History

Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6

* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (741 commits) staging:iio:meter:ade7753 should be 16 bit read not 8 bit for mode register. staging:iio:kfifo_buf fix double initialization of the ring device structure. staging:iio:accel:lis3l02dq: fix incorrect pointer passed to spi_set_drvdata. staging:iio:imu fix missing register table index for some channels spectra: enable device before poking it staging: rts_pstor: Fix a miswriting staging/lirc_bt829: Return -ENODEV when no hardware is found. staging/lirc_parallel: remove pointless prototypes. staging/lirc_parallel: fix panic on rmmod staging:iio:adc:ad7476: Incorrect pointer into spi_set_drvdata. Staging: zram: Fix kunmapping order Revert "gma500: Fix dependencies" gma500: Add medfield header gma500: wire up the mrst i2c bus from chip_info gma500: Fix DPU build gma500: Clean up the DPU config and make it runtime gma500: resync with Medfield progress gma500: Use the mrst helpers and power control for mode commit gma500@ Fix backlight range error gma500: More Moorestown muddle meddling means MM maybe might modeset ... Fix up fairly trivial conflicts all over, mostly due to header file cleanup conflicts, but some deleted files and some just context changes: - Documentation/feature-removal-schedule.txt - drivers/staging/bcm/headers.h - drivers/staging/brcm80211/brcmfmac/dhd_linux.c - drivers/staging/brcm80211/brcmfmac/dhd_sdio.c - drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h - drivers/staging/brcm80211/brcmfmac/wl_iw.c - drivers/staging/et131x/et131x_netdev.c - drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c - drivers/staging/rtl8192e/r8192E.h - drivers/staging/usbip/userspace/src/utils.h

Linus Torvalds committed 15 years ago

Commit 13805162 parents d5ef642 e1703b3797 files · +49665 −188042Browse files

Unified · Split

771 files
  1. Documentation/feature-removal-schedule.txt +0 −14
  2. MAINTAINERS +141 −8
  3. arch/arm/mach-ux500/board-mop500-u8500uib.c +2 −22
  4. drivers/staging/Kconfig +0 −10
  5. drivers/staging/Makefile +0 −5
  6. drivers/staging/altera-stapl/Kconfig +0 −2
  7. drivers/staging/altera-stapl/Makefile +1 −1
  8. drivers/staging/altera-stapl/altera.c +21 −12
  9. drivers/staging/ath6kl/TODO +1 −1
  10. drivers/staging/ath6kl/os/linux/ar6000_drv.c +41 −15
  11. drivers/staging/ath6kl/os/linux/cfg80211.c +198 −13
  12. drivers/staging/ath6kl/os/linux/include/ar6000_drv.h +11 −8
  13. drivers/staging/ath6kl/os/linux/include/cfg80211.h +11 −0
  14. drivers/staging/ath6kl/os/linux/include/config_linux.h +0 −2
  15. drivers/staging/ath6kl/os/linux/include/ieee80211_ioctl.h +0 −2
  16. drivers/staging/ath6kl/os/linux/include/osapi_linux.h +0 −1
  17. drivers/staging/ath6kl/wmi/wmi.c +3 −3
  18. drivers/staging/bcm/Debug.h +1 −1
  19. drivers/staging/bcm/InterfaceRx.c +2 −2
  20. drivers/staging/bcm/Macros.h +2 −2
  21. drivers/staging/bcm/Misc.c +2 −8
  22. drivers/staging/bcm/PHSModule.c +12 −12
  23. drivers/staging/bcm/PHSModule.h +1 −1
  24. drivers/staging/bcm/headers.h +0 −1
  25. drivers/staging/bcm/sort.c +33 −44
  26. drivers/staging/brcm80211/Makefile +2 −2
  27. drivers/staging/brcm80211/README +1 −64
  28. drivers/staging/brcm80211/TODO +5 −7
  29. drivers/staging/brcm80211/brcmfmac/Makefile +5 −22
  30. drivers/staging/brcm80211/brcmfmac/README +0 −2
  31. drivers/staging/brcm80211/brcmfmac/aiutils.c +0 −1
  32. drivers/staging/brcm80211/brcmfmac/bcmcdc.h +0 −98
  33. drivers/staging/brcm80211/brcmfmac/bcmchip.h +3 −6
  34. drivers/staging/brcm80211/brcmfmac/bcmsdbus.h +0 −113
  35. drivers/staging/brcm80211/brcmfmac/bcmsdh.c +321 −310
  36. drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c +0 −386
  37. drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +441 −484
  38. drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.h +0 −134
  39. drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c +0 −235
  40. drivers/staging/brcm80211/brcmfmac/dhd.h +730 −240
  41. drivers/staging/brcm80211/brcmfmac/dhd_bus.h +36 −40
  42. drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +188 −160
  43. drivers/staging/brcm80211/brcmfmac/dhd_common.c +477 −1129
  44. drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c +0 −158
  45. drivers/staging/brcm80211/brcmfmac/dhd_dbg.h +36 −69
  46. drivers/staging/brcm80211/brcmfmac/dhd_linux.c +554 −1682
  47. drivers/staging/brcm80211/brcmfmac/dhd_linux_sched.c +0 −25
  48. drivers/staging/brcm80211/brcmfmac/dhd_proto.h +24 −39
  49. drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +2564 −2181
  50. drivers/staging/brcm80211/brcmfmac/dhdioctl.h +0 −100
  51. drivers/staging/brcm80211/brcmfmac/dngl_stats.h +0 −32
  52. drivers/staging/brcm80211/brcmfmac/hndrte_armtrap.h +0 −75
  53. drivers/staging/brcm80211/brcmfmac/hndrte_cons.h +0 −62
  54. drivers/staging/brcm80211/brcmfmac/msgtrace.h +0 −61
  55. drivers/staging/brcm80211/brcmfmac/sdio_host.h +347 −0
  56. drivers/staging/brcm80211/brcmfmac/sdioh.h +0 −63
  57. drivers/staging/brcm80211/brcmfmac/sdiovar.h +0 −38
  58. drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +1102 −1378
  59. drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +75 −132
  60. drivers/staging/brcm80211/brcmfmac/wl_iw.c +0 −3689
  61. drivers/staging/brcm80211/brcmfmac/wl_iw.h +0 −142
  62. drivers/staging/brcm80211/brcmsmac/Makefile +22 −23
  63. drivers/staging/brcm80211/brcmsmac/aiutils.c +471 −246
  64. drivers/staging/brcm80211/brcmsmac/aiutils.h +134 −96
  65. drivers/staging/brcm80211/brcmsmac/alloc.c +64 −89
  66. drivers/staging/brcm80211/brcmsmac/alloc.h +3 −2
  67. drivers/staging/brcm80211/brcmsmac/ampdu.c +188 −222
  68. drivers/staging/brcm80211/brcmsmac/ampdu.h +12 −19
  69. drivers/staging/brcm80211/brcmsmac/antsel.c +52 −61
  70. drivers/staging/brcm80211/brcmsmac/antsel.h +8 −8
  71. drivers/staging/brcm80211/brcmsmac/bcmotp.c +0 −936
  72. drivers/staging/brcm80211/brcmsmac/bcmsrom.c +0 −714
  73. drivers/staging/brcm80211/brcmsmac/bmac.c +551 −561
  74. drivers/staging/brcm80211/brcmsmac/bmac.h +174 −0
  75. drivers/staging/brcm80211/brcmsmac/channel.c +298 −296
  76. drivers/staging/brcm80211/brcmsmac/channel.h +47 −35
  77. drivers/staging/brcm80211/brcmsmac/d11.h +81 −79
  78. drivers/staging/brcm80211/brcmsmac/dma.c +362 −201
  79. drivers/staging/brcm80211/brcmsmac/dma.h +85 −61
  80. drivers/staging/brcm80211/brcmsmac/mac80211_if.c +404 −418
  81. drivers/staging/brcm80211/brcmsmac/mac80211_if.h +49 −26
  82. drivers/staging/brcm80211/brcmsmac/main.c +1431 −2858
  83. drivers/staging/brcm80211/brcmsmac/main.h +440 −354
  84. drivers/staging/brcm80211/brcmsmac/nicpci.c +343 −329
  85. drivers/staging/brcm80211/brcmsmac/nicpci.h +85 −0
  86. drivers/staging/brcm80211/brcmsmac/nvram.c +0 −215
  87. drivers/staging/brcm80211/brcmsmac/otp.c +544 −0
  88. drivers/staging/brcm80211/brcmsmac/otp.h +8 −5
  89. drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +318 −400
  90. drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h +294 −0
  91. drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +238 −229
  92. drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +288 −296
  93. drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.h +7 −5
  94. drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +472 −559
  95. drivers/staging/brcm80211/brcmsmac/phy/phy_qmath.c +1 −3
  96. drivers/staging/brcm80211/brcmsmac/phy/phy_qmath.h +5 −3
  97. drivers/staging/brcm80211/brcmsmac/phy/phy_radio.h +3 −3
  98. drivers/staging/brcm80211/brcmsmac/phy/phy_version.h +0 −36
  99. drivers/staging/brcm80211/brcmsmac/phy/phyreg_n.h +7 −7
  100. drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c +26 −27
  101. drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.h +20 −15
  102. drivers/staging/brcm80211/brcmsmac/phy/phytbl_n.c +25 −28
  103. drivers/staging/brcm80211/brcmsmac/phy/phytbl_n.h +11 −10
  104. drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_hal.h +0 −256
  105. drivers/staging/brcm80211/brcmsmac/phy_shim.c +218 −0
  106. drivers/staging/brcm80211/brcmsmac/phy_shim.h +164 −0
  107. drivers/staging/brcm80211/brcmsmac/pmu.c +474 −0
  108. drivers/staging/brcm80211/brcmsmac/pmu.h +19 −25
  109. drivers/staging/brcm80211/brcmsmac/pub.h +254 −173
  110. drivers/staging/brcm80211/brcmsmac/rate.c +103 −104
  111. drivers/staging/brcm80211/brcmsmac/rate.h +60 −56
  112. drivers/staging/brcm80211/brcmsmac/scb.h +18 −13
  113. drivers/staging/brcm80211/brcmsmac/srom.c +807 −83
  114. drivers/staging/brcm80211/brcmsmac/srom.h +6 −6
  115. drivers/staging/brcm80211/brcmsmac/stf.c +79 −125
  116. drivers/staging/brcm80211/brcmsmac/stf.h +42 −0
  117. drivers/staging/brcm80211/brcmsmac/types.h +398 −0
  118. drivers/staging/brcm80211/brcmsmac/ucode_loader.c +42 −38
  119. drivers/staging/brcm80211/brcmsmac/ucode_loader.h +9 −6
  120. drivers/staging/brcm80211/brcmsmac/wl_dbg.h +0 −92
  121. drivers/staging/brcm80211/brcmsmac/wl_export.h +0 −47
  122. drivers/staging/brcm80211/brcmsmac/wlc_ampdu.h +0 −29
  123. drivers/staging/brcm80211/brcmsmac/wlc_bmac.h +0 −178
  124. drivers/staging/brcm80211/brcmsmac/wlc_bsscfg.h +0 −135
  125. drivers/staging/brcm80211/brcmsmac/wlc_cfg.h +0 −280
  126. drivers/staging/brcm80211/brcmsmac/wlc_key.h +0 −140
  127. drivers/staging/brcm80211/brcmsmac/wlc_phy_shim.c +0 −243
  128. drivers/staging/brcm80211/brcmsmac/wlc_phy_shim.h +0 −112
  129. drivers/staging/brcm80211/brcmsmac/wlc_pmu.c +0 −1929
  130. drivers/staging/brcm80211/brcmsmac/wlc_stf.h +0 −38
  131. drivers/staging/brcm80211/brcmutil/Makefile +3 −3
  132. drivers/staging/brcm80211/brcmutil/utils.c +72 −81
  133. drivers/staging/brcm80211/brcmutil/wifi.c +7 −13
  134. drivers/staging/brcm80211/include/aidmp.h +0 −374
  135. drivers/staging/brcm80211/include/bcmdefs.h +0 −150
  136. drivers/staging/brcm80211/include/bcmdevs.h +0 −124
  137. drivers/staging/brcm80211/include/bcmnvram.h +0 −153
  138. drivers/staging/brcm80211/include/bcmsdh.h +0 −205
  139. drivers/staging/brcm80211/include/bcmsdpcm.h +0 −208
  140. drivers/staging/brcm80211/include/bcmsrom_fmt.h +0 −367
  141. drivers/staging/brcm80211/include/bcmutils.h +0 −500
  142. drivers/staging/brcm80211/include/brcm_hw_ids.h +59 −0
  143. drivers/staging/brcm80211/include/brcmu_utils.h +301 −0
  144. drivers/staging/brcm80211/include/brcmu_wifi.h +101 −25
  145. drivers/staging/brcm80211/include/chipcommon.h +281 −0
  146. drivers/staging/brcm80211/include/defs.h +112 −0
  147. drivers/staging/brcm80211/include/hndsoc.h +0 −199
  148. drivers/staging/brcm80211/include/nicpci.h +0 −79
  149. drivers/staging/brcm80211/include/pci_core.h +0 −122
  150. drivers/staging/brcm80211/include/pcicfg.h +0 −50
  151. drivers/staging/brcm80211/include/pcie_core.h +0 −299
  152. drivers/staging/brcm80211/include/proto/802.11.h +0 −200
  153. drivers/staging/brcm80211/include/proto/bcmeth.h +0 −44
  154. drivers/staging/brcm80211/include/proto/bcmevent.h +0 −207
  155. drivers/staging/brcm80211/include/sbchipc.h +0 −1588
  156. drivers/staging/brcm80211/include/sbconfig.h +0 −272
  157. drivers/staging/brcm80211/include/sbhnddma.h +0 −315
  158. drivers/staging/brcm80211/include/sbsdio.h +0 −152
  159. drivers/staging/brcm80211/include/sbsdpcmdev.h +0 −281
  160. drivers/staging/brcm80211/include/sdio.h +0 −552
  161. drivers/staging/brcm80211/include/soc.h +95 −0
  162. drivers/staging/brcm80211/include/wlioctl.h +0 −1365
  163. drivers/staging/comedi/Kconfig +10 −0
  164. drivers/staging/comedi/comedi.h +5 −1
  165. drivers/staging/comedi/comedi_fops.c +8 −10
  166. drivers/staging/comedi/comedidev.h +0 −3
  167. drivers/staging/comedi/drivers.c +4 −0
  168. drivers/staging/comedi/drivers/Makefile +1 −0
  169. drivers/staging/comedi/drivers/addi-data/addi_common.c +1 −1
  170. drivers/staging/comedi/drivers/adl_pci9118.c +1 −0
  171. drivers/staging/comedi/drivers/adv_pci1723.c +1 −1
  172. drivers/staging/comedi/drivers/das1800.c +12 −16
  173. drivers/staging/comedi/drivers/dt282x.c +1 −0
  174. drivers/staging/comedi/drivers/dyna_pci10xx.c +462 −0
  175. drivers/staging/comedi/drivers/ni_at_a2150.c +1 −0
  176. drivers/staging/comedi/drivers/ni_daq_700.c +5 −5
  177. drivers/staging/comedi/drivers/ni_labpc.c +34 −3
  178. drivers/staging/comedi/drivers/pcl812.c +1 −0
  179. drivers/staging/comedi/drivers/pcl816.c +1 −0
  180. drivers/staging/comedi/drivers/pcl818.c +1 −0
  181. drivers/staging/comedi/drivers/rtd520.c +13 −9
  182. drivers/staging/comedi/drivers/serial2002.c +16 −29
  183. drivers/staging/comedi/drivers/unioxx5.c +29 −17
  184. drivers/staging/comedi/drivers/usbdux.c +3 −4
  185. drivers/staging/cs5535_gpio/Kconfig +0 −11
  186. drivers/staging/cs5535_gpio/Makefile +0 −1
  187. drivers/staging/cs5535_gpio/TODO +0 −6
  188. drivers/staging/cs5535_gpio/cs5535_gpio.c +0 −260
  189. drivers/staging/cxd2099/cxd2099.c +0 −1
  190. drivers/staging/cxt1e1/sbecom_inline_linux.h +0 −1
  191. drivers/staging/dt3155v4l/Kconfig +9 −1
  192. drivers/staging/dt3155v4l/dt3155v4l.c +169 −317
  193. drivers/staging/dt3155v4l/dt3155v4l.h +6 −16
  194. drivers/staging/easycap/Kconfig +2 −30
  195. drivers/staging/easycap/Makefile +1 −3
  196. drivers/staging/easycap/README +2 −26
  197. drivers/staging/easycap/easycap.h +0 −46
  198. drivers/staging/easycap/easycap_ioctl.c +1 −16
  199. drivers/staging/easycap/easycap_main.c +7 −149
  200. drivers/staging/easycap/easycap_settings.c +1 −1
  201. drivers/staging/easycap/easycap_sound.c +0 −35
  202. drivers/staging/easycap/easycap_sound_oss.c +0 −954
  203. drivers/staging/echo/echo.c +2 −9
  204. drivers/staging/et131x/et1310_address_map.h +137 −186
  205. drivers/staging/et131x/et1310_mac.c +149 −116
  206. drivers/staging/et131x/et1310_phy.c +16 −17
  207. drivers/staging/et131x/et1310_phy.h +58 −111
  208. drivers/staging/et131x/et1310_pm.c +2 −2
  209. drivers/staging/et131x/et1310_rx.c +106 −108
  210. drivers/staging/et131x/et1310_tx.c +6 −6
  211. drivers/staging/et131x/et131x.h +2 −2
  212. drivers/staging/et131x/et131x_adapter.h +8 −13
  213. drivers/staging/et131x/et131x_defs.h +0 −1
  214. drivers/staging/et131x/et131x_initpci.c +17 −17
  215. drivers/staging/et131x/et131x_isr.c +10 −10
  216. drivers/staging/et131x/et131x_netdev.c +61 −78
  217. drivers/staging/ft1000/ft1000-pcmcia/ft1000.conf +0 −14
  218. drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +80 −400
  219. drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +20 −170
  220. drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h +0 −66
  221. drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +198 −363
  222. drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +84 −140
  223. drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +12 −14
  224. drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h +0 −32
  225. drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +10 −403
  226. drivers/staging/ft1000/ft1000.h +252 −0
  227. drivers/staging/generic_serial/Kconfig +0 −45
  228. drivers/staging/generic_serial/Makefile +0 −6
  229. drivers/staging/generic_serial/TODO +0 −6
  230. drivers/staging/generic_serial/generic_serial.c +0 −844
  231. drivers/staging/generic_serial/rio/Makefile +0 −12
  232. drivers/staging/generic_serial/rio/board.h +0 −132
  233. drivers/staging/generic_serial/rio/cirrus.h +0 −210
  234. drivers/staging/generic_serial/rio/cmdblk.h +0 −53
  235. drivers/staging/generic_serial/rio/cmdpkt.h +0 −177
  236. drivers/staging/generic_serial/rio/daemon.h +0 −307
  237. drivers/staging/generic_serial/rio/errors.h +0 −98
  238. drivers/staging/generic_serial/rio/func.h +0 −143
  239. drivers/staging/generic_serial/rio/host.h +0 −123
  240. drivers/staging/generic_serial/rio/link.h +0 −96
  241. drivers/staging/generic_serial/rio/linux_compat.h +0 −77
  242. drivers/staging/generic_serial/rio/map.h +0 −98
  243. drivers/staging/generic_serial/rio/param.h +0 −55
  244. drivers/staging/generic_serial/rio/parmmap.h +0 −81
  245. drivers/staging/generic_serial/rio/pci.h +0 −72
  246. drivers/staging/generic_serial/rio/phb.h +0 −142
  247. drivers/staging/generic_serial/rio/pkt.h +0 −77
  248. drivers/staging/generic_serial/rio/port.h +0 −179
  249. drivers/staging/generic_serial/rio/protsts.h +0 −110
  250. drivers/staging/generic_serial/rio/rio.h +0 −208
  251. drivers/staging/generic_serial/rio/rio_linux.c +0 −1204
  252. drivers/staging/generic_serial/rio/rio_linux.h +0 −197
  253. drivers/staging/generic_serial/rio/rioboard.h +0 −275
  254. drivers/staging/generic_serial/rio/rioboot.c +0 −1113
  255. drivers/staging/generic_serial/rio/riocmd.c +0 −939
  256. drivers/staging/generic_serial/rio/rioctrl.c +0 −1504
  257. drivers/staging/generic_serial/rio/riodrvr.h +0 −138
  258. drivers/staging/generic_serial/rio/rioinfo.h +0 −92
  259. drivers/staging/generic_serial/rio/rioinit.c +0 −421
  260. drivers/staging/generic_serial/rio/riointr.c +0 −645
  261. drivers/staging/generic_serial/rio/rioioctl.h +0 −57
  262. drivers/staging/generic_serial/rio/rioparam.c +0 −663
  263. drivers/staging/generic_serial/rio/rioroute.c +0 −1039
  264. drivers/staging/generic_serial/rio/riospace.h +0 −154
  265. drivers/staging/generic_serial/rio/riotable.c +0 −941
  266. drivers/staging/generic_serial/rio/riotty.c +0 −654
  267. drivers/staging/generic_serial/rio/route.h +0 −101
  268. drivers/staging/generic_serial/rio/rup.h +0 −69
  269. drivers/staging/generic_serial/rio/unixrup.h +0 −51
  270. drivers/staging/generic_serial/ser_a2232.c +0 −831
  271. drivers/staging/generic_serial/ser_a2232.h +0 −202
  272. drivers/staging/generic_serial/ser_a2232fw.ax +0 −529
  273. drivers/staging/generic_serial/ser_a2232fw.h +0 −306
  274. drivers/staging/generic_serial/sx.c +0 −2894
  275. drivers/staging/generic_serial/sx.h +0 −201
  276. drivers/staging/generic_serial/sxboards.h +0 −206
  277. drivers/staging/generic_serial/sxwindow.h +0 −393
  278. drivers/staging/generic_serial/vme_scc.c +0 −1145
  279. drivers/staging/gma500/Kconfig +24 −3
  280. drivers/staging/gma500/Makefile +37 −11
  281. drivers/staging/gma500/TODO +9 −20
  282. drivers/staging/gma500/accel_2d.c +150 −148
  283. drivers/staging/gma500/backlight.c +49 −0
  284. drivers/staging/gma500/cdv_device.c +351 −0
  285. drivers/staging/gma500/cdv_device.h +36 −0
  286. drivers/staging/gma500/cdv_intel_crt.c +326 −0
  287. drivers/staging/gma500/cdv_intel_display.c +1508 −0
  288. drivers/staging/gma500/cdv_intel_hdmi.c +376 −0
  289. drivers/staging/gma500/cdv_intel_lvds.c +721 −0
  290. drivers/staging/gma500/displays/hdmi.h +33 −0
  291. drivers/staging/gma500/displays/pyr_cmd.h +34 −0
  292. drivers/staging/gma500/displays/pyr_vid.h +34 −0
  293. drivers/staging/gma500/displays/tmd_cmd.h +34 −0
  294. drivers/staging/gma500/displays/tmd_vid.h +34 −0
  295. drivers/staging/gma500/displays/tpo_cmd.h +35 −0
  296. drivers/staging/gma500/displays/tpo_vid.h +33 −0
  297. drivers/staging/gma500/framebuffer.c +245 −285
  298. drivers/staging/gma500/framebuffer.h +5 −6
  299. drivers/staging/gma500/gem.c +70 −95
  300. drivers/staging/gma500/gem_glue.c +110 −0
  301. drivers/staging/gma500/gem_glue.h +4 −0
  302. drivers/staging/gma500/gtt.c +104 −143
  303. drivers/staging/gma500/gtt.h +7 −7
  304. drivers/staging/gma500/intel_bios.c +11 −14
  305. drivers/staging/gma500/intel_bios.h +0 −0
  306. drivers/staging/gma500/intel_i2c.c +0 −0
  307. drivers/staging/gma500/intel_opregion.c +15 −13
  308. drivers/staging/gma500/mdfld_device.c +714 −0
  309. drivers/staging/gma500/mdfld_dsi_dbi.c +760 −0
  310. drivers/staging/gma500/mdfld_dsi_dbi.h +176 −0
  311. drivers/staging/gma500/mdfld_dsi_dbi_dpu.c +778 −0
  312. drivers/staging/gma500/mdfld_dsi_dbi_dpu.h +154 −0
  313. drivers/staging/gma500/mdfld_dsi_dpi.c +800 −0
  314. drivers/staging/gma500/mdfld_dsi_dpi.h +78 −0
  315. drivers/staging/gma500/mdfld_dsi_output.c +1011 −0
  316. drivers/staging/gma500/mdfld_dsi_output.h +138 −0
  317. drivers/staging/gma500/mdfld_dsi_pkg_sender.c +1484 −0
  318. drivers/staging/gma500/mdfld_dsi_pkg_sender.h +184 −0
  319. drivers/staging/gma500/mdfld_intel_display.c +1402 −0
  320. drivers/staging/gma500/mdfld_msic.h +31 −0
  321. drivers/staging/gma500/mdfld_output.c +170 −0
  322. drivers/staging/gma500/mdfld_output.h +41 −0
  323. drivers/staging/gma500/mdfld_pyr_cmd.c +558 −0
  324. drivers/staging/gma500/mdfld_tmd_vid.c +206 −0
  325. drivers/staging/gma500/mdfld_tpo_cmd.c +509 −0
  326. drivers/staging/gma500/mdfld_tpo_vid.c +140 −0
  327. drivers/staging/gma500/medfield.h +270 −0
  328. drivers/staging/gma500/mid_bios.c +269 −0
  329. drivers/staging/gma500/mid_bios.h +21 −0
  330. drivers/staging/gma500/mmu.c +0 −0
  331. drivers/staging/gma500/mrst.h +54 −19
  332. drivers/staging/gma500/mrst_crtc.c +11 −20
  333. drivers/staging/gma500/mrst_device.c +634 −0
  334. drivers/staging/gma500/mrst_hdmi.c +852 −0
  335. drivers/staging/gma500/mrst_hdmi_i2c.c +327 −0
  336. drivers/staging/gma500/mrst_lvds.c +64 −28
  337. drivers/staging/gma500/power.c +32 −205
  338. drivers/staging/gma500/power.h +3 −3
  339. drivers/staging/gma500/psb_bl.c +0 −227
  340. drivers/staging/gma500/psb_device.c +353 −0
  341. drivers/staging/gma500/psb_drm.h +48 −104
  342. drivers/staging/gma500/psb_drv.c +110 −346
  343. drivers/staging/gma500/psb_drv.h +299 −195
  344. drivers/staging/gma500/psb_intel_display.c +56 −115
  345. drivers/staging/gma500/psb_intel_display.h +3 −0
  346. drivers/staging/gma500/psb_intel_drv.h +8 −16
  347. drivers/staging/gma500/psb_intel_lvds.c +56 −92
  348. drivers/staging/gma500/psb_intel_reg.h +621 −523
  349. drivers/staging/gma500/psb_intel_sdvo.c +15 −20
  350. drivers/staging/gma500/psb_intel_sdvo_regs.h +7 −7
  351. drivers/staging/gma500/psb_irq.c +70 −29
  352. drivers/staging/gma500/psb_irq.h +2 −6
  353. drivers/staging/gma500/psb_lid.c +3 −3
  354. drivers/staging/gma500/psb_reg.h +418 −424
  355. drivers/staging/hv/blkvsc_drv.c +23 −19
  356. drivers/staging/hv/channel.c +31 −82
  357. drivers/staging/hv/channel_mgmt.c +1 −7
  358. drivers/staging/hv/connection.c +7 −45
  359. drivers/staging/hv/hv.c +2 −2
  360. drivers/staging/hv/hv_mouse.c +0 −1
  361. drivers/staging/hv/hv_timesource.c +0 −1
  362. drivers/staging/hv/hyperv.h +45 −41
  363. drivers/staging/hv/hyperv_net.h +2 −12
  364. drivers/staging/hv/hyperv_vmbus.h +0 −2
  365. drivers/staging/hv/netvsc.c +6 −167
  366. drivers/staging/hv/netvsc_drv.c +23 −37
  367. drivers/staging/hv/ring_buffer.c +4 −2
  368. drivers/staging/hv/rndis_filter.c +21 −38
  369. drivers/staging/hv/storvsc.c +4 −4
  370. drivers/staging/hv/storvsc_drv.c +31 −57
  371. drivers/staging/hv/vmbus_drv.c +34 −102
  372. drivers/staging/iio/Documentation/sysfs-bus-iio-light +8 −0
  373. drivers/staging/iio/accel/adis16201.h +5 −7
  374. drivers/staging/iio/accel/adis16201_core.c +55 −78
  375. drivers/staging/iio/accel/adis16201_ring.c +4 −4
  376. drivers/staging/iio/accel/adis16201_trigger.c +5 −6
  377. drivers/staging/iio/accel/adis16203.h +5 −7
  378. drivers/staging/iio/accel/adis16203_core.c +31 −54
  379. drivers/staging/iio/accel/adis16203_ring.c +4 −4
  380. drivers/staging/iio/accel/adis16203_trigger.c +8 −9
  381. drivers/staging/iio/accel/adis16204.h +5 −7
  382. drivers/staging/iio/accel/adis16204_core.c +30 −54
  383. drivers/staging/iio/accel/adis16204_ring.c +4 −4
  384. drivers/staging/iio/accel/adis16204_trigger.c +5 −6
  385. drivers/staging/iio/accel/adis16209.h +5 −7
  386. drivers/staging/iio/accel/adis16209_core.c +29 −53
  387. drivers/staging/iio/accel/adis16209_ring.c +4 −4
  388. drivers/staging/iio/accel/adis16209_trigger.c +8 −9
  389. drivers/staging/iio/accel/adis16220.h +4 −10
  390. drivers/staging/iio/accel/adis16220_core.c +39 −66
  391. drivers/staging/iio/accel/adis16240.h +6 −8
  392. drivers/staging/iio/accel/adis16240_core.c +30 −52
  393. drivers/staging/iio/accel/adis16240_ring.c +4 −4
  394. drivers/staging/iio/accel/adis16240_trigger.c +8 −9
  395. drivers/staging/iio/accel/kxsd9.c +26 −76
  396. drivers/staging/iio/accel/lis3l02dq_core.c +1 −1
  397. drivers/staging/iio/accel/sca3000.h +0 −1
  398. drivers/staging/iio/accel/sca3000_core.c +46 −54
  399. drivers/staging/iio/accel/sca3000_ring.c +7 −7
  400. drivers/staging/iio/adc/Kconfig +14 −0
  401. drivers/staging/iio/adc/Makefile +1 −0
  402. drivers/staging/iio/adc/ad7150.c +41 −50
  403. drivers/staging/iio/adc/ad7152.c +32 −41
  404. drivers/staging/iio/adc/ad7291.c +38 −48
  405. drivers/staging/iio/adc/ad7314.c +19 −29
  406. drivers/staging/iio/adc/ad7476.h +2 −3
  407. drivers/staging/iio/adc/ad7476_core.c +41 −43
  408. drivers/staging/iio/adc/ad7476_ring.c +5 −5
  409. drivers/staging/iio/adc/ad7745.c +35 −44
  410. drivers/staging/iio/adc/ad7793.c +987 −0
  411. drivers/staging/iio/adc/ad7793.h +107 −0
  412. drivers/staging/iio/adc/ad7816.c +33 −41
  413. drivers/staging/iio/adc/ad7887_core.c +1 −2
  414. drivers/staging/iio/adc/ad7887_ring.c +3 −3
  415. drivers/staging/iio/adc/ad799x_core.c +6 −7
  416. drivers/staging/iio/adc/ad799x_ring.c +2 −2
  417. drivers/staging/iio/adc/adt7310.c +42 −52
  418. drivers/staging/iio/adc/adt7410.c +38 −48
  419. drivers/staging/iio/adc/adt75.c +56 −67
  420. drivers/staging/iio/adc/max1363_core.c +11 −9
  421. drivers/staging/iio/addac/adt7316.c +107 −117
  422. drivers/staging/iio/dac/Kconfig +11 −0
  423. drivers/staging/iio/dac/Makefile +1 −0
  424. drivers/staging/iio/dac/ad5446.c +38 −44
  425. drivers/staging/iio/dac/ad5446.h +0 −2
  426. drivers/staging/iio/dac/ad5504.c +41 −48
  427. drivers/staging/iio/dac/ad5504.h +0 −2
  428. drivers/staging/iio/dac/ad5624r.h +0 −1
  429. drivers/staging/iio/dac/ad5624r_spi.c +39 −45
  430. drivers/staging/iio/dac/ad5686.c +497 −0
  431. drivers/staging/iio/dac/ad5791.c +55 −57
  432. drivers/staging/iio/dac/ad5791.h +0 −2
  433. drivers/staging/iio/dac/max517.c +14 −26
  434. drivers/staging/iio/dds/ad5930.c +12 −25
  435. drivers/staging/iio/dds/ad9832.c +32 −37
  436. drivers/staging/iio/dds/ad9832.h +0 −2
  437. drivers/staging/iio/dds/ad9834.c +37 −44
  438. drivers/staging/iio/dds/ad9834.h +0 −2
  439. drivers/staging/iio/dds/ad9850.c +12 −25
  440. drivers/staging/iio/dds/ad9852.c +14 −24
  441. drivers/staging/iio/dds/ad9910.c +12 −24
  442. drivers/staging/iio/dds/ad9951.c +13 −23
  443. drivers/staging/iio/gyro/adis16060_core.c +25 −34
  444. drivers/staging/iio/gyro/adis16080_core.c +19 −29
  445. drivers/staging/iio/gyro/adis16130_core.c +20 −30
  446. drivers/staging/iio/gyro/adis16260.h +8 −10
  447. drivers/staging/iio/gyro/adis16260_core.c +38 −62
  448. drivers/staging/iio/gyro/adis16260_ring.c +4 −5
  449. drivers/staging/iio/gyro/adis16260_trigger.c +7 −8
  450. drivers/staging/iio/gyro/adxrs450.h +6 −7
  451. drivers/staging/iio/gyro/adxrs450_core.c +24 −47
  452. drivers/staging/iio/iio.h +16 −0
  453. drivers/staging/iio/imu/adis16400.h +3 −0
  454. drivers/staging/iio/imu/adis16400_core.c +27 −23
  455. drivers/staging/iio/industrialio-core.c +35 −12
  456. drivers/staging/iio/industrialio-trigger.c +19 −1
  457. drivers/staging/iio/kfifo_buf.c +0 −2
  458. drivers/staging/iio/light/Kconfig +1 −1
  459. drivers/staging/iio/light/isl29018.c +105 −92
  460. drivers/staging/iio/light/tsl2563.c +56 −69
  461. drivers/staging/iio/magnetometer/ak8975.c +40 −51
  462. drivers/staging/iio/magnetometer/hmc5843.c +21 −29
  463. drivers/staging/iio/meter/ade7753.c +30 −53
  464. drivers/staging/iio/meter/ade7753.h +4 −6
  465. drivers/staging/iio/meter/ade7754.c +29 −51
  466. drivers/staging/iio/meter/ade7754.h +5 −7
  467. drivers/staging/iio/meter/ade7759.c +27 −53
  468. drivers/staging/iio/meter/ade7759.h +5 −7
  469. drivers/staging/iio/meter/ade7854-i2c.c +19 −20
  470. drivers/staging/iio/meter/ade7854-spi.c +20 −20
  471. drivers/staging/iio/meter/ade7854.c +24 −52
  472. drivers/staging/iio/meter/ade7854.h +18 −18
  473. drivers/staging/iio/resolver/Kconfig +0 −27
  474. drivers/staging/iio/resolver/ad2s120x.c +31 −165
  475. drivers/staging/iio/resolver/ad2s1210.c +399 −457
  476. drivers/staging/iio/resolver/ad2s1210.h +17 −0
  477. drivers/staging/iio/resolver/ad2s90.c +12 −36
  478. drivers/staging/iio/trigger.h +28 −24
  479. drivers/staging/iio/trigger/iio-trig-gpio.c +1 −1
  480. drivers/staging/intel_sst/intel_sst.c +4 −1
  481. drivers/staging/intel_sst/intel_sst_app_interface.c +3 −1
  482. drivers/staging/intel_sst/intel_sst_common.h +2 −0
  483. drivers/staging/intel_sst/intel_sst_drv_interface.c +10 −0
  484. drivers/staging/intel_sst/intelmid_v2_control.c +1 −1
  485. drivers/staging/keucr/Kconfig +3 −3
  486. drivers/staging/keucr/Makefile +0 −2
  487. drivers/staging/keucr/init.c +1 −70
  488. drivers/staging/keucr/init.h +0 −773
  489. drivers/staging/keucr/ms.c +0 −1034
  490. drivers/staging/keucr/ms.h +0 −401
  491. drivers/staging/keucr/msscsi.c +0 −344
  492. drivers/staging/keucr/transport.c +1 −3
  493. drivers/staging/keucr/transport.h +0 −46
  494. drivers/staging/keucr/usb.c +1 −4
  495. drivers/staging/keucr/usb.h +1 −2
  496. drivers/staging/lirc/lirc_bt829.c +2 −2
  497. drivers/staging/lirc/lirc_parallel.c +3 −3
  498. drivers/staging/lirc/lirc_ttusbir.c +0 −1
  499. drivers/staging/lirc/lirc_zilog.c +0 −2
  500. drivers/staging/mei/init.c +72 −77
  501. drivers/staging/mei/interface.c +4 −5
  502. drivers/staging/mei/interrupt.c +23 −24
  503. drivers/staging/mei/iorw.c +16 −16
  504. drivers/staging/mei/main.c +16 −23
  505. drivers/staging/mei/mei_dev.h +63 −60
  506. drivers/staging/mei/wd.c +9 −9
  507. drivers/staging/msm/Kconfig +0 −124
  508. drivers/staging/msm/Makefile +0 −88
  509. drivers/staging/msm/TODO +0 −3
  510. drivers/staging/msm/ebi2_l2f.c +0 −569
  511. drivers/staging/msm/ebi2_lcd.c +0 −250
  512. drivers/staging/msm/ebi2_tmd20.c +0 −1122
  513. drivers/staging/msm/hdmi_sii9022.c +0 −248
  514. drivers/staging/msm/lcdc.c +0 −239
  515. drivers/staging/msm/lcdc_external.c +0 −54
  516. drivers/staging/msm/lcdc_gordon.c +0 −446
  517. drivers/staging/msm/lcdc_panel.c +0 −88
  518. drivers/staging/msm/lcdc_prism.c +0 −64
  519. drivers/staging/msm/lcdc_sharp_wvga_pt.c +0 −290
  520. drivers/staging/msm/lcdc_st15.c +0 −237
  521. drivers/staging/msm/lcdc_toshiba_wvga_pt.c +0 −374
  522. drivers/staging/msm/logo.c +0 −98
  523. drivers/staging/msm/mddi.c +0 −375
  524. drivers/staging/msm/mddi_ext.c +0 −320
  525. drivers/staging/msm/mddi_ext_lcd.c +0 −91
  526. drivers/staging/msm/mddi_prism.c +0 −114
  527. drivers/staging/msm/mddi_sharp.c +0 −892
  528. drivers/staging/msm/mddi_toshiba.c +0 −1741
  529. drivers/staging/msm/mddi_toshiba.h +0 −36
  530. drivers/staging/msm/mddi_toshiba_vga.c +0 −136
  531. drivers/staging/msm/mddi_toshiba_wvga_pt.c +0 −64
  532. drivers/staging/msm/mddihost.c +0 −377
  533. drivers/staging/msm/mddihost.h +0 −207
  534. drivers/staging/msm/mddihost_e.c +0 −63
  535. drivers/staging/msm/mddihosti.c +0 −2239
  536. drivers/staging/msm/mddihosti.h +0 −531
  537. drivers/staging/msm/mdp.c +0 −1113
  538. drivers/staging/msm/mdp.h +0 −679
  539. drivers/staging/msm/mdp4.h +0 −336
  540. drivers/staging/msm/mdp4_debugfs.c +0 −175
  541. drivers/staging/msm/mdp4_overlay.c +0 −1259
  542. drivers/staging/msm/mdp4_overlay_lcdc.c +0 −313
  543. drivers/staging/msm/mdp4_overlay_mddi.c +0 −254
  544. drivers/staging/msm/mdp4_util.c +0 −1686
  545. drivers/staging/msm/mdp_cursor.c +0 −104
  546. drivers/staging/msm/mdp_dma.c +0 −561
  547. drivers/staging/msm/mdp_dma_lcdc.c +0 −379
  548. drivers/staging/msm/mdp_dma_s.c +0 −139
  549. drivers/staging/msm/mdp_dma_tv.c +0 −142
  550. drivers/staging/msm/mdp_hw_init.c +0 −720
  551. drivers/staging/msm/mdp_ppp.c +0 −1502
  552. drivers/staging/msm/mdp_ppp_dq.c +0 −347
  553. drivers/staging/msm/mdp_ppp_dq.h +0 −69
  554. drivers/staging/msm/mdp_ppp_v20.c +0 −2486
  555. drivers/staging/msm/mdp_ppp_v31.c +0 −828
  556. drivers/staging/msm/mdp_vsync.c +0 −389
  557. drivers/staging/msm/memory.c +0 −214
  558. drivers/staging/msm/memory_ll.h +0 −61
  559. drivers/staging/msm/msm_fb.c +0 −2354
  560. drivers/staging/msm/msm_fb.h +0 −158
  561. drivers/staging/msm/msm_fb_bl.c +0 −79
  562. drivers/staging/msm/msm_fb_def.h +0 −181
  563. drivers/staging/msm/msm_fb_panel.c +0 −136
  564. drivers/staging/msm/msm_fb_panel.h +0 −129
  565. drivers/staging/msm/msm_mdp.h +0 −245
  566. drivers/staging/msm/staging-devices.c +0 −312
  567. drivers/staging/msm/tv_ntsc.c +0 −163
  568. drivers/staging/msm/tv_pal.c +0 −213
  569. drivers/staging/msm/tvenc.c +0 −296
  570. drivers/staging/msm/tvenc.h +0 −101
  571. drivers/staging/octeon/ethernet-mdio.c +14 −13
  572. drivers/staging/octeon/ethernet-rgmii.c +17 −16
  573. drivers/staging/octeon/ethernet-rx.c +13 −11
  574. drivers/staging/octeon/ethernet-sgmii.c +8 −6
  575. drivers/staging/octeon/ethernet-tx.c +6 −5
  576. drivers/staging/octeon/ethernet-util.h +0 −4
  577. drivers/staging/octeon/ethernet-xaui.c +12 −10
  578. drivers/staging/panel/panel.c +0 −1
  579. drivers/staging/rtl8187se/ieee80211/ieee80211.h +0 −1
  580. drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c +0 −1
  581. drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +0 −1
  582. drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c +0 −1
  583. drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c +0 −1
  584. drivers/staging/rtl8187se/ieee80211/ieee80211_module.c +0 −1
  585. drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +2 −6
  586. drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c +1 −1
  587. drivers/staging/rtl8192e/dot11d.h +12 −11
  588. drivers/staging/rtl8192e/ieee80211/ieee80211.h +0 −1
  589. drivers/staging/rtl8192e/ieee80211/ieee80211_crypt.c +0 −1
  590. drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_ccmp.c +0 −1
  591. drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_tkip.c +0 −1
  592. drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_wep.c +0 −1
  593. drivers/staging/rtl8192e/ieee80211/ieee80211_module.c +0 −1
  594. drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c +0 −1
  595. drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c +1 −2
  596. drivers/staging/rtl8192e/ieee80211/ieee80211_tx.c +1 −2
  597. drivers/staging/rtl8192e/r8192E.h +0 −1
  598. drivers/staging/rtl8192e/r8192E_core.c +6 −0
  599. drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 −1
  600. drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +0 −1
  601. drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +0 −1
  602. drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +0 −1
  603. drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +0 −1
  604. drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +0 −1
  605. drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +0 −1
  606. drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +1 −6
  607. drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +1 −1
  608. drivers/staging/rtl8192u/r8192U.h +0 −1
  609. drivers/staging/rtl8192u/r8192U_core.c +0 −4
  610. drivers/staging/rtl8712/ieee80211.h +16 −15
  611. drivers/staging/rtl8712/osdep_service.h +1 −5
  612. drivers/staging/rtl8712/rtl8712_hal.h +1 −1
  613. drivers/staging/rtl8712/wifi.h +4 −3
  614. drivers/staging/rts_pstor/ms.c +1 −2
  615. drivers/staging/rts_pstor/rtsx.h +0 −1
  616. drivers/staging/rts_pstor/rtsx_chip.c +2 −4
  617. drivers/staging/rts_pstor/sd.c +42 −22
  618. drivers/staging/rts_pstor/sd.h +5 −0
  619. drivers/staging/sep/sep_driver.c +3 −3
  620. drivers/staging/sep/sep_driver_config.h +1 −1
  621. drivers/staging/speakup/main.c +0 −1
  622. drivers/staging/speakup/speakup.h +0 −1
  623. drivers/staging/speakup/speakup_soft.c +1 −8
  624. drivers/staging/spectra/lld_nand.c +10 −8
  625. drivers/staging/ste_rmi4/Makefile +1 −0
  626. drivers/staging/ste_rmi4/board-mop500-u8500uib-rmi4.c +32 −0
  627. drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +20 −23
  628. drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h +0 −2
  629. drivers/staging/tidspbridge/include/dspbridge/host_os.h +0 −1
  630. drivers/staging/tm6000/tm6000-alsa.c +4 −4
  631. drivers/staging/tm6000/tm6000-cards.c +1 −6
  632. drivers/staging/tm6000/tm6000-dvb.c +5 −5
  633. drivers/staging/tm6000/tm6000-i2c.c +1 −1
  634. drivers/staging/tm6000/tm6000-input.c +1 −2
  635. drivers/staging/tm6000/tm6000-video.c +20 −23
  636. drivers/staging/tm6000/tm6000.h +1 −2
  637. drivers/staging/tty/Kconfig +0 −87
  638. drivers/staging/tty/Makefile +0 −7
  639. drivers/staging/tty/TODO +0 −6
  640. drivers/staging/tty/cd1865.h +0 −263
  641. drivers/staging/tty/digi1.h +0 −100
  642. drivers/staging/tty/digiFep1.h +0 −136
  643. drivers/staging/tty/digiPCI.h +0 −42
  644. drivers/staging/tty/epca.c +0 −2784
  645. drivers/staging/tty/epca.h +0 −158
  646. drivers/staging/tty/epcaconfig.h +0 −7
  647. drivers/staging/tty/ip2/Makefile +0 −8
  648. drivers/staging/tty/ip2/i2cmd.c +0 −210
  649. drivers/staging/tty/ip2/i2cmd.h +0 −630
  650. drivers/staging/tty/ip2/i2ellis.c +0 −1403
  651. drivers/staging/tty/ip2/i2ellis.h +0 −566
  652. drivers/staging/tty/ip2/i2hw.h +0 −652
  653. drivers/staging/tty/ip2/i2lib.c +0 −2214
  654. drivers/staging/tty/ip2/i2lib.h +0 −351
  655. drivers/staging/tty/ip2/i2pack.h +0 −364
  656. drivers/staging/tty/ip2/ip2.h +0 −107
  657. drivers/staging/tty/ip2/ip2ioctl.h +0 −35
  658. drivers/staging/tty/ip2/ip2main.c +0 −3234
  659. drivers/staging/tty/ip2/ip2trace.h +0 −42
  660. drivers/staging/tty/ip2/ip2types.h +0 −57
  661. drivers/staging/tty/istallion.c +0 −4507
  662. drivers/staging/tty/riscom8.c +0 −1560
  663. drivers/staging/tty/riscom8.h +0 −91
  664. drivers/staging/tty/riscom8_reg.h +0 −254
  665. drivers/staging/tty/serial167.c +0 −2489
  666. drivers/staging/tty/specialix.c +0 −2368
  667. drivers/staging/tty/specialix_io8.h +0 −140
  668. drivers/staging/tty/stallion.c +0 −4651
  669. drivers/staging/usbip/README +1 −0
  670. drivers/staging/usbip/stub.h +3 −1
  671. drivers/staging/usbip/stub_dev.c +21 −34
  672. drivers/staging/usbip/stub_main.c +87 −106
  673. drivers/staging/usbip/stub_rx.c +3 −3
  674. drivers/staging/usbip/stub_tx.c +7 −8
  675. drivers/staging/usbip/usbip_common.c +17 −18
  676. drivers/staging/usbip/usbip_common.h +122 −116
  677. drivers/staging/usbip/userspace/AUTHORS +1 −0
  678. drivers/staging/usbip/userspace/Makefile.am +2 −7
  679. drivers/staging/usbip/userspace/README +142 −156
  680. drivers/staging/usbip/userspace/cleanup.sh +6 −4
  681. drivers/staging/usbip/userspace/configure.ac +6 −20
  682. drivers/staging/usbip/userspace/libsrc/Makefile.am +4 −4
  683. drivers/staging/usbip/userspace/libsrc/stub_driver.c +0 −391
  684. drivers/staging/usbip/userspace/libsrc/stub_driver.h +0 −36
  685. drivers/staging/usbip/userspace/libsrc/usbip.h +0 −19
  686. drivers/staging/usbip/userspace/libsrc/usbip_common.c +16 −12
  687. drivers/staging/usbip/userspace/libsrc/usbip_common.h +68 −70
  688. drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c +401 −0
  689. drivers/staging/usbip/userspace/libsrc/usbip_host_driver.h +48 −0
  690. drivers/staging/usbip/userspace/libsrc/vhci_driver.c +90 −77
  691. drivers/staging/usbip/userspace/libsrc/vhci_driver.h +19 −13
  692. drivers/staging/usbip/userspace/src/Makefile.am +9 −8
  693. drivers/staging/usbip/userspace/src/bind-driver.c +0 −643
  694. drivers/staging/usbip/userspace/src/usbip.c +142 −675
  695. drivers/staging/usbip/userspace/src/usbip.h +39 −0
  696. drivers/staging/usbip/userspace/src/usbip_attach.c +228 −0
  697. drivers/staging/usbip/userspace/src/usbip_bind.c +277 −0
  698. drivers/staging/usbip/userspace/src/usbip_detach.c +103 −0
  699. drivers/staging/usbip/userspace/src/usbip_list.c +303 −0
  700. drivers/staging/usbip/userspace/src/usbip_network.c +102 −96
  701. drivers/staging/usbip/userspace/src/usbip_network.h +40 −54
  702. drivers/staging/usbip/userspace/src/usbip_unbind.c +186 −0
  703. drivers/staging/usbip/userspace/src/usbipd.c +351 −354
  704. drivers/staging/usbip/userspace/src/utils.c +52 −231
  705. drivers/staging/usbip/userspace/src/utils.h +21 −34
  706. drivers/staging/usbip/userspace/usb.ids +0 −13209
  707. drivers/staging/usbip/vhci.h +1 −10
  708. drivers/staging/usbip/vhci_hcd.c +36 −23
  709. drivers/staging/usbip/vhci_rx.c +0 −2
  710. drivers/staging/usbip/vhci_sysfs.c +3 −3
  711. drivers/staging/vme/boards/vme_vmivme7805.c +2 −2
  712. drivers/staging/vme/bridges/vme_ca91cx42.c +16 −3
  713. drivers/staging/vme/bridges/vme_tsi148.c +1 −1
  714. drivers/staging/vme/devices/vme_user.c +39 −14
  715. drivers/staging/vme/devices/vme_user.h +6 −0
  716. drivers/staging/vme/vme.h +1 −1
  717. drivers/staging/westbridge/Kconfig +0 −53
  718. drivers/staging/westbridge/TODO +0 −7
  719. drivers/staging/westbridge/astoria/Kconfig +0 −9
  720. drivers/staging/westbridge/astoria/Makefile +0 −11
  721. drivers/staging/westbridge/astoria/api/Makefile +0 −14
  722. drivers/staging/westbridge/astoria/api/src/cyasdma.c +0 −1107
  723. drivers/staging/westbridge/astoria/api/src/cyasintr.c +0 −143
  724. drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c +0 −358
  725. drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c +0 −1264
  726. drivers/staging/westbridge/astoria/api/src/cyasmisc.c +0 −3488
  727. drivers/staging/westbridge/astoria/api/src/cyasmtp.c +0 −1136
  728. drivers/staging/westbridge/astoria/api/src/cyasstorage.c +0 −4125
  729. drivers/staging/westbridge/astoria/api/src/cyasusb.c +0 −3740
  730. drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c +0 −2441
  731. drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/cyashaldef.h +0 −55
  732. drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h +0 −319
  733. drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasmemmap.h +0 −558
  734. drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasomapdev_kernel.h +0 −72
  735. drivers/staging/westbridge/astoria/block/Kconfig +0 −9
  736. drivers/staging/westbridge/astoria/block/Makefile +0 −11
  737. drivers/staging/westbridge/astoria/block/cyasblkdev_block.c +0 −1631
  738. drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c +0 −417
  739. drivers/staging/westbridge/astoria/block/cyasblkdev_queue.h +0 −64
  740. drivers/staging/westbridge/astoria/device/Kconfig +0 −9
  741. drivers/staging/westbridge/astoria/device/Makefile +0 −23
  742. drivers/staging/westbridge/astoria/device/cyasdevice.c +0 −409
  743. drivers/staging/westbridge/astoria/gadget/Kconfig +0 −9
  744. drivers/staging/westbridge/astoria/gadget/Makefile +0 −11
  745. drivers/staging/westbridge/astoria/gadget/cyasgadget.c +0 −2177
  746. drivers/staging/westbridge/astoria/gadget/cyasgadget.h +0 −193
  747. drivers/staging/westbridge/astoria/gadget/cyasgadget_ioctl.h +0 −99
  748. drivers/staging/westbridge/astoria/include/linux/westbridge/cyanerr.h +0 −418
  749. drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmedia.h +0 −59
  750. drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h +0 −614
  751. drivers/staging/westbridge/astoria/include/linux/westbridge/cyanregs.h +0 −180
  752. drivers/staging/westbridge/astoria/include/linux/westbridge/cyansdkversion.h +0 −30
  753. drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h +0 −419
  754. drivers/staging/westbridge/astoria/include/linux/westbridge/cyantioch.h +0 −35
  755. drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h +0 −31
  756. drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h +0 −619
  757. drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_end.h +0 −11
  758. drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_start.h +0 −11
  759. drivers/staging/westbridge/astoria/include/linux/westbridge/cyascast.h +0 −35
  760. drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h +0 −1057
  761. drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h +0 −375
  762. drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h +0 −1094
  763. drivers/staging/westbridge/astoria/include/linux/westbridge/cyashal.h +0 −108
  764. drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h +0 −44
  765. drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h +0 −800
  766. drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h +0 −104
  767. drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h +0 −36
  768. drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h +0 −366
  769. drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h +0 −54
  770. drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h +0 −1549
  771. drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc_dep.h +0 −53
Documentation/feature-removal-schedule.txt+0−14
@@ -193,20 +193,6 @@ Why: /proc/<pid>/oom_adj allows userspace to influence the oom killer's · 192 unmodified lines
193 193
194---------------------------194---------------------------
195 195
196What: CS5535/CS5536 obsolete GPIO driver
197When: June 2011
198Files: drivers/staging/cs5535_gpio/*
199Check: drivers/staging/cs5535_gpio/cs5535_gpio.c
200Why: A newer driver replaces this; it is drivers/gpio/cs5535-gpio.c, and
201 integrates with the Linux GPIO subsystem. The old driver has been
202 moved to staging, and will be removed altogether around 3.0.
203 Please test the new driver, and ensure that the functionality you
204 need and any bugfixes from the old driver are available in the new
205 one.
206Who: Andres Salomon <dilinger@queued.net>
207
208--------------------------
209
210What: remove EXPORT_SYMBOL(kernel_thread)196What: remove EXPORT_SYMBOL(kernel_thread)
211When: August 2006197When: August 2006
212Files: arch/*/kernel/*_ksyms.c198Files: arch/*/kernel/*_ksyms.c
MAINTAINERS+141−8
@@ -1546,9 +1546,10 @@ F: drivers/net/tg3.* · 1545 unmodified lines
1546BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER1546BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER
1547M: Brett Rudley <brudley@broadcom.com>1547M: Brett Rudley <brudley@broadcom.com>
1548M: Henry Ptasinski <henryp@broadcom.com>1548M: Henry Ptasinski <henryp@broadcom.com>
1549M: Dowan Kim <dowan@broadcom.com>
1550M: Roland Vossen <rvossen@broadcom.com>1549M: Roland Vossen <rvossen@broadcom.com>
1551M: Arend van Spriel <arend@broadcom.com>1550M: Arend van Spriel <arend@broadcom.com>
1551M: Franky (Zhenhui) Lin <frankyl@broadcom.com>
1552M: Kan Yan <kanyan@broadcom.com>
1552L: linux-wireless@vger.kernel.org1553L: linux-wireless@vger.kernel.org
1553S: Supported1554S: Supported
1554F: drivers/staging/brcm80211/1555F: drivers/staging/brcm80211/
@@ -6092,6 +6093,145 @@ L: devel@driverdev.osuosl.org · 4537 unmodified lines
6092S: Maintained6093S: Maintained
6093F: drivers/staging/6094F: drivers/staging/
6094 6095
6096STAGING - AGERE HERMES II and II.5 WIRELESS DRIVERS
6097M: Henk de Groot <pe1dnn@amsat.org>
6098S: Odd Fixes
6099F: drivers/staging/wlags49_h2/
6100F: drivers/staging/wlags49_h25/
6101
6102STAGING - ASUS OLED
6103M: Jakub Schmidtke <sjakub@gmail.com>
6104S: Odd Fixes
6105F: drivers/staging/asus_oled/
6106
6107STAGING - ATHEROS ATH6KL WIRELESS DRIVER
6108M: Luis R. Rodriguez <mcgrof@gmail.com>
6109M: Naveen Singh <nsingh@atheros.com>
6110S: Odd Fixes
6111F: drivers/staging/ath6kl/
6112
6113STAGING - COMEDI
6114M: Ian Abbott <abbotti@mev.co.uk>
6115M: Mori Hess <fmhess@users.sourceforge.net>
6116S: Odd Fixes
6117F: drivers/staging/comedi/
6118
6119STAGING - CRYSTAL HD VIDEO DECODER
6120M: Naren Sankar <nsankar@broadcom.com>
6121M: Jarod Wilson <jarod@wilsonet.com>
6122M: Scott Davilla <davilla@4pi.com>
6123M: Manu Abraham <abraham.manu@gmail.com>
6124S: Odd Fixes
6125F: drivers/staging/crystalhd/
6126
6127STAGING - CYPRESS WESTBRIDGE SUPPORT
6128M: David Cross <david.cross@cypress.com>
6129S: Odd Fixes
6130F: drivers/staging/westbridge/
6131
6132STAGING - ECHO CANCELLER
6133M: Steve Underwood <steveu@coppice.org>
6134M: David Rowe <david@rowetel.com>
6135S: Odd Fixes
6136F: drivers/staging/echo/
6137
6138STAGING - FLARION FT1000 DRIVERS
6139M: Marek Belisko <marek.belisko@gmail.com>
6140S: Odd Fixes
6141F: drivers/staging/ft1000/
6142
6143STAGING - FRONTIER TRANZPORT AND ALPHATRACK
6144M: David Täht <d@teklibre.com>
6145S: Odd Fixes
6146F: drivers/staging/frontier/
6147
6148STAGING - HYPER-V (MICROSOFT)
6149M: Hank Janssen <hjanssen@microsoft.com>
6150M: Haiyang Zhang <haiyangz@microsoft.com>
6151S: Odd Fixes
6152F: drivers/staging/hv/
6153
6154STAGING - INDUSTRIAL IO
6155M: Jonathan Cameron <jic23@cam.ac.uk>
6156L: linux-iio@vger.kernel.org
6157S: Odd Fixes
6158F: drivers/staging/iio/
6159
6160STAGING - LIRC (LINUX INFRARED REMOTE CONTROL) DRIVERS
6161M: Jarod Wilson <jarod@wilsonet.com>
6162W: http://www.lirc.org/
6163S: Odd Fixes
6164F: drivers/staging/lirc/
6165
6166STAGING - OLPC SECONDARY DISPLAY CONTROLLER (DCON)
6167M: Andres Salomon <dilinger@queued.net>
6168M: Chris Ball <cjb@laptop.org>
6169M: Jon Nettleton <jon.nettleton@gmail.com>
6170W: http://wiki.laptop.org/go/DCON
6171S: Odd Fixes
6172F: drivers/staging/olpc_dcon/
6173
6174STAGING - PARALLEL LCD/KEYPAD PANEL DRIVER
6175M: Willy Tarreau <willy@meta-x.org>
6176S: Odd Fixes
6177F: drivers/staging/panel/
6178
6179STAGING - REALTEK RTL8712U DRIVERS
6180M: Larry Finger <Larry.Finger@lwfinger.net>
6181M: Florian Schilhabel <florian.c.schilhabel@googlemail.com>.
6182S: Odd Fixes
6183F: drivers/staging/rtl8712/
6184
6185STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER
6186M: Teddy Wang <teddy.wang@siliconmotion.com.cn>
6187S: Odd Fixes
6188F: drivers/staging/sm7xx/
6189
6190STAGING - SOFTLOGIC 6x10 MPEG CODEC
6191M: Ben Collins <bcollins@bluecherry.net>
6192S: Odd Fixes
6193F: drivers/staging/solo6x10/
6194
6195STAGING - SPEAKUP CONSOLE SPEECH DRIVER
6196M: William Hubbs <w.d.hubbs@gmail.com>
6197M: Chris Brannon <chris@the-brannons.com>
6198M: Kirk Reiser <kirk@braille.uwo.ca>
6199M: Samuel Thibault <samuel.thibault@ens-lyon.org>
6200L: speakup@braille.uwo.ca
6201W: http://www.linux-speakup.org/
6202S: Odd Fixes
6203F: drivers/staging/speakup/
6204
6205STAGING - TI DSP BRIDGE DRIVERS
6206M: Omar Ramirez Luna <omar.ramirez@ti.com>
6207S: Odd Fixes
6208F: drivers/staging/tidspbridge/
6209
6210STAGING - TRIDENT TVMASTER TMxxxx USB VIDEO CAPTURE DRIVERS
6211L: linux-media@vger.kernel.org
6212S: Odd Fixes
6213F: drivers/staging/tm6000/
6214
6215STAGING - USB ENE SM/MS CARD READER DRIVER
6216M: Al Cho <acho@novell.com>
6217S: Odd Fixes
6218F: drivers/staging/keucr/
6219
6220STAGING - VIA VT665X DRIVERS
6221M: Forest Bond <forest@alittletooquiet.net>
6222S: Odd Fixes
6223F: drivers/staging/vt665?/
6224
6225STAGING - WINBOND IS89C35 WLAN USB DRIVER
6226M: Pavel Machek <pavel@ucw.cz>
6227S: Odd Fixes
6228F: drivers/staging/winbond/
6229
6230STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER
6231M: Arnaud Patard <apatard@mandriva.com>
6232S: Odd Fixes
6233F: drivers/staging/xgifb/
6234
6095STARFIRE/DURALAN NETWORK DRIVER6235STARFIRE/DURALAN NETWORK DRIVER
6096M: Ion Badulescu <ionut@badula.org>6236M: Ion Badulescu <ionut@badula.org>
6097S: Odd Fixes6237S: Odd Fixes
@@ -6594,13 +6734,6 @@ W: http://pegasus2.sourceforge.net/ · 496 unmodified lines
6594S: Maintained6734S: Maintained
6595F: drivers/net/usb/rtl8150.c6735F: drivers/net/usb/rtl8150.c
6596 6736
6597USB SE401 DRIVER
6598L: linux-usb@vger.kernel.org
6599W: http://www.chello.nl/~j.vreeken/se401/
6600S: Orphan
6601F: Documentation/video4linux/se401.txt
6602F: drivers/staging/se401/
6603
6604USB SERIAL BELKIN F5U103 DRIVER6737USB SERIAL BELKIN F5U103 DRIVER
6605M: William Greathouse <wgreathouse@smva.com>6738M: William Greathouse <wgreathouse@smva.com>
6606L: linux-usb@vger.kernel.org6739L: linux-usb@vger.kernel.org
arch/arm/mach-ux500/board-mop500-u8500uib.c+2−22
@@ -12,34 +12,14 @@ · 11 unmodified lines
12#include <linux/interrupt.h>12#include <linux/interrupt.h>
13#include <linux/mfd/tc3589x.h>13#include <linux/mfd/tc3589x.h>
14#include <linux/input/matrix_keypad.h>14#include <linux/input/matrix_keypad.h>
15#include <../drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h>
16 15
17#include <mach/gpio.h>16#include <mach/gpio.h>
18#include <mach/irqs.h>17#include <mach/irqs.h>
19 18
20#include "board-mop500.h"19#include "board-mop500.h"
21 20
22/*21/* Dummy data that can be overridden by staging driver */
23 * Synaptics RMI4 touchscreen interface on the U8500 UIB22struct i2c_board_info __initdata __weak mop500_i2c3_devices_u8500[] = {
24 */
25
26/*
27 * Descriptor structure.
28 * Describes the number of i2c devices on the bus that speak RMI.
29 */
30static struct synaptics_rmi4_platform_data rmi4_i2c_dev_platformdata = {
31 .irq_number = NOMADIK_GPIO_TO_IRQ(84),
32 .irq_type = (IRQF_TRIGGER_FALLING | IRQF_SHARED),
33 .x_flip = false,
34 .y_flip = true,
35 .regulator_en = false,
36};
37
38static struct i2c_board_info __initdata mop500_i2c3_devices_u8500[] = {
39 {
40 I2C_BOARD_INFO("synaptics_rmi4_i2c", 0x4B),
41 .platform_data = &rmi4_i2c_dev_platformdata,
42 },
43};23};
44 24
45/*25/*
drivers/staging/Kconfig+0−10
@@ -24,10 +24,6 @@ menuconfig STAGING · 23 unmodified lines
24 24
25if STAGING25if STAGING
26 26
27source "drivers/staging/tty/Kconfig"
28
29source "drivers/staging/generic_serial/Kconfig"
30
31source "drivers/staging/et131x/Kconfig"27source "drivers/staging/et131x/Kconfig"
32 28
33source "drivers/staging/slicoss/Kconfig"29source "drivers/staging/slicoss/Kconfig"
@@ -100,8 +96,6 @@ source "drivers/staging/sep/Kconfig" · 66 unmodified lines
100 96
101source "drivers/staging/iio/Kconfig"97source "drivers/staging/iio/Kconfig"
102 98
103source "drivers/staging/cs5535_gpio/Kconfig"
104
105source "drivers/staging/zram/Kconfig"99source "drivers/staging/zram/Kconfig"
106 100
107source "drivers/staging/zcache/Kconfig"101source "drivers/staging/zcache/Kconfig"
@@ -120,8 +114,6 @@ source "drivers/staging/cxt1e1/Kconfig" · 12 unmodified lines
120 114
121source "drivers/staging/xgifb/Kconfig"115source "drivers/staging/xgifb/Kconfig"
122 116
123source "drivers/staging/msm/Kconfig"
124
125source "drivers/staging/lirc/Kconfig"117source "drivers/staging/lirc/Kconfig"
126 118
127source "drivers/staging/easycap/Kconfig"119source "drivers/staging/easycap/Kconfig"
@@ -132,8 +124,6 @@ source "drivers/staging/tidspbridge/Kconfig" · 4 unmodified lines
132 124
133source "drivers/staging/quickstart/Kconfig"125source "drivers/staging/quickstart/Kconfig"
134 126
135source "drivers/staging/westbridge/Kconfig"
136
137source "drivers/staging/sbe-2t3e3/Kconfig"127source "drivers/staging/sbe-2t3e3/Kconfig"
138 128
139source "drivers/staging/ath6kl/Kconfig"129source "drivers/staging/ath6kl/Kconfig"
drivers/staging/Makefile+0−5
@@ -3,8 +3,6 @@ · 2 unmodified lines
3# fix for build system bug...3# fix for build system bug...
4obj-$(CONFIG_STAGING) += staging.o4obj-$(CONFIG_STAGING) += staging.o
5 5
6obj-y += tty/
7obj-y += generic_serial/
8obj-$(CONFIG_ET131X) += et131x/6obj-$(CONFIG_ET131X) += et131x/
9obj-$(CONFIG_SLICOSS) += slicoss/7obj-$(CONFIG_SLICOSS) += slicoss/
10obj-$(CONFIG_VIDEO_GO7007) += go7007/8obj-$(CONFIG_VIDEO_GO7007) += go7007/
@@ -41,7 +39,6 @@ obj-$(CONFIG_HYPERV) += hv/ · 30 unmodified lines
41obj-$(CONFIG_VME_BUS) += vme/39obj-$(CONFIG_VME_BUS) += vme/
42obj-$(CONFIG_DX_SEP) += sep/40obj-$(CONFIG_DX_SEP) += sep/
43obj-$(CONFIG_IIO) += iio/41obj-$(CONFIG_IIO) += iio/
44obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio/
45obj-$(CONFIG_ZRAM) += zram/42obj-$(CONFIG_ZRAM) += zram/
46obj-$(CONFIG_XVMALLOC) += zram/43obj-$(CONFIG_XVMALLOC) += zram/
47obj-$(CONFIG_ZCACHE) += zcache/44obj-$(CONFIG_ZCACHE) += zcache/
@@ -52,12 +49,10 @@ obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ · 4 unmodified lines
52obj-$(CONFIG_CRYSTALHD) += crystalhd/49obj-$(CONFIG_CRYSTALHD) += crystalhd/
53obj-$(CONFIG_CXT1E1) += cxt1e1/50obj-$(CONFIG_CXT1E1) += cxt1e1/
54obj-$(CONFIG_FB_XGI) += xgifb/51obj-$(CONFIG_FB_XGI) += xgifb/
55obj-$(CONFIG_MSM_STAGING) += msm/
56obj-$(CONFIG_EASYCAP) += easycap/52obj-$(CONFIG_EASYCAP) += easycap/
57obj-$(CONFIG_SOLO6X10) += solo6x10/53obj-$(CONFIG_SOLO6X10) += solo6x10/
58obj-$(CONFIG_TIDSPBRIDGE) += tidspbridge/54obj-$(CONFIG_TIDSPBRIDGE) += tidspbridge/
59obj-$(CONFIG_ACPI_QUICKSTART) += quickstart/55obj-$(CONFIG_ACPI_QUICKSTART) += quickstart/
60obj-$(CONFIG_WESTBRIDGE_ASTORIA) += westbridge/astoria/
61obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3/56obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3/
62obj-$(CONFIG_ATH6K_LEGACY) += ath6kl/57obj-$(CONFIG_ATH6K_LEGACY) += ath6kl/
63obj-$(CONFIG_USB_ENESTORAGE) += keucr/58obj-$(CONFIG_USB_ENESTORAGE) += keucr/
drivers/staging/altera-stapl/Kconfig+0−2
@@ -1,5 +1,3 @@
1comment "Altera FPGA firmware download module"
2
3config ALTERA_STAPL1config ALTERA_STAPL
4 tristate "Altera FPGA firmware download module"2 tristate "Altera FPGA firmware download module"
5 depends on I2C3 depends on I2C
drivers/staging/altera-stapl/Makefile+1−1
@@ -1,3 +1,3 @@
1altera-stapl-objs = altera-lpt.o altera-jtag.o altera-comp.o altera.o1altera-stapl-y := altera-lpt.o altera-jtag.o altera-comp.o altera.o
2 2
3obj-$(CONFIG_ALTERA_STAPL) += altera-stapl.o3obj-$(CONFIG_ALTERA_STAPL) += altera-stapl.o
drivers/staging/altera-stapl/altera.c+21−12
@@ -2430,16 +2430,23 @@ int altera_init(struct altera_config *config, const struct firmware *fw) · 2429 unmodified lines
2430 int index = 0;2430 int index = 0;
2431 s32 offset = 0L;2431 s32 offset = 0L;
2432 s32 error_address = 0L;2432 s32 error_address = 0L;
2433 int retval = 0;
2433 2434
2434 key = kzalloc(33 * sizeof(char), GFP_KERNEL);2435 key = kzalloc(33, GFP_KERNEL);
2435 if (!key)2436 if (!key) {
2436 return -ENOMEM;2437 retval = -ENOMEM;
2437 value = kzalloc(257 * sizeof(char), GFP_KERNEL);2438 goto out;
2438 if (!value)2439 }
2439 return -ENOMEM;2440 value = kzalloc(257, GFP_KERNEL);
2441 if (!value) {
2442 retval = -ENOMEM;
2443 goto free_key;
2444 }
2440 astate = kzalloc(sizeof(struct altera_state), GFP_KERNEL);2445 astate = kzalloc(sizeof(struct altera_state), GFP_KERNEL);
2441 if (!astate)2446 if (!astate) {
2442 return -ENOMEM;2447 retval = -ENOMEM;
2448 goto free_value;
2449 }
2443 2450
2444 astate->config = config;2451 astate->config = config;
2445 if (!astate->config->jtag_io) {2452 if (!astate->config->jtag_io) {
@@ -2518,10 +2525,12 @@ int altera_init(struct altera_config *config, const struct firmware *fw) · 72 unmodified lines
2518 } else if (exec_result)2525 } else if (exec_result)
2519 printk(KERN_ERR "%s: error %d\n", __func__, exec_result);2526 printk(KERN_ERR "%s: error %d\n", __func__, exec_result);
2520 2527
2521 kfree(key);
2522 kfree(value);
2523 kfree(astate);2528 kfree(astate);
2524 2529free_value:
2525 return 0;2530 kfree(value);
2531free_key:
2532 kfree(key);
2533out:
2534 return retval;
2526}2535}
2527EXPORT_SYMBOL(altera_init);2536EXPORT_SYMBOL(altera_init);
drivers/staging/ath6kl/TODO+1−1
@@ -1,7 +1,7 @@
1TODO:1TODO:
2 2
3We are working hard on cleaning up the driver. There's sooooooooo much todo3We are working hard on cleaning up the driver. There's sooooooooo much todo
4so instead of editign this file please use the wiki:4so instead of editing this file please use the wiki:
5 5
6http://wireless.kernel.org/en/users/Drivers/ath6kl6http://wireless.kernel.org/en/users/Drivers/ath6kl
7 7
drivers/staging/ath6kl/os/linux/ar6000_drv.c+41−15
@@ -954,9 +954,13 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 953 unmodified lines
954 const char *filename;954 const char *filename;
955 const struct firmware *fw_entry;955 const struct firmware *fw_entry;
956 u32 fw_entry_size;956 u32 fw_entry_size;
957 u8 **buf;
958 size_t *buf_len;
957 959
958 switch (file) {960 switch (file) {
959 case AR6K_OTP_FILE:961 case AR6K_OTP_FILE:
962 buf = &ar->fw_otp;
963 buf_len = &ar->fw_otp_len;
960 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {964 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
961 filename = AR6003_REV1_OTP_FILE;965 filename = AR6003_REV1_OTP_FILE;
962 } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {966 } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {
@@ -970,6 +974,8 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 7 unmodified lines
970 break;974 break;
971 975
972 case AR6K_FIRMWARE_FILE:976 case AR6K_FIRMWARE_FILE:
977 buf = &ar->fw;
978 buf_len = &ar->fw_len;
973 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {979 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
974 filename = AR6003_REV1_FIRMWARE_FILE;980 filename = AR6003_REV1_FIRMWARE_FILE;
975 } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {981 } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {
@@ -1028,6 +1034,8 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 52 unmodified lines
1028 break;1034 break;
1029 1035
1030 case AR6K_PATCH_FILE:1036 case AR6K_PATCH_FILE:
1037 buf = &ar->fw_patch;
1038 buf_len = &ar->fw_patch_len;
1031 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {1039 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
1032 filename = AR6003_REV1_PATCH_FILE;1040 filename = AR6003_REV1_PATCH_FILE;
1033 } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {1041 } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {
@@ -1041,6 +1049,8 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 7 unmodified lines
1041 break;1049 break;
1042 1050
1043 case AR6K_BOARD_DATA_FILE:1051 case AR6K_BOARD_DATA_FILE:
1052 buf = &ar->fw_data;
1053 buf_len = &ar->fw_data_len;
1044 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {1054 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
1045 filename = AR6003_REV1_BOARD_DATA_FILE;1055 filename = AR6003_REV1_BOARD_DATA_FILE;
1046 } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {1056 } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {
@@ -1057,23 +1067,29 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 10 unmodified lines
1057 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown file type: %d\n", file));1067 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown file type: %d\n", file));
1058 return A_ERROR;1068 return A_ERROR;
1059 }1069 }
1060 if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0)1070
1061 {1071 if (*buf == NULL) {
1062 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename));1072 if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0) {
1063 return A_ENOENT;1073 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename));
1074 return A_ENOENT;
1075 }
1076
1077 *buf = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
1078 *buf_len = fw_entry->size;
1079 A_RELEASE_FIRMWARE(fw_entry);
1064 }1080 }
1065 1081
1066#ifdef SOFTMAC_FILE_USED1082#ifdef SOFTMAC_FILE_USED
1067 if (file==AR6K_BOARD_DATA_FILE && fw_entry->data) {1083 if (file==AR6K_BOARD_DATA_FILE && *buf_len) {
1068 ar6000_softmac_update(ar, (u8 *)fw_entry->data, fw_entry->size);1084 ar6000_softmac_update(ar, *buf, *buf_len);
1069 }1085 }
1070#endif 1086#endif
1071 1087
1072 1088
1073 fw_entry_size = fw_entry->size;1089 fw_entry_size = *buf_len;
1074 1090
1075 /* Load extended board data for AR6003 */1091 /* Load extended board data for AR6003 */
1076 if ((file==AR6K_BOARD_DATA_FILE) && (fw_entry->data)) {1092 if ((file==AR6K_BOARD_DATA_FILE) && *buf) {
1077 u32 board_ext_address;1093 u32 board_ext_address;
1078 u32 board_ext_data_size;1094 u32 board_ext_data_size;
1079 u32 board_data_size;1095 u32 board_data_size;
@@ -1089,14 +1105,13 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 9 unmodified lines
1089 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("Board extended Data download address: 0x%x\n", board_ext_address));1105 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("Board extended Data download address: 0x%x\n", board_ext_address));
1090 1106
1091 /* check whether the target has allocated memory for extended board data and file contains extended board data */1107 /* check whether the target has allocated memory for extended board data and file contains extended board data */
1092 if ((board_ext_address) && (fw_entry->size == (board_data_size + board_ext_data_size))) {1108 if ((board_ext_address) && (*buf_len == (board_data_size + board_ext_data_size))) {
1093 u32 param;1109 u32 param;
1094 1110
1095 status = BMIWriteMemory(ar->arHifDevice, board_ext_address, (u8 *)(fw_entry->data + board_data_size), board_ext_data_size);1111 status = BMIWriteMemory(ar->arHifDevice, board_ext_address, (u8 *)(*buf + board_data_size), board_ext_data_size);
1096 1112
1097 if (status) {1113 if (status) {
1098 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__));1114 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__));
1099 A_RELEASE_FIRMWARE(fw_entry);
1100 return A_ERROR;1115 return A_ERROR;
1101 }1116 }
1102 1117
@@ -1110,17 +1125,16 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 7 unmodified lines
1110 }1125 }
1111 1126
1112 if (compressed) {1127 if (compressed) {
1113 status = BMIFastDownload(ar->arHifDevice, address, (u8 *)fw_entry->data, fw_entry_size);1128 status = BMIFastDownload(ar->arHifDevice, address, *buf, fw_entry_size);
1114 } else {1129 } else {
1115 status = BMIWriteMemory(ar->arHifDevice, address, (u8 *)fw_entry->data, fw_entry_size);1130 status = BMIWriteMemory(ar->arHifDevice, address, *buf, fw_entry_size);
1116 }1131 }
1117 1132
1118 if (status) {1133 if (status) {
1119 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__));1134 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__));
1120 A_RELEASE_FIRMWARE(fw_entry);
1121 return A_ERROR;1135 return A_ERROR;
1122 }1136 }
1123 A_RELEASE_FIRMWARE(fw_entry);1137
1124 return 0;1138 return 0;
1125}1139}
1126 1140
@@ -2088,6 +2102,11 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister) · 961 unmodified lines
2088 ar6000_remove_ap_interface();2102 ar6000_remove_ap_interface();
2089#endif /*CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */2103#endif /*CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
2090 2104
2105 kfree(ar->fw_otp);
2106 kfree(ar->fw);
2107 kfree(ar->fw_patch);
2108 kfree(ar->fw_data);
2109
2091 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("-ar6000_destroy \n"));2110 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("-ar6000_destroy \n"));
2092}2111}
2093 2112
@@ -4114,6 +4133,13 @@ ar6000_ready_event(void *devt, u8 *datap, u8 phyCap, u32 sw_ver, u32 abi_ver) · 2020 unmodified lines
4114 ar->arVersion.wlan_ver = sw_ver;4133 ar->arVersion.wlan_ver = sw_ver;
4115 ar->arVersion.abi_ver = abi_ver;4134 ar->arVersion.abi_ver = abi_ver;
4116 4135
4136 snprintf(ar->wdev->wiphy->fw_version, sizeof(ar->wdev->wiphy->fw_version),
4137 "%u:%u:%u:%u",
4138 (ar->arVersion.wlan_ver & 0xf0000000) >> 28,
4139 (ar->arVersion.wlan_ver & 0x0f000000) >> 24,
4140 (ar->arVersion.wlan_ver & 0x00ff0000) >> 16,
4141 (ar->arVersion.wlan_ver & 0x0000ffff));
4142
4117 /* Indicate to the waiting thread that the ready event was received */4143 /* Indicate to the waiting thread that the ready event was received */
4118 ar->arWmiReady = true;4144 ar->arWmiReady = true;
4119 wake_up(&arEvent);4145 wake_up(&arEvent);
drivers/staging/ath6kl/os/linux/cfg80211.c+198−13
@@ -24,6 +24,7 @@ · 23 unmodified lines
24#include <linux/wireless.h>24#include <linux/wireless.h>
25#include <linux/ieee80211.h>25#include <linux/ieee80211.h>
26#include <net/cfg80211.h>26#include <net/cfg80211.h>
27#include <net/netlink.h>
27 28
28#include "ar6000_drv.h"29#include "ar6000_drv.h"
29 30
@@ -867,26 +868,31 @@ ar6k_cfg80211_scanComplete_event(struct ar6_softc *ar, int status) · 837 unmodified lines
867 868
868 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: status %d\n", __func__, status));869 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: status %d\n", __func__, status));
869 870
870 if(ar->scan_request)871 if (!ar->scan_request)
871 {872 return;
872 /* Translate data to cfg80211 mgmt format */873
873 if (ar->arWmi)874 if ((status == A_ECANCELED) || (status == A_EBUSY)) {
874 wmi_iterate_nodes(ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy);875 cfg80211_scan_done(ar->scan_request, true);
876 goto out;
877 }
875 878
876 cfg80211_scan_done(ar->scan_request,879 /* Translate data to cfg80211 mgmt format */
877 ((status & A_ECANCELED) || (status & A_EBUSY)) ? true : false);880 wmi_iterate_nodes(ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy);
878 881
879 if(ar->scan_request->n_ssids &&882 cfg80211_scan_done(ar->scan_request, false);
880 ar->scan_request->ssids[0].ssid_len) {883
884 if(ar->scan_request->n_ssids &&
885 ar->scan_request->ssids[0].ssid_len) {
881 u8 i;886 u8 i;
882 887
883 for (i = 0; i < ar->scan_request->n_ssids; i++) {888 for (i = 0; i < ar->scan_request->n_ssids; i++) {
884 wmi_probedSsid_cmd(ar->arWmi, i+1, DISABLE_SSID_FLAG,889 wmi_probedSsid_cmd(ar->arWmi, i+1, DISABLE_SSID_FLAG,
885 0, NULL);890 0, NULL);
886 }891 }
887 }
888 ar->scan_request = NULL;
889 }892 }
893
894out:
895 ar->scan_request = NULL;
890}896}
891 897
892static int898static int
@@ -1453,6 +1459,159 @@ ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) · 560 unmodified lines
1453 return 0;1459 return 0;
1454}1460}
1455 1461
1462#ifdef CONFIG_NL80211_TESTMODE
1463enum ar6k_testmode_attr {
1464 __AR6K_TM_ATTR_INVALID = 0,
1465 AR6K_TM_ATTR_CMD = 1,
1466 AR6K_TM_ATTR_DATA = 2,
1467
1468 /* keep last */
1469 __AR6K_TM_ATTR_AFTER_LAST,
1470 AR6K_TM_ATTR_MAX = __AR6K_TM_ATTR_AFTER_LAST - 1
1471};
1472
1473enum ar6k_testmode_cmd {
1474 AR6K_TM_CMD_TCMD = 0,
1475 AR6K_TM_CMD_RX_REPORT = 1,
1476};
1477
1478#define AR6K_TM_DATA_MAX_LEN 5000
1479
1480static const struct nla_policy ar6k_testmode_policy[AR6K_TM_ATTR_MAX + 1] = {
1481 [AR6K_TM_ATTR_CMD] = { .type = NLA_U32 },
1482 [AR6K_TM_ATTR_DATA] = { .type = NLA_BINARY,
1483 .len = AR6K_TM_DATA_MAX_LEN },
1484};
1485
1486void ar6000_testmode_rx_report_event(struct ar6_softc *ar, void *buf,
1487 int buf_len)
1488{
1489 if (down_interruptible(&ar->arSem))
1490 return;
1491
1492 kfree(ar->tcmd_rx_report);
1493
1494 ar->tcmd_rx_report = kmemdup(buf, buf_len, GFP_KERNEL);
1495 ar->tcmd_rx_report_len = buf_len;
1496
1497 up(&ar->arSem);
1498
1499 wake_up(&arEvent);
1500}
1501
1502static int ar6000_testmode_rx_report(struct ar6_softc *ar, void *buf,
1503 int buf_len, struct sk_buff *skb)
1504{
1505 int ret = 0;
1506 long left;
1507
1508 if (down_interruptible(&ar->arSem))
1509 return -ERESTARTSYS;
1510
1511 if (ar->arWmiReady == false) {
1512 ret = -EIO;
1513 goto out;
1514 }
1515
1516 if (ar->bIsDestroyProgress) {
1517 ret = -EBUSY;
1518 goto out;
1519 }
1520
1521 WARN_ON(ar->tcmd_rx_report != NULL);
1522 WARN_ON(ar->tcmd_rx_report_len > 0);
1523
1524 if (wmi_test_cmd(ar->arWmi, buf, buf_len) < 0) {
1525 up(&ar->arSem);
1526 return -EIO;
1527 }
1528
1529 left = wait_event_interruptible_timeout(arEvent,
1530 ar->tcmd_rx_report != NULL,
1531 wmitimeout * HZ);
1532
1533 if (left == 0) {
1534 ret = -ETIMEDOUT;
1535 goto out;
1536 } else if (left < 0) {
1537 ret = left;
1538 goto out;
1539 }
1540
1541 if (ar->tcmd_rx_report == NULL || ar->tcmd_rx_report_len == 0) {
1542 ret = -EINVAL;
1543 goto out;
1544 }
1545
1546 NLA_PUT(skb, AR6K_TM_ATTR_DATA, ar->tcmd_rx_report_len,
1547 ar->tcmd_rx_report);
1548
1549 kfree(ar->tcmd_rx_report);
1550 ar->tcmd_rx_report = NULL;
1551
1552out:
1553 up(&ar->arSem);
1554
1555 return ret;
1556
1557nla_put_failure:
1558 ret = -ENOBUFS;
1559 goto out;
1560}
1561
1562static int ar6k_testmode_cmd(struct wiphy *wiphy, void *data, int len)
1563{
1564 struct ar6_softc *ar = wiphy_priv(wiphy);
1565 struct nlattr *tb[AR6K_TM_ATTR_MAX + 1];
1566 int err, buf_len, reply_len;
1567 struct sk_buff *skb;
1568 void *buf;
1569
1570 err = nla_parse(tb, AR6K_TM_ATTR_MAX, data, len,
1571 ar6k_testmode_policy);
1572 if (err)
1573 return err;
1574
1575 if (!tb[AR6K_TM_ATTR_CMD])
1576 return -EINVAL;
1577
1578 switch (nla_get_u32(tb[AR6K_TM_ATTR_CMD])) {
1579 case AR6K_TM_CMD_TCMD:
1580 if (!tb[AR6K_TM_ATTR_DATA])
1581 return -EINVAL;
1582
1583 buf = nla_data(tb[AR6K_TM_ATTR_DATA]);
1584 buf_len = nla_len(tb[AR6K_TM_ATTR_DATA]);
1585
1586 wmi_test_cmd(ar->arWmi, buf, buf_len);
1587
1588 return 0;
1589
1590 break;
1591 case AR6K_TM_CMD_RX_REPORT:
1592 if (!tb[AR6K_TM_ATTR_DATA])
1593 return -EINVAL;
1594
1595 buf = nla_data(tb[AR6K_TM_ATTR_DATA]);
1596 buf_len = nla_len(tb[AR6K_TM_ATTR_DATA]);
1597
1598 reply_len = nla_total_size(AR6K_TM_DATA_MAX_LEN);
1599 skb = cfg80211_testmode_alloc_reply_skb(wiphy, reply_len);
1600 if (!skb)
1601 return -ENOMEM;
1602
1603 err = ar6000_testmode_rx_report(ar, buf, buf_len, skb);
1604 if (err < 0) {
1605 kfree_skb(skb);
1606 return err;
1607 }
1608
1609 return cfg80211_testmode_reply(skb);
1610 default:
1611 return -EOPNOTSUPP;
1612 }
1613}
1614#endif
1456 1615
1457static const1616static const
1458u32 cipher_suites[] = {1617u32 cipher_suites[] = {
@@ -1607,6 +1766,28 @@ static int ar6k_get_station(struct wiphy *wiphy, struct net_device *dev, · 148 unmodified lines
1607 return 0;1766 return 0;
1608}1767}
1609 1768
1769static int ar6k_set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
1770 struct cfg80211_pmksa *pmksa)
1771{
1772 struct ar6_softc *ar = ar6k_priv(netdev);
1773 return wmi_setPmkid_cmd(ar->arWmi, pmksa->bssid, pmksa->pmkid, true);
1774}
1775
1776static int ar6k_del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
1777 struct cfg80211_pmksa *pmksa)
1778{
1779 struct ar6_softc *ar = ar6k_priv(netdev);
1780 return wmi_setPmkid_cmd(ar->arWmi, pmksa->bssid, pmksa->pmkid, false);
1781}
1782
1783static int ar6k_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
1784{
1785 struct ar6_softc *ar = ar6k_priv(netdev);
1786 if (ar->arConnected)
1787 return wmi_setPmkid_cmd(ar->arWmi, ar->arBssid, NULL, false);
1788 return 0;
1789}
1790
1610static struct1791static struct
1611cfg80211_ops ar6k_cfg80211_ops = {1792cfg80211_ops ar6k_cfg80211_ops = {
1612 .change_virtual_intf = ar6k_cfg80211_change_iface,1793 .change_virtual_intf = ar6k_cfg80211_change_iface,
@@ -1628,6 +1809,10 @@ cfg80211_ops ar6k_cfg80211_ops = { · 15 unmodified lines
1628 .join_ibss = ar6k_cfg80211_join_ibss,1809 .join_ibss = ar6k_cfg80211_join_ibss,
1629 .leave_ibss = ar6k_cfg80211_leave_ibss,1810 .leave_ibss = ar6k_cfg80211_leave_ibss,
1630 .get_station = ar6k_get_station,1811 .get_station = ar6k_get_station,
1812 .set_pmksa = ar6k_set_pmksa,
1813 .del_pmksa = ar6k_del_pmksa,
1814 .flush_pmksa = ar6k_flush_pmksa,
1815 CFG80211_TESTMODE_CMD(ar6k_testmode_cmd)
1631};1816};
1632 1817
1633struct wireless_dev *1818struct wireless_dev *
drivers/staging/ath6kl/os/linux/include/ar6000_drv.h+11−8
@@ -545,15 +545,9 @@ struct ar6_softc { · 544 unmodified lines
545 s8 arMaxRetries;545 s8 arMaxRetries;
546 u8 arPhyCapability;546 u8 arPhyCapability;
547#ifdef CONFIG_HOST_TCMD_SUPPORT547#ifdef CONFIG_HOST_TCMD_SUPPORT
548 u8 tcmdRxReport;
549 u32 tcmdRxTotalPkt;
550 s32 tcmdRxRssi;
551 u32 tcmdPm;
552 u32 arTargetMode;548 u32 arTargetMode;
553 u32 tcmdRxcrcErrPkt;549 void *tcmd_rx_report;
554 u32 tcmdRxsecErrPkt;550 int tcmd_rx_report_len;
555 u16 tcmdRateCnt[TCMD_MAX_RATES];
556 u16 tcmdRateCntShortGuard[TCMD_MAX_RATES];
557#endif551#endif
558 AR6000_WLAN_STATE arWlanState;552 AR6000_WLAN_STATE arWlanState;
559 struct ar_node_mapping arNodeMap[MAX_NODE_NUM];553 struct ar_node_mapping arNodeMap[MAX_NODE_NUM];
@@ -650,6 +644,15 @@ struct ar6_softc { · 90 unmodified lines
650 void *arApDev;644 void *arApDev;
651#endif645#endif
652 u8 arAutoAuthStage;646 u8 arAutoAuthStage;
647
648 u8 *fw_otp;
649 size_t fw_otp_len;
650 u8 *fw;
651 size_t fw_len;
652 u8 *fw_patch;
653 size_t fw_patch_len;
654 u8 *fw_data;
655 size_t fw_data_len;
653};656};
654 657
655#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT658#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
drivers/staging/ath6kl/os/linux/include/cfg80211.h+11−0
@@ -41,6 +41,17 @@ void ar6k_cfg80211_disconnect_event(struct ar6_softc *ar, u8 reason, · 40 unmodified lines
41 41
42void ar6k_cfg80211_tkip_micerr_event(struct ar6_softc *ar, u8 keyid, bool ismcast);42void ar6k_cfg80211_tkip_micerr_event(struct ar6_softc *ar, u8 keyid, bool ismcast);
43 43
44#ifdef CONFIG_NL80211_TESTMODE
45void ar6000_testmode_rx_report_event(struct ar6_softc *ar, void *buf,
46 int buf_len);
47#else
48static inline void ar6000_testmode_rx_report_event(struct ar6_softc *ar,
49 void *buf, int buf_len)
50{
51}
52#endif
53
54
44#endif /* _AR6K_CFG80211_H_ */55#endif /* _AR6K_CFG80211_H_ */
45 56
46 57
drivers/staging/ath6kl/os/linux/include/config_linux.h+0−2
@@ -28,8 +28,6 @@ · 27 unmodified lines
28extern "C" {28extern "C" {
29#endif29#endif
30 30
31#include <linux/version.h>
32
33/*31/*
34 * Host side Test Command support32 * Host side Test Command support
35 */33 */
drivers/staging/ath6kl/os/linux/include/ieee80211_ioctl.h+0−2
@@ -24,8 +24,6 @@ · 23 unmodified lines
24#ifndef _IEEE80211_IOCTL_H_24#ifndef _IEEE80211_IOCTL_H_
25#define _IEEE80211_IOCTL_H_25#define _IEEE80211_IOCTL_H_
26 26
27#include <linux/version.h>
28
29#ifdef __cplusplus27#ifdef __cplusplus
30extern "C" {28extern "C" {
31#endif29#endif
drivers/staging/ath6kl/os/linux/include/osapi_linux.h+0−1
@@ -29,7 +29,6 @@ · 28 unmodified lines
29 29
30#ifdef __KERNEL__30#ifdef __KERNEL__
31 31
32#include <linux/version.h>
33#include <linux/types.h>32#include <linux/types.h>
34#include <linux/kernel.h>33#include <linux/kernel.h>
35#include <linux/string.h>34#include <linux/string.h>
drivers/staging/ath6kl/wmi/wmi.c+3−3
@@ -41,6 +41,7 @@ · 40 unmodified lines
41#include "a_debug.h"41#include "a_debug.h"
42#include "dbglog_api.h"42#include "dbglog_api.h"
43#include "roaming.h"43#include "roaming.h"
44#include "cfg80211.h"
44 45
45#define ATH_DEBUG_WMI ATH_DEBUG_MAKE_MODULE_MASK(0)46#define ATH_DEBUG_WMI ATH_DEBUG_MAKE_MODULE_MASK(0)
46 47
@@ -4465,10 +4466,9 @@ wmi_verify_tspec_params(WMI_CREATE_PSTREAM_CMD *pCmd, int tspecCompliance) · 4418 unmodified lines
4465static int4466static int
4466wmi_tcmd_test_report_rx(struct wmi_t *wmip, u8 *datap, int len)4467wmi_tcmd_test_report_rx(struct wmi_t *wmip, u8 *datap, int len)
4467{4468{
4469 ar6000_testmode_rx_report_event(wmip->wmi_devt, datap, len);
4468 4470
4469 A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG));4471 return 0;
4470
4471 return 0;
4472}4472}
4473 4473
4474#endif /* CONFIG_HOST_TCMD_SUPPORT*/4474#endif /* CONFIG_HOST_TCMD_SUPPORT*/
drivers/staging/bcm/Debug.h+1−1
@@ -131,7 +131,7 @@ DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, InterfaceDDR.c */ · 130 unmodified lines
131 131
132// TODO - put PHS_SEND in Tx PHS_RECEIVE in Rx path ?132// TODO - put PHS_SEND in Tx PHS_RECEIVE in Rx path ?
133#define PHS_SEND (OTHERS<<16)133#define PHS_SEND (OTHERS<<16)
134#define PHS_RECIEVE (OTHERS<<17)134#define PHS_RECEIVE (OTHERS<<17)
135#define PHS_MODULE (OTHERS<<18)135#define PHS_MODULE (OTHERS<<18)
136 136
137#define INTF_INIT (OTHERS<<19)137#define INTF_INIT (OTHERS<<19)
drivers/staging/bcm/InterfaceRx.c+2−2
@@ -157,7 +157,7 @@ static void read_bulk_callback(struct urb *urb) · 156 unmodified lines
157 {157 {
158 /* Moving ahead by ETH_HLEN to the data ptr as received from FW */158 /* Moving ahead by ETH_HLEN to the data ptr as received from FW */
159 skb_pull(skb, ETH_HLEN);159 skb_pull(skb, ETH_HLEN);
160 PHSRecieve(Adapter, pLeader->Vcid, skb, &skb->len,160 PHSReceive(Adapter, pLeader->Vcid, skb, &skb->len,
161 NULL,bHeaderSupressionEnabled);161 NULL,bHeaderSupressionEnabled);
162 162
163 if(!Adapter->PackInfo[QueueIndex].bEthCSSupport)163 if(!Adapter->PackInfo[QueueIndex].bEthCSSupport)
@@ -229,7 +229,7 @@ static int ReceiveRcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_RCB pRcb) · 65 unmodified lines
229/*229/*
230Function: InterfaceRx230Function: InterfaceRx
231 231
232Description: This is the hardware specific Function for Recieveing232Description: This is the hardware specific Function for Receiving
233 data packet/control packets from the device.233 data packet/control packets from the device.
234 234
235Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context235Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context
drivers/staging/bcm/Macros.h+2−2
@@ -176,8 +176,8 @@ enum enLinkStatus { · 175 unmodified lines
176 PHY_SYNC_ACHIVED = 2,176 PHY_SYNC_ACHIVED = 2,
177 LINKUP_IN_PROGRESS = 3,177 LINKUP_IN_PROGRESS = 3,
178 LINKUP_DONE = 4,178 LINKUP_DONE = 4,
179 DREG_RECIEVED = 5,179 DREG_RECEIVED = 5,
180 LINK_STATUS_RESET_RECIEVED = 6,180 LINK_STATUS_RESET_RECEIVED = 6,
181 PERIODIC_WAKE_UP_NOTIFICATION_FRM_FW = 7,181 PERIODIC_WAKE_UP_NOTIFICATION_FRM_FW = 7,
182 LINK_SHUTDOWN_REQ_FROM_FIRMWARE = 8,182 LINK_SHUTDOWN_REQ_FROM_FIRMWARE = 8,
183 COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW =9183 COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW =9
drivers/staging/bcm/Misc.c+2−8
@@ -1447,16 +1447,10 @@ static void convertEndian(B_UINT8 rwFlag, PUINT puiBuffer, UINT uiByteCount) · 1446 unmodified lines
1447 1447
1448int rdm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize)1448int rdm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize)
1449{1449{
1450 INT uiRetVal =0;1450 return Adapter->interface_rdm(Adapter->pvInterfaceAdapter,
1451
1452 uiRetVal = Adapter->interface_rdm(Adapter->pvInterfaceAdapter,
1453 uiAddress, pucBuff, sSize);1451 uiAddress, pucBuff, sSize);
1454
1455 if(uiRetVal < 0)
1456 return uiRetVal;
1457
1458 return uiRetVal;
1459}1452}
1453
1460int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize)1454int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize)
1461{1455{
1462 int iRetVal;1456 int iRetVal;
drivers/staging/bcm/PHSModule.c+12−12
@@ -209,7 +209,7 @@ int PHSTransmit(PMINI_ADAPTER Adapter, · 208 unmodified lines
209 return STATUS_SUCCESS;209 return STATUS_SUCCESS;
210}210}
211 211
212int PHSRecieve(PMINI_ADAPTER Adapter,212int PHSReceive(PMINI_ADAPTER Adapter,
213 USHORT usVcid,213 USHORT usVcid,
214 struct sk_buff *packet,214 struct sk_buff *packet,
215 UINT *punPacketLen,215 UINT *punPacketLen,
@@ -223,7 +223,7 @@ int PHSRecieve(PMINI_ADAPTER Adapter, · 7 unmodified lines
223 UINT TotalBytesAdded = 0;223 UINT TotalBytesAdded = 0;
224 if(!bHeaderSuppressionEnabled)224 if(!bHeaderSuppressionEnabled)
225 {225 {
226 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nPhs Disabled for incoming packet");226 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nPhs Disabled for incoming packet");
227 return ulPhsStatus;227 return ulPhsStatus;
228 }228 }
229 229
@@ -238,7 +238,7 @@ int PHSRecieve(PMINI_ADAPTER Adapter, · 8 unmodified lines
238 &nTotalsupressedPktHdrBytes,238 &nTotalsupressedPktHdrBytes,
239 &nStandardPktHdrLen);239 &nStandardPktHdrLen);
240 240
241 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nSupressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x",241 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nSupressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x",
242 nTotalsupressedPktHdrBytes,nStandardPktHdrLen);242 nTotalsupressedPktHdrBytes,nStandardPktHdrLen);
243 243
244 if(ulPhsStatus != STATUS_PHS_COMPRESSED)244 if(ulPhsStatus != STATUS_PHS_COMPRESSED)
@@ -786,14 +786,14 @@ ULONG PhsDeCompress(IN void* pvContext, · 541 unmodified lines
786 786
787 if(pDeviceExtension == NULL)787 if(pDeviceExtension == NULL)
788 {788 {
789 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"Invalid Device Extension\n");789 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"Invalid Device Extension\n");
790 return ERR_PHS_INVALID_DEVICE_EXETENSION;790 return ERR_PHS_INVALID_DEVICE_EXETENSION;
791 }791 }
792 792
793 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"Restoring header \n");793 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"Restoring header\n");
794 794
795 phsi = *((unsigned char *)(pvInputBuffer));795 phsi = *((unsigned char *)(pvInputBuffer));
796 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"PHSI To Be Used For restore : %x \n",phsi);796 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"PHSI To Be Used For restore : %x\n",phsi);
797 if(phsi == UNCOMPRESSED_PACKET )797 if(phsi == UNCOMPRESSED_PACKET )
798 {798 {
799 return STATUS_PHS_NOCOMPRESSION;799 return STATUS_PHS_NOCOMPRESSION;
@@ -804,7 +804,7 @@ ULONG PhsDeCompress(IN void* pvContext, · 4 unmodified lines
804 uiVcid,&pstServiceFlowEntry);804 uiVcid,&pstServiceFlowEntry);
805 if(nSFIndex == PHS_INVALID_TABLE_INDEX)805 if(nSFIndex == PHS_INVALID_TABLE_INDEX)
806 {806 {
807 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"SFID Match Failed During Lookup\n");807 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"SFID Match Failed During Lookup\n");
808 return ERR_SF_MATCH_FAIL;808 return ERR_SF_MATCH_FAIL;
809 }809 }
810 810
@@ -1417,7 +1417,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 606 unmodified lines
1417 int in_buf_len = *header_size-1;1417 int in_buf_len = *header_size-1;
1418 PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);1418 PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
1419 in_buf++;1419 in_buf++;
1420 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"====>\n");1420 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"====>\n");
1421 *header_size = 0;1421 *header_size = 0;
1422 1422
1423 if((decomp_phs_rules == NULL ))1423 if((decomp_phs_rules == NULL ))
@@ -1425,7 +1425,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 1 unmodified line
1425 1425
1426 1426
1427 tmp_memb = decomp_phs_rules;1427 tmp_memb = decomp_phs_rules;
1428 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI 1 %d",phsi));1428 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI 1 %d",phsi));
1429 //*header_size = tmp_memb->u8PHSFLength;1429 //*header_size = tmp_memb->u8PHSFLength;
1430 phss = tmp_memb->u8PHSS;1430 phss = tmp_memb->u8PHSS;
1431 phsf = tmp_memb->u8PHSF;1431 phsf = tmp_memb->u8PHSF;
@@ -1433,7 +1433,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 1 unmodified line
1433 1433
1434 if(phss > MAX_PHS_LENGTHS)1434 if(phss > MAX_PHS_LENGTHS)
1435 phss = MAX_PHS_LENGTHS;1435 phss = MAX_PHS_LENGTHS;
1436 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI %d phss %d index %d",phsi,phss,index));1436 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI %d phss %d index %d",phsi,phss,index));
1437 while((phss > 0) && (size < in_buf_len))1437 while((phss > 0) && (size < in_buf_len))
1438 {1438 {
1439 bit = ((*phsm << i)& SUPPRESS);1439 bit = ((*phsm << i)& SUPPRESS);
@@ -1441,13 +1441,13 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 1 unmodified line
1441 if(bit == SUPPRESS)1441 if(bit == SUPPRESS)
1442 {1442 {
1443 *out_buf = *phsf;1443 *out_buf = *phsf;
1444 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nDECOMP:In phss %d phsf %d ouput %d",1444 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phss %d phsf %d ouput %d",
1445 phss,*phsf,*out_buf);1445 phss,*phsf,*out_buf);
1446 }1446 }
1447 else1447 else
1448 {1448 {
1449 *out_buf = *in_buf;1449 *out_buf = *in_buf;
1450 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nDECOMP:In phss %d input %d ouput %d",1450 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phss %d input %d ouput %d",
1451 phss,*in_buf,*out_buf);1451 phss,*in_buf,*out_buf);
1452 in_buf++;1452 in_buf++;
1453 size++;1453 size++;
drivers/staging/bcm/PHSModule.h+1−1
@@ -9,7 +9,7 @@ int PHSTransmit(PMINI_ADAPTER Adapter, · 8 unmodified lines
9 PUINT PacketLen,9 PUINT PacketLen,
10 UCHAR bEthCSSupport);10 UCHAR bEthCSSupport);
11 11
12int PHSRecieve(PMINI_ADAPTER Adapter,12int PHSReceive(PMINI_ADAPTER Adapter,
13 USHORT usVcid,13 USHORT usVcid,
14 struct sk_buff *packet,14 struct sk_buff *packet,
15 UINT *punPacketLen,15 UINT *punPacketLen,
drivers/staging/bcm/headers.h+0−1
@@ -23,7 +23,6 @@ · 22 unmodified lines
23#include <linux/wait.h>23#include <linux/wait.h>
24#include <linux/proc_fs.h>24#include <linux/proc_fs.h>
25#include <linux/interrupt.h>25#include <linux/interrupt.h>
26#include <linux/version.h>
27#include <linux/stddef.h>26#include <linux/stddef.h>
28#include <linux/stat.h>27#include <linux/stat.h>
29#include <linux/fcntl.h>28#include <linux/fcntl.h>
drivers/staging/bcm/sort.c+33−44
@@ -1,4 +1,5 @@
1#include "headers.h"1#include "headers.h"
2#include <linux/sort.h>
2 3
3/*4/*
4 * File Name: sort.c5 * File Name: sort.c
@@ -10,54 +11,42 @@ · 5 unmodified lines
10 * Copyright (c) 2007 Beceem Communications Pvt. Ltd11 * Copyright (c) 2007 Beceem Communications Pvt. Ltd
11 */12 */
12 13
14static int compare_packet_info(void const *a, void const *b)
15{
16 PacketInfo const *pa = a;
17 PacketInfo const *pb = b;
18
19 if (!pa->bValid || !pb->bValid)
20 return 0;
21
22 return pa->u8TrafficPriority - pb->u8TrafficPriority;
23}
24
13VOID SortPackInfo(PMINI_ADAPTER Adapter)25VOID SortPackInfo(PMINI_ADAPTER Adapter)
14{26{
15 UINT nIndex1;27 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG,
16 UINT nIndex2;28 DBG_LVL_ALL, "<=======");
17 29
18 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=======");30 sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(PacketInfo),
19 31 compare_packet_info, NULL);
20 for(nIndex1 = 0; nIndex1 < NO_OF_QUEUES -2 ; nIndex1++)32}
21 {33
22 for(nIndex2 = nIndex1 + 1 ; nIndex2 < NO_OF_QUEUES -1 ; nIndex2++)34static int compare_classifiers(void const *a, void const *b)
23 {35{
24 if(Adapter->PackInfo[nIndex1].bValid && Adapter->PackInfo[nIndex2].bValid)36 S_CLASSIFIER_RULE const *pa = a;
25 {37 S_CLASSIFIER_RULE const *pb = b;
26 if(Adapter->PackInfo[nIndex2].u8TrafficPriority <38
27 Adapter->PackInfo[nIndex1].u8TrafficPriority)39 if (!pa->bUsed || !pb->bUsed)
28 {40 return 0;
29 PacketInfo stTemppackInfo = Adapter->PackInfo[nIndex2];41
30 Adapter->PackInfo[nIndex2] = Adapter->PackInfo[nIndex1];42 return pa->u8ClassifierRulePriority - pb->u8ClassifierRulePriority;
31 Adapter->PackInfo[nIndex1] = stTemppackInfo;
32
33 }
34 }
35 }
36 }
37}43}
38 44
39VOID SortClassifiers(PMINI_ADAPTER Adapter)45VOID SortClassifiers(PMINI_ADAPTER Adapter)
40{46{
41 UINT nIndex1;47 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG,
42 UINT nIndex2;48 DBG_LVL_ALL, "<=======");
43 49
44 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=======");50 sort(Adapter->astClassifierTable, MAX_CLASSIFIERS,
45 51 sizeof(S_CLASSIFIER_RULE), compare_classifiers, NULL);
46 for(nIndex1 = 0; nIndex1 < MAX_CLASSIFIERS -1 ; nIndex1++)
47 {
48 for(nIndex2 = nIndex1 + 1 ; nIndex2 < MAX_CLASSIFIERS ; nIndex2++)
49 {
50 if(Adapter->astClassifierTable[nIndex1].bUsed && Adapter->astClassifierTable[nIndex2].bUsed)
51 {
52 if(Adapter->astClassifierTable[nIndex2].u8ClassifierRulePriority <
53 Adapter->astClassifierTable[nIndex1].u8ClassifierRulePriority)
54 {
55 S_CLASSIFIER_RULE stTempClassifierRule = Adapter->astClassifierTable[nIndex2];
56 Adapter->astClassifierTable[nIndex2] = Adapter->astClassifierTable[nIndex1];
57 Adapter->astClassifierTable[nIndex1] = stTempClassifierRule;
58
59 }
60 }
61 }
62 }
63}52}
drivers/staging/brcm80211/Makefile+2−2
@@ -17,8 +17,8 @@ · 16 unmodified lines
17 17
18# common flags18# common flags
19subdir-ccflags-y := -DBCMDMA3219subdir-ccflags-y := -DBCMDMA32
20subdir-ccflags-$(CONFIG_BRCMDBG) += -DBCMDBG -DBCMDBG_ASSERT20subdir-ccflags-$(CONFIG_BRCMDBG) += -DBCMDBG
21 21
22obj-$(CONFIG_BRCMUTIL) += util/22obj-$(CONFIG_BRCMUTIL) += brcmutil/
23obj-$(CONFIG_BRCMFMAC) += brcmfmac/23obj-$(CONFIG_BRCMFMAC) += brcmfmac/
24obj-$(CONFIG_BRCMSMAC) += brcmsmac/24obj-$(CONFIG_BRCMSMAC) += brcmsmac/
drivers/staging/brcm80211/README+1−64
@@ -1,64 +1 @@
1Broadcom brcmsmac (mac80211-based softmac PCIe) and brcmfmac (SDIO) drivers.1refer to: http://linuxwireless.org/en/users/Drivers/brcm80211
2
3Completely open source host drivers, no binary object files.
4
5Support for the following chips:
6===============================
7
8 brcmsmac (PCIe)
9 Name Device ID
10 BCM4313 0x4727
11 BCM43224 0x4353
12 BCM43225 0x4357
13
14 brcmfmac (SDIO)
15 Name
16 BCM4329
17
18Both brcmsmac and brcmfmac drivers require firmware files that need to be
19separately downloaded.
20
21Firmware
22======================
23Firmware is available from the Linux firmware repository at:
24
25 git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
26 http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git
27 https://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git
28
29
30===============================================================
31Broadcom brcmsmac driver
32===============================================================
33- Support for both 32 and 64 bit Linux kernels
34
35
36Firmware installation
37======================
38Copy brcm/bcm43xx-0.fw and brcm/bcm43xx_hdr-0.fw to
39/lib/firmware/brcm (or wherever firmware is normally installed
40on your system).
41
42
43===============================================================
44Broadcom brcmfmac driver
45===============================================================
46- Support for 32 bit Linux kernel, 64 bit untested
47
48
49Firmware installation
50======================
51Copy brcm/bcm4329-fullmac-4.bin and brcm/bcm4329-fullmac-4.txt
52to /lib/firmware/brcm (or wherever firmware is normally installed on your
53system).
54
55
56Contact Info:
57=============
58Brett Rudley brudley@broadcom.com
59Henry Ptasinski henryp@broadcom.com
60Dowan Kim dowan@broadcom.com
61Roland Vossen rvossen@broadcom.com
62Arend van Spriel arend@broadcom.com
63
64For more info, refer to: http://linuxwireless.org/en/users/Drivers/brcm80211
drivers/staging/brcm80211/TODO+5−7
@@ -2,14 +2,12 @@ To Do List for Broadcom Mac80211 driver before getting in mainline · 1 unmodified line
2 2
3Bugs3Bugs
4====4====
5- Oops on AMPDU traffic, to be solved by new ucode (currently under test)5- none known at this moment
6 6
7brcmfmac and brcmsmac7brcmfmac
8=====================8=====================
9- ASSERTS not allowed in mainline, replace by warning + error handling9- ASSERTS deprecated in mainline, replace by warning + error handling
10- Replace printk and WL_ERROR() with proper routines
11 10
12brcmfmac11brcm80211 info page
13=====================12=====================
14- Replace driver's proprietary ssb interface with generic kernel ssb module13http://linuxwireless.org/en/users/Drivers/brcm80211
15- Build and test on 64 bit linux kernel
drivers/staging/brcm80211/brcmfmac/Makefile+5−22
@@ -16,23 +16,11 @@ · 15 unmodified lines
16# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.16# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 17
18ccflags-y := \18ccflags-y := \
19 -DARP_OFFLOAD_SUPPORT \19 -DBRCMF_FIRSTREAD=64 \
20 -DBCMLXSDMMC \20 -DBRCMF_SDALIGN=64 \
21 -DBCMPLATFORM_BUS \21 -DMAX_HDR_READ=64
22 -DBCMSDIO \
23 -DBDC \
24 -DBRCM_FULLMAC \
25 -DDHD_FIRSTREAD=64 \
26 -DDHD_SCHED \
27 -DDHD_SDALIGN=64 \
28 -DEMBEDDED_PLATFORM \
29 -DMAX_HDR_READ=64 \
30 -DMMC_SDIO_ABORT \
31 -DPKT_FILTER_SUPPORT \
32 -DSHOW_EVENTS \
33 -DTOE
34 22
35ccflags-$(CONFIG_BRCMDBG) += -DDHD_DEBUG23ccflags-$(CONFIG_BRCMDBG) += -DSHOW_EVENTS
36 24
37ccflags-y += \25ccflags-y += \
38 -Idrivers/staging/brcm80211/brcmfmac \26 -Idrivers/staging/brcm80211/brcmfmac \
@@ -40,17 +28,12 @@ ccflags-y += \ · 1 unmodified line
40 28
41DHDOFILES = \29DHDOFILES = \
42 wl_cfg80211.o \30 wl_cfg80211.o \
43 wl_iw.o \
44 dhd_cdc.o \31 dhd_cdc.o \
45 dhd_common.o \32 dhd_common.o \
46 dhd_custom_gpio.o \
47 dhd_sdio.o \33 dhd_sdio.o \
48 dhd_linux.o \34 dhd_linux.o \
49 dhd_linux_sched.o \
50 bcmsdh.o \35 bcmsdh.o \
51 bcmsdh_linux.o \36 bcmsdh_sdmmc.o
52 bcmsdh_sdmmc.o \
53 bcmsdh_sdmmc_linux.o
54 37
55obj-$(CONFIG_BRCMFMAC) += brcmfmac.o38obj-$(CONFIG_BRCMFMAC) += brcmfmac.o
56brcmfmac-objs += $(DHDOFILES)39brcmfmac-objs += $(DHDOFILES)
drivers/staging/brcm80211/brcmfmac/README+0−2
@@ -1,2 +0,0 @@
1
2
drivers/staging/brcm80211/brcmfmac/aiutils.c+0−1
@@ -1 +0,0 @@
1#include "../util/aiutils.c"
drivers/staging/brcm80211/brcmfmac/bcmcdc.h+0−98
@@ -1,98 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16#include <linux/if_ether.h>
17
18typedef struct cdc_ioctl {
19 u32 cmd; /* ioctl command value */
20 u32 len; /* lower 16: output buflen; upper 16:
21 input buflen (excludes header) */
22 u32 flags; /* flag defns given below */
23 u32 status; /* status code returned from the device */
24} cdc_ioctl_t;
25
26/* Max valid buffer size that can be sent to the dongle */
27#define CDC_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN)
28
29/* len field is divided into input and output buffer lengths */
30#define CDCL_IOC_OUTLEN_MASK 0x0000FFFF /* maximum or expected
31 response length, */
32 /* excluding IOCTL header */
33#define CDCL_IOC_OUTLEN_SHIFT 0
34#define CDCL_IOC_INLEN_MASK 0xFFFF0000 /* input buffer length,
35 excluding IOCTL header */
36#define CDCL_IOC_INLEN_SHIFT 16
37
38/* CDC flag definitions */
39#define CDCF_IOC_ERROR 0x01 /* 0=success, 1=ioctl cmd failed */
40#define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */
41#define CDCF_IOC_IF_MASK 0xF000 /* I/F index */
42#define CDCF_IOC_IF_SHIFT 12
43#define CDCF_IOC_ID_MASK 0xFFFF0000 /* used to uniquely id an ioctl
44 req/resp pairing */
45#define CDCF_IOC_ID_SHIFT 16 /* # of bits of shift for ID Mask */
46
47#define CDC_IOC_IF_IDX(flags) \
48 (((flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT)
49#define CDC_IOC_ID(flags) \
50 (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT)
51
52#define CDC_GET_IF_IDX(hdr) \
53 ((int)((((hdr)->flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT))
54#define CDC_SET_IF_IDX(hdr, idx) \
55 ((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | \
56 ((idx) << CDCF_IOC_IF_SHIFT)))
57
58/*
59 * BDC header
60 *
61 * The BDC header is used on data packets to convey priority across USB.
62 */
63
64#define BDC_HEADER_LEN 4
65
66#define BDC_PROTO_VER 1 /* Protocol version */
67
68#define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */
69#define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */
70
71#define BDC_FLAG__UNUSED 0x03 /* Unassigned */
72#define BDC_FLAG_SUM_GOOD 0x04 /* Dongle has verified good
73 RX checksums */
74#define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums */
75
76#define BDC_PRIORITY_MASK 0x7
77
78#define BDC_FLAG2_FC_FLAG 0x10 /* flag to indicate if pkt contains */
79 /* FLOW CONTROL info only */
80#define BDC_PRIORITY_FC_SHIFT 4 /* flow control info shift */
81
82#define BDC_FLAG2_IF_MASK 0x0f /* APSTA: interface on which the
83 packet was received */
84#define BDC_FLAG2_IF_SHIFT 0
85
86#define BDC_GET_IF_IDX(hdr) \
87 ((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT))
88#define BDC_SET_IF_IDX(hdr, idx) \
89 ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | \
90 ((idx) << BDC_FLAG2_IF_SHIFT)))
91
92struct bdc_header {
93 u8 flags; /* Flags */
94 u8 priority; /* 802.1d Priority 0:2 bits, 4:7 flow
95 control info for usb */
96 u8 flags2;
97 u8 rssi;
98};
drivers/staging/brcm80211/brcmfmac/bcmchip.h+3−6
@@ -17,12 +17,6 @@ · 16 unmodified lines
17#ifndef _bcmchip_h_17#ifndef _bcmchip_h_
18#define _bcmchip_h_18#define _bcmchip_h_
19 19
20/* Core reg address translation */
21#define CORE_CC_REG(base, field) (base + offsetof(chipcregs_t, field))
22#define CORE_BUS_REG(base, field) (base + offsetof(sdpcmd_regs_t, field))
23#define CORE_SB(base, field) \
24 (base + SBCONFIGOFF + offsetof(sbconfig_t, field))
25
26/* bcm4329 */20/* bcm4329 */
27/* SDIO device core, ID 0x829 */21/* SDIO device core, ID 0x829 */
28#define BCM4329_CORE_BUS_BASE 0x1801100022#define BCM4329_CORE_BUS_BASE 0x18011000
@@ -31,5 +25,8 @@ · 2 unmodified lines
31/* ARM Cortex M3 core, ID 0x82a */25/* ARM Cortex M3 core, ID 0x82a */
32#define BCM4329_CORE_ARM_BASE 0x1800200026#define BCM4329_CORE_ARM_BASE 0x18002000
33#define BCM4329_RAMSIZE 0x4800027#define BCM4329_RAMSIZE 0x48000
28/* firmware name */
29#define BCM4329_FW_NAME "brcm/bcm4329-fullmac-4.bin"
30#define BCM4329_NV_NAME "brcm/bcm4329-fullmac-4.txt"
34 31
35#endif /* _bcmchip_h_ */32#endif /* _bcmchip_h_ */
drivers/staging/brcm80211/brcmfmac/bcmsdbus.h+0−113
@@ -1,113 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _sdio_api_h_
18#define _sdio_api_h_
19
20#define SDIOH_API_RC_SUCCESS (0x00)
21#define SDIOH_API_RC_FAIL (0x01)
22#define SDIOH_API_SUCCESS(status) (status == 0)
23
24#define SDIOH_READ 0 /* Read request */
25#define SDIOH_WRITE 1 /* Write request */
26
27#define SDIOH_DATA_FIX 0 /* Fixed addressing */
28#define SDIOH_DATA_INC 1 /* Incremental addressing */
29
30#define SDIOH_CMD_TYPE_NORMAL 0 /* Normal command */
31#define SDIOH_CMD_TYPE_APPEND 1 /* Append command */
32#define SDIOH_CMD_TYPE_CUTTHRU 2 /* Cut-through command */
33
34#define SDIOH_DATA_PIO 0 /* PIO mode */
35#define SDIOH_DATA_DMA 1 /* DMA mode */
36
37typedef int SDIOH_API_RC;
38
39/* SDio Host structure */
40typedef struct sdioh_info sdioh_info_t;
41
42/* callback function, taking one arg */
43typedef void (*sdioh_cb_fn_t) (void *);
44
45/* attach, return handler on success, NULL if failed.
46 * The handler shall be provided by all subsequent calls. No local cache
47 * cfghdl points to the starting address of pci device mapped memory
48 */
49extern sdioh_info_t *sdioh_attach(void *cfghdl, uint irq);
50extern SDIOH_API_RC sdioh_detach(sdioh_info_t *si);
51extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si,
52 sdioh_cb_fn_t fn, void *argh);
53extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si);
54
55/* query whether SD interrupt is enabled or not */
56extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *si, bool *onoff);
57
58/* enable or disable SD interrupt */
59extern SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *si, bool enable_disable);
60
61#if defined(DHD_DEBUG)
62extern bool sdioh_interrupt_pending(sdioh_info_t *si);
63#endif
64
65extern int sdioh_claim_host_and_lock(sdioh_info_t *si);
66extern int sdioh_release_host_and_unlock(sdioh_info_t *si);
67
68/* read or write one byte using cmd52 */
69extern SDIOH_API_RC sdioh_request_byte(sdioh_info_t *si, uint rw, uint fnc,
70 uint addr, u8 *byte);
71
72/* read or write 2/4 bytes using cmd53 */
73extern SDIOH_API_RC sdioh_request_word(sdioh_info_t *si, uint cmd_type,
74 uint rw, uint fnc, uint addr,
75 u32 *word, uint nbyte);
76
77/* read or write any buffer using cmd53 */
78extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *si, uint pio_dma,
79 uint fix_inc, uint rw, uint fnc_num,
80 u32 addr, uint regwidth,
81 u32 buflen, u8 *buffer,
82 struct sk_buff *pkt);
83
84/* get cis data */
85extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, u8 *cis,
86 u32 length);
87
88extern SDIOH_API_RC sdioh_cfg_read(sdioh_info_t *si, uint fuc, u32 addr,
89 u8 *data);
90extern SDIOH_API_RC sdioh_cfg_write(sdioh_info_t *si, uint fuc, u32 addr,
91 u8 *data);
92
93/* query number of io functions */
94extern uint sdioh_query_iofnum(sdioh_info_t *si);
95
96/* handle iovars */
97extern int sdioh_iovar_op(sdioh_info_t *si, const char *name,
98 void *params, int plen, void *arg, int len, bool set);
99
100/* Issue abort to the specified function and clear controller as needed */
101extern int sdioh_abort(sdioh_info_t *si, uint fnc);
102
103/* Start and Stop SDIO without re-enumerating the SD card. */
104extern int sdioh_start(sdioh_info_t *si, int stage);
105extern int sdioh_stop(sdioh_info_t *si);
106
107/* Reset and re-initialize the device */
108extern int sdioh_sdio_reset(sdioh_info_t *si);
109
110/* Helper function */
111void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh);
112
113#endif /* _sdio_api_h_ */
drivers/staging/brcm80211/brcmfmac/bcmsdh.c+321−310
@@ -13,29 +13,59 @@ · 12 unmodified lines
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */15 */
16/* ****************** BCMSDH Interface Functions *************************** */16/* ****************** SDIO CARD Interface Functions **************************/
17 17
18#include <linux/types.h>18#include <linux/types.h>
19#include <linux/netdevice.h>19#include <linux/netdevice.h>
20#include <linux/pci.h>
20#include <linux/pci_ids.h>21#include <linux/pci_ids.h>
21#include <bcmdefs.h>22#include <linux/sched.h>
22#include <bcmdevs.h>23#include <linux/completion.h>
23#include <bcmutils.h>24
24#include <hndsoc.h>25#include <defs.h>
25 26#include <brcm_hw_ids.h>
26#include <bcmsdh.h> /* BRCM API for SDIO27#include <brcmu_utils.h>
27 clients (such as wl, dhd) */28#include <brcmu_wifi.h>
28#include <bcmsdbus.h> /* common SDIO/controller interface */29#include <soc.h>
29#include <sbsdio.h> /* BRCM sdio device core */
30
31#include <sdio.h> /* sdio spec */
32#include "dngl_stats.h"
33#include "dhd.h"30#include "dhd.h"
31#include "dhd_bus.h"
32#include "sdio_host.h"
34 33
35#define SDIOH_API_ACCESS_RETRY_LIMIT 234#define SDIOH_API_ACCESS_RETRY_LIMIT 2
36const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL;
37 35
38struct bcmsdh_info {36#define BRCMF_SD_ERROR_VAL 0x0001 /* Error */
37#define BRCMF_SD_INFO_VAL 0x0002 /* Info */
38
39
40#ifdef BCMDBG
41#define BRCMF_SD_ERROR(x) \
42 do { \
43 if ((brcmf_sdio_msglevel & BRCMF_SD_ERROR_VAL) && \
44 net_ratelimit()) \
45 printk x; \
46 } while (0)
47#define BRCMF_SD_INFO(x) \
48 do { \
49 if ((brcmf_sdio_msglevel & BRCMF_SD_INFO_VAL) && \
50 net_ratelimit()) \
51 printk x; \
52 } while (0)
53#else /* BCMDBG */
54#define BRCMF_SD_ERROR(x)
55#define BRCMF_SD_INFO(x)
56#endif /* BCMDBG */
57
58/* debugging macros */
59#define SDLX_MSG(x)
60
61#define SDIOH_CMD_TYPE_NORMAL 0 /* Normal command */
62#define SDIOH_CMD_TYPE_APPEND 1 /* Append command */
63#define SDIOH_CMD_TYPE_CUTTHRU 2 /* Cut-through command */
64
65#define SDIOH_DATA_PIO 0 /* PIO mode */
66#define SDIOH_DATA_DMA 1 /* DMA mode */
67
68struct brcmf_sdio_card {
39 bool init_success; /* underlying driver successfully attached */69 bool init_success; /* underlying driver successfully attached */
40 void *sdioh; /* handler for sdioh */70 void *sdioh; /* handler for sdioh */
41 u32 vendevid; /* Target Vendor and Device ID on SD bus */71 u32 vendevid; /* Target Vendor and Device ID on SD bus */
@@ -43,282 +73,232 @@ struct bcmsdh_info { · 1 unmodified line
43 reg_read/reg_write call */73 reg_read/reg_write call */
44 u32 sbwad; /* Save backplane window address */74 u32 sbwad; /* Save backplane window address */
45};75};
76
77/**
78 * SDIO Host Controller info
79 */
80struct sdio_hc {
81 struct sdio_hc *next;
82 struct device *dev; /* platform device handle */
83 void *regs; /* SDIO Host Controller address */
84 struct brcmf_sdio_card *card;
85 void *ch;
86 unsigned int oob_irq;
87 unsigned long oob_flags; /* OOB Host specifiction
88 as edge and etc */
89 bool oob_irq_registered;
90};
91
46/* local copy of bcm sd handler */92/* local copy of bcm sd handler */
47bcmsdh_info_t *l_bcmsdh;93static struct brcmf_sdio_card *l_card;
48 94
49#if defined(OOB_INTR_ONLY) && defined(HW_OOB)95const uint brcmf_sdio_msglevel = BRCMF_SD_ERROR_VAL;
50extern int sdioh_enable_hw_oob_intr(void *sdioh, bool enable);
51 96
52void bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable)97static struct sdio_hc *sdhcinfo;
53{98
54 sdioh_enable_hw_oob_intr(sdh->sdioh, enable);99/* driver info, initialized when brcmf_sdio_register is called */
55}100static struct brcmf_sdioh_driver drvinfo = { NULL, NULL };
56#endif101
102/* Module parameters specific to each host-controller driver */
103
104module_param(sd_msglevel, uint, 0);
57 105
58bcmsdh_info_t *bcmsdh_attach(void *cfghdl, void **regsva, uint irq)106extern uint sd_f2_blocksize;
107module_param(sd_f2_blocksize, int, 0);
108
109/* forward declarations */
110int brcmf_sdio_probe(struct device *dev);
111EXPORT_SYMBOL(brcmf_sdio_probe);
112
113int brcmf_sdio_remove(struct device *dev);
114EXPORT_SYMBOL(brcmf_sdio_remove);
115
116struct brcmf_sdio_card*
117brcmf_sdcard_attach(void *cfghdl, u32 *regsva, uint irq)
59{118{
60 bcmsdh_info_t *bcmsdh;119 struct brcmf_sdio_card *card;
61 120
62 bcmsdh = kzalloc(sizeof(bcmsdh_info_t), GFP_ATOMIC);121 card = kzalloc(sizeof(struct brcmf_sdio_card), GFP_ATOMIC);
63 if (bcmsdh == NULL) {122 if (card == NULL) {
64 BCMSDH_ERROR(("bcmsdh_attach: out of memory"));123 BRCMF_SD_ERROR(("sdcard_attach: out of memory"));
65 return NULL;124 return NULL;
66 }125 }
67 126
68 /* save the handler locally */127 /* save the handler locally */
69 l_bcmsdh = bcmsdh;128 l_card = card;
70 129
71 bcmsdh->sdioh = sdioh_attach(cfghdl, irq);130 card->sdioh = brcmf_sdioh_attach(cfghdl, irq);
72 if (!bcmsdh->sdioh) {131 if (!card->sdioh) {
73 bcmsdh_detach(bcmsdh);132 brcmf_sdcard_detach(card);
74 return NULL;133 return NULL;
75 }134 }
76 135
77 bcmsdh->init_success = true;136 card->init_success = true;
78 137
79 *regsva = (u32 *) SI_ENUM_BASE;138 *regsva = SI_ENUM_BASE;
80 139
81 /* Report the BAR, to fix if needed */140 /* Report the BAR, to fix if needed */
82 bcmsdh->sbwad = SI_ENUM_BASE;141 card->sbwad = SI_ENUM_BASE;
83 return bcmsdh;142 return card;
84}143}
85 144
86int bcmsdh_detach(void *sdh)145int brcmf_sdcard_detach(struct brcmf_sdio_card *card)
87{146{
88 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;147 if (card != NULL) {
89 148 if (card->sdioh) {
90 if (bcmsdh != NULL) {149 brcmf_sdioh_detach(card->sdioh);
91 if (bcmsdh->sdioh) {150 card->sdioh = NULL;
92 sdioh_detach(bcmsdh->sdioh);
93 bcmsdh->sdioh = NULL;
94 }151 }
95 kfree(bcmsdh);152 kfree(card);
96 }153 }
97 154
98 l_bcmsdh = NULL;155 l_card = NULL;
99 return 0;156 return 0;
100}157}
101 158
102int159int
103bcmsdh_iovar_op(void *sdh, const char *name,160brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name,
104 void *params, int plen, void *arg, int len, bool set)161 void *params, int plen, void *arg, int len, bool set)
105{162{
106 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;163 return brcmf_sdioh_iovar_op(card->sdioh, name, params, plen, arg,
107 return sdioh_iovar_op(bcmsdh->sdioh, name, params, plen, arg, len, set);164 len, set);
108}
109
110bool bcmsdh_intr_query(void *sdh)
111{
112 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
113 SDIOH_API_RC status;
114 bool on;
115
116 ASSERT(bcmsdh);
117 status = sdioh_interrupt_query(bcmsdh->sdioh, &on);
118 if (SDIOH_API_SUCCESS(status))
119 return false;
120 else
121 return on;
122}
123
124int bcmsdh_intr_enable(void *sdh)
125{
126 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
127 SDIOH_API_RC status;
128 ASSERT(bcmsdh);
129
130 status = sdioh_interrupt_set(bcmsdh->sdioh, true);
131 return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
132}165}
133 166
134int bcmsdh_intr_disable(void *sdh)167int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card)
135{168{
136 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;169 return brcmf_sdioh_interrupt_set(card->sdioh, true);
137 SDIOH_API_RC status;
138 ASSERT(bcmsdh);
139
140 status = sdioh_interrupt_set(bcmsdh->sdioh, false);
141 return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
142}170}
143 171
144int bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)172int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card)
145{173{
146 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;174 return brcmf_sdioh_interrupt_set(card->sdioh, false);
147 SDIOH_API_RC status;
148 ASSERT(bcmsdh);
149
150 status = sdioh_interrupt_register(bcmsdh->sdioh, fn, argh);
151 return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
152}175}
153 176
154int bcmsdh_intr_dereg(void *sdh)177int brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card,
178 void (*fn)(void *), void *argh)
155{179{
156 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;180 return brcmf_sdioh_interrupt_register(card->sdioh, fn, argh);
157 SDIOH_API_RC status;
158 ASSERT(bcmsdh);
159
160 status = sdioh_interrupt_deregister(bcmsdh->sdioh);
161 return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
162}181}
163 182
164#if defined(DHD_DEBUG)183int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card)
165bool bcmsdh_intr_pending(void *sdh)
166{184{
167 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;185 return brcmf_sdioh_interrupt_deregister(card->sdioh);
168
169 ASSERT(sdh);
170 return sdioh_interrupt_pending(bcmsdh->sdioh);
171}186}
172#endif
173 187
174int bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)188u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
189 int *err)
175{190{
176 ASSERT(sdh);191 int status;
177
178 /* don't support yet */
179 return -ENOTSUPP;
180}
181
182u8 bcmsdh_cfg_read(void *sdh, uint fnc_num, u32 addr, int *err)
183{
184 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
185 SDIOH_API_RC status;
186#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
187 s32 retry = 0;192 s32 retry = 0;
188#endif
189 u8 data = 0;193 u8 data = 0;
190 194
191 if (!bcmsdh)195 if (!card)
192 bcmsdh = l_bcmsdh;196 card = l_card;
193
194 ASSERT(bcmsdh->init_success);
195 197
196#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
197 do {198 do {
198 if (retry) /* wait for 1 ms till bus get settled down */199 if (retry) /* wait for 1 ms till bus get settled down */
199 udelay(1000);200 udelay(1000);
200#endif
201 status =201 status =
202 sdioh_cfg_read(bcmsdh->sdioh, fnc_num, addr,202 brcmf_sdioh_cfg_read(card->sdioh, fnc_num, addr,
203 (u8 *) &data);203 (u8 *) &data);
204#ifdef SDIOH_API_ACCESS_RETRY_LIMIT204 } while (status != 0
205 } while (!SDIOH_API_SUCCESS(status)
206 && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));205 && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
207#endif
208 if (err)206 if (err)
209 *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO);207 *err = status;
210 208
211 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n",209 BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n",
212 __func__, fnc_num, addr, data));210 __func__, fnc_num, addr, data));
213 211
214 return data;212 return data;
215}213}
216 214
217void215void
218bcmsdh_cfg_write(void *sdh, uint fnc_num, u32 addr, u8 data, int *err)216brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
217 u8 data, int *err)
219{218{
220 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;219 int status;
221 SDIOH_API_RC status;
222#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
223 s32 retry = 0;220 s32 retry = 0;
224#endif
225 221
226 if (!bcmsdh)222 if (!card)
227 bcmsdh = l_bcmsdh;223 card = l_card;
228 224
229 ASSERT(bcmsdh->init_success);
230
231#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
232 do {225 do {
233 if (retry) /* wait for 1 ms till bus get settled down */226 if (retry) /* wait for 1 ms till bus get settled down */
234 udelay(1000);227 udelay(1000);
235#endif
236 status =228 status =
237 sdioh_cfg_write(bcmsdh->sdioh, fnc_num, addr,229 brcmf_sdioh_cfg_write(card->sdioh, fnc_num, addr,
238 (u8 *) &data);230 (u8 *) &data);
239#ifdef SDIOH_API_ACCESS_RETRY_LIMIT231 } while (status != 0
240 } while (!SDIOH_API_SUCCESS(status)
241 && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));232 && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
242#endif
243 if (err)233 if (err)
244 *err = SDIOH_API_SUCCESS(status) ? 0 : -EIO;234 *err = status;
245 235
246 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n",236 BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n",
247 __func__, fnc_num, addr, data));237 __func__, fnc_num, addr, data));
248}238}
249 239
250u32 bcmsdh_cfg_read_word(void *sdh, uint fnc_num, u32 addr, int *err)240u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
241 u32 addr, int *err)
251{242{
252 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;243 int status;
253 SDIOH_API_RC status;
254 u32 data = 0;244 u32 data = 0;
255 245
256 if (!bcmsdh)246 if (!card)
257 bcmsdh = l_bcmsdh;247 card = l_card;
258
259 ASSERT(bcmsdh->init_success);
260 248
261 status =249 status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
262 sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_READ,250 SDIOH_READ, fnc_num, addr, &data, 4);
263 fnc_num, addr, &data, 4);
264 251
265 if (err)252 if (err)
266 *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO);253 *err = status;
267 254
268 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n",255 BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n",
269 __func__, fnc_num, addr, data));256 __func__, fnc_num, addr, data));
270 257
271 return data;258 return data;
272}259}
273 260
274void261void
275bcmsdh_cfg_write_word(void *sdh, uint fnc_num, u32 addr, u32 data,262brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num,
276 int *err)263 u32 addr, u32 data, int *err)
277{264{
278 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;265 int status;
279 SDIOH_API_RC status;
280
281 if (!bcmsdh)
282 bcmsdh = l_bcmsdh;
283 266
284 ASSERT(bcmsdh->init_success);267 if (!card)
268 card = l_card;
285 269
286 status =270 status =
287 sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL,271 brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
288 SDIOH_WRITE, fnc_num, addr, &data, 4);272 SDIOH_WRITE, fnc_num, addr, &data, 4);
289 273
290 if (err)274 if (err)
291 *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO);275 *err = status;
292 276
293 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n",277 BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n",
294 __func__, fnc_num, addr, data));278 __func__, fnc_num, addr, data));
295}279}
296 280
297int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length)281int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis,
282 uint length)
298{283{
299 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;284 int status;
300 SDIOH_API_RC status;
301 285
302 u8 *tmp_buf, *tmp_ptr;286 u8 *tmp_buf, *tmp_ptr;
303 u8 *ptr;287 u8 *ptr;
304 bool ascii = func & ~0xf;288 bool ascii = func & ~0xf;
305 func &= 0x7;289 func &= 0x7;
306 290
307 if (!bcmsdh)291 if (!card)
308 bcmsdh = l_bcmsdh;292 card = l_card;
309 293
310 ASSERT(bcmsdh->init_success);294 status = brcmf_sdioh_cis_read(card->sdioh, func, cis, length);
311 ASSERT(cis);
312 ASSERT(length <= SBSDIO_CIS_SIZE_LIMIT);
313
314 status = sdioh_cis_read(bcmsdh->sdioh, func, cis, length);
315 295
316 if (ascii) {296 if (ascii) {
317 /* Move binary bits to tmp and format them297 /* Move binary bits to tmp and format them
318 into the provided buffer. */298 into the provided buffer. */
319 tmp_buf = kmalloc(length, GFP_ATOMIC);299 tmp_buf = kmalloc(length, GFP_ATOMIC);
320 if (tmp_buf == NULL) {300 if (tmp_buf == NULL) {
321 BCMSDH_ERROR(("%s: out of memory\n", __func__));301 BRCMF_SD_ERROR(("%s: out of memory\n", __func__));
322 return -ENOMEM;302 return -ENOMEM;
323 }303 }
324 memcpy(tmp_buf, cis, length);304 memcpy(tmp_buf, cis, length);
@@ -331,60 +311,60 @@ int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length) · 6 unmodified lines
331 kfree(tmp_buf);311 kfree(tmp_buf);
332 }312 }
333 313
334 return SDIOH_API_SUCCESS(status) ? 0 : -EIO;314 return status;
335}315}
336 316
337static int bcmsdhsdio_set_sbaddr_window(void *sdh, u32 address)317static int
318brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_card *card, u32 address)
338{319{
339 int err = 0;320 int err = 0;
340 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;321 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
341 bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
342 (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);322 (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
343 if (!err)323 if (!err)
344 bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID,324 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
345 (address >> 16) & SBSDIO_SBADDRMID_MASK, &err);325 SBSDIO_FUNC1_SBADDRMID,
326 (address >> 16) & SBSDIO_SBADDRMID_MASK,
327 &err);
346 if (!err)328 if (!err)
347 bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH,329 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
348 (address >> 24) & SBSDIO_SBADDRHIGH_MASK,330 SBSDIO_FUNC1_SBADDRHIGH,
349 &err);331 (address >> 24) & SBSDIO_SBADDRHIGH_MASK,
332 &err);
350 333
351 return err;334 return err;
352}335}
353 336
354u32 bcmsdh_reg_read(void *sdh, u32 addr, uint size)337u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
355{338{
356 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;339 int status;
357 SDIOH_API_RC status;
358 u32 word = 0;340 u32 word = 0;
359 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;341 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
360 342
361 BCMSDH_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr));343 BRCMF_SD_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr));
362
363 if (!bcmsdh)
364 bcmsdh = l_bcmsdh;
365 344
366 ASSERT(bcmsdh->init_success);345 if (!card)
346 card = l_card;
367 347
368 if (bar0 != bcmsdh->sbwad) {348 if (bar0 != card->sbwad) {
369 if (bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0))349 if (brcmf_sdcard_set_sbaddr_window(card, bar0))
370 return 0xFFFFFFFF;350 return 0xFFFFFFFF;
371 351
372 bcmsdh->sbwad = bar0;352 card->sbwad = bar0;
373 }353 }
374 354
375 addr &= SBSDIO_SB_OFT_ADDR_MASK;355 addr &= SBSDIO_SB_OFT_ADDR_MASK;
376 if (size == 4)356 if (size == 4)
377 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;357 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
378 358
379 status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL,359 status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
380 SDIOH_READ, SDIO_FUNC_1, addr, &word, size);360 SDIOH_READ, SDIO_FUNC_1, addr, &word, size);
381 361
382 bcmsdh->regfail = !(SDIOH_API_SUCCESS(status));362 card->regfail = (status != 0);
383 363
384 BCMSDH_INFO(("u32data = 0x%x\n", word));364 BRCMF_SD_INFO(("u32data = 0x%x\n", word));
385 365
386 /* if ok, return appropriately masked word */366 /* if ok, return appropriately masked word */
387 if (SDIOH_API_SUCCESS(status)) {367 if (status == 0) {
388 switch (size) {368 switch (size) {
389 case sizeof(u8):369 case sizeof(u8):
390 return word & 0xff;370 return word & 0xff;
@@ -393,90 +373,86 @@ u32 bcmsdh_reg_read(void *sdh, u32 addr, uint size) · 2 unmodified lines
393 case sizeof(u32):373 case sizeof(u32):
394 return word;374 return word;
395 default:375 default:
396 bcmsdh->regfail = true;376 card->regfail = true;
397 377
398 }378 }
399 }379 }
400 380
401 /* otherwise, bad sdio access or invalid size */381 /* otherwise, bad sdio access or invalid size */
402 BCMSDH_ERROR(("%s: error reading addr 0x%04x size %d\n", __func__,382 BRCMF_SD_ERROR(("%s: error reading addr 0x%04x size %d\n", __func__,
403 addr, size));383 addr, size));
404 return 0xFFFFFFFF;384 return 0xFFFFFFFF;
405}385}
406 386
407u32 bcmsdh_reg_write(void *sdh, u32 addr, uint size, u32 data)387u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
388 u32 data)
408{389{
409 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;390 int status;
410 SDIOH_API_RC status;
411 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;391 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
412 int err = 0;392 int err = 0;
413 393
414 BCMSDH_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n",394 BRCMF_SD_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n",
415 __func__, addr, size * 8, data));395 __func__, addr, size * 8, data));
416 396
417 if (!bcmsdh)397 if (!card)
418 bcmsdh = l_bcmsdh;398 card = l_card;
419
420 ASSERT(bcmsdh->init_success);
421 399
422 if (bar0 != bcmsdh->sbwad) {400 if (bar0 != card->sbwad) {
423 err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0);401 err = brcmf_sdcard_set_sbaddr_window(card, bar0);
424 if (err)402 if (err)
425 return err;403 return err;
426 404
427 bcmsdh->sbwad = bar0;405 card->sbwad = bar0;
428 }406 }
429 407
430 addr &= SBSDIO_SB_OFT_ADDR_MASK;408 addr &= SBSDIO_SB_OFT_ADDR_MASK;
431 if (size == 4)409 if (size == 4)
432 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;410 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
433 status =411 status =
434 sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL,412 brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
435 SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size);413 SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size);
436 bcmsdh->regfail = !(SDIOH_API_SUCCESS(status));414 card->regfail = (status != 0);
437 415
438 if (SDIOH_API_SUCCESS(status))416 if (status == 0)
439 return 0;417 return 0;
440 418
441 BCMSDH_ERROR(("%s: error writing 0x%08x to addr 0x%04x size %d\n",419 BRCMF_SD_ERROR(("%s: error writing 0x%08x to addr 0x%04x size %d\n",
442 __func__, data, addr, size));420 __func__, data, addr, size));
443 return 0xFFFFFFFF;421 return 0xFFFFFFFF;
444}422}
445 423
446bool bcmsdh_regfail(void *sdh)424bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card)
447{425{
448 return ((bcmsdh_info_t *) sdh)->regfail;426 return card->regfail;
449}427}
450 428
451int429int
452bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags,430brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
453 u8 *buf, uint nbytes, struct sk_buff *pkt,431 uint flags,
454 bcmsdh_cmplt_fn_t complete, void *handle)432 u8 *buf, uint nbytes, struct sk_buff *pkt,
455{433 void (*complete)(void *handle, int status,
456 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;434 bool sync_waiting),
457 SDIOH_API_RC status;435 void *handle)
436{
437 int status;
458 uint incr_fix;438 uint incr_fix;
459 uint width;439 uint width;
460 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;440 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
461 int err = 0;441 int err = 0;
462 442
463 ASSERT(bcmsdh);443 BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
464 ASSERT(bcmsdh->init_success);
465
466 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
467 __func__, fn, addr, nbytes));444 __func__, fn, addr, nbytes));
468 445
469 /* Async not implemented yet */446 /* Async not implemented yet */
470 ASSERT(!(flags & SDIO_REQ_ASYNC));
471 if (flags & SDIO_REQ_ASYNC)447 if (flags & SDIO_REQ_ASYNC)
472 return -ENOTSUPP;448 return -ENOTSUPP;
473 449
474 if (bar0 != bcmsdh->sbwad) {450 if (bar0 != card->sbwad) {
475 err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0);451 err = brcmf_sdcard_set_sbaddr_window(card, bar0);
476 if (err)452 if (err)
477 return err;453 return err;
478 454
479 bcmsdh->sbwad = bar0;455 card->sbwad = bar0;
480 }456 }
481 457
482 addr &= SBSDIO_SB_OFT_ADDR_MASK;458 addr &= SBSDIO_SB_OFT_ADDR_MASK;
@@ -486,42 +462,37 @@ bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags, · 3 unmodified lines
486 if (width == 4)462 if (width == 4)
487 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;463 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
488 464
489 status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix,465 status = brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO,
490 SDIOH_READ, fn, addr, width, nbytes, buf,466 incr_fix, SDIOH_READ, fn, addr, width, nbytes, buf, pkt);
491 pkt);
492 467
493 return SDIOH_API_SUCCESS(status) ? 0 : -EIO;468 return status;
494}469}
495 470
496int471int
497bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags,472brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
498 u8 *buf, uint nbytes, void *pkt,473 uint flags, u8 *buf, uint nbytes, void *pkt,
499 bcmsdh_cmplt_fn_t complete, void *handle)474 void (*complete)(void *handle, int status,
475 bool sync_waiting),
476 void *handle)
500{477{
501 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
502 SDIOH_API_RC status;
503 uint incr_fix;478 uint incr_fix;
504 uint width;479 uint width;
505 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;480 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
506 int err = 0;481 int err = 0;
507 482
508 ASSERT(bcmsdh);483 BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
509 ASSERT(bcmsdh->init_success);
510
511 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
512 __func__, fn, addr, nbytes));484 __func__, fn, addr, nbytes));
513 485
514 /* Async not implemented yet */486 /* Async not implemented yet */
515 ASSERT(!(flags & SDIO_REQ_ASYNC));
516 if (flags & SDIO_REQ_ASYNC)487 if (flags & SDIO_REQ_ASYNC)
517 return -ENOTSUPP;488 return -ENOTSUPP;
518 489
519 if (bar0 != bcmsdh->sbwad) {490 if (bar0 != card->sbwad) {
520 err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0);491 err = brcmf_sdcard_set_sbaddr_window(card, bar0);
521 if (err)492 if (err)
522 return err;493 return err;
523 494
524 bcmsdh->sbwad = bar0;495 card->sbwad = bar0;
525 }496 }
526 497
527 addr &= SBSDIO_SB_OFT_ADDR_MASK;498 addr &= SBSDIO_SB_OFT_ADDR_MASK;
@@ -531,101 +502,141 @@ bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags, · 3 unmodified lines
531 if (width == 4)502 if (width == 4)
532 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;503 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
533 504
534 status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix,505 return brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO,
535 SDIOH_WRITE, fn, addr, width, nbytes, buf,506 incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt);
536 pkt);
537
538 return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
539}507}
540 508
541int bcmsdh_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, uint nbytes)509int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr,
510 u8 *buf, uint nbytes)
542{511{
543 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
544 SDIOH_API_RC status;
545
546 ASSERT(bcmsdh);
547 ASSERT(bcmsdh->init_success);
548 ASSERT((addr & SBSDIO_SBWINDOW_MASK) == 0);
549
550 addr &= SBSDIO_SB_OFT_ADDR_MASK;512 addr &= SBSDIO_SB_OFT_ADDR_MASK;
551 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;513 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
552 514
553 status =515 return brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO,
554 sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, SDIOH_DATA_INC,516 SDIOH_DATA_INC, (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,
555 (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,517 addr, 4, nbytes, buf, NULL);
556 addr, 4, nbytes, buf, NULL);
557
558 return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
559}518}
560 519
561int bcmsdh_abort(void *sdh, uint fn)520int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn)
562{521{
563 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;522 return brcmf_sdioh_abort(card->sdioh, fn);
564
565 return sdioh_abort(bcmsdh->sdioh, fn);
566}523}
567 524
568int bcmsdh_start(void *sdh, int stage)525int brcmf_sdcard_query_device(struct brcmf_sdio_card *card)
569{526{
570 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;527 card->vendevid = (PCI_VENDOR_ID_BROADCOM << 16) | 0;
571 528 return card->vendevid;
572 return sdioh_start(bcmsdh->sdioh, stage);
573}529}
574 530
575int bcmsdh_stop(void *sdh)531u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card)
576{532{
577 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;533 if (!card)
534 card = l_card;
578 535
579 return sdioh_stop(bcmsdh->sdioh);536 return card->sbwad;
580}537}
581 538
582int bcmsdh_query_device(void *sdh)539int brcmf_sdio_probe(struct device *dev)
583{540{
584 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;541 struct sdio_hc *sdhc = NULL;
585 bcmsdh->vendevid = (PCI_VENDOR_ID_BROADCOM << 16) | 0;542 u32 regs = 0;
586 return bcmsdh->vendevid;543 struct brcmf_sdio_card *card = NULL;
587}544 int irq = 0;
545 u32 vendevid;
546 unsigned long irq_flags = 0;
588 547
589uint bcmsdh_query_iofnum(void *sdh)548 /* allocate SDIO Host Controller state info */
590{549 sdhc = kzalloc(sizeof(struct sdio_hc), GFP_ATOMIC);
591 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;550 if (!sdhc) {
551 SDLX_MSG(("%s: out of memory\n", __func__));
552 goto err;
553 }
554 sdhc->dev = (void *)dev;
592 555
593 if (!bcmsdh)556 card = brcmf_sdcard_attach((void *)0, &regs, irq);
594 bcmsdh = l_bcmsdh;557 if (!card) {
558 SDLX_MSG(("%s: attach failed\n", __func__));
559 goto err;
560 }
595 561
596 return sdioh_query_iofnum(bcmsdh->sdioh);562 sdhc->card = card;
597}563 sdhc->oob_irq = irq;
564 sdhc->oob_flags = irq_flags;
565 sdhc->oob_irq_registered = false; /* to make sure.. */
566
567 /* chain SDIO Host Controller info together */
568 sdhc->next = sdhcinfo;
569 sdhcinfo = sdhc;
570 /* Read the vendor/device ID from the CIS */
571 vendevid = brcmf_sdcard_query_device(card);
572
573 /* try to attach to the target device */
574 sdhc->ch = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF),
575 0, 0, 0, 0, regs, card);
576 if (!sdhc->ch) {
577 SDLX_MSG(("%s: device attach failed\n", __func__));
578 goto err;
579 }
598 580
599int bcmsdh_reset(bcmsdh_info_t *sdh)581 return 0;
600{
601 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
602 582
603 return sdioh_sdio_reset(bcmsdh->sdioh);583 /* error handling */
604}584err:
585 if (sdhc) {
586 if (sdhc->card)
587 brcmf_sdcard_detach(sdhc->card);
588 kfree(sdhc);
589 }
605 590
606void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh)591 return -ENODEV;
607{
608 ASSERT(sdh);
609 return sdh->sdioh;
610}592}
611 593
612/* Function to pass device-status bits to DHD. */594int brcmf_sdio_remove(struct device *dev)
613u32 bcmsdh_get_dstatus(void *sdh)
614{595{
596 struct sdio_hc *sdhc, *prev;
597
598 sdhc = sdhcinfo;
599 drvinfo.detach(sdhc->ch);
600 brcmf_sdcard_detach(sdhc->card);
601 /* find the SDIO Host Controller state for this pdev
602 and take it out from the list */
603 for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) {
604 if (sdhc->dev == (void *)dev) {
605 if (prev)
606 prev->next = sdhc->next;
607 else
608 sdhcinfo = NULL;
609 break;
610 }
611 prev = sdhc;
612 }
613 if (!sdhc) {
614 SDLX_MSG(("%s: failed\n", __func__));
615 return 0;
616 }
617
618 /* release SDIO Host Controller info */
619 kfree(sdhc);
615 return 0;620 return 0;
616}621}
617 622
618u32 bcmsdh_cur_sbwad(void *sdh)623int brcmf_sdio_register(struct brcmf_sdioh_driver *driver)
619{624{
620 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;625 drvinfo = *driver;
621 626
622 if (!bcmsdh)627 SDLX_MSG(("Linux Kernel SDIO/MMC Driver\n"));
623 bcmsdh = l_bcmsdh;628 return brcmf_sdio_function_init();
629}
624 630
625 return bcmsdh->sbwad;631void brcmf_sdio_unregister(void)
632{
633 brcmf_sdio_function_cleanup();
626}634}
627 635
628void bcmsdh_chipinfo(void *sdh, u32 chip, u32 chiprev)636void brcmf_sdio_wdtmr_enable(bool enable)
629{637{
630 return;638 if (enable)
639 brcmf_sdbrcm_wd_timer(sdhcinfo->ch, brcmf_watchdog_ms);
640 else
641 brcmf_sdbrcm_wd_timer(sdhcinfo->ch, 0);
631}642}
drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c+0−386
@@ -1,386 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17/**
18 * @file bcmsdh_linux.c
19 */
20
21#define __UNDEF_NO_VERSION__
22
23#include <linux/netdevice.h>
24#include <linux/pci.h>
25#include <linux/completion.h>
26
27#include <pcicfg.h>
28#include <bcmdefs.h>
29#include <bcmdevs.h>
30#include <bcmutils.h>
31
32#if defined(OOB_INTR_ONLY)
33#include <linux/irq.h>
34extern void dhdsdio_isr(void *args);
35#include <dngl_stats.h>
36#include <dhd.h>
37#endif /* defined(OOB_INTR_ONLY) */
38#if defined(CONFIG_MACH_SANDGATE2G) || defined(CONFIG_MACH_LOGICPD_PXA270)
39#if !defined(BCMPLATFORM_BUS)
40#define BCMPLATFORM_BUS
41#endif /* !defined(BCMPLATFORM_BUS) */
42
43#include <linux/platform_device.h>
44#endif /* CONFIG_MACH_SANDGATE2G */
45
46#include "dngl_stats.h"
47#include "dhd.h"
48
49/**
50 * SDIO Host Controller info
51 */
52typedef struct bcmsdh_hc bcmsdh_hc_t;
53
54struct bcmsdh_hc {
55 bcmsdh_hc_t *next;
56#ifdef BCMPLATFORM_BUS
57 struct device *dev; /* platform device handle */
58#else
59 struct pci_dev *dev; /* pci device handle */
60#endif /* BCMPLATFORM_BUS */
61 void *regs; /* SDIO Host Controller address */
62 bcmsdh_info_t *sdh; /* SDIO Host Controller handle */
63 void *ch;
64 unsigned int oob_irq;
65 unsigned long oob_flags; /* OOB Host specifiction
66 as edge and etc */
67 bool oob_irq_registered;
68#if defined(OOB_INTR_ONLY)
69 spinlock_t irq_lock;
70#endif
71};
72static bcmsdh_hc_t *sdhcinfo;
73
74/* driver info, initialized when bcmsdh_register is called */
75static bcmsdh_driver_t drvinfo = { NULL, NULL };
76
77/* debugging macros */
78#define SDLX_MSG(x)
79
80/**
81 * Checks to see if vendor and device IDs match a supported SDIO Host Controller.
82 */
83bool bcmsdh_chipmatch(u16 vendor, u16 device)
84{
85 /* Add other vendors and devices as required */
86
87#ifdef BCMSDIOH_STD
88 /* Check for Arasan host controller */
89 if (vendor == VENDOR_SI_IMAGE)
90 return true;
91
92 /* Check for BRCM 27XX Standard host controller */
93 if (device == BCM27XX_SDIOH_ID && vendor == PCI_VENDOR_ID_BROADCOM)
94 return true;
95
96 /* Check for BRCM Standard host controller */
97 if (device == SDIOH_FPGA_ID && vendor == PCI_VENDOR_ID_BROADCOM)
98 return true;
99
100 /* Check for TI PCIxx21 Standard host controller */
101 if (device == PCIXX21_SDIOH_ID && vendor == VENDOR_TI)
102 return true;
103
104 if (device == PCIXX21_SDIOH0_ID && vendor == VENDOR_TI)
105 return true;
106
107 /* Ricoh R5C822 Standard SDIO Host */
108 if (device == R5C822_SDIOH_ID && vendor == VENDOR_RICOH)
109 return true;
110
111 /* JMicron Standard SDIO Host */
112 if (device == JMICRON_SDIOH_ID && vendor == VENDOR_JMICRON)
113 return true;
114#endif /* BCMSDIOH_STD */
115#ifdef BCMSDIOH_SPI
116 /* This is the PciSpiHost. */
117 if (device == SPIH_FPGA_ID && vendor == PCI_VENDOR_ID_BROADCOM) {
118 return true;
119 }
120#endif /* BCMSDIOH_SPI */
121
122 return false;
123}
124
125#if defined(BCMPLATFORM_BUS)
126#if defined(BCMLXSDMMC)
127/* forward declarations */
128int bcmsdh_probe(struct device *dev);
129EXPORT_SYMBOL(bcmsdh_probe);
130
131int bcmsdh_remove(struct device *dev);
132EXPORT_SYMBOL(bcmsdh_remove);
133
134#else
135/* forward declarations */
136static int __devinit bcmsdh_probe(struct device *dev);
137static int __devexit bcmsdh_remove(struct device *dev);
138#endif /* BCMLXSDMMC */
139
140#ifndef BCMLXSDMMC
141static
142#endif /* BCMLXSDMMC */
143int bcmsdh_probe(struct device *dev)
144{
145 bcmsdh_hc_t *sdhc = NULL;
146 unsigned long regs = 0;
147 bcmsdh_info_t *sdh = NULL;
148#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS)
149 struct platform_device *pdev;
150 struct resource *r;
151#endif /* BCMLXSDMMC */
152 int irq = 0;
153 u32 vendevid;
154 unsigned long irq_flags = 0;
155
156#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS)
157 pdev = to_platform_device(dev);
158 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
159 irq = platform_get_irq(pdev, 0);
160 if (!r || irq == NO_IRQ)
161 return -ENXIO;
162#endif /* BCMLXSDMMC */
163
164#if defined(OOB_INTR_ONLY)
165#ifdef HW_OOB
166 irq_flags =
167 IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL |
168 IORESOURCE_IRQ_SHAREABLE;
169#else
170 irq_flags = IRQF_TRIGGER_FALLING;
171#endif /* HW_OOB */
172 irq = dhd_customer_oob_irq_map(&irq_flags);
173 if (irq < 0) {
174 SDLX_MSG(("%s: Host irq is not defined\n", __func__));
175 return 1;
176 }
177#endif /* defined(OOB_INTR_ONLY) */
178 /* allocate SDIO Host Controller state info */
179 sdhc = kzalloc(sizeof(bcmsdh_hc_t), GFP_ATOMIC);
180 if (!sdhc) {
181 SDLX_MSG(("%s: out of memory\n", __func__));
182 goto err;
183 }
184 sdhc->dev = (void *)dev;
185
186#ifdef BCMLXSDMMC
187 sdh = bcmsdh_attach((void *)0, (void **)&regs, irq);
188 if (!sdh) {
189 SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
190 goto err;
191 }
192#else
193 sdh = bcmsdh_attach((void *)r->start, (void **)&regs, irq);
194 if (!sdh) {
195 SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
196 goto err;
197 }
198#endif /* BCMLXSDMMC */
199 sdhc->sdh = sdh;
200 sdhc->oob_irq = irq;
201 sdhc->oob_flags = irq_flags;
202 sdhc->oob_irq_registered = false; /* to make sure.. */
203#if defined(OOB_INTR_ONLY)
204 spin_lock_init(&sdhc->irq_lock);
205#endif
206
207 /* chain SDIO Host Controller info together */
208 sdhc->next = sdhcinfo;
209 sdhcinfo = sdhc;
210 /* Read the vendor/device ID from the CIS */
211 vendevid = bcmsdh_query_device(sdh);
212
213 /* try to attach to the target device */
214 sdhc->ch = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF),
215 0, 0, 0, 0, (void *)regs, sdh);
216 if (!sdhc->ch) {
217 SDLX_MSG(("%s: device attach failed\n", __func__));
218 goto err;
219 }
220
221 return 0;
222
223 /* error handling */
224err:
225 if (sdhc) {
226 if (sdhc->sdh)
227 bcmsdh_detach(sdhc->sdh);
228 kfree(sdhc);
229 }
230
231 return -ENODEV;
232}
233
234#ifndef BCMLXSDMMC
235static
236#endif /* BCMLXSDMMC */
237int bcmsdh_remove(struct device *dev)
238{
239 bcmsdh_hc_t *sdhc, *prev;
240
241 sdhc = sdhcinfo;
242 drvinfo.detach(sdhc->ch);
243 bcmsdh_detach(sdhc->sdh);
244 /* find the SDIO Host Controller state for this pdev
245 and take it out from the list */
246 for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) {
247 if (sdhc->dev == (void *)dev) {
248 if (prev)
249 prev->next = sdhc->next;
250 else
251 sdhcinfo = NULL;
252 break;
253 }
254 prev = sdhc;
255 }
256 if (!sdhc) {
257 SDLX_MSG(("%s: failed\n", __func__));
258 return 0;
259 }
260
261 /* release SDIO Host Controller info */
262 kfree(sdhc);
263
264#if !defined(BCMLXSDMMC)
265 dev_set_drvdata(dev, NULL);
266#endif /* !defined(BCMLXSDMMC) */
267
268 return 0;
269}
270#endif /* BCMPLATFORM_BUS */
271
272extern int sdio_function_init(void);
273
274int bcmsdh_register(bcmsdh_driver_t *driver)
275{
276 drvinfo = *driver;
277
278 SDLX_MSG(("Linux Kernel SDIO/MMC Driver\n"));
279 return sdio_function_init();
280}
281
282extern void sdio_function_cleanup(void);
283
284void bcmsdh_unregister(void)
285{
286 sdio_function_cleanup();
287}
288
289#if defined(OOB_INTR_ONLY)
290void bcmsdh_oob_intr_set(bool enable)
291{
292 static bool curstate = 1;
293 unsigned long flags;
294
295 spin_lock_irqsave(&sdhcinfo->irq_lock, flags);
296 if (curstate != enable) {
297 if (enable)
298 enable_irq(sdhcinfo->oob_irq);
299 else
300 disable_irq_nosync(sdhcinfo->oob_irq);
301 curstate = enable;
302 }
303 spin_unlock_irqrestore(&sdhcinfo->irq_lock, flags);
304}
305
306static irqreturn_t wlan_oob_irq(int irq, void *dev_id)
307{
308 dhd_pub_t *dhdp;
309
310 dhdp = (dhd_pub_t *) dev_get_drvdata(sdhcinfo->dev);
311
312 bcmsdh_oob_intr_set(0);
313
314 if (dhdp == NULL) {
315 SDLX_MSG(("Out of band GPIO interrupt fired way too early\n"));
316 return IRQ_HANDLED;
317 }
318
319 dhdsdio_isr((void *)dhdp->bus);
320
321 return IRQ_HANDLED;
322}
323
324int bcmsdh_register_oob_intr(void *dhdp)
325{
326 int error = 0;
327
328 SDLX_MSG(("%s Enter\n", __func__));
329
330 sdhcinfo->oob_flags =
331 IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL |
332 IORESOURCE_IRQ_SHAREABLE;
333 dev_set_drvdata(sdhcinfo->dev, dhdp);
334
335 if (!sdhcinfo->oob_irq_registered) {
336 SDLX_MSG(("%s IRQ=%d Type=%X\n", __func__,
337 (int)sdhcinfo->oob_irq, (int)sdhcinfo->oob_flags));
338 /* Refer to customer Host IRQ docs about
339 proper irqflags definition */
340 error =
341 request_irq(sdhcinfo->oob_irq, wlan_oob_irq,
342 sdhcinfo->oob_flags, "bcmsdh_sdmmc", NULL);
343 if (error)
344 return -ENODEV;
345
346 irq_set_irq_wake(sdhcinfo->oob_irq, 1);
347 sdhcinfo->oob_irq_registered = true;
348 }
349
350 return 0;
351}
352
353void bcmsdh_unregister_oob_intr(void)
354{
355 SDLX_MSG(("%s: Enter\n", __func__));
356
357 irq_set_irq_wake(sdhcinfo->oob_irq, 0);
358 disable_irq(sdhcinfo->oob_irq); /* just in case.. */
359 free_irq(sdhcinfo->oob_irq, NULL);
360 sdhcinfo->oob_irq_registered = false;
361}
362#endif /* defined(OOB_INTR_ONLY) */
363/* Module parameters specific to each host-controller driver */
364
365extern uint sd_msglevel; /* Debug message level */
366module_param(sd_msglevel, uint, 0);
367
368extern uint sd_power; /* 0 = SD Power OFF,
369 1 = SD Power ON. */
370module_param(sd_power, uint, 0);
371
372extern uint sd_clock; /* SD Clock Control, 0 = SD Clock OFF,
373 1 = SD Clock ON */
374module_param(sd_clock, uint, 0);
375
376extern uint sd_divisor; /* Divisor (-1 means external clock) */
377module_param(sd_divisor, uint, 0);
378
379extern uint sd_sdmode; /* Default is SD4, 0=SPI, 1=SD1, 2=SD4 */
380module_param(sd_sdmode, uint, 0);
381
382extern uint sd_hiok; /* Ok to use hi-speed mode */
383module_param(sd_hiok, uint, 0);
384
385extern uint sd_f2_blocksize;
386module_param(sd_f2_blocksize, int, 0);
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c+441−484
@@ -15,64 +15,179 @@ · 14 unmodified lines
15 */15 */
16#include <linux/types.h>16#include <linux/types.h>
17#include <linux/netdevice.h>17#include <linux/netdevice.h>
18#include <bcmdefs.h>18#include <linux/mmc/sdio.h>
19#include <bcmdevs.h>
20#include <bcmutils.h>
21#include <sdio.h> /* SDIO Device and Protocol Specs */
22#include <sdioh.h> /* SDIO Host Controller Specification */
23#include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */
24#include <sdiovar.h> /* ioctl/iovars */
25
26#include <linux/mmc/core.h>19#include <linux/mmc/core.h>
27#include <linux/mmc/sdio_func.h>20#include <linux/mmc/sdio_func.h>
28#include <linux/mmc/sdio_ids.h>21#include <linux/mmc/sdio_ids.h>
22#include <linux/mmc/card.h>
29#include <linux/suspend.h>23#include <linux/suspend.h>
24#include <linux/errno.h>
25#include <linux/sched.h> /* request_irq() */
26#include <net/cfg80211.h>
30 27
31#include <dngl_stats.h>28#include <defs.h>
32#include <dhd.h>29#include <brcm_hw_ids.h>
30#include <brcmu_utils.h>
31#include <brcmu_wifi.h>
32#include "sdio_host.h"
33#include "dhd.h"
34#include "dhd_dbg.h"
35#include "wl_cfg80211.h"
33 36
34#include "bcmsdh_sdmmc.h"37#define BLOCK_SIZE_64 64
38#define BLOCK_SIZE_512 512
39#define BLOCK_SIZE_4318 64
40#define BLOCK_SIZE_4328 512
35 41
36extern int sdio_function_init(void);42/* private bus modes */
37extern void sdio_function_cleanup(void);43#define SDIOH_MODE_SD4 2
38 44
39#if !defined(OOB_INTR_ONLY)45#define CLIENT_INTR 0x100 /* Get rid of this! */
40static void IRQHandler(struct sdio_func *func);
41static void IRQHandlerF2(struct sdio_func *func);
42#endif /* !defined(OOB_INTR_ONLY) */
43static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr);
44extern int sdio_reset_comm(struct mmc_card *card);
45 46
46extern PBCMSDH_SDMMC_INSTANCE gInstance;47#if !defined(SDIO_VENDOR_ID_BROADCOM)
48#define SDIO_VENDOR_ID_BROADCOM 0x02d0
49#endif /* !defined(SDIO_VENDOR_ID_BROADCOM) */
47 50
48uint sd_sdmode = SDIOH_MODE_SD4; /* Use SD4 mode by default */51#define SDIO_DEVICE_ID_BROADCOM_DEFAULT 0x0000
49uint sd_f2_blocksize = 512; /* Default blocksize */52
53#define DMA_ALIGN_MASK 0x03
50 54
51uint sd_divisor = 2; /* Default 48MHz/2 = 24MHz */55#if !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB)
56#define SDIO_DEVICE_ID_BROADCOM_4325_SDGWB 0x0492 /* BCM94325SDGWB */
57#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) */
58#if !defined(SDIO_DEVICE_ID_BROADCOM_4325)
59#define SDIO_DEVICE_ID_BROADCOM_4325 0x0493
60#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325) */
61#if !defined(SDIO_DEVICE_ID_BROADCOM_4329)
62#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329
63#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */
64#if !defined(SDIO_DEVICE_ID_BROADCOM_4319)
65#define SDIO_DEVICE_ID_BROADCOM_4319 0x4319
66#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */
67
68/* Common msglevel constants */
69#define SDH_ERROR_VAL 0x0001 /* Error */
70#define SDH_TRACE_VAL 0x0002 /* Trace */
71#define SDH_INFO_VAL 0x0004 /* Info */
72#define SDH_DEBUG_VAL 0x0008 /* Debug */
73#define SDH_DATA_VAL 0x0010 /* Data */
74#define SDH_CTRL_VAL 0x0020 /* Control Regs */
75#define SDH_LOG_VAL 0x0040 /* Enable bcmlog */
76#define SDH_DMA_VAL 0x0080 /* DMA */
77
78#ifdef BCMDBG
79#define sd_err(x) \
80 do { \
81 if ((sd_msglevel & SDH_ERROR_VAL) && net_ratelimit()) \
82 printk x; \
83 } while (0)
84#define sd_trace(x) \
85 do { \
86 if ((sd_msglevel & SDH_TRACE_VAL) && net_ratelimit()) \
87 printk x; \
88 } while (0)
89#define sd_info(x) \
90 do { \
91 if ((sd_msglevel & SDH_INFO_VAL) && net_ratelimit()) \
92 printk x; \
93 } while (0)
94#define sd_debug(x) \
95 do { \
96 if ((sd_msglevel & SDH_DEBUG_VAL) && net_ratelimit()) \
97 printk x; \
98 } while (0)
99#define sd_data(x) \
100 do { \
101 if ((sd_msglevel & SDH_DATA_VAL) && net_ratelimit()) \
102 printk x; \
103 } while (0)
104#define sd_ctrl(x) \
105 do { \
106 if ((sd_msglevel & SDH_CTRL_VAL) && net_ratelimit()) \
107 printk x; \
108 } while (0)
109#else
110#define sd_err(x)
111#define sd_trace(x)
112#define sd_info(x)
113#define sd_debug(x)
114#define sd_data(x)
115#define sd_ctrl(x)
116#endif
117
118struct sdos_info {
119 struct sdioh_info *sd;
120 spinlock_t lock;
121};
122
123static void brcmf_sdioh_irqhandler(struct sdio_func *func);
124static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func);
125static int brcmf_sdioh_get_cisaddr(struct sdioh_info *sd, u32 regaddr);
126static int brcmf_ops_sdio_probe(struct sdio_func *func,
127 const struct sdio_device_id *id);
128static void brcmf_ops_sdio_remove(struct sdio_func *func);
129
130#ifdef CONFIG_PM
131static int brcmf_sdio_suspend(struct device *dev);
132static int brcmf_sdio_resume(struct device *dev);
133#endif /* CONFIG_PM */
134
135uint sd_f2_blocksize = 512; /* Default blocksize */
52 136
53uint sd_power = 1; /* Default to SD Slot powered ON */
54uint sd_clock = 1; /* Default to SD Clock turned ON */
55uint sd_hiok = false; /* Don't use hi-speed mode by default */
56uint sd_msglevel = 0x01;137uint sd_msglevel = 0x01;
57uint sd_use_dma = true;
58DHD_PM_RESUME_WAIT_INIT(sdioh_request_byte_wait);
59DHD_PM_RESUME_WAIT_INIT(sdioh_request_word_wait);
60DHD_PM_RESUME_WAIT_INIT(sdioh_request_packet_wait);
61DHD_PM_RESUME_WAIT_INIT(sdioh_request_buffer_wait);
62 138
63#define DMA_ALIGN_MASK 0x03139/* module param defaults */
140static int clockoverride;
64 141
65int sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, u32 regaddr,142module_param(clockoverride, int, 0644);
66 int regsize, u32 *data);143MODULE_PARM_DESC(clockoverride, "SDIO card clock override");
67 144
68void sdioh_sdio_set_host_pm_flags(int flag)145struct brcmf_sdmmc_instance *gInstance;
69{146
70 if (sdio_set_host_pm_flags(gInstance->func[1], flag))147struct device sdmmc_dev;
71 printk(KERN_ERR "%s: Failed to set pm_flags 0x%08x\n",\148
72 __func__, (unsigned int)flag);149/* devices we support, null terminated */
73}150static const struct sdio_device_id brcmf_sdmmc_ids[] = {
151 {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_DEFAULT)},
152 {SDIO_DEVICE
153 (SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325_SDGWB)},
154 {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325)},
155 {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329)},
156 {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4319)},
157 { /* end: all zeroes */ },
158};
159
160#ifdef CONFIG_PM
161static const struct dev_pm_ops brcmf_sdio_pm_ops = {
162 .suspend = brcmf_sdio_suspend,
163 .resume = brcmf_sdio_resume,
164};
165#endif /* CONFIG_PM */
166
167static struct sdio_driver brcmf_sdmmc_driver = {
168 .probe = brcmf_ops_sdio_probe,
169 .remove = brcmf_ops_sdio_remove,
170 .name = "brcmfmac",
171 .id_table = brcmf_sdmmc_ids,
172#ifdef CONFIG_PM
173 .drv = {
174 .pm = &brcmf_sdio_pm_ops,
175 },
176#endif /* CONFIG_PM */
177};
178
179MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);
180
181BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_byte_wait);
182BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_word_wait);
183BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_packet_wait);
184BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_buffer_wait);
74 185
75static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd)186static int
187brcmf_sdioh_card_regread(struct sdioh_info *sd, int func, u32 regaddr,
188 int regsize, u32 *data);
189
190static int brcmf_sdioh_enablefuncs(struct sdioh_info *sd)
76{191{
77 int err_ret;192 int err_ret;
78 u32 fbraddr;193 u32 fbraddr;
@@ -81,16 +196,16 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) · 2 unmodified lines
81 sd_trace(("%s\n", __func__));196 sd_trace(("%s\n", __func__));
82 197
83 /* Get the Card's common CIS address */198 /* Get the Card's common CIS address */
84 sd->com_cis_ptr = sdioh_sdmmc_get_cisaddr(sd, SDIOD_CCCR_CISPTR_0);199 sd->com_cis_ptr = brcmf_sdioh_get_cisaddr(sd, SDIO_CCCR_CIS);
85 sd->func_cis_ptr[0] = sd->com_cis_ptr;200 sd->func_cis_ptr[0] = sd->com_cis_ptr;
86 sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __func__,201 sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __func__,
87 sd->com_cis_ptr));202 sd->com_cis_ptr));
88 203
89 /* Get the Card's function CIS (for each function) */204 /* Get the Card's function CIS (for each function) */
90 for (fbraddr = SDIOD_FBR_STARTADDR, func = 1;205 for (fbraddr = SDIO_FBR_BASE(1), func = 1;
91 func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) {206 func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) {
92 sd->func_cis_ptr[func] =207 sd->func_cis_ptr[func] =
93 sdioh_sdmmc_get_cisaddr(sd, SDIOD_FBR_CISPTR_0 + fbraddr);208 brcmf_sdioh_get_cisaddr(sd, SDIO_FBR_CIS + fbraddr);
94 sd_info(("%s: Function %d CIS Ptr = 0x%x\n", __func__, func,209 sd_info(("%s: Function %d CIS Ptr = 0x%x\n", __func__, func,
95 sd->func_cis_ptr[func]));210 sd->func_cis_ptr[func]));
96 }211 }
@@ -104,8 +219,8 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) · 7 unmodified lines
104 err_ret = sdio_enable_func(gInstance->func[1]);219 err_ret = sdio_enable_func(gInstance->func[1]);
105 sdio_release_host(gInstance->func[1]);220 sdio_release_host(gInstance->func[1]);
106 if (err_ret) {221 if (err_ret) {
107 sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: 0x%08x",222 sd_err(("brcmf_sdioh_enablefuncs: Failed to enable F1 "
108 err_ret));223 "Err: 0x%08x\n", err_ret));
109 }224 }
110 225
111 return false;226 return false;
@@ -114,9 +229,9 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) · 2 unmodified lines
114/*229/*
115 * Public entry points & extern's230 * Public entry points & extern's
116 */231 */
117sdioh_info_t *sdioh_attach(void *bar0, uint irq)232struct sdioh_info *brcmf_sdioh_attach(void *bar0, uint irq)
118{233{
119 sdioh_info_t *sd;234 struct sdioh_info *sd;
120 int err_ret;235 int err_ret;
121 236
122 sd_trace(("%s\n", __func__));237 sd_trace(("%s\n", __func__));
@@ -126,19 +241,18 @@ sdioh_info_t *sdioh_attach(void *bar0, uint irq) · 3 unmodified lines
126 return NULL;241 return NULL;
127 }242 }
128 243
129 sd = kzalloc(sizeof(sdioh_info_t), GFP_ATOMIC);244 sd = kzalloc(sizeof(struct sdioh_info), GFP_ATOMIC);
130 if (sd == NULL) {245 if (sd == NULL) {
131 sd_err(("sdioh_attach: out of memory\n"));246 sd_err(("sdioh_attach: out of memory\n"));
132 return NULL;247 return NULL;
133 }248 }
134 if (sdioh_sdmmc_osinit(sd) != 0) {249 if (brcmf_sdioh_osinit(sd) != 0) {
135 sd_err(("%s:sdioh_sdmmc_osinit() failed\n", __func__));250 sd_err(("%s:sdioh_sdmmc_osinit() failed\n", __func__));
136 kfree(sd);251 kfree(sd);
137 return NULL;252 return NULL;
138 }253 }
139 254
140 sd->num_funcs = 2;255 sd->num_funcs = 2;
141 sd->sd_blockmode = true;
142 sd->use_client_ints = true;256 sd->use_client_ints = true;
143 sd->client_block_size[0] = 64;257 sd->client_block_size[0] = 64;
144 258
@@ -150,7 +264,7 @@ sdioh_info_t *sdioh_attach(void *bar0, uint irq) · 5 unmodified lines
150 sd->client_block_size[1] = 64;264 sd->client_block_size[1] = 64;
151 err_ret = sdio_set_block_size(gInstance->func[1], 64);265 err_ret = sdio_set_block_size(gInstance->func[1], 64);
152 if (err_ret)266 if (err_ret)
153 sd_err(("bcmsdh_sdmmc: Failed to set F1 blocksize\n"));267 sd_err(("brcmf_sdioh_attach: Failed to set F1 blocksize\n"));
154 268
155 /* Release host controller F1 */269 /* Release host controller F1 */
156 sdio_release_host(gInstance->func[1]);270 sdio_release_host(gInstance->func[1]);
@@ -163,20 +277,20 @@ sdioh_info_t *sdioh_attach(void *bar0, uint irq) · 6 unmodified lines
163 err_ret =277 err_ret =
164 sdio_set_block_size(gInstance->func[2], sd_f2_blocksize);278 sdio_set_block_size(gInstance->func[2], sd_f2_blocksize);
165 if (err_ret)279 if (err_ret)
166 sd_err(("bcmsdh_sdmmc: Failed to set F2 blocksize "280 sd_err(("brcmf_sdioh_attach: Failed to set F2 blocksize"
167 "to %d\n", sd_f2_blocksize));281 " to %d\n", sd_f2_blocksize));
168 282
169 /* Release host controller F2 */283 /* Release host controller F2 */
170 sdio_release_host(gInstance->func[2]);284 sdio_release_host(gInstance->func[2]);
171 }285 }
172 286
173 sdioh_sdmmc_card_enablefuncs(sd);287 brcmf_sdioh_enablefuncs(sd);
174 288
175 sd_trace(("%s: Done\n", __func__));289 sd_trace(("%s: Done\n", __func__));
176 return sd;290 return sd;
177}291}
178 292
179extern SDIOH_API_RC sdioh_detach(sdioh_info_t *sd)293extern int brcmf_sdioh_detach(struct sdioh_info *sd)
180{294{
181 sd_trace(("%s\n", __func__));295 sd_trace(("%s\n", __func__));
182 296
@@ -193,92 +307,25 @@ extern SDIOH_API_RC sdioh_detach(sdioh_info_t *sd) · 10 unmodified lines
193 sdio_release_host(gInstance->func[1]);307 sdio_release_host(gInstance->func[1]);
194 308
195 /* deregister irq */309 /* deregister irq */
196 sdioh_sdmmc_osfree(sd);310 brcmf_sdioh_osfree(sd);
197 311
198 kfree(sd);312 kfree(sd);
199 }313 }
200 return SDIOH_API_RC_SUCCESS;314 return 0;
201}
202
203#if defined(OOB_INTR_ONLY) && defined(HW_OOB)
204
205extern SDIOH_API_RC sdioh_enable_func_intr(void)
206{
207 u8 reg;
208 int err;
209
210 if (gInstance->func[0]) {
211 sdio_claim_host(gInstance->func[0]);
212
213 reg = sdio_readb(gInstance->func[0], SDIOD_CCCR_INTEN, &err);
214 if (err) {
215 sd_err(("%s: error for read SDIO_CCCR_IENx : 0x%x\n",
216 __func__, err));
217 sdio_release_host(gInstance->func[0]);
218 return SDIOH_API_RC_FAIL;
219 }
220
221 /* Enable F1 and F2 interrupts, set master enable */
222 reg |=
223 (INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN |
224 INTR_CTL_MASTER_EN);
225
226 sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err);
227 sdio_release_host(gInstance->func[0]);
228
229 if (err) {
230 sd_err(("%s: error for write SDIO_CCCR_IENx : 0x%x\n",
231 __func__, err));
232 return SDIOH_API_RC_FAIL;
233 }
234 }
235
236 return SDIOH_API_RC_SUCCESS;
237}
238
239extern SDIOH_API_RC sdioh_disable_func_intr(void)
240{
241 u8 reg;
242 int err;
243
244 if (gInstance->func[0]) {
245 sdio_claim_host(gInstance->func[0]);
246 reg = sdio_readb(gInstance->func[0], SDIOD_CCCR_INTEN, &err);
247 if (err) {
248 sd_err(("%s: error for read SDIO_CCCR_IENx : 0x%x\n",
249 __func__, err));
250 sdio_release_host(gInstance->func[0]);
251 return SDIOH_API_RC_FAIL;
252 }
253
254 reg &= ~(INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN);
255 /* Disable master interrupt with the last function interrupt */
256 if (!(reg & 0xFE))
257 reg = 0;
258 sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err);
259
260 sdio_release_host(gInstance->func[0]);
261 if (err) {
262 sd_err(("%s: error for write SDIO_CCCR_IENx : 0x%x\n",
263 __func__, err));
264 return SDIOH_API_RC_FAIL;
265 }
266 }
267 return SDIOH_API_RC_SUCCESS;
268}315}
269#endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */
270 316
271/* Configure callback to client when we receive client interrupt */317/* Configure callback to client when we receive client interrupt */
272extern SDIOH_API_RC318extern int
273sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh)319brcmf_sdioh_interrupt_register(struct sdioh_info *sd, void (*fn)(void *),
320 void *argh)
274{321{
275 sd_trace(("%s: Entering\n", __func__));322 sd_trace(("%s: Entering\n", __func__));
276 if (fn == NULL) {323 if (fn == NULL) {
277 sd_err(("%s: interrupt handler is NULL, not registering\n",324 sd_err(("%s: interrupt handler is NULL, not registering\n",
278 __func__));325 __func__));
279 return SDIOH_API_RC_FAIL;326 return -EINVAL;
280 }327 }
281#if !defined(OOB_INTR_ONLY)328
282 sd->intr_handler = fn;329 sd->intr_handler = fn;
283 sd->intr_handler_arg = argh;330 sd->intr_handler_arg = argh;
284 sd->intr_handler_valid = true;331 sd->intr_handler_valid = true;
@@ -286,26 +333,23 @@ sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh) · 1 unmodified line
286 /* register and unmask irq */333 /* register and unmask irq */
287 if (gInstance->func[2]) {334 if (gInstance->func[2]) {
288 sdio_claim_host(gInstance->func[2]);335 sdio_claim_host(gInstance->func[2]);
289 sdio_claim_irq(gInstance->func[2], IRQHandlerF2);336 sdio_claim_irq(gInstance->func[2], brcmf_sdioh_irqhandler_f2);
290 sdio_release_host(gInstance->func[2]);337 sdio_release_host(gInstance->func[2]);
291 }338 }
292 339
293 if (gInstance->func[1]) {340 if (gInstance->func[1]) {
294 sdio_claim_host(gInstance->func[1]);341 sdio_claim_host(gInstance->func[1]);
295 sdio_claim_irq(gInstance->func[1], IRQHandler);342 sdio_claim_irq(gInstance->func[1], brcmf_sdioh_irqhandler);
296 sdio_release_host(gInstance->func[1]);343 sdio_release_host(gInstance->func[1]);
297 }344 }
298#elif defined(HW_OOB)345
299 sdioh_enable_func_intr();346 return 0;
300#endif /* defined(OOB_INTR_ONLY) */
301 return SDIOH_API_RC_SUCCESS;
302}347}
303 348
304extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *sd)349extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *sd)
305{350{
306 sd_trace(("%s: Entering\n", __func__));351 sd_trace(("%s: Entering\n", __func__));
307 352
308#if !defined(OOB_INTR_ONLY)
309 if (gInstance->func[1]) {353 if (gInstance->func[1]) {
310 /* register and unmask irq */354 /* register and unmask irq */
311 sdio_claim_host(gInstance->func[1]);355 sdio_claim_host(gInstance->func[1]);
@@ -324,73 +368,28 @@ extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *sd) · 12 unmodified lines
324 sd->intr_handler_valid = false;368 sd->intr_handler_valid = false;
325 sd->intr_handler = NULL;369 sd->intr_handler = NULL;
326 sd->intr_handler_arg = NULL;370 sd->intr_handler_arg = NULL;
327#elif defined(HW_OOB)
328 sdioh_disable_func_intr();
329#endif /* !defined(OOB_INTR_ONLY) */
330 return SDIOH_API_RC_SUCCESS;
331}
332
333extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *sd, bool *onoff)
334{
335 sd_trace(("%s: Entering\n", __func__));
336 *onoff = sd->client_intr_enabled;
337 return SDIOH_API_RC_SUCCESS;
338}
339 371
340#if defined(DHD_DEBUG)
341extern bool sdioh_interrupt_pending(sdioh_info_t *sd)
342{
343 return 0;372 return 0;
344}373}
345#endif
346
347uint sdioh_query_iofnum(sdioh_info_t *sd)
348{
349 return sd->num_funcs;
350}
351 374
352/* IOVar table */375/* IOVar table */
353enum {376enum {
354 IOV_MSGLEVEL = 1,377 IOV_MSGLEVEL = 1,
355 IOV_BLOCKMODE,
356 IOV_BLOCKSIZE,378 IOV_BLOCKSIZE,
357 IOV_DMA,
358 IOV_USEINTS,379 IOV_USEINTS,
359 IOV_NUMINTS,380 IOV_NUMINTS,
360 IOV_NUMLOCALINTS,
361 IOV_HOSTREG,
362 IOV_DEVREG,381 IOV_DEVREG,
363 IOV_DIVISOR,
364 IOV_SDMODE,
365 IOV_HISPEED,
366 IOV_HCIREGS,382 IOV_HCIREGS,
367 IOV_POWER,
368 IOV_CLOCK,
369 IOV_RXCHAIN383 IOV_RXCHAIN
370};384};
371 385
372const bcm_iovar_t sdioh_iovars[] = {386const struct brcmu_iovar sdioh_iovars[] = {
373 {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0},387 {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0},
374 {"sd_blockmode", IOV_BLOCKMODE, 0, IOVT_BOOL, 0},
375 {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0},/* ((fn << 16) |388 {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0},/* ((fn << 16) |
376 size) */389 size) */
377 {"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0},
378 {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0},390 {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0},
379 {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0},391 {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0},
380 {"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0},392 {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)}
381 {"sd_hostreg", IOV_HOSTREG, 0, IOVT_BUFFER, sizeof(sdreg_t)}
382 ,
383 {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t)}
384 ,
385 {"sd_divisor", IOV_DIVISOR, 0, IOVT_UINT32, 0}
386 ,
387 {"sd_power", IOV_POWER, 0, IOVT_UINT32, 0}
388 ,
389 {"sd_clock", IOV_CLOCK, 0, IOVT_UINT32, 0}
390 ,
391 {"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100}
392 ,
393 {"sd_highspeed", IOV_HISPEED, 0, IOVT_UINT32, 0}
394 ,393 ,
395 {"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0}394 {"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0}
396 ,395 ,
@@ -398,33 +397,37 @@ const bcm_iovar_t sdioh_iovars[] = { · 1 unmodified line
398};397};
399 398
400int399int
401sdioh_iovar_op(sdioh_info_t *si, const char *name,400brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,
402 void *params, int plen, void *arg, int len, bool set)401 void *params, int plen, void *arg, int len, bool set)
403{402{
404 const bcm_iovar_t *vi = NULL;403 const struct brcmu_iovar *vi = NULL;
405 int bcmerror = 0;404 int bcmerror = 0;
406 int val_size;405 int val_size;
407 s32 int_val = 0;406 s32 int_val = 0;
408 bool bool_val;407 bool bool_val;
409 u32 actionid;408 u32 actionid;
410 409
411 ASSERT(name);410 if (name == NULL || len <= 0)
412 ASSERT(len >= 0);411 return -EINVAL;
412
413 /* Set does not take qualifiers */
414 if (set && (params || plen))
415 return -EINVAL;
413 416
414 /* Get must have return space; Set does not take qualifiers */417 /* Get must have return space;*/
415 ASSERT(set || (arg && len));418 if (!set && !(arg && len))
416 ASSERT(!set || (!params && !plen));419 return -EINVAL;
417 420
418 sd_trace(("%s: Enter (%s %s)\n", __func__, (set ? "set" : "get"),421 sd_trace(("%s: Enter (%s %s)\n", __func__, (set ? "set" : "get"),
419 name));422 name));
420 423
421 vi = bcm_iovar_lookup(sdioh_iovars, name);424 vi = brcmu_iovar_lookup(sdioh_iovars, name);
422 if (vi == NULL) {425 if (vi == NULL) {
423 bcmerror = -ENOTSUPP;426 bcmerror = -ENOTSUPP;
424 goto exit;427 goto exit;
425 }428 }
426 429
427 bcmerror = bcm_iovar_lencheck(vi, arg, len, set);430 bcmerror = brcmu_iovar_lencheck(vi, arg, len, set);
428 if (bcmerror != 0)431 if (bcmerror != 0)
429 goto exit;432 goto exit;
430 433
@@ -457,16 +460,6 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 26 unmodified lines
457 sd_msglevel = int_val;460 sd_msglevel = int_val;
458 break;461 break;
459 462
460 case IOV_GVAL(IOV_BLOCKMODE):
461 int_val = (s32) si->sd_blockmode;
462 memcpy(arg, &int_val, val_size);
463 break;
464
465 case IOV_SVAL(IOV_BLOCKMODE):
466 si->sd_blockmode = (bool) int_val;
467 /* Haven't figured out how to make non-block mode with DMA */
468 break;
469
470 case IOV_GVAL(IOV_BLOCKSIZE):463 case IOV_GVAL(IOV_BLOCKSIZE):
471 if ((u32) int_val > si->num_funcs) {464 if ((u32) int_val > si->num_funcs) {
472 bcmerror = -EINVAL;465 bcmerror = -EINVAL;
@@ -518,15 +511,6 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 45 unmodified lines
518 memcpy(arg, &int_val, val_size);511 memcpy(arg, &int_val, val_size);
519 break;512 break;
520 513
521 case IOV_GVAL(IOV_DMA):
522 int_val = (s32) si->sd_use_dma;
523 memcpy(arg, &int_val, val_size);
524 break;
525
526 case IOV_SVAL(IOV_DMA):
527 si->sd_use_dma = (bool) int_val;
528 break;
529
530 case IOV_GVAL(IOV_USEINTS):514 case IOV_GVAL(IOV_USEINTS):
531 int_val = (s32) si->use_client_ints;515 int_val = (s32) si->use_client_ints;
532 memcpy(arg, &int_val, val_size);516 memcpy(arg, &int_val, val_size);
@@ -541,117 +525,18 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 8 unmodified lines
541 525
542 break;526 break;
543 527
544 case IOV_GVAL(IOV_DIVISOR):
545 int_val = (u32) sd_divisor;
546 memcpy(arg, &int_val, val_size);
547 break;
548
549 case IOV_SVAL(IOV_DIVISOR):
550 sd_divisor = int_val;
551 break;
552
553 case IOV_GVAL(IOV_POWER):
554 int_val = (u32) sd_power;
555 memcpy(arg, &int_val, val_size);
556 break;
557
558 case IOV_SVAL(IOV_POWER):
559 sd_power = int_val;
560 break;
561
562 case IOV_GVAL(IOV_CLOCK):
563 int_val = (u32) sd_clock;
564 memcpy(arg, &int_val, val_size);
565 break;
566
567 case IOV_SVAL(IOV_CLOCK):
568 sd_clock = int_val;
569 break;
570
571 case IOV_GVAL(IOV_SDMODE):
572 int_val = (u32) sd_sdmode;
573 memcpy(arg, &int_val, val_size);
574 break;
575
576 case IOV_SVAL(IOV_SDMODE):
577 sd_sdmode = int_val;
578 break;
579
580 case IOV_GVAL(IOV_HISPEED):
581 int_val = (u32) sd_hiok;
582 memcpy(arg, &int_val, val_size);
583 break;
584
585 case IOV_SVAL(IOV_HISPEED):
586 sd_hiok = int_val;
587 break;
588
589 case IOV_GVAL(IOV_NUMINTS):528 case IOV_GVAL(IOV_NUMINTS):
590 int_val = (s32) si->intrcount;529 int_val = (s32) si->intrcount;
591 memcpy(arg, &int_val, val_size);530 memcpy(arg, &int_val, val_size);
592 break;531 break;
593 532
594 case IOV_GVAL(IOV_NUMLOCALINTS):
595 int_val = (s32) 0;
596 memcpy(arg, &int_val, val_size);
597 break;
598
599 case IOV_GVAL(IOV_HOSTREG):
600 {
601 sdreg_t *sd_ptr = (sdreg_t *) params;
602
603 if (sd_ptr->offset < SD_SysAddr
604 || sd_ptr->offset > SD_MaxCurCap) {
605 sd_err(("%s: bad offset 0x%x\n", __func__,
606 sd_ptr->offset));
607 bcmerror = -EINVAL;
608 break;
609 }
610
611 sd_trace(("%s: rreg%d at offset %d\n", __func__,
612 (sd_ptr->offset & 1) ? 8
613 : ((sd_ptr->offset & 2) ? 16 : 32),
614 sd_ptr->offset));
615 if (sd_ptr->offset & 1)
616 int_val = 8; /* sdioh_sdmmc_rreg8(si,
617 sd_ptr->offset); */
618 else if (sd_ptr->offset & 2)
619 int_val = 16; /* sdioh_sdmmc_rreg16(si,
620 sd_ptr->offset); */
621 else
622 int_val = 32; /* sdioh_sdmmc_rreg(si,
623 sd_ptr->offset); */
624
625 memcpy(arg, &int_val, sizeof(int_val));
626 break;
627 }
628
629 case IOV_SVAL(IOV_HOSTREG):
630 {
631 sdreg_t *sd_ptr = (sdreg_t *) params;
632
633 if (sd_ptr->offset < SD_SysAddr
634 || sd_ptr->offset > SD_MaxCurCap) {
635 sd_err(("%s: bad offset 0x%x\n", __func__,
636 sd_ptr->offset));
637 bcmerror = -EINVAL;
638 break;
639 }
640
641 sd_trace(("%s: wreg%d value 0x%08x at offset %d\n",
642 __func__, sd_ptr->value,
643 (sd_ptr->offset & 1) ? 8
644 : ((sd_ptr->offset & 2) ? 16 : 32),
645 sd_ptr->offset));
646 break;
647 }
648
649 case IOV_GVAL(IOV_DEVREG):533 case IOV_GVAL(IOV_DEVREG):
650 {534 {
651 sdreg_t *sd_ptr = (sdreg_t *) params;535 struct brcmf_sdreg *sd_ptr =
536 (struct brcmf_sdreg *) params;
652 u8 data = 0;537 u8 data = 0;
653 538
654 if (sdioh_cfg_read539 if (brcmf_sdioh_cfg_read
655 (si, sd_ptr->func, sd_ptr->offset, &data)) {540 (si, sd_ptr->func, sd_ptr->offset, &data)) {
656 bcmerror = -EIO;541 bcmerror = -EIO;
657 break;542 break;
@@ -664,10 +549,11 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 6 unmodified lines
664 549
665 case IOV_SVAL(IOV_DEVREG):550 case IOV_SVAL(IOV_DEVREG):
666 {551 {
667 sdreg_t *sd_ptr = (sdreg_t *) params;552 struct brcmf_sdreg *sd_ptr =
553 (struct brcmf_sdreg *) params;
668 u8 data = (u8) sd_ptr->value;554 u8 data = (u8) sd_ptr->value;
669 555
670 if (sdioh_cfg_write556 if (brcmf_sdioh_cfg_write
671 (si, sd_ptr->func, sd_ptr->offset, &data)) {557 (si, sd_ptr->func, sd_ptr->offset, &data)) {
672 bcmerror = -EIO;558 bcmerror = -EIO;
673 break;559 break;
@@ -684,50 +570,32 @@ exit: · 10 unmodified lines
684 return bcmerror;570 return bcmerror;
685}571}
686 572
687#if defined(OOB_INTR_ONLY) && defined(HW_OOB)573extern int
688 574brcmf_sdioh_cfg_read(struct sdioh_info *sd, uint fnc_num, u32 addr, u8 *data)
689SDIOH_API_RC sdioh_enable_hw_oob_intr(sdioh_info_t *sd, bool enable)
690{
691 SDIOH_API_RC status;
692 u8 data;
693
694 if (enable)
695 data = 3; /* enable hw oob interrupt */
696 else
697 data = 4; /* disable hw oob interrupt */
698 data |= 4; /* Active HIGH */
699
700 status = sdioh_request_byte(sd, SDIOH_WRITE, 0, 0xf2, &data);
701 return status;
702}
703#endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */
704
705extern SDIOH_API_RC
706sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, u32 addr, u8 *data)
707{575{
708 SDIOH_API_RC status;576 int status;
709 /* No lock needed since sdioh_request_byte does locking */577 /* No lock needed since brcmf_sdioh_request_byte does locking */
710 status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data);578 status = brcmf_sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data);
711 return status;579 return status;
712}580}
713 581
714extern SDIOH_API_RC582extern int
715sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, u32 addr, u8 *data)583brcmf_sdioh_cfg_write(struct sdioh_info *sd, uint fnc_num, u32 addr, u8 *data)
716{584{
717 /* No lock needed since sdioh_request_byte does locking */585 /* No lock needed since brcmf_sdioh_request_byte does locking */
718 SDIOH_API_RC status;586 int status;
719 status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data);587 status = brcmf_sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data);
720 return status;588 return status;
721}589}
722 590
723static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr)591static int brcmf_sdioh_get_cisaddr(struct sdioh_info *sd, u32 regaddr)
724{592{
725 /* read 24 bits and return valid 17 bit addr */593 /* read 24 bits and return valid 17 bit addr */
726 int i;594 int i;
727 u32 scratch, regdata;595 u32 scratch, regdata;
728 u8 *ptr = (u8 *)&scratch;596 u8 *ptr = (u8 *)&scratch;
729 for (i = 0; i < 3; i++) {597 for (i = 0; i < 3; i++) {
730 if ((sdioh_sdmmc_card_regread(sd, 0, regaddr, 1, &regdata)) !=598 if ((brcmf_sdioh_card_regread(sd, 0, regaddr, 1, &regdata)) !=
731 SUCCESS)599 SUCCESS)
732 sd_err(("%s: Can't read!\n", __func__));600 sd_err(("%s: Can't read!\n", __func__));
733 601
@@ -741,8 +609,8 @@ static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr) · 7 unmodified lines
741 return scratch;609 return scratch;
742}610}
743 611
744extern SDIOH_API_RC612extern int
745sdioh_cis_read(sdioh_info_t *sd, uint func, u8 *cisd, u32 length)613brcmf_sdioh_cis_read(struct sdioh_info *sd, uint func, u8 *cisd, u32 length)
746{614{
747 u32 count;615 u32 count;
748 int offset;616 int offset;
@@ -754,7 +622,7 @@ sdioh_cis_read(sdioh_info_t *sd, uint func, u8 *cisd, u32 length) · 5 unmodified lines
754 if (!sd->func_cis_ptr[func]) {622 if (!sd->func_cis_ptr[func]) {
755 memset(cis, 0, length);623 memset(cis, 0, length);
756 sd_err(("%s: no func_cis_ptr[%d]\n", __func__, func));624 sd_err(("%s: no func_cis_ptr[%d]\n", __func__, func));
757 return SDIOH_API_RC_FAIL;625 return -ENOTSUPP;
758 }626 }
759 627
760 sd_err(("%s: func_cis_ptr[%d]=0x%04x\n", __func__, func,628 sd_err(("%s: func_cis_ptr[%d]=0x%04x\n", __func__, func,
@@ -762,37 +630,37 @@ sdioh_cis_read(sdioh_info_t *sd, uint func, u8 *cisd, u32 length) · 1 unmodified line
762 630
763 for (count = 0; count < length; count++) {631 for (count = 0; count < length; count++) {
764 offset = sd->func_cis_ptr[func] + count;632 offset = sd->func_cis_ptr[func] + count;
765 if (sdioh_sdmmc_card_regread(sd, 0, offset, 1, &foo) < 0) {633 if (brcmf_sdioh_card_regread(sd, 0, offset, 1, &foo) < 0) {
766 sd_err(("%s: regread failed: Can't read CIS\n",634 sd_err(("%s: regread failed: Can't read CIS\n",
767 __func__));635 __func__));
768 return SDIOH_API_RC_FAIL;636 return -EIO;
769 }637 }
770 638
771 *cis = (u8) (foo & 0xff);639 *cis = (u8) (foo & 0xff);
772 cis++;640 cis++;
773 }641 }
774 642
775 return SDIOH_API_RC_SUCCESS;643 return 0;
776}644}
777 645
778extern SDIOH_API_RC646extern int
779sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr,647brcmf_sdioh_request_byte(struct sdioh_info *sd, uint rw, uint func,
780 u8 *byte)648 uint regaddr, u8 *byte)
781{649{
782 int err_ret;650 int err_ret;
783 651
784 sd_info(("%s: rw=%d, func=%d, addr=0x%05x\n", __func__, rw, func,652 sd_info(("%s: rw=%d, func=%d, addr=0x%05x\n", __func__, rw, func,
785 regaddr));653 regaddr));
786 654
787 DHD_PM_RESUME_WAIT(sdioh_request_byte_wait);655 BRCMF_PM_RESUME_WAIT(sdioh_request_byte_wait);
788 DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);656 BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
789 if (rw) { /* CMD52 Write */657 if (rw) { /* CMD52 Write */
790 if (func == 0) {658 if (func == 0) {
791 /* Can only directly write to some F0 registers.659 /* Can only directly write to some F0 registers.
792 * Handle F2 enable660 * Handle F2 enable
793 * as a special case.661 * as a special case.
794 */662 */
795 if (regaddr == SDIOD_CCCR_IOEN) {663 if (regaddr == SDIO_CCCR_IOEx) {
796 if (gInstance->func[2]) {664 if (gInstance->func[2]) {
797 sdio_claim_host(gInstance->func[2]);665 sdio_claim_host(gInstance->func[2]);
798 if (*byte & SDIO_FUNC_ENABLE_2) {666 if (*byte & SDIO_FUNC_ENABLE_2) {
@@ -801,7 +669,9 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, · 2 unmodified lines
801 sdio_enable_func669 sdio_enable_func
802 (gInstance->func[2]);670 (gInstance->func[2]);
803 if (err_ret)671 if (err_ret)
804 sd_err(("bcmsdh_sdmmc: enable F2 failed:%d",672 sd_err(("request_byte: "
673 "enable F2 "
674 "failed:%d\n",
805 err_ret));675 err_ret));
806 } else {676 } else {
807 /* Disable Function 2 */677 /* Disable Function 2 */
@@ -809,15 +679,16 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, · 1 unmodified line
809 sdio_disable_func679 sdio_disable_func
810 (gInstance->func[2]);680 (gInstance->func[2]);
811 if (err_ret)681 if (err_ret)
812 sd_err(("bcmsdh_sdmmc: Disab F2 failed:%d",682 sd_err(("request_byte: "
683 "Disab F2 "
684 "failed:%d\n",
813 err_ret));685 err_ret));
814 }686 }
815 sdio_release_host(gInstance->func[2]);687 sdio_release_host(gInstance->func[2]);
816 }688 }
817 }689 }
818#if defined(MMC_SDIO_ABORT)
819 /* to allow abort command through F1 */690 /* to allow abort command through F1 */
820 else if (regaddr == SDIOD_CCCR_IOABORT) {691 else if (regaddr == SDIO_CCCR_ABORT) {
821 sdio_claim_host(gInstance->func[func]);692 sdio_claim_host(gInstance->func[func]);
822 /*693 /*
823 * this sdio_f0_writeb() can be replaced694 * this sdio_f0_writeb() can be replaced
@@ -828,10 +699,8 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, · 4 unmodified lines
828 sdio_writeb(gInstance->func[func], *byte,699 sdio_writeb(gInstance->func[func], *byte,
829 regaddr, &err_ret);700 regaddr, &err_ret);
830 sdio_release_host(gInstance->func[func]);701 sdio_release_host(gInstance->func[func]);
831 }702 } else if (regaddr < 0xF0) {
832#endif /* MMC_SDIO_ABORT */703 sd_err(("brcmf: F0 Wr:0x%02x: write "
833 else if (regaddr < 0xF0) {
834 sd_err(("bcmsdh_sdmmc: F0 Wr:0x%02x: write "
835 "disallowed\n", regaddr));704 "disallowed\n", regaddr));
836 } else {705 } else {
837 /* Claim host controller, perform F0 write,706 /* Claim host controller, perform F0 write,
@@ -867,29 +736,29 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, · 29 unmodified lines
867 }736 }
868 737
869 if (err_ret)738 if (err_ret)
870 sd_err(("bcmsdh_sdmmc: Failed to %s byte F%d:@0x%05x=%02x, "739 sd_err(("brcmf: Failed to %s byte F%d:@0x%05x=%02x, "
871 "Err: %d\n", rw ? "Write" : "Read", func, regaddr,740 "Err: %d\n", rw ? "Write" : "Read", func, regaddr,
872 *byte, err_ret));741 *byte, err_ret));
873 742
874 return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);743 return err_ret;
875}744}
876 745
877extern SDIOH_API_RC746extern int
878sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func,747brcmf_sdioh_request_word(struct sdioh_info *sd, uint cmd_type, uint rw,
879 uint addr, u32 *word, uint nbytes)748 uint func, uint addr, u32 *word, uint nbytes)
880{749{
881 int err_ret = SDIOH_API_RC_FAIL;750 int err_ret = -EIO;
882 751
883 if (func == 0) {752 if (func == 0) {
884 sd_err(("%s: Only CMD52 allowed to F0.\n", __func__));753 sd_err(("%s: Only CMD52 allowed to F0.\n", __func__));
885 return SDIOH_API_RC_FAIL;754 return -EINVAL;
886 }755 }
887 756
888 sd_info(("%s: cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",757 sd_info(("%s: cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
889 __func__, cmd_type, rw, func, addr, nbytes));758 __func__, cmd_type, rw, func, addr, nbytes));
890 759
891 DHD_PM_RESUME_WAIT(sdioh_request_word_wait);760 BRCMF_PM_RESUME_WAIT(sdioh_request_word_wait);
892 DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);761 BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
893 /* Claim host controller */762 /* Claim host controller */
894 sdio_claim_host(gInstance->func[func]);763 sdio_claim_host(gInstance->func[func]);
895 764
@@ -920,16 +789,16 @@ sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, · 24 unmodified lines
920 sdio_release_host(gInstance->func[func]);789 sdio_release_host(gInstance->func[func]);
921 790
922 if (err_ret) {791 if (err_ret) {
923 sd_err(("bcmsdh_sdmmc: Failed to %s word, Err: 0x%08x",792 sd_err(("brcmf: Failed to %s word, Err: 0x%08x\n",
924 rw ? "Write" : "Read", err_ret));793 rw ? "Write" : "Read", err_ret));
925 }794 }
926 795
927 return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);796 return err_ret;
928}797}
929 798
930static SDIOH_API_RC799static int
931sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func,800brcmf_sdioh_request_packet(struct sdioh_info *sd, uint fix_inc, uint write,
932 uint addr, struct sk_buff *pkt)801 uint func, uint addr, struct sk_buff *pkt)
933{802{
934 bool fifo = (fix_inc == SDIOH_DATA_FIX);803 bool fifo = (fix_inc == SDIOH_DATA_FIX);
935 u32 SGCount = 0;804 u32 SGCount = 0;
@@ -939,9 +808,8 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 3 unmodified lines
939 808
940 sd_trace(("%s: Enter\n", __func__));809 sd_trace(("%s: Enter\n", __func__));
941 810
942 ASSERT(pkt);811 BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait);
943 DHD_PM_RESUME_WAIT(sdioh_request_packet_wait);812 BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
944 DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
945 813
946 /* Claim host controller */814 /* Claim host controller */
947 sdio_claim_host(gInstance->func[func]);815 sdio_claim_host(gInstance->func[func]);
@@ -950,21 +818,6 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 2 unmodified lines
950 pkt_len += 3;818 pkt_len += 3;
951 pkt_len &= 0xFFFFFFFC;819 pkt_len &= 0xFFFFFFFC;
952 820
953#ifdef CONFIG_MMC_MSM7X00A
954 if ((pkt_len % 64) == 32) {
955 sd_trace(("%s: Rounding up TX packet +=32\n",
956 __func__));
957 pkt_len += 32;
958 }
959#endif /* CONFIG_MMC_MSM7X00A */
960 /* Make sure the packet is aligned properly.
961 * If it isn't, then this
962 * is the fault of sdioh_request_buffer() which
963 * is supposed to give
964 * us something we can work with.
965 */
966 ASSERT(((u32) (pkt->data) & DMA_ALIGN_MASK) == 0);
967
968 if ((write) && (!fifo)) {821 if ((write) && (!fifo)) {
969 err_ret = sdio_memcpy_toio(gInstance->func[func], addr,822 err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
970 ((u8 *) (pnext->data)),823 ((u8 *) (pnext->data)),
@@ -1005,7 +858,7 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 34 unmodified lines
1005 sdio_release_host(gInstance->func[func]);858 sdio_release_host(gInstance->func[func]);
1006 859
1007 sd_trace(("%s: Exit\n", __func__));860 sd_trace(("%s: Exit\n", __func__));
1008 return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);861 return err_ret;
1009}862}
1010 863
1011/*864/*
@@ -1023,114 +876,101 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 11 unmodified lines
1023 * aligned packet.876 * aligned packet.
1024 *877 *
1025 */878 */
1026extern SDIOH_API_RC879extern int
1027sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,880brcmf_sdioh_request_buffer(struct sdioh_info *sd, uint pio_dma, uint fix_inc,
1028 uint func, uint addr, uint reg_width, uint buflen_u,881 uint write, uint func, uint addr, uint reg_width,
1029 u8 *buffer, struct sk_buff *pkt)882 uint buflen_u, u8 *buffer, struct sk_buff *pkt)
1030{883{
1031 SDIOH_API_RC Status;884 int Status;
1032 struct sk_buff *mypkt = NULL;885 struct sk_buff *mypkt = NULL;
1033 886
1034 sd_trace(("%s: Enter\n", __func__));887 sd_trace(("%s: Enter\n", __func__));
1035 888
1036 DHD_PM_RESUME_WAIT(sdioh_request_buffer_wait);889 BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait);
1037 DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);890 BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
1038 /* Case 1: we don't have a packet. */891 /* Case 1: we don't have a packet. */
1039 if (pkt == NULL) {892 if (pkt == NULL) {
1040 sd_data(("%s: Creating new %s Packet, len=%d\n",893 sd_data(("%s: Creating new %s Packet, len=%d\n",
1041 __func__, write ? "TX" : "RX", buflen_u));894 __func__, write ? "TX" : "RX", buflen_u));
1042 mypkt = bcm_pkt_buf_get_skb(buflen_u);895 mypkt = brcmu_pkt_buf_get_skb(buflen_u);
1043 if (!mypkt) {896 if (!mypkt) {
1044 sd_err(("%s: bcm_pkt_buf_get_skb failed: len %d\n",897 sd_err(("%s: brcmu_pkt_buf_get_skb failed: len %d\n",
1045 __func__, buflen_u));898 __func__, buflen_u));
1046 return SDIOH_API_RC_FAIL;899 return -EIO;
1047 }900 }
1048 901
1049 /* For a write, copy the buffer data into the packet. */902 /* For a write, copy the buffer data into the packet. */
1050 if (write)903 if (write)
1051 memcpy(mypkt->data, buffer, buflen_u);904 memcpy(mypkt->data, buffer, buflen_u);
1052 905
1053 Status =906 Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func,
1054 sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);907 addr, mypkt);
1055 908
1056 /* For a read, copy the packet data back to the buffer. */909 /* For a read, copy the packet data back to the buffer. */
1057 if (!write)910 if (!write)
1058 memcpy(buffer, mypkt->data, buflen_u);911 memcpy(buffer, mypkt->data, buflen_u);
1059 912
1060 bcm_pkt_buf_free_skb(mypkt);913 brcmu_pkt_buf_free_skb(mypkt);
1061 } else if (((u32) (pkt->data) & DMA_ALIGN_MASK) != 0) {914 } else if (((ulong) (pkt->data) & DMA_ALIGN_MASK) != 0) {
1062 /* Case 2: We have a packet, but it is unaligned. */915 /*
1063 916 * Case 2: We have a packet, but it is unaligned.
1064 /* In this case, we cannot have a chain. */917 * In this case, we cannot have a chain (pkt->next == NULL)
1065 ASSERT(pkt->next == NULL);918 */
1066
1067 sd_data(("%s: Creating aligned %s Packet, len=%d\n",919 sd_data(("%s: Creating aligned %s Packet, len=%d\n",
1068 __func__, write ? "TX" : "RX", pkt->len));920 __func__, write ? "TX" : "RX", pkt->len));
1069 mypkt = bcm_pkt_buf_get_skb(pkt->len);921 mypkt = brcmu_pkt_buf_get_skb(pkt->len);
1070 if (!mypkt) {922 if (!mypkt) {
1071 sd_err(("%s: bcm_pkt_buf_get_skb failed: len %d\n",923 sd_err(("%s: brcmu_pkt_buf_get_skb failed: len %d\n",
1072 __func__, pkt->len));924 __func__, pkt->len));
1073 return SDIOH_API_RC_FAIL;925 return -EIO;
1074 }926 }
1075 927
1076 /* For a write, copy the buffer data into the packet. */928 /* For a write, copy the buffer data into the packet. */
1077 if (write)929 if (write)
1078 memcpy(mypkt->data, pkt->data, pkt->len);930 memcpy(mypkt->data, pkt->data, pkt->len);
1079 931
1080 Status =932 Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func,
1081 sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);933 addr, mypkt);
1082 934
1083 /* For a read, copy the packet data back to the buffer. */935 /* For a read, copy the packet data back to the buffer. */
1084 if (!write)936 if (!write)
1085 memcpy(pkt->data, mypkt->data, mypkt->len);937 memcpy(pkt->data, mypkt->data, mypkt->len);
1086 938
1087 bcm_pkt_buf_free_skb(mypkt);939 brcmu_pkt_buf_free_skb(mypkt);
1088 } else { /* case 3: We have a packet and940 } else { /* case 3: We have a packet and
1089 it is aligned. */941 it is aligned. */
1090 sd_data(("%s: Aligned %s Packet, direct DMA\n",942 sd_data(("%s: Aligned %s Packet, direct DMA\n",
1091 __func__, write ? "Tx" : "Rx"));943 __func__, write ? "Tx" : "Rx"));
1092 Status =944 Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func,
1093 sdioh_request_packet(sd, fix_inc, write, func, addr, pkt);945 addr, pkt);
1094 }946 }
1095 947
1096 return Status;948 return Status;
1097}949}
1098 950
1099/* this function performs "abort" for both of host & device */951/* this function performs "abort" for both of host & device */
1100extern int sdioh_abort(sdioh_info_t *sd, uint func)952extern int brcmf_sdioh_abort(struct sdioh_info *sd, uint func)
1101{953{
1102#if defined(MMC_SDIO_ABORT)
1103 char t_func = (char)func;954 char t_func = (char)func;
1104#endif /* defined(MMC_SDIO_ABORT) */
1105 sd_trace(("%s: Enter\n", __func__));955 sd_trace(("%s: Enter\n", __func__));
1106 956
1107#if defined(MMC_SDIO_ABORT)957 /* issue abort cmd52 command through F0 */
1108 /* issue abort cmd52 command through F1 */958 brcmf_sdioh_request_byte(sd, SDIOH_WRITE, SDIO_FUNC_0, SDIO_CCCR_ABORT,
1109 sdioh_request_byte(sd, SD_IO_OP_WRITE, SDIO_FUNC_0, SDIOD_CCCR_IOABORT,
1110 &t_func);959 &t_func);
1111#endif /* defined(MMC_SDIO_ABORT) */
1112
1113 sd_trace(("%s: Exit\n", __func__));
1114 return SDIOH_API_RC_SUCCESS;
1115}
1116 960
1117/* Reset and re-initialize the device */
1118int sdioh_sdio_reset(sdioh_info_t *si)
1119{
1120 sd_trace(("%s: Enter\n", __func__));
1121 sd_trace(("%s: Exit\n", __func__));961 sd_trace(("%s: Exit\n", __func__));
1122 return SDIOH_API_RC_SUCCESS;962 return 0;
1123}963}
1124 964
1125/* Disable device interrupt */965/* Disable device interrupt */
1126void sdioh_sdmmc_devintr_off(sdioh_info_t *sd)966void brcmf_sdioh_dev_intr_off(struct sdioh_info *sd)
1127{967{
1128 sd_trace(("%s: %d\n", __func__, sd->use_client_ints));968 sd_trace(("%s: %d\n", __func__, sd->use_client_ints));
1129 sd->intmask &= ~CLIENT_INTR;969 sd->intmask &= ~CLIENT_INTR;
1130}970}
1131 971
1132/* Enable device interrupt */972/* Enable device interrupt */
1133void sdioh_sdmmc_devintr_on(sdioh_info_t *sd)973void brcmf_sdioh_dev_intr_on(struct sdioh_info *sd)
1134{974{
1135 sd_trace(("%s: %d\n", __func__, sd->use_client_ints));975 sd_trace(("%s: %d\n", __func__, sd->use_client_ints));
1136 sd->intmask |= CLIENT_INTR;976 sd->intmask |= CLIENT_INTR;
@@ -1138,19 +978,19 @@ void sdioh_sdmmc_devintr_on(sdioh_info_t *sd) · 1 unmodified line
1138 978
1139/* Read client card reg */979/* Read client card reg */
1140int980int
1141sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, u32 regaddr,981brcmf_sdioh_card_regread(struct sdioh_info *sd, int func, u32 regaddr,
1142 int regsize, u32 *data)982 int regsize, u32 *data)
1143{983{
1144 984
1145 if ((func == 0) || (regsize == 1)) {985 if ((func == 0) || (regsize == 1)) {
1146 u8 temp = 0;986 u8 temp = 0;
1147 987
1148 sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp);988 brcmf_sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp);
1149 *data = temp;989 *data = temp;
1150 *data &= 0xff;990 *data &= 0xff;
1151 sd_data(("%s: byte read data=0x%02x\n", __func__, *data));991 sd_data(("%s: byte read data=0x%02x\n", __func__, *data));
1152 } else {992 } else {
1153 sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, data,993 brcmf_sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, data,
1154 regsize);994 regsize);
1155 if (regsize == 2)995 if (regsize == 2)
1156 *data &= 0xffff;996 *data &= 0xffff;
@@ -1161,25 +1001,20 @@ sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, u32 regaddr, · 4 unmodified lines
1161 return SUCCESS;1001 return SUCCESS;
1162}1002}
1163 1003
1164#if !defined(OOB_INTR_ONLY)1004static void brcmf_sdioh_irqhandler(struct sdio_func *func)
1165/* bcmsdh_sdmmc interrupt handler */
1166static void IRQHandler(struct sdio_func *func)
1167{1005{
1168 sdioh_info_t *sd;1006 struct sdioh_info *sd;
1169 1007
1170 sd_trace(("bcmsdh_sdmmc: ***IRQHandler\n"));1008 sd_trace(("brcmf: ***IRQHandler\n"));
1171 sd = gInstance->sd;1009 sd = gInstance->sd;
1172 1010
1173 ASSERT(sd != NULL);
1174 sdio_release_host(gInstance->func[0]);1011 sdio_release_host(gInstance->func[0]);
1175 1012
1176 if (sd->use_client_ints) {1013 if (sd->use_client_ints) {
1177 sd->intrcount++;1014 sd->intrcount++;
1178 ASSERT(sd->intr_handler);
1179 ASSERT(sd->intr_handler_arg);
1180 (sd->intr_handler) (sd->intr_handler_arg);1015 (sd->intr_handler) (sd->intr_handler_arg);
1181 } else {1016 } else {
1182 sd_err(("bcmsdh_sdmmc: ***IRQHandler\n"));1017 sd_err(("brcmf: ***IRQHandler\n"));
1183 1018
1184 sd_err(("%s: Not ready for intr: enabled %d, handler %p\n",1019 sd_err(("%s: Not ready for intr: enabled %d, handler %p\n",
1185 __func__, sd->client_intr_enabled, sd->intr_handler));1020 __func__, sd->client_intr_enabled, sd->intr_handler));
@@ -1188,52 +1023,174 @@ static void IRQHandler(struct sdio_func *func) · 2 unmodified lines
1188 sdio_claim_host(gInstance->func[0]);1023 sdio_claim_host(gInstance->func[0]);
1189}1024}
1190 1025
1191/* bcmsdh_sdmmc interrupt handler for F2 (dummy handler) */1026/* interrupt handler for F2 (dummy handler) */
1192static void IRQHandlerF2(struct sdio_func *func)1027static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func)
1193{1028{
1194 sdioh_info_t *sd;1029 struct sdioh_info *sd;
1195 1030
1196 sd_trace(("bcmsdh_sdmmc: ***IRQHandlerF2\n"));1031 sd_trace(("brcmf: ***IRQHandlerF2\n"));
1197 1032
1198 sd = gInstance->sd;1033 sd = gInstance->sd;
1034}
1035
1036static int brcmf_ops_sdio_probe(struct sdio_func *func,
1037 const struct sdio_device_id *id)
1038{
1039 int ret = 0;
1040 static struct sdio_func sdio_func_0;
1041 sd_trace(("sdio_probe: %s Enter\n", __func__));
1042 sd_trace(("sdio_probe: func->class=%x\n", func->class));
1043 sd_trace(("sdio_vendor: 0x%04x\n", func->vendor));
1044 sd_trace(("sdio_device: 0x%04x\n", func->device));
1045 sd_trace(("Function#: 0x%04x\n", func->num));
1046
1047 if (func->num == 1) {
1048 sdio_func_0.num = 0;
1049 sdio_func_0.card = func->card;
1050 gInstance->func[0] = &sdio_func_0;
1051 if (func->device == 0x4) { /* 4318 */
1052 gInstance->func[2] = NULL;
1053 sd_trace(("NIC found, calling brcmf_sdio_probe...\n"));
1054 ret = brcmf_sdio_probe(&sdmmc_dev);
1055 }
1056 }
1199 1057
1200 ASSERT(sd != NULL);1058 gInstance->func[func->num] = func;
1059
1060 if (func->num == 2) {
1061 brcmf_cfg80211_sdio_func(func);
1062 sd_trace(("F2 found, calling brcmf_sdio_probe...\n"));
1063 ret = brcmf_sdio_probe(&sdmmc_dev);
1064 }
1065
1066 return ret;
1201}1067}
1202#endif /* !defined(OOB_INTR_ONLY) */
1203 1068
1204#ifdef NOTUSED1069static void brcmf_ops_sdio_remove(struct sdio_func *func)
1205/* Write client card reg */
1206static int
1207sdioh_sdmmc_card_regwrite(sdioh_info_t *sd, int func, u32 regaddr,
1208 int regsize, u32 data)
1209{1070{
1071 sd_trace(("%s Enter\n", __func__));
1072 sd_info(("func->class=%x\n", func->class));
1073 sd_info(("sdio_vendor: 0x%04x\n", func->vendor));
1074 sd_info(("sdio_device: 0x%04x\n", func->device));
1075 sd_info(("Function#: 0x%04x\n", func->num));
1076
1077 if (func->num == 2) {
1078 sd_trace(("F2 found, calling brcmf_sdio_remove...\n"));
1079 brcmf_sdio_remove(&sdmmc_dev);
1080 }
1081}
1210 1082
1211 if ((func == 0) || (regsize == 1)) {
1212 u8 temp;
1213 1083
1214 temp = data & 0xff;1084#ifdef CONFIG_PM
1215 sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp);1085static int brcmf_sdio_suspend(struct device *dev)
1216 sd_data(("%s: byte write data=0x%02x\n", __func__, data));1086{
1217 } else {1087 mmc_pm_flag_t sdio_flags;
1218 if (regsize == 2)1088 int ret = 0;
1219 data &= 0xffff;
1220 1089
1221 sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, &data,1090 sd_trace(("%s\n", __func__));
1222 regsize);
1223 1091
1224 sd_data(("%s: word write data=0x%08x\n", __func__, data));1092 sdio_flags = sdio_get_host_pm_caps(gInstance->func[1]);
1093 if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
1094 sd_err(("Host can't keep power while suspended\n"));
1095 return -EINVAL;
1225 }1096 }
1226 1097
1227 return SUCCESS;1098 ret = sdio_set_host_pm_flags(gInstance->func[1], MMC_PM_KEEP_POWER);
1099 if (ret) {
1100 sd_err(("Failed to set pm_flags\n"));
1101 return ret;
1102 }
1103
1104 brcmf_sdio_wdtmr_enable(false);
1105
1106 return ret;
1107}
1108
1109static int brcmf_sdio_resume(struct device *dev)
1110{
1111 brcmf_sdio_wdtmr_enable(true);
1112 return 0;
1228}1113}
1229#endif /* NOTUSED */1114#endif /* CONFIG_PM */
1230 1115
1231int sdioh_start(sdioh_info_t *si, int stage)1116int brcmf_sdioh_osinit(struct sdioh_info *sd)
1232{1117{
1118 struct sdos_info *sdos;
1119
1120 sdos = kmalloc(sizeof(struct sdos_info), GFP_ATOMIC);
1121 sd->sdos_info = (void *)sdos;
1122 if (sdos == NULL)
1123 return -ENOMEM;
1124
1125 sdos->sd = sd;
1126 spin_lock_init(&sdos->lock);
1233 return 0;1127 return 0;
1234}1128}
1235 1129
1236int sdioh_stop(sdioh_info_t *si)1130void brcmf_sdioh_osfree(struct sdioh_info *sd)
1131{
1132 struct sdos_info *sdos;
1133
1134 sdos = (struct sdos_info *)sd->sdos_info;
1135 kfree(sdos);
1136}
1137
1138/* Interrupt enable/disable */
1139int brcmf_sdioh_interrupt_set(struct sdioh_info *sd, bool enable)
1237{1140{
1141 unsigned long flags;
1142 struct sdos_info *sdos;
1143
1144 sd_trace(("%s: %s\n", __func__, enable ? "Enabling" : "Disabling"));
1145
1146 sdos = (struct sdos_info *)sd->sdos_info;
1147
1148 if (enable && !(sd->intr_handler && sd->intr_handler_arg)) {
1149 sd_err(("%s: no handler registered, will not enable\n",
1150 __func__));
1151 return -EINVAL;
1152 }
1153
1154 /* Ensure atomicity for enable/disable calls */
1155 spin_lock_irqsave(&sdos->lock, flags);
1156
1157 sd->client_intr_enabled = enable;
1158 if (enable)
1159 brcmf_sdioh_dev_intr_on(sd);
1160 else
1161 brcmf_sdioh_dev_intr_off(sd);
1162
1163 spin_unlock_irqrestore(&sdos->lock, flags);
1164
1238 return 0;1165 return 0;
1239}1166}
1167
1168/*
1169 * module init
1170*/
1171int brcmf_sdio_function_init(void)
1172{
1173 int error = 0;
1174 sd_trace(("brcmf_sdio_function_init: %s Enter\n", __func__));
1175
1176 gInstance = kzalloc(sizeof(struct brcmf_sdmmc_instance), GFP_KERNEL);
1177 if (!gInstance)
1178 return -ENOMEM;
1179
1180 memset(&sdmmc_dev, 0, sizeof(sdmmc_dev));
1181 error = sdio_register_driver(&brcmf_sdmmc_driver);
1182
1183 return error;
1184}
1185
1186/*
1187 * module cleanup
1188*/
1189void brcmf_sdio_function_cleanup(void)
1190{
1191 sd_trace(("%s Enter\n", __func__));
1192
1193 sdio_unregister_driver(&brcmf_sdmmc_driver);
1194
1195 kfree(gInstance);
1196}
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.h+0−134
@@ -1,134 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef __BCMSDH_SDMMC_H__
18#define __BCMSDH_SDMMC_H__
19
20#ifdef BCMDBG
21#define sd_err(x) \
22 do { \
23 if ((sd_msglevel & SDH_ERROR_VAL) && net_ratelimit()) \
24 printk x; \
25 } while (0)
26#define sd_trace(x) \
27 do { \
28 if ((sd_msglevel & SDH_TRACE_VAL) && net_ratelimit()) \
29 printk x; \
30 } while (0)
31#define sd_info(x) \
32 do { \
33 if ((sd_msglevel & SDH_INFO_VAL) && net_ratelimit()) \
34 printk x; \
35 } while (0)
36#define sd_debug(x) \
37 do { \
38 if ((sd_msglevel & SDH_DEBUG_VAL) && net_ratelimit()) \
39 printk x; \
40 } while (0)
41#define sd_data(x) \
42 do { \
43 if ((sd_msglevel & SDH_DATA_VAL) && net_ratelimit()) \
44 printk x; \
45 } while (0)
46#define sd_ctrl(x) \
47 do { \
48 if ((sd_msglevel & SDH_CTRL_VAL) && net_ratelimit()) \
49 printk x; \
50 } while (0)
51#else
52#define sd_err(x)
53#define sd_trace(x)
54#define sd_info(x)
55#define sd_debug(x)
56#define sd_data(x)
57#define sd_ctrl(x)
58#endif
59
60/* Allocate/init/free per-OS private data */
61extern int sdioh_sdmmc_osinit(sdioh_info_t *sd);
62extern void sdioh_sdmmc_osfree(sdioh_info_t *sd);
63
64#define BLOCK_SIZE_64 64
65#define BLOCK_SIZE_512 512
66#define BLOCK_SIZE_4318 64
67#define BLOCK_SIZE_4328 512
68
69/* internal return code */
70#define SUCCESS 0
71#define ERROR 1
72
73/* private bus modes */
74#define SDIOH_MODE_SD4 2
75#define CLIENT_INTR 0x100 /* Get rid of this! */
76
77struct sdioh_info {
78 struct osl_info *osh; /* osh handler */
79 bool client_intr_enabled; /* interrupt connnected flag */
80 bool intr_handler_valid; /* client driver interrupt handler valid */
81 sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
82 void *intr_handler_arg; /* argument to call interrupt handler */
83 u16 intmask; /* Current active interrupts */
84 void *sdos_info; /* Pointer to per-OS private data */
85
86 uint irq; /* Client irq */
87 int intrcount; /* Client interrupts */
88 bool sd_use_dma; /* DMA on CMD53 */
89 bool sd_blockmode; /* sd_blockmode == false => 64 Byte Cmd 53s. */
90 /* Must be on for sd_multiblock to be effective */
91 bool use_client_ints; /* If this is false, make sure to restore */
92 int sd_mode; /* SD1/SD4/SPI */
93 int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
94 u8 num_funcs; /* Supported funcs on client */
95 u32 com_cis_ptr;
96 u32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
97 uint max_dma_len;
98 uint max_dma_descriptors; /* DMA Descriptors supported by this controller. */
99 /* SDDMA_DESCRIPTOR SGList[32]; *//* Scatter/Gather DMA List */
100};
101
102/************************************************************
103 * Internal interfaces: per-port references into bcmsdh_sdmmc.c
104 */
105
106/* Global message bits */
107extern uint sd_msglevel;
108
109/* OS-independent interrupt handler */
110extern bool check_client_intr(sdioh_info_t *sd);
111
112/* Core interrupt enable/disable of device interrupts */
113extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd);
114extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd);
115
116/**************************************************************
117 * Internal interfaces: bcmsdh_sdmmc.c references to per-port code
118 */
119
120/* Register mapping routines */
121extern u32 *sdioh_sdmmc_reg_map(s32 addr, int size);
122extern void sdioh_sdmmc_reg_unmap(s32 addr, int size);
123
124/* Interrupt (de)registration routines */
125extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq);
126extern void sdioh_sdmmc_free_irq(uint irq, sdioh_info_t *sd);
127
128typedef struct _BCMSDH_SDMMC_INSTANCE {
129 sdioh_info_t *sd;
130 struct sdio_func *func[SDIOD_MAX_IOFUNCS];
131 u32 host_claimed;
132} BCMSDH_SDMMC_INSTANCE, *PBCMSDH_SDMMC_INSTANCE;
133
134#endif /* __BCMSDH_SDMMC_H__ */
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c+0−235
@@ -1,235 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16#include <linux/types.h>
17#include <linux/sched.h> /* request_irq() */
18#include <linux/netdevice.h>
19#include <bcmdefs.h>
20#include <bcmutils.h>
21#include <sdio.h> /* SDIO Specs */
22#include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */
23#include <sdiovar.h> /* to get msglevel bit values */
24
25#include <linux/mmc/core.h>
26#include <linux/mmc/card.h>
27#include <linux/mmc/sdio_func.h>
28#include <linux/mmc/sdio_ids.h>
29
30#include "dngl_stats.h"
31#include "dhd.h"
32
33#if !defined(SDIO_VENDOR_ID_BROADCOM)
34#define SDIO_VENDOR_ID_BROADCOM 0x02d0
35#endif /* !defined(SDIO_VENDOR_ID_BROADCOM) */
36
37#define SDIO_DEVICE_ID_BROADCOM_DEFAULT 0x0000
38
39#if !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB)
40#define SDIO_DEVICE_ID_BROADCOM_4325_SDGWB 0x0492 /* BCM94325SDGWB */
41#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) */
42#if !defined(SDIO_DEVICE_ID_BROADCOM_4325)
43#define SDIO_DEVICE_ID_BROADCOM_4325 0x0493
44#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325) */
45#if !defined(SDIO_DEVICE_ID_BROADCOM_4329)
46#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329
47#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */
48#if !defined(SDIO_DEVICE_ID_BROADCOM_4319)
49#define SDIO_DEVICE_ID_BROADCOM_4319 0x4319
50#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */
51
52#include <bcmsdh_sdmmc.h>
53
54#include <dhd_dbg.h>
55#include <wl_cfg80211.h>
56
57extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd);
58extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd);
59
60int sdio_function_init(void);
61void sdio_function_cleanup(void);
62
63/* module param defaults */
64static int clockoverride;
65
66module_param(clockoverride, int, 0644);
67MODULE_PARM_DESC(clockoverride, "SDIO card clock override");
68
69PBCMSDH_SDMMC_INSTANCE gInstance;
70
71/* Maximum number of bcmsdh_sdmmc devices supported by driver */
72#define BCMSDH_SDMMC_MAX_DEVICES 1
73
74extern int bcmsdh_probe(struct device *dev);
75extern int bcmsdh_remove(struct device *dev);
76struct device sdmmc_dev;
77
78static int bcmsdh_sdmmc_probe(struct sdio_func *func,
79 const struct sdio_device_id *id)
80{
81 int ret = 0;
82 static struct sdio_func sdio_func_0;
83 sd_trace(("bcmsdh_sdmmc: %s Enter\n", __func__));
84 sd_trace(("sdio_bcmsdh: func->class=%x\n", func->class));
85 sd_trace(("sdio_vendor: 0x%04x\n", func->vendor));
86 sd_trace(("sdio_device: 0x%04x\n", func->device));
87 sd_trace(("Function#: 0x%04x\n", func->num));
88
89 if (func->num == 1) {
90 sdio_func_0.num = 0;
91 sdio_func_0.card = func->card;
92 gInstance->func[0] = &sdio_func_0;
93 if (func->device == 0x4) { /* 4318 */
94 gInstance->func[2] = NULL;
95 sd_trace(("NIC found, calling bcmsdh_probe...\n"));
96 ret = bcmsdh_probe(&sdmmc_dev);
97 }
98 }
99
100 gInstance->func[func->num] = func;
101
102 if (func->num == 2) {
103 wl_cfg80211_sdio_func(func);
104 sd_trace(("F2 found, calling bcmsdh_probe...\n"));
105 ret = bcmsdh_probe(&sdmmc_dev);
106 }
107
108 return ret;
109}
110
111static void bcmsdh_sdmmc_remove(struct sdio_func *func)
112{
113 sd_trace(("bcmsdh_sdmmc: %s Enter\n", __func__));
114 sd_info(("sdio_bcmsdh: func->class=%x\n", func->class));
115 sd_info(("sdio_vendor: 0x%04x\n", func->vendor));
116 sd_info(("sdio_device: 0x%04x\n", func->device));
117 sd_info(("Function#: 0x%04x\n", func->num));
118
119 if (func->num == 2) {
120 sd_trace(("F2 found, calling bcmsdh_remove...\n"));
121 bcmsdh_remove(&sdmmc_dev);
122 }
123}
124
125/* devices we support, null terminated */
126static const struct sdio_device_id bcmsdh_sdmmc_ids[] = {
127 {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_DEFAULT)},
128 {SDIO_DEVICE
129 (SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325_SDGWB)},
130 {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325)},
131 {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329)},
132 {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4319)},
133 { /* end: all zeroes */ },
134};
135
136MODULE_DEVICE_TABLE(sdio, bcmsdh_sdmmc_ids);
137
138static struct sdio_driver bcmsdh_sdmmc_driver = {
139 .probe = bcmsdh_sdmmc_probe,
140 .remove = bcmsdh_sdmmc_remove,
141 .name = "brcmfmac",
142 .id_table = bcmsdh_sdmmc_ids,
143};
144
145struct sdos_info {
146 sdioh_info_t *sd;
147 spinlock_t lock;
148};
149
150int sdioh_sdmmc_osinit(sdioh_info_t *sd)
151{
152 struct sdos_info *sdos;
153
154 sdos = kmalloc(sizeof(struct sdos_info), GFP_ATOMIC);
155 sd->sdos_info = (void *)sdos;
156 if (sdos == NULL)
157 return -ENOMEM;
158
159 sdos->sd = sd;
160 spin_lock_init(&sdos->lock);
161 return 0;
162}
163
164void sdioh_sdmmc_osfree(sdioh_info_t *sd)
165{
166 struct sdos_info *sdos;
167 ASSERT(sd && sd->sdos_info);
168
169 sdos = (struct sdos_info *)sd->sdos_info;
170 kfree(sdos);
171}
172
173/* Interrupt enable/disable */
174SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *sd, bool enable)
175{
176 unsigned long flags;
177 struct sdos_info *sdos;
178
179 sd_trace(("%s: %s\n", __func__, enable ? "Enabling" : "Disabling"));
180
181 sdos = (struct sdos_info *)sd->sdos_info;
182 ASSERT(sdos);
183
184#if !defined(OOB_INTR_ONLY)
185 if (enable && !(sd->intr_handler && sd->intr_handler_arg)) {
186 sd_err(("%s: no handler registered, will not enable\n",
187 __func__));
188 return SDIOH_API_RC_FAIL;
189 }
190#endif /* !defined(OOB_INTR_ONLY) */
191
192 /* Ensure atomicity for enable/disable calls */
193 spin_lock_irqsave(&sdos->lock, flags);
194
195 sd->client_intr_enabled = enable;
196 if (enable)
197 sdioh_sdmmc_devintr_on(sd);
198 else
199 sdioh_sdmmc_devintr_off(sd);
200
201 spin_unlock_irqrestore(&sdos->lock, flags);
202
203 return SDIOH_API_RC_SUCCESS;
204}
205
206/*
207 * module init
208*/
209int sdio_function_init(void)
210{
211 int error = 0;
212 sd_trace(("bcmsdh_sdmmc: %s Enter\n", __func__));
213
214 gInstance = kzalloc(sizeof(BCMSDH_SDMMC_INSTANCE), GFP_KERNEL);
215 if (!gInstance)
216 return -ENOMEM;
217
218 memset(&sdmmc_dev, 0, sizeof(sdmmc_dev));
219 error = sdio_register_driver(&bcmsdh_sdmmc_driver);
220
221 return error;
222}
223
224/*
225 * module cleanup
226*/
227extern int bcmsdh_remove(struct device *dev);
228void sdio_function_cleanup(void)
229{
230 sd_trace(("%s Enter\n", __func__));
231
232 sdio_unregister_driver(&bcmsdh_sdmmc_driver);
233
234 kfree(gInstance);
235}
drivers/staging/brcm80211/brcmfmac/dhd.h+730−240
@@ -18,51 +18,539 @@ · 17 unmodified lines
18 * Common types *18 * Common types *
19 */19 */
20 20
21#ifndef _dhd_h_21#ifndef _BRCMF_H_
22#define _dhd_h_22#define _BRCMF_H_
23 23
24#include <linux/sched.h>24#define BRCMF_VERSION_STR "4.218.248.5"
25#include <linux/init.h>25
26#include <linux/kernel.h>26#define BRCMF_C_IOCTL_SMLEN 256 /* "small" ioctl buffer required */
27#include <linux/slab.h>27#define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */
28#include <linux/skbuff.h>28#define BRCMF_C_IOCTL_MAXLEN 8192
29#include <linux/netdevice.h>29
30#include <linux/etherdevice.h>30#define BRCMF_C_UP 2
31#include <linux/random.h>31#define BRCMF_C_SET_PROMISC 10
32#include <linux/spinlock.h>32#define BRCMF_C_GET_RATE 12
33#include <linux/ethtool.h>33#define BRCMF_C_GET_INFRA 19
34#include <linux/suspend.h>34#define BRCMF_C_SET_INFRA 20
35#include <asm/uaccess.h>35#define BRCMF_C_GET_AUTH 21
36#include <asm/unaligned.h>36#define BRCMF_C_SET_AUTH 22
37/* The kernel threading is sdio-specific */37#define BRCMF_C_GET_BSSID 23
38 38#define BRCMF_C_GET_SSID 25
39#include <wlioctl.h>39#define BRCMF_C_SET_SSID 26
40 40#define BRCMF_C_GET_CHANNEL 29
41/* Forward decls */41#define BRCMF_C_GET_SRL 31
42struct dhd_bus;42#define BRCMF_C_GET_LRL 33
43struct dhd_prot;43#define BRCMF_C_GET_RADIO 37
44struct dhd_info;44#define BRCMF_C_SET_RADIO 38
45#define BRCMF_C_GET_PHYTYPE 39
46#define BRCMF_C_SET_KEY 45
47#define BRCMF_C_SET_PASSIVE_SCAN 49
48#define BRCMF_C_SCAN 50
49#define BRCMF_C_SCAN_RESULTS 51
50#define BRCMF_C_DISASSOC 52
51#define BRCMF_C_REASSOC 53
52#define BRCMF_C_SET_ROAM_TRIGGER 55
53#define BRCMF_C_SET_ROAM_DELTA 57
54#define BRCMF_C_GET_DTIMPRD 77
55#define BRCMF_C_SET_COUNTRY 84
56#define BRCMF_C_GET_PM 85
57#define BRCMF_C_SET_PM 86
58#define BRCMF_C_GET_AP 117
59#define BRCMF_C_SET_AP 118
60#define BRCMF_C_GET_RSSI 127
61#define BRCMF_C_GET_WSEC 133
62#define BRCMF_C_SET_WSEC 134
63#define BRCMF_C_GET_PHY_NOISE 135
64#define BRCMF_C_GET_BSS_INFO 136
65#define BRCMF_C_SET_SCAN_CHANNEL_TIME 185
66#define BRCMF_C_SET_SCAN_UNASSOC_TIME 187
67#define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201
68#define BRCMF_C_GET_VALID_CHANNELS 217
69#define BRCMF_C_GET_KEY_PRIMARY 235
70#define BRCMF_C_SET_KEY_PRIMARY 236
71#define BRCMF_C_SET_SCAN_PASSIVE_TIME 258
72#define BRCMF_C_GET_VAR 262
73#define BRCMF_C_SET_VAR 263
74
75/* phy types (returned by WLC_GET_PHYTPE) */
76#define WLC_PHY_TYPE_A 0
77#define WLC_PHY_TYPE_B 1
78#define WLC_PHY_TYPE_G 2
79#define WLC_PHY_TYPE_N 4
80#define WLC_PHY_TYPE_LP 5
81#define WLC_PHY_TYPE_SSN 6
82#define WLC_PHY_TYPE_HT 7
83#define WLC_PHY_TYPE_LCN 8
84#define WLC_PHY_TYPE_NULL 0xf
85
86#define BRCMF_PKT_FILTER_FIXED_LEN offsetof(struct brcmf_pkt_filter, u)
87#define BRCMF_PKT_FILTER_PATTERN_FIXED_LEN \
88 offsetof(struct brcmf_pkt_filter_pattern, mask_and_pattern)
89
90#define BRCMF_EVENTING_MASK_LEN 16
91
92#define TOE_TX_CSUM_OL 0x00000001
93#define TOE_RX_CSUM_OL 0x00000002
94
95/* maximum channels returned by the get valid channels iovar */
96#define WL_NUMCHANNELS 64
97
98#define BRCMF_BSS_INFO_VERSION 108 /* current ver of brcmf_bss_info struct */
99
100/* size of brcmf_scan_params not including variable length array */
101#define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
102
103/* masks for channel and ssid count */
104#define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff
105#define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16
106
107#define BRCMF_SCAN_ACTION_START 1
108#define BRCMF_SCAN_ACTION_CONTINUE 2
109#define WL_SCAN_ACTION_ABORT 3
110
111#define BRCMF_ISCAN_REQ_VERSION 1
112
113/* brcmf_iscan_results status values */
114#define BRCMF_SCAN_RESULTS_SUCCESS 0
115#define BRCMF_SCAN_RESULTS_PARTIAL 1
116#define BRCMF_SCAN_RESULTS_PENDING 2
117#define BRCMF_SCAN_RESULTS_ABORTED 3
118#define BRCMF_SCAN_RESULTS_NO_MEM 4
119
120#define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */
121#define BRCMF_PRIMARY_KEY (1 << 1) /* primary (ie tx) key */
122#define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */
123#define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */
124#define WL_IBSS_PEER_GROUP_KEY (1 << 6) /* Indicates a group key for a IBSS PEER */
125
126/* For supporting multiple interfaces */
127#define BRCMF_MAX_IFS 16
128#define BRCMF_DEL_IF -0xe
129#define BRCMF_BAD_IF -0xf
130
131#define DOT11_BSSTYPE_ANY 2
132#define DOT11_MAX_DEFAULT_KEYS 4
133
134#define BRCMF_EVENT_MSG_LINK 0x01
135#define BRCMF_EVENT_MSG_FLUSHTXQ 0x02
136#define BRCMF_EVENT_MSG_GROUP 0x04
137
138struct brcmf_event_msg {
139 u16 version;
140 u16 flags;
141 u32 event_type;
142 u32 status;
143 u32 reason;
144 u32 auth_type;
145 u32 datalen;
146 u8 addr[ETH_ALEN];
147 char ifname[IFNAMSIZ];
148} __packed;
149
150struct brcm_ethhdr {
151 u16 subtype;
152 u16 length;
153 u8 version;
154 u8 oui[3];
155 u16 usr_subtype;
156} __packed;
157
158struct brcmf_event {
159 struct ethhdr eth;
160 struct brcm_ethhdr hdr;
161 struct brcmf_event_msg msg;
162} __packed;
163
164struct dngl_stats {
165 unsigned long rx_packets; /* total packets received */
166 unsigned long tx_packets; /* total packets transmitted */
167 unsigned long rx_bytes; /* total bytes received */
168 unsigned long tx_bytes; /* total bytes transmitted */
169 unsigned long rx_errors; /* bad packets received */
170 unsigned long tx_errors; /* packet transmit problems */
171 unsigned long rx_dropped; /* packets dropped by dongle */
172 unsigned long tx_dropped; /* packets dropped by dongle */
173 unsigned long multicast; /* multicast packets received */
174};
175
176#define BRCMF_E_SET_SSID 0
177#define BRCMF_E_JOIN 1
178#define BRCMF_E_START 2
179#define BRCMF_E_AUTH 3
180#define BRCMF_E_AUTH_IND 4
181#define BRCMF_E_DEAUTH 5
182#define BRCMF_E_DEAUTH_IND 6
183#define BRCMF_E_ASSOC 7
184#define BRCMF_E_ASSOC_IND 8
185#define BRCMF_E_REASSOC 9
186#define BRCMF_E_REASSOC_IND 10
187#define BRCMF_E_DISASSOC 11
188#define BRCMF_E_DISASSOC_IND 12
189#define BRCMF_E_QUIET_START 13
190#define BRCMF_E_QUIET_END 14
191#define BRCMF_E_BEACON_RX 15
192#define BRCMF_E_LINK 16
193#define BRCMF_E_MIC_ERROR 17
194#define BRCMF_E_NDIS_LINK 18
195#define BRCMF_E_ROAM 19
196#define BRCMF_E_TXFAIL 20
197#define BRCMF_E_PMKID_CACHE 21
198#define BRCMF_E_RETROGRADE_TSF 22
199#define BRCMF_E_PRUNE 23
200#define BRCMF_E_AUTOAUTH 24
201#define BRCMF_E_EAPOL_MSG 25
202#define BRCMF_E_SCAN_COMPLETE 26
203#define BRCMF_E_ADDTS_IND 27
204#define BRCMF_E_DELTS_IND 28
205#define BRCMF_E_BCNSENT_IND 29
206#define BRCMF_E_BCNRX_MSG 30
207#define BRCMF_E_BCNLOST_MSG 31
208#define BRCMF_E_ROAM_PREP 32
209#define BRCMF_E_PFN_NET_FOUND 33
210#define BRCMF_E_PFN_NET_LOST 34
211#define BRCMF_E_RESET_COMPLETE 35
212#define BRCMF_E_JOIN_START 36
213#define BRCMF_E_ROAM_START 37
214#define BRCMF_E_ASSOC_START 38
215#define BRCMF_E_IBSS_ASSOC 39
216#define BRCMF_E_RADIO 40
217#define BRCMF_E_PSM_WATCHDOG 41
218#define BRCMF_E_PROBREQ_MSG 44
219#define BRCMF_E_SCAN_CONFIRM_IND 45
220#define BRCMF_E_PSK_SUP 46
221#define BRCMF_E_COUNTRY_CODE_CHANGED 47
222#define BRCMF_E_EXCEEDED_MEDIUM_TIME 48
223#define BRCMF_E_ICV_ERROR 49
224#define BRCMF_E_UNICAST_DECODE_ERROR 50
225#define BRCMF_E_MULTICAST_DECODE_ERROR 51
226#define BRCMF_E_TRACE 52
227#define BRCMF_E_IF 54
228#define BRCMF_E_RSSI 56
229#define BRCMF_E_PFN_SCAN_COMPLETE 57
230#define BRCMF_E_EXTLOG_MSG 58
231#define BRCMF_E_ACTION_FRAME 59
232#define BRCMF_E_ACTION_FRAME_COMPLETE 60
233#define BRCMF_E_PRE_ASSOC_IND 61
234#define BRCMF_E_PRE_REASSOC_IND 62
235#define BRCMF_E_CHANNEL_ADOPTED 63
236#define BRCMF_E_AP_STARTED 64
237#define BRCMF_E_DFS_AP_STOP 65
238#define BRCMF_E_DFS_AP_RESUME 66
239#define BRCMF_E_RESERVED1 67
240#define BRCMF_E_RESERVED2 68
241#define BRCMF_E_ESCAN_RESULT 69
242#define BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70
243#define BRCMF_E_DCS_REQUEST 73
244
245#define BRCMF_E_FIFO_CREDIT_MAP 74
246
247#define BRCMF_E_LAST 75
248
249#define BRCMF_E_STATUS_SUCCESS 0
250#define BRCMF_E_STATUS_FAIL 1
251#define BRCMF_E_STATUS_TIMEOUT 2
252#define BRCMF_E_STATUS_NO_NETWORKS 3
253#define BRCMF_E_STATUS_ABORT 4
254#define BRCMF_E_STATUS_NO_ACK 5
255#define BRCMF_E_STATUS_UNSOLICITED 6
256#define BRCMF_E_STATUS_ATTEMPT 7
257#define BRCMF_E_STATUS_PARTIAL 8
258#define BRCMF_E_STATUS_NEWSCAN 9
259#define BRCMF_E_STATUS_NEWASSOC 10
260#define BRCMF_E_STATUS_11HQUIET 11
261#define BRCMF_E_STATUS_SUPPRESS 12
262#define BRCMF_E_STATUS_NOCHANS 13
263#define BRCMF_E_STATUS_CS_ABORT 15
264#define BRCMF_E_STATUS_ERROR 16
265
266#define BRCMF_E_REASON_INITIAL_ASSOC 0
267#define BRCMF_E_REASON_LOW_RSSI 1
268#define BRCMF_E_REASON_DEAUTH 2
269#define BRCMF_E_REASON_DISASSOC 3
270#define BRCMF_E_REASON_BCNS_LOST 4
271#define BRCMF_E_REASON_MINTXRATE 9
272#define BRCMF_E_REASON_TXFAIL 10
273
274#define BRCMF_E_REASON_FAST_ROAM_FAILED 5
275#define BRCMF_E_REASON_DIRECTED_ROAM 6
276#define BRCMF_E_REASON_TSPEC_REJECTED 7
277#define BRCMF_E_REASON_BETTER_AP 8
278
279#define BRCMF_E_PRUNE_ENCR_MISMATCH 1
280#define BRCMF_E_PRUNE_BCAST_BSSID 2
281#define BRCMF_E_PRUNE_MAC_DENY 3
282#define BRCMF_E_PRUNE_MAC_NA 4
283#define BRCMF_E_PRUNE_REG_PASSV 5
284#define BRCMF_E_PRUNE_SPCT_MGMT 6
285#define BRCMF_E_PRUNE_RADAR 7
286#define BRCMF_E_RSN_MISMATCH 8
287#define BRCMF_E_PRUNE_NO_COMMON_RATES 9
288#define BRCMF_E_PRUNE_BASIC_RATES 10
289#define BRCMF_E_PRUNE_CIPHER_NA 12
290#define BRCMF_E_PRUNE_KNOWN_STA 13
291#define BRCMF_E_PRUNE_WDS_PEER 15
292#define BRCMF_E_PRUNE_QBSS_LOAD 16
293#define BRCMF_E_PRUNE_HOME_AP 17
294
295#define BRCMF_E_SUP_OTHER 0
296#define BRCMF_E_SUP_DECRYPT_KEY_DATA 1
297#define BRCMF_E_SUP_BAD_UCAST_WEP128 2
298#define BRCMF_E_SUP_BAD_UCAST_WEP40 3
299#define BRCMF_E_SUP_UNSUP_KEY_LEN 4
300#define BRCMF_E_SUP_PW_KEY_CIPHER 5
301#define BRCMF_E_SUP_MSG3_TOO_MANY_IE 6
302#define BRCMF_E_SUP_MSG3_IE_MISMATCH 7
303#define BRCMF_E_SUP_NO_INSTALL_FLAG 8
304#define BRCMF_E_SUP_MSG3_NO_GTK 9
305#define BRCMF_E_SUP_GRP_KEY_CIPHER 10
306#define BRCMF_E_SUP_GRP_MSG1_NO_GTK 11
307#define BRCMF_E_SUP_GTK_DECRYPT_FAIL 12
308#define BRCMF_E_SUP_SEND_FAIL 13
309#define BRCMF_E_SUP_DEAUTH 14
310
311#define BRCMF_E_IF_ADD 1
312#define BRCMF_E_IF_DEL 2
313#define BRCMF_E_IF_CHANGE 3
314
315#define BRCMF_E_IF_ROLE_STA 0
316#define BRCMF_E_IF_ROLE_AP 1
317#define BRCMF_E_IF_ROLE_WDS 2
318
319#define BRCMF_E_LINK_BCN_LOSS 1
320#define BRCMF_E_LINK_DISASSOC 2
321#define BRCMF_E_LINK_ASSOC_REC 3
322#define BRCMF_E_LINK_BSSCFG_DIS 4
45 323
46/* The level of bus communication with the dongle */324/* The level of bus communication with the dongle */
47enum dhd_bus_state {325enum brcmf_bus_state {
48 DHD_BUS_DOWN, /* Not ready for frame transfers */326 BRCMF_BUS_DOWN, /* Not ready for frame transfers */
49 DHD_BUS_LOAD, /* Download access only (CPU reset) */327 BRCMF_BUS_LOAD, /* Download access only (CPU reset) */
50 DHD_BUS_DATA /* Ready for frame transfers */328 BRCMF_BUS_DATA /* Ready for frame transfers */
329};
330
331/* Pattern matching filter. Specifies an offset within received packets to
332 * start matching, the pattern to match, the size of the pattern, and a bitmask
333 * that indicates which bits within the pattern should be matched.
334 */
335struct brcmf_pkt_filter_pattern {
336 u32 offset; /* Offset within received packet to start pattern matching.
337 * Offset '0' is the first byte of the ethernet header.
338 */
339 u32 size_bytes; /* Size of the pattern. Bitmask must be the same size. */
340 u8 mask_and_pattern[1]; /* Variable length mask and pattern data. mask starts
341 * at offset 0. Pattern immediately follows mask.
342 */
343};
344
345/* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
346struct brcmf_pkt_filter {
347 u32 id; /* Unique filter id, specified by app. */
348 u32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */
349 u32 negate_match; /* Negate the result of filter matches */
350 union { /* Filter definitions */
351 struct brcmf_pkt_filter_pattern pattern; /* Filter pattern */
352 } u;
353};
354
355/* IOVAR "pkt_filter_enable" parameter. */
356struct brcmf_pkt_filter_enable {
357 u32 id; /* Unique filter id */
358 u32 enable; /* Enable/disable bool */
359};
360
361/* BSS info structure
362 * Applications MUST CHECK ie_offset field and length field to access IEs and
363 * next bss_info structure in a vector (in struct brcmf_scan_results)
364 */
365struct brcmf_bss_info {
366 u32 version; /* version field */
367 u32 length; /* byte length of data in this record,
368 * starting at version and including IEs
369 */
370 u8 BSSID[ETH_ALEN];
371 u16 beacon_period; /* units are Kusec */
372 u16 capability; /* Capability information */
373 u8 SSID_len;
374 u8 SSID[32];
375 struct {
376 uint count; /* # rates in this set */
377 u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
378 } rateset; /* supported rates */
379 chanspec_t chanspec; /* chanspec for bss */
380 u16 atim_window; /* units are Kusec */
381 u8 dtim_period; /* DTIM period */
382 s16 RSSI; /* receive signal strength (in dBm) */
383 s8 phy_noise; /* noise (in dBm) */
384
385 u8 n_cap; /* BSS is 802.11N Capable */
386 u32 nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */
387 u8 ctl_ch; /* 802.11N BSS control channel number */
388 u32 reserved32[1]; /* Reserved for expansion of BSS properties */
389 u8 flags; /* flags */
390 u8 reserved[3]; /* Reserved for expansion of BSS properties */
391 u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
392
393 u16 ie_offset; /* offset at which IEs start, from beginning */
394 u32 ie_length; /* byte length of Information Elements */
395 s16 SNR; /* average SNR of during frame reception */
396 /* Add new fields here */
397 /* variable length Information Elements */
398};
399
400struct brcmf_ssid {
401 u32 SSID_len;
402 unsigned char SSID[32];
403};
404
405struct brcmf_scan_params {
406 struct brcmf_ssid ssid; /* default: {0, ""} */
407 u8 bssid[ETH_ALEN]; /* default: bcast */
408 s8 bss_type; /* default: any,
409 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
410 */
411 u8 scan_type; /* flags, 0 use default */
412 s32 nprobes; /* -1 use default, number of probes per channel */
413 s32 active_time; /* -1 use default, dwell time per channel for
414 * active scanning
415 */
416 s32 passive_time; /* -1 use default, dwell time per channel
417 * for passive scanning
418 */
419 s32 home_time; /* -1 use default, dwell time for the home channel
420 * between channel scans
421 */
422 s32 channel_num; /* count of channels and ssids that follow
423 *
424 * low half is count of channels in
425 * channel_list, 0 means default (use all
426 * available channels)
427 *
428 * high half is entries in struct brcmf_ssid
429 * array that follows channel_list, aligned for
430 * s32 (4 bytes) meaning an odd channel count
431 * implies a 2-byte pad between end of
432 * channel_list and first ssid
433 *
434 * if ssid count is zero, single ssid in the
435 * fixed parameter portion is assumed, otherwise
436 * ssid in the fixed portion is ignored
437 */
438 u16 channel_list[1]; /* list of chanspecs */
439};
440
441/* incremental scan struct */
442struct brcmf_iscan_params {
443 u32 version;
444 u16 action;
445 u16 scan_duration;
446 struct brcmf_scan_params params;
447};
448
449/* 3 fields + size of brcmf_scan_params, not including variable length array */
450#define BRCMF_ISCAN_PARAMS_FIXED_SIZE \
451 (offsetof(struct brcmf_iscan_params, params) + \
452 sizeof(struct brcmf_ssid))
453
454struct brcmf_scan_results {
455 u32 buflen;
456 u32 version;
457 u32 count;
458 struct brcmf_bss_info bss_info[1];
459};
460
461/* used for association with a specific BSSID and chanspec list */
462struct brcmf_assoc_params {
463 u8 bssid[ETH_ALEN]; /* 00:00:00:00:00:00: broadcast scan */
464 s32 chanspec_num; /* 0: all available channels,
465 * otherwise count of chanspecs in chanspec_list
466 */
467 chanspec_t chanspec_list[1]; /* list of chanspecs */
468};
469#define BRCMF_ASSOC_PARAMS_FIXED_SIZE \
470 (sizeof(struct brcmf_assoc_params) - sizeof(chanspec_t))
471
472/* used for join with or without a specific bssid and channel list */
473struct brcmf_join_params {
474 struct brcmf_ssid ssid;
475 struct brcmf_assoc_params params;
476};
477
478/* size of brcmf_scan_results not including variable length array */
479#define BRCMF_SCAN_RESULTS_FIXED_SIZE \
480 (sizeof(struct brcmf_scan_results) - sizeof(struct brcmf_bss_info))
481
482/* incremental scan results struct */
483struct brcmf_iscan_results {
484 u32 status;
485 struct brcmf_scan_results results;
486};
487
488/* size of brcmf_iscan_results not including variable length array */
489#define BRCMF_ISCAN_RESULTS_FIXED_SIZE \
490 (BRCMF_SCAN_RESULTS_FIXED_SIZE + \
491 offsetof(struct brcmf_iscan_results, results))
492
493struct brcmf_wsec_key {
494 u32 index; /* key index */
495 u32 len; /* key length */
496 u8 data[WLAN_MAX_KEY_LEN]; /* key data */
497 u32 pad_1[18];
498 u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
499 u32 flags; /* misc flags */
500 u32 pad_2[2];
501 int pad_3;
502 int iv_initialized; /* has IV been initialized already? */
503 int pad_4;
504 /* Rx IV */
505 struct {
506 u32 hi; /* upper 32 bits of IV */
507 u16 lo; /* lower 16 bits of IV */
508 } rxiv;
509 u32 pad_5[2];
510 u8 ea[ETH_ALEN]; /* per station */
511};
512
513/* Used to get specific STA parameters */
514struct brcmf_scb_val {
515 u32 val;
516 u8 ea[ETH_ALEN];
517};
518
519/* channel encoding */
520struct brcmf_channel_info {
521 int hw_channel;
522 int target_channel;
523 int scan_channel;
51};524};
52 525
526/* Linux network driver ioctl encoding */
527struct brcmf_ioctl {
528 uint cmd; /* common ioctl definition */
529 void *buf; /* pointer to user buffer */
530 uint len; /* length of user buffer */
531 u8 set; /* get or set request (optional) */
532 uint used; /* bytes read or written (optional) */
533 uint needed; /* bytes needed (optional) */
534};
535
536/* Forward decls for struct brcmf_pub (see below) */
537struct brcmf_bus; /* device bus info */
538struct brcmf_proto; /* device communication protocol info */
539struct brcmf_info; /* device driver info */
540
53/* Common structure for module and instance linkage */541/* Common structure for module and instance linkage */
54typedef struct dhd_pub {542struct brcmf_pub {
55 /* Linkage ponters */543 /* Linkage ponters */
56 struct dhd_bus *bus; /* Bus module handle */544 struct brcmf_bus *bus;
57 struct dhd_prot *prot; /* Protocol module handle */545 struct brcmf_proto *prot;
58 struct dhd_info *info; /* Info module handle */546 struct brcmf_info *info;
59 547
60 /* Internal dhd items */548 /* Internal brcmf items */
61 bool up; /* Driver up/down (to OS) */549 bool up; /* Driver up/down (to OS) */
62 bool txoff; /* Transmit flow-controlled */550 bool txoff; /* Transmit flow-controlled */
63 bool dongle_reset; /* true = DEVRESET put dongle into reset */551 bool dongle_reset; /* true = DEVRESET put dongle into reset */
64 enum dhd_bus_state busstate;552 enum brcmf_bus_state busstate;
65 uint hdrlen; /* Total DHD header length (proto + bus) */553 uint hdrlen; /* Total BRCMF header length (proto + bus) */
66 uint maxctl; /* Max size rxctl request from proto to bus */554 uint maxctl; /* Max size rxctl request from proto to bus */
67 uint rxsz; /* Rx buffer size bus module should use */555 uint rxsz; /* Rx buffer size bus module should use */
68 u8 wme_dp; /* wme discard priority */556 u8 wme_dp; /* wme discard priority */
@@ -71,7 +559,7 @@ typedef struct dhd_pub { · 2 unmodified lines
71 bool iswl; /* Dongle-resident driver is wl */559 bool iswl; /* Dongle-resident driver is wl */
72 unsigned long drv_version; /* Version of dongle-resident driver */560 unsigned long drv_version; /* Version of dongle-resident driver */
73 u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */561 u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */
74 dngl_stats_t dstats; /* Stats for dongle-based data */562 struct dngl_stats dstats; /* Stats for dongle-based data */
75 563
76 /* Additional stats for the bus level */564 /* Additional stats for the bus level */
77 unsigned long tx_packets; /* Data packets sent to dongle */565 unsigned long tx_packets; /* Data packets sent to dongle */
@@ -88,7 +576,7 @@ typedef struct dhd_pub { · 10 unmodified lines
88 unsigned long rx_dropped; /* Packets dropped locally (no memory) */576 unsigned long rx_dropped; /* Packets dropped locally (no memory) */
89 unsigned long rx_flushed; /* Packets flushed due to577 unsigned long rx_flushed; /* Packets flushed due to
90 unscheduled sendup thread */578 unscheduled sendup thread */
91 unsigned long wd_dpc_sched; /* Number of times dhd dpc scheduled by579 unsigned long wd_dpc_sched; /* Number of times dpc scheduled by
92 watchdog timer */580 watchdog timer */
93 581
94 unsigned long rx_readahead_cnt; /* Number of packets where header read-ahead582 unsigned long rx_readahead_cnt; /* Number of packets where header read-ahead
@@ -108,40 +596,51 @@ typedef struct dhd_pub { · 13 unmodified lines
108 int suspend_disable_flag; /* "1" to disable all extra powersaving596 int suspend_disable_flag; /* "1" to disable all extra powersaving
109 during suspend */597 during suspend */
110 int in_suspend; /* flag set to 1 when early suspend called */598 int in_suspend; /* flag set to 1 when early suspend called */
111#ifdef PNO_SUPPORT
112 int pno_enable; /* pno status : "1" is pno enable */
113#endif /* PNO_SUPPORT */
114 int dtim_skip; /* dtim skip , default 0 means wake each dtim */599 int dtim_skip; /* dtim skip , default 0 means wake each dtim */
115 600
116 /* Pkt filter defination */601 /* Pkt filter defination */
117 char *pktfilter[100];602 char *pktfilter[100];
118 int pktfilter_count;603 int pktfilter_count;
119 604
120 u8 country_code[WLC_CNTRY_BUF_SZ];605 u8 country_code[BRCM_CNTRY_BUF_SZ];
121 char eventmask[WL_EVENTING_MASK_LEN];606 char eventmask[BRCMF_EVENTING_MASK_LEN];
607
608};
609
610struct brcmf_if_event {
611 u8 ifidx;
612 u8 action;
613 u8 flags;
614 u8 bssidx;
615};
616
617struct brcmf_timeout {
618 u32 limit; /* Expiration time (usec) */
619 u32 increment; /* Current expiration increment (usec) */
620 u32 elapsed; /* Current elapsed time (usec) */
621 u32 tick; /* O/S tick time (usec) */
622};
122 623
123} dhd_pub_t;624struct bcmevent_name {
625 uint event;
626 const char *name;
627};
124 628
125#if defined(CONFIG_PM_SLEEP)629#if defined(CONFIG_PM_SLEEP)
126extern atomic_t dhd_mmc_suspend;630extern atomic_t brcmf_mmc_suspend;
127#define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);631#define BRCMF_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
128#define _DHD_PM_RESUME_WAIT(a, b) do { \632#define _BRCMF_PM_RESUME_WAIT(a, b) do { \
129 int retry = 0; \633 int retry = 0; \
130 while (atomic_read(&dhd_mmc_suspend) && retry++ != b) { \634 while (atomic_read(&brcmf_mmc_suspend) && retry++ != b) { \
131 wait_event_timeout(a, false, HZ/100); \635 wait_event_timeout(a, false, HZ/100); \
132 } \636 } \
133 } while (0)637 } while (0)
134#define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 30)638#define BRCMF_PM_RESUME_WAIT(a) _BRCMF_PM_RESUME_WAIT(a, 30)
135#define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0)639#define BRCMF_PM_RESUME_RETURN_ERROR(a) \
136#define DHD_PM_RESUME_RETURN_ERROR(a) \640 do { if (atomic_read(&brcmf_mmc_suspend)) return a; } while (0)
137 do { if (atomic_read(&dhd_mmc_suspend)) return a; } while (0)
138#define DHD_PM_RESUME_RETURN do { \
139 if (atomic_read(&dhd_mmc_suspend)) \
140 return; \
141 } while (0)
142 641
143#define DHD_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);642#define BRCMF_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
144#define SPINWAIT_SLEEP(a, exp, us) do { \643#define BRCMF_SPINWAIT_SLEEP(a, exp, us) do { \
145 uint countdown = (us) + 9999; \644 uint countdown = (us) + 9999; \
146 while ((exp) && (countdown >= 10000)) { \645 while ((exp) && (countdown >= 10000)) { \
147 wait_event_timeout(a, false, HZ/100); \646 wait_event_timeout(a, false, HZ/100); \
@@ -151,14 +650,12 @@ extern atomic_t dhd_mmc_suspend; · 3 unmodified lines
151 650
152#else651#else
153 652
154#define DHD_PM_RESUME_WAIT_INIT(a)653#define BRCMF_PM_RESUME_WAIT_INIT(a)
155#define DHD_PM_RESUME_WAIT(a)654#define BRCMF_PM_RESUME_WAIT(a)
156#define DHD_PM_RESUME_WAIT_FOREVER(a)655#define BRCMF_PM_RESUME_RETURN_ERROR(a)
157#define DHD_PM_RESUME_RETURN_ERROR(a)
158#define DHD_PM_RESUME_RETURN
159 656
160#define DHD_SPINWAIT_SLEEP_INIT(a)657#define BRCMF_SPINWAIT_SLEEP_INIT(a)
161#define SPINWAIT_SLEEP(a, exp, us) do { \658#define BRCMF_SPINWAIT_SLEEP(a, exp, us) do { \
162 uint countdown = (us) + 9; \659 uint countdown = (us) + 9; \
163 while ((exp) && (countdown >= 10)) { \660 while ((exp) && (countdown >= 10)) { \
164 udelay(10); \661 udelay(10); \
@@ -167,29 +664,82 @@ extern atomic_t dhd_mmc_suspend; · 2 unmodified lines
167 } while (0)664 } while (0)
168 665
169#endif /* defined(CONFIG_PM_SLEEP) */666#endif /* defined(CONFIG_PM_SLEEP) */
170#define DHD_IF_VIF 0x01 /* Virtual IF (Hidden from user) */
171 667
172static inline void MUTEX_LOCK_INIT(dhd_pub_t *dhdp)668/*
669 * Insmod parameters for debug/test
670 */
671
672/* Use interrupts */
673extern uint brcmf_intr;
674
675/* Use polling */
676extern uint brcmf_poll;
677
678/* ARP offload agent mode */
679extern uint brcmf_arp_mode;
680
681/* ARP offload enable */
682extern uint brcmf_arp_enable;
683
684/* Pkt filte enable control */
685extern uint brcmf_pkt_filter_enable;
686
687/* Pkt filter init setup */
688extern uint brcmf_pkt_filter_init;
689
690/* Pkt filter mode control */
691extern uint brcmf_master_mode;
692
693/* Roaming mode control */
694extern uint brcmf_roam;
695
696/* Roaming mode control */
697extern uint brcmf_radio_up;
698
699/* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */
700extern int brcmf_idletime;
701#define BRCMF_IDLETIME_TICKS 1
702
703/* SDIO Drive Strength */
704extern uint brcmf_sdiod_drive_strength;
705
706/* Override to force tx queueing all the time */
707extern uint brcmf_force_tx_queueing;
708
709#ifdef SDTEST
710/* Echo packet generator (SDIO), pkts/s */
711extern uint brcmf_pktgen;
712
713/* Echo packet len (0 => sawtooth, max 1800) */
714extern uint brcmf_pktgen_len;
715#define BRCMF_MAX_PKTGEN_LEN 1800
716#endif
717
718extern const struct bcmevent_name bcmevent_names[];
719extern const int bcmevent_names_size;
720
721
722static inline void MUTEX_LOCK_INIT(struct brcmf_pub *drvr)
173{723{
174}724}
175 725
176static inline void MUTEX_LOCK(dhd_pub_t *dhdp)726static inline void MUTEX_LOCK(struct brcmf_pub *drvr)
177{727{
178}728}
179 729
180static inline void MUTEX_UNLOCK(dhd_pub_t *dhdp)730static inline void MUTEX_UNLOCK(struct brcmf_pub *drvr)
181{731{
182}732}
183 733
184static inline void MUTEX_LOCK_SOFTAP_SET_INIT(dhd_pub_t *dhdp)734static inline void MUTEX_LOCK_SOFTAP_SET_INIT(struct brcmf_pub *drvr)
185{735{
186}736}
187 737
188static inline void MUTEX_LOCK_SOFTAP_SET(dhd_pub_t *dhdp)738static inline void MUTEX_LOCK_SOFTAP_SET(struct brcmf_pub *drvr)
189{739{
190}740}
191 741
192static inline void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t *dhdp)742static inline void MUTEX_UNLOCK_SOFTAP_SET(struct brcmf_pub *drvr)
193{743{
194}744}
195 745
@@ -205,210 +755,150 @@ static inline void MUTEX_UNLOCK_WL_SCAN_SET(void) · 9 unmodified lines
205{755{
206}756}
207 757
208typedef struct dhd_if_event {
209 u8 ifidx;
210 u8 action;
211 u8 flags;
212 u8 bssidx;
213} dhd_if_event_t;
214
215/*
216 * Exported from dhd OS modules (dhd_linux/dhd_ndis)
217 */
218
219/* Indication from bus module regarding presence/insertion of dongle.758/* Indication from bus module regarding presence/insertion of dongle.
220 * Return dhd_pub_t pointer, used as handle to OS module in later calls.759 * Return struct brcmf_pub pointer, used as handle to OS module in later calls.
221 * Returned structure should have bus and prot pointers filled in.760 * Returned structure should have bus and prot pointers filled in.
222 * bus_hdrlen specifies required headroom for bus module header.761 * bus_hdrlen specifies required headroom for bus module header.
223 */762 */
224extern dhd_pub_t *dhd_attach(struct dhd_bus *bus,763extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus,
225 uint bus_hdrlen);764 uint bus_hdrlen);
226extern int dhd_net_attach(dhd_pub_t *dhdp, int idx);765extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx);
766extern int brcmf_netdev_wait_pend8021x(struct net_device *dev);
227 767
228/* Indication from bus module regarding removal/absence of dongle */768/* Indication from bus module regarding removal/absence of dongle */
229extern void dhd_detach(dhd_pub_t *dhdp);769extern void brcmf_detach(struct brcmf_pub *drvr);
230 770
231/* Indication from bus module to change flow-control state */771/* Indication from bus module to change flow-control state */
232extern void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on);772extern void brcmf_txflowcontrol(struct brcmf_pub *drvr, int ifidx, bool on);
233 773
234extern bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q,774extern bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q,
235 struct sk_buff *pkt, int prec);775 struct sk_buff *pkt, int prec);
236 776
237/* Receive frame for delivery to OS. Callee disposes of rxp. */777/* Receive frame for delivery to OS. Callee disposes of rxp. */
238extern void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx,778extern void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx,
239 struct sk_buff *rxp, int numpkt);779 struct sk_buff *rxp, int numpkt);
240 780
241/* Return pointer to interface name */781/* Return pointer to interface name */
242extern char *dhd_ifname(dhd_pub_t *dhdp, int idx);782extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
243
244/* Request scheduling of the bus dpc */
245extern void dhd_sched_dpc(dhd_pub_t *dhdp);
246 783
247/* Notify tx completion */784/* Notify tx completion */
248extern void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success);785extern void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp,
786 bool success);
249 787
250/* Query ioctl */788/* Query ioctl */
251extern int dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,789extern int brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx,
252 uint len);790 uint cmd, void *buf, uint len);
253 791
254/* OS independent layer functions */792/* OS independent layer functions */
255extern int dhd_os_proto_block(dhd_pub_t *pub);793extern int brcmf_os_proto_block(struct brcmf_pub *drvr);
256extern int dhd_os_proto_unblock(dhd_pub_t *pub);794extern int brcmf_os_proto_unblock(struct brcmf_pub *drvr);
257extern int dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition,795extern int brcmf_os_ioctl_resp_wait(struct brcmf_pub *drvr, uint *condition,
258 bool *pending);796 bool *pending);
259extern int dhd_os_ioctl_resp_wake(dhd_pub_t *pub);797extern int brcmf_os_ioctl_resp_wake(struct brcmf_pub *drvr);
260extern unsigned int dhd_os_get_ioctl_resp_timeout(void);798extern unsigned int brcmf_os_get_ioctl_resp_timeout(void);
261extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec);799extern void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec);
262extern void *dhd_os_open_image(char *filename);800#ifdef BCMDBG
263extern int dhd_os_get_image_block(char *buf, int len, void *image);801extern int brcmf_write_to_file(struct brcmf_pub *drvr, u8 *buf, int size);
264extern void dhd_os_close_image(void *image);802#endif /* BCMDBG */
265extern void dhd_os_wd_timer(void *bus, uint wdtick);
266extern void dhd_os_sdlock(dhd_pub_t *pub);
267extern void dhd_os_sdunlock(dhd_pub_t *pub);
268extern void dhd_os_sdlock_txq(dhd_pub_t *pub);
269extern void dhd_os_sdunlock_txq(dhd_pub_t *pub);
270extern void dhd_os_sdlock_rxq(dhd_pub_t *pub);
271extern void dhd_os_sdunlock_rxq(dhd_pub_t *pub);
272extern void dhd_os_sdlock_sndup_rxq(dhd_pub_t *pub);
273extern void dhd_customer_gpio_wlan_ctrl(int onoff);
274extern int dhd_custom_get_mac_address(unsigned char *buf);
275extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t *pub);
276extern void dhd_os_sdlock_eventq(dhd_pub_t *pub);
277extern void dhd_os_sdunlock_eventq(dhd_pub_t *pub);
278#ifdef DHD_DEBUG
279extern int write_to_file(dhd_pub_t *dhd, u8 *buf, int size);
280#endif /* DHD_DEBUG */
281#if defined(OOB_INTR_ONLY)
282extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr);
283#endif /* defined(OOB_INTR_ONLY) */
284extern void dhd_os_sdtxlock(dhd_pub_t *pub);
285extern void dhd_os_sdtxunlock(dhd_pub_t *pub);
286
287int setScheduler(struct task_struct *p, int policy, struct sched_param *param);
288
289typedef struct {
290 u32 limit; /* Expiration time (usec) */
291 u32 increment; /* Current expiration increment (usec) */
292 u32 elapsed; /* Current elapsed time (usec) */
293 u32 tick; /* O/S tick time (usec) */
294} dhd_timeout_t;
295 803
296extern void dhd_timeout_start(dhd_timeout_t *tmo, uint usec);804extern void brcmf_timeout_start(struct brcmf_timeout *tmo, uint usec);
297extern int dhd_timeout_expired(dhd_timeout_t *tmo);805extern int brcmf_timeout_expired(struct brcmf_timeout *tmo);
298 806
299extern int dhd_ifname2idx(struct dhd_info *dhd, char *name);807extern int brcmf_ifname2idx(struct brcmf_info *drvr_priv, char *name);
300extern u8 *dhd_bssidx2bssid(dhd_pub_t *dhd, int idx);808extern int brcmf_c_host_event(struct brcmf_info *drvr_priv, int *idx,
301extern int wl_host_event(struct dhd_info *dhd, int *idx, void *pktdata,809 void *pktdata, struct brcmf_event_msg *,
302 wl_event_msg_t *, void **data_ptr);810 void **data_ptr);
303 811
304extern void dhd_common_init(void);812extern void brcmf_c_init(void);
305 813
306extern int dhd_add_if(struct dhd_info *dhd, int ifidx, void *handle,814extern int brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle,
307 char *name, u8 *mac_addr, u32 flags, u8 bssidx);815 char *name, u8 *mac_addr, u32 flags, u8 bssidx);
308extern void dhd_del_if(struct dhd_info *dhd, int ifidx);816extern void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx);
309
310extern void dhd_vif_add(struct dhd_info *dhd, int ifidx, char *name);
311extern void dhd_vif_del(struct dhd_info *dhd, int ifidx);
312
313extern void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx);
314extern void dhd_vif_sendup(struct dhd_info *dhd, int ifidx, unsigned char * cp,
315 int len);
316 817
317/* Send packet to dongle via data channel */818/* Send packet to dongle via data channel */
318extern int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pkt);819extern int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx,\
319 820 struct sk_buff *pkt);
320/* Send event to host */821
321extern void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event,822extern int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag);
322 void *data);823extern int brcmf_bus_start(struct brcmf_pub *drvr);
323extern int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag);824
324extern uint dhd_bus_status(dhd_pub_t *dhdp);825extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg);
325extern int dhd_bus_start(dhd_pub_t *dhdp);826extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg,
326 827 int enable, int master_mode);
327enum cust_gpio_modes {828
328 WLAN_RESET_ON,829/* Linux network driver ioctl encoding */
329 WLAN_RESET_OFF,830struct brcmf_c_ioctl {
330 WLAN_POWER_ON,831 uint cmd; /* common ioctl definition */
331 WLAN_POWER_OFF832 void *buf; /* pointer to user buffer */
833 uint len; /* length of user buffer */
834 bool set; /* get or set request (optional) */
835 uint used; /* bytes read or written (optional) */
836 uint needed; /* bytes needed (optional) */
837 uint driver; /* to identify target driver */
332};838};
333/*
334 * Insmod parameters for debug/test
335 */
336
337/* Watchdog timer interval */
338extern uint dhd_watchdog_ms;
339
340#if defined(DHD_DEBUG)
341/* Console output poll interval */
342extern uint dhd_console_ms;
343#endif /* defined(DHD_DEBUG) */
344
345/* Use interrupts */
346extern uint dhd_intr;
347
348/* Use polling */
349extern uint dhd_poll;
350
351/* ARP offload agent mode */
352extern uint dhd_arp_mode;
353
354/* ARP offload enable */
355extern uint dhd_arp_enable;
356
357/* Pkt filte enable control */
358extern uint dhd_pkt_filter_enable;
359
360/* Pkt filter init setup */
361extern uint dhd_pkt_filter_init;
362
363/* Pkt filter mode control */
364extern uint dhd_master_mode;
365 839
366/* Roaming mode control */840/* per-driver magic numbers */
367extern uint dhd_roam;841#define BRCMF_IOCTL_MAGIC 0x00444944
368 842
369/* Roaming mode control */843/* bump this number if you change the ioctl interface */
370extern uint dhd_radio_up;844#define BRCMF_IOCTL_VERSION 1
371 845#define BRCMF_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */
372/* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */846
373extern int dhd_idletime;847/* common ioctl definitions */
374#define DHD_IDLETIME_TICKS 1848#define BRCMF_GET_MAGIC 0
375 849#define BRCMF_GET_VERSION 1
376/* SDIO Drive Strength */850#define BRCMF_GET_VAR 2
377extern uint dhd_sdiod_drive_strength;851#define BRCMF_SET_VAR 3
378 852
379/* Override to force tx queueing all the time */853/* message levels */
380extern uint dhd_force_tx_queueing;854#define BRCMF_ERROR_VAL 0x0001
855#define BRCMF_TRACE_VAL 0x0002
856#define BRCMF_INFO_VAL 0x0004
857#define BRCMF_DATA_VAL 0x0008
858#define BRCMF_CTL_VAL 0x0010
859#define BRCMF_TIMER_VAL 0x0020
860#define BRCMF_HDRS_VAL 0x0040
861#define BRCMF_BYTES_VAL 0x0080
862#define BRCMF_INTR_VAL 0x0100
863#define BRCMF_GLOM_VAL 0x0400
864#define BRCMF_EVENT_VAL 0x0800
865#define BRCMF_BTA_VAL 0x1000
866#define BRCMF_ISCAN_VAL 0x2000
381 867
382#ifdef SDTEST868#ifdef SDTEST
383/* Echo packet generator (SDIO), pkts/s */869/* For pktgen iovar */
384extern uint dhd_pktgen;870struct brcmf_pktgen {
385 871 uint version; /* To allow structure change tracking */
386/* Echo packet len (0 => sawtooth, max 1800) */872 uint freq; /* Max ticks between tx/rx attempts */
387extern uint dhd_pktgen_len;873 uint count; /* Test packets to send/rcv each attempt */
388#define MAX_PKTGEN_LEN 1800874 uint print; /* Print counts every <print> attempts */
389#endif875 uint total; /* Total packets (or bursts) */
390 876 uint minlen; /* Minimum length of packets to send */
391/* optionally set by a module_param_string() */877 uint maxlen; /* Maximum length of packets to send */
392#define MOD_PARAM_PATHLEN 2048878 uint numsent; /* Count of test packets sent */
393extern char fw_path[MOD_PARAM_PATHLEN];879 uint numrcvd; /* Count of test packets received */
394extern char nv_path[MOD_PARAM_PATHLEN];880 uint numfail; /* Count of test send failures */
881 uint mode; /* Test mode (type of test packets) */
882 uint stop; /* Stop after this many tx failures */
883};
395 884
396/* For supporting multiple interfaces */885/* Version in case structure changes */
397#define DHD_MAX_IFS 16886#define BRCMF_PKTGEN_VERSION 2
398#define DHD_DEL_IF -0xe
399#define DHD_BAD_IF -0xf
400 887
401extern void dhd_wait_for_event(dhd_pub_t *dhd, bool * lockvar);888/* Type of test packets to use */
402extern void dhd_wait_event_wakeup(dhd_pub_t *dhd);889#define BRCMF_PKTGEN_ECHO 1 /* Send echo requests */
890#define BRCMF_PKTGEN_SEND 2 /* Send discard packets */
891#define BRCMF_PKTGEN_RXBURST 3 /* Request dongle send N packets */
892#define BRCMF_PKTGEN_RECV 4 /* Continuous rx from continuous
893 tx dongle */
894#endif /* SDTEST */
403 895
404extern u32 g_assert_type;896/* Enter idle immediately (no timeout) */
897#define BRCMF_IDLE_IMMEDIATE (-1)
405 898
406#ifdef BCMDBG899/* Values for idleclock iovar: other values are the sd_divisor to use
407#define ASSERT(exp) \900 when idle */
408 do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)901#define BRCMF_IDLE_ACTIVE 0 /* Do not request any SD clock change
409extern void osl_assert(char *exp, char *file, int line);902 when idle */
410#else
411#define ASSERT(exp) do {} while (0)
412#endif /* defined(BCMDBG) */
413 903
414#endif /* _dhd_h_ */904#endif /* _BRCMF_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_bus.h+36−40
@@ -14,69 +14,65 @@ · 13 unmodified lines
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */15 */
16 16
17#ifndef _dhd_bus_h_17#ifndef _BRCMF_BUS_H_
18#define _dhd_bus_h_18#define _BRCMF_BUS_H_
19
20/* Packet alignment for most efficient SDIO (can change based on platform) */
21#ifndef BRCMF_SDALIGN
22#define BRCMF_SDALIGN 32
23#endif
24#if !ISPOWEROF2(BRCMF_SDALIGN)
25#error BRCMF_SDALIGN is not a power of 2!
26#endif
19 27
20/*28/*
21 * Exported from dhd bus module (dhd_usb, dhd_sdio)29 * Exported from brcmf bus module (brcmf_usb, brcmf_sdio)
22 */30 */
23 31
24/* Indicate (dis)interest in finding dongles. */32/* dongle ram module parameter */
25extern int dhd_bus_register(void);33extern int brcmf_dongle_memsize;
26extern void dhd_bus_unregister(void);34
35/* Tx/Rx bounds module parameters */
36extern uint brcmf_txbound;
37extern uint brcmf_rxbound;
27 38
28/* Download firmware image and nvram image */39/* Watchdog timer interval */
29extern bool dhd_bus_download_firmware(struct dhd_bus *bus,40extern uint brcmf_watchdog_ms;
30 char *fw_path, char *nv_path);41
42/* Indicate (dis)interest in finding dongles. */
43extern int brcmf_bus_register(void);
44extern void brcmf_bus_unregister(void);
31 45
32/* Stop bus module: clear pending frames, disable data flow */46/* Stop bus module: clear pending frames, disable data flow */
33extern void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex);47extern void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex);
34 48
35/* Initialize bus module: prepare for communication w/dongle */49/* Initialize bus module: prepare for communication w/dongle */
36extern int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex);50extern int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex);
37 51
38/* Send a data frame to the dongle. Callee disposes of txp. */52/* Send a data frame to the dongle. Callee disposes of txp. */
39extern int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *txp);53extern int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *txp);
40 54
41/* Send/receive a control message to/from the dongle.55/* Send/receive a control message to/from the dongle.
42 * Expects caller to enforce a single outstanding transaction.56 * Expects caller to enforce a single outstanding transaction.
43 */57 */
44extern int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen);58extern int
45extern int dhd_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen);59brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen);
46 60
47/* Watchdog timer function */61extern int
48extern bool dhd_bus_watchdog(dhd_pub_t *dhd);62brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen);
49
50#ifdef DHD_DEBUG
51/* Device console input function */
52extern int dhd_bus_console_in(dhd_pub_t *dhd, unsigned char *msg, uint msglen);
53#endif /* DHD_DEBUG */
54
55/* Deferred processing for the bus, return true requests reschedule */
56extern bool dhd_bus_dpc(struct dhd_bus *bus);
57extern void dhd_bus_isr(bool *InterruptRecognized,
58 bool *QueueMiniportHandleInterrupt, void *arg);
59 63
60/* Check for and handle local prot-specific iovar commands */64/* Check for and handle local prot-specific iovar commands */
61extern int dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name,65extern int brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name,
62 void *params, int plen, void *arg, int len,66 void *params, int plen, void *arg, int len,
63 bool set);67 bool set);
64 68
65/* Add bus dump output to a buffer */69/* Add bus dump output to a buffer */
66extern void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf);70extern void brcmf_sdbrcm_bus_dump(struct brcmf_pub *drvr,
71 struct brcmu_strbuf *strbuf);
67 72
68/* Clear any bus counters */73/* Clear any bus counters */
69extern void dhd_bus_clearcounts(dhd_pub_t *dhdp);74extern void brcmf_bus_clearcounts(struct brcmf_pub *drvr);
70
71/* return the dongle chipid */
72extern uint dhd_bus_chip(struct dhd_bus *bus);
73
74/* Set user-specified nvram parameters. */
75extern void dhd_bus_set_nvram_params(struct dhd_bus *bus,
76 const char *nvram_params);
77 75
78extern void *dhd_bus_pub(struct dhd_bus *bus);76extern void brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick);
79extern void *dhd_bus_txq(struct dhd_bus *bus);
80extern uint dhd_bus_hdrlen(struct dhd_bus *bus);
81 77
82#endif /* _dhd_bus_h_ */78#endif /* _BRCMF_BUS_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c+188−160
@@ -16,33 +16,71 @@ · 15 unmodified lines
16 16
17#include <linux/types.h>17#include <linux/types.h>
18#include <linux/netdevice.h>18#include <linux/netdevice.h>
19#include <bcmdefs.h>19#include <linux/sched.h>
20 20#include <defs.h>
21#include <bcmutils.h>21
22#include <bcmcdc.h>22#include <brcmu_utils.h>
23 23#include <brcmu_wifi.h>
24#include <dngl_stats.h>24
25#include <dhd.h>25#include "dhd.h"
26#include <dhd_proto.h>26#include "dhd_proto.h"
27#include <dhd_bus.h>27#include "dhd_bus.h"
28#include <dhd_dbg.h>28#include "dhd_dbg.h"
29#ifdef CUSTOMER_HW229
30int wifi_get_mac_addr(unsigned char *buf);30struct brcmf_proto_cdc_ioctl {
31#endif31 u32 cmd; /* ioctl command value */
32 32 u32 len; /* lower 16: output buflen;
33extern int dhd_preinit_ioctls(dhd_pub_t *dhd);33 * upper 16: input buflen (excludes header) */
34 34 u32 flags; /* flag defns given below */
35/* Packet alignment for most efficient SDIO (can change based on platform) */35 u32 status; /* status code returned from the device */
36#ifndef DHD_SDALIGN36};
37#define DHD_SDALIGN 3237
38#endif38/* Max valid buffer size that can be sent to the dongle */
39#if !ISPOWEROF2(DHD_SDALIGN)39#define CDC_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN)
40#error DHD_SDALIGN is not a power of 2!40
41#endif41/* CDC flag definitions */
42#define CDCF_IOC_ERROR 0x01 /* 1=ioctl cmd failed */
43#define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */
44#define CDCF_IOC_IF_MASK 0xF000 /* I/F index */
45#define CDCF_IOC_IF_SHIFT 12
46#define CDCF_IOC_ID_MASK 0xFFFF0000 /* id an ioctl pairing */
47#define CDCF_IOC_ID_SHIFT 16 /* ID Mask shift bits */
48#define CDC_IOC_ID(flags) \
49 (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT)
50#define CDC_SET_IF_IDX(hdr, idx) \
51 ((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | \
52 ((idx) << CDCF_IOC_IF_SHIFT)))
53
54/*
55 * BDC header - Broadcom specific extension of CDC.
56 * Used on data packets to convey priority across USB.
57 */
58#define BDC_HEADER_LEN 4
59#define BDC_PROTO_VER 1 /* Protocol version */
60#define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */
61#define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */
62#define BDC_FLAG_SUM_GOOD 0x04 /* Good RX checksums */
63#define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums */
64#define BDC_PRIORITY_MASK 0x7
65#define BDC_FLAG2_IF_MASK 0x0f /* packet rx interface in APSTA */
66#define BDC_FLAG2_IF_SHIFT 0
67
68#define BDC_GET_IF_IDX(hdr) \
69 ((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT))
70#define BDC_SET_IF_IDX(hdr, idx) \
71 ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | \
72 ((idx) << BDC_FLAG2_IF_SHIFT)))
73
74struct brcmf_proto_bdc_header {
75 u8 flags;
76 u8 priority; /* 802.1d Priority, 4:7 flow control info for usb */
77 u8 flags2;
78 u8 rssi;
79};
80
42 81
43#define RETRIES 2 /* # of retries to retrieve matching ioctl response */82#define RETRIES 2 /* # of retries to retrieve matching ioctl response */
44#define BUS_HEADER_LEN (16+DHD_SDALIGN) /* Must be atleast SDPCM_RESERVE83#define BUS_HEADER_LEN (16+BRCMF_SDALIGN) /* Must be atleast SDPCM_RESERVE
45 * defined in dhd_sdio.c
46 * (amount of header tha might be added)84 * (amount of header tha might be added)
47 * plus any space that might be needed85 * plus any space that might be needed
48 * for alignment padding.86 * for alignment padding.
@@ -51,21 +89,22 @@ extern int dhd_preinit_ioctls(dhd_pub_t *dhd); · 2 unmodified lines
51 * round off at the end of buffer89 * round off at the end of buffer
52 */90 */
53 91
54typedef struct dhd_prot {92struct brcmf_proto {
55 u16 reqid;93 u16 reqid;
56 u8 pending;94 u8 pending;
57 u32 lastcmd;95 u32 lastcmd;
58 u8 bus_header[BUS_HEADER_LEN];96 u8 bus_header[BUS_HEADER_LEN];
59 cdc_ioctl_t msg;97 struct brcmf_proto_cdc_ioctl msg;
60 unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN];98 unsigned char buf[BRCMF_C_IOCTL_MAXLEN + ROUND_UP_MARGIN];
61} dhd_prot_t;99};
62 100
63static int dhdcdc_msg(dhd_pub_t *dhd)101static int brcmf_proto_cdc_msg(struct brcmf_pub *drvr)
64{102{
65 dhd_prot_t *prot = dhd->prot;103 struct brcmf_proto *prot = drvr->prot;
66 int len = le32_to_cpu(prot->msg.len) + sizeof(cdc_ioctl_t);104 int len = le32_to_cpu(prot->msg.len) +
105 sizeof(struct brcmf_proto_cdc_ioctl);
67 106
68 DHD_TRACE(("%s: Enter\n", __func__));107 BRCMF_TRACE(("%s: Enter\n", __func__));
69 108
70 /* NOTE : cdc->msg.len holds the desired length of the buffer to be109 /* NOTE : cdc->msg.len holds the desired length of the buffer to be
71 * returned. Only up to CDC_MAX_MSG_SIZE of this buffer area110 * returned. Only up to CDC_MAX_MSG_SIZE of this buffer area
@@ -75,20 +114,21 @@ static int dhdcdc_msg(dhd_pub_t *dhd) · 3 unmodified lines
75 len = CDC_MAX_MSG_SIZE;114 len = CDC_MAX_MSG_SIZE;
76 115
77 /* Send request */116 /* Send request */
78 return dhd_bus_txctl(dhd->bus, (unsigned char *)&prot->msg, len);117 return brcmf_sdbrcm_bus_txctl(drvr->bus, (unsigned char *)&prot->msg,
118 len);
79}119}
80 120
81static int dhdcdc_cmplt(dhd_pub_t *dhd, u32 id, u32 len)121static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len)
82{122{
83 int ret;123 int ret;
84 dhd_prot_t *prot = dhd->prot;124 struct brcmf_proto *prot = drvr->prot;
85 125
86 DHD_TRACE(("%s: Enter\n", __func__));126 BRCMF_TRACE(("%s: Enter\n", __func__));
87 127
88 do {128 do {
89 ret =129 ret = brcmf_sdbrcm_bus_rxctl(drvr->bus,
90 dhd_bus_rxctl(dhd->bus, (unsigned char *)&prot->msg,130 (unsigned char *)&prot->msg,
91 len + sizeof(cdc_ioctl_t));131 len + sizeof(struct brcmf_proto_cdc_ioctl));
92 if (ret < 0)132 if (ret < 0)
93 break;133 break;
94 } while (CDC_IOC_ID(le32_to_cpu(prot->msg.flags)) != id);134 } while (CDC_IOC_ID(le32_to_cpu(prot->msg.flags)) != id);
@@ -97,30 +137,31 @@ static int dhdcdc_cmplt(dhd_pub_t *dhd, u32 id, u32 len) · 2 unmodified lines
97}137}
98 138
99int139int
100dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)140brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
141 void *buf, uint len)
101{142{
102 dhd_prot_t *prot = dhd->prot;143 struct brcmf_proto *prot = drvr->prot;
103 cdc_ioctl_t *msg = &prot->msg;144 struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
104 void *info;145 void *info;
105 int ret = 0, retries = 0;146 int ret = 0, retries = 0;
106 u32 id, flags = 0;147 u32 id, flags = 0;
107 148
108 DHD_TRACE(("%s: Enter\n", __func__));149 BRCMF_TRACE(("%s: Enter\n", __func__));
109 DHD_CTL(("%s: cmd %d len %d\n", __func__, cmd, len));150 BRCMF_CTL(("%s: cmd %d len %d\n", __func__, cmd, len));
110 151
111 /* Respond "bcmerror" and "bcmerrorstr" with local cache */152 /* Respond "bcmerror" and "bcmerrorstr" with local cache */
112 if (cmd == WLC_GET_VAR && buf) {153 if (cmd == BRCMF_C_GET_VAR && buf) {
113 if (!strcmp((char *)buf, "bcmerrorstr")) {154 if (!strcmp((char *)buf, "bcmerrorstr")) {
114 strncpy((char *)buf, "bcm_error",155 strncpy((char *)buf, "bcm_error",
115 BCME_STRLEN);156 BCME_STRLEN);
116 goto done;157 goto done;
117 } else if (!strcmp((char *)buf, "bcmerror")) {158 } else if (!strcmp((char *)buf, "bcmerror")) {
118 *(int *)buf = dhd->dongle_error;159 *(int *)buf = drvr->dongle_error;
119 goto done;160 goto done;
120 }161 }
121 }162 }
122 163
123 memset(msg, 0, sizeof(cdc_ioctl_t));164 memset(msg, 0, sizeof(struct brcmf_proto_cdc_ioctl));
124 165
125 msg->cmd = cpu_to_le32(cmd);166 msg->cmd = cpu_to_le32(cmd);
126 msg->len = cpu_to_le32(len);167 msg->len = cpu_to_le32(len);
@@ -131,16 +172,16 @@ dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) · 4 unmodified lines
131 if (buf)172 if (buf)
132 memcpy(prot->buf, buf, len);173 memcpy(prot->buf, buf, len);
133 174
134 ret = dhdcdc_msg(dhd);175 ret = brcmf_proto_cdc_msg(drvr);
135 if (ret < 0) {176 if (ret < 0) {
136 DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status "177 BRCMF_ERROR(("brcmf_proto_cdc_query_ioctl: brcmf_proto_cdc_msg "
137 "%d\n", ret));178 "failed w/status %d\n", ret));
138 goto done;179 goto done;
139 }180 }
140 181
141retry:182retry:
142 /* wait for interrupt and get first fragment */183 /* wait for interrupt and get first fragment */
143 ret = dhdcdc_cmplt(dhd, prot->reqid, len);184 ret = brcmf_proto_cdc_cmplt(drvr, prot->reqid, len);
144 if (ret < 0)185 if (ret < 0)
145 goto done;186 goto done;
146 187
@@ -150,8 +191,9 @@ retry: · 3 unmodified lines
150 if ((id < prot->reqid) && (++retries < RETRIES))191 if ((id < prot->reqid) && (++retries < RETRIES))
151 goto retry;192 goto retry;
152 if (id != prot->reqid) {193 if (id != prot->reqid) {
153 DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",194 BRCMF_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
154 dhd_ifname(dhd, ifidx), __func__, id, prot->reqid));195 brcmf_ifname(drvr, ifidx), __func__, id,
196 prot->reqid));
155 ret = -EINVAL;197 ret = -EINVAL;
156 goto done;198 goto done;
157 }199 }
@@ -170,24 +212,25 @@ retry: · 12 unmodified lines
170 if (flags & CDCF_IOC_ERROR) {212 if (flags & CDCF_IOC_ERROR) {
171 ret = le32_to_cpu(msg->status);213 ret = le32_to_cpu(msg->status);
172 /* Cache error from dongle */214 /* Cache error from dongle */
173 dhd->dongle_error = ret;215 drvr->dongle_error = ret;
174 }216 }
175 217
176done:218done:
177 return ret;219 return ret;
178}220}
179 221
180int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)222int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
223 void *buf, uint len)
181{224{
182 dhd_prot_t *prot = dhd->prot;225 struct brcmf_proto *prot = drvr->prot;
183 cdc_ioctl_t *msg = &prot->msg;226 struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
184 int ret = 0;227 int ret = 0;
185 u32 flags, id;228 u32 flags, id;
186 229
187 DHD_TRACE(("%s: Enter\n", __func__));230 BRCMF_TRACE(("%s: Enter\n", __func__));
188 DHD_CTL(("%s: cmd %d len %d\n", __func__, cmd, len));231 BRCMF_CTL(("%s: cmd %d len %d\n", __func__, cmd, len));
189 232
190 memset(msg, 0, sizeof(cdc_ioctl_t));233 memset(msg, 0, sizeof(struct brcmf_proto_cdc_ioctl));
191 234
192 msg->cmd = cpu_to_le32(cmd);235 msg->cmd = cpu_to_le32(cmd);
193 msg->len = cpu_to_le32(len);236 msg->len = cpu_to_le32(len);
@@ -198,11 +241,11 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) · 4 unmodified lines
198 if (buf)241 if (buf)
199 memcpy(prot->buf, buf, len);242 memcpy(prot->buf, buf, len);
200 243
201 ret = dhdcdc_msg(dhd);244 ret = brcmf_proto_cdc_msg(drvr);
202 if (ret < 0)245 if (ret < 0)
203 goto done;246 goto done;
204 247
205 ret = dhdcdc_cmplt(dhd, prot->reqid, len);248 ret = brcmf_proto_cdc_cmplt(drvr, prot->reqid, len);
206 if (ret < 0)249 if (ret < 0)
207 goto done;250 goto done;
208 251
@@ -210,8 +253,9 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) · 1 unmodified line
210 id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;253 id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
211 254
212 if (id != prot->reqid) {255 if (id != prot->reqid) {
213 DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",256 BRCMF_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
214 dhd_ifname(dhd, ifidx), __func__, id, prot->reqid));257 brcmf_ifname(drvr, ifidx), __func__, id,
258 prot->reqid));
215 ret = -EINVAL;259 ret = -EINVAL;
216 goto done;260 goto done;
217 }261 }
@@ -220,41 +264,40 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) · 2 unmodified lines
220 if (flags & CDCF_IOC_ERROR) {264 if (flags & CDCF_IOC_ERROR) {
221 ret = le32_to_cpu(msg->status);265 ret = le32_to_cpu(msg->status);
222 /* Cache error from dongle */266 /* Cache error from dongle */
223 dhd->dongle_error = ret;267 drvr->dongle_error = ret;
224 }268 }
225 269
226done:270done:
227 return ret;271 return ret;
228}272}
229 273
230extern int dhd_bus_interface(struct dhd_bus *bus, uint arg, void *arg2);
231int274int
232dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len)275brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc,
276 void *buf, int len)
233{277{
234 dhd_prot_t *prot = dhd->prot;278 struct brcmf_proto *prot = drvr->prot;
235 int ret = -1;279 int ret = -1;
236 280
237 if (dhd->busstate == DHD_BUS_DOWN) {281 if (drvr->busstate == BRCMF_BUS_DOWN) {
238 DHD_ERROR(("%s : bus is down. we have nothing to do\n",282 BRCMF_ERROR(("%s : bus is down. we have nothing to do\n",
239 __func__));283 __func__));
240 return ret;284 return ret;
241 }285 }
242 dhd_os_proto_block(dhd);286 brcmf_os_proto_block(drvr);
243
244 DHD_TRACE(("%s: Enter\n", __func__));
245 287
246 ASSERT(len <= WLC_IOCTL_MAXLEN);288 BRCMF_TRACE(("%s: Enter\n", __func__));
247 289
248 if (len > WLC_IOCTL_MAXLEN)290 if (len > BRCMF_C_IOCTL_MAXLEN)
249 goto done;291 goto done;
250 292
251 if (prot->pending == true) {293 if (prot->pending == true) {
252 DHD_TRACE(("CDC packet is pending!!!! cmd=0x%x (%lu) "294 BRCMF_TRACE(("CDC packet is pending!!!! cmd=0x%x (%lu) "
253 "lastcmd=0x%x (%lu)\n",295 "lastcmd=0x%x (%lu)\n",
254 ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd,296 ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd,
255 (unsigned long)prot->lastcmd));297 (unsigned long)prot->lastcmd));
256 if ((ioc->cmd == WLC_SET_VAR) || (ioc->cmd == WLC_GET_VAR))298 if ((ioc->cmd == BRCMF_C_SET_VAR) ||
257 DHD_TRACE(("iovar cmd=%s\n", (char *)buf));299 (ioc->cmd == BRCMF_C_GET_VAR))
300 BRCMF_TRACE(("iovar cmd=%s\n", (char *)buf));
258 301
259 goto done;302 goto done;
260 }303 }
@@ -262,36 +305,39 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len) · 1 unmodified line
262 prot->pending = true;305 prot->pending = true;
263 prot->lastcmd = ioc->cmd;306 prot->lastcmd = ioc->cmd;
264 if (ioc->set)307 if (ioc->set)
265 ret = dhdcdc_set_ioctl(dhd, ifidx, ioc->cmd, buf, len);308 ret = brcmf_proto_cdc_set_ioctl(drvr, ifidx, ioc->cmd,
309 buf, len);
266 else {310 else {
267 ret = dhdcdc_query_ioctl(dhd, ifidx, ioc->cmd, buf, len);311 ret = brcmf_proto_cdc_query_ioctl(drvr, ifidx, ioc->cmd,
312 buf, len);
268 if (ret > 0)313 if (ret > 0)
269 ioc->used = ret - sizeof(cdc_ioctl_t);314 ioc->used = ret - sizeof(struct brcmf_proto_cdc_ioctl);
270 }315 }
271 316
272 /* Too many programs assume ioctl() returns 0 on success */317 /* Too many programs assume ioctl() returns 0 on success */
273 if (ret >= 0)318 if (ret >= 0)
274 ret = 0;319 ret = 0;
275 else {320 else {
276 cdc_ioctl_t *msg = &prot->msg;321 struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
277 /* len == needed when set/query fails from dongle */322 /* len == needed when set/query fails from dongle */
278 ioc->needed = le32_to_cpu(msg->len);323 ioc->needed = le32_to_cpu(msg->len);
279 }324 }
280 325
281 /* Intercept the wme_dp ioctl here */326 /* Intercept the wme_dp ioctl here */
282 if ((!ret) && (ioc->cmd == WLC_SET_VAR) && (!strcmp(buf, "wme_dp"))) {327 if (!ret && ioc->cmd == BRCMF_C_SET_VAR &&
328 !strcmp(buf, "wme_dp")) {
283 int slen, val = 0;329 int slen, val = 0;
284 330
285 slen = strlen("wme_dp") + 1;331 slen = strlen("wme_dp") + 1;
286 if (len >= (int)(slen + sizeof(int)))332 if (len >= (int)(slen + sizeof(int)))
287 memcpy(&val, (char *)buf + slen, sizeof(int));333 memcpy(&val, (char *)buf + slen, sizeof(int));
288 dhd->wme_dp = (u8) le32_to_cpu(val);334 drvr->wme_dp = (u8) le32_to_cpu(val);
289 }335 }
290 336
291 prot->pending = false;337 prot->pending = false;
292 338
293done:339done:
294 dhd_os_proto_unblock(dhd);340 brcmf_os_proto_unblock(drvr);
295 341
296 return ret;342 return ret;
297}343}
@@ -302,35 +348,23 @@ done: · 4 unmodified lines
302 (((struct sk_buff *)(skb))->ip_summed = \348 (((struct sk_buff *)(skb))->ip_summed = \
303 ((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE))349 ((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE))
304 350
305/* PKTSETSUMNEEDED and PKTSUMGOOD are not possible because351void brcmf_proto_dump(struct brcmf_pub *drvr, struct brcmu_strbuf *strbuf)
306 skb->ip_summed is overloaded */
307
308int
309dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name,
310 void *params, int plen, void *arg, int len, bool set)
311{
312 return -ENOTSUPP;
313}
314
315void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
316{352{
317 bcm_bprintf(strbuf, "Protocol CDC: reqid %d\n", dhdp->prot->reqid);353 brcmu_bprintf(strbuf, "Protocol CDC: reqid %d\n", drvr->prot->reqid);
318}354}
319 355
320void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf)356void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx,
357 struct sk_buff *pktbuf)
321{358{
322#ifdef BDC359 struct brcmf_proto_bdc_header *h;
323 struct bdc_header *h;
324#endif /* BDC */
325 360
326 DHD_TRACE(("%s: Enter\n", __func__));361 BRCMF_TRACE(("%s: Enter\n", __func__));
327 362
328#ifdef BDC
329 /* Push BDC header used to convey priority for buses that don't */363 /* Push BDC header used to convey priority for buses that don't */
330 364
331 skb_push(pktbuf, BDC_HEADER_LEN);365 skb_push(pktbuf, BDC_HEADER_LEN);
332 366
333 h = (struct bdc_header *)(pktbuf->data);367 h = (struct brcmf_proto_bdc_header *)(pktbuf->data);
334 368
335 h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT);369 h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT);
336 if (PKTSUMNEEDED(pktbuf))370 if (PKTSUMNEEDED(pktbuf))
@@ -339,79 +373,74 @@ void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf) · 2 unmodified lines
339 h->priority = (pktbuf->priority & BDC_PRIORITY_MASK);373 h->priority = (pktbuf->priority & BDC_PRIORITY_MASK);
340 h->flags2 = 0;374 h->flags2 = 0;
341 h->rssi = 0;375 h->rssi = 0;
342#endif /* BDC */
343 BDC_SET_IF_IDX(h, ifidx);376 BDC_SET_IF_IDX(h, ifidx);
344}377}
345 378
346int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)379int brcmf_proto_hdrpull(struct brcmf_pub *drvr, int *ifidx,
380 struct sk_buff *pktbuf)
347{381{
348#ifdef BDC382 struct brcmf_proto_bdc_header *h;
349 struct bdc_header *h;
350#endif
351 383
352 DHD_TRACE(("%s: Enter\n", __func__));384 BRCMF_TRACE(("%s: Enter\n", __func__));
353 385
354#ifdef BDC
355 /* Pop BDC header used to convey priority for buses that don't */386 /* Pop BDC header used to convey priority for buses that don't */
356 387
357 if (pktbuf->len < BDC_HEADER_LEN) {388 if (pktbuf->len < BDC_HEADER_LEN) {
358 DHD_ERROR(("%s: rx data too short (%d < %d)\n", __func__,389 BRCMF_ERROR(("%s: rx data too short (%d < %d)\n", __func__,
359 pktbuf->len, BDC_HEADER_LEN));390 pktbuf->len, BDC_HEADER_LEN));
360 return -EBADE;391 return -EBADE;
361 }392 }
362 393
363 h = (struct bdc_header *)(pktbuf->data);394 h = (struct brcmf_proto_bdc_header *)(pktbuf->data);
364 395
365 *ifidx = BDC_GET_IF_IDX(h);396 *ifidx = BDC_GET_IF_IDX(h);
366 if (*ifidx >= DHD_MAX_IFS) {397 if (*ifidx >= BRCMF_MAX_IFS) {
367 DHD_ERROR(("%s: rx data ifnum out of range (%d)\n",398 BRCMF_ERROR(("%s: rx data ifnum out of range (%d)\n",
368 __func__, *ifidx));399 __func__, *ifidx));
369 return -EBADE;400 return -EBADE;
370 }401 }
371 402
372 if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) !=403 if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) !=
373 BDC_PROTO_VER) {404 BDC_PROTO_VER) {
374 DHD_ERROR(("%s: non-BDC packet received, flags 0x%x\n",405 BRCMF_ERROR(("%s: non-BDC packet received, flags 0x%x\n",
375 dhd_ifname(dhd, *ifidx), h->flags));406 brcmf_ifname(drvr, *ifidx), h->flags));
376 return -EBADE;407 return -EBADE;
377 }408 }
378 409
379 if (h->flags & BDC_FLAG_SUM_GOOD) {410 if (h->flags & BDC_FLAG_SUM_GOOD) {
380 DHD_INFO(("%s: BDC packet received with good rx-csum, "411 BRCMF_INFO(("%s: BDC packet received with good rx-csum, "
381 "flags 0x%x\n",412 "flags 0x%x\n",
382 dhd_ifname(dhd, *ifidx), h->flags));413 brcmf_ifname(drvr, *ifidx), h->flags));
383 PKTSETSUMGOOD(pktbuf, true);414 PKTSETSUMGOOD(pktbuf, true);
384 }415 }
385 416
386 pktbuf->priority = h->priority & BDC_PRIORITY_MASK;417 pktbuf->priority = h->priority & BDC_PRIORITY_MASK;
387 418
388 skb_pull(pktbuf, BDC_HEADER_LEN);419 skb_pull(pktbuf, BDC_HEADER_LEN);
389#endif /* BDC */
390 420
391 return 0;421 return 0;
392}422}
393 423
394int dhd_prot_attach(dhd_pub_t *dhd)424int brcmf_proto_attach(struct brcmf_pub *drvr)
395{425{
396 dhd_prot_t *cdc;426 struct brcmf_proto *cdc;
397 427
398 cdc = kzalloc(sizeof(dhd_prot_t), GFP_ATOMIC);428 cdc = kzalloc(sizeof(struct brcmf_proto), GFP_ATOMIC);
399 if (!cdc) {429 if (!cdc) {
400 DHD_ERROR(("%s: kmalloc failed\n", __func__));430 BRCMF_ERROR(("%s: kmalloc failed\n", __func__));
401 goto fail;431 goto fail;
402 }432 }
403 433
404 /* ensure that the msg buf directly follows the cdc msg struct */434 /* ensure that the msg buf directly follows the cdc msg struct */
405 if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) {435 if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) {
406 DHD_ERROR(("dhd_prot_t is not correctly defined\n"));436 BRCMF_ERROR(("struct brcmf_proto is not correctly defined\n"));
407 goto fail;437 goto fail;
408 }438 }
409 439
410 dhd->prot = cdc;440 drvr->prot = cdc;
411#ifdef BDC441 drvr->hdrlen += BDC_HEADER_LEN;
412 dhd->hdrlen += BDC_HEADER_LEN;442 drvr->maxctl = BRCMF_C_IOCTL_MAXLEN +
413#endif443 sizeof(struct brcmf_proto_cdc_ioctl) + ROUND_UP_MARGIN;
414 dhd->maxctl = WLC_IOCTL_MAXLEN + sizeof(cdc_ioctl_t) + ROUND_UP_MARGIN;
415 return 0;444 return 0;
416 445
417fail:446fail:
@@ -420,55 +449,54 @@ fail: · 2 unmodified lines
420}449}
421 450
422/* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */451/* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */
423void dhd_prot_detach(dhd_pub_t *dhd)452void brcmf_proto_detach(struct brcmf_pub *drvr)
424{453{
425 kfree(dhd->prot);454 kfree(drvr->prot);
426 dhd->prot = NULL;455 drvr->prot = NULL;
427}456}
428 457
429void dhd_prot_dstats(dhd_pub_t *dhd)458void brcmf_proto_dstats(struct brcmf_pub *drvr)
430{459{
431 /* No stats from dongle added yet, copy bus stats */460 /* No stats from dongle added yet, copy bus stats */
432 dhd->dstats.tx_packets = dhd->tx_packets;461 drvr->dstats.tx_packets = drvr->tx_packets;
433 dhd->dstats.tx_errors = dhd->tx_errors;462 drvr->dstats.tx_errors = drvr->tx_errors;
434 dhd->dstats.rx_packets = dhd->rx_packets;463 drvr->dstats.rx_packets = drvr->rx_packets;
435 dhd->dstats.rx_errors = dhd->rx_errors;464 drvr->dstats.rx_errors = drvr->rx_errors;
436 dhd->dstats.rx_dropped = dhd->rx_dropped;465 drvr->dstats.rx_dropped = drvr->rx_dropped;
437 dhd->dstats.multicast = dhd->rx_multicast;466 drvr->dstats.multicast = drvr->rx_multicast;
438 return;467 return;
439}468}
440 469
441int dhd_prot_init(dhd_pub_t *dhd)470int brcmf_proto_init(struct brcmf_pub *drvr)
442{471{
443 int ret = 0;472 int ret = 0;
444 char buf[128];473 char buf[128];
445 474
446 DHD_TRACE(("%s: Enter\n", __func__));475 BRCMF_TRACE(("%s: Enter\n", __func__));
447 476
448 dhd_os_proto_block(dhd);477 brcmf_os_proto_block(drvr);
449 478
450 /* Get the device MAC address */479 /* Get the device MAC address */
451 strcpy(buf, "cur_etheraddr");480 strcpy(buf, "cur_etheraddr");
452 ret = dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf));481 ret = brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR,
482 buf, sizeof(buf));
453 if (ret < 0) {483 if (ret < 0) {
454 dhd_os_proto_unblock(dhd);484 brcmf_os_proto_unblock(drvr);
455 return ret;485 return ret;
456 }486 }
457 memcpy(dhd->mac, buf, ETH_ALEN);487 memcpy(drvr->mac, buf, ETH_ALEN);
458 488
459 dhd_os_proto_unblock(dhd);489 brcmf_os_proto_unblock(drvr);
460 490
461#ifdef EMBEDDED_PLATFORM491 ret = brcmf_c_preinit_ioctls(drvr);
462 ret = dhd_preinit_ioctls(dhd);
463#endif /* EMBEDDED_PLATFORM */
464 492
465 /* Always assumes wl for now */493 /* Always assumes wl for now */
466 dhd->iswl = true;494 drvr->iswl = true;
467 495
468 return ret;496 return ret;
469}497}
470 498
471void dhd_prot_stop(dhd_pub_t *dhd)499void brcmf_proto_stop(struct brcmf_pub *drvr)
472{500{
473 /* Nothing to do for CDC */501 /* Nothing to do for CDC */
474}502}
drivers/staging/brcm80211/brcmfmac/dhd_common.c+477−1129
@@ -15,64 +15,41 @@ · 14 unmodified lines
15 */15 */
16#include <linux/kernel.h>16#include <linux/kernel.h>
17#include <linux/string.h>17#include <linux/string.h>
18#include <bcmdefs.h>18#include <linux/sched.h>
19#include <linux/netdevice.h>19#include <linux/netdevice.h>
20#include <bcmutils.h>20#include <asm/unaligned.h>
21#include <dngl_stats.h>21#include <defs.h>
22#include <dhd.h>22#include <brcmu_wifi.h>
23#include <dhd_bus.h>23#include <brcmu_utils.h>
24#include <dhd_proto.h>24#include "dhd.h"
25#include <dhd_dbg.h>25#include "dhd_bus.h"
26#include <msgtrace.h>26#include "dhd_proto.h"
27#include <wlioctl.h>27#include "dhd_dbg.h"
28 28
29int dhd_msg_level;29#define BRCM_OUI "\x00\x10\x18"
30char fw_path[MOD_PARAM_PATHLEN];30#define DOT11_OUI_LEN 3
31char nv_path[MOD_PARAM_PATHLEN];31#define BCMILCP_BCM_SUBTYPE_EVENT 1
32 32#define PKTFILTER_BUF_SIZE 2048
33/* Last connection success/failure status */33
34u32 dhd_conn_event;34int brcmf_msg_level;
35u32 dhd_conn_status;35
36u32 dhd_conn_reason;36#define MSGTRACE_VERSION 1
37 37
38extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,38#ifdef BCMDBG
39 uint len);39const char brcmf_version[] =
40extern void dhd_ind_scan_confirm(void *h, bool status);40"Dongle Host Driver, version " BRCMF_VERSION_STR "\nCompiled on " __DATE__
41extern int dhd_wl_ioctl(dhd_pub_t *dhd, uint cmd, char *buf, uint buflen);
42void dhd_iscan_lock(void);
43void dhd_iscan_unlock(void);
44
45/* Packet alignment for most efficient SDIO (can change based on platform) */
46#ifndef DHD_SDALIGN
47#define DHD_SDALIGN 32
48#endif
49#if !ISPOWEROF2(DHD_SDALIGN)
50#error DHD_SDALIGN is not a power of 2!
51#endif
52
53#define EPI_VERSION_STR "4.218.248.5"
54#ifdef DHD_DEBUG
55const char dhd_version[] =
56"Dongle Host Driver, version " EPI_VERSION_STR "\nCompiled on " __DATE__
57" at " __TIME__;41" at " __TIME__;
58#else42#else
59const char dhd_version[] = "Dongle Host Driver, version " EPI_VERSION_STR;43const char brcmf_version[] = "Dongle Host Driver, version " BRCMF_VERSION_STR;
60#endif44#endif
61 45
62void dhd_set_timer(void *bus, uint wdtick);
63
64/* IOVar table */46/* IOVar table */
65enum {47enum {
66 IOV_VERSION = 1,48 IOV_VERSION = 1,
67 IOV_MSGLEVEL,49 IOV_MSGLEVEL,
68 IOV_BCMERRORSTR,50 IOV_BCMERRORSTR,
69 IOV_BCMERROR,51 IOV_BCMERROR,
70 IOV_WDTICK,
71 IOV_DUMP,52 IOV_DUMP,
72#ifdef DHD_DEBUG
73 IOV_CONS,
74 IOV_DCONSOLE_POLL,
75#endif
76 IOV_CLEARCOUNTS,53 IOV_CLEARCOUNTS,
77 IOV_LOGDUMP,54 IOV_LOGDUMP,
78 IOV_LOGCAL,55 IOV_LOGCAL,
@@ -82,27 +59,19 @@ enum { · 3 unmodified lines
82 IOV_LAST59 IOV_LAST
83};60};
84 61
85const bcm_iovar_t dhd_iovars[] = {62const struct brcmu_iovar brcmf_iovars[] = {
86 {"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(dhd_version)}63 {"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(brcmf_version)}
87 ,64 ,
88#ifdef DHD_DEBUG65#ifdef BCMDBG
89 {"msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0}66 {"msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0}
90 ,67 ,
91#endif /* DHD_DEBUG */68#endif /* BCMDBG */
92 {"bcmerrorstr", IOV_BCMERRORSTR, 0, IOVT_BUFFER, BCME_STRLEN}69 {"bcmerrorstr", IOV_BCMERRORSTR, 0, IOVT_BUFFER, BCME_STRLEN}
93 ,70 ,
94 {"bcmerror", IOV_BCMERROR, 0, IOVT_INT8, 0}71 {"bcmerror", IOV_BCMERROR, 0, IOVT_INT8, 0}
95 ,72 ,
96 {"wdtick", IOV_WDTICK, 0, IOVT_UINT32, 0}73 {"dump", IOV_DUMP, 0, IOVT_BUFFER, BRCMF_IOCTL_MAXLEN}
97 ,
98 {"dump", IOV_DUMP, 0, IOVT_BUFFER, DHD_IOCTL_MAXLEN}
99 ,
100#ifdef DHD_DEBUG
101 {"dconpoll", IOV_DCONSOLE_POLL, 0, IOVT_UINT32, 0}
102 ,74 ,
103 {"cons", IOV_CONS, 0, IOVT_BUFFER, 0}
104 ,
105#endif
106 {"clearcounts", IOV_CLEARCOUNTS, 0, IOVT_VOID, 0}75 {"clearcounts", IOV_CLEARCOUNTS, 0, IOVT_VOID, 0}
107 ,76 ,
108 {"gpioob", IOV_GPIOOB, 0, IOVT_UINT32, 0}77 {"gpioob", IOV_GPIOOB, 0, IOVT_UINT32, 0}
@@ -112,7 +81,23 @@ const bcm_iovar_t dhd_iovars[] = { · 3 unmodified lines
112 {NULL, 0, 0, 0, 0}81 {NULL, 0, 0, 0, 0}
113};82};
114 83
115void dhd_common_init(void)84/* Message trace header */
85struct msgtrace_hdr {
86 u8 version;
87 u8 spare;
88 u16 len; /* Len of the trace */
89 u32 seqnum; /* Sequence number of message. Useful
90 * if the messsage has been lost
91 * because of DMA error or a bus reset
92 * (ex: SDIO Func2)
93 */
94 u32 discarded_bytes; /* Number of discarded bytes because of
95 trace overflow */
96 u32 discarded_printf; /* Number of discarded printf
97 because of trace overflow */
98} __packed;
99
100void brcmf_c_init(void)
116{101{
117 /* Init global variables at run-time, not as part of the declaration.102 /* Init global variables at run-time, not as part of the declaration.
118 * This is required to support init/de-init of the driver.103 * This is required to support init/de-init of the driver.
@@ -122,87 +107,77 @@ void dhd_common_init(void) · 3 unmodified lines
122 * first time that the driver is initialized vs subsequent107 * first time that the driver is initialized vs subsequent
123 * initializations.108 * initializations.
124 */109 */
125 dhd_msg_level = DHD_ERROR_VAL;110 brcmf_msg_level = BRCMF_ERROR_VAL;
126#ifdef CONFIG_BCM4329_FW_PATH
127 strncpy(fw_path, CONFIG_BCM4329_FW_PATH, MOD_PARAM_PATHLEN - 1);
128#else
129 fw_path[0] = '\0';
130#endif
131#ifdef CONFIG_BCM4329_NVRAM_PATH
132 strncpy(nv_path, CONFIG_BCM4329_NVRAM_PATH, MOD_PARAM_PATHLEN - 1);
133#else
134 nv_path[0] = '\0';
135#endif
136}111}
137 112
138static int dhd_dump(dhd_pub_t *dhdp, char *buf, int buflen)113static int brcmf_c_dump(struct brcmf_pub *drvr, char *buf, int buflen)
139{114{
140 struct bcmstrbuf b;115 struct brcmu_strbuf b;
141 struct bcmstrbuf *strbuf = &b;116 struct brcmu_strbuf *strbuf = &b;
142 117
143 bcm_binit(strbuf, buf, buflen);118 brcmu_binit(strbuf, buf, buflen);
144 119
145 /* Base DHD info */120 /* Base info */
146 bcm_bprintf(strbuf, "%s\n", dhd_version);121 brcmu_bprintf(strbuf, "%s\n", brcmf_version);
147 bcm_bprintf(strbuf, "\n");122 brcmu_bprintf(strbuf, "\n");
148 bcm_bprintf(strbuf, "pub.up %d pub.txoff %d pub.busstate %d\n",123 brcmu_bprintf(strbuf, "pub.up %d pub.txoff %d pub.busstate %d\n",
149 dhdp->up, dhdp->txoff, dhdp->busstate);124 drvr->up, drvr->txoff, drvr->busstate);
150 bcm_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n",125 brcmu_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n",
151 dhdp->hdrlen, dhdp->maxctl, dhdp->rxsz);126 drvr->hdrlen, drvr->maxctl, drvr->rxsz);
152 bcm_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %pM\n",127 brcmu_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %pM\n",
153 dhdp->iswl, dhdp->drv_version, &dhdp->mac);128 drvr->iswl, drvr->drv_version, &drvr->mac);
154 bcm_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", dhdp->bcmerror,129 brcmu_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", drvr->bcmerror,
155 dhdp->tickcnt);130 drvr->tickcnt);
156 131
157 bcm_bprintf(strbuf, "dongle stats:\n");132 brcmu_bprintf(strbuf, "dongle stats:\n");
158 bcm_bprintf(strbuf,133 brcmu_bprintf(strbuf,
159 "tx_packets %ld tx_bytes %ld tx_errors %ld tx_dropped %ld\n",134 "tx_packets %ld tx_bytes %ld tx_errors %ld tx_dropped %ld\n",
160 dhdp->dstats.tx_packets, dhdp->dstats.tx_bytes,135 drvr->dstats.tx_packets, drvr->dstats.tx_bytes,
161 dhdp->dstats.tx_errors, dhdp->dstats.tx_dropped);136 drvr->dstats.tx_errors, drvr->dstats.tx_dropped);
162 bcm_bprintf(strbuf,137 brcmu_bprintf(strbuf,
163 "rx_packets %ld rx_bytes %ld rx_errors %ld rx_dropped %ld\n",138 "rx_packets %ld rx_bytes %ld rx_errors %ld rx_dropped %ld\n",
164 dhdp->dstats.rx_packets, dhdp->dstats.rx_bytes,139 drvr->dstats.rx_packets, drvr->dstats.rx_bytes,
165 dhdp->dstats.rx_errors, dhdp->dstats.rx_dropped);140 drvr->dstats.rx_errors, drvr->dstats.rx_dropped);
166 bcm_bprintf(strbuf, "multicast %ld\n", dhdp->dstats.multicast);141 brcmu_bprintf(strbuf, "multicast %ld\n", drvr->dstats.multicast);
167 142
168 bcm_bprintf(strbuf, "bus stats:\n");143 brcmu_bprintf(strbuf, "bus stats:\n");
169 bcm_bprintf(strbuf, "tx_packets %ld tx_multicast %ld tx_errors %ld\n",144 brcmu_bprintf(strbuf, "tx_packets %ld tx_multicast %ld tx_errors %ld\n",
170 dhdp->tx_packets, dhdp->tx_multicast, dhdp->tx_errors);145 drvr->tx_packets, drvr->tx_multicast, drvr->tx_errors);
171 bcm_bprintf(strbuf, "tx_ctlpkts %ld tx_ctlerrs %ld\n",146 brcmu_bprintf(strbuf, "tx_ctlpkts %ld tx_ctlerrs %ld\n",
172 dhdp->tx_ctlpkts, dhdp->tx_ctlerrs);147 drvr->tx_ctlpkts, drvr->tx_ctlerrs);
173 bcm_bprintf(strbuf, "rx_packets %ld rx_multicast %ld rx_errors %ld\n",148 brcmu_bprintf(strbuf, "rx_packets %ld rx_multicast %ld rx_errors %ld\n",
174 dhdp->rx_packets, dhdp->rx_multicast, dhdp->rx_errors);149 drvr->rx_packets, drvr->rx_multicast, drvr->rx_errors);
175 bcm_bprintf(strbuf,150 brcmu_bprintf(strbuf,
176 "rx_ctlpkts %ld rx_ctlerrs %ld rx_dropped %ld rx_flushed %ld\n",151 "rx_ctlpkts %ld rx_ctlerrs %ld rx_dropped %ld rx_flushed %ld\n",
177 dhdp->rx_ctlpkts, dhdp->rx_ctlerrs, dhdp->rx_dropped,152 drvr->rx_ctlpkts, drvr->rx_ctlerrs, drvr->rx_dropped,
178 dhdp->rx_flushed);153 drvr->rx_flushed);
179 bcm_bprintf(strbuf,154 brcmu_bprintf(strbuf,
180 "rx_readahead_cnt %ld tx_realloc %ld fc_packets %ld\n",155 "rx_readahead_cnt %ld tx_realloc %ld fc_packets %ld\n",
181 dhdp->rx_readahead_cnt, dhdp->tx_realloc, dhdp->fc_packets);156 drvr->rx_readahead_cnt, drvr->tx_realloc, drvr->fc_packets);
182 bcm_bprintf(strbuf, "wd_dpc_sched %ld\n", dhdp->wd_dpc_sched);157 brcmu_bprintf(strbuf, "wd_dpc_sched %ld\n", drvr->wd_dpc_sched);
183 bcm_bprintf(strbuf, "\n");158 brcmu_bprintf(strbuf, "\n");
184 159
185 /* Add any prot info */160 /* Add any prot info */
186 dhd_prot_dump(dhdp, strbuf);161 brcmf_proto_dump(drvr, strbuf);
187 bcm_bprintf(strbuf, "\n");162 brcmu_bprintf(strbuf, "\n");
188 163
189 /* Add any bus info */164 /* Add any bus info */
190 dhd_bus_dump(dhdp, strbuf);165 brcmf_sdbrcm_bus_dump(drvr, strbuf);
191 166
192 return !strbuf->size ? -EOVERFLOW : 0;167 return !strbuf->size ? -EOVERFLOW : 0;
193}168}
194 169
195static int170static int
196dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid,171brcmf_c_doiovar(struct brcmf_pub *drvr, const struct brcmu_iovar *vi,
197 const char *name, void *params, int plen, void *arg, int len,172 u32 actionid, const char *name, void *params, int plen,
198 int val_size)173 void *arg, int len, int val_size)
199{174{
200 int bcmerror = 0;175 int bcmerror = 0;
201 s32 int_val = 0;176 s32 int_val = 0;
202 177
203 DHD_TRACE(("%s: Enter\n", __func__));178 BRCMF_TRACE(("%s: Enter\n", __func__));
204 179
205 bcmerror = bcm_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid));180 bcmerror = brcmu_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid));
206 if (bcmerror != 0)181 if (bcmerror != 0)
207 goto exit;182 goto exit;
208 183
@@ -212,16 +187,16 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines
212 switch (actionid) {187 switch (actionid) {
213 case IOV_GVAL(IOV_VERSION):188 case IOV_GVAL(IOV_VERSION):
214 /* Need to have checked buffer length */189 /* Need to have checked buffer length */
215 strncpy((char *)arg, dhd_version, len);190 strncpy((char *)arg, brcmf_version, len);
216 break;191 break;
217 192
218 case IOV_GVAL(IOV_MSGLEVEL):193 case IOV_GVAL(IOV_MSGLEVEL):
219 int_val = (s32) dhd_msg_level;194 int_val = (s32) brcmf_msg_level;
220 memcpy(arg, &int_val, val_size);195 memcpy(arg, &int_val, val_size);
221 break;196 break;
222 197
223 case IOV_SVAL(IOV_MSGLEVEL):198 case IOV_SVAL(IOV_MSGLEVEL):
224 dhd_msg_level = int_val;199 brcmf_msg_level = int_val;
225 break;200 break;
226 201
227 case IOV_GVAL(IOV_BCMERRORSTR):202 case IOV_GVAL(IOV_BCMERRORSTR):
@@ -231,58 +206,29 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines
231 break;206 break;
232 207
233 case IOV_GVAL(IOV_BCMERROR):208 case IOV_GVAL(IOV_BCMERROR):
234 int_val = (s32) dhd_pub->bcmerror;209 int_val = (s32) drvr->bcmerror;
235 memcpy(arg, &int_val, val_size);210 memcpy(arg, &int_val, val_size);
236 break;211 break;
237 212
238 case IOV_GVAL(IOV_WDTICK):
239 int_val = (s32) dhd_watchdog_ms;
240 memcpy(arg, &int_val, val_size);
241 break;
242
243 case IOV_SVAL(IOV_WDTICK):
244 if (!dhd_pub->up) {
245 bcmerror = -ENOLINK;
246 break;
247 }
248 dhd_os_wd_timer(dhd_pub, (uint) int_val);
249 break;
250
251 case IOV_GVAL(IOV_DUMP):213 case IOV_GVAL(IOV_DUMP):
252 bcmerror = dhd_dump(dhd_pub, arg, len);214 bcmerror = brcmf_c_dump(drvr, arg, len);
253 break;
254
255#ifdef DHD_DEBUG
256 case IOV_GVAL(IOV_DCONSOLE_POLL):
257 int_val = (s32) dhd_console_ms;
258 memcpy(arg, &int_val, val_size);
259 break;
260
261 case IOV_SVAL(IOV_DCONSOLE_POLL):
262 dhd_console_ms = (uint) int_val;
263 break;
264
265 case IOV_SVAL(IOV_CONS):
266 if (len > 0)
267 bcmerror = dhd_bus_console_in(dhd_pub, arg, len - 1);
268 break;215 break;
269#endif
270 216
271 case IOV_SVAL(IOV_CLEARCOUNTS):217 case IOV_SVAL(IOV_CLEARCOUNTS):
272 dhd_pub->tx_packets = dhd_pub->rx_packets = 0;218 drvr->tx_packets = drvr->rx_packets = 0;
273 dhd_pub->tx_errors = dhd_pub->rx_errors = 0;219 drvr->tx_errors = drvr->rx_errors = 0;
274 dhd_pub->tx_ctlpkts = dhd_pub->rx_ctlpkts = 0;220 drvr->tx_ctlpkts = drvr->rx_ctlpkts = 0;
275 dhd_pub->tx_ctlerrs = dhd_pub->rx_ctlerrs = 0;221 drvr->tx_ctlerrs = drvr->rx_ctlerrs = 0;
276 dhd_pub->rx_dropped = 0;222 drvr->rx_dropped = 0;
277 dhd_pub->rx_readahead_cnt = 0;223 drvr->rx_readahead_cnt = 0;
278 dhd_pub->tx_realloc = 0;224 drvr->tx_realloc = 0;
279 dhd_pub->wd_dpc_sched = 0;225 drvr->wd_dpc_sched = 0;
280 memset(&dhd_pub->dstats, 0, sizeof(dhd_pub->dstats));226 memset(&drvr->dstats, 0, sizeof(drvr->dstats));
281 dhd_bus_clearcounts(dhd_pub);227 brcmf_bus_clearcounts(drvr);
282 break;228 break;
283 229
284 case IOV_GVAL(IOV_IOCTLTIMEOUT):{230 case IOV_GVAL(IOV_IOCTLTIMEOUT):{
285 int_val = (s32) dhd_os_get_ioctl_resp_timeout();231 int_val = (s32) brcmf_os_get_ioctl_resp_timeout();
286 memcpy(arg, &int_val, sizeof(int_val));232 memcpy(arg, &int_val, sizeof(int_val));
287 break;233 break;
288 }234 }
@@ -291,7 +237,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
291 if (int_val <= 0)237 if (int_val <= 0)
292 bcmerror = -EINVAL;238 bcmerror = -EINVAL;
293 else239 else
294 dhd_os_set_ioctl_resp_timeout((unsigned int)240 brcmf_os_set_ioctl_resp_timeout((unsigned int)
295 int_val);241 int_val);
296 break;242 break;
297 }243 }
@@ -305,8 +251,8 @@ exit: · 7 unmodified lines
305 return bcmerror;251 return bcmerror;
306}252}
307 253
308bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt,254bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q,
309 int prec)255 struct sk_buff *pkt, int prec)
310{256{
311 struct sk_buff *p;257 struct sk_buff *p;
312 int eprec = -1; /* precedence to evict from */258 int eprec = -1; /* precedence to evict from */
@@ -316,7 +262,7 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, · 3 unmodified lines
316 * exceeding total queue length262 * exceeding total queue length
317 */263 */
318 if (!pktq_pfull(q, prec) && !pktq_full(q)) {264 if (!pktq_pfull(q, prec) && !pktq_full(q)) {
319 bcm_pktq_penq(q, prec, pkt);265 brcmu_pktq_penq(q, prec, pkt);
320 return true;266 return true;
321 }267 }
322 268
@@ -324,8 +270,7 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, · 1 unmodified line
324 if (pktq_pfull(q, prec))270 if (pktq_pfull(q, prec))
325 eprec = prec;271 eprec = prec;
326 else if (pktq_full(q)) {272 else if (pktq_full(q)) {
327 p = bcm_pktq_peek_tail(q, &eprec);273 p = brcmu_pktq_peek_tail(q, &eprec);
328 ASSERT(p);
329 if (eprec > prec)274 if (eprec > prec)
330 return false;275 return false;
331 }276 }
@@ -333,60 +278,58 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, · 1 unmodified line
333 /* Evict if needed */278 /* Evict if needed */
334 if (eprec >= 0) {279 if (eprec >= 0) {
335 /* Detect queueing to unconfigured precedence */280 /* Detect queueing to unconfigured precedence */
336 ASSERT(!pktq_pempty(q, eprec));281 discard_oldest = AC_BITMAP_TST(drvr->wme_dp, eprec);
337 discard_oldest = AC_BITMAP_TST(dhdp->wme_dp, eprec);
338 if (eprec == prec && !discard_oldest)282 if (eprec == prec && !discard_oldest)
339 return false; /* refuse newer (incoming) packet */283 return false; /* refuse newer (incoming) packet */
340 /* Evict packet according to discard policy */284 /* Evict packet according to discard policy */
341 p = discard_oldest ? bcm_pktq_pdeq(q, eprec) :285 p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) :
342 bcm_pktq_pdeq_tail(q, eprec);286 brcmu_pktq_pdeq_tail(q, eprec);
343 if (p == NULL) {287 if (p == NULL) {
344 DHD_ERROR(("%s: bcm_pktq_penq() failed, oldest %d.",288 BRCMF_ERROR(("%s: brcmu_pktq_penq() failed, oldest %d.",
345 __func__, discard_oldest));289 __func__, discard_oldest));
346 ASSERT(p);
347 }290 }
348 291 brcmu_pkt_buf_free_skb(p);
349 bcm_pkt_buf_free_skb(p);
350 }292 }
351 293
352 /* Enqueue */294 /* Enqueue */
353 p = bcm_pktq_penq(q, prec, pkt);295 p = brcmu_pktq_penq(q, prec, pkt);
354 if (p == NULL) {296 if (p == NULL) {
355 DHD_ERROR(("%s: bcm_pktq_penq() failed.", __func__));297 BRCMF_ERROR(("%s: brcmu_pktq_penq() failed.", __func__));
356 ASSERT(p);
357 }298 }
358 299
359 return true;300 return p != NULL;
360}301}
361 302
362static int303static int
363dhd_iovar_op(dhd_pub_t *dhd_pub, const char *name,304brcmf_c_iovar_op(struct brcmf_pub *drvr, const char *name,
364 void *params, int plen, void *arg, int len, bool set)305 void *params, int plen, void *arg, int len, bool set)
365{306{
366 int bcmerror = 0;307 int bcmerror = 0;
367 int val_size;308 int val_size;
368 const bcm_iovar_t *vi = NULL;309 const struct brcmu_iovar *vi = NULL;
369 u32 actionid;310 u32 actionid;
370 311
371 DHD_TRACE(("%s: Enter\n", __func__));312 BRCMF_TRACE(("%s: Enter\n", __func__));
372 313
373 ASSERT(name);314 if (name == NULL || len <= 0)
374 ASSERT(len >= 0);315 return -EINVAL;
375 316
376 /* Get MUST have return space */317 /* Set does not take qualifiers */
377 ASSERT(set || (arg && len));318 if (set && (params || plen))
319 return -EINVAL;
378 320
379 /* Set does NOT take qualifiers */321 /* Get must have return space;*/
380 ASSERT(!set || (!params && !plen));322 if (!set && !(arg && len))
323 return -EINVAL;
381 324
382 vi = bcm_iovar_lookup(dhd_iovars, name);325 vi = brcmu_iovar_lookup(brcmf_iovars, name);
383 if (vi == NULL) {326 if (vi == NULL) {
384 bcmerror = -ENOTSUPP;327 bcmerror = -ENOTSUPP;
385 goto exit;328 goto exit;
386 }329 }
387 330
388 DHD_CTL(("%s: %s %s, len %d plen %d\n", __func__,331 BRCMF_CTL(("%s: %s %s, len %d plen %d\n", __func__,
389 name, (set ? "set" : "get"), len, plen));332 name, (set ? "set" : "get"), len, plen));
390 333
391 /* set up 'params' pointer in case this is a set command so that334 /* set up 'params' pointer in case this is a set command so that
392 * the convenience int and bool code can be common to set and get335 * the convenience int and bool code can be common to set and get
@@ -406,39 +349,40 @@ dhd_iovar_op(dhd_pub_t *dhd_pub, const char *name, · 13 unmodified lines
406 349
407 actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);350 actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
408 bcmerror =351 bcmerror =
409 dhd_doiovar(dhd_pub, vi, actionid, name, params, plen, arg, len,352 brcmf_c_doiovar(drvr, vi, actionid, name, params, plen, arg, len,
410 val_size);353 val_size);
411 354
412exit:355exit:
413 return bcmerror;356 return bcmerror;
414}357}
415 358
416int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen)359int brcmf_c_ioctl(struct brcmf_pub *drvr, struct brcmf_c_ioctl *ioc, void *buf,
360 uint buflen)
417{361{
418 int bcmerror = 0;362 int bcmerror = 0;
419 363
420 DHD_TRACE(("%s: Enter\n", __func__));364 BRCMF_TRACE(("%s: Enter\n", __func__));
421 365
422 if (!buf)366 if (!buf)
423 return -EINVAL;367 return -EINVAL;
424 368
425 switch (ioc->cmd) {369 switch (ioc->cmd) {
426 case DHD_GET_MAGIC:370 case BRCMF_GET_MAGIC:
427 if (buflen < sizeof(int))371 if (buflen < sizeof(int))
428 bcmerror = -EOVERFLOW;372 bcmerror = -EOVERFLOW;
429 else373 else
430 *(int *)buf = DHD_IOCTL_MAGIC;374 *(int *)buf = BRCMF_IOCTL_MAGIC;
431 break;375 break;
432 376
433 case DHD_GET_VERSION:377 case BRCMF_GET_VERSION:
434 if (buflen < sizeof(int))378 if (buflen < sizeof(int))
435 bcmerror = -EOVERFLOW;379 bcmerror = -EOVERFLOW;
436 else380 else
437 *(int *)buf = DHD_IOCTL_VERSION;381 *(int *)buf = BRCMF_IOCTL_VERSION;
438 break;382 break;
439 383
440 case DHD_GET_VAR:384 case BRCMF_GET_VAR:
441 case DHD_SET_VAR:{385 case BRCMF_SET_VAR:{
442 char *arg;386 char *arg;
443 uint arglen;387 uint arglen;
444 388
@@ -456,38 +400,25 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) · 11 unmodified lines
456 arg++, arglen--;400 arg++, arglen--;
457 401
458 /* call with the appropriate arguments */402 /* call with the appropriate arguments */
459 if (ioc->cmd == DHD_GET_VAR)403 if (ioc->cmd == BRCMF_GET_VAR)
460 bcmerror =404 bcmerror = brcmf_c_iovar_op(drvr, buf, arg,
461 dhd_iovar_op(dhd_pub, buf, arg, arglen, buf,405 arglen, buf, buflen, IOV_GET);
462 buflen, IOV_GET);
463 else406 else
464 bcmerror =407 bcmerror =
465 dhd_iovar_op(dhd_pub, buf, NULL, 0, arg,408 brcmf_c_iovar_op(drvr, buf, NULL, 0, arg,
466 arglen, IOV_SET);409 arglen, IOV_SET);
467 if (bcmerror != -ENOTSUPP)
468 break;
469
470 /* not in generic table, try protocol module */
471 if (ioc->cmd == DHD_GET_VAR)
472 bcmerror = dhd_prot_iovar_op(dhd_pub, buf, arg,
473 arglen, buf,
474 buflen, IOV_GET);
475 else
476 bcmerror = dhd_prot_iovar_op(dhd_pub, buf,
477 NULL, 0, arg,
478 arglen, IOV_SET);
479 if (bcmerror != -ENOTSUPP)410 if (bcmerror != -ENOTSUPP)
480 break;411 break;
481 412
482 /* if still not found, try bus module */413 /* if still not found, try bus module */
483 if (ioc->cmd == DHD_GET_VAR)414 if (ioc->cmd == BRCMF_GET_VAR)
484 bcmerror = dhd_bus_iovar_op(dhd_pub, buf,415 bcmerror = brcmf_sdbrcm_bus_iovar_op(drvr,
485 arg, arglen, buf,416 buf, arg, arglen, buf, buflen,
486 buflen, IOV_GET);417 IOV_GET);
487 else418 else
488 bcmerror = dhd_bus_iovar_op(dhd_pub, buf,419 bcmerror = brcmf_sdbrcm_bus_iovar_op(drvr,
489 NULL, 0, arg,420 buf, NULL, 0, arg, arglen,
490 arglen, IOV_SET);421 IOV_SET);
491 422
492 break;423 break;
493 }424 }
@@ -500,7 +431,8 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) · 6 unmodified lines
500}431}
501 432
502#ifdef SHOW_EVENTS433#ifdef SHOW_EVENTS
503static void wl_show_host_event(wl_event_msg_t *event, void *event_data)434static void
435brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
504{436{
505 uint i, status, reason;437 uint i, status, reason;
506 bool group = false, flush_txq = false, link = false;438 bool group = false, flush_txq = false, link = false;
@@ -512,62 +444,62 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 5 unmodified lines
512 char *event_name;444 char *event_name;
513 } event_names[] = {445 } event_names[] = {
514 {446 {
515 WLC_E_SET_SSID, "SET_SSID"}, {447 BRCMF_E_SET_SSID, "SET_SSID"}, {
516 WLC_E_JOIN, "JOIN"}, {448 BRCMF_E_JOIN, "JOIN"}, {
517 WLC_E_START, "START"}, {449 BRCMF_E_START, "START"}, {
518 WLC_E_AUTH, "AUTH"}, {450 BRCMF_E_AUTH, "AUTH"}, {
519 WLC_E_AUTH_IND, "AUTH_IND"}, {451 BRCMF_E_AUTH_IND, "AUTH_IND"}, {
520 WLC_E_DEAUTH, "DEAUTH"}, {452 BRCMF_E_DEAUTH, "DEAUTH"}, {
521 WLC_E_DEAUTH_IND, "DEAUTH_IND"}, {453 BRCMF_E_DEAUTH_IND, "DEAUTH_IND"}, {
522 WLC_E_ASSOC, "ASSOC"}, {454 BRCMF_E_ASSOC, "ASSOC"}, {
523 WLC_E_ASSOC_IND, "ASSOC_IND"}, {455 BRCMF_E_ASSOC_IND, "ASSOC_IND"}, {
524 WLC_E_REASSOC, "REASSOC"}, {456 BRCMF_E_REASSOC, "REASSOC"}, {
525 WLC_E_REASSOC_IND, "REASSOC_IND"}, {457 BRCMF_E_REASSOC_IND, "REASSOC_IND"}, {
526 WLC_E_DISASSOC, "DISASSOC"}, {458 BRCMF_E_DISASSOC, "DISASSOC"}, {
527 WLC_E_DISASSOC_IND, "DISASSOC_IND"}, {459 BRCMF_E_DISASSOC_IND, "DISASSOC_IND"}, {
528 WLC_E_QUIET_START, "START_QUIET"}, {460 BRCMF_E_QUIET_START, "START_QUIET"}, {
529 WLC_E_QUIET_END, "END_QUIET"}, {461 BRCMF_E_QUIET_END, "END_QUIET"}, {
530 WLC_E_BEACON_RX, "BEACON_RX"}, {462 BRCMF_E_BEACON_RX, "BEACON_RX"}, {
531 WLC_E_LINK, "LINK"}, {463 BRCMF_E_LINK, "LINK"}, {
532 WLC_E_MIC_ERROR, "MIC_ERROR"}, {464 BRCMF_E_MIC_ERROR, "MIC_ERROR"}, {
533 WLC_E_NDIS_LINK, "NDIS_LINK"}, {465 BRCMF_E_NDIS_LINK, "NDIS_LINK"}, {
534 WLC_E_ROAM, "ROAM"}, {466 BRCMF_E_ROAM, "ROAM"}, {
535 WLC_E_TXFAIL, "TXFAIL"}, {467 BRCMF_E_TXFAIL, "TXFAIL"}, {
536 WLC_E_PMKID_CACHE, "PMKID_CACHE"}, {468 BRCMF_E_PMKID_CACHE, "PMKID_CACHE"}, {
537 WLC_E_RETROGRADE_TSF, "RETROGRADE_TSF"}, {469 BRCMF_E_RETROGRADE_TSF, "RETROGRADE_TSF"}, {
538 WLC_E_PRUNE, "PRUNE"}, {470 BRCMF_E_PRUNE, "PRUNE"}, {
539 WLC_E_AUTOAUTH, "AUTOAUTH"}, {471 BRCMF_E_AUTOAUTH, "AUTOAUTH"}, {
540 WLC_E_EAPOL_MSG, "EAPOL_MSG"}, {472 BRCMF_E_EAPOL_MSG, "EAPOL_MSG"}, {
541 WLC_E_SCAN_COMPLETE, "SCAN_COMPLETE"}, {473 BRCMF_E_SCAN_COMPLETE, "SCAN_COMPLETE"}, {
542 WLC_E_ADDTS_IND, "ADDTS_IND"}, {474 BRCMF_E_ADDTS_IND, "ADDTS_IND"}, {
543 WLC_E_DELTS_IND, "DELTS_IND"}, {475 BRCMF_E_DELTS_IND, "DELTS_IND"}, {
544 WLC_E_BCNSENT_IND, "BCNSENT_IND"}, {476 BRCMF_E_BCNSENT_IND, "BCNSENT_IND"}, {
545 WLC_E_BCNRX_MSG, "BCNRX_MSG"}, {477 BRCMF_E_BCNRX_MSG, "BCNRX_MSG"}, {
546 WLC_E_BCNLOST_MSG, "BCNLOST_MSG"}, {478 BRCMF_E_BCNLOST_MSG, "BCNLOST_MSG"}, {
547 WLC_E_ROAM_PREP, "ROAM_PREP"}, {479 BRCMF_E_ROAM_PREP, "ROAM_PREP"}, {
548 WLC_E_PFN_NET_FOUND, "PNO_NET_FOUND"}, {480 BRCMF_E_PFN_NET_FOUND, "PNO_NET_FOUND"}, {
549 WLC_E_PFN_NET_LOST, "PNO_NET_LOST"}, {481 BRCMF_E_PFN_NET_LOST, "PNO_NET_LOST"}, {
550 WLC_E_RESET_COMPLETE, "RESET_COMPLETE"}, {482 BRCMF_E_RESET_COMPLETE, "RESET_COMPLETE"}, {
551 WLC_E_JOIN_START, "JOIN_START"}, {483 BRCMF_E_JOIN_START, "JOIN_START"}, {
552 WLC_E_ROAM_START, "ROAM_START"}, {484 BRCMF_E_ROAM_START, "ROAM_START"}, {
553 WLC_E_ASSOC_START, "ASSOC_START"}, {485 BRCMF_E_ASSOC_START, "ASSOC_START"}, {
554 WLC_E_IBSS_ASSOC, "IBSS_ASSOC"}, {486 BRCMF_E_IBSS_ASSOC, "IBSS_ASSOC"}, {
555 WLC_E_RADIO, "RADIO"}, {487 BRCMF_E_RADIO, "RADIO"}, {
556 WLC_E_PSM_WATCHDOG, "PSM_WATCHDOG"}, {488 BRCMF_E_PSM_WATCHDOG, "PSM_WATCHDOG"}, {
557 WLC_E_PROBREQ_MSG, "PROBREQ_MSG"}, {489 BRCMF_E_PROBREQ_MSG, "PROBREQ_MSG"}, {
558 WLC_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND"}, {490 BRCMF_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND"}, {
559 WLC_E_PSK_SUP, "PSK_SUP"}, {491 BRCMF_E_PSK_SUP, "PSK_SUP"}, {
560 WLC_E_COUNTRY_CODE_CHANGED, "COUNTRY_CODE_CHANGED"}, {492 BRCMF_E_COUNTRY_CODE_CHANGED, "COUNTRY_CODE_CHANGED"}, {
561 WLC_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME"}, {493 BRCMF_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME"}, {
562 WLC_E_ICV_ERROR, "ICV_ERROR"}, {494 BRCMF_E_ICV_ERROR, "ICV_ERROR"}, {
563 WLC_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR"}, {495 BRCMF_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR"}, {
564 WLC_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR"}, {496 BRCMF_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR"}, {
565 WLC_E_TRACE, "TRACE"}, {497 BRCMF_E_TRACE, "TRACE"}, {
566 WLC_E_ACTION_FRAME, "ACTION FRAME"}, {498 BRCMF_E_ACTION_FRAME, "ACTION FRAME"}, {
567 WLC_E_ACTION_FRAME_COMPLETE, "ACTION FRAME TX COMPLETE"}, {499 BRCMF_E_ACTION_FRAME_COMPLETE, "ACTION FRAME TX COMPLETE"}, {
568 WLC_E_IF, "IF"}, {500 BRCMF_E_IF, "IF"}, {
569 WLC_E_RSSI, "RSSI"}, {501 BRCMF_E_RSSI, "RSSI"}, {
570 WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"}502 BRCMF_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"}
571 };503 };
572 uint event_type, flags, auth_type, datalen;504 uint event_type, flags, auth_type, datalen;
573 event_type = be32_to_cpu(event->event_type);505 event_type = be32_to_cpu(event->event_type);
@@ -585,54 +517,55 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 11 unmodified lines
585 event_name = event_names[i].event_name;517 event_name = event_names[i].event_name;
586 }518 }
587 519
588 DHD_EVENT(("EVENT: %s, event ID = %d\n", event_name, event_type));520 BRCMF_EVENT(("EVENT: %s, event ID = %d\n", event_name, event_type));
589 DHD_EVENT(("flags 0x%04x, status %d, reason %d, auth_type %d MAC %s\n",521 BRCMF_EVENT(("flags 0x%04x, status %d, reason %d, auth_type %d"
590 flags, status, reason, auth_type, eabuf));522 " MAC %s\n", flags, status, reason, auth_type, eabuf));
591 523
592 if (flags & WLC_EVENT_MSG_LINK)524 if (flags & BRCMF_EVENT_MSG_LINK)
593 link = true;525 link = true;
594 if (flags & WLC_EVENT_MSG_GROUP)526 if (flags & BRCMF_EVENT_MSG_GROUP)
595 group = true;527 group = true;
596 if (flags & WLC_EVENT_MSG_FLUSHTXQ)528 if (flags & BRCMF_EVENT_MSG_FLUSHTXQ)
597 flush_txq = true;529 flush_txq = true;
598 530
599 switch (event_type) {531 switch (event_type) {
600 case WLC_E_START:532 case BRCMF_E_START:
601 case WLC_E_DEAUTH:533 case BRCMF_E_DEAUTH:
602 case WLC_E_DISASSOC:534 case BRCMF_E_DISASSOC:
603 DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));535 BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));
604 break;536 break;
605 537
606 case WLC_E_ASSOC_IND:538 case BRCMF_E_ASSOC_IND:
607 case WLC_E_REASSOC_IND:539 case BRCMF_E_REASSOC_IND:
608 DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));540 BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));
609 break;541 break;
610 542
611 case WLC_E_ASSOC:543 case BRCMF_E_ASSOC:
612 case WLC_E_REASSOC:544 case BRCMF_E_REASSOC:
613 if (status == WLC_E_STATUS_SUCCESS) {545 if (status == BRCMF_E_STATUS_SUCCESS) {
614 DHD_EVENT(("MACEVENT: %s, MAC %s, SUCCESS\n",546 BRCMF_EVENT(("MACEVENT: %s, MAC %s, SUCCESS\n",
615 event_name, eabuf));547 event_name, eabuf));
616 } else if (status == WLC_E_STATUS_TIMEOUT) {548 } else if (status == BRCMF_E_STATUS_TIMEOUT) {
617 DHD_EVENT(("MACEVENT: %s, MAC %s, TIMEOUT\n",549 BRCMF_EVENT(("MACEVENT: %s, MAC %s, TIMEOUT\n",
618 event_name, eabuf));550 event_name, eabuf));
619 } else if (status == WLC_E_STATUS_FAIL) {551 } else if (status == BRCMF_E_STATUS_FAIL) {
620 DHD_EVENT(("MACEVENT: %s, MAC %s, FAILURE, reason %d\n",552 BRCMF_EVENT(("MACEVENT: %s, MAC %s, FAILURE,"
621 event_name, eabuf, (int)reason));553 " reason %d\n", event_name, eabuf,
554 (int)reason));
622 } else {555 } else {
623 DHD_EVENT(("MACEVENT: %s, MAC %s, unexpected status "556 BRCMF_EVENT(("MACEVENT: %s, MAC %s, unexpected status "
624 "%d\n", event_name, eabuf, (int)status));557 "%d\n", event_name, eabuf, (int)status));
625 }558 }
626 break;559 break;
627 560
628 case WLC_E_DEAUTH_IND:561 case BRCMF_E_DEAUTH_IND:
629 case WLC_E_DISASSOC_IND:562 case BRCMF_E_DISASSOC_IND:
630 DHD_EVENT(("MACEVENT: %s, MAC %s, reason %d\n", event_name,563 BRCMF_EVENT(("MACEVENT: %s, MAC %s, reason %d\n", event_name,
631 eabuf, (int)reason));564 eabuf, (int)reason));
632 break;565 break;
633 566
634 case WLC_E_AUTH:567 case BRCMF_E_AUTH:
635 case WLC_E_AUTH_IND:568 case BRCMF_E_AUTH_IND:
636 if (auth_type == WLAN_AUTH_OPEN)569 if (auth_type == WLAN_AUTH_OPEN)
637 auth_str = "Open System";570 auth_str = "Open System";
638 else if (auth_type == WLAN_AUTH_SHARED_KEY)571 else if (auth_type == WLAN_AUTH_SHARED_KEY)
@@ -641,102 +574,102 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 2 unmodified lines
641 sprintf(err_msg, "AUTH unknown: %d", (int)auth_type);574 sprintf(err_msg, "AUTH unknown: %d", (int)auth_type);
642 auth_str = err_msg;575 auth_str = err_msg;
643 }576 }
644 if (event_type == WLC_E_AUTH_IND) {577 if (event_type == BRCMF_E_AUTH_IND) {
645 DHD_EVENT(("MACEVENT: %s, MAC %s, %s\n", event_name,578 BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s\n", event_name,
646 eabuf, auth_str));579 eabuf, auth_str));
647 } else if (status == WLC_E_STATUS_SUCCESS) {580 } else if (status == BRCMF_E_STATUS_SUCCESS) {
648 DHD_EVENT(("MACEVENT: %s, MAC %s, %s, SUCCESS\n",581 BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, SUCCESS\n",
649 event_name, eabuf, auth_str));582 event_name, eabuf, auth_str));
650 } else if (status == WLC_E_STATUS_TIMEOUT) {583 } else if (status == BRCMF_E_STATUS_TIMEOUT) {
651 DHD_EVENT(("MACEVENT: %s, MAC %s, %s, TIMEOUT\n",584 BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, TIMEOUT\n",
652 event_name, eabuf, auth_str));585 event_name, eabuf, auth_str));
653 } else if (status == WLC_E_STATUS_FAIL) {586 } else if (status == BRCMF_E_STATUS_FAIL) {
654 DHD_EVENT(("MACEVENT: %s, MAC %s, %s, FAILURE, "587 BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, FAILURE, "
655 "reason %d\n",588 "reason %d\n",
656 event_name, eabuf, auth_str, (int)reason));589 event_name, eabuf, auth_str, (int)reason));
657 }590 }
658 591
659 break;592 break;
660 593
661 case WLC_E_JOIN:594 case BRCMF_E_JOIN:
662 case WLC_E_ROAM:595 case BRCMF_E_ROAM:
663 case WLC_E_SET_SSID:596 case BRCMF_E_SET_SSID:
664 if (status == WLC_E_STATUS_SUCCESS) {597 if (status == BRCMF_E_STATUS_SUCCESS) {
665 DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name,598 BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name,
666 eabuf));599 eabuf));
667 } else if (status == WLC_E_STATUS_FAIL) {600 } else if (status == BRCMF_E_STATUS_FAIL) {
668 DHD_EVENT(("MACEVENT: %s, failed\n", event_name));601 BRCMF_EVENT(("MACEVENT: %s, failed\n", event_name));
669 } else if (status == WLC_E_STATUS_NO_NETWORKS) {602 } else if (status == BRCMF_E_STATUS_NO_NETWORKS) {
670 DHD_EVENT(("MACEVENT: %s, no networks found\n",603 BRCMF_EVENT(("MACEVENT: %s, no networks found\n",
671 event_name));604 event_name));
672 } else {605 } else {
673 DHD_EVENT(("MACEVENT: %s, unexpected status %d\n",606 BRCMF_EVENT(("MACEVENT: %s, unexpected status %d\n",
674 event_name, (int)status));607 event_name, (int)status));
675 }608 }
676 break;609 break;
677 610
678 case WLC_E_BEACON_RX:611 case BRCMF_E_BEACON_RX:
679 if (status == WLC_E_STATUS_SUCCESS) {612 if (status == BRCMF_E_STATUS_SUCCESS) {
680 DHD_EVENT(("MACEVENT: %s, SUCCESS\n", event_name));613 BRCMF_EVENT(("MACEVENT: %s, SUCCESS\n", event_name));
681 } else if (status == WLC_E_STATUS_FAIL) {614 } else if (status == BRCMF_E_STATUS_FAIL) {
682 DHD_EVENT(("MACEVENT: %s, FAIL\n", event_name));615 BRCMF_EVENT(("MACEVENT: %s, FAIL\n", event_name));
683 } else {616 } else {
684 DHD_EVENT(("MACEVENT: %s, status %d\n", event_name,617 BRCMF_EVENT(("MACEVENT: %s, status %d\n", event_name,
685 status));618 status));
686 }619 }
687 break;620 break;
688 621
689 case WLC_E_LINK:622 case BRCMF_E_LINK:
690 DHD_EVENT(("MACEVENT: %s %s\n", event_name,623 BRCMF_EVENT(("MACEVENT: %s %s\n", event_name,
691 link ? "UP" : "DOWN"));624 link ? "UP" : "DOWN"));
692 break;625 break;
693 626
694 case WLC_E_MIC_ERROR:627 case BRCMF_E_MIC_ERROR:
695 DHD_EVENT(("MACEVENT: %s, MAC %s, Group %d, Flush %d\n",628 BRCMF_EVENT(("MACEVENT: %s, MAC %s, Group %d, Flush %d\n",
696 event_name, eabuf, group, flush_txq));629 event_name, eabuf, group, flush_txq));
697 break;630 break;
698 631
699 case WLC_E_ICV_ERROR:632 case BRCMF_E_ICV_ERROR:
700 case WLC_E_UNICAST_DECODE_ERROR:633 case BRCMF_E_UNICAST_DECODE_ERROR:
701 case WLC_E_MULTICAST_DECODE_ERROR:634 case BRCMF_E_MULTICAST_DECODE_ERROR:
702 DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));635 BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));
703 break;636 break;
704 637
705 case WLC_E_TXFAIL:638 case BRCMF_E_TXFAIL:
706 DHD_EVENT(("MACEVENT: %s, RA %s\n", event_name, eabuf));639 BRCMF_EVENT(("MACEVENT: %s, RA %s\n", event_name, eabuf));
707 break;640 break;
708 641
709 case WLC_E_SCAN_COMPLETE:642 case BRCMF_E_SCAN_COMPLETE:
710 case WLC_E_PMKID_CACHE:643 case BRCMF_E_PMKID_CACHE:
711 DHD_EVENT(("MACEVENT: %s\n", event_name));644 BRCMF_EVENT(("MACEVENT: %s\n", event_name));
712 break;645 break;
713 646
714 case WLC_E_PFN_NET_FOUND:647 case BRCMF_E_PFN_NET_FOUND:
715 case WLC_E_PFN_NET_LOST:648 case BRCMF_E_PFN_NET_LOST:
716 case WLC_E_PFN_SCAN_COMPLETE:649 case BRCMF_E_PFN_SCAN_COMPLETE:
717 DHD_EVENT(("PNOEVENT: %s\n", event_name));650 BRCMF_EVENT(("PNOEVENT: %s\n", event_name));
718 break;651 break;
719 652
720 case WLC_E_PSK_SUP:653 case BRCMF_E_PSK_SUP:
721 case WLC_E_PRUNE:654 case BRCMF_E_PRUNE:
722 DHD_EVENT(("MACEVENT: %s, status %d, reason %d\n",655 BRCMF_EVENT(("MACEVENT: %s, status %d, reason %d\n",
723 event_name, (int)status, (int)reason));656 event_name, (int)status, (int)reason));
724 break;657 break;
725 658
726 case WLC_E_TRACE:659 case BRCMF_E_TRACE:
727 {660 {
728 static u32 seqnum_prev;661 static u32 seqnum_prev;
729 msgtrace_hdr_t hdr;662 struct msgtrace_hdr hdr;
730 u32 nblost;663 u32 nblost;
731 char *s, *p;664 char *s, *p;
732 665
733 buf = (unsigned char *) event_data;666 buf = (unsigned char *) event_data;
734 memcpy(&hdr, buf, MSGTRACE_HDRLEN);667 memcpy(&hdr, buf, sizeof(struct msgtrace_hdr));
735 668
736 if (hdr.version != MSGTRACE_VERSION) {669 if (hdr.version != MSGTRACE_VERSION) {
737 DHD_ERROR(670 BRCMF_ERROR(
738 ("\nMACEVENT: %s [unsupported version --> "671 ("\nMACEVENT: %s [unsupported version --> "
739 "dhd version:%d dongle version:%d]\n",672 "brcmf version:%d dongle version:%d]\n",
740 event_name, MSGTRACE_VERSION, hdr.version)673 event_name, MSGTRACE_VERSION, hdr.version)
741 );674 );
742 /* Reset datalen to avoid display below */675 /* Reset datalen to avoid display below */
@@ -745,11 +678,12 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 2 unmodified lines
745 }678 }
746 679
747 /* There are 2 bytes available at the end of data */680 /* There are 2 bytes available at the end of data */
748 buf[MSGTRACE_HDRLEN + be16_to_cpu(hdr.len)] = '\0';681 *(buf + sizeof(struct msgtrace_hdr)
682 + be16_to_cpu(hdr.len)) = '\0';
749 683
750 if (be32_to_cpu(hdr.discarded_bytes)684 if (be32_to_cpu(hdr.discarded_bytes)
751 || be32_to_cpu(hdr.discarded_printf)) {685 || be32_to_cpu(hdr.discarded_printf)) {
752 DHD_ERROR(686 BRCMF_ERROR(
753 ("\nWLC_E_TRACE: [Discarded traces in dongle -->"687 ("\nWLC_E_TRACE: [Discarded traces in dongle -->"
754 "discarded_bytes %d discarded_printf %d]\n",688 "discarded_bytes %d discarded_printf %d]\n",
755 be32_to_cpu(hdr.discarded_bytes),689 be32_to_cpu(hdr.discarded_bytes),
@@ -758,7 +692,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 2 unmodified lines
758 692
759 nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1;693 nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1;
760 if (nblost > 0) {694 if (nblost > 0) {
761 DHD_ERROR(695 BRCMF_ERROR(
762 ("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n",696 ("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n",
763 be32_to_cpu(hdr.seqnum), nblost));697 be32_to_cpu(hdr.seqnum), nblost));
764 }698 }
@@ -768,7 +702,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 3 unmodified lines
768 * avoid display big702 * avoid display big
769 * printf (issue with Linux printk )703 * printf (issue with Linux printk )
770 */704 */
771 p = (char *)&buf[MSGTRACE_HDRLEN];705 p = (char *)&buf[sizeof(struct msgtrace_hdr)];
772 while ((s = strstr(p, "\n")) != NULL) {706 while ((s = strstr(p, "\n")) != NULL) {
773 *s = '\0';707 *s = '\0';
774 printk(KERN_DEBUG"%s\n", p);708 printk(KERN_DEBUG"%s\n", p);
@@ -781,49 +715,49 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 6 unmodified lines
781 }715 }
782 break;716 break;
783 717
784 case WLC_E_RSSI:718 case BRCMF_E_RSSI:
785 DHD_EVENT(("MACEVENT: %s %d\n", event_name,719 BRCMF_EVENT(("MACEVENT: %s %d\n", event_name,
786 be32_to_cpu(*((int *)event_data))));720 be32_to_cpu(*((int *)event_data))));
787 break;721 break;
788 722
789 default:723 default:
790 DHD_EVENT(("MACEVENT: %s %d, MAC %s, status %d, reason %d, "724 BRCMF_EVENT(("MACEVENT: %s %d, MAC %s, status %d, reason %d, "
791 "auth %d\n", event_name, event_type, eabuf,725 "auth %d\n", event_name, event_type, eabuf,
792 (int)status, (int)reason, (int)auth_type));726 (int)status, (int)reason, (int)auth_type));
793 break;727 break;
794 }728 }
795 729
796 /* show any appended data */730 /* show any appended data */
797 if (datalen) {731 if (datalen) {
798 buf = (unsigned char *) event_data;732 buf = (unsigned char *) event_data;
799 DHD_EVENT((" data (%d) : ", datalen));733 BRCMF_EVENT((" data (%d) : ", datalen));
800 for (i = 0; i < datalen; i++)734 for (i = 0; i < datalen; i++)
801 DHD_EVENT((" 0x%02x ", *buf++));735 BRCMF_EVENT((" 0x%02x ", *buf++));
802 DHD_EVENT(("\n"));736 BRCMF_EVENT(("\n"));
803 }737 }
804}738}
805#endif /* SHOW_EVENTS */739#endif /* SHOW_EVENTS */
806 740
807int741int
808wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata,742brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
809 wl_event_msg_t *event, void **data_ptr)743 struct brcmf_event_msg *event, void **data_ptr)
810{744{
811 /* check whether packet is a BRCM event pkt */745 /* check whether packet is a BRCM event pkt */
812 bcm_event_t *pvt_data = (bcm_event_t *) pktdata;746 struct brcmf_event *pvt_data = (struct brcmf_event *) pktdata;
813 char *event_data;747 char *event_data;
814 u32 type, status;748 u32 type, status;
815 u16 flags;749 u16 flags;
816 int evlen;750 int evlen;
817 751
818 if (memcmp(BRCM_OUI, &pvt_data->bcm_hdr.oui[0], DOT11_OUI_LEN)) {752 if (memcmp(BRCM_OUI, &pvt_data->hdr.oui[0], DOT11_OUI_LEN)) {
819 DHD_ERROR(("%s: mismatched OUI, bailing\n", __func__));753 BRCMF_ERROR(("%s: mismatched OUI, bailing\n", __func__));
820 return -EBADE;754 return -EBADE;
821 }755 }
822 756
823 /* BRCM event pkt may be unaligned - use xxx_ua to load user_subtype. */757 /* BRCM event pkt may be unaligned - use xxx_ua to load user_subtype. */
824 if (get_unaligned_be16(&pvt_data->bcm_hdr.usr_subtype) !=758 if (get_unaligned_be16(&pvt_data->hdr.usr_subtype) !=
825 BCMILCP_BCM_SUBTYPE_EVENT) {759 BCMILCP_BCM_SUBTYPE_EVENT) {
826 DHD_ERROR(("%s: mismatched subtype, bailing\n", __func__));760 BRCMF_ERROR(("%s: mismatched subtype, bailing\n", __func__));
827 return -EBADE;761 return -EBADE;
828 }762 }
829 763
@@ -831,93 +765,87 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata, · 1 unmodified line
831 event_data = *data_ptr;765 event_data = *data_ptr;
832 766
833 /* memcpy since BRCM event pkt may be unaligned. */767 /* memcpy since BRCM event pkt may be unaligned. */
834 memcpy(event, &pvt_data->event, sizeof(wl_event_msg_t));768 memcpy(event, &pvt_data->msg, sizeof(struct brcmf_event_msg));
835 769
836 type = get_unaligned_be32(&event->event_type);770 type = get_unaligned_be32(&event->event_type);
837 flags = get_unaligned_be16(&event->flags);771 flags = get_unaligned_be16(&event->flags);
838 status = get_unaligned_be32(&event->status);772 status = get_unaligned_be32(&event->status);
839 evlen = get_unaligned_be32(&event->datalen) + sizeof(bcm_event_t);773 evlen = get_unaligned_be32(&event->datalen) +
774 sizeof(struct brcmf_event);
840 775
841 switch (type) {776 switch (type) {
842 case WLC_E_IF:777 case BRCMF_E_IF:
843 {778 {
844 dhd_if_event_t *ifevent = (dhd_if_event_t *) event_data;779 struct brcmf_if_event *ifevent =
845 DHD_TRACE(("%s: if event\n", __func__));780 (struct brcmf_if_event *) event_data;
781 BRCMF_TRACE(("%s: if event\n", __func__));
846 782
847 if (ifevent->ifidx > 0 &&783 if (ifevent->ifidx > 0 &&
848 ifevent->ifidx < DHD_MAX_IFS) {784 ifevent->ifidx < BRCMF_MAX_IFS) {
849 if (ifevent->action == WLC_E_IF_ADD)785 if (ifevent->action == BRCMF_E_IF_ADD)
850 dhd_add_if(dhd, ifevent->ifidx,786 brcmf_add_if(drvr_priv, ifevent->ifidx,
851 NULL, event->ifname,787 NULL, event->ifname,
852 pvt_data->eth.h_dest,788 pvt_data->eth.h_dest,
853 ifevent->flags,789 ifevent->flags,
854 ifevent->bssidx);790 ifevent->bssidx);
855 else791 else
856 dhd_del_if(dhd, ifevent->ifidx);792 brcmf_del_if(drvr_priv, ifevent->ifidx);
857 } else {793 } else {
858 DHD_ERROR(("%s: Invalid ifidx %d for %s\n",794 BRCMF_ERROR(("%s: Invalid ifidx %d for %s\n",
859 __func__, ifevent->ifidx,795 __func__, ifevent->ifidx,
860 event->ifname));796 event->ifname));
861 }797 }
862 }798 }
863 /* send up the if event: btamp user needs it */799 /* send up the if event: btamp user needs it */
864 *ifidx = dhd_ifname2idx(dhd, event->ifname);800 *ifidx = brcmf_ifname2idx(drvr_priv, event->ifname);
865 /* push up to external supp/auth */
866 dhd_event(dhd, (char *)pvt_data, evlen, *ifidx);
867 break;801 break;
868 802
869#ifdef P2P
870 case WLC_E_NDIS_LINK:
871 break;
872#endif
873 /* fall through */
874 /* These are what external supplicant/authenticator wants */803 /* These are what external supplicant/authenticator wants */
875 case WLC_E_LINK:804 case BRCMF_E_LINK:
876 case WLC_E_ASSOC_IND:805 case BRCMF_E_ASSOC_IND:
877 case WLC_E_REASSOC_IND:806 case BRCMF_E_REASSOC_IND:
878 case WLC_E_DISASSOC_IND:807 case BRCMF_E_DISASSOC_IND:
879 case WLC_E_MIC_ERROR:808 case BRCMF_E_MIC_ERROR:
880 default:809 default:
881 /* Fall through: this should get _everything_ */810 /* Fall through: this should get _everything_ */
882 811
883 *ifidx = dhd_ifname2idx(dhd, event->ifname);812 *ifidx = brcmf_ifname2idx(drvr_priv, event->ifname);
884 /* push up to external supp/auth */813 BRCMF_TRACE(("%s: MAC event %d, flags %x, status %x\n",
885 dhd_event(dhd, (char *)pvt_data, evlen, *ifidx);814 __func__, type, flags, status));
886 DHD_TRACE(("%s: MAC event %d, flags %x, status %x\n",
887 __func__, type, flags, status));
888 815
889 /* put it back to WLC_E_NDIS_LINK */816 /* put it back to BRCMF_E_NDIS_LINK */
890 if (type == WLC_E_NDIS_LINK) {817 if (type == BRCMF_E_NDIS_LINK) {
891 u32 temp;818 u32 temp;
892 819
893 temp = get_unaligned_be32(&event->event_type);820 temp = get_unaligned_be32(&event->event_type);
894 DHD_TRACE(("Converted to WLC_E_LINK type %d\n", temp));821 BRCMF_TRACE(("Converted to WLC_E_LINK type %d\n",
822 temp));
895 823
896 temp = be32_to_cpu(WLC_E_NDIS_LINK);824 temp = be32_to_cpu(BRCMF_E_NDIS_LINK);
897 memcpy((void *)(&pvt_data->event.event_type), &temp,825 memcpy((void *)(&pvt_data->msg.event_type), &temp,
898 sizeof(pvt_data->event.event_type));826 sizeof(pvt_data->msg.event_type));
899 }827 }
900 break;828 break;
901 }829 }
902 830
903#ifdef SHOW_EVENTS831#ifdef SHOW_EVENTS
904 wl_show_host_event(event, event_data);832 brcmf_c_show_host_event(event, event_data);
905#endif /* SHOW_EVENTS */833#endif /* SHOW_EVENTS */
906 834
907 return 0;835 return 0;
908}836}
909 837
910/* Convert user's input in hex pattern to byte-size mask */838/* Convert user's input in hex pattern to byte-size mask */
911static int wl_pattern_atoh(char *src, char *dst)839static int brcmf_c_pattern_atoh(char *src, char *dst)
912{840{
913 int i;841 int i;
914 if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) {842 if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) {
915 DHD_ERROR(("Mask invalid format. Needs to start with 0x\n"));843 BRCMF_ERROR(("Mask invalid format. Needs to start with 0x\n"));
916 return -1;844 return -1;
917 }845 }
918 src = src + 2; /* Skip past 0x */846 src = src + 2; /* Skip past 0x */
919 if (strlen(src) % 2 != 0) {847 if (strlen(src) % 2 != 0) {
920 DHD_ERROR(("Mask invalid format. Length must be even.\n"));848 BRCMF_ERROR(("Mask invalid format. Length must be even.\n"));
921 return -1;849 return -1;
922 }850 }
923 for (i = 0; *src != '\0'; i++) {851 for (i = 0; *src != '\0'; i++) {
@@ -931,7 +859,7 @@ static int wl_pattern_atoh(char *src, char *dst) · 7 unmodified lines
931}859}
932 860
933void861void
934dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable,862brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable,
935 int master_mode)863 int master_mode)
936{864{
937 char *argv[8];865 char *argv[8];
@@ -942,12 +870,12 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 4 unmodified lines
942 char *arg_save = 0, *arg_org = 0;870 char *arg_save = 0, *arg_org = 0;
943 int rc;871 int rc;
944 char buf[128];872 char buf[128];
945 wl_pkt_filter_enable_t enable_parm;873 struct brcmf_pkt_filter_enable enable_parm;
946 wl_pkt_filter_enable_t *pkt_filterp;874 struct brcmf_pkt_filter_enable *pkt_filterp;
947 875
948 arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);876 arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);
949 if (!arg_save) {877 if (!arg_save) {
950 DHD_ERROR(("%s: kmalloc failed\n", __func__));878 BRCMF_ERROR(("%s: kmalloc failed\n", __func__));
951 goto fail;879 goto fail;
952 }880 }
953 arg_org = arg_save;881 arg_org = arg_save;
@@ -957,7 +885,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 3 unmodified lines
957 885
958 i = 0;886 i = 0;
959 if (NULL == argv[i]) {887 if (NULL == argv[i]) {
960 DHD_ERROR(("No args provided\n"));888 BRCMF_ERROR(("No args provided\n"));
961 goto fail;889 goto fail;
962 }890 }
963 891
@@ -967,7 +895,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 3 unmodified lines
967 buf[str_len] = '\0';895 buf[str_len] = '\0';
968 buf_len = str_len + 1;896 buf_len = str_len + 1;
969 897
970 pkt_filterp = (wl_pkt_filter_enable_t *) (buf + str_len + 1);898 pkt_filterp = (struct brcmf_pkt_filter_enable *) (buf + str_len + 1);
971 899
972 /* Parse packet filter id. */900 /* Parse packet filter id. */
973 enable_parm.id = simple_strtoul(argv[i], NULL, 0);901 enable_parm.id = simple_strtoul(argv[i], NULL, 0);
@@ -979,33 +907,34 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 5 unmodified lines
979 memcpy((char *)pkt_filterp, &enable_parm, sizeof(enable_parm));907 memcpy((char *)pkt_filterp, &enable_parm, sizeof(enable_parm));
980 908
981 /* Enable/disable the specified filter. */909 /* Enable/disable the specified filter. */
982 rc = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, buf_len);910 rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len);
983 rc = rc >= 0 ? 0 : rc;911 rc = rc >= 0 ? 0 : rc;
984 if (rc)912 if (rc)
985 DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",913 BRCMF_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",
986 __func__, arg, rc));914 __func__, arg, rc));
987 else915 else
988 DHD_TRACE(("%s: successfully added pktfilter %s\n",916 BRCMF_TRACE(("%s: successfully added pktfilter %s\n",
989 __func__, arg));917 __func__, arg));
990 918
991 /* Contorl the master mode */919 /* Contorl the master mode */
992 bcm_mkiovar("pkt_filter_mode", (char *)&master_mode, 4, buf,920 brcmu_mkiovar("pkt_filter_mode", (char *)&master_mode, 4, buf,
993 sizeof(buf));921 sizeof(buf));
994 rc = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, sizeof(buf));922 rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf,
923 sizeof(buf));
995 rc = rc >= 0 ? 0 : rc;924 rc = rc >= 0 ? 0 : rc;
996 if (rc)925 if (rc)
997 DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",926 BRCMF_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",
998 __func__, arg, rc));927 __func__, arg, rc));
999 928
1000fail:929fail:
1001 kfree(arg_org);930 kfree(arg_org);
1002}931}
1003 932
1004void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)933void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg)
1005{934{
1006 const char *str;935 const char *str;
1007 wl_pkt_filter_t pkt_filter;936 struct brcmf_pkt_filter pkt_filter;
1008 wl_pkt_filter_t *pkt_filterp;937 struct brcmf_pkt_filter *pkt_filterp;
1009 int buf_len;938 int buf_len;
1010 int str_len;939 int str_len;
1011 int rc;940 int rc;
@@ -1014,29 +943,22 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 2 unmodified lines
1014 char *argv[8], *buf = 0;943 char *argv[8], *buf = 0;
1015 int i = 0;944 int i = 0;
1016 char *arg_save = 0, *arg_org = 0;945 char *arg_save = 0, *arg_org = 0;
1017#define BUF_SIZE 2048
1018 946
1019 arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);947 arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);
1020 if (!arg_save) {948 if (!arg_save) {
1021 DHD_ERROR(("%s: kmalloc failed\n", __func__));949 BRCMF_ERROR(("%s: kmalloc failed\n", __func__));
1022 goto fail;950 goto fail;
1023 }951 }
1024 952
1025 arg_org = arg_save;953 arg_org = arg_save;
1026 954
1027 buf = kmalloc(BUF_SIZE, GFP_ATOMIC);955 buf = kmalloc(PKTFILTER_BUF_SIZE, GFP_ATOMIC);
1028 if (!buf) {956 if (!buf) {
1029 DHD_ERROR(("%s: kmalloc failed\n", __func__));957 BRCMF_ERROR(("%s: kmalloc failed\n", __func__));
1030 goto fail;958 goto fail;
1031 }959 }
1032 960
1033 memcpy(arg_save, arg, strlen(arg) + 1);961 strcpy(arg_save, arg);
1034
1035 if (strlen(arg) > BUF_SIZE) {
1036 DHD_ERROR(("Not enough buffer %d < %d\n", (int)strlen(arg),
1037 (int)sizeof(buf)));
1038 goto fail;
1039 }
1040 962
1041 argv[i] = strsep(&arg_save, " ");963 argv[i] = strsep(&arg_save, " ");
1042 while (argv[i++])964 while (argv[i++])
@@ -1044,23 +966,22 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line
1044 966
1045 i = 0;967 i = 0;
1046 if (NULL == argv[i]) {968 if (NULL == argv[i]) {
1047 DHD_ERROR(("No args provided\n"));969 BRCMF_ERROR(("No args provided\n"));
1048 goto fail;970 goto fail;
1049 }971 }
1050 972
1051 str = "pkt_filter_add";973 str = "pkt_filter_add";
974 strcpy(buf, str);
1052 str_len = strlen(str);975 str_len = strlen(str);
1053 strncpy(buf, str, str_len);
1054 buf[str_len] = '\0';
1055 buf_len = str_len + 1;976 buf_len = str_len + 1;
1056 977
1057 pkt_filterp = (wl_pkt_filter_t *) (buf + str_len + 1);978 pkt_filterp = (struct brcmf_pkt_filter *) (buf + str_len + 1);
1058 979
1059 /* Parse packet filter id. */980 /* Parse packet filter id. */
1060 pkt_filter.id = simple_strtoul(argv[i], NULL, 0);981 pkt_filter.id = simple_strtoul(argv[i], NULL, 0);
1061 982
1062 if (NULL == argv[++i]) {983 if (NULL == argv[++i]) {
1063 DHD_ERROR(("Polarity not provided\n"));984 BRCMF_ERROR(("Polarity not provided\n"));
1064 goto fail;985 goto fail;
1065 }986 }
1066 987
@@ -1068,7 +989,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line
1068 pkt_filter.negate_match = simple_strtoul(argv[i], NULL, 0);989 pkt_filter.negate_match = simple_strtoul(argv[i], NULL, 0);
1069 990
1070 if (NULL == argv[++i]) {991 if (NULL == argv[++i]) {
1071 DHD_ERROR(("Filter type not provided\n"));992 BRCMF_ERROR(("Filter type not provided\n"));
1072 goto fail;993 goto fail;
1073 }994 }
1074 995
@@ -1076,7 +997,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line
1076 pkt_filter.type = simple_strtoul(argv[i], NULL, 0);997 pkt_filter.type = simple_strtoul(argv[i], NULL, 0);
1077 998
1078 if (NULL == argv[++i]) {999 if (NULL == argv[++i]) {
1079 DHD_ERROR(("Offset not provided\n"));1000 BRCMF_ERROR(("Offset not provided\n"));
1080 goto fail;1001 goto fail;
1081 }1002 }
1082 1003
@@ -1084,34 +1005,34 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line
1084 pkt_filter.u.pattern.offset = simple_strtoul(argv[i], NULL, 0);1005 pkt_filter.u.pattern.offset = simple_strtoul(argv[i], NULL, 0);
1085 1006
1086 if (NULL == argv[++i]) {1007 if (NULL == argv[++i]) {
1087 DHD_ERROR(("Bitmask not provided\n"));1008 BRCMF_ERROR(("Bitmask not provided\n"));
1088 goto fail;1009 goto fail;
1089 }1010 }
1090 1011
1091 /* Parse pattern filter mask. */1012 /* Parse pattern filter mask. */
1092 mask_size =1013 mask_size =
1093 wl_pattern_atoh1014 brcmf_c_pattern_atoh
1094 (argv[i], (char *)pkt_filterp->u.pattern.mask_and_pattern);1015 (argv[i], (char *)pkt_filterp->u.pattern.mask_and_pattern);
1095 1016
1096 if (NULL == argv[++i]) {1017 if (NULL == argv[++i]) {
1097 DHD_ERROR(("Pattern not provided\n"));1018 BRCMF_ERROR(("Pattern not provided\n"));
1098 goto fail;1019 goto fail;
1099 }1020 }
1100 1021
1101 /* Parse pattern filter pattern. */1022 /* Parse pattern filter pattern. */
1102 pattern_size =1023 pattern_size =
1103 wl_pattern_atoh(argv[i],1024 brcmf_c_pattern_atoh(argv[i],
1104 (char *)&pkt_filterp->u.pattern.1025 (char *)&pkt_filterp->u.pattern.
1105 mask_and_pattern[mask_size]);1026 mask_and_pattern[mask_size]);
1106 1027
1107 if (mask_size != pattern_size) {1028 if (mask_size != pattern_size) {
1108 DHD_ERROR(("Mask and pattern not the same size\n"));1029 BRCMF_ERROR(("Mask and pattern not the same size\n"));
1109 goto fail;1030 goto fail;
1110 }1031 }
1111 1032
1112 pkt_filter.u.pattern.size_bytes = mask_size;1033 pkt_filter.u.pattern.size_bytes = mask_size;
1113 buf_len += WL_PKT_FILTER_FIXED_LEN;1034 buf_len += BRCMF_PKT_FILTER_FIXED_LEN;
1114 buf_len += (WL_PKT_FILTER_PATTERN_FIXED_LEN + 2 * mask_size);1035 buf_len += (BRCMF_PKT_FILTER_PATTERN_FIXED_LEN + 2 * mask_size);
1115 1036
1116 /* Keep-alive attributes are set in local1037 /* Keep-alive attributes are set in local
1117 * variable (keep_alive_pkt), and1038 * variable (keep_alive_pkt), and
@@ -1120,17 +1041,17 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 2 unmodified lines
1120 */1041 */
1121 memcpy((char *)pkt_filterp,1042 memcpy((char *)pkt_filterp,
1122 &pkt_filter,1043 &pkt_filter,
1123 WL_PKT_FILTER_FIXED_LEN + WL_PKT_FILTER_PATTERN_FIXED_LEN);1044 BRCMF_PKT_FILTER_FIXED_LEN + BRCMF_PKT_FILTER_PATTERN_FIXED_LEN);
1124 1045
1125 rc = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, buf_len);1046 rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len);
1126 rc = rc >= 0 ? 0 : rc;1047 rc = rc >= 0 ? 0 : rc;
1127 1048
1128 if (rc)1049 if (rc)
1129 DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",1050 BRCMF_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",
1130 __func__, arg, rc));1051 __func__, arg, rc));
1131 else1052 else
1132 DHD_TRACE(("%s: successfully added pktfilter %s\n",1053 BRCMF_TRACE(("%s: successfully added pktfilter %s\n",
1133 __func__, arg));1054 __func__, arg));
1134 1055
1135fail:1056fail:
1136 kfree(arg_org);1057 kfree(arg_org);
@@ -1138,711 +1059,138 @@ fail: · 1 unmodified line
1138 kfree(buf);1059 kfree(buf);
1139}1060}
1140 1061
1141void dhd_arp_offload_set(dhd_pub_t *dhd, int arp_mode)1062void brcmf_c_arp_offload_set(struct brcmf_pub *drvr, int arp_mode)
1142{1063{
1143 char iovbuf[32];1064 char iovbuf[32];
1144 int retcode;1065 int retcode;
1145 1066
1146 bcm_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf));1067 brcmu_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf));
1147 retcode = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));1068 retcode = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR,
1069 iovbuf, sizeof(iovbuf));
1148 retcode = retcode >= 0 ? 0 : retcode;1070 retcode = retcode >= 0 ? 0 : retcode;
1149 if (retcode)1071 if (retcode)
1150 DHD_TRACE(("%s: failed to set ARP offload mode to 0x%x, "1072 BRCMF_TRACE(("%s: failed to set ARP offload mode to 0x%x, "
1151 "retcode = %d\n", __func__, arp_mode, retcode));1073 "retcode = %d\n", __func__, arp_mode, retcode));
1152 else1074 else
1153 DHD_TRACE(("%s: successfully set ARP offload mode to 0x%x\n",1075 BRCMF_TRACE(("%s: successfully set ARP offload mode to 0x%x\n",
1154 __func__, arp_mode));1076 __func__, arp_mode));
1155}1077}
1156 1078
1157void dhd_arp_offload_enable(dhd_pub_t *dhd, int arp_enable)1079void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable)
1158{1080{
1159 char iovbuf[32];1081 char iovbuf[32];
1160 int retcode;1082 int retcode;
1161 1083
1162 bcm_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf));1084 brcmu_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf));
1163 retcode = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));1085 retcode = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR,
1086 iovbuf, sizeof(iovbuf));
1164 retcode = retcode >= 0 ? 0 : retcode;1087 retcode = retcode >= 0 ? 0 : retcode;
1165 if (retcode)1088 if (retcode)
1166 DHD_TRACE(("%s: failed to enabe ARP offload to %d, "1089 BRCMF_TRACE(("%s: failed to enabe ARP offload to %d, "
1167 "retcode = %d\n", __func__, arp_enable, retcode));1090 "retcode = %d\n", __func__, arp_enable, retcode));
1168 else1091 else
1169 DHD_TRACE(("%s: successfully enabed ARP offload to %d\n",1092 BRCMF_TRACE(("%s: successfully enabed ARP offload to %d\n",
1170 __func__, arp_enable));1093 __func__, arp_enable));
1171}1094}
1172 1095
1173int dhd_preinit_ioctls(dhd_pub_t *dhd)1096int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
1174{1097{
1175 char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for1098 char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for
1176 "event_msgs" + '\0' + bitvec */1099 "event_msgs" + '\0' + bitvec */
1177 uint up = 0;1100 uint up = 0;
1178 char buf[128], *ptr;1101 char buf[128], *ptr;
1179 uint power_mode = PM_FAST;1102 uint power_mode = PM_FAST;
1180 u32 dongle_align = DHD_SDALIGN;1103 u32 dongle_align = BRCMF_SDALIGN;
1181 u32 glom = 0;1104 u32 glom = 0;
1182 uint bcn_timeout = 3;1105 uint bcn_timeout = 3;
1183 int scan_assoc_time = 40;1106 int scan_assoc_time = 40;
1184 int scan_unassoc_time = 40;1107 int scan_unassoc_time = 40;
1185#ifdef GET_CUSTOM_MAC_ENABLE1108 int i;
1186 int ret = 0;1109
1187 u8 ea_addr[ETH_ALEN];1110 brcmf_os_proto_block(drvr);
1188#endif /* GET_CUSTOM_MAC_ENABLE */
1189
1190 dhd_os_proto_block(dhd);
1191
1192#ifdef GET_CUSTOM_MAC_ENABLE
1193 /* Read MAC address from external customer place
1194 ** NOTE that default mac address has to be present in
1195 ** otp or nvram file to bring up
1196 ** firmware but unique per board mac address maybe provided by
1197 ** customer code
1198 */
1199 ret = dhd_custom_get_mac_address(ea_addr);
1200 if (!ret) {
1201 bcm_mkiovar("cur_etheraddr", (void *)ea_addr, ETH_ALEN,
1202 buf, sizeof(buf));
1203 ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, sizeof(buf));
1204 if (ret < 0) {
1205 DHD_ERROR(("%s: can't set MAC address , error=%d\n",
1206 __func__, ret));
1207 } else
1208 memcpy(dhd->mac.octet, (void *)&ea_addr,
1209 ETH_ALEN);
1210 }
1211#endif /* GET_CUSTOM_MAC_ENABLE */
1212 1111
1213 /* Set Country code */1112 /* Set Country code */
1214 if (dhd->country_code[0] != 0) {1113 if (drvr->country_code[0] != 0) {
1215 if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_COUNTRY,1114 if (brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_COUNTRY,
1216 dhd->country_code,1115 drvr->country_code,
1217 sizeof(dhd->country_code)) < 0) {1116 sizeof(drvr->country_code)) < 0) {
1218 DHD_ERROR(("%s: country code setting failed\n",1117 BRCMF_ERROR(("%s: country code setting failed\n",
1219 __func__));1118 __func__));
1220 }1119 }
1221 }1120 }
1222 1121
1223 /* query for 'ver' to get version info from firmware */1122 /* query for 'ver' to get version info from firmware */
1224 memset(buf, 0, sizeof(buf));1123 memset(buf, 0, sizeof(buf));
1225 ptr = buf;1124 ptr = buf;
1226 bcm_mkiovar("ver", 0, 0, buf, sizeof(buf));1125 brcmu_mkiovar("ver", 0, 0, buf, sizeof(buf));
1227 dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf));1126 brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, buf, sizeof(buf));
1228 strsep(&ptr, "\n");1127 strsep(&ptr, "\n");
1229 /* Print fw version info */1128 /* Print fw version info */
1230 DHD_ERROR(("Firmware version = %s\n", buf));1129 BRCMF_ERROR(("Firmware version = %s\n", buf));
1231 1130
1232 /* Set PowerSave mode */1131 /* Set PowerSave mode */
1233 dhdcdc_set_ioctl(dhd, 0, WLC_SET_PM, (char *)&power_mode,1132 brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_PM, (char *)&power_mode,
1234 sizeof(power_mode));1133 sizeof(power_mode));
1235 1134
1236 /* Match Host and Dongle rx alignment */1135 /* Match Host and Dongle rx alignment */
1237 bcm_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf,1136 brcmu_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf,
1238 sizeof(iovbuf));1137 sizeof(iovbuf));
1239 dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));1138 brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
1139 sizeof(iovbuf));
1240 1140
1241 /* disable glom option per default */1141 /* disable glom option per default */
1242 bcm_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf));1142 brcmu_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf));
1243 dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));1143 brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
1144 sizeof(iovbuf));
1244 1145
1245 /* Setup timeout if Beacons are lost and roam is off to report1146 /* Setup timeout if Beacons are lost and roam is off to report
1246 link down */1147 link down */
1247 bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf,1148 brcmu_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf,
1248 sizeof(iovbuf));1149 sizeof(iovbuf));
1249 dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));1150 brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
1151 sizeof(iovbuf));
1250 1152
1251 /* Enable/Disable build-in roaming to allowed ext supplicant to take1153 /* Enable/Disable build-in roaming to allowed ext supplicant to take
1252 of romaing */1154 of romaing */
1253 bcm_mkiovar("roam_off", (char *)&dhd_roam, 4, iovbuf, sizeof(iovbuf));1155 brcmu_mkiovar("roam_off", (char *)&brcmf_roam, 4,
1254 dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));1156 iovbuf, sizeof(iovbuf));
1157 brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
1158 sizeof(iovbuf));
1255 1159
1256 /* Force STA UP */1160 /* Force STA UP */
1257 if (dhd_radio_up)1161 if (brcmf_radio_up)
1258 dhdcdc_set_ioctl(dhd, 0, WLC_UP, (char *)&up, sizeof(up));1162 brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_UP, (char *)&up,
1163 sizeof(up));
1259 1164
1260 /* Setup event_msgs */1165 /* Setup event_msgs */
1261 bcm_mkiovar("event_msgs", dhd->eventmask, WL_EVENTING_MASK_LEN, iovbuf,1166 brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN,
1262 sizeof(iovbuf));1167 iovbuf, sizeof(iovbuf));
1263 dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));1168 brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
1169 sizeof(iovbuf));
1264 1170
1265 dhdcdc_set_ioctl(dhd, 0, WLC_SET_SCAN_CHANNEL_TIME,1171 brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME,
1266 (char *)&scan_assoc_time, sizeof(scan_assoc_time));1172 (char *)&scan_assoc_time, sizeof(scan_assoc_time));
1267 dhdcdc_set_ioctl(dhd, 0, WLC_SET_SCAN_UNASSOC_TIME,1173 brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME,
1268 (char *)&scan_unassoc_time, sizeof(scan_unassoc_time));1174 (char *)&scan_unassoc_time, sizeof(scan_unassoc_time));
1269 1175
1270#ifdef ARP_OFFLOAD_SUPPORT
1271 /* Set and enable ARP offload feature */1176 /* Set and enable ARP offload feature */
1272 if (dhd_arp_enable)1177 if (brcmf_arp_enable)
1273 dhd_arp_offload_set(dhd, dhd_arp_mode);1178 brcmf_c_arp_offload_set(drvr, brcmf_arp_mode);
1274 dhd_arp_offload_enable(dhd, dhd_arp_enable);1179 brcmf_c_arp_offload_enable(drvr, brcmf_arp_enable);
1275#endif /* ARP_OFFLOAD_SUPPORT */1180
1276 1181 /* Set up pkt filter */
1277#ifdef PKT_FILTER_SUPPORT1182 if (brcmf_pkt_filter_enable) {
1278 {1183 for (i = 0; i < drvr->pktfilter_count; i++) {
1279 int i;1184 brcmf_c_pktfilter_offload_set(drvr,
1280 /* Set up pkt filter */1185 drvr->pktfilter[i]);
1281 if (dhd_pkt_filter_enable) {1186 brcmf_c_pktfilter_offload_enable(drvr,
1282 for (i = 0; i < dhd->pktfilter_count; i++) {1187 drvr->pktfilter[i],
1283 dhd_pktfilter_offload_set(dhd,1188 brcmf_pkt_filter_init,
1284 dhd->pktfilter[i]);1189 brcmf_master_mode);
1285 dhd_pktfilter_offload_enable(dhd,
1286 dhd->pktfilter[i],
1287 dhd_pkt_filter_init,
1288 dhd_master_mode);
1289 }
1290 }
1291 }
1292#endif /* PKT_FILTER_SUPPORT */
1293
1294 dhd_os_proto_unblock(dhd);
1295
1296 return 0;
1297}
1298
1299#ifdef SIMPLE_ISCAN
1300uint iscan_thread_id;
1301iscan_buf_t *iscan_chain;
1302
1303iscan_buf_t *dhd_iscan_allocate_buf(dhd_pub_t *dhd, iscan_buf_t **iscanbuf)
1304{
1305 iscan_buf_t *iscanbuf_alloc = 0;
1306 iscan_buf_t *iscanbuf_head;
1307
1308 dhd_iscan_lock();
1309
1310 iscanbuf_alloc = kmalloc(sizeof(iscan_buf_t), GFP_ATOMIC);
1311 if (iscanbuf_alloc == NULL)
1312 goto fail;
1313
1314 iscanbuf_alloc->next = NULL;
1315 iscanbuf_head = *iscanbuf;
1316
1317 DHD_ISCAN(("%s: addr of allocated node = 0x%X"
1318 "addr of iscanbuf_head = 0x%X dhd = 0x%X\n",
1319 __func__, iscanbuf_alloc, iscanbuf_head, dhd));
1320
1321 if (iscanbuf_head == NULL) {
1322 *iscanbuf = iscanbuf_alloc;
1323 DHD_ISCAN(("%s: Head is allocated\n", __func__));
1324 goto fail;
1325 }
1326
1327 while (iscanbuf_head->next)
1328 iscanbuf_head = iscanbuf_head->next;
1329
1330 iscanbuf_head->next = iscanbuf_alloc;
1331
1332fail:
1333 dhd_iscan_unlock();
1334 return iscanbuf_alloc;
1335}
1336
1337void dhd_iscan_free_buf(void *dhdp, iscan_buf_t *iscan_delete)
1338{
1339 iscan_buf_t *iscanbuf_free = 0;
1340 iscan_buf_t *iscanbuf_prv = 0;
1341 iscan_buf_t *iscanbuf_cur = iscan_chain;
1342 dhd_pub_t *dhd = dhd_bus_pub(dhdp);
1343
1344 dhd_iscan_lock();
1345 /* If iscan_delete is null then delete the entire
1346 * chain or else delete specific one provided
1347 */
1348 if (!iscan_delete) {
1349 while (iscanbuf_cur) {
1350 iscanbuf_free = iscanbuf_cur;
1351 iscanbuf_cur = iscanbuf_cur->next;
1352 iscanbuf_free->next = 0;
1353 kfree(iscanbuf_free);
1354 }
1355 iscan_chain = 0;
1356 } else {
1357 while (iscanbuf_cur) {
1358 if (iscanbuf_cur == iscan_delete)
1359 break;
1360 iscanbuf_prv = iscanbuf_cur;
1361 iscanbuf_cur = iscanbuf_cur->next;
1362 }
1363 if (iscanbuf_prv)
1364 iscanbuf_prv->next = iscan_delete->next;
1365
1366 iscan_delete->next = 0;
1367 kfree(iscan_delete);
1368
1369 if (!iscanbuf_prv)
1370 iscan_chain = 0;
1371 }
1372 dhd_iscan_unlock();
1373}
1374
1375iscan_buf_t *dhd_iscan_result_buf(void)
1376{
1377 return iscan_chain;
1378}
1379
1380/*
1381* print scan cache
1382* print partial iscan_skip list differently
1383*/
1384int dhd_iscan_print_cache(iscan_buf_t *iscan_skip)
1385{
1386 int i = 0, l = 0;
1387 iscan_buf_t *iscan_cur;
1388 wl_iscan_results_t *list;
1389 wl_scan_results_t *results;
1390 wl_bss_info_t UNALIGNED *bi;
1391
1392 dhd_iscan_lock();
1393
1394 iscan_cur = dhd_iscan_result_buf();
1395
1396 while (iscan_cur) {
1397 list = (wl_iscan_results_t *)iscan_cur->iscan_buf;
1398 if (!list)
1399 break;
1400
1401 results = (wl_scan_results_t *)&list->results;
1402 if (!results)
1403 break;
1404
1405 if (results->version != WL_BSS_INFO_VERSION) {
1406 DHD_ISCAN(("%s: results->version %d != "
1407 "WL_BSS_INFO_VERSION\n",
1408 __func__, results->version));
1409 goto done;
1410 }
1411
1412 bi = results->bss_info;
1413 for (i = 0; i < results->count; i++) {
1414 if (!bi)
1415 break;
1416
1417 DHD_ISCAN(("%s[%2.2d:%2.2d] %X:%X:%X:%X:%X:%X\n",
1418 iscan_cur != iscan_skip ? "BSS" : "bss", l,
1419 i, bi->BSSID.octet[0], bi->BSSID.octet[1],
1420 bi->BSSID.octet[2], bi->BSSID.octet[3],
1421 bi->BSSID.octet[4], bi->BSSID.octet[5]));
1422
1423 bi = (wl_bss_info_t *)((unsigned long)bi + bi->length);
1424 }
1425 iscan_cur = iscan_cur->next;
1426 l++;
1427 }
1428
1429done:
1430 dhd_iscan_unlock();
1431 return 0;
1432}
1433
1434/*
1435* delete disappeared AP from specific scan cache but skip partial
1436* list in iscan_skip
1437*/
1438int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip)
1439{
1440 int i = 0, j = 0, l = 0;
1441 iscan_buf_t *iscan_cur;
1442 wl_iscan_results_t *list;
1443 wl_scan_results_t *results;
1444 wl_bss_info_t UNALIGNED *bi, *bi_new, *bi_next;
1445
1446 unsigned char *s_addr = addr;
1447
1448 dhd_iscan_lock();
1449 DHD_ISCAN(("%s: BSS to remove %X:%X:%X:%X:%X:%X\n",
1450 __func__, s_addr[0], s_addr[1], s_addr[2],
1451 s_addr[3], s_addr[4], s_addr[5]));
1452
1453 iscan_cur = dhd_iscan_result_buf();
1454
1455 while (iscan_cur) {
1456 if (iscan_cur != iscan_skip) {
1457 list = (wl_iscan_results_t *)iscan_cur->iscan_buf;
1458 if (!list)
1459 break;
1460
1461 results = (wl_scan_results_t *)&list->results;
1462 if (!results)
1463 break;
1464
1465 if (results->version != WL_BSS_INFO_VERSION) {
1466 DHD_ERROR(("%s: results->version %d != "
1467 "WL_BSS_INFO_VERSION\n",
1468 __func__, results->version));
1469 goto done;
1470 }
1471
1472 bi = results->bss_info;
1473 for (i = 0; i < results->count; i++) {
1474 if (!bi)
1475 break;
1476
1477 if (!memcmp
1478 (bi->BSSID.octet, addr, ETH_ALEN)) {
1479 DHD_ISCAN(("%s: Del BSS[%2.2d:%2.2d] "
1480 "%X:%X:%X:%X:%X:%X\n",
1481 __func__, l, i, bi->BSSID.octet[0],
1482 bi->BSSID.octet[1], bi->BSSID.octet[2],
1483 bi->BSSID.octet[3], bi->BSSID.octet[4],
1484 bi->BSSID.octet[5]));
1485
1486 bi_new = bi;
1487 bi = (wl_bss_info_t *)((unsigned long)
1488 bi + bi->length);
1489/*
1490 if(bi && bi_new) {
1491 memcpy(bi_new, bi, results->buflen -
1492 bi_new->length);
1493 results->buflen -= bi_new->length;
1494 }
1495*/
1496 results->buflen -= bi_new->length;
1497 results->count--;
1498
1499 for (j = i; j < results->count; j++) {
1500 if (bi && bi_new) {
1501 DHD_ISCAN(("%s: Moved up BSS[%2.2d:%2.2d]" "%X:%X:%X:%X:%X:%X\n",
1502 __func__, l, j,
1503 bi->BSSID.octet[0],
1504 bi->BSSID.octet[1],
1505 bi->BSSID.octet[2],
1506 bi->BSSID.octet[3],
1507 bi->BSSID.octet[4],
1508 bi->BSSID.octet[5]));
1509
1510 bi_next =
1511 (wl_bss_info_t *)((unsigned long)bi +
1512 bi->length);
1513 memcpy(bi_new, bi,
1514 bi->length);
1515 bi_new =
1516 (wl_bss_info_t *)((unsigned long)bi_new +
1517 bi_new->
1518 length);
1519 bi = bi_next;
1520 }
1521 }
1522
1523 if (results->count == 0) {
1524 /* Prune now empty partial
1525 scan list */
1526 dhd_iscan_free_buf(dhdp,
1527 iscan_cur);
1528 goto done;
1529 }
1530 break;
1531 }
1532 bi = (wl_bss_info_t *)((unsigned long)bi +
1533 bi->length);
1534 }
1535 }1190 }
1536 iscan_cur = iscan_cur->next;
1537 l++;
1538 }
1539
1540done:
1541 dhd_iscan_unlock();
1542 return 0;
1543}
1544
1545int dhd_iscan_remove_duplicates(void *dhdp, iscan_buf_t *iscan_cur)
1546{
1547 int i = 0;
1548 wl_iscan_results_t *list;
1549 wl_scan_results_t *results;
1550 wl_bss_info_t UNALIGNED *bi, *bi_new, *bi_next;
1551
1552 dhd_iscan_lock();
1553
1554 DHD_ISCAN(("%s: Scan cache before delete\n", __func__));
1555 dhd_iscan_print_cache(iscan_cur);
1556
1557 if (!iscan_cur)
1558 goto done;
1559
1560 list = (wl_iscan_results_t *)iscan_cur->iscan_buf;
1561 if (!list)
1562 goto done;
1563
1564 results = (wl_scan_results_t *)&list->results;
1565 if (!results)
1566 goto done;
1567
1568 if (results->version != WL_BSS_INFO_VERSION) {
1569 DHD_ERROR(("%s: results->version %d != WL_BSS_INFO_VERSION\n",
1570 __func__, results->version));
1571 goto done;
1572 }1191 }
1573 1192
1574 bi = results->bss_info;1193 brcmf_os_proto_unblock(drvr);
1575 for (i = 0; i < results->count; i++) {
1576 if (!bi)
1577 break;
1578
1579 DHD_ISCAN(("%s: Find dups for BSS[%2.2d] %X:%X:%X:%X:%X:%X\n",
1580 __func__, i, bi->BSSID.octet[0],
1581 bi->BSSID.octet[1], bi->BSSID.octet[2],
1582 bi->BSSID.octet[3], bi->BSSID.octet[4],
1583 bi->BSSID.octet[5]));
1584
1585 dhd_iscan_delete_bss(dhdp, bi->BSSID.octet, iscan_cur);
1586 1194
1587 bi = (wl_bss_info_t *)((unsigned long)bi + bi->length);
1588 }
1589
1590done:
1591 DHD_ISCAN(("%s: Scan cache after delete\n", __func__));
1592 dhd_iscan_print_cache(iscan_cur);
1593 dhd_iscan_unlock();
1594 return 0;1195 return 0;
1595}1196}
1596
1597void dhd_iscan_ind_scan_confirm(void *dhdp, bool status)
1598{
1599
1600 dhd_ind_scan_confirm(dhdp, status);
1601}
1602
1603int dhd_iscan_request(void *dhdp, u16 action)
1604{
1605 int rc;
1606 wl_iscan_params_t params;
1607 dhd_pub_t *dhd = dhd_bus_pub(dhdp);
1608 char buf[WLC_IOCTL_SMLEN];
1609
1610 memset(&params, 0, sizeof(wl_iscan_params_t));
1611 memcpy(&params.params.bssid, &ether_bcast, ETH_ALEN);
1612
1613 params.params.bss_type = DOT11_BSSTYPE_ANY;
1614 params.params.scan_type = DOT11_SCANTYPE_ACTIVE;
1615
1616 params.params.nprobes = -1;
1617 params.params.active_time = -1;
1618 params.params.passive_time = -1;
1619 params.params.home_time = -1;
1620 params.params.channel_num = 0;
1621
1622 params.version = ISCAN_REQ_VERSION;
1623 params.action = action;
1624 params.scan_duration = 0;
1625
1626 bcm_mkiovar("iscan", (char *)&params, sizeof(wl_iscan_params_t), buf,
1627 WLC_IOCTL_SMLEN);
1628 rc = dhd_wl_ioctl(dhdp, WLC_SET_VAR, buf, WLC_IOCTL_SMLEN);
1629
1630 return rc;
1631}
1632
1633static int dhd_iscan_get_partial_result(void *dhdp, uint *scan_count)
1634{
1635 wl_iscan_results_t *list_buf;
1636 wl_iscan_results_t list;
1637 wl_scan_results_t *results;
1638 iscan_buf_t *iscan_cur;
1639 int status = -1;
1640 dhd_pub_t *dhd = dhd_bus_pub(dhdp);
1641 int rc;
1642
1643 iscan_cur = dhd_iscan_allocate_buf(dhd, &iscan_chain);
1644 if (!iscan_cur) {
1645 DHD_ERROR(("%s: Failed to allocate node\n", __func__));
1646 dhd_iscan_free_buf(dhdp, 0);
1647 dhd_iscan_request(dhdp, WL_SCAN_ACTION_ABORT);
1648 goto fail;
1649 }
1650
1651 dhd_iscan_lock();
1652
1653 memset(iscan_cur->iscan_buf, 0, WLC_IW_ISCAN_MAXLEN);
1654 list_buf = (wl_iscan_results_t *) iscan_cur->iscan_buf;
1655 results = &list_buf->results;
1656 results->buflen = WL_ISCAN_RESULTS_FIXED_SIZE;
1657 results->version = 0;
1658 results->count = 0;
1659
1660 memset(&list, 0, sizeof(list));
1661 list.results.buflen = WLC_IW_ISCAN_MAXLEN;
1662 bcm_mkiovar("iscanresults", (char *)&list, WL_ISCAN_RESULTS_FIXED_SIZE,
1663 iscan_cur->iscan_buf, WLC_IW_ISCAN_MAXLEN);
1664 rc = dhd_wl_ioctl(dhdp, WLC_GET_VAR, iscan_cur->iscan_buf,
1665 WLC_IW_ISCAN_MAXLEN);
1666
1667 results->buflen = results->buflen;
1668 results->version = results->version;
1669 *scan_count = results->count = results->count;
1670 status = list_buf->status;
1671
1672 dhd_iscan_unlock();
1673
1674 if (!(*scan_count))
1675 dhd_iscan_free_buf(dhdp, iscan_cur);
1676 else
1677 dhd_iscan_remove_duplicates(dhdp, iscan_cur);
1678
1679fail:
1680 return status;
1681}
1682#endif /* SIMPLE_ISCAN */
1683
1684#ifdef PNO_SUPPORT
1685int dhd_pno_clean(dhd_pub_t *dhd)
1686{
1687 char iovbuf[128];
1688 int pfn_enabled = 0;
1689 int iov_len = 0;
1690 int ret;
1691
1692 /* Disable pfn */
1693 iov_len =
1694 bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, sizeof(iovbuf));
1695 ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
1696 if (ret >= 0) {
1697 /* clear pfn */
1698 iov_len = bcm_mkiovar("pfnclear", 0, 0, iovbuf, sizeof(iovbuf));
1699 if (iov_len) {
1700 ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
1701 iov_len);
1702 if (ret < 0) {
1703 DHD_ERROR(("%s failed code %d\n", __func__,
1704 ret));
1705 }
1706 } else {
1707 ret = -1;
1708 DHD_ERROR(("%s failed code %d\n", __func__, iov_len));
1709 }
1710 } else
1711 DHD_ERROR(("%s failed code %d\n", __func__, ret));
1712
1713 return ret;
1714}
1715
1716int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled)
1717{
1718 char iovbuf[128];
1719 int ret = -1;
1720
1721 if ((!dhd) && ((pfn_enabled != 0) || (pfn_enabled != 1))) {
1722 DHD_ERROR(("%s error exit\n", __func__));
1723 return ret;
1724 }
1725
1726 /* Enable/disable PNO */
1727 ret = bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf,
1728 sizeof(iovbuf));
1729 if (ret > 0) {
1730 ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
1731 sizeof(iovbuf));
1732 if (ret < 0) {
1733 DHD_ERROR(("%s failed for error=%d\n", __func__, ret));
1734 return ret;
1735 } else {
1736 dhd->pno_enable = pfn_enabled;
1737 DHD_TRACE(("%s set pno as %d\n", __func__,
1738 dhd->pno_enable));
1739 }
1740 } else
1741 DHD_ERROR(("%s failed err=%d\n", __func__, ret));
1742
1743 return ret;
1744}
1745
1746/* Function to execute combined scan */
1747int
1748dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char scan_fr)
1749{
1750 int err = -1;
1751 char iovbuf[128];
1752 int k, i;
1753 wl_pfn_param_t pfn_param;
1754 wl_pfn_t pfn_element;
1755
1756 DHD_TRACE(("%s nssid=%d nchan=%d\n", __func__, nssid, scan_fr));
1757
1758 if ((!dhd) && (!ssids_local)) {
1759 DHD_ERROR(("%s error exit\n", __func__));
1760 err = -1;
1761 }
1762
1763 /* Check for broadcast ssid */
1764 for (k = 0; k < nssid; k++) {
1765 if (!ssids_local[k].SSID_len) {
1766 DHD_ERROR(("%d: Broadcast SSID is ilegal for PNO "
1767 "setting\n", k));
1768 return err;
1769 }
1770 }
1771/* #define PNO_DUMP 1 */
1772#ifdef PNO_DUMP
1773 {
1774 int j;
1775 for (j = 0; j < nssid; j++) {
1776 DHD_ERROR(("%d: scan for %s size =%d\n", j,
1777 ssids_local[j].SSID,
1778 ssids_local[j].SSID_len));
1779 }
1780 }
1781#endif /* PNO_DUMP */
1782
1783 /* clean up everything */
1784 err = dhd_pno_clean(dhd);
1785 if (err < 0) {
1786 DHD_ERROR(("%s failed error=%d\n", __func__, err));
1787 return err;
1788 }
1789 memset(&pfn_param, 0, sizeof(pfn_param));
1790 memset(&pfn_element, 0, sizeof(pfn_element));
1791
1792 /* set pfn parameters */
1793 pfn_param.version = PFN_VERSION;
1794 pfn_param.flags = (PFN_LIST_ORDER << SORT_CRITERIA_BIT);
1795
1796 /* set up pno scan fr */
1797 if (scan_fr != 0)
1798 pfn_param.scan_freq = scan_fr;
1799
1800 bcm_mkiovar("pfn_set", (char *)&pfn_param, sizeof(pfn_param), iovbuf,
1801 sizeof(iovbuf));
1802 dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
1803
1804 /* set all pfn ssid */
1805 for (i = 0; i < nssid; i++) {
1806
1807 pfn_element.bss_type = DOT11_BSSTYPE_INFRASTRUCTURE;
1808 pfn_element.auth = WLAN_AUTH_OPEN;
1809 pfn_element.wpa_auth = WPA_AUTH_PFN_ANY;
1810 pfn_element.wsec = 0;
1811 pfn_element.infra = 1;
1812
1813 memcpy((char *)pfn_element.ssid.SSID, ssids_local[i].SSID,
1814 ssids_local[i].SSID_len);
1815 pfn_element.ssid.SSID_len = ssids_local[i].SSID_len;
1816
1817 err = bcm_mkiovar("pfn_add", (char *)&pfn_element,
1818 sizeof(pfn_element), iovbuf, sizeof(iovbuf));
1819 if (err > 0) {
1820 err = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
1821 sizeof(iovbuf));
1822 if (err < 0) {
1823 DHD_ERROR(("%s failed for i=%d error=%d\n",
1824 __func__, i, err));
1825 return err;
1826 }
1827 } else
1828 DHD_ERROR(("%s failed err=%d\n", __func__, err));
1829 }
1830
1831 /* Enable PNO */
1832 /* dhd_pno_enable(dhd, 1); */
1833 return err;
1834}
1835
1836int dhd_pno_get_status(dhd_pub_t *dhd)
1837{
1838 int ret = -1;
1839
1840 if (!dhd)
1841 return ret;
1842 else
1843 return dhd->pno_enable;
1844}
1845
1846#endif /* PNO_SUPPORT */
1847
1848/* Androd ComboSCAN support */
drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c+0−158
@@ -1,158 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/netdevice.h>
18#include <bcmutils.h>
19
20#include <dngl_stats.h>
21#include <dhd.h>
22
23#include <wlioctl.h>
24#include <wl_iw.h>
25
26#define WL_ERROR(fmt, args...) printk(fmt, ##args)
27#define WL_TRACE(fmt, args...) no_printk(fmt, ##args)
28
29#ifdef CUSTOMER_HW
30extern void bcm_wlan_power_off(int);
31extern void bcm_wlan_power_on(int);
32#endif /* CUSTOMER_HW */
33#ifdef CUSTOMER_HW2
34int wifi_set_carddetect(int on);
35int wifi_set_power(int on, unsigned long msec);
36int wifi_get_irq_number(unsigned long *irq_flags_ptr);
37#endif
38
39#if defined(OOB_INTR_ONLY)
40
41#if defined(BCMLXSDMMC)
42extern int sdioh_mmc_irq(int irq);
43#endif /* (BCMLXSDMMC) */
44
45#ifdef CUSTOMER_HW3
46#include <mach/gpio.h>
47#endif
48
49/* Customer specific Host GPIO definition */
50static int dhd_oob_gpio_num = -1; /* GG 19 */
51
52module_param(dhd_oob_gpio_num, int, 0644);
53MODULE_PARM_DESC(dhd_oob_gpio_num, "DHD oob gpio number");
54
55int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr)
56{
57 int host_oob_irq = 0;
58
59#ifdef CUSTOMER_HW2
60 host_oob_irq = wifi_get_irq_number(irq_flags_ptr);
61
62#else /* for NOT CUSTOMER_HW2 */
63#if defined(CUSTOM_OOB_GPIO_NUM)
64 if (dhd_oob_gpio_num < 0)
65 dhd_oob_gpio_num = CUSTOM_OOB_GPIO_NUM;
66#endif
67
68 if (dhd_oob_gpio_num < 0) {
69 WL_ERROR("%s: ERROR customer specific Host GPIO is NOT defined\n",
70 __func__);
71 return dhd_oob_gpio_num;
72 }
73
74 WL_ERROR("%s: customer specific Host GPIO number is (%d)\n",
75 __func__, dhd_oob_gpio_num);
76
77#if defined CUSTOMER_HW
78 host_oob_irq = MSM_GPIO_TO_INT(dhd_oob_gpio_num);
79#elif defined CUSTOMER_HW3
80 gpio_request(dhd_oob_gpio_num, "oob irq");
81 host_oob_irq = gpio_to_irq(dhd_oob_gpio_num);
82 gpio_direction_input(dhd_oob_gpio_num);
83#endif /* CUSTOMER_HW */
84#endif /* CUSTOMER_HW2 */
85
86 return host_oob_irq;
87}
88#endif /* defined(OOB_INTR_ONLY) */
89
90/* Customer function to control hw specific wlan gpios */
91void dhd_customer_gpio_wlan_ctrl(int onoff)
92{
93 switch (onoff) {
94 case WLAN_RESET_OFF:
95 WL_TRACE("%s: call customer specific GPIO to insert WLAN RESET\n",
96 __func__);
97#ifdef CUSTOMER_HW
98 bcm_wlan_power_off(2);
99#endif /* CUSTOMER_HW */
100#ifdef CUSTOMER_HW2
101 wifi_set_power(0, 0);
102#endif
103 WL_ERROR("=========== WLAN placed in RESET ========\n");
104 break;
105
106 case WLAN_RESET_ON:
107 WL_TRACE("%s: callc customer specific GPIO to remove WLAN RESET\n",
108 __func__);
109#ifdef CUSTOMER_HW
110 bcm_wlan_power_on(2);
111#endif /* CUSTOMER_HW */
112#ifdef CUSTOMER_HW2
113 wifi_set_power(1, 0);
114#endif
115 WL_ERROR("=========== WLAN going back to live ========\n");
116 break;
117
118 case WLAN_POWER_OFF:
119 WL_TRACE("%s: call customer specific GPIO to turn off WL_REG_ON\n",
120 __func__);
121#ifdef CUSTOMER_HW
122 bcm_wlan_power_off(1);
123#endif /* CUSTOMER_HW */
124 break;
125
126 case WLAN_POWER_ON:
127 WL_TRACE("%s: call customer specific GPIO to turn on WL_REG_ON\n",
128 __func__);
129#ifdef CUSTOMER_HW
130 bcm_wlan_power_on(1);
131#endif /* CUSTOMER_HW */
132 /* Lets customer power to get stable */
133 udelay(200);
134 break;
135 }
136}
137
138#ifdef GET_CUSTOM_MAC_ENABLE
139/* Function to get custom MAC address */
140int dhd_custom_get_mac_address(unsigned char *buf)
141{
142 WL_TRACE("%s Enter\n", __func__);
143 if (!buf)
144 return -EINVAL;
145
146 /* Customer access to MAC address stored outside of DHD driver */
147
148#ifdef EXAMPLE_GET_MAC
149 /* EXAMPLE code */
150 {
151 u8 ea_example[ETH_ALEN] = {0x00, 0x11, 0x22, 0x33, 0x44, 0xFF};
152 memcpy(buf, ea_example, ETH_ALEN);
153 }
154#endif /* EXAMPLE_GET_MAC */
155
156 return 0;
157}
158#endif /* GET_CUSTOM_MAC_ENABLE */
drivers/staging/brcm80211/brcmfmac/dhd_dbg.h+36−69
@@ -14,90 +14,57 @@ · 13 unmodified lines
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */15 */
16 16
17#ifndef _dhd_dbg_17#ifndef _BRCMF_DBG_H_
18#define _dhd_dbg_18#define _BRCMF_DBG_H_
19 19
20#if defined(DHD_DEBUG)20#if defined(BCMDBG)
21 21
22#define DHD_ERROR(args) \22#define BRCMF_ERROR(args) \
23 do {if ((dhd_msg_level & DHD_ERROR_VAL) && (net_ratelimit())) \23 do {if ((brcmf_msg_level & BRCMF_ERROR_VAL) && (net_ratelimit())) \
24 printk args; } while (0)24 printk args; } while (0)
25#define DHD_TRACE(args) do {if (dhd_msg_level & DHD_TRACE_VAL) \25#define BRCMF_TRACE(args) do {if (brcmf_msg_level & BRCMF_TRACE_VAL) \
26 printk args; } while (0)26 printk args; } while (0)
27#define DHD_INFO(args) do {if (dhd_msg_level & DHD_INFO_VAL) \27#define BRCMF_INFO(args) do {if (brcmf_msg_level & BRCMF_INFO_VAL) \
28 printk args; } while (0)28 printk args; } while (0)
29#define DHD_DATA(args) do {if (dhd_msg_level & DHD_DATA_VAL) \29#define BRCMF_DATA(args) do {if (brcmf_msg_level & BRCMF_DATA_VAL) \
30 printk args; } while (0)30 printk args; } while (0)
31#define DHD_CTL(args) do {if (dhd_msg_level & DHD_CTL_VAL) \31#define BRCMF_CTL(args) do {if (brcmf_msg_level & BRCMF_CTL_VAL) \
32 printk args; } while (0)32 printk args; } while (0)
33#define DHD_TIMER(args) do {if (dhd_msg_level & DHD_TIMER_VAL) \33#define BRCMF_TIMER(args) do {if (brcmf_msg_level & BRCMF_TIMER_VAL) \
34 printk args; } while (0)34 printk args; } while (0)
35#define DHD_HDRS(args) do {if (dhd_msg_level & DHD_HDRS_VAL) \35#define BRCMF_INTR(args) do {if (brcmf_msg_level & BRCMF_INTR_VAL) \
36 printk args; } while (0)36 printk args; } while (0)
37#define DHD_BYTES(args) do {if (dhd_msg_level & DHD_BYTES_VAL) \37#define BRCMF_GLOM(args) do {if (brcmf_msg_level & BRCMF_GLOM_VAL) \
38 printk args; } while (0)38 printk args; } while (0)
39#define DHD_INTR(args) do {if (dhd_msg_level & DHD_INTR_VAL) \39#define BRCMF_EVENT(args) do {if (brcmf_msg_level & BRCMF_EVENT_VAL) \
40 printk args; } while (0)40 printk args; } while (0)
41#define DHD_GLOM(args) do {if (dhd_msg_level & DHD_GLOM_VAL) \
42 printk args; } while (0)
43#define DHD_EVENT(args) do {if (dhd_msg_level & DHD_EVENT_VAL) \
44 printk args; } while (0)
45#define DHD_BTA(args) do {if (dhd_msg_level & DHD_BTA_VAL) \
46 printk args; } while (0)
47#define DHD_ISCAN(args) do {if (dhd_msg_level & DHD_ISCAN_VAL) \
48 printk args; } while (0)
49
50#define DHD_ERROR_ON() (dhd_msg_level & DHD_ERROR_VAL)
51#define DHD_TRACE_ON() (dhd_msg_level & DHD_TRACE_VAL)
52#define DHD_INFO_ON() (dhd_msg_level & DHD_INFO_VAL)
53#define DHD_DATA_ON() (dhd_msg_level & DHD_DATA_VAL)
54#define DHD_CTL_ON() (dhd_msg_level & DHD_CTL_VAL)
55#define DHD_TIMER_ON() (dhd_msg_level & DHD_TIMER_VAL)
56#define DHD_HDRS_ON() (dhd_msg_level & DHD_HDRS_VAL)
57#define DHD_BYTES_ON() (dhd_msg_level & DHD_BYTES_VAL)
58#define DHD_INTR_ON() (dhd_msg_level & DHD_INTR_VAL)
59#define DHD_GLOM_ON() (dhd_msg_level & DHD_GLOM_VAL)
60#define DHD_EVENT_ON() (dhd_msg_level & DHD_EVENT_VAL)
61#define DHD_BTA_ON() (dhd_msg_level & DHD_BTA_VAL)
62#define DHD_ISCAN_ON() (dhd_msg_level & DHD_ISCAN_VAL)
63 41
64#else /* (defined BCMDBG) || (defined DHD_DEBUG) */42#define BRCMF_DATA_ON() (brcmf_msg_level & BRCMF_DATA_VAL)
43#define BRCMF_CTL_ON() (brcmf_msg_level & BRCMF_CTL_VAL)
44#define BRCMF_HDRS_ON() (brcmf_msg_level & BRCMF_HDRS_VAL)
45#define BRCMF_BYTES_ON() (brcmf_msg_level & BRCMF_BYTES_VAL)
46#define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
65 47
66#define DHD_ERROR(args) do {if (net_ratelimit()) printk args; } while (0)48#else /* (defined BCMDBG) || (defined BCMDBG) */
67#define DHD_TRACE(args)
68#define DHD_INFO(args)
69#define DHD_DATA(args)
70#define DHD_CTL(args)
71#define DHD_TIMER(args)
72#define DHD_HDRS(args)
73#define DHD_BYTES(args)
74#define DHD_INTR(args)
75#define DHD_GLOM(args)
76#define DHD_EVENT(args)
77#define DHD_BTA(args)
78#define DHD_ISCAN(args)
79 49
80#define DHD_ERROR_ON() 050#define BRCMF_ERROR(args) do {if (net_ratelimit()) printk args; } while (0)
81#define DHD_TRACE_ON() 051#define BRCMF_TRACE(args)
82#define DHD_INFO_ON() 052#define BRCMF_INFO(args)
83#define DHD_DATA_ON() 053#define BRCMF_DATA(args)
84#define DHD_CTL_ON() 054#define BRCMF_CTL(args)
85#define DHD_TIMER_ON() 055#define BRCMF_TIMER(args)
86#define DHD_HDRS_ON() 056#define BRCMF_INTR(args)
87#define DHD_BYTES_ON() 057#define BRCMF_GLOM(args)
88#define DHD_INTR_ON() 058#define BRCMF_EVENT(args)
89#define DHD_GLOM_ON() 0
90#define DHD_EVENT_ON() 0
91#define DHD_BTA_ON() 0
92#define DHD_ISCAN_ON() 0
93#endif /* defined(DHD_DEBUG) */
94 59
95#define DHD_LOG(args)60#define BRCMF_DATA_ON() 0
61#define BRCMF_CTL_ON() 0
62#define BRCMF_HDRS_ON() 0
63#define BRCMF_BYTES_ON() 0
64#define BRCMF_GLOM_ON() 0
96 65
97#define DHD_NONE(args)66#endif /* defined(BCMDBG) */
98extern int dhd_msg_level;
99 67
100/* Defines msg bits */68extern int brcmf_msg_level;
101#include <dhdioctl.h>
102 69
103#endif /* _dhd_dbg_ */70#endif /* _BRCMF_DBG_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_linux.c+554−1682
@@ -14,9 +14,6 @@ · 13 unmodified lines
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */15 */
16 16
17#ifdef CONFIG_WIFI_CONTROL_FUNC
18#include <linux/platform_device.h>
19#endif
20#include <linux/init.h>17#include <linux/init.h>
21#include <linux/kernel.h>18#include <linux/kernel.h>
22#include <linux/kthread.h>19#include <linux/kthread.h>
@@ -33,177 +30,32 @@ · 10 unmodified lines
33#include <linux/uaccess.h>30#include <linux/uaccess.h>
34#include <linux/interrupt.h>31#include <linux/interrupt.h>
35#include <linux/hardirq.h>32#include <linux/hardirq.h>
36#include <bcmdefs.h>33#include <net/cfg80211.h>
37#include <bcmutils.h>34#include <defs.h>
38 35#include <brcmu_utils.h>
39#include <dngl_stats.h>36#include <brcmu_wifi.h>
40#include <dhd.h>37
41#include <dhd_bus.h>38#include "dhd.h"
42#include <dhd_proto.h>39#include "dhd_bus.h"
43#include <dhd_dbg.h>40#include "dhd_proto.h"
44 41#include "dhd_dbg.h"
45#include <wl_cfg80211.h>42#include "wl_cfg80211.h"
46 43#include "bcmchip.h"
47#define EPI_VERSION_STR "4.218.248.5"
48#define ETH_P_BRCM 0x886c
49
50#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
51#include <linux/wifi_tiwlan.h>
52
53struct semaphore wifi_control_sem;
54
55struct dhd_bus *g_bus;
56
57static struct wifi_platform_data *wifi_control_data;
58static struct resource *wifi_irqres;
59
60int wifi_get_irq_number(unsigned long *irq_flags_ptr)
61{
62 if (wifi_irqres) {
63 *irq_flags_ptr = wifi_irqres->flags & IRQF_TRIGGER_MASK;
64 return (int)wifi_irqres->start;
65 }
66#ifdef CUSTOM_OOB_GPIO_NUM
67 return CUSTOM_OOB_GPIO_NUM;
68#else
69 return -1;
70#endif
71}
72
73int wifi_set_carddetect(int on)
74{
75 printk(KERN_ERR "%s = %d\n", __func__, on);
76 if (wifi_control_data && wifi_control_data->set_carddetect)
77 wifi_control_data->set_carddetect(on);
78 return 0;
79}
80
81int wifi_set_power(int on, unsigned long msec)
82{
83 printk(KERN_ERR "%s = %d\n", __func__, on);
84 if (wifi_control_data && wifi_control_data->set_power)
85 wifi_control_data->set_power(on);
86 if (msec)
87 mdelay(msec);
88 return 0;
89}
90
91int wifi_set_reset(int on, unsigned long msec)
92{
93 printk(KERN_ERR "%s = %d\n", __func__, on);
94 if (wifi_control_data && wifi_control_data->set_reset)
95 wifi_control_data->set_reset(on);
96 if (msec)
97 mdelay(msec);
98 return 0;
99}
100
101static int wifi_probe(struct platform_device *pdev)
102{
103 struct wifi_platform_data *wifi_ctrl =
104 (struct wifi_platform_data *)(pdev->dev.platform_data);
105
106 printk(KERN_ERR "## %s\n", __func__);
107 wifi_irqres =
108 platform_get_resource_byname(pdev, IORESOURCE_IRQ,
109 "bcm4329_wlan_irq");
110 wifi_control_data = wifi_ctrl;
111
112 wifi_set_power(1, 0); /* Power On */
113 wifi_set_carddetect(1); /* CardDetect (0->1) */
114
115 up(&wifi_control_sem);
116 return 0;
117}
118
119static int wifi_remove(struct platform_device *pdev)
120{
121 struct wifi_platform_data *wifi_ctrl =
122 (struct wifi_platform_data *)(pdev->dev.platform_data);
123
124 printk(KERN_ERR "## %s\n", __func__);
125 wifi_control_data = wifi_ctrl;
126
127 wifi_set_carddetect(0); /* CardDetect (1->0) */
128 wifi_set_power(0, 0); /* Power Off */
129
130 up(&wifi_control_sem);
131 return 0;
132}
133
134static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
135{
136 DHD_TRACE(("##> %s\n", __func__));
137 return 0;
138}
139
140static int wifi_resume(struct platform_device *pdev)
141{
142 DHD_TRACE(("##> %s\n", __func__));
143 return 0;
144}
145
146static struct platform_driver wifi_device = {
147 .probe = wifi_probe,
148 .remove = wifi_remove,
149 .suspend = wifi_suspend,
150 .resume = wifi_resume,
151 .driver = {
152 .name = KBUILD_MODNAME,
153 }
154};
155
156int wifi_add_dev(void)
157{
158 DHD_TRACE(("## Calling platform_driver_register\n"));
159 return platform_driver_register(&wifi_device);
160}
161
162void wifi_del_dev(void)
163{
164 DHD_TRACE(("## Unregister platform_driver_register\n"));
165 platform_driver_unregister(&wifi_device);
166}
167#endif /* defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */
168 44
169#if defined(CONFIG_PM_SLEEP)45#if defined(CONFIG_PM_SLEEP)
170#include <linux/suspend.h>46#include <linux/suspend.h>
171atomic_t dhd_mmc_suspend;47atomic_t brcmf_mmc_suspend;
172DECLARE_WAIT_QUEUE_HEAD(dhd_dpc_wait);
173#endif /* defined(CONFIG_PM_SLEEP) */48#endif /* defined(CONFIG_PM_SLEEP) */
174 49
175#if defined(OOB_INTR_ONLY)
176extern void dhd_enable_oob_intr(struct dhd_bus *bus, bool enable);
177#endif /* defined(OOB_INTR_ONLY) */
178
179MODULE_AUTHOR("Broadcom Corporation");50MODULE_AUTHOR("Broadcom Corporation");
180MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN fullmac driver.");51MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN fullmac driver.");
181MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN fullmac cards");52MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN fullmac cards");
182MODULE_LICENSE("Dual BSD/GPL");53MODULE_LICENSE("Dual BSD/GPL");
183 54
184#define DRV_MODULE_NAME "brcmfmac"
185
186/* Linux wireless extension support */
187#if defined(CONFIG_WIRELESS_EXT)
188#include <wl_iw.h>
189extern wl_iw_extra_params_t g_wl_iw_params;
190#endif /* defined(CONFIG_WIRELESS_EXT) */
191
192#if defined(CONFIG_HAS_EARLYSUSPEND)
193#include <linux/earlysuspend.h>
194extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
195 uint len);
196#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */
197
198#ifdef PKT_FILTER_SUPPORT
199extern void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg);
200extern void dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable,
201 int master_mode);
202#endif
203 55
204/* Interface control information */56/* Interface control information */
205typedef struct dhd_if {57struct brcmf_if {
206 struct dhd_info *info; /* back pointer to dhd_info */58 struct brcmf_info *info; /* back pointer to brcmf_info */
207 /* OS/stack specifics */59 /* OS/stack specifics */
208 struct net_device *net;60 struct net_device *net;
209 struct net_device_stats stats;61 struct net_device_stats stats;
@@ -214,33 +66,17 @@ typedef struct dhd_if { · 4 unmodified lines
214 bool attached; /* Delayed attachment when unset */66 bool attached; /* Delayed attachment when unset */
215 bool txflowcontrol; /* Per interface flow control indicator */67 bool txflowcontrol; /* Per interface flow control indicator */
216 char name[IFNAMSIZ]; /* linux interface name */68 char name[IFNAMSIZ]; /* linux interface name */
217} dhd_if_t;69};
218 70
219/* Local private structure (extension of pub) */71/* Local private structure (extension of pub) */
220typedef struct dhd_info {72struct brcmf_info {
221#if defined(CONFIG_WIRELESS_EXT)73 struct brcmf_pub pub;
222 wl_iw_t iw; /* wireless extensions state (must be first) */
223#endif /* defined(CONFIG_WIRELESS_EXT) */
224
225 dhd_pub_t pub;
226 74
227 /* OS/stack specifics */75 /* OS/stack specifics */
228 dhd_if_t *iflist[DHD_MAX_IFS];76 struct brcmf_if *iflist[BRCMF_MAX_IFS];
229 77
230 struct semaphore proto_sem;78 struct semaphore proto_sem;
231 wait_queue_head_t ioctl_resp_wait;79 wait_queue_head_t ioctl_resp_wait;
232 struct timer_list timer;
233 bool wd_timer_valid;
234 struct tasklet_struct tasklet;
235 spinlock_t sdlock;
236 spinlock_t txqlock;
237 /* Thread based operation */
238 bool threads_only;
239 struct semaphore sdsem;
240 struct task_struct *watchdog_tsk;
241 struct semaphore watchdog_sem;
242 struct task_struct *dpc_tsk;
243 struct semaphore dpc_sem;
244 80
245 /* Thread to issue ioctl for multicast */81 /* Thread to issue ioctl for multicast */
246 struct task_struct *sysioc_tsk;82 struct task_struct *sysioc_tsk;
@@ -248,83 +84,44 @@ typedef struct dhd_info { · 1 unmodified line
248 bool set_multicast;84 bool set_multicast;
249 bool set_macaddress;85 bool set_macaddress;
250 u8 macvalue[ETH_ALEN];86 u8 macvalue[ETH_ALEN];
251 wait_queue_head_t ctrl_wait;
252 atomic_t pend_8021x_cnt;87 atomic_t pend_8021x_cnt;
253 88};
254#ifdef CONFIG_HAS_EARLYSUSPEND
255 struct early_suspend early_suspend;
256#endif /* CONFIG_HAS_EARLYSUSPEND */
257} dhd_info_t;
258
259/* Definitions to provide path to the firmware and nvram
260 * example nvram_path[MOD_PARAM_PATHLEN]="/projects/wlan/nvram.txt"
261 */
262char firmware_path[MOD_PARAM_PATHLEN];
263char nvram_path[MOD_PARAM_PATHLEN];
264
265/* load firmware and/or nvram values from the filesystem */
266module_param_string(firmware_path, firmware_path, MOD_PARAM_PATHLEN, 0);
267module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0);
268 89
269/* Error bits */90/* Error bits */
270module_param(dhd_msg_level, int, 0);91module_param(brcmf_msg_level, int, 0);
271 92
272/* Spawn a thread for system ioctls (set mac, set mcast) */93/* Spawn a thread for system ioctls (set mac, set mcast) */
273uint dhd_sysioc = true;94uint brcmf_sysioc = true;
274module_param(dhd_sysioc, uint, 0);95module_param(brcmf_sysioc, uint, 0);
275
276/* Watchdog interval */
277uint dhd_watchdog_ms = 10;
278module_param(dhd_watchdog_ms, uint, 0);
279
280#ifdef DHD_DEBUG
281/* Console poll interval */
282uint dhd_console_ms;
283module_param(dhd_console_ms, uint, 0);
284#endif /* DHD_DEBUG */
285 96
286/* ARP offload agent mode : Enable ARP Host Auto-Reply97/* ARP offload agent mode : Enable ARP Host Auto-Reply
287and ARP Peer Auto-Reply */98and ARP Peer Auto-Reply */
288uint dhd_arp_mode = 0xb;99uint brcmf_arp_mode = 0xb;
289module_param(dhd_arp_mode, uint, 0);100module_param(brcmf_arp_mode, uint, 0);
290 101
291/* ARP offload enable */102/* ARP offload enable */
292uint dhd_arp_enable = true;103uint brcmf_arp_enable = true;
293module_param(dhd_arp_enable, uint, 0);104module_param(brcmf_arp_enable, uint, 0);
294 105
295/* Global Pkt filter enable control */106/* Global Pkt filter enable control */
296uint dhd_pkt_filter_enable = true;107uint brcmf_pkt_filter_enable = true;
297module_param(dhd_pkt_filter_enable, uint, 0);108module_param(brcmf_pkt_filter_enable, uint, 0);
298 109
299/* Pkt filter init setup */110/* Pkt filter init setup */
300uint dhd_pkt_filter_init;111uint brcmf_pkt_filter_init;
301module_param(dhd_pkt_filter_init, uint, 0);112module_param(brcmf_pkt_filter_init, uint, 0);
302 113
303/* Pkt filter mode control */114/* Pkt filter mode control */
304uint dhd_master_mode = true;115uint brcmf_master_mode = true;
305module_param(dhd_master_mode, uint, 1);116module_param(brcmf_master_mode, uint, 0);
306
307/* Watchdog thread priority, -1 to use kernel timer */
308int dhd_watchdog_prio = 97;
309module_param(dhd_watchdog_prio, int, 0);
310
311/* DPC thread priority, -1 to use tasklet */
312int dhd_dpc_prio = 98;
313module_param(dhd_dpc_prio, int, 0);
314 117
315/* DPC thread priority, -1 to use tasklet */118module_param(brcmf_dongle_memsize, int, 0);
316extern int dhd_dongle_memsize;
317module_param(dhd_dongle_memsize, int, 0);
318 119
319/* Contorl fw roaming */120/* Contorl fw roaming */
320#ifdef CUSTOMER_HW2121uint brcmf_roam = 1;
321uint dhd_roam;
322#else
323uint dhd_roam = 1;
324#endif
325 122
326/* Control radio state */123/* Control radio state */
327uint dhd_radio_up = 1;124uint brcmf_radio_up = 1;
328 125
329/* Network inteface name */126/* Network inteface name */
330char iface_name[IFNAMSIZ] = "wlan";127char iface_name[IFNAMSIZ] = "wlan";
@@ -333,252 +130,58 @@ module_param_string(iface_name, iface_name, IFNAMSIZ, 0); · 2 unmodified lines
333/* The following are specific to the SDIO dongle */130/* The following are specific to the SDIO dongle */
334 131
335/* IOCTL response timeout */132/* IOCTL response timeout */
336int dhd_ioctl_timeout_msec = IOCTL_RESP_TIMEOUT;133int brcmf_ioctl_timeout_msec = IOCTL_RESP_TIMEOUT;
337 134
338/* Idle timeout for backplane clock */135/* Idle timeout for backplane clock */
339int dhd_idletime = DHD_IDLETIME_TICKS;136int brcmf_idletime = BRCMF_IDLETIME_TICKS;
340module_param(dhd_idletime, int, 0);137module_param(brcmf_idletime, int, 0);
341 138
342/* Use polling */139/* Use polling */
343uint dhd_poll = false;140uint brcmf_poll;
344module_param(dhd_poll, uint, 0);141module_param(brcmf_poll, uint, 0);
345
346/* Use cfg80211 */
347uint dhd_cfg80211 = true;
348module_param(dhd_cfg80211, uint, 0);
349 142
350/* Use interrupts */143/* Use interrupts */
351uint dhd_intr = true;144uint brcmf_intr = true;
352module_param(dhd_intr, uint, 0);145module_param(brcmf_intr, uint, 0);
353 146
354/* SDIO Drive Strength (in milliamps) */147/* SDIO Drive Strength (in milliamps) */
355uint dhd_sdiod_drive_strength = 6;148uint brcmf_sdiod_drive_strength = 6;
356module_param(dhd_sdiod_drive_strength, uint, 0);149module_param(brcmf_sdiod_drive_strength, uint, 0);
357 150
358/* Tx/Rx bounds */151/* Tx/Rx bounds */
359extern uint dhd_txbound;152module_param(brcmf_txbound, uint, 0);
360extern uint dhd_rxbound;153module_param(brcmf_rxbound, uint, 0);
361module_param(dhd_txbound, uint, 0);
362module_param(dhd_rxbound, uint, 0);
363
364/* Deferred transmits */
365extern uint dhd_deferred_tx;
366module_param(dhd_deferred_tx, uint, 0);
367 154
368#ifdef SDTEST155#ifdef SDTEST
369/* Echo packet generator (pkts/s) */156/* Echo packet generator (pkts/s) */
370uint dhd_pktgen;157uint brcmf_pktgen;
371module_param(dhd_pktgen, uint, 0);158module_param(brcmf_pktgen, uint, 0);
372 159
373/* Echo packet len (0 => sawtooth, max 2040) */160/* Echo packet len (0 => sawtooth, max 2040) */
374uint dhd_pktgen_len;161uint brcmf_pktgen_len;
375module_param(dhd_pktgen_len, uint, 0);162module_param(brcmf_pktgen_len, uint, 0);
376#endif
377
378#define FAVORITE_WIFI_CP (!!dhd_cfg80211)
379#define IS_CFG80211_FAVORITE() FAVORITE_WIFI_CP
380#define DBG_CFG80211_GET() ((dhd_cfg80211 & WL_DBG_MASK) >> 1)
381#define NO_FW_REQ() (dhd_cfg80211 & 0x80)
382
383/* Version string to report */
384#ifdef DHD_DEBUG
385#define DHD_COMPILED "\nCompiled in " SRCBASE
386#else
387#define DHD_COMPILED
388#endif163#endif
389 164
390static void dhd_dpc(unsigned long data);165static int brcmf_toe_get(struct brcmf_info *drvr_priv, int idx, u32 *toe_ol);
391/* forward decl */166static int brcmf_toe_set(struct brcmf_info *drvr_priv, int idx, u32 toe_ol);
392extern int dhd_wait_pend8021x(struct net_device *dev);167static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
393 168 struct brcmf_event_msg *event_ptr,
394#ifdef TOE169 void **data_ptr);
395#ifndef BDC
396#error TOE requires BDC
397#endif /* !BDC */
398static int dhd_toe_get(dhd_info_t *dhd, int idx, u32 *toe_ol);
399static int dhd_toe_set(dhd_info_t *dhd, int idx, u32 toe_ol);
400#endif /* TOE */
401
402static int dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
403 wl_event_msg_t *event_ptr, void **data_ptr);
404
405#if defined(CONFIG_PM_SLEEP)
406static int dhd_sleep_pm_callback(struct notifier_block *nfb,
407 unsigned long action, void *ignored)
408{
409 switch (action) {
410 case PM_HIBERNATION_PREPARE:
411 case PM_SUSPEND_PREPARE:
412 atomic_set(&dhd_mmc_suspend, true);
413 return NOTIFY_OK;
414 case PM_POST_HIBERNATION:
415 case PM_POST_SUSPEND:
416 atomic_set(&dhd_mmc_suspend, false);
417 return NOTIFY_OK;
418 }
419 return 0;
420}
421
422static struct notifier_block dhd_sleep_pm_notifier = {
423 .notifier_call = dhd_sleep_pm_callback,
424 .priority = 0
425};
426
427extern int register_pm_notifier(struct notifier_block *nb);
428extern int unregister_pm_notifier(struct notifier_block *nb);
429#endif /* defined(CONFIG_PM_SLEEP) */
430 /* && defined(DHD_GPL) */
431static void dhd_set_packet_filter(int value, dhd_pub_t *dhd)
432{
433#ifdef PKT_FILTER_SUPPORT
434 DHD_TRACE(("%s: %d\n", __func__, value));
435 /* 1 - Enable packet filter, only allow unicast packet to send up */
436 /* 0 - Disable packet filter */
437 if (dhd_pkt_filter_enable) {
438 int i;
439
440 for (i = 0; i < dhd->pktfilter_count; i++) {
441 dhd_pktfilter_offload_set(dhd, dhd->pktfilter[i]);
442 dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i],
443 value, dhd_master_mode);
444 }
445 }
446#endif
447}
448
449#if defined(CONFIG_HAS_EARLYSUSPEND)
450static int dhd_set_suspend(int value, dhd_pub_t *dhd)
451{
452 int power_mode = PM_MAX;
453 /* wl_pkt_filter_enable_t enable_parm; */
454 char iovbuf[32];
455 int bcn_li_dtim = 3;
456#ifdef CUSTOMER_HW2
457 uint roamvar = 1;
458#endif /* CUSTOMER_HW2 */
459
460 DHD_TRACE(("%s: enter, value = %d in_suspend=%d\n",
461 __func__, value, dhd->in_suspend));
462
463 if (dhd && dhd->up) {
464 if (value && dhd->in_suspend) {
465
466 /* Kernel suspended */
467 DHD_TRACE(("%s: force extra Suspend setting\n",
468 __func__));
469
470 dhdcdc_set_ioctl(dhd, 0, WLC_SET_PM,
471 (char *)&power_mode,
472 sizeof(power_mode));
473
474 /* Enable packet filter, only allow unicast
475 packet to send up */
476 dhd_set_packet_filter(1, dhd);
477
478 /* if dtim skip setup as default force it
479 * to wake each third dtim
480 * for better power saving.
481 * Note that side effect is chance to miss BC/MC
482 * packet
483 */
484 if ((dhd->dtim_skip == 0) || (dhd->dtim_skip == 1))
485 bcn_li_dtim = 3;
486 else
487 bcn_li_dtim = dhd->dtim_skip;
488 bcm_mkiovar("bcn_li_dtim", (char *)&bcn_li_dtim,
489 4, iovbuf, sizeof(iovbuf));
490 dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
491 sizeof(iovbuf));
492#ifdef CUSTOMER_HW2
493 /* Disable build-in roaming to allowed \
494 * supplicant to take of romaing
495 */
496 bcm_mkiovar("roam_off", (char *)&roamvar, 4,
497 iovbuf, sizeof(iovbuf));
498 dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
499 sizeof(iovbuf));
500#endif /* CUSTOMER_HW2 */
501 } else {
502
503 /* Kernel resumed */
504 DHD_TRACE(("%s: Remove extra suspend setting\n",
505 __func__));
506
507 power_mode = PM_FAST;
508 dhdcdc_set_ioctl(dhd, 0, WLC_SET_PM,
509 (char *)&power_mode,
510 sizeof(power_mode));
511
512 /* disable pkt filter */
513 dhd_set_packet_filter(0, dhd);
514
515 /* restore pre-suspend setting for dtim_skip */
516 bcm_mkiovar("bcn_li_dtim", (char *)&dhd->dtim_skip,
517 4, iovbuf, sizeof(iovbuf));
518
519 dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
520 sizeof(iovbuf));
521#ifdef CUSTOMER_HW2
522 roamvar = 0;
523 bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf,
524 sizeof(iovbuf));
525 dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
526 sizeof(iovbuf));
527#endif /* CUSTOMER_HW2 */
528 }
529 }
530
531 return 0;
532}
533
534static void dhd_suspend_resume_helper(struct dhd_info *dhd, int val)
535{
536 dhd_pub_t *dhdp = &dhd->pub;
537
538 dhd_os_proto_block(dhdp);
539 /* Set flag when early suspend was called */
540 dhdp->in_suspend = val;
541 if (!dhdp->suspend_disable_flag)
542 dhd_set_suspend(val, dhdp);
543 dhd_os_proto_unblock(dhdp);
544}
545
546static void dhd_early_suspend(struct early_suspend *h)
547{
548 struct dhd_info *dhd = container_of(h, struct dhd_info, early_suspend);
549
550 DHD_TRACE(("%s: enter\n", __func__));
551
552 if (dhd)
553 dhd_suspend_resume_helper(dhd, 1);
554
555}
556
557static void dhd_late_resume(struct early_suspend *h)
558{
559 struct dhd_info *dhd = container_of(h, struct dhd_info, early_suspend);
560
561 DHD_TRACE(("%s: enter\n", __func__));
562
563 if (dhd)
564 dhd_suspend_resume_helper(dhd, 0);
565}
566#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */
567 170
568/*171/*
569 * Generalized timeout mechanism. Uses spin sleep with exponential172 * Generalized timeout mechanism. Uses spin sleep with exponential
570 * back-off until173 * back-off until
571 * the sleep time reaches one jiffy, then switches over to task delay. Usage:174 * the sleep time reaches one jiffy, then switches over to task delay. Usage:
572 *175 *
573 * dhd_timeout_start(&tmo, usec);176 * brcmf_timeout_start(&tmo, usec);
574 * while (!dhd_timeout_expired(&tmo))177 * while (!brcmf_timeout_expired(&tmo))
575 * if (poll_something())178 * if (poll_something())
576 * break;179 * break;
577 * if (dhd_timeout_expired(&tmo))180 * if (brcmf_timeout_expired(&tmo))
578 * fatal();181 * fatal();
579 */182 */
580 183
581void dhd_timeout_start(dhd_timeout_t *tmo, uint usec)184void brcmf_timeout_start(struct brcmf_timeout *tmo, uint usec)
582{185{
583 tmo->limit = usec;186 tmo->limit = usec;
584 tmo->increment = 0;187 tmo->increment = 0;
@@ -586,7 +189,7 @@ void dhd_timeout_start(dhd_timeout_t *tmo, uint usec) · 1 unmodified line
586 tmo->tick = 1000000 / HZ;189 tmo->tick = 1000000 / HZ;
587}190}
588 191
589int dhd_timeout_expired(dhd_timeout_t *tmo)192int brcmf_timeout_expired(struct brcmf_timeout *tmo)
590{193{
591 /* Does nothing the first call */194 /* Does nothing the first call */
592 if (tmo->increment == 0) {195 if (tmo->increment == 0) {
@@ -623,74 +226,68 @@ int dhd_timeout_expired(dhd_timeout_t *tmo) · 30 unmodified lines
623 return 0;226 return 0;
624}227}
625 228
626static int dhd_net2idx(dhd_info_t *dhd, struct net_device *net)229static int brcmf_net2idx(struct brcmf_info *drvr_priv, struct net_device *net)
627{230{
628 int i = 0;231 int i = 0;
629 232
630 ASSERT(dhd);233 while (i < BRCMF_MAX_IFS) {
631 while (i < DHD_MAX_IFS) {234 if (drvr_priv->iflist[i] && (drvr_priv->iflist[i]->net == net))
632 if (dhd->iflist[i] && (dhd->iflist[i]->net == net))
633 return i;235 return i;
634 i++;236 i++;
635 }237 }
636 238
637 return DHD_BAD_IF;239 return BRCMF_BAD_IF;
638}240}
639 241
640int dhd_ifname2idx(dhd_info_t *dhd, char *name)242int brcmf_ifname2idx(struct brcmf_info *drvr_priv, char *name)
641{243{
642 int i = DHD_MAX_IFS;244 int i = BRCMF_MAX_IFS;
643
644 ASSERT(dhd);
645 245
646 if (name == NULL || *name == '\0')246 if (name == NULL || *name == '\0')
647 return 0;247 return 0;
648 248
649 while (--i > 0)249 while (--i > 0)
650 if (dhd->iflist[i]250 if (drvr_priv->iflist[i]
651 && !strncmp(dhd->iflist[i]->name, name, IFNAMSIZ))251 && !strncmp(drvr_priv->iflist[i]->name, name, IFNAMSIZ))
652 break;252 break;
653 253
654 DHD_TRACE(("%s: return idx %d for \"%s\"\n", __func__, i, name));254 BRCMF_TRACE(("%s: return idx %d for \"%s\"\n", __func__, i, name));
655 255
656 return i; /* default - the primary interface */256 return i; /* default - the primary interface */
657}257}
658 258
659char *dhd_ifname(dhd_pub_t *dhdp, int ifidx)259char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
660{260{
661 dhd_info_t *dhd = (dhd_info_t *) dhdp->info;261 struct brcmf_info *drvr_priv = drvr->info;
662
663 ASSERT(dhd);
664 262
665 if (ifidx < 0 || ifidx >= DHD_MAX_IFS) {263 if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
666 DHD_ERROR(("%s: ifidx %d out of range\n", __func__, ifidx));264 BRCMF_ERROR(("%s: ifidx %d out of range\n", __func__, ifidx));
667 return "<if_bad>";265 return "<if_bad>";
668 }266 }
669 267
670 if (dhd->iflist[ifidx] == NULL) {268 if (drvr_priv->iflist[ifidx] == NULL) {
671 DHD_ERROR(("%s: null i/f %d\n", __func__, ifidx));269 BRCMF_ERROR(("%s: null i/f %d\n", __func__, ifidx));
672 return "<if_null>";270 return "<if_null>";
673 }271 }
674 272
675 if (dhd->iflist[ifidx]->net)273 if (drvr_priv->iflist[ifidx]->net)
676 return dhd->iflist[ifidx]->net->name;274 return drvr_priv->iflist[ifidx]->net->name;
677 275
678 return "<if_none>";276 return "<if_none>";
679}277}
680 278
681static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)279static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
682{280{
683 struct net_device *dev;281 struct net_device *dev;
684 struct netdev_hw_addr *ha;282 struct netdev_hw_addr *ha;
685 u32 allmulti, cnt;283 u32 allmulti, cnt;
686 284
687 wl_ioctl_t ioc;285 struct brcmf_ioctl ioc;
688 char *buf, *bufp;286 char *buf, *bufp;
689 uint buflen;287 uint buflen;
690 int ret;288 int ret;
691 289
692 ASSERT(dhd && dhd->iflist[ifidx]);290 dev = drvr_priv->iflist[ifidx]->net;
693 dev = dhd->iflist[ifidx]->net;
694 cnt = netdev_mc_count(dev);291 cnt = netdev_mc_count(dev);
695 292
696 /* Determine initial value of allmulti flag */293 /* Determine initial value of allmulti flag */
@@ -701,8 +298,8 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 4 unmodified lines
701 buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETH_ALEN);298 buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETH_ALEN);
702 bufp = buf = kmalloc(buflen, GFP_ATOMIC);299 bufp = buf = kmalloc(buflen, GFP_ATOMIC);
703 if (!bufp) {300 if (!bufp) {
704 DHD_ERROR(("%s: out of memory for mcast_list, cnt %d\n",301 BRCMF_ERROR(("%s: out of memory for mcast_list, cnt %d\n",
705 dhd_ifname(&dhd->pub, ifidx), cnt));302 brcmf_ifname(&drvr_priv->pub, ifidx), cnt));
706 return;303 return;
707 }304 }
708 305
@@ -722,15 +319,15 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 13 unmodified lines
722 }319 }
723 320
724 memset(&ioc, 0, sizeof(ioc));321 memset(&ioc, 0, sizeof(ioc));
725 ioc.cmd = WLC_SET_VAR;322 ioc.cmd = BRCMF_C_SET_VAR;
726 ioc.buf = buf;323 ioc.buf = buf;
727 ioc.len = buflen;324 ioc.len = buflen;
728 ioc.set = true;325 ioc.set = true;
729 326
730 ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);327 ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
731 if (ret < 0) {328 if (ret < 0) {
732 DHD_ERROR(("%s: set mcast_list failed, cnt %d\n",329 BRCMF_ERROR(("%s: set mcast_list failed, cnt %d\n",
733 dhd_ifname(&dhd->pub, ifidx), cnt));330 brcmf_ifname(&drvr_priv->pub, ifidx), cnt));
734 allmulti = cnt ? true : allmulti;331 allmulti = cnt ? true : allmulti;
735 }332 }
736 333
@@ -744,32 +341,33 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 7 unmodified lines
744 buflen = sizeof("allmulti") + sizeof(allmulti);341 buflen = sizeof("allmulti") + sizeof(allmulti);
745 buf = kmalloc(buflen, GFP_ATOMIC);342 buf = kmalloc(buflen, GFP_ATOMIC);
746 if (!buf) {343 if (!buf) {
747 DHD_ERROR(("%s: out of memory for allmulti\n",344 BRCMF_ERROR(("%s: out of memory for allmulti\n",
748 dhd_ifname(&dhd->pub, ifidx)));345 brcmf_ifname(&drvr_priv->pub, ifidx)));
749 return;346 return;
750 }347 }
751 allmulti = cpu_to_le32(allmulti);348 allmulti = cpu_to_le32(allmulti);
752 349
753 if (!bcm_mkiovar350 if (!brcmu_mkiovar
754 ("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) {351 ("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) {
755 DHD_ERROR(("%s: mkiovar failed for allmulti, datalen %d "352 BRCMF_ERROR(("%s: mkiovar failed for allmulti, datalen %d "
756 "buflen %u\n", dhd_ifname(&dhd->pub, ifidx),353 "buflen %u\n",
757 (int)sizeof(allmulti), buflen));354 brcmf_ifname(&drvr_priv->pub, ifidx),
355 (int)sizeof(allmulti), buflen));
758 kfree(buf);356 kfree(buf);
759 return;357 return;
760 }358 }
761 359
762 memset(&ioc, 0, sizeof(ioc));360 memset(&ioc, 0, sizeof(ioc));
763 ioc.cmd = WLC_SET_VAR;361 ioc.cmd = BRCMF_C_SET_VAR;
764 ioc.buf = buf;362 ioc.buf = buf;
765 ioc.len = buflen;363 ioc.len = buflen;
766 ioc.set = true;364 ioc.set = true;
767 365
768 ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);366 ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
769 if (ret < 0) {367 if (ret < 0) {
770 DHD_ERROR(("%s: set allmulti %d failed\n",368 BRCMF_ERROR(("%s: set allmulti %d failed\n",
771 dhd_ifname(&dhd->pub, ifidx),369 brcmf_ifname(&drvr_priv->pub, ifidx),
772 le32_to_cpu(allmulti)));370 le32_to_cpu(allmulti)));
773 }371 }
774 372
775 kfree(buf);373 kfree(buf);
@@ -781,45 +379,44 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 5 unmodified lines
781 allmulti = cpu_to_le32(allmulti);379 allmulti = cpu_to_le32(allmulti);
782 380
783 memset(&ioc, 0, sizeof(ioc));381 memset(&ioc, 0, sizeof(ioc));
784 ioc.cmd = WLC_SET_PROMISC;382 ioc.cmd = BRCMF_C_SET_PROMISC;
785 ioc.buf = &allmulti;383 ioc.buf = &allmulti;
786 ioc.len = sizeof(allmulti);384 ioc.len = sizeof(allmulti);
787 ioc.set = true;385 ioc.set = true;
788 386
789 ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);387 ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
790 if (ret < 0) {388 if (ret < 0) {
791 DHD_ERROR(("%s: set promisc %d failed\n",389 BRCMF_ERROR(("%s: set promisc %d failed\n",
792 dhd_ifname(&dhd->pub, ifidx),390 brcmf_ifname(&drvr_priv->pub, ifidx),
793 le32_to_cpu(allmulti)));391 le32_to_cpu(allmulti)));
794 }392 }
795}393}
796 394
797static int395static int _brcmf_set_mac_address(struct brcmf_info *drvr_priv, int ifidx, u8 *addr)
798_dhd_set_mac_address(dhd_info_t *dhd, int ifidx, u8 *addr)
799{396{
800 char buf[32];397 char buf[32];
801 wl_ioctl_t ioc;398 struct brcmf_ioctl ioc;
802 int ret;399 int ret;
803 400
804 DHD_TRACE(("%s enter\n", __func__));401 BRCMF_TRACE(("%s enter\n", __func__));
805 if (!bcm_mkiovar402 if (!brcmu_mkiovar
806 ("cur_etheraddr", (char *)addr, ETH_ALEN, buf, 32)) {403 ("cur_etheraddr", (char *)addr, ETH_ALEN, buf, 32)) {
807 DHD_ERROR(("%s: mkiovar failed for cur_etheraddr\n",404 BRCMF_ERROR(("%s: mkiovar failed for cur_etheraddr\n",
808 dhd_ifname(&dhd->pub, ifidx)));405 brcmf_ifname(&drvr_priv->pub, ifidx)));
809 return -1;406 return -1;
810 }407 }
811 memset(&ioc, 0, sizeof(ioc));408 memset(&ioc, 0, sizeof(ioc));
812 ioc.cmd = WLC_SET_VAR;409 ioc.cmd = BRCMF_C_SET_VAR;
813 ioc.buf = buf;410 ioc.buf = buf;
814 ioc.len = 32;411 ioc.len = 32;
815 ioc.set = true;412 ioc.set = true;
816 413
817 ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);414 ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
818 if (ret < 0) {415 if (ret < 0) {
819 DHD_ERROR(("%s: set cur_etheraddr failed\n",416 BRCMF_ERROR(("%s: set cur_etheraddr failed\n",
820 dhd_ifname(&dhd->pub, ifidx)));417 brcmf_ifname(&drvr_priv->pub, ifidx)));
821 } else {418 } else {
822 memcpy(dhd->iflist[ifidx]->net->dev_addr, addr, ETH_ALEN);419 memcpy(drvr_priv->iflist[ifidx]->net->dev_addr, addr, ETH_ALEN);
823 }420 }
824 421
825 return ret;422 return ret;
@@ -829,45 +426,44 @@ _dhd_set_mac_address(dhd_info_t *dhd, int ifidx, u8 *addr) · 3 unmodified lines
829extern struct net_device *ap_net_dev;426extern struct net_device *ap_net_dev;
830#endif427#endif
831 428
832static void dhd_op_if(dhd_if_t *ifp)429/* Virtual interfaces only ((ifp && ifp->info && ifp->idx == true) */
430static void brcmf_op_if(struct brcmf_if *ifp)
833{431{
834 dhd_info_t *dhd;432 struct brcmf_info *drvr_priv;
835 int ret = 0, err = 0;433 int ret = 0, err = 0;
836 434
837 ASSERT(ifp && ifp->info && ifp->idx); /* Virtual interfaces only */435 drvr_priv = ifp->info;
838
839 dhd = ifp->info;
840 436
841 DHD_TRACE(("%s: idx %d, state %d\n", __func__, ifp->idx, ifp->state));437 BRCMF_TRACE(("%s: idx %d, state %d\n", __func__, ifp->idx, ifp->state));
842 438
843 switch (ifp->state) {439 switch (ifp->state) {
844 case WLC_E_IF_ADD:440 case BRCMF_E_IF_ADD:
845 /*441 /*
846 * Delete the existing interface before overwriting it442 * Delete the existing interface before overwriting it
847 * in case we missed the WLC_E_IF_DEL event.443 * in case we missed the BRCMF_E_IF_DEL event.
848 */444 */
849 if (ifp->net != NULL) {445 if (ifp->net != NULL) {
850 DHD_ERROR(("%s: ERROR: netdev:%s already exists, "446 BRCMF_ERROR(("%s: ERROR: netdev:%s already exists, "
851 "try free & unregister\n",447 "try free & unregister\n",
852 __func__, ifp->net->name));448 __func__, ifp->net->name));
853 netif_stop_queue(ifp->net);449 netif_stop_queue(ifp->net);
854 unregister_netdev(ifp->net);450 unregister_netdev(ifp->net);
855 free_netdev(ifp->net);451 free_netdev(ifp->net);
856 }452 }
857 /* Allocate etherdev, including space for private structure */453 /* Allocate etherdev, including space for private structure */
858 ifp->net = alloc_etherdev(sizeof(dhd));454 ifp->net = alloc_etherdev(sizeof(drvr_priv));
859 if (!ifp->net) {455 if (!ifp->net) {
860 DHD_ERROR(("%s: OOM - alloc_etherdev\n", __func__));456 BRCMF_ERROR(("%s: OOM - alloc_etherdev\n", __func__));
861 ret = -ENOMEM;457 ret = -ENOMEM;
862 }458 }
863 if (ret == 0) {459 if (ret == 0) {
864 strcpy(ifp->net->name, ifp->name);460 strcpy(ifp->net->name, ifp->name);
865 memcpy(netdev_priv(ifp->net), &dhd, sizeof(dhd));461 memcpy(netdev_priv(ifp->net), &drvr_priv, sizeof(drvr_priv));
866 err = dhd_net_attach(&dhd->pub, ifp->idx);462 err = brcmf_net_attach(&drvr_priv->pub, ifp->idx);
867 if (err != 0) {463 if (err != 0) {
868 DHD_ERROR(("%s: dhd_net_attach failed, "464 BRCMF_ERROR(("%s: brcmf_net_attach failed, "
869 "err %d\n",465 "err %d\n",
870 __func__, err));466 __func__, err));
871 ret = -EOPNOTSUPP;467 ret = -EOPNOTSUPP;
872 } else {468 } else {
873#ifdef SOFTAP469#ifdef SOFTAP
@@ -882,26 +478,25 @@ static void dhd_op_if(dhd_if_t *ifp) · 8 unmodified lines
882 wl0.1 is ready */478 wl0.1 is ready */
883 up(&ap_eth_sema);479 up(&ap_eth_sema);
884#endif480#endif
885 DHD_TRACE(("\n ==== pid:%x, net_device for "481 BRCMF_TRACE(("\n ==== pid:%x, net_device for "
886 "if:%s created ===\n\n",482 "if:%s created ===\n\n",
887 current->pid, ifp->net->name));483 current->pid, ifp->net->name));
888 ifp->state = 0;484 ifp->state = 0;
889 }485 }
890 }486 }
891 break;487 break;
892 case WLC_E_IF_DEL:488 case BRCMF_E_IF_DEL:
893 if (ifp->net != NULL) {489 if (ifp->net != NULL) {
894 DHD_TRACE(("\n%s: got 'WLC_E_IF_DEL' state\n",490 BRCMF_TRACE(("\n%s: got 'WLC_E_IF_DEL' state\n",
895 __func__));491 __func__));
896 netif_stop_queue(ifp->net);492 netif_stop_queue(ifp->net);
897 unregister_netdev(ifp->net);493 unregister_netdev(ifp->net);
898 ret = DHD_DEL_IF; /* Make sure the free_netdev()494 ret = BRCMF_DEL_IF; /* Make sure the free_netdev()
899 is called */495 is called */
900 }496 }
901 break;497 break;
902 default:498 default:
903 DHD_ERROR(("%s: bad op %d\n", __func__, ifp->state));499 BRCMF_ERROR(("%s: bad op %d\n", __func__, ifp->state));
904 ASSERT(!ifp->state);
905 break;500 break;
906 }501 }
907 502
@@ -909,7 +504,7 @@ static void dhd_op_if(dhd_if_t *ifp) · 1 unmodified line
909 if (ifp->net)504 if (ifp->net)
910 free_netdev(ifp->net);505 free_netdev(ifp->net);
911 506
912 dhd->iflist[ifp->idx] = NULL;507 drvr_priv->iflist[ifp->idx] = NULL;
913 kfree(ifp);508 kfree(ifp);
914#ifdef SOFTAP509#ifdef SOFTAP
915 if (ifp->net == ap_net_dev)510 if (ifp->net == ap_net_dev)
@@ -919,9 +514,9 @@ static void dhd_op_if(dhd_if_t *ifp) · 3 unmodified lines
919 }514 }
920}515}
921 516
922static int _dhd_sysioc_thread(void *data)517static int _brcmf_sysioc_thread(void *data)
923{518{
924 dhd_info_t *dhd = (dhd_info_t *) data;519 struct brcmf_info *drvr_priv = (struct brcmf_info *) data;
925 int i;520 int i;
926#ifdef SOFTAP521#ifdef SOFTAP
927 bool in_ap = false;522 bool in_ap = false;
@@ -929,46 +524,51 @@ static int _dhd_sysioc_thread(void *data) · 1 unmodified line
929 524
930 allow_signal(SIGTERM);525 allow_signal(SIGTERM);
931 526
932 while (down_interruptible(&dhd->sysioc_sem) == 0) {527 while (down_interruptible(&drvr_priv->sysioc_sem) == 0) {
933 if (kthread_should_stop())528 if (kthread_should_stop())
934 break;529 break;
935 for (i = 0; i < DHD_MAX_IFS; i++) {530 for (i = 0; i < BRCMF_MAX_IFS; i++) {
936 if (dhd->iflist[i]) {531 struct brcmf_if *ifentry = drvr_priv->iflist[i];
532 if (ifentry) {
937#ifdef SOFTAP533#ifdef SOFTAP
938 in_ap = (ap_net_dev != NULL);534 in_ap = (ap_net_dev != NULL);
939#endif /* SOFTAP */535#endif /* SOFTAP */
940 if (dhd->iflist[i]->state)536 if (ifentry->state)
941 dhd_op_if(dhd->iflist[i]);537 brcmf_op_if(ifentry);
942#ifdef SOFTAP538#ifdef SOFTAP
943 if (dhd->iflist[i] == NULL) {539 if (drvr_priv->iflist[i] == NULL) {
944 DHD_TRACE(("\n\n %s: interface %d "540 BRCMF_TRACE(("\n\n %s: interface %d "
945 "removed!\n", __func__, i));541 "removed!\n", __func__,
542 i));
946 continue;543 continue;
947 }544 }
948 545
949 if (in_ap && dhd->set_macaddress) {546 if (in_ap && drvr_priv->set_macaddress) {
950 DHD_TRACE(("attempt to set MAC for %s "547 BRCMF_TRACE(("attempt to set MAC for"
951 "in AP Mode," "blocked. \n",548 " %s in AP Mode,"
952 dhd->iflist[i]->net->name));549 " blocked.\n",
953 dhd->set_macaddress = false;550 ifentry->net->name));
551 drvr_priv->set_macaddress = false;
954 continue;552 continue;
955 }553 }
956 554
957 if (in_ap && dhd->set_multicast) {555 if (in_ap && drvr_priv->set_multicast) {
958 DHD_TRACE(("attempt to set MULTICAST list for %s" "in AP Mode, blocked. \n",556 BRCMF_TRACE(("attempt to set MULTICAST "
959 dhd->iflist[i]->net->name));557 "list for %s in AP Mode, "
960 dhd->set_multicast = false;558 "blocked.\n",
559 ifentry->net->name));
560 drvr_priv->set_multicast = false;
961 continue;561 continue;
962 }562 }
963#endif /* SOFTAP */563#endif /* SOFTAP */
964 if (dhd->set_multicast) {564 if (drvr_priv->set_multicast) {
965 dhd->set_multicast = false;565 drvr_priv->set_multicast = false;
966 _dhd_set_multicast_list(dhd, i);566 _brcmf_set_multicast_list(drvr_priv, i);
967 }567 }
968 if (dhd->set_macaddress) {568 if (drvr_priv->set_macaddress) {
969 dhd->set_macaddress = false;569 drvr_priv->set_macaddress = false;
970 _dhd_set_mac_address(dhd, i,570 _brcmf_set_mac_address(drvr_priv, i,
971 dhd->macvalue);571 drvr_priv->macvalue);
972 }572 }
973 }573 }
974 }574 }
@@ -976,47 +576,44 @@ static int _dhd_sysioc_thread(void *data) · 1 unmodified line
976 return 0;576 return 0;
977}577}
978 578
979static int dhd_set_mac_address(struct net_device *dev, void *addr)579static int brcmf_netdev_set_mac_address(struct net_device *dev, void *addr)
980{580{
981 int ret = 0;581 int ret = 0;
982 582
983 dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(dev);583 struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(dev);
984 struct sockaddr *sa = (struct sockaddr *)addr;584 struct sockaddr *sa = (struct sockaddr *)addr;
985 int ifidx;585 int ifidx;
986 586
987 ifidx = dhd_net2idx(dhd, dev);587 ifidx = brcmf_net2idx(drvr_priv, dev);
988 if (ifidx == DHD_BAD_IF)588 if (ifidx == BRCMF_BAD_IF)
989 return -1;589 return -1;
990 590
991 ASSERT(dhd->sysioc_tsk);591 memcpy(&drvr_priv->macvalue, sa->sa_data, ETH_ALEN);
992 memcpy(&dhd->macvalue, sa->sa_data, ETH_ALEN);592 drvr_priv->set_macaddress = true;
993 dhd->set_macaddress = true;593 up(&drvr_priv->sysioc_sem);
994 up(&dhd->sysioc_sem);
995 594
996 return ret;595 return ret;
997}596}
998 597
999static void dhd_set_multicast_list(struct net_device *dev)598static void brcmf_netdev_set_multicast_list(struct net_device *dev)
1000{599{
1001 dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(dev);600 struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(dev);
1002 int ifidx;601 int ifidx;
1003 602
1004 ifidx = dhd_net2idx(dhd, dev);603 ifidx = brcmf_net2idx(drvr_priv, dev);
1005 if (ifidx == DHD_BAD_IF)604 if (ifidx == BRCMF_BAD_IF)
1006 return;605 return;
1007 606
1008 ASSERT(dhd->sysioc_tsk);607 drvr_priv->set_multicast = true;
1009 dhd->set_multicast = true;608 up(&drvr_priv->sysioc_sem);
1010 up(&dhd->sysioc_sem);
1011}609}
1012 610
1013int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)611int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx, struct sk_buff *pktbuf)
1014{612{
1015 int ret;613 struct brcmf_info *drvr_priv = drvr->info;
1016 dhd_info_t *dhd = (dhd_info_t *) (dhdp->info);
1017 614
1018 /* Reject if down */615 /* Reject if down */
1019 if (!dhdp->up || (dhdp->busstate == DHD_BUS_DOWN))616 if (!drvr->up || (drvr->busstate == BRCMF_BUS_DOWN))
1020 return -ENODEV;617 return -ENODEV;
1021 618
1022 /* Update multicast statistic */619 /* Update multicast statistic */
@@ -1025,143 +622,107 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf) · 2 unmodified lines
1025 struct ethhdr *eh = (struct ethhdr *)pktdata;622 struct ethhdr *eh = (struct ethhdr *)pktdata;
1026 623
1027 if (is_multicast_ether_addr(eh->h_dest))624 if (is_multicast_ether_addr(eh->h_dest))
1028 dhdp->tx_multicast++;625 drvr->tx_multicast++;
1029 if (ntohs(eh->h_proto) == ETH_P_PAE)626 if (ntohs(eh->h_proto) == ETH_P_PAE)
1030 atomic_inc(&dhd->pend_8021x_cnt);627 atomic_inc(&drvr_priv->pend_8021x_cnt);
1031 }628 }
1032 629
1033 /* If the protocol uses a data header, apply it */630 /* If the protocol uses a data header, apply it */
1034 dhd_prot_hdrpush(dhdp, ifidx, pktbuf);631 brcmf_proto_hdrpush(drvr, ifidx, pktbuf);
1035 632
1036 /* Use bus module to send data frame */633 /* Use bus module to send data frame */
1037#ifdef BCMDBUS634 return brcmf_sdbrcm_bus_txdata(drvr->bus, pktbuf);
1038 ret = dbus_send_pkt(dhdp->dbus, pktbuf, NULL /* pktinfo */);
1039#else
1040 ret = dhd_bus_txdata(dhdp->bus, pktbuf);
1041#endif /* BCMDBUS */
1042
1043 return ret;
1044}
1045
1046static inline void *
1047osl_pkt_frmnative(struct sk_buff *skb)
1048{
1049 return (void *)skb;
1050}
1051#define PKTFRMNATIVE(osh, skb) \
1052 osl_pkt_frmnative((struct sk_buff *)(skb))
1053
1054static inline struct sk_buff *
1055osl_pkt_tonative(void *pkt)
1056{
1057 return (struct sk_buff *)pkt;
1058}635}
1059#define PKTTONATIVE(osh, pkt) \
1060 osl_pkt_tonative((pkt))
1061 636
1062static int dhd_start_xmit(struct sk_buff *skb, struct net_device *net)637static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *net)
1063{638{
1064 int ret;639 int ret;
1065 void *pktbuf;640 struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
1066 dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
1067 int ifidx;641 int ifidx;
1068 642
1069 DHD_TRACE(("%s: Enter\n", __func__));643 BRCMF_TRACE(("%s: Enter\n", __func__));
1070 644
1071 /* Reject if down */645 /* Reject if down */
1072 if (!dhd->pub.up || (dhd->pub.busstate == DHD_BUS_DOWN)) {646 if (!drvr_priv->pub.up || (drvr_priv->pub.busstate == BRCMF_BUS_DOWN)) {
1073 DHD_ERROR(("%s: xmit rejected pub.up=%d busstate=%d\n",647 BRCMF_ERROR(("%s: xmit rejected pub.up=%d busstate=%d\n",
1074 __func__, dhd->pub.up, dhd->pub.busstate));648 __func__, drvr_priv->pub.up,
649 drvr_priv->pub.busstate));
1075 netif_stop_queue(net);650 netif_stop_queue(net);
1076 return -ENODEV;651 return -ENODEV;
1077 }652 }
1078 653
1079 ifidx = dhd_net2idx(dhd, net);654 ifidx = brcmf_net2idx(drvr_priv, net);
1080 if (ifidx == DHD_BAD_IF) {655 if (ifidx == BRCMF_BAD_IF) {
1081 DHD_ERROR(("%s: bad ifidx %d\n", __func__, ifidx));656 BRCMF_ERROR(("%s: bad ifidx %d\n", __func__, ifidx));
1082 netif_stop_queue(net);657 netif_stop_queue(net);
1083 return -ENODEV;658 return -ENODEV;
1084 }659 }
1085 660
1086 /* Make sure there's enough room for any header */661 /* Make sure there's enough room for any header */
1087 if (skb_headroom(skb) < dhd->pub.hdrlen) {662 if (skb_headroom(skb) < drvr_priv->pub.hdrlen) {
1088 struct sk_buff *skb2;663 struct sk_buff *skb2;
1089 664
1090 DHD_INFO(("%s: insufficient headroom\n",665 BRCMF_INFO(("%s: insufficient headroom\n",
1091 dhd_ifname(&dhd->pub, ifidx)));666 brcmf_ifname(&drvr_priv->pub, ifidx)));
1092 dhd->pub.tx_realloc++;667 drvr_priv->pub.tx_realloc++;
1093 skb2 = skb_realloc_headroom(skb, dhd->pub.hdrlen);668 skb2 = skb_realloc_headroom(skb, drvr_priv->pub.hdrlen);
1094 dev_kfree_skb(skb);669 dev_kfree_skb(skb);
1095 skb = skb2;670 skb = skb2;
1096 if (skb == NULL) {671 if (skb == NULL) {
1097 DHD_ERROR(("%s: skb_realloc_headroom failed\n",672 BRCMF_ERROR(("%s: skb_realloc_headroom failed\n",
1098 dhd_ifname(&dhd->pub, ifidx)));673 brcmf_ifname(&drvr_priv->pub, ifidx)));
1099 ret = -ENOMEM;674 ret = -ENOMEM;
1100 goto done;675 goto done;
1101 }676 }
1102 }677 }
1103 678
1104 /* Convert to packet */679 ret = brcmf_sendpkt(&drvr_priv->pub, ifidx, skb);
1105 pktbuf = PKTFRMNATIVE(dhd->pub.osh, skb);
1106 if (!pktbuf) {
1107 DHD_ERROR(("%s: PKTFRMNATIVE failed\n",
1108 dhd_ifname(&dhd->pub, ifidx)));
1109 dev_kfree_skb_any(skb);
1110 ret = -ENOMEM;
1111 goto done;
1112 }
1113
1114 ret = dhd_sendpkt(&dhd->pub, ifidx, pktbuf);
1115 680
1116done:681done:
1117 if (ret)682 if (ret)
1118 dhd->pub.dstats.tx_dropped++;683 drvr_priv->pub.dstats.tx_dropped++;
1119 else684 else
1120 dhd->pub.tx_packets++;685 drvr_priv->pub.tx_packets++;
1121 686
1122 /* Return ok: we always eat the packet */687 /* Return ok: we always eat the packet */
1123 return 0;688 return 0;
1124}689}
1125 690
1126void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool state)691void brcmf_txflowcontrol(struct brcmf_pub *drvr, int ifidx, bool state)
1127{692{
1128 struct net_device *net;693 struct net_device *net;
1129 dhd_info_t *dhd = dhdp->info;694 struct brcmf_info *drvr_priv = drvr->info;
1130 695
1131 DHD_TRACE(("%s: Enter\n", __func__));696 BRCMF_TRACE(("%s: Enter\n", __func__));
1132 697
1133 dhdp->txoff = state;698 drvr->txoff = state;
1134 ASSERT(dhd && dhd->iflist[ifidx]);699 net = drvr_priv->iflist[ifidx]->net;
1135 net = dhd->iflist[ifidx]->net;
1136 if (state == ON)700 if (state == ON)
1137 netif_stop_queue(net);701 netif_stop_queue(net);
1138 else702 else
1139 netif_wake_queue(net);703 netif_wake_queue(net);
1140}704}
1141 705
1142void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf,706void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, struct sk_buff *skb,
1143 int numpkt)707 int numpkt)
1144{708{
1145 dhd_info_t *dhd = (dhd_info_t *) dhdp->info;709 struct brcmf_info *drvr_priv = drvr->info;
1146 struct sk_buff *skb;
1147 unsigned char *eth;710 unsigned char *eth;
1148 uint len;711 uint len;
1149 void *data;712 void *data;
1150 struct sk_buff *pnext, *save_pktbuf;713 struct sk_buff *pnext, *save_pktbuf;
1151 int i;714 int i;
1152 dhd_if_t *ifp;715 struct brcmf_if *ifp;
1153 wl_event_msg_t event;716 struct brcmf_event_msg event;
1154
1155 DHD_TRACE(("%s: Enter\n", __func__));
1156 717
1157 save_pktbuf = pktbuf;718 BRCMF_TRACE(("%s: Enter\n", __func__));
1158 719
1159 for (i = 0; pktbuf && i < numpkt; i++, pktbuf = pnext) {720 save_pktbuf = skb;
1160 721
1161 pnext = pktbuf->next;722 for (i = 0; skb && i < numpkt; i++, skb = pnext) {
1162 pktbuf->next = NULL;
1163 723
1164 skb = PKTTONATIVE(dhdp->osh, pktbuf);724 pnext = skb->next;
725 skb->next = NULL;
1165 726
1166 /* Get the protocol, maintain skb around eth_type_trans()727 /* Get the protocol, maintain skb around eth_type_trans()
1167 * The main reason for this hack is for the limitation of728 * The main reason for this hack is for the limitation of
@@ -1178,16 +739,15 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, · 10 unmodified lines
1178 eth = skb->data;739 eth = skb->data;
1179 len = skb->len;740 len = skb->len;
1180 741
1181 ifp = dhd->iflist[ifidx];742 ifp = drvr_priv->iflist[ifidx];
1182 if (ifp == NULL)743 if (ifp == NULL)
1183 ifp = dhd->iflist[0];744 ifp = drvr_priv->iflist[0];
1184 745
1185 ASSERT(ifp);
1186 skb->dev = ifp->net;746 skb->dev = ifp->net;
1187 skb->protocol = eth_type_trans(skb, skb->dev);747 skb->protocol = eth_type_trans(skb, skb->dev);
1188 748
1189 if (skb->pkt_type == PACKET_MULTICAST)749 if (skb->pkt_type == PACKET_MULTICAST)
1190 dhd->pub.rx_multicast++;750 drvr_priv->pub.rx_multicast++;
1191 751
1192 skb->data = eth;752 skb->data = eth;
1193 skb->len = len;753 skb->len = len;
@@ -1196,20 +756,20 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, · 2 unmodified lines
1196 skb_pull(skb, ETH_HLEN);756 skb_pull(skb, ETH_HLEN);
1197 757
1198 /* Process special event packets and then discard them */758 /* Process special event packets and then discard them */
1199 if (ntohs(skb->protocol) == ETH_P_BRCM)759 if (ntohs(skb->protocol) == ETH_P_LINK_CTL)
1200 dhd_wl_host_event(dhd, &ifidx,760 brcmf_host_event(drvr_priv, &ifidx,
1201 skb_mac_header(skb),761 skb_mac_header(skb),
1202 &event, &data);762 &event, &data);
1203 763
1204 ASSERT(ifidx < DHD_MAX_IFS && dhd->iflist[ifidx]);764 if (drvr_priv->iflist[ifidx] &&
1205 if (dhd->iflist[ifidx] && !dhd->iflist[ifidx]->state)765 !drvr_priv->iflist[ifidx]->state)
1206 ifp = dhd->iflist[ifidx];766 ifp = drvr_priv->iflist[ifidx];
1207 767
1208 if (ifp->net)768 if (ifp->net)
1209 ifp->net->last_rx = jiffies;769 ifp->net->last_rx = jiffies;
1210 770
1211 dhdp->dstats.rx_bytes += skb->len;771 drvr->dstats.rx_bytes += skb->len;
1212 dhdp->rx_packets++; /* Local count */772 drvr->rx_packets++; /* Local count */
1213 773
1214 if (in_interrupt()) {774 if (in_interrupt()) {
1215 netif_rx(skb);775 netif_rx(skb);
@@ -1225,216 +785,83 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, · 9 unmodified lines
1225 }785 }
1226}786}
1227 787
1228void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx)788void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp, bool success)
1229{
1230 /* Linux version has nothing to do */
1231 return;
1232}
1233
1234void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success)
1235{789{
1236 uint ifidx;790 uint ifidx;
1237 dhd_info_t *dhd = (dhd_info_t *) (dhdp->info);791 struct brcmf_info *drvr_priv = drvr->info;
1238 struct ethhdr *eh;792 struct ethhdr *eh;
1239 u16 type;793 u16 type;
1240 794
1241 dhd_prot_hdrpull(dhdp, &ifidx, txp);795 brcmf_proto_hdrpull(drvr, &ifidx, txp);
1242 796
1243 eh = (struct ethhdr *)(txp->data);797 eh = (struct ethhdr *)(txp->data);
1244 type = ntohs(eh->h_proto);798 type = ntohs(eh->h_proto);
1245 799
1246 if (type == ETH_P_PAE)800 if (type == ETH_P_PAE)
1247 atomic_dec(&dhd->pend_8021x_cnt);801 atomic_dec(&drvr_priv->pend_8021x_cnt);
1248 802
1249}803}
1250 804
1251static struct net_device_stats *dhd_get_stats(struct net_device *net)805static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *net)
1252{806{
1253 dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);807 struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
1254 dhd_if_t *ifp;808 struct brcmf_if *ifp;
1255 int ifidx;809 int ifidx;
1256 810
1257 DHD_TRACE(("%s: Enter\n", __func__));811 BRCMF_TRACE(("%s: Enter\n", __func__));
1258 812
1259 ifidx = dhd_net2idx(dhd, net);813 ifidx = brcmf_net2idx(drvr_priv, net);
1260 if (ifidx == DHD_BAD_IF)814 if (ifidx == BRCMF_BAD_IF)
1261 return NULL;815 return NULL;
1262 816
1263 ifp = dhd->iflist[ifidx];817 ifp = drvr_priv->iflist[ifidx];
1264 ASSERT(dhd && ifp);
1265 818
1266 if (dhd->pub.up) {819 if (drvr_priv->pub.up) {
1267 /* Use the protocol to get dongle stats */820 /* Use the protocol to get dongle stats */
1268 dhd_prot_dstats(&dhd->pub);821 brcmf_proto_dstats(&drvr_priv->pub);
1269 }822 }
1270 823
1271 /* Copy dongle stats to net device stats */824 /* Copy dongle stats to net device stats */
1272 ifp->stats.rx_packets = dhd->pub.dstats.rx_packets;825 ifp->stats.rx_packets = drvr_priv->pub.dstats.rx_packets;
1273 ifp->stats.tx_packets = dhd->pub.dstats.tx_packets;826 ifp->stats.tx_packets = drvr_priv->pub.dstats.tx_packets;
1274 ifp->stats.rx_bytes = dhd->pub.dstats.rx_bytes;827 ifp->stats.rx_bytes = drvr_priv->pub.dstats.rx_bytes;
1275 ifp->stats.tx_bytes = dhd->pub.dstats.tx_bytes;828 ifp->stats.tx_bytes = drvr_priv->pub.dstats.tx_bytes;
1276 ifp->stats.rx_errors = dhd->pub.dstats.rx_errors;829 ifp->stats.rx_errors = drvr_priv->pub.dstats.rx_errors;
1277 ifp->stats.tx_errors = dhd->pub.dstats.tx_errors;830 ifp->stats.tx_errors = drvr_priv->pub.dstats.tx_errors;
1278 ifp->stats.rx_dropped = dhd->pub.dstats.rx_dropped;831 ifp->stats.rx_dropped = drvr_priv->pub.dstats.rx_dropped;
1279 ifp->stats.tx_dropped = dhd->pub.dstats.tx_dropped;832 ifp->stats.tx_dropped = drvr_priv->pub.dstats.tx_dropped;
1280 ifp->stats.multicast = dhd->pub.dstats.multicast;833 ifp->stats.multicast = drvr_priv->pub.dstats.multicast;
1281 834
1282 return &ifp->stats;835 return &ifp->stats;
1283}836}
1284 837
1285static int dhd_watchdog_thread(void *data)
1286{
1287 dhd_info_t *dhd = (dhd_info_t *) data;
1288
1289 /* This thread doesn't need any user-level access,
1290 * so get rid of all our resources
1291 */
1292#ifdef DHD_SCHED
1293 if (dhd_watchdog_prio > 0) {
1294 struct sched_param param;
1295 param.sched_priority = (dhd_watchdog_prio < MAX_RT_PRIO) ?
1296 dhd_watchdog_prio : (MAX_RT_PRIO - 1);
1297 setScheduler(current, SCHED_FIFO, &param);
1298 }
1299#endif /* DHD_SCHED */
1300
1301 allow_signal(SIGTERM);
1302 /* Run until signal received */
1303 while (1) {
1304 if (kthread_should_stop())
1305 break;
1306 if (down_interruptible(&dhd->watchdog_sem) == 0) {
1307 if (dhd->pub.dongle_reset == false) {
1308 /* Call the bus module watchdog */
1309 dhd_bus_watchdog(&dhd->pub);
1310 }
1311 /* Count the tick for reference */
1312 dhd->pub.tickcnt++;
1313 } else
1314 break;
1315 }
1316 return 0;
1317}
1318
1319static void dhd_watchdog(unsigned long data)
1320{
1321 dhd_info_t *dhd = (dhd_info_t *) data;
1322
1323 if (dhd->watchdog_tsk) {
1324 up(&dhd->watchdog_sem);
1325
1326 /* Reschedule the watchdog */
1327 if (dhd->wd_timer_valid) {
1328 mod_timer(&dhd->timer,
1329 jiffies + dhd_watchdog_ms * HZ / 1000);
1330 }
1331 return;
1332 }
1333
1334 /* Call the bus module watchdog */
1335 dhd_bus_watchdog(&dhd->pub);
1336
1337 /* Count the tick for reference */
1338 dhd->pub.tickcnt++;
1339
1340 /* Reschedule the watchdog */
1341 if (dhd->wd_timer_valid)
1342 mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
1343}
1344
1345static int dhd_dpc_thread(void *data)
1346{
1347 dhd_info_t *dhd = (dhd_info_t *) data;
1348
1349 /* This thread doesn't need any user-level access,
1350 * so get rid of all our resources
1351 */
1352#ifdef DHD_SCHED
1353 if (dhd_dpc_prio > 0) {
1354 struct sched_param param;
1355 param.sched_priority =
1356 (dhd_dpc_prio <
1357 MAX_RT_PRIO) ? dhd_dpc_prio : (MAX_RT_PRIO - 1);
1358 setScheduler(current, SCHED_FIFO, &param);
1359 }
1360#endif /* DHD_SCHED */
1361
1362 allow_signal(SIGTERM);
1363 /* Run until signal received */
1364 while (1) {
1365 if (kthread_should_stop())
1366 break;
1367 if (down_interruptible(&dhd->dpc_sem) == 0) {
1368 /* Call bus dpc unless it indicated down
1369 (then clean stop) */
1370 if (dhd->pub.busstate != DHD_BUS_DOWN) {
1371 if (dhd_bus_dpc(dhd->pub.bus)) {
1372 up(&dhd->dpc_sem);
1373 }
1374 } else {
1375 dhd_bus_stop(dhd->pub.bus, true);
1376 }
1377 } else
1378 break;
1379 }
1380 return 0;
1381}
1382
1383static void dhd_dpc(unsigned long data)
1384{
1385 dhd_info_t *dhd;
1386
1387 dhd = (dhd_info_t *) data;
1388
1389 /* Call bus dpc unless it indicated down (then clean stop) */
1390 if (dhd->pub.busstate != DHD_BUS_DOWN) {
1391 if (dhd_bus_dpc(dhd->pub.bus))
1392 tasklet_schedule(&dhd->tasklet);
1393 } else {
1394 dhd_bus_stop(dhd->pub.bus, true);
1395 }
1396}
1397
1398void dhd_sched_dpc(dhd_pub_t *dhdp)
1399{
1400 dhd_info_t *dhd = (dhd_info_t *) dhdp->info;
1401
1402 if (dhd->dpc_tsk) {
1403 up(&dhd->dpc_sem);
1404 return;
1405 }
1406
1407 tasklet_schedule(&dhd->tasklet);
1408}
1409
1410#ifdef TOE
1411/* Retrieve current toe component enables, which are kept838/* Retrieve current toe component enables, which are kept
1412 as a bitmap in toe_ol iovar */839 as a bitmap in toe_ol iovar */
1413static int dhd_toe_get(dhd_info_t *dhd, int ifidx, u32 *toe_ol)840static int brcmf_toe_get(struct brcmf_info *drvr_priv, int ifidx, u32 *toe_ol)
1414{841{
1415 wl_ioctl_t ioc;842 struct brcmf_ioctl ioc;
1416 char buf[32];843 char buf[32];
1417 int ret;844 int ret;
1418 845
1419 memset(&ioc, 0, sizeof(ioc));846 memset(&ioc, 0, sizeof(ioc));
1420 847
1421 ioc.cmd = WLC_GET_VAR;848 ioc.cmd = BRCMF_C_GET_VAR;
1422 ioc.buf = buf;849 ioc.buf = buf;
1423 ioc.len = (uint) sizeof(buf);850 ioc.len = (uint) sizeof(buf);
1424 ioc.set = false;851 ioc.set = false;
1425 852
1426 strcpy(buf, "toe_ol");853 strcpy(buf, "toe_ol");
1427 ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);854 ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
1428 if (ret < 0) {855 if (ret < 0) {
1429 /* Check for older dongle image that doesn't support toe_ol */856 /* Check for older dongle image that doesn't support toe_ol */
1430 if (ret == -EIO) {857 if (ret == -EIO) {
1431 DHD_ERROR(("%s: toe not supported by device\n",858 BRCMF_ERROR(("%s: toe not supported by device\n",
1432 dhd_ifname(&dhd->pub, ifidx)));859 brcmf_ifname(&drvr_priv->pub, ifidx)));
1433 return -EOPNOTSUPP;860 return -EOPNOTSUPP;
1434 }861 }
1435 862
1436 DHD_INFO(("%s: could not get toe_ol: ret=%d\n",863 BRCMF_INFO(("%s: could not get toe_ol: ret=%d\n",
1437 dhd_ifname(&dhd->pub, ifidx), ret));864 brcmf_ifname(&drvr_priv->pub, ifidx), ret));
1438 return ret;865 return ret;
1439 }866 }
1440 867
@@ -1444,15 +871,15 @@ static int dhd_toe_get(dhd_info_t *dhd, int ifidx, u32 *toe_ol) · 3 unmodified lines
1444 871
1445/* Set current toe component enables in toe_ol iovar,872/* Set current toe component enables in toe_ol iovar,
1446 and set toe global enable iovar */873 and set toe global enable iovar */
1447static int dhd_toe_set(dhd_info_t *dhd, int ifidx, u32 toe_ol)874static int brcmf_toe_set(struct brcmf_info *drvr_priv, int ifidx, u32 toe_ol)
1448{875{
1449 wl_ioctl_t ioc;876 struct brcmf_ioctl ioc;
1450 char buf[32];877 char buf[32];
1451 int toe, ret;878 int toe, ret;
1452 879
1453 memset(&ioc, 0, sizeof(ioc));880 memset(&ioc, 0, sizeof(ioc));
1454 881
1455 ioc.cmd = WLC_SET_VAR;882 ioc.cmd = BRCMF_C_SET_VAR;
1456 ioc.buf = buf;883 ioc.buf = buf;
1457 ioc.len = (uint) sizeof(buf);884 ioc.len = (uint) sizeof(buf);
1458 ioc.set = true;885 ioc.set = true;
@@ -1462,10 +889,10 @@ static int dhd_toe_set(dhd_info_t *dhd, int ifidx, u32 toe_ol) · 3 unmodified lines
1462 strcpy(buf, "toe_ol");889 strcpy(buf, "toe_ol");
1463 memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(u32));890 memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(u32));
1464 891
1465 ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);892 ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
1466 if (ret < 0) {893 if (ret < 0) {
1467 DHD_ERROR(("%s: could not set toe_ol: ret=%d\n",894 BRCMF_ERROR(("%s: could not set toe_ol: ret=%d\n",
1468 dhd_ifname(&dhd->pub, ifidx), ret));895 brcmf_ifname(&drvr_priv->pub, ifidx), ret));
1469 return ret;896 return ret;
1470 }897 }
1471 898
@@ -1476,44 +903,42 @@ static int dhd_toe_set(dhd_info_t *dhd, int ifidx, u32 toe_ol) · 4 unmodified lines
1476 strcpy(buf, "toe");903 strcpy(buf, "toe");
1477 memcpy(&buf[sizeof("toe")], &toe, sizeof(u32));904 memcpy(&buf[sizeof("toe")], &toe, sizeof(u32));
1478 905
1479 ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);906 ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
1480 if (ret < 0) {907 if (ret < 0) {
1481 DHD_ERROR(("%s: could not set toe: ret=%d\n",908 BRCMF_ERROR(("%s: could not set toe: ret=%d\n",
1482 dhd_ifname(&dhd->pub, ifidx), ret));909 brcmf_ifname(&drvr_priv->pub, ifidx), ret));
1483 return ret;910 return ret;
1484 }911 }
1485 912
1486 return 0;913 return 0;
1487}914}
1488#endif /* TOE */
1489 915
1490static void dhd_ethtool_get_drvinfo(struct net_device *net,916static void brcmf_ethtool_get_drvinfo(struct net_device *net,
1491 struct ethtool_drvinfo *info)917 struct ethtool_drvinfo *info)
1492{918{
1493 dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);919 struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
1494 920
1495 sprintf(info->driver, DRV_MODULE_NAME);921 sprintf(info->driver, KBUILD_MODNAME);
1496 sprintf(info->version, "%lu", dhd->pub.drv_version);922 sprintf(info->version, "%lu", drvr_priv->pub.drv_version);
1497 sprintf(info->fw_version, "%s", wl_cfg80211_get_fwname());923 sprintf(info->fw_version, "%s", BCM4329_FW_NAME);
1498 sprintf(info->bus_info, "%s", dev_name(&wl_cfg80211_get_sdio_func()->dev));924 sprintf(info->bus_info, "%s",
925 dev_name(&brcmf_cfg80211_get_sdio_func()->dev));
1499}926}
1500 927
1501struct ethtool_ops dhd_ethtool_ops = {928struct ethtool_ops brcmf_ethtool_ops = {
1502 .get_drvinfo = dhd_ethtool_get_drvinfo929 .get_drvinfo = brcmf_ethtool_get_drvinfo
1503};930};
1504 931
1505static int dhd_ethtool(dhd_info_t *dhd, void *uaddr)932static int brcmf_ethtool(struct brcmf_info *drvr_priv, void *uaddr)
1506{933{
1507 struct ethtool_drvinfo info;934 struct ethtool_drvinfo info;
1508 char drvname[sizeof(info.driver)];935 char drvname[sizeof(info.driver)];
1509 u32 cmd;936 u32 cmd;
1510#ifdef TOE
1511 struct ethtool_value edata;937 struct ethtool_value edata;
1512 u32 toe_cmpnt, csum_dir;938 u32 toe_cmpnt, csum_dir;
1513 int ret;939 int ret;
1514#endif
1515 940
1516 DHD_TRACE(("%s: Enter\n", __func__));941 BRCMF_TRACE(("%s: Enter\n", __func__));
1517 942
1518 /* all ethtool calls start with a cmd word */943 /* all ethtool calls start with a cmd word */
1519 if (copy_from_user(&cmd, uaddr, sizeof(u32)))944 if (copy_from_user(&cmd, uaddr, sizeof(u32)))
@@ -1531,36 +956,35 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 11 unmodified lines
1531 memset(&info, 0, sizeof(info));956 memset(&info, 0, sizeof(info));
1532 info.cmd = cmd;957 info.cmd = cmd;
1533 958
1534 /* if dhd requested, identify ourselves */959 /* if requested, identify ourselves */
1535 if (strcmp(drvname, "?dhd") == 0) {960 if (strcmp(drvname, "?dhd") == 0) {
1536 sprintf(info.driver, "dhd");961 sprintf(info.driver, "dhd");
1537 strcpy(info.version, EPI_VERSION_STR);962 strcpy(info.version, BRCMF_VERSION_STR);
1538 }963 }
1539 964
1540 /* otherwise, require dongle to be up */965 /* otherwise, require dongle to be up */
1541 else if (!dhd->pub.up) {966 else if (!drvr_priv->pub.up) {
1542 DHD_ERROR(("%s: dongle is not up\n", __func__));967 BRCMF_ERROR(("%s: dongle is not up\n", __func__));
1543 return -ENODEV;968 return -ENODEV;
1544 }969 }
1545 970
1546 /* finally, report dongle driver type */971 /* finally, report dongle driver type */
1547 else if (dhd->pub.iswl)972 else if (drvr_priv->pub.iswl)
1548 sprintf(info.driver, "wl");973 sprintf(info.driver, "wl");
1549 else974 else
1550 sprintf(info.driver, "xx");975 sprintf(info.driver, "xx");
1551 976
1552 sprintf(info.version, "%lu", dhd->pub.drv_version);977 sprintf(info.version, "%lu", drvr_priv->pub.drv_version);
1553 if (copy_to_user(uaddr, &info, sizeof(info)))978 if (copy_to_user(uaddr, &info, sizeof(info)))
1554 return -EFAULT;979 return -EFAULT;
1555 DHD_CTL(("%s: given %*s, returning %s\n", __func__,980 BRCMF_CTL(("%s: given %*s, returning %s\n", __func__,
1556 (int)sizeof(drvname), drvname, info.driver));981 (int)sizeof(drvname), drvname, info.driver));
1557 break;982 break;
1558 983
1559#ifdef TOE
1560 /* Get toe offload components from dongle */984 /* Get toe offload components from dongle */
1561 case ETHTOOL_GRXCSUM:985 case ETHTOOL_GRXCSUM:
1562 case ETHTOOL_GTXCSUM:986 case ETHTOOL_GTXCSUM:
1563 ret = dhd_toe_get(dhd, 0, &toe_cmpnt);987 ret = brcmf_toe_get(drvr_priv, 0, &toe_cmpnt);
1564 if (ret < 0)988 if (ret < 0)
1565 return ret;989 return ret;
1566 990
@@ -1581,7 +1005,7 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 14 unmodified lines
1581 return -EFAULT;1005 return -EFAULT;
1582 1006
1583 /* Read the current settings, update and write back */1007 /* Read the current settings, update and write back */
1584 ret = dhd_toe_get(dhd, 0, &toe_cmpnt);1008 ret = brcmf_toe_get(drvr_priv, 0, &toe_cmpnt);
1585 if (ret < 0)1009 if (ret < 0)
1586 return ret;1010 return ret;
1587 1011
@@ -1593,22 +1017,21 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 5 unmodified lines
1593 else1017 else
1594 toe_cmpnt &= ~csum_dir;1018 toe_cmpnt &= ~csum_dir;
1595 1019
1596 ret = dhd_toe_set(dhd, 0, toe_cmpnt);1020 ret = brcmf_toe_set(drvr_priv, 0, toe_cmpnt);
1597 if (ret < 0)1021 if (ret < 0)
1598 return ret;1022 return ret;
1599 1023
1600 /* If setting TX checksum mode, tell Linux the new mode */1024 /* If setting TX checksum mode, tell Linux the new mode */
1601 if (cmd == ETHTOOL_STXCSUM) {1025 if (cmd == ETHTOOL_STXCSUM) {
1602 if (edata.data)1026 if (edata.data)
1603 dhd->iflist[0]->net->features |=1027 drvr_priv->iflist[0]->net->features |=
1604 NETIF_F_IP_CSUM;1028 NETIF_F_IP_CSUM;
1605 else1029 else
1606 dhd->iflist[0]->net->features &=1030 drvr_priv->iflist[0]->net->features &=
1607 ~NETIF_F_IP_CSUM;1031 ~NETIF_F_IP_CSUM;
1608 }1032 }
1609 1033
1610 break;1034 break;
1611#endif /* TOE */
1612 1035
1613 default:1036 default:
1614 return -EOPNOTSUPP;1037 return -EOPNOTSUPP;
@@ -1617,10 +1040,11 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 2 unmodified lines
1617 return 0;1040 return 0;
1618}1041}
1619 1042
1620static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)1043static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr,
1044 int cmd)
1621{1045{
1622 dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);1046 struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
1623 dhd_ioctl_t ioc;1047 struct brcmf_c_ioctl ioc;
1624 int bcmerror = 0;1048 int bcmerror = 0;
1625 int buflen = 0;1049 int buflen = 0;
1626 void *buf = NULL;1050 void *buf = NULL;
@@ -1628,22 +1052,14 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 1 unmodified line
1628 int ifidx;1052 int ifidx;
1629 bool is_set_key_cmd;1053 bool is_set_key_cmd;
1630 1054
1631 ifidx = dhd_net2idx(dhd, net);1055 ifidx = brcmf_net2idx(drvr_priv, net);
1632 DHD_TRACE(("%s: ifidx %d, cmd 0x%04x\n", __func__, ifidx, cmd));1056 BRCMF_TRACE(("%s: ifidx %d, cmd 0x%04x\n", __func__, ifidx, cmd));
1633 1057
1634 if (ifidx == DHD_BAD_IF)1058 if (ifidx == BRCMF_BAD_IF)
1635 return -1;1059 return -1;
1636 1060
1637#if defined(CONFIG_WIRELESS_EXT)
1638 /* linux wireless extensions */
1639 if ((cmd >= SIOCIWFIRST) && (cmd <= SIOCIWLAST)) {
1640 /* may recurse, do NOT lock */
1641 return wl_iw_ioctl(net, ifr, cmd);
1642 }
1643#endif /* defined(CONFIG_WIRELESS_EXT) */
1644
1645 if (cmd == SIOCETHTOOL)1061 if (cmd == SIOCETHTOOL)
1646 return dhd_ethtool(dhd, (void *)ifr->ifr_data);1062 return brcmf_ethtool(drvr_priv, (void *)ifr->ifr_data);
1647 1063
1648 if (cmd != SIOCDEVPRIVATE)1064 if (cmd != SIOCDEVPRIVATE)
1649 return -EOPNOTSUPP;1065 return -EOPNOTSUPP;
@@ -1651,14 +1067,14 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 1 unmodified line
1651 memset(&ioc, 0, sizeof(ioc));1067 memset(&ioc, 0, sizeof(ioc));
1652 1068
1653 /* Copy the ioc control structure part of ioctl request */1069 /* Copy the ioc control structure part of ioctl request */
1654 if (copy_from_user(&ioc, ifr->ifr_data, sizeof(wl_ioctl_t))) {1070 if (copy_from_user(&ioc, ifr->ifr_data, sizeof(struct brcmf_ioctl))) {
1655 bcmerror = -EINVAL;1071 bcmerror = -EINVAL;
1656 goto done;1072 goto done;
1657 }1073 }
1658 1074
1659 /* Copy out any buffer passed */1075 /* Copy out any buffer passed */
1660 if (ioc.buf) {1076 if (ioc.buf) {
1661 buflen = min_t(int, ioc.len, DHD_IOCTL_MAXLEN);1077 buflen = min_t(int, ioc.len, BRCMF_IOCTL_MAXLEN);
1662 /* optimization for direct ioctl calls from kernel */1078 /* optimization for direct ioctl calls from kernel */
1663 /*1079 /*
1664 if (segment_eq(get_fs(), KERNEL_DS)) {1080 if (segment_eq(get_fs(), KERNEL_DS)) {
@@ -1678,9 +1094,9 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 13 unmodified lines
1678 }1094 }
1679 }1095 }
1680 1096
1681 /* To differentiate between wl and dhd read 4 more byes */1097 /* To differentiate read 4 more byes */
1682 if ((copy_from_user(&driver, (char *)ifr->ifr_data + sizeof(wl_ioctl_t),1098 if ((copy_from_user(&driver, (char *)ifr->ifr_data +
1683 sizeof(uint)) != 0)) {1099 sizeof(struct brcmf_ioctl), sizeof(uint)) != 0)) {
1684 bcmerror = -EINVAL;1100 bcmerror = -EINVAL;
1685 goto done;1101 goto done;
1686 }1102 }
@@ -1690,39 +1106,41 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 3 unmodified lines
1690 goto done;1106 goto done;
1691 }1107 }
1692 1108
1693 /* check for local dhd ioctl and handle it */1109 /* check for local brcmf ioctl and handle it */
1694 if (driver == DHD_IOCTL_MAGIC) {1110 if (driver == BRCMF_IOCTL_MAGIC) {
1695 bcmerror = dhd_ioctl((void *)&dhd->pub, &ioc, buf, buflen);1111 bcmerror = brcmf_c_ioctl((void *)&drvr_priv->pub, &ioc, buf, buflen);
1696 if (bcmerror)1112 if (bcmerror)
1697 dhd->pub.bcmerror = bcmerror;1113 drvr_priv->pub.bcmerror = bcmerror;
1698 goto done;1114 goto done;
1699 }1115 }
1700 1116
1701 /* send to dongle (must be up, and wl) */1117 /* send to dongle (must be up, and wl) */
1702 if ((dhd->pub.busstate != DHD_BUS_DATA)) {1118 if ((drvr_priv->pub.busstate != BRCMF_BUS_DATA)) {
1703 DHD_ERROR(("%s DONGLE_DOWN,__func__\n", __func__));1119 BRCMF_ERROR(("%s DONGLE_DOWN,__func__\n", __func__));
1704 bcmerror = -EIO;1120 bcmerror = -EIO;
1705 goto done;1121 goto done;
1706 }1122 }
1707 1123
1708 if (!dhd->pub.iswl) {1124 if (!drvr_priv->pub.iswl) {
1709 bcmerror = -EIO;1125 bcmerror = -EIO;
1710 goto done;1126 goto done;
1711 }1127 }
1712 1128
1713 /* Intercept WLC_SET_KEY IOCTL - serialize M4 send and set key IOCTL to1129 /*
1714 * prevent M4 encryption.1130 * Intercept BRCMF_C_SET_KEY IOCTL - serialize M4 send and
1131 * set key IOCTL to prevent M4 encryption.
1715 */1132 */
1716 is_set_key_cmd = ((ioc.cmd == WLC_SET_KEY) ||1133 is_set_key_cmd = ((ioc.cmd == BRCMF_C_SET_KEY) ||
1717 ((ioc.cmd == WLC_SET_VAR) &&1134 ((ioc.cmd == BRCMF_C_SET_VAR) &&
1718 !(strncmp("wsec_key", ioc.buf, 9))) ||1135 !(strncmp("wsec_key", ioc.buf, 9))) ||
1719 ((ioc.cmd == WLC_SET_VAR) &&1136 ((ioc.cmd == BRCMF_C_SET_VAR) &&
1720 !(strncmp("bsscfg:wsec_key", ioc.buf, 15))));1137 !(strncmp("bsscfg:wsec_key", ioc.buf, 15))));
1721 if (is_set_key_cmd)1138 if (is_set_key_cmd)
1722 dhd_wait_pend8021x(net);1139 brcmf_netdev_wait_pend8021x(net);
1723 1140
1724 bcmerror =1141 bcmerror =
1725 dhd_prot_ioctl(&dhd->pub, ifidx, (wl_ioctl_t *)&ioc, buf, buflen);1142 brcmf_proto_ioctl(&drvr_priv->pub, ifidx, (struct brcmf_ioctl *)&ioc,
1143 buf, buflen);
1726 1144
1727done:1145done:
1728 if (!bcmerror && buf && ioc.buf) {1146 if (!bcmerror && buf && ioc.buf) {
@@ -1738,159 +1156,146 @@ done: · 9 unmodified lines
1738 return bcmerror;1156 return bcmerror;
1739}1157}
1740 1158
1741static int dhd_stop(struct net_device *net)1159static int brcmf_netdev_stop(struct net_device *net)
1742{1160{
1743#if !defined(IGNORE_ETH0_DOWN)1161#if !defined(IGNORE_ETH0_DOWN)
1744 dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);1162 struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
1745 1163
1746 DHD_TRACE(("%s: Enter\n", __func__));1164 BRCMF_TRACE(("%s: Enter\n", __func__));
1747 if (IS_CFG80211_FAVORITE()) {1165 brcmf_cfg80211_down();
1748 wl_cfg80211_down();1166 if (drvr_priv->pub.up == 0)
1749 }
1750 if (dhd->pub.up == 0)
1751 return 0;1167 return 0;
1752 1168
1753 /* Set state and stop OS transmissions */1169 /* Set state and stop OS transmissions */
1754 dhd->pub.up = 0;1170 drvr_priv->pub.up = 0;
1755 netif_stop_queue(net);1171 netif_stop_queue(net);
1756#else1172#else
1757 DHD_ERROR(("BYPASS %s:due to BRCM compilation : under investigation\n",1173 BRCMF_ERROR(("BYPASS %s:due to BRCM compilation: under investigation\n",
1758 __func__));1174 __func__));
1759#endif /* !defined(IGNORE_ETH0_DOWN) */1175#endif /* !defined(IGNORE_ETH0_DOWN) */
1760 1176
1761 return 0;1177 return 0;
1762}1178}
1763 1179
1764static int dhd_open(struct net_device *net)1180static int brcmf_netdev_open(struct net_device *net)
1765{1181{
1766 dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);1182 struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
1767#ifdef TOE
1768 u32 toe_ol;1183 u32 toe_ol;
1769#endif1184 int ifidx = brcmf_net2idx(drvr_priv, net);
1770 int ifidx = dhd_net2idx(dhd, net);
1771 s32 ret = 0;1185 s32 ret = 0;
1772 1186
1773 DHD_TRACE(("%s: ifidx %d\n", __func__, ifidx));1187 BRCMF_TRACE(("%s: ifidx %d\n", __func__, ifidx));
1774 1188
1775 if (ifidx == 0) { /* do it only for primary eth0 */1189 if (ifidx == 0) { /* do it only for primary eth0 */
1776 1190
1777 /* try to bring up bus */1191 /* try to bring up bus */
1778 ret = dhd_bus_start(&dhd->pub);1192 ret = brcmf_bus_start(&drvr_priv->pub);
1779 if (ret != 0) {1193 if (ret != 0) {
1780 DHD_ERROR(("%s: failed with code %d\n", __func__, ret));1194 BRCMF_ERROR(("%s: failed with code %d\n",
1195 __func__, ret));
1781 return -1;1196 return -1;
1782 }1197 }
1783 atomic_set(&dhd->pend_8021x_cnt, 0);1198 atomic_set(&drvr_priv->pend_8021x_cnt, 0);
1784 1199
1785 memcpy(net->dev_addr, dhd->pub.mac, ETH_ALEN);1200 memcpy(net->dev_addr, drvr_priv->pub.mac, ETH_ALEN);
1786 1201
1787#ifdef TOE
1788 /* Get current TOE mode from dongle */1202 /* Get current TOE mode from dongle */
1789 if (dhd_toe_get(dhd, ifidx, &toe_ol) >= 01203 if (brcmf_toe_get(drvr_priv, ifidx, &toe_ol) >= 0
1790 && (toe_ol & TOE_TX_CSUM_OL) != 0)1204 && (toe_ol & TOE_TX_CSUM_OL) != 0)
1791 dhd->iflist[ifidx]->net->features |= NETIF_F_IP_CSUM;1205 drvr_priv->iflist[ifidx]->net->features |=
1206 NETIF_F_IP_CSUM;
1792 else1207 else
1793 dhd->iflist[ifidx]->net->features &= ~NETIF_F_IP_CSUM;1208 drvr_priv->iflist[ifidx]->net->features &=
1794#endif1209 ~NETIF_F_IP_CSUM;
1795 }1210 }
1796 /* Allow transmit calls */1211 /* Allow transmit calls */
1797 netif_start_queue(net);1212 netif_start_queue(net);
1798 dhd->pub.up = 1;1213 drvr_priv->pub.up = 1;
1799 if (IS_CFG80211_FAVORITE()) {1214 if (unlikely(brcmf_cfg80211_up())) {
1800 if (unlikely(wl_cfg80211_up())) {1215 BRCMF_ERROR(("%s: failed to bring up cfg80211\n",
1801 DHD_ERROR(("%s: failed to bring up cfg80211\n",1216 __func__));
1802 __func__));1217 return -1;
1803 return -1;
1804 }
1805 }1218 }
1806 1219
1807 return ret;1220 return ret;
1808}1221}
1809 1222
1810int1223int
1811dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name,1224brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle, char *name,
1812 u8 *mac_addr, u32 flags, u8 bssidx)1225 u8 *mac_addr, u32 flags, u8 bssidx)
1813{1226{
1814 dhd_if_t *ifp;1227 struct brcmf_if *ifp;
1815
1816 DHD_TRACE(("%s: idx %d, handle->%p\n", __func__, ifidx, handle));
1817 1228
1818 ASSERT(dhd && (ifidx < DHD_MAX_IFS));1229 BRCMF_TRACE(("%s: idx %d, handle->%p\n", __func__, ifidx, handle));
1819 1230
1820 ifp = dhd->iflist[ifidx];1231 ifp = drvr_priv->iflist[ifidx];
1821 if (!ifp && !(ifp = kmalloc(sizeof(dhd_if_t), GFP_ATOMIC))) {1232 if (!ifp) {
1822 DHD_ERROR(("%s: OOM - dhd_if_t\n", __func__));1233 ifp = kmalloc(sizeof(struct brcmf_if), GFP_ATOMIC);
1823 return -ENOMEM;1234 if (!ifp) {
1235 BRCMF_ERROR(("%s: OOM - struct brcmf_if\n", __func__));
1236 return -ENOMEM;
1237 }
1824 }1238 }
1825 1239
1826 memset(ifp, 0, sizeof(dhd_if_t));1240 memset(ifp, 0, sizeof(struct brcmf_if));
1827 ifp->info = dhd;1241 ifp->info = drvr_priv;
1828 dhd->iflist[ifidx] = ifp;1242 drvr_priv->iflist[ifidx] = ifp;
1829 strlcpy(ifp->name, name, IFNAMSIZ);1243 strlcpy(ifp->name, name, IFNAMSIZ);
1830 if (mac_addr != NULL)1244 if (mac_addr != NULL)
1831 memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN);1245 memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN);
1832 1246
1833 if (handle == NULL) {1247 if (handle == NULL) {
1834 ifp->state = WLC_E_IF_ADD;1248 ifp->state = BRCMF_E_IF_ADD;
1835 ifp->idx = ifidx;1249 ifp->idx = ifidx;
1836 ASSERT(dhd->sysioc_tsk);1250 up(&drvr_priv->sysioc_sem);
1837 up(&dhd->sysioc_sem);
1838 } else1251 } else
1839 ifp->net = (struct net_device *)handle;1252 ifp->net = (struct net_device *)handle;
1840 1253
1841 return 0;1254 return 0;
1842}1255}
1843 1256
1844void dhd_del_if(dhd_info_t *dhd, int ifidx)1257void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx)
1845{1258{
1846 dhd_if_t *ifp;1259 struct brcmf_if *ifp;
1847 1260
1848 DHD_TRACE(("%s: idx %d\n", __func__, ifidx));1261 BRCMF_TRACE(("%s: idx %d\n", __func__, ifidx));
1849 1262
1850 ASSERT(dhd && ifidx && (ifidx < DHD_MAX_IFS));1263 ifp = drvr_priv->iflist[ifidx];
1851 ifp = dhd->iflist[ifidx];
1852 if (!ifp) {1264 if (!ifp) {
1853 DHD_ERROR(("%s: Null interface\n", __func__));1265 BRCMF_ERROR(("%s: Null interface\n", __func__));
1854 return;1266 return;
1855 }1267 }
1856 1268
1857 ifp->state = WLC_E_IF_DEL;1269 ifp->state = BRCMF_E_IF_DEL;
1858 ifp->idx = ifidx;1270 ifp->idx = ifidx;
1859 ASSERT(dhd->sysioc_tsk);1271 up(&drvr_priv->sysioc_sem);
1860 up(&dhd->sysioc_sem);
1861}1272}
1862 1273
1863dhd_pub_t *dhd_attach(struct dhd_bus *bus, uint bus_hdrlen)1274struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
1864{1275{
1865 dhd_info_t *dhd = NULL;1276 struct brcmf_info *drvr_priv = NULL;
1866 struct net_device *net;1277 struct net_device *net;
1867 1278
1868 DHD_TRACE(("%s: Enter\n", __func__));1279 BRCMF_TRACE(("%s: Enter\n", __func__));
1869 /* updates firmware nvram path if it was provided as module
1870 paramters */
1871 if ((firmware_path != NULL) && (firmware_path[0] != '\0'))
1872 strcpy(fw_path, firmware_path);
1873 if ((nvram_path != NULL) && (nvram_path[0] != '\0'))
1874 strcpy(nv_path, nvram_path);
1875 1280
1876 /* Allocate etherdev, including space for private structure */1281 /* Allocate etherdev, including space for private structure */
1877 net = alloc_etherdev(sizeof(dhd));1282 net = alloc_etherdev(sizeof(drvr_priv));
1878 if (!net) {1283 if (!net) {
1879 DHD_ERROR(("%s: OOM - alloc_etherdev\n", __func__));1284 BRCMF_ERROR(("%s: OOM - alloc_etherdev\n", __func__));
1880 goto fail;1285 goto fail;
1881 }1286 }
1882 1287
1883 /* Allocate primary dhd_info */1288 /* Allocate primary brcmf_info */
1884 dhd = kzalloc(sizeof(dhd_info_t), GFP_ATOMIC);1289 drvr_priv = kzalloc(sizeof(struct brcmf_info), GFP_ATOMIC);
1885 if (!dhd) {1290 if (!drvr_priv) {
1886 DHD_ERROR(("%s: OOM - alloc dhd_info\n", __func__));1291 BRCMF_ERROR(("%s: OOM - alloc brcmf_info\n", __func__));
1887 goto fail;1292 goto fail;
1888 }1293 }
1889 1294
1890 /*1295 /*
1891 * Save the dhd_info into the priv1296 * Save the brcmf_info into the priv
1892 */1297 */
1893 memcpy(netdev_priv(net), &dhd, sizeof(dhd));1298 memcpy(netdev_priv(net), &drvr_priv, sizeof(drvr_priv));
1894 1299
1895 /* Set network interface name if it was provided as module parameter */1300 /* Set network interface name if it was provided as module parameter */
1896 if (iface_name[0]) {1301 if (iface_name[0]) {
@@ -1904,317 +1309,180 @@ dhd_pub_t *dhd_attach(struct dhd_bus *bus, uint bus_hdrlen) · 7 unmodified lines
1904 strcat(net->name, "%d");1309 strcat(net->name, "%d");
1905 }1310 }
1906 1311
1907 if (dhd_add_if(dhd, 0, (void *)net, net->name, NULL, 0, 0) ==1312 if (brcmf_add_if(drvr_priv, 0, (void *)net, net->name, NULL, 0, 0) ==
1908 DHD_BAD_IF)1313 BRCMF_BAD_IF)
1909 goto fail;1314 goto fail;
1910 1315
1911 net->netdev_ops = NULL;1316 net->netdev_ops = NULL;
1912 sema_init(&dhd->proto_sem, 1);1317 sema_init(&drvr_priv->proto_sem, 1);
1913 /* Initialize other structure content */1318 /* Initialize other structure content */
1914 init_waitqueue_head(&dhd->ioctl_resp_wait);1319 init_waitqueue_head(&drvr_priv->ioctl_resp_wait);
1915 init_waitqueue_head(&dhd->ctrl_wait);
1916
1917 /* Initialize the spinlocks */
1918 spin_lock_init(&dhd->sdlock);
1919 spin_lock_init(&dhd->txqlock);
1920 1320
1921 /* Link to info module */1321 /* Link to info module */
1922 dhd->pub.info = dhd;1322 drvr_priv->pub.info = drvr_priv;
1923 1323
1924 /* Link to bus module */1324 /* Link to bus module */
1925 dhd->pub.bus = bus;1325 drvr_priv->pub.bus = bus;
1926 dhd->pub.hdrlen = bus_hdrlen;1326 drvr_priv->pub.hdrlen = bus_hdrlen;
1927 1327
1928 /* Attach and link in the protocol */1328 /* Attach and link in the protocol */
1929 if (dhd_prot_attach(&dhd->pub) != 0) {1329 if (brcmf_proto_attach(&drvr_priv->pub) != 0) {
1930 DHD_ERROR(("dhd_prot_attach failed\n"));1330 BRCMF_ERROR(("brcmf_prot_attach failed\n"));
1931 goto fail;1331 goto fail;
1932 }1332 }
1933#if defined(CONFIG_WIRELESS_EXT)
1934 /* Attach and link in the iw */
1935 if (wl_iw_attach(net, (void *)&dhd->pub) != 0) {
1936 DHD_ERROR(("wl_iw_attach failed\n"));
1937 goto fail;
1938 }
1939#endif /* defined(CONFIG_WIRELESS_EXT) */
1940 1333
1941 /* Attach and link in the cfg80211 */1334 /* Attach and link in the cfg80211 */
1942 if (IS_CFG80211_FAVORITE()) {1335 if (unlikely(brcmf_cfg80211_attach(net, &drvr_priv->pub))) {
1943 if (unlikely(wl_cfg80211_attach(net, &dhd->pub))) {1336 BRCMF_ERROR(("wl_cfg80211_attach failed\n"));
1944 DHD_ERROR(("wl_cfg80211_attach failed\n"));1337 goto fail;
1945 goto fail;
1946 }
1947 if (!NO_FW_REQ()) {
1948 strcpy(fw_path, wl_cfg80211_get_fwname());
1949 strcpy(nv_path, wl_cfg80211_get_nvramname());
1950 }
1951 }
1952
1953 /* Set up the watchdog timer */
1954 init_timer(&dhd->timer);
1955 dhd->timer.data = (unsigned long) dhd;
1956 dhd->timer.function = dhd_watchdog;
1957
1958 /* Initialize thread based operation and lock */
1959 sema_init(&dhd->sdsem, 1);
1960 if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0))
1961 dhd->threads_only = true;
1962 else
1963 dhd->threads_only = false;
1964
1965 if (dhd_dpc_prio >= 0) {
1966 /* Initialize watchdog thread */
1967 sema_init(&dhd->watchdog_sem, 0);
1968 dhd->watchdog_tsk = kthread_run(dhd_watchdog_thread, dhd,
1969 "dhd_watchdog");
1970 if (IS_ERR(dhd->watchdog_tsk)) {
1971 printk(KERN_WARNING
1972 "dhd_watchdog thread failed to start\n");
1973 dhd->watchdog_tsk = NULL;
1974 }
1975 } else {
1976 dhd->watchdog_tsk = NULL;
1977 }
1978
1979 /* Set up the bottom half handler */
1980 if (dhd_dpc_prio >= 0) {
1981 /* Initialize DPC thread */
1982 sema_init(&dhd->dpc_sem, 0);
1983 dhd->dpc_tsk = kthread_run(dhd_dpc_thread, dhd, "dhd_dpc");
1984 if (IS_ERR(dhd->dpc_tsk)) {
1985 printk(KERN_WARNING
1986 "dhd_dpc thread failed to start\n");
1987 dhd->dpc_tsk = NULL;
1988 }
1989 } else {
1990 tasklet_init(&dhd->tasklet, dhd_dpc, (unsigned long) dhd);
1991 dhd->dpc_tsk = NULL;
1992 }1338 }
1993 1339
1994 if (dhd_sysioc) {1340 if (brcmf_sysioc) {
1995 sema_init(&dhd->sysioc_sem, 0);1341 sema_init(&drvr_priv->sysioc_sem, 0);
1996 dhd->sysioc_tsk = kthread_run(_dhd_sysioc_thread, dhd,1342 drvr_priv->sysioc_tsk = kthread_run(_brcmf_sysioc_thread, drvr_priv,
1997 "_dhd_sysioc");1343 "_brcmf_sysioc");
1998 if (IS_ERR(dhd->sysioc_tsk)) {1344 if (IS_ERR(drvr_priv->sysioc_tsk)) {
1999 printk(KERN_WARNING1345 printk(KERN_WARNING
2000 "_dhd_sysioc thread failed to start\n");1346 "_brcmf_sysioc thread failed to start\n");
2001 dhd->sysioc_tsk = NULL;1347 drvr_priv->sysioc_tsk = NULL;
2002 }1348 }
2003 } else1349 } else
2004 dhd->sysioc_tsk = NULL;1350 drvr_priv->sysioc_tsk = NULL;
2005 1351
2006 /*1352 /*
2007 * Save the dhd_info into the priv1353 * Save the brcmf_info into the priv
2008 */1354 */
2009 memcpy(netdev_priv(net), &dhd, sizeof(dhd));1355 memcpy(netdev_priv(net), &drvr_priv, sizeof(drvr_priv));
2010 1356
2011#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
2012 g_bus = bus;
2013#endif
2014#if defined(CONFIG_PM_SLEEP)1357#if defined(CONFIG_PM_SLEEP)
2015 atomic_set(&dhd_mmc_suspend, false);1358 atomic_set(&brcmf_mmc_suspend, false);
2016 if (!IS_CFG80211_FAVORITE())
2017 register_pm_notifier(&dhd_sleep_pm_notifier);
2018#endif /* defined(CONFIG_PM_SLEEP) */1359#endif /* defined(CONFIG_PM_SLEEP) */
2019 /* && defined(DHD_GPL) */1360 return &drvr_priv->pub;
2020 /* Init lock suspend to prevent kernel going to suspend */
2021#ifdef CONFIG_HAS_EARLYSUSPEND
2022 dhd->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 20;
2023 dhd->early_suspend.suspend = dhd_early_suspend;
2024 dhd->early_suspend.resume = dhd_late_resume;
2025 register_early_suspend(&dhd->early_suspend);
2026#endif
2027
2028 return &dhd->pub;
2029 1361
2030fail:1362fail:
2031 if (net)1363 if (net)
2032 free_netdev(net);1364 free_netdev(net);
2033 if (dhd)1365 if (drvr_priv)
2034 dhd_detach(&dhd->pub);1366 brcmf_detach(&drvr_priv->pub);
2035 1367
2036 return NULL;1368 return NULL;
2037}1369}
2038 1370
2039int dhd_bus_start(dhd_pub_t *dhdp)1371int brcmf_bus_start(struct brcmf_pub *drvr)
2040{1372{
2041 int ret = -1;1373 int ret = -1;
2042 dhd_info_t *dhd = (dhd_info_t *) dhdp->info;1374 struct brcmf_info *drvr_priv = drvr->info;
2043#ifdef EMBEDDED_PLATFORM1375 /* Room for "event_msgs" + '\0' + bitvec */
2044 char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" +1376 char iovbuf[BRCMF_EVENTING_MASK_LEN + 12];
2045 '\0' + bitvec */
2046#endif /* EMBEDDED_PLATFORM */
2047
2048 ASSERT(dhd);
2049
2050 DHD_TRACE(("%s:\n", __func__));
2051
2052 /* try to download image and nvram to the dongle */
2053 if (dhd->pub.busstate == DHD_BUS_DOWN) {
2054 if (!(dhd_bus_download_firmware(dhd->pub.bus,
2055 fw_path, nv_path))) {
2056 DHD_ERROR(("%s: dhdsdio_probe_download failed. "
2057 "firmware = %s nvram = %s\n",
2058 __func__, fw_path, nv_path));
2059 return -1;
2060 }
2061 }
2062 1377
2063 /* Start the watchdog timer */1378 BRCMF_TRACE(("%s:\n", __func__));
2064 dhd->pub.tickcnt = 0;
2065 dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms);
2066 1379
2067 /* Bring up the bus */1380 /* Bring up the bus */
2068 ret = dhd_bus_init(&dhd->pub, true);1381 ret = brcmf_sdbrcm_bus_init(&drvr_priv->pub, true);
2069 if (ret != 0) {1382 if (ret != 0) {
2070 DHD_ERROR(("%s, dhd_bus_init failed %d\n", __func__, ret));1383 BRCMF_ERROR(("%s, brcmf_sdbrcm_bus_init failed %d\n", __func__,
1384 ret));
2071 return ret;1385 return ret;
2072 }1386 }
2073#if defined(OOB_INTR_ONLY)
2074 /* Host registration for OOB interrupt */
2075 if (bcmsdh_register_oob_intr(dhdp)) {
2076 del_timer_sync(&dhd->timer);
2077 dhd->wd_timer_valid = false;
2078 DHD_ERROR(("%s Host failed to resgister for OOB\n", __func__));
2079 return -ENODEV;
2080 }
2081
2082 /* Enable oob at firmware */
2083 dhd_enable_oob_intr(dhd->pub.bus, true);
2084#endif /* defined(OOB_INTR_ONLY) */
2085 1387
2086 /* If bus is not ready, can't come up */1388 /* If bus is not ready, can't come up */
2087 if (dhd->pub.busstate != DHD_BUS_DATA) {1389 if (drvr_priv->pub.busstate != BRCMF_BUS_DATA) {
2088 del_timer_sync(&dhd->timer);1390 BRCMF_ERROR(("%s failed bus is not ready\n", __func__));
2089 dhd->wd_timer_valid = false;
2090 DHD_ERROR(("%s failed bus is not ready\n", __func__));
2091 return -ENODEV;1391 return -ENODEV;
2092 }1392 }
2093#ifdef EMBEDDED_PLATFORM1393
2094 bcm_mkiovar("event_msgs", dhdp->eventmask, WL_EVENTING_MASK_LEN, iovbuf,1394 brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN,
2095 sizeof(iovbuf));1395 iovbuf, sizeof(iovbuf));
2096 dhdcdc_query_ioctl(dhdp, 0, WLC_GET_VAR, iovbuf, sizeof(iovbuf));1396 brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, iovbuf,
2097 memcpy(dhdp->eventmask, iovbuf, WL_EVENTING_MASK_LEN);1397 sizeof(iovbuf));
2098 1398 memcpy(drvr->eventmask, iovbuf, BRCMF_EVENTING_MASK_LEN);
2099 setbit(dhdp->eventmask, WLC_E_SET_SSID);1399
2100 setbit(dhdp->eventmask, WLC_E_PRUNE);1400 setbit(drvr->eventmask, BRCMF_E_SET_SSID);
2101 setbit(dhdp->eventmask, WLC_E_AUTH);1401 setbit(drvr->eventmask, BRCMF_E_PRUNE);
2102 setbit(dhdp->eventmask, WLC_E_REASSOC);1402 setbit(drvr->eventmask, BRCMF_E_AUTH);
2103 setbit(dhdp->eventmask, WLC_E_REASSOC_IND);1403 setbit(drvr->eventmask, BRCMF_E_REASSOC);
2104 setbit(dhdp->eventmask, WLC_E_DEAUTH_IND);1404 setbit(drvr->eventmask, BRCMF_E_REASSOC_IND);
2105 setbit(dhdp->eventmask, WLC_E_DISASSOC_IND);1405 setbit(drvr->eventmask, BRCMF_E_DEAUTH_IND);
2106 setbit(dhdp->eventmask, WLC_E_DISASSOC);1406 setbit(drvr->eventmask, BRCMF_E_DISASSOC_IND);
2107 setbit(dhdp->eventmask, WLC_E_JOIN);1407 setbit(drvr->eventmask, BRCMF_E_DISASSOC);
2108 setbit(dhdp->eventmask, WLC_E_ASSOC_IND);1408 setbit(drvr->eventmask, BRCMF_E_JOIN);
2109 setbit(dhdp->eventmask, WLC_E_PSK_SUP);1409 setbit(drvr->eventmask, BRCMF_E_ASSOC_IND);
2110 setbit(dhdp->eventmask, WLC_E_LINK);1410 setbit(drvr->eventmask, BRCMF_E_PSK_SUP);
2111 setbit(dhdp->eventmask, WLC_E_NDIS_LINK);1411 setbit(drvr->eventmask, BRCMF_E_LINK);
2112 setbit(dhdp->eventmask, WLC_E_MIC_ERROR);1412 setbit(drvr->eventmask, BRCMF_E_NDIS_LINK);
2113 setbit(dhdp->eventmask, WLC_E_PMKID_CACHE);1413 setbit(drvr->eventmask, BRCMF_E_MIC_ERROR);
2114 setbit(dhdp->eventmask, WLC_E_TXFAIL);1414 setbit(drvr->eventmask, BRCMF_E_PMKID_CACHE);
2115 setbit(dhdp->eventmask, WLC_E_JOIN_START);1415 setbit(drvr->eventmask, BRCMF_E_TXFAIL);
2116 setbit(dhdp->eventmask, WLC_E_SCAN_COMPLETE);1416 setbit(drvr->eventmask, BRCMF_E_JOIN_START);
2117#ifdef PNO_SUPPORT1417 setbit(drvr->eventmask, BRCMF_E_SCAN_COMPLETE);
2118 setbit(dhdp->eventmask, WLC_E_PFN_NET_FOUND);
2119#endif /* PNO_SUPPORT */
2120 1418
2121/* enable dongle roaming event */1419/* enable dongle roaming event */
2122 1420
2123 dhdp->pktfilter_count = 1;1421 drvr->pktfilter_count = 1;
2124 /* Setup filter to allow only unicast */1422 /* Setup filter to allow only unicast */
2125 dhdp->pktfilter[0] = "100 0 0 0 0x01 0x00";1423 drvr->pktfilter[0] = "100 0 0 0 0x01 0x00";
2126#endif /* EMBEDDED_PLATFORM */
2127 1424
2128 /* Bus is ready, do any protocol initialization */1425 /* Bus is ready, do any protocol initialization */
2129 ret = dhd_prot_init(&dhd->pub);1426 ret = brcmf_proto_init(&drvr_priv->pub);
2130 if (ret < 0)1427 if (ret < 0)
2131 return ret;1428 return ret;
2132 1429
2133 return 0;1430 return 0;
2134}1431}
2135 1432
2136int1433static struct net_device_ops brcmf_netdev_ops_pri = {
2137dhd_iovar(dhd_pub_t *pub, int ifidx, char *name, char *cmd_buf, uint cmd_len,1434 .ndo_open = brcmf_netdev_open,
2138 int set)1435 .ndo_stop = brcmf_netdev_stop,
2139{1436 .ndo_get_stats = brcmf_netdev_get_stats,
2140 char buf[strlen(name) + 1 + cmd_len];1437 .ndo_do_ioctl = brcmf_netdev_ioctl_entry,
2141 int len = sizeof(buf);1438 .ndo_start_xmit = brcmf_netdev_start_xmit,
2142 wl_ioctl_t ioc;1439 .ndo_set_mac_address = brcmf_netdev_set_mac_address,
2143 int ret;1440 .ndo_set_multicast_list = brcmf_netdev_set_multicast_list
2144
2145 len = bcm_mkiovar(name, cmd_buf, cmd_len, buf, len);
2146
2147 memset(&ioc, 0, sizeof(ioc));
2148
2149 ioc.cmd = set ? WLC_SET_VAR : WLC_GET_VAR;
2150 ioc.buf = buf;
2151 ioc.len = len;
2152 ioc.set = set;
2153
2154 ret = dhd_prot_ioctl(pub, ifidx, &ioc, ioc.buf, ioc.len);
2155 if (!set && ret >= 0)
2156 memcpy(cmd_buf, buf, cmd_len);
2157
2158 return ret;
2159}
2160
2161static struct net_device_ops dhd_ops_pri = {
2162 .ndo_open = dhd_open,
2163 .ndo_stop = dhd_stop,
2164 .ndo_get_stats = dhd_get_stats,
2165 .ndo_do_ioctl = dhd_ioctl_entry,
2166 .ndo_start_xmit = dhd_start_xmit,
2167 .ndo_set_mac_address = dhd_set_mac_address,
2168 .ndo_set_multicast_list = dhd_set_multicast_list
2169};1441};
2170 1442
2171int dhd_net_attach(dhd_pub_t *dhdp, int ifidx)1443int brcmf_net_attach(struct brcmf_pub *drvr, int ifidx)
2172{1444{
2173 dhd_info_t *dhd = (dhd_info_t *) dhdp->info;1445 struct brcmf_info *drvr_priv = drvr->info;
2174 struct net_device *net;1446 struct net_device *net;
2175 u8 temp_addr[ETH_ALEN] = {1447 u8 temp_addr[ETH_ALEN] = {
2176 0x00, 0x90, 0x4c, 0x11, 0x22, 0x33};1448 0x00, 0x90, 0x4c, 0x11, 0x22, 0x33};
2177 1449
2178 DHD_TRACE(("%s: ifidx %d\n", __func__, ifidx));1450 BRCMF_TRACE(("%s: ifidx %d\n", __func__, ifidx));
2179
2180 ASSERT(dhd && dhd->iflist[ifidx]);
2181 1451
2182 net = dhd->iflist[ifidx]->net;1452 net = drvr_priv->iflist[ifidx]->net;
2183 ASSERT(net);1453 net->netdev_ops = &brcmf_netdev_ops_pri;
2184
2185 ASSERT(!net->netdev_ops);
2186 net->netdev_ops = &dhd_ops_pri;
2187 1454
2188 /*1455 /*
2189 * We have to use the primary MAC for virtual interfaces1456 * We have to use the primary MAC for virtual interfaces
2190 */1457 */
2191 if (ifidx != 0) {1458 if (ifidx != 0) {
2192 /* for virtual interfaces use the primary MAC */1459 /* for virtual interfaces use the primary MAC */
2193 memcpy(temp_addr, dhd->pub.mac, ETH_ALEN);1460 memcpy(temp_addr, drvr_priv->pub.mac, ETH_ALEN);
2194 1461
2195 }1462 }
2196 1463
2197 if (ifidx == 1) {1464 if (ifidx == 1) {
2198 DHD_TRACE(("%s ACCESS POINT MAC: \n", __func__));1465 BRCMF_TRACE(("%s ACCESS POINT MAC:\n", __func__));
2199 /* ACCESSPOINT INTERFACE CASE */1466 /* ACCESSPOINT INTERFACE CASE */
2200 temp_addr[0] |= 0X02; /* set bit 2 ,1467 temp_addr[0] |= 0X02; /* set bit 2 ,
2201 - Locally Administered address */1468 - Locally Administered address */
2202 1469
2203 }1470 }
2204 net->hard_header_len = ETH_HLEN + dhd->pub.hdrlen;1471 net->hard_header_len = ETH_HLEN + drvr_priv->pub.hdrlen;
2205 net->ethtool_ops = &dhd_ethtool_ops;1472 net->ethtool_ops = &brcmf_ethtool_ops;
2206 1473
2207 dhd->pub.rxsz = net->mtu + net->hard_header_len + dhd->pub.hdrlen;1474 drvr_priv->pub.rxsz = net->mtu + net->hard_header_len +
1475 drvr_priv->pub.hdrlen;
2208 1476
2209 memcpy(net->dev_addr, temp_addr, ETH_ALEN);1477 memcpy(net->dev_addr, temp_addr, ETH_ALEN);
2210 1478
2211 if (register_netdev(net) != 0) {1479 if (register_netdev(net) != 0) {
2212 DHD_ERROR(("%s: couldn't register the net device\n",1480 BRCMF_ERROR(("%s: couldn't register the net device\n",
2213 __func__));1481 __func__));
2214 goto fail;1482 goto fail;
2215 }1483 }
2216 1484
2217 DHD_INFO(("%s: Broadcom Dongle Host Driver\n", net->name));1485 BRCMF_INFO(("%s: Broadcom Dongle Host Driver\n", net->name));
2218 1486
2219 return 0;1487 return 0;
2220 1488
@@ -2223,221 +1491,139 @@ fail: · 2 unmodified lines
2223 return -EBADE;1491 return -EBADE;
2224}1492}
2225 1493
2226void dhd_bus_detach(dhd_pub_t *dhdp)1494static void brcmf_bus_detach(struct brcmf_pub *drvr)
2227{1495{
2228 dhd_info_t *dhd;1496 struct brcmf_info *drvr_priv;
2229 1497
2230 DHD_TRACE(("%s: Enter\n", __func__));1498 BRCMF_TRACE(("%s: Enter\n", __func__));
2231 1499
2232 if (dhdp) {1500 if (drvr) {
2233 dhd = (dhd_info_t *) dhdp->info;1501 drvr_priv = drvr->info;
2234 if (dhd) {1502 if (drvr_priv) {
2235 /* Stop the protocol module */1503 /* Stop the protocol module */
2236 dhd_prot_stop(&dhd->pub);1504 brcmf_proto_stop(&drvr_priv->pub);
2237 1505
2238 /* Stop the bus module */1506 /* Stop the bus module */
2239 dhd_bus_stop(dhd->pub.bus, true);1507 brcmf_sdbrcm_bus_stop(drvr_priv->pub.bus, true);
2240#if defined(OOB_INTR_ONLY)
2241 bcmsdh_unregister_oob_intr();
2242#endif /* defined(OOB_INTR_ONLY) */
2243
2244 /* Clear the watchdog timer */
2245 del_timer_sync(&dhd->timer);
2246 dhd->wd_timer_valid = false;
2247 }1508 }
2248 }1509 }
2249}1510}
2250 1511
2251void dhd_detach(dhd_pub_t *dhdp)1512void brcmf_detach(struct brcmf_pub *drvr)
2252{1513{
2253 dhd_info_t *dhd;1514 struct brcmf_info *drvr_priv;
2254 1515
2255 DHD_TRACE(("%s: Enter\n", __func__));1516 BRCMF_TRACE(("%s: Enter\n", __func__));
2256 1517
2257 if (dhdp) {1518 if (drvr) {
2258 dhd = (dhd_info_t *) dhdp->info;1519 drvr_priv = drvr->info;
2259 if (dhd) {1520 if (drvr_priv) {
2260 dhd_if_t *ifp;1521 struct brcmf_if *ifp;
2261 int i;1522 int i;
2262 1523
2263#if defined(CONFIG_HAS_EARLYSUSPEND)1524 for (i = 1; i < BRCMF_MAX_IFS; i++)
2264 if (dhd->early_suspend.suspend)1525 if (drvr_priv->iflist[i])
2265 unregister_early_suspend(&dhd->early_suspend);1526 brcmf_del_if(drvr_priv, i);
2266#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */
2267
2268 for (i = 1; i < DHD_MAX_IFS; i++)
2269 if (dhd->iflist[i])
2270 dhd_del_if(dhd, i);
2271 1527
2272 ifp = dhd->iflist[0];1528 ifp = drvr_priv->iflist[0];
2273 ASSERT(ifp);1529 if (ifp->net->netdev_ops == &brcmf_netdev_ops_pri) {
2274 if (ifp->net->netdev_ops == &dhd_ops_pri) {1530 brcmf_netdev_stop(ifp->net);
2275 dhd_stop(ifp->net);
2276 unregister_netdev(ifp->net);1531 unregister_netdev(ifp->net);
2277 }1532 }
2278 1533
2279 if (dhd->watchdog_tsk) {1534 if (drvr_priv->sysioc_tsk) {
2280 send_sig(SIGTERM, dhd->watchdog_tsk, 1);1535 send_sig(SIGTERM, drvr_priv->sysioc_tsk, 1);
2281 kthread_stop(dhd->watchdog_tsk);1536 kthread_stop(drvr_priv->sysioc_tsk);
2282 dhd->watchdog_tsk = NULL;1537 drvr_priv->sysioc_tsk = NULL;
2283 }1538 }
2284 1539
2285 if (dhd->dpc_tsk) {1540 brcmf_bus_detach(drvr);
2286 send_sig(SIGTERM, dhd->dpc_tsk, 1);
2287 kthread_stop(dhd->dpc_tsk);
2288 dhd->dpc_tsk = NULL;
2289 } else
2290 tasklet_kill(&dhd->tasklet);
2291
2292 if (dhd->sysioc_tsk) {
2293 send_sig(SIGTERM, dhd->sysioc_tsk, 1);
2294 kthread_stop(dhd->sysioc_tsk);
2295 dhd->sysioc_tsk = NULL;
2296 }
2297 1541
2298 dhd_bus_detach(dhdp);1542 if (drvr->prot)
1543 brcmf_proto_detach(drvr);
2299 1544
2300 if (dhdp->prot)1545 brcmf_cfg80211_detach();
2301 dhd_prot_detach(dhdp);
2302 1546
2303#if defined(CONFIG_WIRELESS_EXT)
2304 wl_iw_detach();
2305#endif /* (CONFIG_WIRELESS_EXT) */
2306
2307 if (IS_CFG80211_FAVORITE())
2308 wl_cfg80211_detach();
2309
2310#if defined(CONFIG_PM_SLEEP)
2311 if (!IS_CFG80211_FAVORITE())
2312 unregister_pm_notifier(&dhd_sleep_pm_notifier);
2313#endif /* defined(CONFIG_PM_SLEEP) */
2314 /* && defined(DHD_GPL) */
2315 free_netdev(ifp->net);1547 free_netdev(ifp->net);
2316 kfree(ifp);1548 kfree(ifp);
2317 kfree(dhd);1549 kfree(drvr_priv);
2318 }1550 }
2319 }1551 }
2320}1552}
2321 1553
2322static void __exit dhd_module_cleanup(void)1554static void __exit brcmf_module_cleanup(void)
2323{1555{
2324 DHD_TRACE(("%s: Enter\n", __func__));1556 BRCMF_TRACE(("%s: Enter\n", __func__));
2325 1557
2326 dhd_bus_unregister();1558 brcmf_bus_unregister();
2327#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
2328 wifi_del_dev();
2329#endif
2330 /* Call customer gpio to turn off power with WL_REG_ON signal */
2331 dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
2332}1559}
2333 1560
2334static int __init dhd_module_init(void)1561static int __init brcmf_module_init(void)
2335{1562{
2336 int error;1563 int error;
2337 1564
2338 DHD_TRACE(("%s: Enter\n", __func__));1565 BRCMF_TRACE(("%s: Enter\n", __func__));
2339 1566
2340 /* Sanity check on the module parameters */1567 error = brcmf_bus_register();
2341 do {
2342 /* Both watchdog and DPC as tasklets are ok */
2343 if ((dhd_watchdog_prio < 0) && (dhd_dpc_prio < 0))
2344 break;
2345
2346 /* If both watchdog and DPC are threads, TX must be deferred */
2347 if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0)
2348 && dhd_deferred_tx)
2349 break;
2350
2351 DHD_ERROR(("Invalid module parameters.\n"));
2352 return -EINVAL;
2353 } while (0);
2354 /* Call customer gpio to turn on power with WL_REG_ON signal */
2355 dhd_customer_gpio_wlan_ctrl(WLAN_POWER_ON);
2356
2357#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
2358 sema_init(&wifi_control_sem, 0);
2359
2360 error = wifi_add_dev();
2361 if (error) {
2362 DHD_ERROR(("%s: platform_driver_register failed\n", __func__));
2363 goto failed;
2364 }
2365
2366 /* Waiting callback after platform_driver_register is done or
2367 exit with error */
2368 if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
2369 printk(KERN_ERR "%s: platform_driver_register timeout\n",
2370 __func__);
2371 /* remove device */
2372 wifi_del_dev();
2373 goto failed;
2374 }
2375#endif /* #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */
2376
2377 error = dhd_bus_register();
2378 1568
2379 if (error) {1569 if (error) {
2380 DHD_ERROR(("%s: sdio_register_driver failed\n", __func__));1570 BRCMF_ERROR(("%s: brcmf_bus_register failed\n", __func__));
2381 goto failed;1571 goto failed;
2382 }1572 }
2383 return error;1573 return 0;
2384 1574
2385failed:1575failed:
2386 /* turn off power and exit */
2387 dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
2388 return -EINVAL;1576 return -EINVAL;
2389}1577}
2390 1578
2391module_init(dhd_module_init);1579module_init(brcmf_module_init);
2392module_exit(dhd_module_cleanup);1580module_exit(brcmf_module_cleanup);
2393 1581
2394/*1582int brcmf_os_proto_block(struct brcmf_pub *drvr)
2395 * OS specific functions required to implement DHD driver in OS independent way
2396 */
2397int dhd_os_proto_block(dhd_pub_t *pub)
2398{1583{
2399 dhd_info_t *dhd = (dhd_info_t *) (pub->info);1584 struct brcmf_info *drvr_priv = drvr->info;
2400 1585
2401 if (dhd) {1586 if (drvr_priv) {
2402 down(&dhd->proto_sem);1587 down(&drvr_priv->proto_sem);
2403 return 1;1588 return 1;
2404 }1589 }
2405 return 0;1590 return 0;
2406}1591}
2407 1592
2408int dhd_os_proto_unblock(dhd_pub_t *pub)1593int brcmf_os_proto_unblock(struct brcmf_pub *drvr)
2409{1594{
2410 dhd_info_t *dhd = (dhd_info_t *) (pub->info);1595 struct brcmf_info *drvr_priv = drvr->info;
2411 1596
2412 if (dhd) {1597 if (drvr_priv) {
2413 up(&dhd->proto_sem);1598 up(&drvr_priv->proto_sem);
2414 return 1;1599 return 1;
2415 }1600 }
2416 1601
2417 return 0;1602 return 0;
2418}1603}
2419 1604
2420unsigned int dhd_os_get_ioctl_resp_timeout(void)1605unsigned int brcmf_os_get_ioctl_resp_timeout(void)
2421{1606{
2422 return (unsigned int)dhd_ioctl_timeout_msec;1607 return (unsigned int)brcmf_ioctl_timeout_msec;
2423}1608}
2424 1609
2425void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec)1610void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec)
2426{1611{
2427 dhd_ioctl_timeout_msec = (int)timeout_msec;1612 brcmf_ioctl_timeout_msec = (int)timeout_msec;
2428}1613}
2429 1614
2430int dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool *pending)1615int brcmf_os_ioctl_resp_wait(struct brcmf_pub *drvr, uint *condition,
1616 bool *pending)
2431{1617{
2432 dhd_info_t *dhd = (dhd_info_t *) (pub->info);1618 struct brcmf_info *drvr_priv = drvr->info;
2433 DECLARE_WAITQUEUE(wait, current);1619 DECLARE_WAITQUEUE(wait, current);
2434 int timeout = dhd_ioctl_timeout_msec;1620 int timeout = brcmf_ioctl_timeout_msec;
2435 1621
2436 /* Convert timeout in millsecond to jiffies */1622 /* Convert timeout in millsecond to jiffies */
2437 timeout = timeout * HZ / 1000;1623 timeout = timeout * HZ / 1000;
2438 1624
2439 /* Wait until control frame is available */1625 /* Wait until control frame is available */
2440 add_wait_queue(&dhd->ioctl_resp_wait, &wait);1626 add_wait_queue(&drvr_priv->ioctl_resp_wait, &wait);
2441 set_current_state(TASK_INTERRUPTIBLE);1627 set_current_state(TASK_INTERRUPTIBLE);
2442 1628
2443 while (!(*condition) && (!signal_pending(current) && timeout))1629 while (!(*condition) && (!signal_pending(current) && timeout))
@@ -2447,366 +1633,59 @@ int dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool *pending) · 3 unmodified lines
2447 *pending = true;1633 *pending = true;
2448 1634
2449 set_current_state(TASK_RUNNING);1635 set_current_state(TASK_RUNNING);
2450 remove_wait_queue(&dhd->ioctl_resp_wait, &wait);1636 remove_wait_queue(&drvr_priv->ioctl_resp_wait, &wait);
2451 1637
2452 return timeout;1638 return timeout;
2453}1639}
2454 1640
2455int dhd_os_ioctl_resp_wake(dhd_pub_t *pub)1641int brcmf_os_ioctl_resp_wake(struct brcmf_pub *drvr)
2456{1642{
2457 dhd_info_t *dhd = (dhd_info_t *) (pub->info);1643 struct brcmf_info *drvr_priv = drvr->info;
2458 1644
2459 if (waitqueue_active(&dhd->ioctl_resp_wait))1645 if (waitqueue_active(&drvr_priv->ioctl_resp_wait))
2460 wake_up_interruptible(&dhd->ioctl_resp_wait);1646 wake_up_interruptible(&drvr_priv->ioctl_resp_wait);
2461 1647
2462 return 0;1648 return 0;
2463}1649}
2464 1650
2465void dhd_os_wd_timer(void *bus, uint wdtick)1651static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
2466{1652 struct brcmf_event_msg *event, void **data)
2467 dhd_pub_t *pub = bus;
2468 static uint save_dhd_watchdog_ms;
2469 dhd_info_t *dhd = (dhd_info_t *) pub->info;
2470
2471 /* don't start the wd until fw is loaded */
2472 if (pub->busstate == DHD_BUS_DOWN)
2473 return;
2474
2475 /* Totally stop the timer */
2476 if (!wdtick && dhd->wd_timer_valid == true) {
2477 del_timer_sync(&dhd->timer);
2478 dhd->wd_timer_valid = false;
2479 save_dhd_watchdog_ms = wdtick;
2480 return;
2481 }
2482
2483 if (wdtick) {
2484 dhd_watchdog_ms = (uint) wdtick;
2485
2486 if (save_dhd_watchdog_ms != dhd_watchdog_ms) {
2487
2488 if (dhd->wd_timer_valid == true)
2489 /* Stop timer and restart at new value */
2490 del_timer_sync(&dhd->timer);
2491
2492 /* Create timer again when watchdog period is
2493 dynamically changed or in the first instance
2494 */
2495 dhd->timer.expires =
2496 jiffies + dhd_watchdog_ms * HZ / 1000;
2497 add_timer(&dhd->timer);
2498
2499 } else {
2500 /* Re arm the timer, at last watchdog period */
2501 mod_timer(&dhd->timer,
2502 jiffies + dhd_watchdog_ms * HZ / 1000);
2503 }
2504
2505 dhd->wd_timer_valid = true;
2506 save_dhd_watchdog_ms = wdtick;
2507 }
2508}
2509
2510void *dhd_os_open_image(char *filename)
2511{
2512 struct file *fp;
2513
2514 if (IS_CFG80211_FAVORITE() && !NO_FW_REQ())
2515 return wl_cfg80211_request_fw(filename);
2516
2517 fp = filp_open(filename, O_RDONLY, 0);
2518 /*
2519 * 2.6.11 (FC4) supports filp_open() but later revs don't?
2520 * Alternative:
2521 * fp = open_namei(AT_FDCWD, filename, O_RD, 0);
2522 * ???
2523 */
2524 if (IS_ERR(fp))
2525 fp = NULL;
2526
2527 return fp;
2528}
2529
2530int dhd_os_get_image_block(char *buf, int len, void *image)
2531{
2532 struct file *fp = (struct file *)image;
2533 int rdlen;
2534
2535 if (IS_CFG80211_FAVORITE() && !NO_FW_REQ())
2536 return wl_cfg80211_read_fw(buf, len);
2537
2538 if (!image)
2539 return 0;
2540
2541 rdlen = kernel_read(fp, fp->f_pos, buf, len);
2542 if (rdlen > 0)
2543 fp->f_pos += rdlen;
2544
2545 return rdlen;
2546}
2547
2548void dhd_os_close_image(void *image)
2549{
2550 if (IS_CFG80211_FAVORITE() && !NO_FW_REQ())
2551 return wl_cfg80211_release_fw();
2552 if (image)
2553 filp_close((struct file *)image, NULL);
2554}
2555
2556void dhd_os_sdlock(dhd_pub_t *pub)
2557{
2558 dhd_info_t *dhd;
2559
2560 dhd = (dhd_info_t *) (pub->info);
2561
2562 if (dhd->threads_only)
2563 down(&dhd->sdsem);
2564 else
2565 spin_lock_bh(&dhd->sdlock);
2566}
2567
2568void dhd_os_sdunlock(dhd_pub_t *pub)
2569{
2570 dhd_info_t *dhd;
2571
2572 dhd = (dhd_info_t *) (pub->info);
2573
2574 if (dhd->threads_only)
2575 up(&dhd->sdsem);
2576 else
2577 spin_unlock_bh(&dhd->sdlock);
2578}
2579
2580void dhd_os_sdlock_txq(dhd_pub_t *pub)
2581{
2582 dhd_info_t *dhd;
2583
2584 dhd = (dhd_info_t *) (pub->info);
2585 spin_lock_bh(&dhd->txqlock);
2586}
2587
2588void dhd_os_sdunlock_txq(dhd_pub_t *pub)
2589{
2590 dhd_info_t *dhd;
2591
2592 dhd = (dhd_info_t *) (pub->info);
2593 spin_unlock_bh(&dhd->txqlock);
2594}
2595
2596void dhd_os_sdlock_rxq(dhd_pub_t *pub)
2597{
2598}
2599
2600void dhd_os_sdunlock_rxq(dhd_pub_t *pub)
2601{
2602}
2603
2604void dhd_os_sdtxlock(dhd_pub_t *pub)
2605{
2606 dhd_os_sdlock(pub);
2607}
2608
2609void dhd_os_sdtxunlock(dhd_pub_t *pub)
2610{
2611 dhd_os_sdunlock(pub);
2612}
2613
2614static int
2615dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
2616 wl_event_msg_t *event, void **data)
2617{1653{
2618 int bcmerror = 0;1654 int bcmerror = 0;
2619 1655
2620 ASSERT(dhd != NULL);1656 bcmerror = brcmf_c_host_event(drvr_priv, ifidx, pktdata, event, data);
2621
2622 bcmerror = wl_host_event(dhd, ifidx, pktdata, event, data);
2623 if (bcmerror != 0)1657 if (bcmerror != 0)
2624 return bcmerror;1658 return bcmerror;
2625 1659
2626#if defined(CONFIG_WIRELESS_EXT)1660 if (drvr_priv->iflist[*ifidx]->net)
2627 if (!IS_CFG80211_FAVORITE()) {1661 brcmf_cfg80211_event(drvr_priv->iflist[*ifidx]->net,
2628 if ((dhd->iflist[*ifidx] == NULL)1662 event, *data);
2629 || (dhd->iflist[*ifidx]->net == NULL)) {
2630 DHD_ERROR(("%s Exit null pointer\n", __func__));
2631 return bcmerror;
2632 }
2633
2634 if (dhd->iflist[*ifidx]->net)
2635 wl_iw_event(dhd->iflist[*ifidx]->net, event, *data);
2636 }
2637#endif /* defined(CONFIG_WIRELESS_EXT) */
2638
2639 if (IS_CFG80211_FAVORITE()) {
2640 ASSERT(dhd->iflist[*ifidx] != NULL);
2641 ASSERT(dhd->iflist[*ifidx]->net != NULL);
2642 if (dhd->iflist[*ifidx]->net)
2643 wl_cfg80211_event(dhd->iflist[*ifidx]->net, event,
2644 *data);
2645 }
2646 1663
2647 return bcmerror;1664 return bcmerror;
2648}1665}
2649 1666
2650/* send up locally generated event */1667int brcmf_netdev_reset(struct net_device *dev, u8 flag)
2651void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data)
2652{
2653 switch (be32_to_cpu(event->event_type)) {
2654 default:
2655 break;
2656 }
2657}
2658
2659void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar)
2660{1668{
2661 struct dhd_info *dhdinfo = dhd->info;1669 struct brcmf_info *drvr_priv = *(struct brcmf_info **)netdev_priv(dev);
2662 dhd_os_sdunlock(dhd);
2663 wait_event_interruptible_timeout(dhdinfo->ctrl_wait,
2664 (*lockvar == false), HZ * 2);
2665 dhd_os_sdlock(dhd);
2666 return;
2667}
2668 1670
2669void dhd_wait_event_wakeup(dhd_pub_t *dhd)1671 brcmf_bus_devreset(&drvr_priv->pub, flag);
2670{
2671 struct dhd_info *dhdinfo = dhd->info;
2672 if (waitqueue_active(&dhdinfo->ctrl_wait))
2673 wake_up_interruptible(&dhdinfo->ctrl_wait);
2674 return;
2675}
2676
2677int dhd_dev_reset(struct net_device *dev, u8 flag)
2678{
2679 dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
2680
2681 /* Turning off watchdog */
2682 if (flag)
2683 dhd_os_wd_timer(&dhd->pub, 0);
2684
2685 dhd_bus_devreset(&dhd->pub, flag);
2686
2687 /* Turning on watchdog back */
2688 if (!flag)
2689 dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms);
2690 DHD_ERROR(("%s: WLAN OFF DONE\n", __func__));
2691 1672
2692 return 1;1673 return 1;
2693}1674}
2694 1675
2695int net_os_set_suspend_disable(struct net_device *dev, int val)1676static int brcmf_get_pend_8021x_cnt(struct brcmf_info *drvr_priv)
2696{
2697 dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
2698 int ret = 0;
2699
2700 if (dhd) {
2701 ret = dhd->pub.suspend_disable_flag;
2702 dhd->pub.suspend_disable_flag = val;
2703 }
2704 return ret;
2705}
2706
2707int net_os_set_suspend(struct net_device *dev, int val)
2708{1677{
2709 int ret = 0;1678 return atomic_read(&drvr_priv->pend_8021x_cnt);
2710#if defined(CONFIG_HAS_EARLYSUSPEND)
2711 dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
2712
2713 if (dhd) {
2714 dhd_os_proto_block(&dhd->pub);
2715 ret = dhd_set_suspend(val, &dhd->pub);
2716 dhd_os_proto_unblock(&dhd->pub);
2717 }
2718#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */
2719 return ret;
2720}
2721
2722int net_os_set_dtim_skip(struct net_device *dev, int val)
2723{
2724 dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(dev);
2725
2726 if (dhd)
2727 dhd->pub.dtim_skip = val;
2728
2729 return 0;
2730}
2731
2732int net_os_set_packet_filter(struct net_device *dev, int val)
2733{
2734 dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(dev);
2735 int ret = 0;
2736
2737 /* Packet filtering is set only if we still in early-suspend and
2738 * we need either to turn it ON or turn it OFF
2739 * We can always turn it OFF in case of early-suspend, but we turn it
2740 * back ON only if suspend_disable_flag was not set
2741 */
2742 if (dhd && dhd->pub.up) {
2743 dhd_os_proto_block(&dhd->pub);
2744 if (dhd->pub.in_suspend) {
2745 if (!val || (val && !dhd->pub.suspend_disable_flag))
2746 dhd_set_packet_filter(val, &dhd->pub);
2747 }
2748 dhd_os_proto_unblock(&dhd->pub);
2749 }
2750 return ret;
2751}
2752
2753void dhd_dev_init_ioctl(struct net_device *dev)
2754{
2755 dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
2756
2757 dhd_preinit_ioctls(&dhd->pub);
2758}
2759
2760#ifdef PNO_SUPPORT
2761/* Linux wrapper to call common dhd_pno_clean */
2762int dhd_dev_pno_reset(struct net_device *dev)
2763{
2764 dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
2765
2766 return dhd_pno_clean(&dhd->pub);
2767}
2768
2769/* Linux wrapper to call common dhd_pno_enable */
2770int dhd_dev_pno_enable(struct net_device *dev, int pfn_enabled)
2771{
2772 dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
2773
2774 return dhd_pno_enable(&dhd->pub, pfn_enabled);
2775}
2776
2777/* Linux wrapper to call common dhd_pno_set */
2778int
2779dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t *ssids_local, int nssid,
2780 unsigned char scan_fr)
2781{
2782 dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
2783
2784 return dhd_pno_set(&dhd->pub, ssids_local, nssid, scan_fr);
2785}
2786
2787/* Linux wrapper to get pno status */
2788int dhd_dev_get_pno_status(struct net_device *dev)
2789{
2790 dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
2791
2792 return dhd_pno_get_status(&dhd->pub);
2793}
2794
2795#endif /* PNO_SUPPORT */
2796
2797static int dhd_get_pend_8021x_cnt(dhd_info_t *dhd)
2798{
2799 return atomic_read(&dhd->pend_8021x_cnt);
2800}1679}
2801 1680
2802#define MAX_WAIT_FOR_8021X_TX 101681#define MAX_WAIT_FOR_8021X_TX 10
2803 1682
2804int dhd_wait_pend8021x(struct net_device *dev)1683int brcmf_netdev_wait_pend8021x(struct net_device *dev)
2805{1684{
2806 dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);1685 struct brcmf_info *drvr_priv = *(struct brcmf_info **)netdev_priv(dev);
2807 int timeout = 10 * HZ / 1000;1686 int timeout = 10 * HZ / 1000;
2808 int ntimes = MAX_WAIT_FOR_8021X_TX;1687 int ntimes = MAX_WAIT_FOR_8021X_TX;
2809 int pend = dhd_get_pend_8021x_cnt(dhd);1688 int pend = brcmf_get_pend_8021x_cnt(drvr_priv);
2810 1689
2811 while (ntimes && pend) {1690 while (ntimes && pend) {
2812 if (pend) {1691 if (pend) {
@@ -2815,20 +1694,13 @@ int dhd_wait_pend8021x(struct net_device *dev) · 2 unmodified lines
2815 set_current_state(TASK_RUNNING);1694 set_current_state(TASK_RUNNING);
2816 ntimes--;1695 ntimes--;
2817 }1696 }
2818 pend = dhd_get_pend_8021x_cnt(dhd);1697 pend = brcmf_get_pend_8021x_cnt(drvr_priv);
2819 }1698 }
2820 return pend;1699 return pend;
2821}1700}
2822 1701
2823void wl_os_wd_timer(struct net_device *ndev, uint wdtick)1702#ifdef BCMDBG
2824{1703int brcmf_write_to_file(struct brcmf_pub *drvr, u8 *buf, int size)
2825 dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(ndev);
2826
2827 dhd_os_wd_timer(&dhd->pub, wdtick);
2828}
2829
2830#ifdef DHD_DEBUG
2831int write_to_file(dhd_pub_t *dhd, u8 *buf, int size)
2832{1704{
2833 int ret = 0;1705 int ret = 0;
2834 struct file *fp;1706 struct file *fp;
@@ -2842,7 +1714,7 @@ int write_to_file(dhd_pub_t *dhd, u8 *buf, int size) · 7 unmodified lines
2842 /* open file to write */1714 /* open file to write */
2843 fp = filp_open("/tmp/mem_dump", O_WRONLY | O_CREAT, 0640);1715 fp = filp_open("/tmp/mem_dump", O_WRONLY | O_CREAT, 0640);
2844 if (!fp) {1716 if (!fp) {
2845 DHD_ERROR(("%s: open file error\n", __func__));1717 BRCMF_ERROR(("%s: open file error\n", __func__));
2846 ret = -1;1718 ret = -1;
2847 goto exit;1719 goto exit;
2848 }1720 }
@@ -2861,4 +1733,4 @@ exit: · 12 unmodified lines
2861 1733
2862 return ret;1734 return ret;
2863}1735}
2864#endif /* DHD_DEBUG */1736#endif /* BCMDBG */
drivers/staging/brcm80211/brcmfmac/dhd_linux_sched.c+0−25
@@ -1,25 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/sched.h>
19
20int setScheduler(struct task_struct *p, int policy, struct sched_param *param)
21{
22 int rc = 0;
23 rc = sched_setscheduler(p, policy, param);
24 return rc;
25}
drivers/staging/brcm80211/brcmfmac/dhd_proto.h+24−39
@@ -14,11 +14,8 @@ · 13 unmodified lines
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */15 */
16 16
17#ifndef _dhd_proto_h_17#ifndef _BRCMF_PROTO_H_
18#define _dhd_proto_h_18#define _BRCMF_PROTO_H_
19
20#include <dhdioctl.h>
21#include <wlioctl.h>
22 19
23#ifndef IOCTL_RESP_TIMEOUT20#ifndef IOCTL_RESP_TIMEOUT
24#define IOCTL_RESP_TIMEOUT 2000 /* In milli second */21#define IOCTL_RESP_TIMEOUT 2000 /* In milli second */
@@ -29,62 +26,50 @@ · 4 unmodified lines
29#endif26#endif
30 27
31/*28/*
32 * Exported from the dhd protocol module (dhd_cdc, dhd_rndis)29 * Exported from the brcmf protocol module (brcmf_cdc)
33 */30 */
34 31
35/* Linkage, sets prot link and updates hdrlen in pub */32/* Linkage, sets prot link and updates hdrlen in pub */
36extern int dhd_prot_attach(dhd_pub_t *dhdp);33extern int brcmf_proto_attach(struct brcmf_pub *drvr);
37 34
38/* Unlink, frees allocated protocol memory (including dhd_prot) */35/* Unlink, frees allocated protocol memory (including brcmf_proto) */
39extern void dhd_prot_detach(dhd_pub_t *dhdp);36extern void brcmf_proto_detach(struct brcmf_pub *drvr);
40 37
41/* Initialize protocol: sync w/dongle state.38/* Initialize protocol: sync w/dongle state.
42 * Sets dongle media info (iswl, drv_version, mac address).39 * Sets dongle media info (iswl, drv_version, mac address).
43 */40 */
44extern int dhd_prot_init(dhd_pub_t *dhdp);41extern int brcmf_proto_init(struct brcmf_pub *drvr);
45 42
46/* Stop protocol: sync w/dongle state. */43/* Stop protocol: sync w/dongle state. */
47extern void dhd_prot_stop(dhd_pub_t *dhdp);44extern void brcmf_proto_stop(struct brcmf_pub *drvr);
48 45
49/* Add any protocol-specific data header.46/* Add any protocol-specific data header.
50 * Caller must reserve prot_hdrlen prepend space.47 * Caller must reserve prot_hdrlen prepend space.
51 */48 */
52extern void dhd_prot_hdrpush(dhd_pub_t *, int ifidx, struct sk_buff *txp);49extern void brcmf_proto_hdrpush(struct brcmf_pub *, int ifidx,
50 struct sk_buff *txp);
53 51
54/* Remove any protocol-specific data header. */52/* Remove any protocol-specific data header. */
55extern int dhd_prot_hdrpull(dhd_pub_t *, int *ifidx, struct sk_buff *rxp);53extern int brcmf_proto_hdrpull(struct brcmf_pub *, int *ifidx,
54 struct sk_buff *rxp);
56 55
57/* Use protocol to issue ioctl to dongle */56/* Use protocol to issue ioctl to dongle */
58extern int dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc,57extern int brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx,
59 void *buf, int len);58 struct brcmf_ioctl *ioc, void *buf, int len);
60
61/* Check for and handle local prot-specific iovar commands */
62extern int dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name,
63 void *params, int plen, void *arg, int len,
64 bool set);
65 59
66/* Add prot dump output to a buffer */60/* Add prot dump output to a buffer */
67extern void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf);61extern void brcmf_proto_dump(struct brcmf_pub *drvr,
62 struct brcmu_strbuf *strbuf);
68 63
69/* Update local copy of dongle statistics */64/* Update local copy of dongle statistics */
70extern void dhd_prot_dstats(dhd_pub_t *dhdp);65extern void brcmf_proto_dstats(struct brcmf_pub *drvr);
71 66
72extern int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf,67extern int brcmf_c_ioctl(struct brcmf_pub *drvr, struct brcmf_c_ioctl *ioc,
73 uint buflen);68 void *buf, uint buflen);
74 69
75extern int dhd_preinit_ioctls(dhd_pub_t *dhd);70extern int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr);
76 71
77/********************************72extern int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx,
78 * For version-string expansion *73 uint cmd, void *buf, uint len);
79 */74
80#if defined(BDC)75#endif /* _BRCMF_PROTO_H_ */
81#define DHD_PROTOCOL "bdc"
82#elif defined(CDC)
83#define DHD_PROTOCOL "cdc"
84#elif defined(RNDIS)
85#define DHD_PROTOCOL "rndis"
86#else
87#define DHD_PROTOCOL "unknown"
88#endif /* proto */
89
90#endif /* _dhd_proto_h_ */
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c+2564−2181
@@ -16,46 +16,145 @@ · 15 unmodified lines
16 16
17#include <linux/types.h>17#include <linux/types.h>
18#include <linux/kernel.h>18#include <linux/kernel.h>
19#include <linux/kthread.h>
19#include <linux/printk.h>20#include <linux/printk.h>
20#include <linux/pci_ids.h>21#include <linux/pci_ids.h>
21#include <linux/netdevice.h>22#include <linux/netdevice.h>
22#include <bcmdefs.h>23#include <linux/interrupt.h>
23#include <bcmsdh.h>24#include <linux/sched.h>
24 25#include <linux/mmc/sdio.h>
25#ifdef BCMEMBEDIMAGE26#include <linux/mmc/sdio_func.h>
26#include BCMEMBEDIMAGE27#include <linux/semaphore.h>
27#endif /* BCMEMBEDIMAGE */28#include <linux/firmware.h>
28 29#include <asm/unaligned.h>
29#include <bcmutils.h>30#include <defs.h>
30#include <bcmdevs.h>31#include <brcmu_wifi.h>
31 32#include <brcmu_utils.h>
32#include <hndsoc.h>33#include <brcm_hw_ids.h>
33#ifdef DHD_DEBUG34#include <soc.h>
34#include <hndrte_armtrap.h>35#include "sdio_host.h"
35#include <hndrte_cons.h>36
36#endif /* DHD_DEBUG */37/* register access macros */
37#include <sbchipc.h>38#ifndef __BIG_ENDIAN
38#include <sbhnddma.h>39#ifndef __mips__
39 40#define R_REG(r, typ) \
40#include <sdio.h>41 brcmf_sdcard_reg_read(NULL, (r), sizeof(typ))
41#include <sbsdio.h>42#else /* __mips__ */
42#include <sbsdpcmdev.h>43#define R_REG(r, typ) \
43#include <bcmsdpcm.h>44 ({ \
44 45 __typeof(*(r)) __osl_v; \
45#include <proto/802.11.h>46 __asm__ __volatile__("sync"); \
46 47 __osl_v = brcmf_sdcard_reg_read(NULL, (r),\
47#include <dngl_stats.h>48 sizeof(typ)); \
48#include <dhd.h>49 __asm__ __volatile__("sync"); \
49#include <dhd_bus.h>50 __osl_v; \
50#include <dhd_proto.h>51 })
51#include <dhd_dbg.h>52#endif /* __mips__ */
52#include <dhdioctl.h>53
53#include <sdiovar.h>54#else /* __BIG_ENDIAN */
54#include <bcmchip.h>55#define R_REG(r, typ) \
56 brcmf_sdcard_reg_read(NULL, (r), sizeof(typ))
57#endif /* __BIG_ENDIAN */
58
59#define OR_REG(r, v, typ) \
60 brcmf_sdcard_reg_write(NULL, (r), sizeof(typ), R_REG(r, typ) | (v))
61
62#ifdef BCMDBG
63
64/* ARM trap handling */
65
66/* Trap types defined by ARM (see arminc.h) */
67
68#if defined(__ARM_ARCH_4T__)
69#define MAX_TRAP_TYPE (TR_FIQ + 1)
70#elif defined(__ARM_ARCH_7M__)
71#define MAX_TRAP_TYPE (TR_ISR + ARMCM3_NUMINTS)
72#endif /* __ARM_ARCH_7M__ */
73
74/* The trap structure is defined here as offsets for assembly */
75#define TR_TYPE 0x00
76#define TR_EPC 0x04
77#define TR_CPSR 0x08
78#define TR_SPSR 0x0c
79#define TR_REGS 0x10
80#define TR_REG(n) (TR_REGS + (n) * 4)
81#define TR_SP TR_REG(13)
82#define TR_LR TR_REG(14)
83#define TR_PC TR_REG(15)
84
85#define TRAP_T_SIZE 80
86
87struct brcmf_trap {
88 u32 type;
89 u32 epc;
90 u32 cpsr;
91 u32 spsr;
92 u32 r0;
93 u32 r1;
94 u32 r2;
95 u32 r3;
96 u32 r4;
97 u32 r5;
98 u32 r6;
99 u32 r7;
100 u32 r8;
101 u32 r9;
102 u32 r10;
103 u32 r11;
104 u32 r12;
105 u32 r13;
106 u32 r14;
107 u32 pc;
108};
55 109
56#ifndef DHDSDIO_MEM_DUMP_FNAME110#define CBUF_LEN (128)
57#define DHDSDIO_MEM_DUMP_FNAME "mem_dump"111
58#endif112struct rte_log {
113 u32 buf; /* Can't be pointer on (64-bit) hosts */
114 uint buf_size;
115 uint idx;
116 char *_buf_compat; /* Redundant pointer for backward compat. */
117};
118
119struct rte_console {
120 /* Virtual UART
121 * When there is no UART (e.g. Quickturn),
122 * the host should write a complete
123 * input line directly into cbuf and then write
124 * the length into vcons_in.
125 * This may also be used when there is a real UART
126 * (at risk of conflicting with
127 * the real UART). vcons_out is currently unused.
128 */
129 volatile uint vcons_in;
130 volatile uint vcons_out;
131
132 /* Output (logging) buffer
133 * Console output is written to a ring buffer log_buf at index log_idx.
134 * The host may read the output when it sees log_idx advance.
135 * Output will be lost if the output wraps around faster than the host
136 * polls.
137 */
138 struct rte_log log;
139
140 /* Console input line buffer
141 * Characters are read one at a time into cbuf
142 * until <CR> is received, then
143 * the buffer is processed as a command line.
144 * Also used for virtual UART.
145 */
146 uint cbuf_idx;
147 char cbuf[CBUF_LEN];
148};
149
150#endif /* BCMDBG */
151#include <chipcommon.h>
152
153#include "dhd.h"
154#include "dhd_bus.h"
155#include "dhd_proto.h"
156#include "dhd_dbg.h"
157#include <bcmchip.h>
59 158
60#define TXQLEN 2048 /* bulk tx queue length */159#define TXQLEN 2048 /* bulk tx queue length */
61#define TXHI (TXQLEN - 256) /* turn on flow control above TXHI */160#define TXHI (TXQLEN - 256) /* turn on flow control above TXHI */
@@ -64,47 +163,239 @@ · 2 unmodified lines
64 163
65#define TXRETRIES 2 /* # of retries for tx frames */164#define TXRETRIES 2 /* # of retries for tx frames */
66 165
67#if defined(CONFIG_MACH_SANDGATE2G)166#define BRCMF_RXBOUND 50 /* Default for max rx frames in
68#define DHD_RXBOUND 250 /* Default for max rx frames in
69 one scheduling */167 one scheduling */
70#else
71#define DHD_RXBOUND 50 /* Default for max rx frames in
72 one scheduling */
73#endif /* defined(CONFIG_MACH_SANDGATE2G) */
74 168
75#define DHD_TXBOUND 20 /* Default for max tx frames in169#define BRCMF_TXBOUND 20 /* Default for max tx frames in
76 one scheduling */170 one scheduling */
77 171
78#define DHD_TXMINMAX 1 /* Max tx frames if rx still pending */172#define BRCMF_TXMINMAX 1 /* Max tx frames if rx still pending */
79 173
80#define MEMBLOCK 2048 /* Block size used for downloading174#define MEMBLOCK 2048 /* Block size used for downloading
81 of dongle image */175 of dongle image */
82#define MAX_DATA_BUF (32 * 1024) /* Must be large enough to hold176#define MAX_DATA_BUF (32 * 1024) /* Must be large enough to hold
83 biggest possible glom */177 biggest possible glom */
84 178
85/* Packet alignment for most efficient SDIO (can change based on platform) */179#ifndef BRCMF_FIRSTREAD
86#ifndef DHD_SDALIGN180#define BRCMF_FIRSTREAD 32
87#define DHD_SDALIGN 32
88#endif
89#if !ISPOWEROF2(DHD_SDALIGN)
90#error DHD_SDALIGN is not a power of 2!
91#endif181#endif
92 182
93#ifndef DHD_FIRSTREAD183#if !ISPOWEROF2(BRCMF_FIRSTREAD)
94#define DHD_FIRSTREAD 32184#error BRCMF_FIRSTREAD is not a power of 2!
95#endif
96#if !ISPOWEROF2(DHD_FIRSTREAD)
97#error DHD_FIRSTREAD is not a power of 2!
98#endif185#endif
99 186
187/* SBSDIO_DEVICE_CTL */
188#define SBSDIO_DEVCTL_SETBUSY 0x01 /* 1: device will assert busy signal when
189 * receiving CMD53
190 */
191#define SBSDIO_DEVCTL_SPI_INTR_SYNC 0x02 /* 1: assertion of sdio interrupt is
192 * synchronous to the sdio clock
193 */
194#define SBSDIO_DEVCTL_CA_INT_ONLY 0x04 /* 1: mask all interrupts to host
195 * except the chipActive (rev 8)
196 */
197#define SBSDIO_DEVCTL_PADS_ISO 0x08 /* 1: isolate internal sdio signals, put
198 * external pads in tri-state; requires
199 * sdio bus power cycle to clear (rev 9)
200 */
201#define SBSDIO_DEVCTL_SB_RST_CTL 0x30 /* Force SD->SB reset mapping (rev 11) */
202#define SBSDIO_DEVCTL_RST_CORECTL 0x00 /* Determined by CoreControl bit */
203#define SBSDIO_DEVCTL_RST_BPRESET 0x10 /* Force backplane reset */
204#define SBSDIO_DEVCTL_RST_NOBPRESET 0x20 /* Force no backplane reset */
205
206/* SBSDIO_FUNC1_CHIPCLKCSR */
207#define SBSDIO_FORCE_ALP 0x01 /* Force ALP request to backplane */
208#define SBSDIO_FORCE_HT 0x02 /* Force HT request to backplane */
209#define SBSDIO_FORCE_ILP 0x04 /* Force ILP request to backplane */
210#define SBSDIO_ALP_AVAIL_REQ 0x08 /* Make ALP ready (power up xtal) */
211#define SBSDIO_HT_AVAIL_REQ 0x10 /* Make HT ready (power up PLL) */
212#define SBSDIO_FORCE_HW_CLKREQ_OFF 0x20 /* Squelch clock requests from HW */
213#define SBSDIO_ALP_AVAIL 0x40 /* Status: ALP is ready */
214#define SBSDIO_HT_AVAIL 0x80 /* Status: HT is ready */
215
216#define SBSDIO_AVBITS (SBSDIO_HT_AVAIL | SBSDIO_ALP_AVAIL)
217#define SBSDIO_ALPAV(regval) ((regval) & SBSDIO_AVBITS)
218#define SBSDIO_HTAV(regval) (((regval) & SBSDIO_AVBITS) == SBSDIO_AVBITS)
219#define SBSDIO_ALPONLY(regval) (SBSDIO_ALPAV(regval) && !SBSDIO_HTAV(regval))
220#define SBSDIO_CLKAV(regval, alponly) (SBSDIO_ALPAV(regval) && \
221 (alponly ? 1 : SBSDIO_HTAV(regval)))
222/* direct(mapped) cis space */
223#define SBSDIO_CIS_BASE_COMMON 0x1000 /* MAPPED common CIS address */
224#define SBSDIO_CIS_SIZE_LIMIT 0x200 /* maximum bytes in one CIS */
225#define SBSDIO_CIS_OFT_ADDR_MASK 0x1FFFF /* cis offset addr is < 17 bits */
226
227#define SBSDIO_CIS_MANFID_TUPLE_LEN 6 /* manfid tuple length, include tuple,
228 * link bytes
229 */
230
231/* intstatus */
232#define I_SMB_SW0 (1 << 0) /* To SB Mail S/W interrupt 0 */
233#define I_SMB_SW1 (1 << 1) /* To SB Mail S/W interrupt 1 */
234#define I_SMB_SW2 (1 << 2) /* To SB Mail S/W interrupt 2 */
235#define I_SMB_SW3 (1 << 3) /* To SB Mail S/W interrupt 3 */
236#define I_SMB_SW_MASK 0x0000000f /* To SB Mail S/W interrupts mask */
237#define I_SMB_SW_SHIFT 0 /* To SB Mail S/W interrupts shift */
238#define I_HMB_SW0 (1 << 4) /* To Host Mail S/W interrupt 0 */
239#define I_HMB_SW1 (1 << 5) /* To Host Mail S/W interrupt 1 */
240#define I_HMB_SW2 (1 << 6) /* To Host Mail S/W interrupt 2 */
241#define I_HMB_SW3 (1 << 7) /* To Host Mail S/W interrupt 3 */
242#define I_HMB_SW_MASK 0x000000f0 /* To Host Mail S/W interrupts mask */
243#define I_HMB_SW_SHIFT 4 /* To Host Mail S/W interrupts shift */
244#define I_WR_OOSYNC (1 << 8) /* Write Frame Out Of Sync */
245#define I_RD_OOSYNC (1 << 9) /* Read Frame Out Of Sync */
246#define I_PC (1 << 10) /* descriptor error */
247#define I_PD (1 << 11) /* data error */
248#define I_DE (1 << 12) /* Descriptor protocol Error */
249#define I_RU (1 << 13) /* Receive descriptor Underflow */
250#define I_RO (1 << 14) /* Receive fifo Overflow */
251#define I_XU (1 << 15) /* Transmit fifo Underflow */
252#define I_RI (1 << 16) /* Receive Interrupt */
253#define I_BUSPWR (1 << 17) /* SDIO Bus Power Change (rev 9) */
254#define I_XMTDATA_AVAIL (1 << 23) /* bits in fifo */
255#define I_XI (1 << 24) /* Transmit Interrupt */
256#define I_RF_TERM (1 << 25) /* Read Frame Terminate */
257#define I_WF_TERM (1 << 26) /* Write Frame Terminate */
258#define I_PCMCIA_XU (1 << 27) /* PCMCIA Transmit FIFO Underflow */
259#define I_SBINT (1 << 28) /* sbintstatus Interrupt */
260#define I_CHIPACTIVE (1 << 29) /* chip from doze to active state */
261#define I_SRESET (1 << 30) /* CCCR RES interrupt */
262#define I_IOE2 (1U << 31) /* CCCR IOE2 Bit Changed */
263#define I_ERRORS (I_PC | I_PD | I_DE | I_RU | I_RO | I_XU)
264#define I_DMA (I_RI | I_XI | I_ERRORS)
265
266/* corecontrol */
267#define CC_CISRDY (1 << 0) /* CIS Ready */
268#define CC_BPRESEN (1 << 1) /* CCCR RES signal */
269#define CC_F2RDY (1 << 2) /* set CCCR IOR2 bit */
270#define CC_CLRPADSISO (1 << 3) /* clear SDIO pads isolation */
271#define CC_XMTDATAAVAIL_MODE (1 << 4)
272#define CC_XMTDATAAVAIL_CTRL (1 << 5)
273
274/* SDA_FRAMECTRL */
275#define SFC_RF_TERM (1 << 0) /* Read Frame Terminate */
276#define SFC_WF_TERM (1 << 1) /* Write Frame Terminate */
277#define SFC_CRC4WOOS (1 << 2) /* CRC error for write out of sync */
278#define SFC_ABORTALL (1 << 3) /* Abort all in-progress frames */
279
280/* HW frame tag */
281#define SDPCM_FRAMETAG_LEN 4 /* 2 bytes len, 2 bytes check val */
282
100/* Total length of frame header for dongle protocol */283/* Total length of frame header for dongle protocol */
101#define SDPCM_HDRLEN (SDPCM_FRAMETAG_LEN + SDPCM_SWHEADER_LEN)284#define SDPCM_HDRLEN (SDPCM_FRAMETAG_LEN + SDPCM_SWHEADER_LEN)
102#ifdef SDTEST285#ifdef SDTEST
103#define SDPCM_RESERVE (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN)286#define SDPCM_RESERVE (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + BRCMF_SDALIGN)
104#else287#else
105#define SDPCM_RESERVE (SDPCM_HDRLEN + DHD_SDALIGN)288#define SDPCM_RESERVE (SDPCM_HDRLEN + BRCMF_SDALIGN)
106#endif289#endif
107 290
291/*
292 * Software allocation of To SB Mailbox resources
293 */
294
295/* tosbmailbox bits corresponding to intstatus bits */
296#define SMB_NAK (1 << 0) /* Frame NAK */
297#define SMB_INT_ACK (1 << 1) /* Host Interrupt ACK */
298#define SMB_USE_OOB (1 << 2) /* Use OOB Wakeup */
299#define SMB_DEV_INT (1 << 3) /* Miscellaneous Interrupt */
300
301/* tosbmailboxdata */
302#define SMB_DATA_VERSION_SHIFT 16 /* host protocol version */
303
304/*
305 * Software allocation of To Host Mailbox resources
306 */
307
308/* intstatus bits */
309#define I_HMB_FC_STATE I_HMB_SW0 /* Flow Control State */
310#define I_HMB_FC_CHANGE I_HMB_SW1 /* Flow Control State Changed */
311#define I_HMB_FRAME_IND I_HMB_SW2 /* Frame Indication */
312#define I_HMB_HOST_INT I_HMB_SW3 /* Miscellaneous Interrupt */
313
314/* tohostmailboxdata */
315#define HMB_DATA_NAKHANDLED 1 /* retransmit NAK'd frame */
316#define HMB_DATA_DEVREADY 2 /* talk to host after enable */
317#define HMB_DATA_FC 4 /* per prio flowcontrol update flag */
318#define HMB_DATA_FWREADY 8 /* fw ready for protocol activity */
319
320#define HMB_DATA_FCDATA_MASK 0xff000000
321#define HMB_DATA_FCDATA_SHIFT 24
322
323#define HMB_DATA_VERSION_MASK 0x00ff0000
324#define HMB_DATA_VERSION_SHIFT 16
325
326/*
327 * Software-defined protocol header
328 */
329
330/* Current protocol version */
331#define SDPCM_PROT_VERSION 4
332
333/* SW frame header */
334#define SDPCM_PACKET_SEQUENCE(p) (((u8 *)p)[0] & 0xff)
335
336#define SDPCM_CHANNEL_MASK 0x00000f00
337#define SDPCM_CHANNEL_SHIFT 8
338#define SDPCM_PACKET_CHANNEL(p) (((u8 *)p)[1] & 0x0f)
339
340#define SDPCM_NEXTLEN_OFFSET 2
341
342/* Data Offset from SOF (HW Tag, SW Tag, Pad) */
343#define SDPCM_DOFFSET_OFFSET 3 /* Data Offset */
344#define SDPCM_DOFFSET_VALUE(p) (((u8 *)p)[SDPCM_DOFFSET_OFFSET] & 0xff)
345#define SDPCM_DOFFSET_MASK 0xff000000
346#define SDPCM_DOFFSET_SHIFT 24
347#define SDPCM_FCMASK_OFFSET 4 /* Flow control */
348#define SDPCM_FCMASK_VALUE(p) (((u8 *)p)[SDPCM_FCMASK_OFFSET] & 0xff)
349#define SDPCM_WINDOW_OFFSET 5 /* Credit based fc */
350#define SDPCM_WINDOW_VALUE(p) (((u8 *)p)[SDPCM_WINDOW_OFFSET] & 0xff)
351
352#define SDPCM_SWHEADER_LEN 8 /* SW header is 64 bits */
353
354/* logical channel numbers */
355#define SDPCM_CONTROL_CHANNEL 0 /* Control channel Id */
356#define SDPCM_EVENT_CHANNEL 1 /* Asyc Event Indication Channel Id */
357#define SDPCM_DATA_CHANNEL 2 /* Data Xmit/Recv Channel Id */
358#define SDPCM_GLOM_CHANNEL 3 /* For coalesced packets */
359#define SDPCM_TEST_CHANNEL 15 /* Reserved for test/debug packets */
360
361#define SDPCM_SEQUENCE_WRAP 256 /* wrap-around val for 8bit frame seq */
362
363#define SDPCM_GLOMDESC(p) (((u8 *)p)[1] & 0x80)
364
365/* For TEST_CHANNEL packets, define another 4-byte header */
366#define SDPCM_TEST_HDRLEN 4 /*
367 * Generally: Cmd(1), Ext(1), Len(2);
368 * Semantics of Ext byte depend on
369 * command. Len is current or requested
370 * frame length, not including test
371 * header; sent little-endian.
372 */
373#define SDPCM_TEST_DISCARD 0x01 /* Receiver discards. Ext:pattern id. */
374#define SDPCM_TEST_ECHOREQ 0x02 /* Echo request. Ext:pattern id. */
375#define SDPCM_TEST_ECHORSP 0x03 /* Echo response. Ext:pattern id. */
376#define SDPCM_TEST_BURST 0x04 /*
377 * Receiver to send a burst.
378 * Ext is a frame count
379 */
380#define SDPCM_TEST_SEND 0x05 /*
381 * Receiver sets send mode.
382 * Ext is boolean on/off
383 */
384
385/* Handy macro for filling in datagen packets with a pattern */
386#define SDPCM_TEST_FILL(byteno, id) ((u8)(id + byteno))
387
388/*
389 * Shared structure between dongle and the host.
390 * The structure contains pointers to trap or assert information.
391 */
392#define SDPCM_SHARED_VERSION 0x0002
393#define SDPCM_SHARED_VERSION_MASK 0x00FF
394#define SDPCM_SHARED_ASSERT_BUILT 0x0100
395#define SDPCM_SHARED_ASSERT 0x0200
396#define SDPCM_SHARED_TRAP 0x0400
397
398
108/* Space for header read, limit for data packets */399/* Space for header read, limit for data packets */
109#ifndef MAX_HDR_READ400#ifndef MAX_HDR_READ
110#define MAX_HDR_READ 32401#define MAX_HDR_READ 32
@@ -116,7 +407,7 @@ · 5 unmodified lines
116#define MAX_RX_DATASZ 2048407#define MAX_RX_DATASZ 2048
117 408
118/* Maximum milliseconds to wait for F2 to come up */409/* Maximum milliseconds to wait for F2 to come up */
119#define DHD_WAIT_F2RDY 3000410#define BRCMF_WAIT_F2RDY 3000
120 411
121/* Bump up limit on waiting for HT to account for first startup;412/* Bump up limit on waiting for HT to account for first startup;
122 * if the image is doing a CRC calculation before programming the PMU413 * if the image is doing a CRC calculation before programming the PMU
@@ -129,13 +420,48 @@ · 6 unmodified lines
129#endif420#endif
130 421
131/* Value for ChipClockCSR during initial setup */422/* Value for ChipClockCSR during initial setup */
132#define DHD_INIT_CLKCTL1 (SBSDIO_FORCE_HW_CLKREQ_OFF | \423#define BRCMF_INIT_CLKCTL1 (SBSDIO_FORCE_HW_CLKREQ_OFF | \
133 SBSDIO_ALP_AVAIL_REQ)424 SBSDIO_ALP_AVAIL_REQ)
134#define DHD_INIT_CLKCTL2 (SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP)
135 425
136/* Flags for SDH calls */426/* Flags for SDH calls */
137#define F2SYNC (SDIO_REQ_4BYTE | SDIO_REQ_FIXED)427#define F2SYNC (SDIO_REQ_4BYTE | SDIO_REQ_FIXED)
138 428
429/* sbimstate */
430#define SBIM_IBE 0x20000 /* inbanderror */
431#define SBIM_TO 0x40000 /* timeout */
432#define SBIM_BY 0x01800000 /* busy (sonics >= 2.3) */
433#define SBIM_RJ 0x02000000 /* reject (sonics >= 2.3) */
434
435/* sbtmstatelow */
436#define SBTML_RESET 0x0001 /* reset */
437#define SBTML_REJ_MASK 0x0006 /* reject field */
438#define SBTML_REJ 0x0002 /* reject */
439#define SBTML_TMPREJ 0x0004 /* temporary reject, for error recovery */
440
441#define SBTML_SICF_SHIFT 16 /* Shift to locate the SI control flags in sbtml */
442
443/* sbtmstatehigh */
444#define SBTMH_SERR 0x0001 /* serror */
445#define SBTMH_INT 0x0002 /* interrupt */
446#define SBTMH_BUSY 0x0004 /* busy */
447#define SBTMH_TO 0x0020 /* timeout (sonics >= 2.3) */
448
449#define SBTMH_SISF_SHIFT 16 /* Shift to locate the SI status flags in sbtmh */
450
451/* sbidlow */
452#define SBIDL_INIT 0x80 /* initiator */
453
454/* sbidhigh */
455#define SBIDH_RC_MASK 0x000f /* revision code */
456#define SBIDH_RCE_MASK 0x7000 /* revision code extension field */
457#define SBIDH_RCE_SHIFT 8
458#define SBCOREREV(sbidh) \
459 ((((sbidh) & SBIDH_RCE_MASK) >> SBIDH_RCE_SHIFT) | ((sbidh) & SBIDH_RC_MASK))
460#define SBIDH_CC_MASK 0x8ff0 /* core code */
461#define SBIDH_CC_SHIFT 4
462#define SBIDH_VC_MASK 0xffff0000 /* vendor code */
463#define SBIDH_VC_SHIFT 16
464
139/*465/*
140 * Conversion of 802.1D priority to precedence level466 * Conversion of 802.1D priority to precedence level
141 */467 */
@@ -143,21 +469,130 @@ · 1 unmodified line
143 (((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? \469 (((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? \
144 ((prio^2)) : (prio))470 ((prio^2)) : (prio))
145 471
146DHD_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep);472BRCMF_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep);
147extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,473
148 uint len);474/*
475 * Core reg address translation.
476 * Both macro's returns a 32 bits byte address on the backplane bus.
477 */
478#define CORE_CC_REG(base, field) (base + offsetof(chipcregs_t, field))
479#define CORE_BUS_REG(base, field) \
480 (base + offsetof(struct sdpcmd_regs, field))
481#define CORE_SB(base, field) \
482 (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
483
484/* core registers */
485struct sdpcmd_regs {
486 u32 corecontrol; /* 0x00, rev8 */
487 u32 corestatus; /* rev8 */
488 u32 PAD[1];
489 u32 biststatus; /* rev8 */
490
491 /* PCMCIA access */
492 u16 pcmciamesportaladdr; /* 0x010, rev8 */
493 u16 PAD[1];
494 u16 pcmciamesportalmask; /* rev8 */
495 u16 PAD[1];
496 u16 pcmciawrframebc; /* rev8 */
497 u16 PAD[1];
498 u16 pcmciaunderflowtimer; /* rev8 */
499 u16 PAD[1];
500
501 /* interrupt */
502 u32 intstatus; /* 0x020, rev8 */
503 u32 hostintmask; /* rev8 */
504 u32 intmask; /* rev8 */
505 u32 sbintstatus; /* rev8 */
506 u32 sbintmask; /* rev8 */
507 u32 funcintmask; /* rev4 */
508 u32 PAD[2];
509 u32 tosbmailbox; /* 0x040, rev8 */
510 u32 tohostmailbox; /* rev8 */
511 u32 tosbmailboxdata; /* rev8 */
512 u32 tohostmailboxdata; /* rev8 */
513
514 /* synchronized access to registers in SDIO clock domain */
515 u32 sdioaccess; /* 0x050, rev8 */
516 u32 PAD[3];
517
518 /* PCMCIA frame control */
519 u8 pcmciaframectrl; /* 0x060, rev8 */
520 u8 PAD[3];
521 u8 pcmciawatermark; /* rev8 */
522 u8 PAD[155];
523
524 /* interrupt batching control */
525 u32 intrcvlazy; /* 0x100, rev8 */
526 u32 PAD[3];
527
528 /* counters */
529 u32 cmd52rd; /* 0x110, rev8 */
530 u32 cmd52wr; /* rev8 */
531 u32 cmd53rd; /* rev8 */
532 u32 cmd53wr; /* rev8 */
533 u32 abort; /* rev8 */
534 u32 datacrcerror; /* rev8 */
535 u32 rdoutofsync; /* rev8 */
536 u32 wroutofsync; /* rev8 */
537 u32 writebusy; /* rev8 */
538 u32 readwait; /* rev8 */
539 u32 readterm; /* rev8 */
540 u32 writeterm; /* rev8 */
541 u32 PAD[40];
542 u32 clockctlstatus; /* rev8 */
543 u32 PAD[7];
544
545 u32 PAD[128]; /* DMA engines */
546
547 /* SDIO/PCMCIA CIS region */
548 char cis[512]; /* 0x400-0x5ff, rev6 */
549
550 /* PCMCIA function control registers */
551 char pcmciafcr[256]; /* 0x600-6ff, rev6 */
552 u16 PAD[55];
553
554 /* PCMCIA backplane access */
555 u16 backplanecsr; /* 0x76E, rev6 */
556 u16 backplaneaddr0; /* rev6 */
557 u16 backplaneaddr1; /* rev6 */
558 u16 backplaneaddr2; /* rev6 */
559 u16 backplaneaddr3; /* rev6 */
560 u16 backplanedata0; /* rev6 */
561 u16 backplanedata1; /* rev6 */
562 u16 backplanedata2; /* rev6 */
563 u16 backplanedata3; /* rev6 */
564 u16 PAD[31];
565
566 /* sprom "size" & "blank" info */
567 u16 spromstatus; /* 0x7BE, rev2 */
568 u32 PAD[464];
569
570 u16 PAD[0x80];
571};
149 572
150#ifdef DHD_DEBUG573#ifdef BCMDBG
151/* Device console log buffer state */574/* Device console log buffer state */
152typedef struct dhd_console {575struct brcmf_console {
153 uint count; /* Poll interval msec counter */576 uint count; /* Poll interval msec counter */
154 uint log_addr; /* Log struct address (fixed) */577 uint log_addr; /* Log struct address (fixed) */
155 hndrte_log_t log; /* Log struct (host copy) */578 struct rte_log log; /* Log struct (host copy) */
156 uint bufsize; /* Size of log buffer */579 uint bufsize; /* Size of log buffer */
157 u8 *buf; /* Log buffer (host copy) */580 u8 *buf; /* Log buffer (host copy) */
158 uint last; /* Last buffer read index */581 uint last; /* Last buffer read index */
159} dhd_console_t;582};
160#endif /* DHD_DEBUG */583#endif /* BCMDBG */
584
585struct sdpcm_shared {
586 u32 flags;
587 u32 trap_addr;
588 u32 assert_exp_addr;
589 u32 assert_file_addr;
590 u32 assert_line;
591 u32 console_addr; /* Address of struct rte_console */
592 u32 msgtrace_addr;
593 u8 tag[32];
594};
595
161 596
162/* misc chip info needed by some of the routines */597/* misc chip info needed by some of the routines */
163struct chip_info {598struct chip_info {
@@ -166,7 +601,7 @@ struct chip_info { · 2 unmodified lines
166 u32 cccorebase;601 u32 cccorebase;
167 u32 ccrev;602 u32 ccrev;
168 u32 cccaps;603 u32 cccaps;
169 u32 buscorebase;604 u32 buscorebase; /* 32 bits backplane bus address */
170 u32 buscorerev;605 u32 buscorerev;
171 u32 buscoretype;606 u32 buscoretype;
172 u32 ramcorebase;607 u32 ramcorebase;
@@ -176,19 +611,14 @@ struct chip_info { · 3 unmodified lines
176};611};
177 612
178/* Private data for SDIO bus interaction */613/* Private data for SDIO bus interaction */
179typedef struct dhd_bus {614struct brcmf_bus {
180 dhd_pub_t *dhd;615 struct brcmf_pub *drvr;
181 616
182 bcmsdh_info_t *sdh; /* Handle for BCMSDH calls */617 struct brcmf_sdio_card *card; /* Handle for sdio card calls */
183 struct chip_info *ci; /* Chip info struct */618 struct chip_info *ci; /* Chip info struct */
184 char *vars; /* Variables (from CIS and/or other) */619 char *vars; /* Variables (from CIS and/or other) */
185 uint varsz; /* Size of variables buffer */620 uint varsz; /* Size of variables buffer */
186 u32 sbaddr; /* Current SB window pointer (-1, invalid) */
187 621
188 sdpcmd_regs_t *regs; /* Registers for SDIO core */
189 uint sdpcmrev; /* SDIO core revision */
190 uint armrev; /* CPU core revision */
191 uint ramrev; /* SOCRAM core revision */
192 u32 ramsize; /* Size of RAM in SOCRAM (bytes) */622 u32 ramsize; /* Size of RAM in SOCRAM (bytes) */
193 u32 orig_ramsize; /* Size of RAM in SOCRAM (bytes) */623 u32 orig_ramsize; /* Size of RAM in SOCRAM (bytes) */
194 624
@@ -198,10 +628,7 @@ typedef struct dhd_bus { · 3 unmodified lines
198 bool dpc_sched; /* Indicates DPC schedule (intrpt rcvd) */628 bool dpc_sched; /* Indicates DPC schedule (intrpt rcvd) */
199 bool fcstate; /* State of dongle flow-control */629 bool fcstate; /* State of dongle flow-control */
200 630
201 u16 cl_devid; /* cached devid for dhdsdio_probe_attach() */631 u16 cl_devid; /* cached devid for brcmf_sdio_probe_attach() */
202 char *fw_path; /* module_param: path to firmware image */
203 char *nv_path; /* module_param: path to nvram vars file */
204 const char *nvram_params; /* user specified nvram params. */
205 632
206 uint blocksize; /* Block size of SDIO transfers */633 uint blocksize; /* Block size of SDIO transfers */
207 uint roundup; /* Max roundup limit */634 uint roundup; /* Max roundup limit */
@@ -211,7 +638,7 @@ typedef struct dhd_bus { · 3 unmodified lines
211 u8 tx_seq; /* Transmit sequence number (next) */638 u8 tx_seq; /* Transmit sequence number (next) */
212 u8 tx_max; /* Maximum transmit sequence allowed */639 u8 tx_max; /* Maximum transmit sequence allowed */
213 640
214 u8 hdrbuf[MAX_HDR_READ + DHD_SDALIGN];641 u8 hdrbuf[MAX_HDR_READ + BRCMF_SDALIGN];
215 u8 *rxhdr; /* Header of current rx frame (in hdrbuf) */642 u8 *rxhdr; /* Header of current rx frame (in hdrbuf) */
216 u16 nextlen; /* Next Read Len from last header */643 u16 nextlen; /* Next Read Len from last header */
217 u8 rx_seq; /* Receive sequence number (expected) */644 u8 rx_seq; /* Receive sequence number (expected) */
@@ -241,27 +668,23 @@ typedef struct dhd_bus { · 23 unmodified lines
241 uint polltick; /* Tick counter */668 uint polltick; /* Tick counter */
242 uint pollcnt; /* Count of active polls */669 uint pollcnt; /* Count of active polls */
243 670
244#ifdef DHD_DEBUG671#ifdef BCMDBG
245 dhd_console_t console; /* Console output polling support */672 struct brcmf_console console; /* Console output polling support */
246 uint console_addr; /* Console address from shared struct */673 uint console_addr; /* Console address from shared struct */
247#endif /* DHD_DEBUG */674#endif /* BCMDBG */
248 675
249 uint regfails; /* Count of R_REG/W_REG failures */676 uint regfails; /* Count of R_REG failures */
250 677
251 uint clkstate; /* State of sd and backplane clock(s) */678 uint clkstate; /* State of sd and backplane clock(s) */
252 bool activity; /* Activity flag for clock down */679 bool activity; /* Activity flag for clock down */
253 s32 idletime; /* Control for activity timeout */680 s32 idletime; /* Control for activity timeout */
254 s32 idlecount; /* Activity timeout counter */681 s32 idlecount; /* Activity timeout counter */
255 s32 idleclock; /* How to set bus driver when idle */682 s32 idleclock; /* How to set bus driver when idle */
256 s32 sd_divisor; /* Speed control to bus driver */683 s32 sd_rxchain;
257 s32 sd_mode; /* Mode control to bus driver */684 bool use_rxchain; /* If brcmf should use PKT chains */
258 s32 sd_rxchain; /* If bcmsdh api accepts PKT chains */
259 bool use_rxchain; /* If dhd should use PKT chains */
260 bool sleeping; /* Is SDIO bus sleeping? */685 bool sleeping; /* Is SDIO bus sleeping? */
261 bool rxflow_mode; /* Rx flow control mode */686 bool rxflow_mode; /* Rx flow control mode */
262 bool rxflow; /* Is rx flow control on */687 bool rxflow; /* Is rx flow control on */
263 uint prev_rxlim_hit; /* Is prev rx limit exceeded
264 (per dpc schedule) */
265 bool alp_only; /* Don't use HT clock (ALP only) */688 bool alp_only; /* Don't use HT clock (ALP only) */
266/* Field to decide if rx of control frames happen in rxbuf or lb-pool */689/* Field to decide if rx of control frames happen in rxbuf or lb-pool */
267 bool usebufpool;690 bool usebufpool;
@@ -313,7 +736,68 @@ typedef struct dhd_bus { · 45 unmodified lines
313 u8 *ctrl_frame_buf;736 u8 *ctrl_frame_buf;
314 u32 ctrl_frame_len;737 u32 ctrl_frame_len;
315 bool ctrl_frame_stat;738 bool ctrl_frame_stat;
316} dhd_bus_t;739
740 spinlock_t txqlock;
741 wait_queue_head_t ctrl_wait;
742
743 struct timer_list timer;
744 struct completion watchdog_wait;
745 struct task_struct *watchdog_tsk;
746 bool wd_timer_valid;
747
748 struct tasklet_struct tasklet;
749 struct task_struct *dpc_tsk;
750 struct completion dpc_wait;
751
752 bool threads_only;
753 struct semaphore sdsem;
754 spinlock_t sdlock;
755
756 const char *fw_name;
757 const struct firmware *firmware;
758 const char *nv_name;
759 u32 fw_ptr;
760};
761
762struct sbconfig {
763 u32 PAD[2];
764 u32 sbipsflag; /* initiator port ocp slave flag */
765 u32 PAD[3];
766 u32 sbtpsflag; /* target port ocp slave flag */
767 u32 PAD[11];
768 u32 sbtmerrloga; /* (sonics >= 2.3) */
769 u32 PAD;
770 u32 sbtmerrlog; /* (sonics >= 2.3) */
771 u32 PAD[3];
772 u32 sbadmatch3; /* address match3 */
773 u32 PAD;
774 u32 sbadmatch2; /* address match2 */
775 u32 PAD;
776 u32 sbadmatch1; /* address match1 */
777 u32 PAD[7];
778 u32 sbimstate; /* initiator agent state */
779 u32 sbintvec; /* interrupt mask */
780 u32 sbtmstatelow; /* target state */
781 u32 sbtmstatehigh; /* target state */
782 u32 sbbwa0; /* bandwidth allocation table0 */
783 u32 PAD;
784 u32 sbimconfiglow; /* initiator configuration */
785 u32 sbimconfighigh; /* initiator configuration */
786 u32 sbadmatch0; /* address match0 */
787 u32 PAD;
788 u32 sbtmconfiglow; /* target configuration */
789 u32 sbtmconfighigh; /* target configuration */
790 u32 sbbconfig; /* broadcast configuration */
791 u32 PAD;
792 u32 sbbstate; /* broadcast state */
793 u32 PAD[3];
794 u32 sbactcnfg; /* activate configuration */
795 u32 PAD[3];
796 u32 sbflagst; /* current sbflags */
797 u32 PAD[3];
798 u32 sbidlow; /* identification */
799 u32 sbidhigh; /* identification */
800};
317 801
318/* clkstate */802/* clkstate */
319#define CLK_NONE 0803#define CLK_NONE 0
@@ -321,29 +805,45 @@ typedef struct dhd_bus { · 1 unmodified line
321#define CLK_PENDING 2 /* Not used yet */805#define CLK_PENDING 2 /* Not used yet */
322#define CLK_AVAIL 3806#define CLK_AVAIL 3
323 807
324#define DHD_NOPMU(dhd) (false)808#define BRCMF_NOPMU(brcmf) (false)
325 809
326#ifdef DHD_DEBUG810#ifdef BCMDBG
327static int qcount[NUMPRIO];811static int qcount[NUMPRIO];
328static int tx_packets[NUMPRIO];812static int tx_packets[NUMPRIO];
329#endif /* DHD_DEBUG */813#endif /* BCMDBG */
330 814
331/* Deferred transmit */815/* Deferred transmit */
332const uint dhd_deferred_tx = 1;816uint brcmf_deferred_tx = 1;
817module_param(brcmf_deferred_tx, uint, 0);
818
819/* Watchdog thread priority, -1 to use kernel timer */
820int brcmf_watchdog_prio = 97;
821module_param(brcmf_watchdog_prio, int, 0);
333 822
334extern uint dhd_watchdog_ms;823/* Watchdog interval */
335extern void dhd_os_wd_timer(void *bus, uint wdtick);824uint brcmf_watchdog_ms = 10;
825module_param(brcmf_watchdog_ms, uint, 0);
826
827/* DPC thread priority, -1 to use tasklet */
828int brcmf_dpc_prio = 98;
829module_param(brcmf_dpc_prio, int, 0);
830
831#ifdef BCMDBG
832/* Console poll interval */
833uint brcmf_console_ms;
834module_param(brcmf_console_ms, uint, 0);
835#endif /* BCMDBG */
336 836
337/* Tx/Rx bounds */837/* Tx/Rx bounds */
338uint dhd_txbound;838uint brcmf_txbound;
339uint dhd_rxbound;839uint brcmf_rxbound;
340uint dhd_txminmax;840uint brcmf_txminmax;
341 841
342/* override the RAM size if possible */842/* override the RAM size if possible */
343#define DONGLE_MIN_MEMSIZE (128 * 1024)843#define DONGLE_MIN_MEMSIZE (128 * 1024)
344int dhd_dongle_memsize;844int brcmf_dongle_memsize;
345 845
346static bool dhd_alignctl;846static bool brcmf_alignctl;
347 847
348static bool sd1idle;848static bool sd1idle;
349 849
@@ -351,9 +851,7 @@ static bool retrydata; · 1 unmodified line
351#define RETRYCHAN(chan) (((chan) == SDPCM_EVENT_CHANNEL) || retrydata)851#define RETRYCHAN(chan) (((chan) == SDPCM_EVENT_CHANNEL) || retrydata)
352 852
353static const uint watermark = 8;853static const uint watermark = 8;
354static const uint firstread = DHD_FIRSTREAD;854static const uint firstread = BRCMF_FIRSTREAD;
355
356#define HDATLEN (firstread - (SDPCM_HDRLEN))
357 855
358/* Retry count for register access failures */856/* Retry count for register access failures */
359static const uint retry_limit = 2;857static const uint retry_limit = 2;
@@ -363,20 +861,11 @@ static bool forcealign; · 3 unmodified lines
363 861
364#define ALIGNMENT 4862#define ALIGNMENT 4
365 863
366#if defined(OOB_INTR_ONLY) && defined(HW_OOB)
367extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable);
368#endif
369
370#if defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD)
371#error OOB_INTR_ONLY is NOT working with SDIO_ISR_THREAD
372#endif /* defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD) */
373#define PKTALIGN(_p, _len, _align) \864#define PKTALIGN(_p, _len, _align) \
374 do { \865 do { \
375 uint datalign; \866 uint datalign; \
376 datalign = (unsigned long)((_p)->data); \867 datalign = (unsigned long)((_p)->data); \
377 datalign = roundup(datalign, (_align)) - datalign; \868 datalign = roundup(datalign, (_align)) - datalign; \
378 ASSERT(datalign < (_align)); \
379 ASSERT((_p)->len >= ((_len) + datalign)); \
380 if (datalign) \869 if (datalign) \
381 skb_pull((_p), datalign); \870 skb_pull((_p), datalign); \
382 __skb_trim((_p), (_len)); \871 __skb_trim((_p), (_len)); \
@@ -386,146 +875,166 @@ extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable); · 3 unmodified lines
386static const uint max_roundup = 512;875static const uint max_roundup = 512;
387 876
388/* Try doing readahead */877/* Try doing readahead */
389static bool dhd_readahead;878static bool brcmf_readahead;
390 879
391/* To check if there's window offered */880/* To check if there's window offered */
392#define DATAOK(bus) \881#define DATAOK(bus) \
393 (((u8)(bus->tx_max - bus->tx_seq) != 0) && \882 (((u8)(bus->tx_max - bus->tx_seq) != 0) && \
394 (((u8)(bus->tx_max - bus->tx_seq) & 0x80) == 0))883 (((u8)(bus->tx_max - bus->tx_seq) & 0x80) == 0))
395 884
396/* Macros to get register read/write status */885/*
397/* NOTE: these assume a local dhdsdio_bus_t *bus! */886 * Reads a register in the SDIO hardware block. This block occupies a series of
398#define R_SDREG(regvar, regaddr, retryvar) \887 * adresses on the 32 bit backplane bus.
399do { \888 */
400 retryvar = 0; \889static void
401 do { \890r_sdreg32(struct brcmf_bus *bus, u32 *regvar, u32 reg_offset, u32 *retryvar)
402 regvar = R_REG(regaddr); \891{
403 } while (bcmsdh_regfail(bus->sdh) && (++retryvar <= retry_limit)); \892 *retryvar = 0;
404 if (retryvar) { \893 do {
405 bus->regfails += (retryvar-1); \894 *regvar = R_REG(bus->ci->buscorebase + reg_offset, u32);
406 if (retryvar > retry_limit) { \895 } while (brcmf_sdcard_regfail(bus->card) &&
407 DHD_ERROR(("%s: FAILED" #regvar "READ, LINE %d\n", \896 (++(*retryvar) <= retry_limit));
408 __func__, __LINE__)); \897 if (*retryvar) {
409 regvar = 0; \898 bus->regfails += (*retryvar-1);
410 } \899 if (*retryvar > retry_limit) {
411 } \900 BRCMF_ERROR(("FAILED READ %Xh\n", reg_offset));
412} while (0)901 *regvar = 0;
413 902 }
414#define W_SDREG(regval, regaddr, retryvar) \903 }
415do { \904}
416 retryvar = 0; \905
417 do { \906static void
418 W_REG(regaddr, regval); \907w_sdreg32(struct brcmf_bus *bus, u32 regval, u32 reg_offset, u32 *retryvar)
419 } while (bcmsdh_regfail(bus->sdh) && (++retryvar <= retry_limit)); \908{
420 if (retryvar) { \909 *retryvar = 0;
421 bus->regfails += (retryvar-1); \910 do {
422 if (retryvar > retry_limit) \911 brcmf_sdcard_reg_write(NULL, bus->ci->buscorebase + reg_offset,
423 DHD_ERROR(("%s: FAILED REGISTER WRITE, LINE %d\n", \912 sizeof(u32), regval);
424 __func__, __LINE__)); \913 } while (brcmf_sdcard_regfail(bus->card) &&
425 } \914 (++(*retryvar) <= retry_limit));
426} while (0)915 if (*retryvar) {
427 916 bus->regfails += (*retryvar-1);
428#define DHD_BUS SDIO_BUS917 if (*retryvar > retry_limit)
918 BRCMF_ERROR(("FAILED REGISTER WRITE"
919 " %Xh\n", reg_offset));
920 }
921}
922
923#define BRCMF_BUS SDIO_BUS
429 924
430#define PKT_AVAILABLE() (intstatus & I_HMB_FRAME_IND)925#define PKT_AVAILABLE() (intstatus & I_HMB_FRAME_IND)
431 926
432#define HOSTINTMASK (I_HMB_SW_MASK | I_CHIPACTIVE)927#define HOSTINTMASK (I_HMB_SW_MASK | I_CHIPACTIVE)
433 928
434#ifdef SDTEST929#ifdef SDTEST
435static void dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq);930static void brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, void *pkt, uint seq);
436static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start);931static void brcmf_sdbrcm_sdtest_set(struct brcmf_bus *bus, bool start);
437#endif932#endif
438 933
439#ifdef DHD_DEBUG934#ifdef BCMDBG
440static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size);935static int brcmf_sdbrcm_bus_console_in(struct brcmf_pub *drvr,
441static int dhdsdio_mem_dump(dhd_bus_t *bus);936 unsigned char *msg, uint msglen);
442#endif /* DHD_DEBUG */937static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size);
443static int dhdsdio_download_state(dhd_bus_t *bus, bool enter);938static int brcmf_sdbrcm_mem_dump(struct brcmf_bus *bus);
444 939#endif /* BCMDBG */
445static void dhdsdio_release(dhd_bus_t *bus);940static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter);
446static void dhdsdio_release_malloc(dhd_bus_t *bus);941
447static void dhdsdio_disconnect(void *ptr);942static void brcmf_sdbrcm_release(struct brcmf_bus *bus);
448static bool dhdsdio_chipmatch(u16 chipid);943static void brcmf_sdbrcm_release_malloc(struct brcmf_bus *bus);
449static bool dhdsdio_probe_attach(dhd_bus_t *bus, void *sdh,944static void brcmf_sdbrcm_disconnect(void *ptr);
450 void *regsva, u16 devid);945static bool brcmf_sdbrcm_chipmatch(u16 chipid);
451static bool dhdsdio_probe_malloc(dhd_bus_t *bus, void *sdh);946static bool brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card,
452static bool dhdsdio_probe_init(dhd_bus_t *bus, void *sdh);947 u32 regsva, u16 devid);
453static void dhdsdio_release_dongle(dhd_bus_t *bus);948static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus, void *card);
454 949static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card);
455static uint process_nvram_vars(char *varbuf, uint len);950static void brcmf_sdbrcm_release_dongle(struct brcmf_bus *bus);
456 951
457static void dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size);952static uint brcmf_process_nvram_vars(char *varbuf, uint len);
458static int dhd_bcmsdh_send_buf(dhd_bus_t *bus, u32 addr, uint fn,953
954static void brcmf_sdbrcm_setmemsize(struct brcmf_bus *bus, int mem_size);
955static int brcmf_sdbrcm_send_buf(struct brcmf_bus *bus, u32 addr, uint fn,
459 uint flags, u8 *buf, uint nbytes,956 uint flags, u8 *buf, uint nbytes,
460 struct sk_buff *pkt, bcmsdh_cmplt_fn_t complete,957 struct sk_buff *pkt,
958 void (*complete)(void *handle, int status,
959 bool sync_waiting),
461 void *handle);960 void *handle);
462 961
463static bool dhdsdio_download_firmware(struct dhd_bus *bus, void *sdh);962static bool brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus, void *card);
464static int _dhdsdio_download_firmware(struct dhd_bus *bus);963static int _brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus);
465 964
466static int dhdsdio_download_code_file(struct dhd_bus *bus, char *image_path);965static int brcmf_sdbrcm_download_code_file(struct brcmf_bus *bus);
467static int dhdsdio_download_nvram(struct dhd_bus *bus);966static int brcmf_sdbrcm_download_nvram(struct brcmf_bus *bus);
468#ifdef BCMEMBEDIMAGE967
469static int dhdsdio_download_code_array(struct dhd_bus *bus);968static void
470#endif969brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio_card *card, u32 corebase);
471static void dhdsdio_chip_disablecore(bcmsdh_info_t *sdh, u32 corebase);970
472static int dhdsdio_chip_attach(struct dhd_bus *bus, void *regs);971static int brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs);
473static void dhdsdio_chip_resetcore(bcmsdh_info_t *sdh, u32 corebase);972
474static void dhdsdio_sdiod_drive_strength_init(struct dhd_bus *bus,973static void
974brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_card *card, u32 corebase);
975
976static void brcmf_sdbrcm_sdiod_drive_strength_init(struct brcmf_bus *bus,
475 u32 drivestrength);977 u32 drivestrength);
476static void dhdsdio_chip_detach(struct dhd_bus *bus);978static void brcmf_sdbrcm_chip_detach(struct brcmf_bus *bus);
979static void brcmf_sdbrcm_wait_for_event(struct brcmf_bus *bus, bool *lockvar);
980static void brcmf_sdbrcm_wait_event_wakeup(struct brcmf_bus *bus);
981static void brcmf_sdbrcm_watchdog(unsigned long data);
982static int brcmf_sdbrcm_watchdog_thread(void *data);
983static int brcmf_sdbrcm_dpc_thread(void *data);
984static void brcmf_sdbrcm_dpc_tasklet(unsigned long data);
985static void brcmf_sdbrcm_sched_dpc(struct brcmf_bus *bus);
986static void brcmf_sdbrcm_sdlock(struct brcmf_bus *bus);
987static void brcmf_sdbrcm_sdunlock(struct brcmf_bus *bus);
988static int brcmf_sdbrcm_get_image(char *buf, int len, struct brcmf_bus *bus);
477 989
478/* Packet free applicable unconditionally for sdio and sdspi.990/* Packet free applicable unconditionally for sdio and sdspi.
479 * Conditional if bufpool was present for gspi bus.991 * Conditional if bufpool was present for gspi bus.
480 */992 */
481static void dhdsdio_pktfree2(dhd_bus_t *bus, struct sk_buff *pkt)993static void brcmf_sdbrcm_pktfree2(struct brcmf_bus *bus, struct sk_buff *pkt)
482{994{
483 dhd_os_sdlock_rxq(bus->dhd);
484 if ((bus->bus != SPI_BUS) || bus->usebufpool)995 if ((bus->bus != SPI_BUS) || bus->usebufpool)
485 bcm_pkt_buf_free_skb(pkt);996 brcmu_pkt_buf_free_skb(pkt);
486 dhd_os_sdunlock_rxq(bus->dhd);
487}997}
488 998
489static void dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size)999static void brcmf_sdbrcm_setmemsize(struct brcmf_bus *bus, int mem_size)
490{1000{
491 s32 min_size = DONGLE_MIN_MEMSIZE;1001 s32 min_size = DONGLE_MIN_MEMSIZE;
492 /* Restrict the memsize to user specified limit */1002 /* Restrict the memsize to user specified limit */
493 DHD_ERROR(("user: Restrict the dongle ram size to %d, min %d\n",1003 BRCMF_ERROR(("user: Restrict the dongle ram size to %d, min %d\n",
494 dhd_dongle_memsize, min_size));1004 brcmf_dongle_memsize, min_size));
495 if ((dhd_dongle_memsize > min_size) &&1005 if ((brcmf_dongle_memsize > min_size) &&
496 (dhd_dongle_memsize < (s32) bus->orig_ramsize))1006 (brcmf_dongle_memsize < (s32) bus->orig_ramsize))
497 bus->ramsize = dhd_dongle_memsize;1007 bus->ramsize = brcmf_dongle_memsize;
498}1008}
499 1009
500static int dhdsdio_set_siaddr_window(dhd_bus_t *bus, u32 address)1010static int brcmf_sdbrcm_set_siaddr_window(struct brcmf_bus *bus, u32 address)
501{1011{
502 int err = 0;1012 int err = 0;
503 bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,1013 brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
504 (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);1014 (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
505 if (!err)1015 if (!err)
506 bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID,1016 brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
1017 SBSDIO_FUNC1_SBADDRMID,
507 (address >> 16) & SBSDIO_SBADDRMID_MASK, &err);1018 (address >> 16) & SBSDIO_SBADDRMID_MASK, &err);
508 if (!err)1019 if (!err)
509 bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH,1020 brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
510 (address >> 24) & SBSDIO_SBADDRHIGH_MASK,1021 SBSDIO_FUNC1_SBADDRHIGH,
511 &err);1022 (address >> 24) & SBSDIO_SBADDRHIGH_MASK,
1023 &err);
512 return err;1024 return err;
513}1025}
514 1026
515/* Turn backplane clock on or off */1027/* Turn backplane clock on or off */
516static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)1028static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
517{1029{
518 int err;1030 int err;
519 u8 clkctl, clkreq, devctl;1031 u8 clkctl, clkreq, devctl;
520 bcmsdh_info_t *sdh;1032 struct brcmf_sdio_card *card;
521 1033
522 DHD_TRACE(("%s: Enter\n", __func__));1034 BRCMF_TRACE(("%s: Enter\n", __func__));
523 1035
524#if defined(OOB_INTR_ONLY)
525 pendok = false;
526#endif
527 clkctl = 0;1036 clkctl = 0;
528 sdh = bus->sdh;1037 card = bus->card;
529 1038
530 if (on) {1039 if (on) {
531 /* Request HT Avail */1040 /* Request HT Avail */
@@ -536,99 +1045,93 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) · 4 unmodified lines
536 && (bus->ci->chiprev == 0))1045 && (bus->ci->chiprev == 0))
537 clkreq |= SBSDIO_FORCE_ALP;1046 clkreq |= SBSDIO_FORCE_ALP;
538 1047
539 bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,1048 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
540 clkreq, &err);1049 SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
541 if (err) {1050 if (err) {
542 DHD_ERROR(("%s: HT Avail request error: %d\n",1051 BRCMF_ERROR(("%s: HT Avail request error: %d\n",
543 __func__, err));1052 __func__, err));
544 return -EBADE;1053 return -EBADE;
545 }1054 }
546 1055
547 if (pendok && ((bus->ci->buscoretype == PCMCIA_CORE_ID)1056 if (pendok && ((bus->ci->buscoretype == PCMCIA_CORE_ID)
548 && (bus->ci->buscorerev == 9))) {1057 && (bus->ci->buscorerev == 9))) {
549 u32 dummy, retries;1058 u32 dummy, retries;
550 R_SDREG(dummy, &bus->regs->clockctlstatus, retries);1059 r_sdreg32(bus, &dummy,
1060 offsetof(struct sdpcmd_regs, clockctlstatus),
1061 &retries);
551 }1062 }
552 1063
553 /* Check current status */1064 /* Check current status */
554 clkctl =1065 clkctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
555 bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,1066 SBSDIO_FUNC1_CHIPCLKCSR, &err);
556 &err);
557 if (err) {1067 if (err) {
558 DHD_ERROR(("%s: HT Avail read error: %d\n",1068 BRCMF_ERROR(("%s: HT Avail read error: %d\n",
559 __func__, err));1069 __func__, err));
560 return -EBADE;1070 return -EBADE;
561 }1071 }
562 1072
563 /* Go to pending and await interrupt if appropriate */1073 /* Go to pending and await interrupt if appropriate */
564 if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) {1074 if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) {
565 /* Allow only clock-available interrupt */1075 /* Allow only clock-available interrupt */
566 devctl =1076 devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
567 bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,1077 SBSDIO_DEVICE_CTL, &err);
568 &err);
569 if (err) {1078 if (err) {
570 DHD_ERROR(("%s: Devctl error setting CA: %d\n",1079 BRCMF_ERROR(("%s: Devctl error setting CA:"
571 __func__, err));1080 " %d\n", __func__, err));
572 return -EBADE;1081 return -EBADE;
573 }1082 }
574 1083
575 devctl |= SBSDIO_DEVCTL_CA_INT_ONLY;1084 devctl |= SBSDIO_DEVCTL_CA_INT_ONLY;
576 bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,1085 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
577 devctl, &err);1086 SBSDIO_DEVICE_CTL, devctl, &err);
578 DHD_INFO(("CLKCTL: set PENDING\n"));1087 BRCMF_INFO(("CLKCTL: set PENDING\n"));
579 bus->clkstate = CLK_PENDING;1088 bus->clkstate = CLK_PENDING;
580 1089
581 return 0;1090 return 0;
582 } else if (bus->clkstate == CLK_PENDING) {1091 } else if (bus->clkstate == CLK_PENDING) {
583 /* Cancel CA-only interrupt filter */1092 /* Cancel CA-only interrupt filter */
584 devctl =1093 devctl =
585 bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,1094 brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
586 &err);1095 SBSDIO_DEVICE_CTL, &err);
587 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;1096 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
588 bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,1097 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
589 devctl, &err);1098 SBSDIO_DEVICE_CTL, devctl, &err);
590 }1099 }
591 1100
592 /* Otherwise, wait here (polling) for HT Avail */1101 /* Otherwise, wait here (polling) for HT Avail */
593 if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {1102 if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {
594 SPINWAIT_SLEEP(sdioh_spinwait_sleep,1103 BRCMF_SPINWAIT_SLEEP(sdioh_spinwait_sleep,
595 ((clkctl =1104 ((clkctl =
596 bcmsdh_cfg_read(sdh, SDIO_FUNC_1,1105 brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
597 SBSDIO_FUNC1_CHIPCLKCSR,1106 SBSDIO_FUNC1_CHIPCLKCSR,
598 &err)),1107 &err)),
599 !SBSDIO_CLKAV(clkctl, bus->alp_only)),1108 !SBSDIO_CLKAV(clkctl, bus->alp_only)),
600 PMU_MAX_TRANSITION_DLY);1109 PMU_MAX_TRANSITION_DLY);
601 }1110 }
602 if (err) {1111 if (err) {
603 DHD_ERROR(("%s: HT Avail request error: %d\n",1112 BRCMF_ERROR(("%s: HT Avail request error: %d\n",
604 __func__, err));1113 __func__, err));
605 return -EBADE;1114 return -EBADE;
606 }1115 }
607 if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {1116 if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {
608 DHD_ERROR(("%s: HT Avail timeout (%d): clkctl 0x%02x\n",1117 BRCMF_ERROR(("%s: HT Avail timeout (%d): "
609 __func__, PMU_MAX_TRANSITION_DLY, clkctl));1118 "clkctl 0x%02x\n", __func__,
1119 PMU_MAX_TRANSITION_DLY, clkctl));
610 return -EBADE;1120 return -EBADE;
611 }1121 }
612 1122
613 /* Mark clock available */1123 /* Mark clock available */
614 bus->clkstate = CLK_AVAIL;1124 bus->clkstate = CLK_AVAIL;
615 DHD_INFO(("CLKCTL: turned ON\n"));1125 BRCMF_INFO(("CLKCTL: turned ON\n"));
616 1126
617#if defined(DHD_DEBUG)1127#if defined(BCMDBG)
618 if (bus->alp_only == true) {1128 if (bus->alp_only != true) {
619#if !defined(BCMLXSDMMC)
620 if (!SBSDIO_ALPONLY(clkctl)) {
621 DHD_ERROR(("%s: HT Clock, when ALP Only\n",
622 __func__));
623 }
624#endif /* !defined(BCMLXSDMMC) */
625 } else {
626 if (SBSDIO_ALPONLY(clkctl)) {1129 if (SBSDIO_ALPONLY(clkctl)) {
627 DHD_ERROR(("%s: HT Clock should be on.\n",1130 BRCMF_ERROR(("%s: HT Clock should be on.\n",
628 __func__));1131 __func__));
629 }1132 }
630 }1133 }
631#endif /* defined (DHD_DEBUG) */1134#endif /* defined (BCMDBG) */
632 1135
633 bus->activity = true;1136 bus->activity = true;
634 } else {1137 } else {
@@ -636,21 +1139,20 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) · 1 unmodified line
636 1139
637 if (bus->clkstate == CLK_PENDING) {1140 if (bus->clkstate == CLK_PENDING) {
638 /* Cancel CA-only interrupt filter */1141 /* Cancel CA-only interrupt filter */
639 devctl =1142 devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
640 bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,1143 SBSDIO_DEVICE_CTL, &err);
641 &err);
642 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;1144 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
643 bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,1145 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
644 devctl, &err);1146 SBSDIO_DEVICE_CTL, devctl, &err);
645 }1147 }
646 1148
647 bus->clkstate = CLK_SDONLY;1149 bus->clkstate = CLK_SDONLY;
648 bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,1150 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
649 clkreq, &err);1151 SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
650 DHD_INFO(("CLKCTL: turned OFF\n"));1152 BRCMF_INFO(("CLKCTL: turned OFF\n"));
651 if (err) {1153 if (err) {
652 DHD_ERROR(("%s: Failed access turning clock off: %d\n",1154 BRCMF_ERROR(("%s: Failed access turning clock off:"
653 __func__, err));1155 " %d\n", __func__, err));
654 return -EBADE;1156 return -EBADE;
655 }1157 }
656 }1158 }
@@ -658,105 +1160,31 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) · 1 unmodified line
658}1160}
659 1161
660/* Change idle/active SD state */1162/* Change idle/active SD state */
661static int dhdsdio_sdclk(dhd_bus_t *bus, bool on)1163static int brcmf_sdbrcm_sdclk(struct brcmf_bus *bus, bool on)
662{1164{
663 int err;1165 BRCMF_TRACE(("%s: Enter\n", __func__));
664 s32 iovalue;
665 1166
666 DHD_TRACE(("%s: Enter\n", __func__));1167 if (on)
667
668 if (on) {
669 if (bus->idleclock == DHD_IDLE_STOP) {
670 /* Turn on clock and restore mode */
671 iovalue = 1;
672 err = bcmsdh_iovar_op(bus->sdh, "sd_clock", NULL, 0,
673 &iovalue, sizeof(iovalue), true);
674 if (err) {
675 DHD_ERROR(("%s: error enabling sd_clock: %d\n",
676 __func__, err));
677 return -EBADE;
678 }
679
680 iovalue = bus->sd_mode;
681 err = bcmsdh_iovar_op(bus->sdh, "sd_mode", NULL, 0,
682 &iovalue, sizeof(iovalue), true);
683 if (err) {
684 DHD_ERROR(("%s: error changing sd_mode: %d\n",
685 __func__, err));
686 return -EBADE;
687 }
688 } else if (bus->idleclock != DHD_IDLE_ACTIVE) {
689 /* Restore clock speed */
690 iovalue = bus->sd_divisor;
691 err = bcmsdh_iovar_op(bus->sdh, "sd_divisor", NULL, 0,
692 &iovalue, sizeof(iovalue), true);
693 if (err) {
694 DHD_ERROR(("%s: error restoring sd_divisor: %d\n",
695 __func__, err));
696 return -EBADE;
697 }
698 }
699 bus->clkstate = CLK_SDONLY;1168 bus->clkstate = CLK_SDONLY;
700 } else {1169 else
701 /* Stop or slow the SD clock itself */
702 if ((bus->sd_divisor == -1) || (bus->sd_mode == -1)) {
703 DHD_TRACE(("%s: can't idle clock, divisor %d mode %d\n",
704 __func__, bus->sd_divisor, bus->sd_mode));
705 return -EBADE;
706 }
707 if (bus->idleclock == DHD_IDLE_STOP) {
708 if (sd1idle) {
709 /* Change to SD1 mode and turn off clock */
710 iovalue = 1;
711 err =
712 bcmsdh_iovar_op(bus->sdh, "sd_mode", NULL,
713 0, &iovalue,
714 sizeof(iovalue), true);
715 if (err) {
716 DHD_ERROR(("%s: error changing sd_clock: %d\n",
717 __func__, err));
718 return -EBADE;
719 }
720 }
721
722 iovalue = 0;
723 err = bcmsdh_iovar_op(bus->sdh, "sd_clock", NULL, 0,
724 &iovalue, sizeof(iovalue), true);
725 if (err) {
726 DHD_ERROR(("%s: error disabling sd_clock: %d\n",
727 __func__, err));
728 return -EBADE;
729 }
730 } else if (bus->idleclock != DHD_IDLE_ACTIVE) {
731 /* Set divisor to idle value */
732 iovalue = bus->idleclock;
733 err = bcmsdh_iovar_op(bus->sdh, "sd_divisor", NULL, 0,
734 &iovalue, sizeof(iovalue), true);
735 if (err) {
736 DHD_ERROR(("%s: error changing sd_divisor: %d\n",
737 __func__, err));
738 return -EBADE;
739 }
740 }
741 bus->clkstate = CLK_NONE;1170 bus->clkstate = CLK_NONE;
742 }
743 1171
744 return 0;1172 return 0;
745}1173}
746 1174
747/* Transition SD and backplane clock readiness */1175/* Transition SD and backplane clock readiness */
748static int dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok)1176static int brcmf_sdbrcm_clkctl(struct brcmf_bus *bus, uint target, bool pendok)
749{1177{
750#ifdef DHD_DEBUG1178#ifdef BCMDBG
751 uint oldstate = bus->clkstate;1179 uint oldstate = bus->clkstate;
752#endif /* DHD_DEBUG */1180#endif /* BCMDBG */
753 1181
754 DHD_TRACE(("%s: Enter\n", __func__));1182 BRCMF_TRACE(("%s: Enter\n", __func__));
755 1183
756 /* Early exit if we're already there */1184 /* Early exit if we're already there */
757 if (bus->clkstate == target) {1185 if (bus->clkstate == target) {
758 if (target == CLK_AVAIL) {1186 if (target == CLK_AVAIL) {
759 dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms);1187 brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
760 bus->activity = true;1188 bus->activity = true;
761 }1189 }
762 return 0;1190 return 0;
@@ -766,50 +1194,50 @@ static int dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok) · 3 unmodified lines
766 case CLK_AVAIL:1194 case CLK_AVAIL:
767 /* Make sure SD clock is available */1195 /* Make sure SD clock is available */
768 if (bus->clkstate == CLK_NONE)1196 if (bus->clkstate == CLK_NONE)
769 dhdsdio_sdclk(bus, true);1197 brcmf_sdbrcm_sdclk(bus, true);
770 /* Now request HT Avail on the backplane */1198 /* Now request HT Avail on the backplane */
771 dhdsdio_htclk(bus, true, pendok);1199 brcmf_sdbrcm_htclk(bus, true, pendok);
772 dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms);1200 brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
773 bus->activity = true;1201 bus->activity = true;
774 break;1202 break;
775 1203
776 case CLK_SDONLY:1204 case CLK_SDONLY:
777 /* Remove HT request, or bring up SD clock */1205 /* Remove HT request, or bring up SD clock */
778 if (bus->clkstate == CLK_NONE)1206 if (bus->clkstate == CLK_NONE)
779 dhdsdio_sdclk(bus, true);1207 brcmf_sdbrcm_sdclk(bus, true);
780 else if (bus->clkstate == CLK_AVAIL)1208 else if (bus->clkstate == CLK_AVAIL)
781 dhdsdio_htclk(bus, false, false);1209 brcmf_sdbrcm_htclk(bus, false, false);
782 else1210 else
783 DHD_ERROR(("dhdsdio_clkctl: request for %d -> %d\n",1211 BRCMF_ERROR(("brcmf_sdbrcm_clkctl: request for %d -> %d"
784 bus->clkstate, target));1212 "\n", bus->clkstate, target));
785 dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms);1213 brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
786 break;1214 break;
787 1215
788 case CLK_NONE:1216 case CLK_NONE:
789 /* Make sure to remove HT request */1217 /* Make sure to remove HT request */
790 if (bus->clkstate == CLK_AVAIL)1218 if (bus->clkstate == CLK_AVAIL)
791 dhdsdio_htclk(bus, false, false);1219 brcmf_sdbrcm_htclk(bus, false, false);
792 /* Now remove the SD clock */1220 /* Now remove the SD clock */
793 dhdsdio_sdclk(bus, false);1221 brcmf_sdbrcm_sdclk(bus, false);
794 dhd_os_wd_timer(bus->dhd, 0);1222 brcmf_sdbrcm_wd_timer(bus, 0);
795 break;1223 break;
796 }1224 }
797#ifdef DHD_DEBUG1225#ifdef BCMDBG
798 DHD_INFO(("dhdsdio_clkctl: %d -> %d\n", oldstate, bus->clkstate));1226 BRCMF_INFO(("brcmf_sdbrcm_clkctl: %d -> %d\n",
799#endif /* DHD_DEBUG */1227 oldstate, bus->clkstate));
1228#endif /* BCMDBG */
800 1229
801 return 0;1230 return 0;
802}1231}
803 1232
804int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep)1233int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep)
805{1234{
806 bcmsdh_info_t *sdh = bus->sdh;1235 struct brcmf_sdio_card *card = bus->card;
807 sdpcmd_regs_t *regs = bus->regs;
808 uint retries = 0;1236 uint retries = 0;
809 1237
810 DHD_INFO(("dhdsdio_bussleep: request %s (currently %s)\n",1238 BRCMF_INFO(("brcmf_sdbrcm_bussleep: request %s (currently %s)\n",
811 (sleep ? "SLEEP" : "WAKE"),1239 (sleep ? "SLEEP" : "WAKE"),
812 (bus->sleeping ? "SLEEP" : "WAKE")));1240 (bus->sleeping ? "SLEEP" : "WAKE")));
813 1241
814 /* Done if we're already in the requested state */1242 /* Done if we're already in the requested state */
815 if (sleep == bus->sleeping)1243 if (sleep == bus->sleeping)
@@ -822,27 +1250,31 @@ int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep) · 6 unmodified lines
822 return -EBUSY;1250 return -EBUSY;
823 1251
824 /* Disable SDIO interrupts (no longer interested) */1252 /* Disable SDIO interrupts (no longer interested) */
825 bcmsdh_intr_disable(bus->sdh);1253 brcmf_sdcard_intr_disable(bus->card);
826 1254
827 /* Make sure the controller has the bus up */1255 /* Make sure the controller has the bus up */
828 dhdsdio_clkctl(bus, CLK_AVAIL, false);1256 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
829 1257
830 /* Tell device to start using OOB wakeup */1258 /* Tell device to start using OOB wakeup */
831 W_SDREG(SMB_USE_OOB, &regs->tosbmailbox, retries);1259 w_sdreg32(bus, SMB_USE_OOB,
1260 offsetof(struct sdpcmd_regs, tosbmailbox), &retries);
832 if (retries > retry_limit)1261 if (retries > retry_limit)
833 DHD_ERROR(("CANNOT SIGNAL CHIP, WILL NOT WAKE UP!!\n"));1262 BRCMF_ERROR(("CANNOT SIGNAL CHIP, "
1263 "WILL NOT WAKE UP!!\n"));
834 1264
835 /* Turn off our contribution to the HT clock request */1265 /* Turn off our contribution to the HT clock request */
836 dhdsdio_clkctl(bus, CLK_SDONLY, false);1266 brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false);
837 1267
838 bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,1268 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
839 SBSDIO_FORCE_HW_CLKREQ_OFF, NULL);1269 SBSDIO_FUNC1_CHIPCLKCSR,
1270 SBSDIO_FORCE_HW_CLKREQ_OFF, NULL);
840 1271
841 /* Isolate the bus */1272 /* Isolate the bus */
842 if (bus->ci->chip != BCM4329_CHIP_ID1273 if (bus->ci->chip != BCM4329_CHIP_ID
843 && bus->ci->chip != BCM4319_CHIP_ID) {1274 && bus->ci->chip != BCM4319_CHIP_ID) {
844 bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,1275 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
845 SBSDIO_DEVCTL_PADS_ISO, NULL);1276 SBSDIO_DEVICE_CTL,
1277 SBSDIO_DEVCTL_PADS_ISO, NULL);
846 }1278 }
847 1279
848 /* Change state */1280 /* Change state */
@@ -851,82 +1283,55 @@ int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep) · 2 unmodified lines
851 } else {1283 } else {
852 /* Waking up: bus power up is ok, set local state */1284 /* Waking up: bus power up is ok, set local state */
853 1285
854 bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,1286 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
855 0, NULL);1287 SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
856 1288
857 /* Force pad isolation off if possible1289 /* Force pad isolation off if possible
858 (in case power never toggled) */1290 (in case power never toggled) */
859 if ((bus->ci->buscoretype == PCMCIA_CORE_ID)1291 if ((bus->ci->buscoretype == PCMCIA_CORE_ID)
860 && (bus->ci->buscorerev >= 10))1292 && (bus->ci->buscorerev >= 10))
861 bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, 0,1293 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
862 NULL);1294 SBSDIO_DEVICE_CTL, 0, NULL);
863 1295
864 /* Make sure the controller has the bus up */1296 /* Make sure the controller has the bus up */
865 dhdsdio_clkctl(bus, CLK_AVAIL, false);1297 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
866 1298
867 /* Send misc interrupt to indicate OOB not needed */1299 /* Send misc interrupt to indicate OOB not needed */
868 W_SDREG(0, &regs->tosbmailboxdata, retries);1300 w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, tosbmailboxdata),
1301 &retries);
869 if (retries <= retry_limit)1302 if (retries <= retry_limit)
870 W_SDREG(SMB_DEV_INT, &regs->tosbmailbox, retries);1303 w_sdreg32(bus, SMB_DEV_INT,
1304 offsetof(struct sdpcmd_regs, tosbmailbox),
1305 &retries);
871 1306
872 if (retries > retry_limit)1307 if (retries > retry_limit)
873 DHD_ERROR(("CANNOT SIGNAL CHIP TO CLEAR OOB!!\n"));1308 BRCMF_ERROR(("CANNOT SIGNAL CHIP TO CLEAR OOB!!\n"));
874 1309
875 /* Make sure we have SD bus access */1310 /* Make sure we have SD bus access */
876 dhdsdio_clkctl(bus, CLK_SDONLY, false);1311 brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false);
877 1312
878 /* Change state */1313 /* Change state */
879 bus->sleeping = false;1314 bus->sleeping = false;
880 1315
881 /* Enable interrupts again */1316 /* Enable interrupts again */
882 if (bus->intr && (bus->dhd->busstate == DHD_BUS_DATA)) {1317 if (bus->intr && (bus->drvr->busstate == BRCMF_BUS_DATA)) {
883 bus->intdis = false;1318 bus->intdis = false;
884 bcmsdh_intr_enable(bus->sdh);1319 brcmf_sdcard_intr_enable(bus->card);
885 }1320 }
886 }1321 }
887 1322
888 return 0;1323 return 0;
889}1324}
890 1325
891#if defined(OOB_INTR_ONLY)
892void dhd_enable_oob_intr(struct dhd_bus *bus, bool enable)
893{
894#if defined(HW_OOB)
895 bcmsdh_enable_hw_oob_intr(bus->sdh, enable);
896#else
897 sdpcmd_regs_t *regs = bus->regs;
898 uint retries = 0;
899
900 dhdsdio_clkctl(bus, CLK_AVAIL, false);
901 if (enable == true) {
902
903 /* Tell device to start using OOB wakeup */
904 W_SDREG(SMB_USE_OOB, &regs->tosbmailbox, retries);
905 if (retries > retry_limit)
906 DHD_ERROR(("CANNOT SIGNAL CHIP, WILL NOT WAKE UP!!\n"));
907
908 } else {
909 /* Send misc interrupt to indicate OOB not needed */
910 W_SDREG(0, &regs->tosbmailboxdata, retries);
911 if (retries <= retry_limit)
912 W_SDREG(SMB_DEV_INT, &regs->tosbmailbox, retries);
913 }
914
915 /* Turn off our contribution to the HT clock request */
916 dhdsdio_clkctl(bus, CLK_SDONLY, false);
917#endif /* !defined(HW_OOB) */
918}
919#endif /* defined(OOB_INTR_ONLY) */
920
921#define BUS_WAKE(bus) \1326#define BUS_WAKE(bus) \
922 do { \1327 do { \
923 if ((bus)->sleeping) \1328 if ((bus)->sleeping) \
924 dhdsdio_bussleep((bus), false); \1329 brcmf_sdbrcm_bussleep((bus), false); \
925 } while (0);1330 } while (0);
926 1331
927/* Writes a HW/SW header into the packet and sends it. */1332/* Writes a HW/SW header into the packet and sends it. */
928/* Assumes: (a) header space already there, (b) caller holds lock */1333/* Assumes: (a) header space already there, (b) caller holds lock */
929static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,1334static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt, uint chan,
930 bool free_pkt)1335 bool free_pkt)
931{1336{
932 int ret;1337 int ret;
@@ -934,15 +1339,15 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 1 unmodified line
934 u16 len, pad = 0;1339 u16 len, pad = 0;
935 u32 swheader;1340 u32 swheader;
936 uint retries = 0;1341 uint retries = 0;
937 bcmsdh_info_t *sdh;1342 struct brcmf_sdio_card *card;
938 struct sk_buff *new;1343 struct sk_buff *new;
939 int i;1344 int i;
940 1345
941 DHD_TRACE(("%s: Enter\n", __func__));1346 BRCMF_TRACE(("%s: Enter\n", __func__));
942 1347
943 sdh = bus->sdh;1348 card = bus->card;
944 1349
945 if (bus->dhd->dongle_reset) {1350 if (bus->drvr->dongle_reset) {
946 ret = -EPERM;1351 ret = -EPERM;
947 goto done;1352 goto done;
948 }1353 }
@@ -950,40 +1355,39 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 1 unmodified line
950 frame = (u8 *) (pkt->data);1355 frame = (u8 *) (pkt->data);
951 1356
952 /* Add alignment padding, allocate new packet if needed */1357 /* Add alignment padding, allocate new packet if needed */
953 pad = ((unsigned long)frame % DHD_SDALIGN);1358 pad = ((unsigned long)frame % BRCMF_SDALIGN);
954 if (pad) {1359 if (pad) {
955 if (skb_headroom(pkt) < pad) {1360 if (skb_headroom(pkt) < pad) {
956 DHD_INFO(("%s: insufficient headroom %d for %d pad\n",1361 BRCMF_INFO(("%s: insufficient headroom %d for %d pad\n",
957 __func__, skb_headroom(pkt), pad));1362 __func__, skb_headroom(pkt), pad));
958 bus->dhd->tx_realloc++;1363 bus->drvr->tx_realloc++;
959 new = bcm_pkt_buf_get_skb(pkt->len + DHD_SDALIGN);1364 new = brcmu_pkt_buf_get_skb(pkt->len + BRCMF_SDALIGN);
960 if (!new) {1365 if (!new) {
961 DHD_ERROR(("%s: couldn't allocate new %d-byte "1366 BRCMF_ERROR(("%s: couldn't allocate new "
962 "packet\n",1367 "%d-byte packet\n", __func__,
963 __func__, pkt->len + DHD_SDALIGN));1368 pkt->len + BRCMF_SDALIGN));
964 ret = -ENOMEM;1369 ret = -ENOMEM;
965 goto done;1370 goto done;
966 }1371 }
967 1372
968 PKTALIGN(new, pkt->len, DHD_SDALIGN);1373 PKTALIGN(new, pkt->len, BRCMF_SDALIGN);
969 memcpy(new->data, pkt->data, pkt->len);1374 memcpy(new->data, pkt->data, pkt->len);
970 if (free_pkt)1375 if (free_pkt)
971 bcm_pkt_buf_free_skb(pkt);1376 brcmu_pkt_buf_free_skb(pkt);
972 /* free the pkt if canned one is not used */1377 /* free the pkt if canned one is not used */
973 free_pkt = true;1378 free_pkt = true;
974 pkt = new;1379 pkt = new;
975 frame = (u8 *) (pkt->data);1380 frame = (u8 *) (pkt->data);
976 ASSERT(((unsigned long)frame % DHD_SDALIGN) == 0);1381 /* precondition: (frame % BRCMF_SDALIGN) == 0) */
977 pad = 0;1382 pad = 0;
978 } else {1383 } else {
979 skb_push(pkt, pad);1384 skb_push(pkt, pad);
980 frame = (u8 *) (pkt->data);1385 frame = (u8 *) (pkt->data);
981 1386 /* precondition: pad + SDPCM_HDRLEN <= pkt->len */
982 ASSERT((pad + SDPCM_HDRLEN) <= (int)(pkt->len));
983 memset(frame, 0, pad + SDPCM_HDRLEN);1387 memset(frame, 0, pad + SDPCM_HDRLEN);
984 }1388 }
985 }1389 }
986 ASSERT(pad < DHD_SDALIGN);1390 /* precondition: pad < BRCMF_SDALIGN */
987 1391
988 /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */1392 /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
989 len = (u16) (pkt->len);1393 len = (u16) (pkt->len);
@@ -999,14 +1403,14 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 9 unmodified lines
999 put_unaligned_le32(swheader, frame + SDPCM_FRAMETAG_LEN);1403 put_unaligned_le32(swheader, frame + SDPCM_FRAMETAG_LEN);
1000 put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));1404 put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
1001 1405
1002#ifdef DHD_DEBUG1406#ifdef BCMDBG
1003 tx_packets[pkt->priority]++;1407 tx_packets[pkt->priority]++;
1004 if (DHD_BYTES_ON() &&1408 if (BRCMF_BYTES_ON() &&
1005 (((DHD_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) ||1409 (((BRCMF_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) ||
1006 (DHD_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) {1410 (BRCMF_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) {
1007 printk(KERN_DEBUG "Tx Frame:\n");1411 printk(KERN_DEBUG "Tx Frame:\n");
1008 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, frame, len);1412 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, frame, len);
1009 } else if (DHD_HDRS_ON()) {1413 } else if (BRCMF_HDRS_ON()) {
1010 printk(KERN_DEBUG "TxHdr:\n");1414 printk(KERN_DEBUG "TxHdr:\n");
1011 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,1415 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
1012 frame, min_t(u16, len, 16));1416 frame, min_t(u16, len, 16));
@@ -1017,53 +1421,40 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 4 unmodified lines
1017 if (bus->roundup && bus->blocksize && (len > bus->blocksize)) {1421 if (bus->roundup && bus->blocksize && (len > bus->blocksize)) {
1018 u16 pad = bus->blocksize - (len % bus->blocksize);1422 u16 pad = bus->blocksize - (len % bus->blocksize);
1019 if ((pad <= bus->roundup) && (pad < bus->blocksize))1423 if ((pad <= bus->roundup) && (pad < bus->blocksize))
1020#ifdef NOTUSED
1021 if (pad <= skb_tailroom(pkt))
1022#endif /* NOTUSED */
1023 len += pad;1424 len += pad;
1024 } else if (len % DHD_SDALIGN) {1425 } else if (len % BRCMF_SDALIGN) {
1025 len += DHD_SDALIGN - (len % DHD_SDALIGN);1426 len += BRCMF_SDALIGN - (len % BRCMF_SDALIGN);
1026 }1427 }
1027 1428
1028 /* Some controllers have trouble with odd bytes -- round to even */1429 /* Some controllers have trouble with odd bytes -- round to even */
1029 if (forcealign && (len & (ALIGNMENT - 1))) {1430 if (forcealign && (len & (ALIGNMENT - 1))) {
1030#ifdef NOTUSED
1031 if (skb_tailroom(pkt))
1032#endif
1033 len = roundup(len, ALIGNMENT);1431 len = roundup(len, ALIGNMENT);
1034#ifdef NOTUSED
1035 else
1036 DHD_ERROR(("%s: sending unrounded %d-byte packet\n",
1037 __func__, len));
1038#endif
1039 }1432 }
1040 1433
1041 do {1434 do {
1042 ret =1435 ret = brcmf_sdbrcm_send_buf(bus, brcmf_sdcard_cur_sbwad(card),
1043 dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2,1436 SDIO_FUNC_2, F2SYNC, frame, len, pkt, NULL, NULL);
1044 F2SYNC, frame, len, pkt, NULL, NULL);
1045 bus->f2txdata++;1437 bus->f2txdata++;
1046 ASSERT(ret != -BCME_PENDING);
1047 1438
1048 if (ret < 0) {1439 if (ret < 0) {
1049 /* On failure, abort the command1440 /* On failure, abort the command
1050 and terminate the frame */1441 and terminate the frame */
1051 DHD_INFO(("%s: sdio error %d, abort command and "1442 BRCMF_INFO(("%s: sdio error %d, abort command and "
1052 "terminate frame.\n", __func__, ret));1443 "terminate frame.\n", __func__, ret));
1053 bus->tx_sderrs++;1444 bus->tx_sderrs++;
1054 1445
1055 bcmsdh_abort(sdh, SDIO_FUNC_2);1446 brcmf_sdcard_abort(card, SDIO_FUNC_2);
1056 bcmsdh_cfg_write(sdh, SDIO_FUNC_1,1447 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1057 SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM,1448 SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM,
1058 NULL);1449 NULL);
1059 bus->f1regdata++;1450 bus->f1regdata++;
1060 1451
1061 for (i = 0; i < 3; i++) {1452 for (i = 0; i < 3; i++) {
1062 u8 hi, lo;1453 u8 hi, lo;
1063 hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,1454 hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
1064 SBSDIO_FUNC1_WFRAMEBCHI,1455 SBSDIO_FUNC1_WFRAMEBCHI,
1065 NULL);1456 NULL);
1066 lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,1457 lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
1067 SBSDIO_FUNC1_WFRAMEBCLO,1458 SBSDIO_FUNC1_WFRAMEBCLO,
1068 NULL);1459 NULL);
1069 bus->f1regdata += 2;1460 bus->f1regdata += 2;
@@ -1080,22 +1471,22 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 10 unmodified lines
1080done:1471done:
1081 /* restore pkt buffer pointer before calling tx complete routine */1472 /* restore pkt buffer pointer before calling tx complete routine */
1082 skb_pull(pkt, SDPCM_HDRLEN + pad);1473 skb_pull(pkt, SDPCM_HDRLEN + pad);
1083 dhd_os_sdunlock(bus->dhd);1474 brcmf_sdbrcm_sdunlock(bus);
1084 dhd_txcomplete(bus->dhd, pkt, ret != 0);1475 brcmf_txcomplete(bus->drvr, pkt, ret != 0);
1085 dhd_os_sdlock(bus->dhd);1476 brcmf_sdbrcm_sdlock(bus);
1086 1477
1087 if (free_pkt)1478 if (free_pkt)
1088 bcm_pkt_buf_free_skb(pkt);1479 brcmu_pkt_buf_free_skb(pkt);
1089 1480
1090 return ret;1481 return ret;
1091}1482}
1092 1483
1093int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)1484int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *pkt)
1094{1485{
1095 int ret = -EBADE;1486 int ret = -EBADE;
1096 uint datalen, prec;1487 uint datalen, prec;
1097 1488
1098 DHD_TRACE(("%s: Enter\n", __func__));1489 BRCMF_TRACE(("%s: Enter\n", __func__));
1099 1490
1100 datalen = pkt->len;1491 datalen = pkt->len;
1101 1492
@@ -1115,79 +1506,80 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) · 13 unmodified lines
1115 1506
1116 /* Add space for the header */1507 /* Add space for the header */
1117 skb_push(pkt, SDPCM_HDRLEN);1508 skb_push(pkt, SDPCM_HDRLEN);
1118 ASSERT(IS_ALIGNED((unsigned long)(pkt->data), 2));1509 /* precondition: IS_ALIGNED((unsigned long)(pkt->data), 2) */
1119 1510
1120 prec = PRIO2PREC((pkt->priority & PRIOMASK));1511 prec = PRIO2PREC((pkt->priority & PRIOMASK));
1121 1512
1122 /* Check for existing queue, current flow-control,1513 /* Check for existing queue, current flow-control,
1123 pending event, or pending clock */1514 pending event, or pending clock */
1124 if (dhd_deferred_tx || bus->fcstate || pktq_len(&bus->txq)1515 if (brcmf_deferred_tx || bus->fcstate || pktq_len(&bus->txq)
1125 || bus->dpc_sched || (!DATAOK(bus))1516 || bus->dpc_sched || (!DATAOK(bus))
1126 || (bus->flowcontrol & NBITVAL(prec))1517 || (bus->flowcontrol & NBITVAL(prec))
1127 || (bus->clkstate != CLK_AVAIL)) {1518 || (bus->clkstate != CLK_AVAIL)) {
1128 DHD_TRACE(("%s: deferring pktq len %d\n", __func__,1519 BRCMF_TRACE(("%s: deferring pktq len %d\n", __func__,
1129 pktq_len(&bus->txq)));1520 pktq_len(&bus->txq)));
1130 bus->fcqueued++;1521 bus->fcqueued++;
1131 1522
1132 /* Priority based enq */1523 /* Priority based enq */
1133 dhd_os_sdlock_txq(bus->dhd);1524 spin_lock_bh(&bus->txqlock);
1134 if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) {1525 if (brcmf_c_prec_enq(bus->drvr, &bus->txq, pkt, prec) == false) {
1135 skb_pull(pkt, SDPCM_HDRLEN);1526 skb_pull(pkt, SDPCM_HDRLEN);
1136 dhd_txcomplete(bus->dhd, pkt, false);1527 brcmf_txcomplete(bus->drvr, pkt, false);
1137 bcm_pkt_buf_free_skb(pkt);1528 brcmu_pkt_buf_free_skb(pkt);
1138 DHD_ERROR(("%s: out of bus->txq !!!\n", __func__));1529 BRCMF_ERROR(("%s: out of bus->txq !!!\n", __func__));
1139 ret = -ENOSR;1530 ret = -ENOSR;
1140 } else {1531 } else {
1141 ret = 0;1532 ret = 0;
1142 }1533 }
1143 dhd_os_sdunlock_txq(bus->dhd);1534 spin_unlock_bh(&bus->txqlock);
1144 1535
1145 if (pktq_len(&bus->txq) >= TXHI)1536 if (pktq_len(&bus->txq) >= TXHI)
1146 dhd_txflowcontrol(bus->dhd, 0, ON);1537 brcmf_txflowcontrol(bus->drvr, 0, ON);
1147 1538
1148#ifdef DHD_DEBUG1539#ifdef BCMDBG
1149 if (pktq_plen(&bus->txq, prec) > qcount[prec])1540 if (pktq_plen(&bus->txq, prec) > qcount[prec])
1150 qcount[prec] = pktq_plen(&bus->txq, prec);1541 qcount[prec] = pktq_plen(&bus->txq, prec);
1151#endif1542#endif
1152 /* Schedule DPC if needed to send queued packet(s) */1543 /* Schedule DPC if needed to send queued packet(s) */
1153 if (dhd_deferred_tx && !bus->dpc_sched) {1544 if (brcmf_deferred_tx && !bus->dpc_sched) {
1154 bus->dpc_sched = true;1545 bus->dpc_sched = true;
1155 dhd_sched_dpc(bus->dhd);1546 brcmf_sdbrcm_sched_dpc(bus);
1156 }1547 }
1157 } else {1548 } else {
1158 /* Lock: we're about to use shared data/code (and SDIO) */1549 /* Lock: we're about to use shared data/code (and SDIO) */
1159 dhd_os_sdlock(bus->dhd);1550 brcmf_sdbrcm_sdlock(bus);
1160 1551
1161 /* Otherwise, send it now */1552 /* Otherwise, send it now */
1162 BUS_WAKE(bus);1553 BUS_WAKE(bus);
1163 /* Make sure back plane ht clk is on, no pending allowed */1554 /* Make sure back plane ht clk is on, no pending allowed */
1164 dhdsdio_clkctl(bus, CLK_AVAIL, true);1555 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, true);
1165 1556
1166#ifndef SDTEST1557#ifndef SDTEST
1167 DHD_TRACE(("%s: calling txpkt\n", __func__));1558 BRCMF_TRACE(("%s: calling txpkt\n", __func__));
1168 ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);1559 ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
1169#else1560#else
1170 ret = dhdsdio_txpkt(bus, pkt,1561 ret = brcmf_sdbrcm_txpkt(bus, pkt,
1171 (bus->ext_loop ? SDPCM_TEST_CHANNEL :1562 (bus->ext_loop ? SDPCM_TEST_CHANNEL :
1172 SDPCM_DATA_CHANNEL), true);1563 SDPCM_DATA_CHANNEL), true);
1173#endif1564#endif
1174 if (ret)1565 if (ret)
1175 bus->dhd->tx_errors++;1566 bus->drvr->tx_errors++;
1176 else1567 else
1177 bus->dhd->dstats.tx_bytes += datalen;1568 bus->drvr->dstats.tx_bytes += datalen;
1178 1569
1179 if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) {1570 if (bus->idletime == BRCMF_IDLE_IMMEDIATE &&
1571 !bus->dpc_sched) {
1180 bus->activity = false;1572 bus->activity = false;
1181 dhdsdio_clkctl(bus, CLK_NONE, true);1573 brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
1182 }1574 }
1183 1575
1184 dhd_os_sdunlock(bus->dhd);1576 brcmf_sdbrcm_sdunlock(bus);
1185 }1577 }
1186 1578
1187 return ret;1579 return ret;
1188}1580}
1189 1581
1190static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes)1582static uint brcmf_sdbrcm_sendfromq(struct brcmf_bus *bus, uint maxframes)
1191{1583{
1192 struct sk_buff *pkt;1584 struct sk_buff *pkt;
1193 u32 intstatus = 0;1585 u32 intstatus = 0;
@@ -1197,42 +1589,43 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) · 3 unmodified lines
1197 uint datalen;1589 uint datalen;
1198 u8 tx_prec_map;1590 u8 tx_prec_map;
1199 1591
1200 dhd_pub_t *dhd = bus->dhd;1592 struct brcmf_pub *drvr = bus->drvr;
1201 sdpcmd_regs_t *regs = bus->regs;
1202 1593
1203 DHD_TRACE(("%s: Enter\n", __func__));1594 BRCMF_TRACE(("%s: Enter\n", __func__));
1204 1595
1205 tx_prec_map = ~bus->flowcontrol;1596 tx_prec_map = ~bus->flowcontrol;
1206 1597
1207 /* Send frames until the limit or some other event */1598 /* Send frames until the limit or some other event */
1208 for (cnt = 0; (cnt < maxframes) && DATAOK(bus); cnt++) {1599 for (cnt = 0; (cnt < maxframes) && DATAOK(bus); cnt++) {
1209 dhd_os_sdlock_txq(bus->dhd);1600 spin_lock_bh(&bus->txqlock);
1210 pkt = bcm_pktq_mdeq(&bus->txq, tx_prec_map, &prec_out);1601 pkt = brcmu_pktq_mdeq(&bus->txq, tx_prec_map, &prec_out);
1211 if (pkt == NULL) {1602 if (pkt == NULL) {
1212 dhd_os_sdunlock_txq(bus->dhd);1603 spin_unlock_bh(&bus->txqlock);
1213 break;1604 break;
1214 }1605 }
1215 dhd_os_sdunlock_txq(bus->dhd);1606 spin_unlock_bh(&bus->txqlock);
1216 datalen = pkt->len - SDPCM_HDRLEN;1607 datalen = pkt->len - SDPCM_HDRLEN;
1217 1608
1218#ifndef SDTEST1609#ifndef SDTEST
1219 ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);1610 ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
1220#else1611#else
1221 ret = dhdsdio_txpkt(bus, pkt,1612 ret = brcmf_sdbrcm_txpkt(bus, pkt,
1222 (bus->ext_loop ? SDPCM_TEST_CHANNEL :1613 (bus->ext_loop ? SDPCM_TEST_CHANNEL :
1223 SDPCM_DATA_CHANNEL), true);1614 SDPCM_DATA_CHANNEL), true);
1224#endif1615#endif
1225 if (ret)1616 if (ret)
1226 bus->dhd->tx_errors++;1617 bus->drvr->tx_errors++;
1227 else1618 else
1228 bus->dhd->dstats.tx_bytes += datalen;1619 bus->drvr->dstats.tx_bytes += datalen;
1229 1620
1230 /* In poll mode, need to check for other events */1621 /* In poll mode, need to check for other events */
1231 if (!bus->intr && cnt) {1622 if (!bus->intr && cnt) {
1232 /* Check device status, signal pending interrupt */1623 /* Check device status, signal pending interrupt */
1233 R_SDREG(intstatus, &regs->intstatus, retries);1624 r_sdreg32(bus, &intstatus,
1625 offsetof(struct sdpcmd_regs, intstatus),
1626 &retries);
1234 bus->f2txdata++;1627 bus->f2txdata++;
1235 if (bcmsdh_regfail(bus->sdh))1628 if (brcmf_sdcard_regfail(bus->card))
1236 break;1629 break;
1237 if (intstatus & bus->hostintmask)1630 if (intstatus & bus->hostintmask)
1238 bus->ipend = true;1631 bus->ipend = true;
@@ -1240,27 +1633,28 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) · 1 unmodified line
1240 }1633 }
1241 1634
1242 /* Deflow-control stack if needed */1635 /* Deflow-control stack if needed */
1243 if (dhd->up && (dhd->busstate == DHD_BUS_DATA) &&1636 if (drvr->up && (drvr->busstate == BRCMF_BUS_DATA) &&
1244 dhd->txoff && (pktq_len(&bus->txq) < TXLOW))1637 drvr->txoff && (pktq_len(&bus->txq) < TXLOW))
1245 dhd_txflowcontrol(dhd, 0, OFF);1638 brcmf_txflowcontrol(drvr, 0, OFF);
1246 1639
1247 return cnt;1640 return cnt;
1248}1641}
1249 1642
1250int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)1643int
1644brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
1251{1645{
1252 u8 *frame;1646 u8 *frame;
1253 u16 len;1647 u16 len;
1254 u32 swheader;1648 u32 swheader;
1255 uint retries = 0;1649 uint retries = 0;
1256 bcmsdh_info_t *sdh = bus->sdh;1650 struct brcmf_sdio_card *card = bus->card;
1257 u8 doff = 0;1651 u8 doff = 0;
1258 int ret = -1;1652 int ret = -1;
1259 int i;1653 int i;
1260 1654
1261 DHD_TRACE(("%s: Enter\n", __func__));1655 BRCMF_TRACE(("%s: Enter\n", __func__));
1262 1656
1263 if (bus->dhd->dongle_reset)1657 if (bus->drvr->dongle_reset)
1264 return -EIO;1658 return -EIO;
1265 1659
1266 /* Back the pointer to make a room for bus header */1660 /* Back the pointer to make a room for bus header */
@@ -1268,15 +1662,15 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 1 unmodified line
1268 len = (msglen += SDPCM_HDRLEN);1662 len = (msglen += SDPCM_HDRLEN);
1269 1663
1270 /* Add alignment padding (optional for ctl frames) */1664 /* Add alignment padding (optional for ctl frames) */
1271 if (dhd_alignctl) {1665 if (brcmf_alignctl) {
1272 doff = ((unsigned long)frame % DHD_SDALIGN);1666 doff = ((unsigned long)frame % BRCMF_SDALIGN);
1273 if (doff) {1667 if (doff) {
1274 frame -= doff;1668 frame -= doff;
1275 len += doff;1669 len += doff;
1276 msglen += doff;1670 msglen += doff;
1277 memset(frame, 0, doff + SDPCM_HDRLEN);1671 memset(frame, 0, doff + SDPCM_HDRLEN);
1278 }1672 }
1279 ASSERT(doff < DHD_SDALIGN);1673 /* precondition: doff < BRCMF_SDALIGN */
1280 }1674 }
1281 doff += SDPCM_HDRLEN;1675 doff += SDPCM_HDRLEN;
1282 1676
@@ -1285,23 +1679,23 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 2 unmodified lines
1285 u16 pad = bus->blocksize - (len % bus->blocksize);1679 u16 pad = bus->blocksize - (len % bus->blocksize);
1286 if ((pad <= bus->roundup) && (pad < bus->blocksize))1680 if ((pad <= bus->roundup) && (pad < bus->blocksize))
1287 len += pad;1681 len += pad;
1288 } else if (len % DHD_SDALIGN) {1682 } else if (len % BRCMF_SDALIGN) {
1289 len += DHD_SDALIGN - (len % DHD_SDALIGN);1683 len += BRCMF_SDALIGN - (len % BRCMF_SDALIGN);
1290 }1684 }
1291 1685
1292 /* Satisfy length-alignment requirements */1686 /* Satisfy length-alignment requirements */
1293 if (forcealign && (len & (ALIGNMENT - 1)))1687 if (forcealign && (len & (ALIGNMENT - 1)))
1294 len = roundup(len, ALIGNMENT);1688 len = roundup(len, ALIGNMENT);
1295 1689
1296 ASSERT(IS_ALIGNED((unsigned long)frame, 2));1690 /* precondition: IS_ALIGNED((unsigned long)frame, 2) */
1297 1691
1298 /* Need to lock here to protect txseq and SDIO tx calls */1692 /* Need to lock here to protect txseq and SDIO tx calls */
1299 dhd_os_sdlock(bus->dhd);1693 brcmf_sdbrcm_sdlock(bus);
1300 1694
1301 BUS_WAKE(bus);1695 BUS_WAKE(bus);
1302 1696
1303 /* Make sure backplane clock is on */1697 /* Make sure backplane clock is on */
1304 dhdsdio_clkctl(bus, CLK_AVAIL, false);1698 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
1305 1699
1306 /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */1700 /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
1307 *(u16 *) frame = cpu_to_le16((u16) msglen);1701 *(u16 *) frame = cpu_to_le16((u16) msglen);
@@ -1317,31 +1711,33 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 9 unmodified lines
1317 put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));1711 put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
1318 1712
1319 if (!DATAOK(bus)) {1713 if (!DATAOK(bus)) {
1320 DHD_INFO(("%s: No bus credit bus->tx_max %d, bus->tx_seq %d\n",1714 BRCMF_INFO(("%s: No bus credit bus->tx_max %d,"
1321 __func__, bus->tx_max, bus->tx_seq));1715 " bus->tx_seq %d\n", __func__,
1716 bus->tx_max, bus->tx_seq));
1322 bus->ctrl_frame_stat = true;1717 bus->ctrl_frame_stat = true;
1323 /* Send from dpc */1718 /* Send from dpc */
1324 bus->ctrl_frame_buf = frame;1719 bus->ctrl_frame_buf = frame;
1325 bus->ctrl_frame_len = len;1720 bus->ctrl_frame_len = len;
1326 1721
1327 dhd_wait_for_event(bus->dhd, &bus->ctrl_frame_stat);1722 brcmf_sdbrcm_wait_for_event(bus, &bus->ctrl_frame_stat);
1328 1723
1329 if (bus->ctrl_frame_stat == false) {1724 if (bus->ctrl_frame_stat == false) {
1330 DHD_INFO(("%s: ctrl_frame_stat == false\n", __func__));1725 BRCMF_INFO(("%s: ctrl_frame_stat == false\n",
1726 __func__));
1331 ret = 0;1727 ret = 0;
1332 } else {1728 } else {
1333 DHD_INFO(("%s: ctrl_frame_stat == true\n", __func__));1729 BRCMF_INFO(("%s: ctrl_frame_stat == true\n", __func__));
1334 ret = -1;1730 ret = -1;
1335 }1731 }
1336 }1732 }
1337 1733
1338 if (ret == -1) {1734 if (ret == -1) {
1339#ifdef DHD_DEBUG1735#ifdef BCMDBG
1340 if (DHD_BYTES_ON() && DHD_CTL_ON()) {1736 if (BRCMF_BYTES_ON() && BRCMF_CTL_ON()) {
1341 printk(KERN_DEBUG "Tx Frame:\n");1737 printk(KERN_DEBUG "Tx Frame:\n");
1342 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,1738 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
1343 frame, len);1739 frame, len);
1344 } else if (DHD_HDRS_ON()) {1740 } else if (BRCMF_HDRS_ON()) {
1345 printk(KERN_DEBUG "TxHdr:\n");1741 printk(KERN_DEBUG "TxHdr:\n");
1346 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,1742 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
1347 frame, min_t(u16, len, 16));1743 frame, min_t(u16, len, 16));
@@ -1350,35 +1746,35 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 2 unmodified lines
1350 1746
1351 do {1747 do {
1352 bus->ctrl_frame_stat = false;1748 bus->ctrl_frame_stat = false;
1353 ret =1749 ret = brcmf_sdbrcm_send_buf(bus,
1354 dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh),1750 brcmf_sdcard_cur_sbwad(card), SDIO_FUNC_2,
1355 SDIO_FUNC_2, F2SYNC, frame, len,1751 F2SYNC, frame, len, NULL, NULL, NULL);
1356 NULL, NULL, NULL);
1357
1358 ASSERT(ret != -BCME_PENDING);
1359 1752
1360 if (ret < 0) {1753 if (ret < 0) {
1361 /* On failure, abort the command and1754 /* On failure, abort the command and
1362 terminate the frame */1755 terminate the frame */
1363 DHD_INFO(("%s: sdio error %d, abort command and terminate frame.\n",1756 BRCMF_INFO(("%s: sdio error %d, abort command "
1364 __func__, ret));1757 "and terminate frame.\n",
1758 __func__, ret));
1365 bus->tx_sderrs++;1759 bus->tx_sderrs++;
1366 1760
1367 bcmsdh_abort(sdh, SDIO_FUNC_2);1761 brcmf_sdcard_abort(card, SDIO_FUNC_2);
1368 1762
1369 bcmsdh_cfg_write(sdh, SDIO_FUNC_1,1763 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1370 SBSDIO_FUNC1_FRAMECTRL,1764 SBSDIO_FUNC1_FRAMECTRL,
1371 SFC_WF_TERM, NULL);1765 SFC_WF_TERM, NULL);
1372 bus->f1regdata++;1766 bus->f1regdata++;
1373 1767
1374 for (i = 0; i < 3; i++) {1768 for (i = 0; i < 3; i++) {
1375 u8 hi, lo;1769 u8 hi, lo;
1376 hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,1770 hi = brcmf_sdcard_cfg_read(card,
1771 SDIO_FUNC_1,
1377 SBSDIO_FUNC1_WFRAMEBCHI,1772 SBSDIO_FUNC1_WFRAMEBCHI,
1378 NULL);1773 NULL);
1379 lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,1774 lo = brcmf_sdcard_cfg_read(card,
1775 SDIO_FUNC_1,
1380 SBSDIO_FUNC1_WFRAMEBCLO,1776 SBSDIO_FUNC1_WFRAMEBCLO,
1381 NULL);1777 NULL);
1382 bus->f1regdata += 2;1778 bus->f1regdata += 2;
1383 if ((hi == 0) && (lo == 0))1779 if ((hi == 0) && (lo == 0))
1384 break;1780 break;
@@ -1392,67 +1788,67 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 7 unmodified lines
1392 } while ((ret < 0) && retries++ < TXRETRIES);1788 } while ((ret < 0) && retries++ < TXRETRIES);
1393 }1789 }
1394 1790
1395 if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) {1791 if ((bus->idletime == BRCMF_IDLE_IMMEDIATE) && !bus->dpc_sched) {
1396 bus->activity = false;1792 bus->activity = false;
1397 dhdsdio_clkctl(bus, CLK_NONE, true);1793 brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
1398 }1794 }
1399 1795
1400 dhd_os_sdunlock(bus->dhd);1796 brcmf_sdbrcm_sdunlock(bus);
1401 1797
1402 if (ret)1798 if (ret)
1403 bus->dhd->tx_ctlerrs++;1799 bus->drvr->tx_ctlerrs++;
1404 else1800 else
1405 bus->dhd->tx_ctlpkts++;1801 bus->drvr->tx_ctlpkts++;
1406 1802
1407 return ret ? -EIO : 0;1803 return ret ? -EIO : 0;
1408}1804}
1409 1805
1410int dhd_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)1806int brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
1411{1807{
1412 int timeleft;1808 int timeleft;
1413 uint rxlen = 0;1809 uint rxlen = 0;
1414 bool pending;1810 bool pending;
1415 1811
1416 DHD_TRACE(("%s: Enter\n", __func__));1812 BRCMF_TRACE(("%s: Enter\n", __func__));
1417 1813
1418 if (bus->dhd->dongle_reset)1814 if (bus->drvr->dongle_reset)
1419 return -EIO;1815 return -EIO;
1420 1816
1421 /* Wait until control frame is available */1817 /* Wait until control frame is available */
1422 timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, &pending);1818 timeleft = brcmf_os_ioctl_resp_wait(bus->drvr, &bus->rxlen, &pending);
1423 1819
1424 dhd_os_sdlock(bus->dhd);1820 brcmf_sdbrcm_sdlock(bus);
1425 rxlen = bus->rxlen;1821 rxlen = bus->rxlen;
1426 memcpy(msg, bus->rxctl, min(msglen, rxlen));1822 memcpy(msg, bus->rxctl, min(msglen, rxlen));
1427 bus->rxlen = 0;1823 bus->rxlen = 0;
1428 dhd_os_sdunlock(bus->dhd);1824 brcmf_sdbrcm_sdunlock(bus);
1429 1825
1430 if (rxlen) {1826 if (rxlen) {
1431 DHD_CTL(("%s: resumed on rxctl frame, got %d expected %d\n",1827 BRCMF_CTL(("%s: resumed on rxctl frame, got %d expected %d\n",
1432 __func__, rxlen, msglen));1828 __func__, rxlen, msglen));
1433 } else if (timeleft == 0) {1829 } else if (timeleft == 0) {
1434 DHD_ERROR(("%s: resumed on timeout\n", __func__));1830 BRCMF_ERROR(("%s: resumed on timeout\n", __func__));
1435#ifdef DHD_DEBUG1831#ifdef BCMDBG
1436 dhd_os_sdlock(bus->dhd);1832 brcmf_sdbrcm_sdlock(bus);
1437 dhdsdio_checkdied(bus, NULL, 0);1833 brcmf_sdbrcm_checkdied(bus, NULL, 0);
1438 dhd_os_sdunlock(bus->dhd);1834 brcmf_sdbrcm_sdunlock(bus);
1439#endif /* DHD_DEBUG */1835#endif /* BCMDBG */
1440 } else if (pending == true) {1836 } else if (pending == true) {
1441 DHD_CTL(("%s: cancelled\n", __func__));1837 BRCMF_CTL(("%s: cancelled\n", __func__));
1442 return -ERESTARTSYS;1838 return -ERESTARTSYS;
1443 } else {1839 } else {
1444 DHD_CTL(("%s: resumed for unknown reason?\n", __func__));1840 BRCMF_CTL(("%s: resumed for unknown reason?\n", __func__));
1445#ifdef DHD_DEBUG1841#ifdef BCMDBG
1446 dhd_os_sdlock(bus->dhd);1842 brcmf_sdbrcm_sdlock(bus);
1447 dhdsdio_checkdied(bus, NULL, 0);1843 brcmf_sdbrcm_checkdied(bus, NULL, 0);
1448 dhd_os_sdunlock(bus->dhd);1844 brcmf_sdbrcm_sdunlock(bus);
1449#endif /* DHD_DEBUG */1845#endif /* BCMDBG */
1450 }1846 }
1451 1847
1452 if (rxlen)1848 if (rxlen)
1453 bus->dhd->rx_ctlpkts++;1849 bus->drvr->rx_ctlpkts++;
1454 else1850 else
1455 bus->dhd->rx_ctlerrs++;1851 bus->drvr->rx_ctlerrs++;
1456 1852
1457 return rxlen ? (int)rxlen : -ETIMEDOUT;1853 return rxlen ? (int)rxlen : -ETIMEDOUT;
1458}1854}
@@ -1466,8 +1862,10 @@ enum { · 7 unmodified lines
1466 IOV_SDCIS,1862 IOV_SDCIS,
1467 IOV_MEMBYTES,1863 IOV_MEMBYTES,
1468 IOV_MEMSIZE,1864 IOV_MEMSIZE,
1469#ifdef DHD_DEBUG1865#ifdef BCMDBG
1470 IOV_CHECKDIED,1866 IOV_CHECKDIED,
1867 IOV_CONS,
1868 IOV_DCONSOLE_POLL,
1471#endif1869#endif
1472 IOV_DOWNLOAD,1870 IOV_DOWNLOAD,
1473 IOV_FORCEEVEN,1871 IOV_FORCEEVEN,
@@ -1490,10 +1888,11 @@ enum { · 16 unmodified lines
1490 IOV_IDLECLOCK,1888 IOV_IDLECLOCK,
1491 IOV_SD1IDLE,1889 IOV_SD1IDLE,
1492 IOV_SLEEP,1890 IOV_SLEEP,
1891 IOV_WDTICK,
1493 IOV_VARS1892 IOV_VARS
1494};1893};
1495 1894
1496const bcm_iovar_t dhdsdio_iovars[] = {1895const struct brcmu_iovar brcmf_sdio_iovars[] = {
1497 {"intr", IOV_INTR, 0, IOVT_BOOL, 0},1896 {"intr", IOV_INTR, 0, IOVT_BOOL, 0},
1498 {"sleep", IOV_SLEEP, 0, IOVT_BOOL, 0},1897 {"sleep", IOV_SLEEP, 0, IOVT_BOOL, 0},
1499 {"pollrate", IOV_POLLRATE, 0, IOVT_UINT32, 0},1898 {"pollrate", IOV_POLLRATE, 0, IOVT_UINT32, 0},
@@ -1510,12 +1909,17 @@ const bcm_iovar_t dhdsdio_iovars[] = { · 10 unmodified lines
1510 {"alignctl", IOV_ALIGNCTL, 0, IOVT_BOOL, 0},1909 {"alignctl", IOV_ALIGNCTL, 0, IOVT_BOOL, 0},
1511 {"sdalign", IOV_SDALIGN, 0, IOVT_BOOL, 0},1910 {"sdalign", IOV_SDALIGN, 0, IOVT_BOOL, 0},
1512 {"devreset", IOV_DEVRESET, 0, IOVT_BOOL, 0},1911 {"devreset", IOV_DEVRESET, 0, IOVT_BOOL, 0},
1513#ifdef DHD_DEBUG1912 {"wdtick", IOV_WDTICK, 0, IOVT_UINT32, 0},
1514 {"sdreg", IOV_SDREG, 0, IOVT_BUFFER, sizeof(sdreg_t)}1913#ifdef BCMDBG
1914 {"cons", IOV_CONS, 0, IOVT_BUFFER, 0}
1915 ,
1916 {"dconpoll", IOV_DCONSOLE_POLL, 0, IOVT_UINT32, 0}
1917 ,
1918 {"sdreg", IOV_SDREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)}
1515 ,1919 ,
1516 {"sbreg", IOV_SBREG, 0, IOVT_BUFFER, sizeof(sdreg_t)}1920 {"sbreg", IOV_SBREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)}
1517 ,1921 ,
1518 {"sd_cis", IOV_SDCIS, 0, IOVT_BUFFER, DHD_IOCTL_MAXLEN}1922 {"sd_cis", IOV_SDCIS, 0, IOVT_BUFFER, BRCMF_IOCTL_MAXLEN}
1519 ,1923 ,
1520 {"forcealign", IOV_FORCEEVEN, 0, IOVT_BOOL, 0}1924 {"forcealign", IOV_FORCEEVEN, 0, IOVT_BOOL, 0}
1521 ,1925 ,
@@ -1527,15 +1931,13 @@ const bcm_iovar_t dhdsdio_iovars[] = { · 5 unmodified lines
1527 ,1931 ,
1528 {"cpu", IOV_CPU, 0, IOVT_BOOL, 0}1932 {"cpu", IOV_CPU, 0, IOVT_BOOL, 0}
1529 ,1933 ,
1530#ifdef DHD_DEBUG
1531 {"checkdied", IOV_CHECKDIED, 0, IOVT_BUFFER, 0}1934 {"checkdied", IOV_CHECKDIED, 0, IOVT_BUFFER, 0}
1532 ,1935 ,
1533#endif /* DHD_DEBUG */1936#endif /* BCMDBG */
1534#endif /* DHD_DEBUG */
1535#ifdef SDTEST1937#ifdef SDTEST
1536 {"extloop", IOV_EXTLOOP, 0, IOVT_BOOL, 0}1938 {"extloop", IOV_EXTLOOP, 0, IOVT_BOOL, 0}
1537 ,1939 ,
1538 {"pktgen", IOV_PKTGEN, 0, IOVT_BUFFER, sizeof(dhd_pktgen_t)}1940 {"pktgen", IOV_PKTGEN, 0, IOVT_BUFFER, sizeof(struct brcmf_pktgen)}
1539 ,1941 ,
1540#endif /* SDTEST */1942#endif /* SDTEST */
1541 1943
@@ -1543,122 +1945,122 @@ const bcm_iovar_t dhdsdio_iovars[] = { · 1 unmodified line
1543};1945};
1544 1946
1545static void1947static void
1546dhd_dump_pct(struct bcmstrbuf *strbuf, char *desc, uint num, uint div)1948brcmf_dump_pct(struct brcmu_strbuf *strbuf, char *desc, uint num, uint div)
1547{1949{
1548 uint q1, q2;1950 uint q1, q2;
1549 1951
1550 if (!div) {1952 if (!div) {
1551 bcm_bprintf(strbuf, "%s N/A", desc);1953 brcmu_bprintf(strbuf, "%s N/A", desc);
1552 } else {1954 } else {
1553 q1 = num / div;1955 q1 = num / div;
1554 q2 = (100 * (num - (q1 * div))) / div;1956 q2 = (100 * (num - (q1 * div))) / div;
1555 bcm_bprintf(strbuf, "%s %d.%02d", desc, q1, q2);1957 brcmu_bprintf(strbuf, "%s %d.%02d", desc, q1, q2);
1556 }1958 }
1557}1959}
1558 1960
1559void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)1961void brcmf_sdbrcm_bus_dump(struct brcmf_pub *drvr, struct brcmu_strbuf *strbuf)
1560{1962{
1561 dhd_bus_t *bus = dhdp->bus;1963 struct brcmf_bus *bus = drvr->bus;
1562 1964
1563 bcm_bprintf(strbuf, "Bus SDIO structure:\n");1965 brcmu_bprintf(strbuf, "Bus SDIO structure:\n");
1564 bcm_bprintf(strbuf,1966 brcmu_bprintf(strbuf,
1565 "hostintmask 0x%08x intstatus 0x%08x sdpcm_ver %d\n",1967 "hostintmask 0x%08x intstatus 0x%08x sdpcm_ver %d\n",
1566 bus->hostintmask, bus->intstatus, bus->sdpcm_ver);1968 bus->hostintmask, bus->intstatus, bus->sdpcm_ver);
1567 bcm_bprintf(strbuf,1969 brcmu_bprintf(strbuf,
1568 "fcstate %d qlen %d tx_seq %d, max %d, rxskip %d rxlen %d rx_seq %d\n",1970 "fcstate %d qlen %d tx_seq %d, max %d, rxskip %d rxlen %d rx_seq %d\n",
1569 bus->fcstate, pktq_len(&bus->txq), bus->tx_seq, bus->tx_max,1971 bus->fcstate, pktq_len(&bus->txq), bus->tx_seq, bus->tx_max,
1570 bus->rxskip, bus->rxlen, bus->rx_seq);1972 bus->rxskip, bus->rxlen, bus->rx_seq);
1571 bcm_bprintf(strbuf, "intr %d intrcount %d lastintrs %d spurious %d\n",1973 brcmu_bprintf(strbuf, "intr %d intrcount %d lastintrs %d spurious %d\n",
1572 bus->intr, bus->intrcount, bus->lastintrs, bus->spurious);1974 bus->intr, bus->intrcount, bus->lastintrs, bus->spurious);
1573 bcm_bprintf(strbuf, "pollrate %d pollcnt %d regfails %d\n",1975 brcmu_bprintf(strbuf, "pollrate %d pollcnt %d regfails %d\n",
1574 bus->pollrate, bus->pollcnt, bus->regfails);1976 bus->pollrate, bus->pollcnt, bus->regfails);
1575 1977
1576 bcm_bprintf(strbuf, "\nAdditional counters:\n");1978 brcmu_bprintf(strbuf, "\nAdditional counters:\n");
1577 bcm_bprintf(strbuf,1979 brcmu_bprintf(strbuf,
1578 "tx_sderrs %d fcqueued %d rxrtx %d rx_toolong %d rxc_errors %d\n",1980 "tx_sderrs %d fcqueued %d rxrtx %d rx_toolong %d rxc_errors %d\n",
1579 bus->tx_sderrs, bus->fcqueued, bus->rxrtx, bus->rx_toolong,1981 bus->tx_sderrs, bus->fcqueued, bus->rxrtx, bus->rx_toolong,
1580 bus->rxc_errors);1982 bus->rxc_errors);
1581 bcm_bprintf(strbuf, "rx_hdrfail %d badhdr %d badseq %d\n",1983 brcmu_bprintf(strbuf, "rx_hdrfail %d badhdr %d badseq %d\n",
1582 bus->rx_hdrfail, bus->rx_badhdr, bus->rx_badseq);1984 bus->rx_hdrfail, bus->rx_badhdr, bus->rx_badseq);
1583 bcm_bprintf(strbuf, "fc_rcvd %d, fc_xoff %d, fc_xon %d\n", bus->fc_rcvd,1985 brcmu_bprintf(strbuf, "fc_rcvd %d, fc_xoff %d, fc_xon %d\n",
1584 bus->fc_xoff, bus->fc_xon);1986 bus->fc_rcvd, bus->fc_xoff, bus->fc_xon);
1585 bcm_bprintf(strbuf, "rxglomfail %d, rxglomframes %d, rxglompkts %d\n",1987 brcmu_bprintf(strbuf, "rxglomfail %d, rxglomframes %d, rxglompkts %d\n",
1586 bus->rxglomfail, bus->rxglomframes, bus->rxglompkts);1988 bus->rxglomfail, bus->rxglomframes, bus->rxglompkts);
1587 bcm_bprintf(strbuf, "f2rx (hdrs/data) %d (%d/%d), f2tx %d f1regs %d\n",1989 brcmu_bprintf(strbuf, "f2rx (hdrs/data) %d (%d/%d), f2tx %d f1regs"
1588 (bus->f2rxhdrs + bus->f2rxdata), bus->f2rxhdrs,1990 " %d\n",
1589 bus->f2rxdata, bus->f2txdata, bus->f1regdata);1991 (bus->f2rxhdrs + bus->f2rxdata), bus->f2rxhdrs,
1992 bus->f2rxdata, bus->f2txdata, bus->f1regdata);
1590 {1993 {
1591 dhd_dump_pct(strbuf, "\nRx: pkts/f2rd", bus->dhd->rx_packets,1994 brcmf_dump_pct(strbuf, "\nRx: pkts/f2rd", bus->drvr->rx_packets,
1592 (bus->f2rxhdrs + bus->f2rxdata));1995 (bus->f2rxhdrs + bus->f2rxdata));
1593 dhd_dump_pct(strbuf, ", pkts/f1sd", bus->dhd->rx_packets,1996 brcmf_dump_pct(strbuf, ", pkts/f1sd", bus->drvr->rx_packets,
1594 bus->f1regdata);1997 bus->f1regdata);
1595 dhd_dump_pct(strbuf, ", pkts/sd", bus->dhd->rx_packets,1998 brcmf_dump_pct(strbuf, ", pkts/sd", bus->drvr->rx_packets,
1596 (bus->f2rxhdrs + bus->f2rxdata + bus->f1regdata));1999 (bus->f2rxhdrs + bus->f2rxdata + bus->f1regdata));
1597 dhd_dump_pct(strbuf, ", pkts/int", bus->dhd->rx_packets,2000 brcmf_dump_pct(strbuf, ", pkts/int", bus->drvr->rx_packets,
1598 bus->intrcount);2001 bus->intrcount);
1599 bcm_bprintf(strbuf, "\n");2002 brcmu_bprintf(strbuf, "\n");
1600 2003
1601 dhd_dump_pct(strbuf, "Rx: glom pct", (100 * bus->rxglompkts),2004 brcmf_dump_pct(strbuf, "Rx: glom pct", (100 * bus->rxglompkts),
1602 bus->dhd->rx_packets);2005 bus->drvr->rx_packets);
1603 dhd_dump_pct(strbuf, ", pkts/glom", bus->rxglompkts,2006 brcmf_dump_pct(strbuf, ", pkts/glom", bus->rxglompkts,
1604 bus->rxglomframes);2007 bus->rxglomframes);
1605 bcm_bprintf(strbuf, "\n");2008 brcmu_bprintf(strbuf, "\n");
1606 2009
1607 dhd_dump_pct(strbuf, "Tx: pkts/f2wr", bus->dhd->tx_packets,2010 brcmf_dump_pct(strbuf, "Tx: pkts/f2wr", bus->drvr->tx_packets,
1608 bus->f2txdata);2011 bus->f2txdata);
1609 dhd_dump_pct(strbuf, ", pkts/f1sd", bus->dhd->tx_packets,2012 brcmf_dump_pct(strbuf, ", pkts/f1sd", bus->drvr->tx_packets,
1610 bus->f1regdata);2013 bus->f1regdata);
1611 dhd_dump_pct(strbuf, ", pkts/sd", bus->dhd->tx_packets,2014 brcmf_dump_pct(strbuf, ", pkts/sd", bus->drvr->tx_packets,
1612 (bus->f2txdata + bus->f1regdata));2015 (bus->f2txdata + bus->f1regdata));
1613 dhd_dump_pct(strbuf, ", pkts/int", bus->dhd->tx_packets,2016 brcmf_dump_pct(strbuf, ", pkts/int", bus->drvr->tx_packets,
1614 bus->intrcount);2017 bus->intrcount);
1615 bcm_bprintf(strbuf, "\n");2018 brcmu_bprintf(strbuf, "\n");
1616 2019
1617 dhd_dump_pct(strbuf, "Total: pkts/f2rw",2020 brcmf_dump_pct(strbuf, "Total: pkts/f2rw",
1618 (bus->dhd->tx_packets + bus->dhd->rx_packets),2021 (bus->drvr->tx_packets + bus->drvr->rx_packets),
1619 (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata));2022 (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata));
1620 dhd_dump_pct(strbuf, ", pkts/f1sd",2023 brcmf_dump_pct(strbuf, ", pkts/f1sd",
1621 (bus->dhd->tx_packets + bus->dhd->rx_packets),2024 (bus->drvr->tx_packets + bus->drvr->rx_packets),
1622 bus->f1regdata);2025 bus->f1regdata);
1623 dhd_dump_pct(strbuf, ", pkts/sd",2026 brcmf_dump_pct(strbuf, ", pkts/sd",
1624 (bus->dhd->tx_packets + bus->dhd->rx_packets),2027 (bus->drvr->tx_packets + bus->drvr->rx_packets),
1625 (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata +2028 (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata +
1626 bus->f1regdata));2029 bus->f1regdata));
1627 dhd_dump_pct(strbuf, ", pkts/int",2030 brcmf_dump_pct(strbuf, ", pkts/int",
1628 (bus->dhd->tx_packets + bus->dhd->rx_packets),2031 (bus->drvr->tx_packets + bus->drvr->rx_packets),
1629 bus->intrcount);2032 bus->intrcount);
1630 bcm_bprintf(strbuf, "\n\n");2033 brcmu_bprintf(strbuf, "\n\n");
1631 }2034 }
1632 2035
1633#ifdef SDTEST2036#ifdef SDTEST
1634 if (bus->pktgen_count) {2037 if (bus->pktgen_count) {
1635 bcm_bprintf(strbuf, "pktgen config and count:\n");2038 brcmu_bprintf(strbuf, "pktgen config and count:\n");
1636 bcm_bprintf(strbuf,2039 brcmu_bprintf(strbuf,
1637 "freq %d count %d print %d total %d min %d len %d\n",2040 "freq %d count %d print %d total %d min %d len %d\n",
1638 bus->pktgen_freq, bus->pktgen_count,2041 bus->pktgen_freq, bus->pktgen_count,
1639 bus->pktgen_print, bus->pktgen_total,2042 bus->pktgen_print, bus->pktgen_total,
1640 bus->pktgen_minlen, bus->pktgen_maxlen);2043 bus->pktgen_minlen, bus->pktgen_maxlen);
1641 bcm_bprintf(strbuf, "send attempts %d rcvd %d fail %d\n",2044 brcmu_bprintf(strbuf, "send attempts %d rcvd %d fail %d\n",
1642 bus->pktgen_sent, bus->pktgen_rcvd,2045 bus->pktgen_sent, bus->pktgen_rcvd,
1643 bus->pktgen_fail);2046 bus->pktgen_fail);
1644 }2047 }
1645#endif /* SDTEST */2048#endif /* SDTEST */
1646#ifdef DHD_DEBUG2049#ifdef BCMDBG
1647 bcm_bprintf(strbuf, "dpc_sched %d host interrupt%spending\n",2050 brcmu_bprintf(strbuf, "dpc_sched %d host interrupt%spending\n",
1648 bus->dpc_sched,2051 bus->dpc_sched, " not ");
1649 (bcmsdh_intr_pending(bus->sdh) ? " " : " not "));2052 brcmu_bprintf(strbuf, "blocksize %d roundup %d\n", bus->blocksize,
1650 bcm_bprintf(strbuf, "blocksize %d roundup %d\n", bus->blocksize,
1651 bus->roundup);2053 bus->roundup);
1652#endif /* DHD_DEBUG */2054#endif /* BCMDBG */
1653 bcm_bprintf(strbuf,2055 brcmu_bprintf(strbuf,
1654 "clkstate %d activity %d idletime %d idlecount %d sleeping %d\n",2056 "clkstate %d activity %d idletime %d idlecount %d sleeping %d\n",
1655 bus->clkstate, bus->activity, bus->idletime, bus->idlecount,2057 bus->clkstate, bus->activity, bus->idletime, bus->idlecount,
1656 bus->sleeping);2058 bus->sleeping);
1657}2059}
1658 2060
1659void dhd_bus_clearcounts(dhd_pub_t *dhdp)2061void brcmf_bus_clearcounts(struct brcmf_pub *drvr)
1660{2062{
1661 dhd_bus_t *bus = (dhd_bus_t *) dhdp->bus;2063 struct brcmf_bus *bus = (struct brcmf_bus *) drvr->bus;
1662 2064
1663 bus->intrcount = bus->lastintrs = bus->spurious = bus->regfails = 0;2065 bus->intrcount = bus->lastintrs = bus->spurious = bus->regfails = 0;
1664 bus->rxrtx = bus->rx_toolong = bus->rxc_errors = 0;2066 bus->rxrtx = bus->rx_toolong = bus->rxc_errors = 0;
@@ -1669,11 +2071,11 @@ void dhd_bus_clearcounts(dhd_pub_t *dhdp) · 4 unmodified lines
1669}2071}
1670 2072
1671#ifdef SDTEST2073#ifdef SDTEST
1672static int dhdsdio_pktgen_get(dhd_bus_t *bus, u8 *arg)2074static int brcmf_sdbrcm_pktgen_get(struct brcmf_bus *bus, u8 *arg)
1673{2075{
1674 dhd_pktgen_t pktgen;2076 struct brcmf_pktgen pktgen;
1675 2077
1676 pktgen.version = DHD_PKTGEN_VERSION;2078 pktgen.version = BRCMF_PKTGEN_VERSION;
1677 pktgen.freq = bus->pktgen_freq;2079 pktgen.freq = bus->pktgen_freq;
1678 pktgen.count = bus->pktgen_count;2080 pktgen.count = bus->pktgen_count;
1679 pktgen.print = bus->pktgen_print;2081 pktgen.print = bus->pktgen_print;
@@ -1691,13 +2093,13 @@ static int dhdsdio_pktgen_get(dhd_bus_t *bus, u8 *arg) · 11 unmodified lines
1691 return 0;2093 return 0;
1692}2094}
1693 2095
1694static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg)2096static int brcmf_sdbrcm_pktgen_set(struct brcmf_bus *bus, u8 *arg)
1695{2097{
1696 dhd_pktgen_t pktgen;2098 struct brcmf_pktgen pktgen;
1697 uint oldcnt, oldmode;2099 uint oldcnt, oldmode;
1698 2100
1699 memcpy(&pktgen, arg, sizeof(pktgen));2101 memcpy(&pktgen, arg, sizeof(pktgen));
1700 if (pktgen.version != DHD_PKTGEN_VERSION)2102 if (pktgen.version != BRCMF_PKTGEN_VERSION)
1701 return -EINVAL;2103 return -EINVAL;
1702 2104
1703 oldcnt = bus->pktgen_count;2105 oldcnt = bus->pktgen_count;
@@ -1725,7 +2127,7 @@ static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg) · 21 unmodified lines
1725#endif /* SDTEST */2127#endif /* SDTEST */
1726 2128
1727static int2129static int
1728dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data,2130brcmf_sdbrcm_membytes(struct brcmf_bus *bus, bool write, u32 address, u8 *data,
1729 uint size)2131 uint size)
1730{2132{
1731 int bcmerror = 0;2133 int bcmerror = 0;
@@ -1740,21 +2142,22 @@ dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data, · 8 unmodified lines
1740 dsize = size;2142 dsize = size;
1741 2143
1742 /* Set the backplane window to include the start address */2144 /* Set the backplane window to include the start address */
1743 bcmerror = dhdsdio_set_siaddr_window(bus, address);2145 bcmerror = brcmf_sdbrcm_set_siaddr_window(bus, address);
1744 if (bcmerror) {2146 if (bcmerror) {
1745 DHD_ERROR(("%s: window change failed\n", __func__));2147 BRCMF_ERROR(("%s: window change failed\n", __func__));
1746 goto xfer_done;2148 goto xfer_done;
1747 }2149 }
1748 2150
1749 /* Do the transfer(s) */2151 /* Do the transfer(s) */
1750 while (size) {2152 while (size) {
1751 DHD_INFO(("%s: %s %d bytes at offset 0x%08x in window 0x%08x\n",2153 BRCMF_INFO(("%s: %s %d bytes at offset 0x%08x in window"
1752 __func__, (write ? "write" : "read"), dsize,2154 " 0x%08x\n", __func__, (write ? "write" : "read"),
1753 sdaddr, (address & SBSDIO_SBWINDOW_MASK)));2155 dsize, sdaddr, (address & SBSDIO_SBWINDOW_MASK)));
1754 bcmerror =2156 bcmerror =
1755 bcmsdh_rwdata(bus->sdh, write, sdaddr, data, dsize);2157 brcmf_sdcard_rwdata(bus->card, write, sdaddr, data, dsize);
1756 if (bcmerror) {2158 if (bcmerror) {
1757 DHD_ERROR(("%s: membytes transfer failed\n", __func__));2159 BRCMF_ERROR(("%s: membytes transfer failed\n",
2160 __func__));
1758 break;2161 break;
1759 }2162 }
1760 2163
@@ -1763,10 +2166,10 @@ dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data, · 2 unmodified lines
1763 if (size) {2166 if (size) {
1764 data += dsize;2167 data += dsize;
1765 address += dsize;2168 address += dsize;
1766 bcmerror = dhdsdio_set_siaddr_window(bus, address);2169 bcmerror = brcmf_sdbrcm_set_siaddr_window(bus, address);
1767 if (bcmerror) {2170 if (bcmerror) {
1768 DHD_ERROR(("%s: window change failed\n",2171 BRCMF_ERROR(("%s: window change failed\n",
1769 __func__));2172 __func__));
1770 break;2173 break;
1771 }2174 }
1772 sdaddr = 0;2175 sdaddr = 0;
@@ -1776,43 +2179,45 @@ dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data, · 3 unmodified lines
1776 2179
1777xfer_done:2180xfer_done:
1778 /* Return the window to backplane enumeration space for core access */2181 /* Return the window to backplane enumeration space for core access */
1779 if (dhdsdio_set_siaddr_window(bus, bcmsdh_cur_sbwad(bus->sdh))) {2182 if (brcmf_sdbrcm_set_siaddr_window(bus,
1780 DHD_ERROR(("%s: FAILED to set window back to 0x%x\n",2183 brcmf_sdcard_cur_sbwad(bus->card))) {
1781 __func__, bcmsdh_cur_sbwad(bus->sdh)));2184 BRCMF_ERROR(("%s: FAILED to set window back to 0x%x\n",
2185 __func__, brcmf_sdcard_cur_sbwad(bus->card)));
1782 }2186 }
1783 2187
1784 return bcmerror;2188 return bcmerror;
1785}2189}
1786 2190
1787#ifdef DHD_DEBUG2191#ifdef BCMDBG
1788static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)2192static int brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh)
1789{2193{
1790 u32 addr;2194 u32 addr;
1791 int rv;2195 int rv;
1792 2196
1793 /* Read last word in memory to determine address of2197 /* Read last word in memory to determine address of
1794 sdpcm_shared structure */2198 sdpcm_shared structure */
1795 rv = dhdsdio_membytes(bus, false, bus->ramsize - 4, (u8 *)&addr, 4);2199 rv = brcmf_sdbrcm_membytes(bus, false, bus->ramsize - 4, (u8 *)&addr,
2200 4);
1796 if (rv < 0)2201 if (rv < 0)
1797 return rv;2202 return rv;
1798 2203
1799 addr = le32_to_cpu(addr);2204 addr = le32_to_cpu(addr);
1800 2205
1801 DHD_INFO(("sdpcm_shared address 0x%08X\n", addr));2206 BRCMF_INFO(("sdpcm_shared address 0x%08X\n", addr));
1802 2207
1803 /*2208 /*
1804 * Check if addr is valid.2209 * Check if addr is valid.
1805 * NVRAM length at the end of memory should have been overwritten.2210 * NVRAM length at the end of memory should have been overwritten.
1806 */2211 */
1807 if (addr == 0 || ((~addr >> 16) & 0xffff) == (addr & 0xffff)) {2212 if (addr == 0 || ((~addr >> 16) & 0xffff) == (addr & 0xffff)) {
1808 DHD_ERROR(("%s: address (0x%08x) of sdpcm_shared invalid\n",2213 BRCMF_ERROR(("%s: address (0x%08x) of sdpcm_shared invalid\n",
1809 __func__, addr));2214 __func__, addr));
1810 return -EBADE;2215 return -EBADE;
1811 }2216 }
1812 2217
1813 /* Read hndrte_shared structure */2218 /* Read rte_shared structure */
1814 rv = dhdsdio_membytes(bus, false, addr, (u8 *) sh,2219 rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *) sh,
1815 sizeof(sdpcm_shared_t));2220 sizeof(struct sdpcm_shared));
1816 if (rv < 0)2221 if (rv < 0)
1817 return rv;2222 return rv;
1818 2223
@@ -1826,28 +2231,28 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh) · 7 unmodified lines
1826 sh->msgtrace_addr = le32_to_cpu(sh->msgtrace_addr);2231 sh->msgtrace_addr = le32_to_cpu(sh->msgtrace_addr);
1827 2232
1828 if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) {2233 if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) {
1829 DHD_ERROR(("%s: sdpcm_shared version %d in dhd "2234 BRCMF_ERROR(("%s: sdpcm_shared version %d in brcmf "
1830 "is different than sdpcm_shared version %d in dongle\n",2235 "is different than sdpcm_shared version %d in dongle\n",
1831 __func__, SDPCM_SHARED_VERSION,2236 __func__, SDPCM_SHARED_VERSION,
1832 sh->flags & SDPCM_SHARED_VERSION_MASK));2237 sh->flags & SDPCM_SHARED_VERSION_MASK));
1833 return -EBADE;2238 return -EBADE;
1834 }2239 }
1835 2240
1836 return 0;2241 return 0;
1837}2242}
1838 2243
1839static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size)2244static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size)
1840{2245{
1841 int bcmerror = 0;2246 int bcmerror = 0;
1842 uint msize = 512;2247 uint msize = 512;
1843 char *mbuffer = NULL;2248 char *mbuffer = NULL;
1844 uint maxstrlen = 256;2249 uint maxstrlen = 256;
1845 char *str = NULL;2250 char *str = NULL;
1846 trap_t tr;2251 struct brcmf_trap tr;
1847 sdpcm_shared_t sdpcm_shared;2252 struct sdpcm_shared sdpcm_shared;
1848 struct bcmstrbuf strbuf;2253 struct brcmu_strbuf strbuf;
1849 2254
1850 DHD_TRACE(("%s: Enter\n", __func__));2255 BRCMF_TRACE(("%s: Enter\n", __func__));
1851 2256
1852 if (data == NULL) {2257 if (data == NULL) {
1853 /*2258 /*
@@ -1857,8 +2262,8 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 3 unmodified lines
1857 size = msize;2262 size = msize;
1858 mbuffer = data = kmalloc(msize, GFP_ATOMIC);2263 mbuffer = data = kmalloc(msize, GFP_ATOMIC);
1859 if (mbuffer == NULL) {2264 if (mbuffer == NULL) {
1860 DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__,2265 BRCMF_ERROR(("%s: kmalloc(%d) failed\n", __func__,
1861 msize));2266 msize));
1862 bcmerror = -ENOMEM;2267 bcmerror = -ENOMEM;
1863 goto done;2268 goto done;
1864 }2269 }
@@ -1866,18 +2271,18 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 1 unmodified line
1866 2271
1867 str = kmalloc(maxstrlen, GFP_ATOMIC);2272 str = kmalloc(maxstrlen, GFP_ATOMIC);
1868 if (str == NULL) {2273 if (str == NULL) {
1869 DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__, maxstrlen));2274 BRCMF_ERROR(("%s: kmalloc(%d) failed\n", __func__, maxstrlen));
1870 bcmerror = -ENOMEM;2275 bcmerror = -ENOMEM;
1871 goto done;2276 goto done;
1872 }2277 }
1873 2278
1874 bcmerror = dhdsdio_readshared(bus, &sdpcm_shared);2279 bcmerror = brcmf_sdbrcm_readshared(bus, &sdpcm_shared);
1875 if (bcmerror < 0)2280 if (bcmerror < 0)
1876 goto done;2281 goto done;
1877 2282
1878 bcm_binit(&strbuf, data, size);2283 brcmu_binit(&strbuf, data, size);
1879 2284
1880 bcm_bprintf(&strbuf,2285 brcmu_bprintf(&strbuf,
1881 "msgtrace address : 0x%08X\nconsole address : 0x%08X\n",2286 "msgtrace address : 0x%08X\nconsole address : 0x%08X\n",
1882 sdpcm_shared.msgtrace_addr, sdpcm_shared.console_addr);2287 sdpcm_shared.msgtrace_addr, sdpcm_shared.console_addr);
1883 2288
@@ -1886,7 +2291,7 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 2 unmodified lines
1886 * (Avoids conflict with real asserts for programmatic2291 * (Avoids conflict with real asserts for programmatic
1887 * parsing of output.)2292 * parsing of output.)
1888 */2293 */
1889 bcm_bprintf(&strbuf, "Assrt not built in dongle\n");2294 brcmu_bprintf(&strbuf, "Assrt not built in dongle\n");
1890 }2295 }
1891 2296
1892 if ((sdpcm_shared.flags & (SDPCM_SHARED_ASSERT | SDPCM_SHARED_TRAP)) ==2297 if ((sdpcm_shared.flags & (SDPCM_SHARED_ASSERT | SDPCM_SHARED_TRAP)) ==
@@ -1895,49 +2300,49 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 2 unmodified lines
1895 * (Avoids conflict with real asserts for programmatic2300 * (Avoids conflict with real asserts for programmatic
1896 * parsing of output.)2301 * parsing of output.)
1897 */2302 */
1898 bcm_bprintf(&strbuf, "No trap%s in dongle",2303 brcmu_bprintf(&strbuf, "No trap%s in dongle",
1899 (sdpcm_shared.flags & SDPCM_SHARED_ASSERT_BUILT)2304 (sdpcm_shared.flags & SDPCM_SHARED_ASSERT_BUILT)
1900 ? "/assrt" : "");2305 ? "/assrt" : "");
1901 } else {2306 } else {
1902 if (sdpcm_shared.flags & SDPCM_SHARED_ASSERT) {2307 if (sdpcm_shared.flags & SDPCM_SHARED_ASSERT) {
1903 /* Download assert */2308 /* Download assert */
1904 bcm_bprintf(&strbuf, "Dongle assert");2309 brcmu_bprintf(&strbuf, "Dongle assert");
1905 if (sdpcm_shared.assert_exp_addr != 0) {2310 if (sdpcm_shared.assert_exp_addr != 0) {
1906 str[0] = '\0';2311 str[0] = '\0';
1907 bcmerror = dhdsdio_membytes(bus, false,2312 bcmerror = brcmf_sdbrcm_membytes(bus, false,
1908 sdpcm_shared.assert_exp_addr,2313 sdpcm_shared.assert_exp_addr,
1909 (u8 *) str, maxstrlen);2314 (u8 *) str, maxstrlen);
1910 if (bcmerror < 0)2315 if (bcmerror < 0)
1911 goto done;2316 goto done;
1912 2317
1913 str[maxstrlen - 1] = '\0';2318 str[maxstrlen - 1] = '\0';
1914 bcm_bprintf(&strbuf, " expr \"%s\"", str);2319 brcmu_bprintf(&strbuf, " expr \"%s\"", str);
1915 }2320 }
1916 2321
1917 if (sdpcm_shared.assert_file_addr != 0) {2322 if (sdpcm_shared.assert_file_addr != 0) {
1918 str[0] = '\0';2323 str[0] = '\0';
1919 bcmerror = dhdsdio_membytes(bus, false,2324 bcmerror = brcmf_sdbrcm_membytes(bus, false,
1920 sdpcm_shared.assert_file_addr,2325 sdpcm_shared.assert_file_addr,
1921 (u8 *) str, maxstrlen);2326 (u8 *) str, maxstrlen);
1922 if (bcmerror < 0)2327 if (bcmerror < 0)
1923 goto done;2328 goto done;
1924 2329
1925 str[maxstrlen - 1] = '\0';2330 str[maxstrlen - 1] = '\0';
1926 bcm_bprintf(&strbuf, " file \"%s\"", str);2331 brcmu_bprintf(&strbuf, " file \"%s\"", str);
1927 }2332 }
1928 2333
1929 bcm_bprintf(&strbuf, " line %d ",2334 brcmu_bprintf(&strbuf, " line %d ",
1930 sdpcm_shared.assert_line);2335 sdpcm_shared.assert_line);
1931 }2336 }
1932 2337
1933 if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) {2338 if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) {
1934 bcmerror = dhdsdio_membytes(bus, false,2339 bcmerror = brcmf_sdbrcm_membytes(bus, false,
1935 sdpcm_shared.trap_addr, (u8 *)&tr,2340 sdpcm_shared.trap_addr, (u8 *)&tr,
1936 sizeof(trap_t));2341 sizeof(struct brcmf_trap));
1937 if (bcmerror < 0)2342 if (bcmerror < 0)
1938 goto done;2343 goto done;
1939 2344
1940 bcm_bprintf(&strbuf,2345 brcmu_bprintf(&strbuf,
1941 "Dongle trap type 0x%x @ epc 0x%x, cpsr 0x%x, spsr 0x%x, sp 0x%x,"2346 "Dongle trap type 0x%x @ epc 0x%x, cpsr 0x%x, spsr 0x%x, sp 0x%x,"
1942 "lp 0x%x, rpc 0x%x Trap offset 0x%x, "2347 "lp 0x%x, rpc 0x%x Trap offset 0x%x, "
1943 "r0 0x%x, r1 0x%x, r2 0x%x, r3 0x%x, r4 0x%x, r5 0x%x, r6 0x%x, r7 0x%x\n",2348 "r0 0x%x, r1 0x%x, r2 0x%x, r3 0x%x, r4 0x%x, r5 0x%x, r6 0x%x, r7 0x%x\n",
@@ -1949,14 +2354,14 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 5 unmodified lines
1949 }2354 }
1950 2355
1951 if (sdpcm_shared.flags & (SDPCM_SHARED_ASSERT | SDPCM_SHARED_TRAP))2356 if (sdpcm_shared.flags & (SDPCM_SHARED_ASSERT | SDPCM_SHARED_TRAP))
1952 DHD_ERROR(("%s: %s\n", __func__, strbuf.origbuf));2357 BRCMF_ERROR(("%s: %s\n", __func__, strbuf.origbuf));
1953 2358
1954#ifdef DHD_DEBUG2359#ifdef BCMDBG
1955 if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) {2360 if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) {
1956 /* Mem dump to a file on device */2361 /* Mem dump to a file on device */
1957 dhdsdio_mem_dump(bus);2362 brcmf_sdbrcm_mem_dump(bus);
1958 }2363 }
1959#endif /* DHD_DEBUG */2364#endif /* BCMDBG */
1960 2365
1961done:2366done:
1962 kfree(mbuffer);2367 kfree(mbuffer);
@@ -1965,7 +2370,7 @@ done: · 2 unmodified lines
1965 return bcmerror;2370 return bcmerror;
1966}2371}
1967 2372
1968static int dhdsdio_mem_dump(dhd_bus_t *bus)2373static int brcmf_sdbrcm_mem_dump(struct brcmf_bus *bus)
1969{2374{
1970 int ret = 0;2375 int ret = 0;
1971 int size; /* Full mem size */2376 int size; /* Full mem size */
@@ -1977,7 +2382,7 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus) · 5 unmodified lines
1977 size = bus->ramsize;2382 size = bus->ramsize;
1978 buf = kmalloc(size, GFP_ATOMIC);2383 buf = kmalloc(size, GFP_ATOMIC);
1979 if (!buf) {2384 if (!buf) {
1980 DHD_ERROR(("%s: Out of memory (%d bytes)\n", __func__, size));2385 BRCMF_ERROR(("%s: Out of memory (%d bytes)\n", __func__, size));
1981 return -1;2386 return -1;
1982 }2387 }
1983 2388
@@ -1986,9 +2391,10 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus) · 2 unmodified lines
1986 databuf = buf;2391 databuf = buf;
1987 while (size) {2392 while (size) {
1988 read_size = min(MEMBLOCK, size);2393 read_size = min(MEMBLOCK, size);
1989 ret = dhdsdio_membytes(bus, false, start, databuf, read_size);2394 ret = brcmf_sdbrcm_membytes(bus, false, start, databuf,
2395 read_size);
1990 if (ret) {2396 if (ret) {
1991 DHD_ERROR(("%s: Error membytes %d\n", __func__, ret));2397 BRCMF_ERROR(("%s: Error membytes %d\n", __func__, ret));
1992 kfree(buf);2398 kfree(buf);
1993 return -1;2399 return -1;
1994 }2400 }
@@ -2002,20 +2408,20 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus) · 7 unmodified lines
2002 printk(KERN_DEBUG "Done\n");2408 printk(KERN_DEBUG "Done\n");
2003 2409
2004 /* free buf before return !!! */2410 /* free buf before return !!! */
2005 if (write_to_file(bus->dhd, buf, bus->ramsize)) {2411 if (brcmf_write_to_file(bus->drvr, buf, bus->ramsize)) {
2006 DHD_ERROR(("%s: Error writing to files\n", __func__));2412 BRCMF_ERROR(("%s: Error writing to files\n", __func__));
2007 return -1;2413 return -1;
2008 }2414 }
2009 2415
2010 /* buf free handled in write_to_file, not here */2416 /* buf free handled in brcmf_write_to_file, not here */
2011 return 0;2417 return 0;
2012}2418}
2013 2419
2014#define CONSOLE_LINE_MAX 1922420#define CONSOLE_LINE_MAX 192
2015 2421
2016static int dhdsdio_readconsole(dhd_bus_t *bus)2422static int brcmf_sdbrcm_readconsole(struct brcmf_bus *bus)
2017{2423{
2018 dhd_console_t *c = &bus->console;2424 struct brcmf_console *c = &bus->console;
2019 u8 line[CONSOLE_LINE_MAX], ch;2425 u8 line[CONSOLE_LINE_MAX], ch;
2020 u32 n, idx, addr;2426 u32 n, idx, addr;
2021 int rv;2427 int rv;
@@ -2025,8 +2431,8 @@ static int dhdsdio_readconsole(dhd_bus_t *bus) · 3 unmodified lines
2025 return 0;2431 return 0;
2026 2432
2027 /* Read console log struct */2433 /* Read console log struct */
2028 addr = bus->console_addr + offsetof(hndrte_cons_t, log);2434 addr = bus->console_addr + offsetof(struct rte_console, log);
2029 rv = dhdsdio_membytes(bus, false, addr, (u8 *)&c->log,2435 rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *)&c->log,
2030 sizeof(c->log));2436 sizeof(c->log));
2031 if (rv < 0)2437 if (rv < 0)
2032 return rv;2438 return rv;
@@ -2052,7 +2458,7 @@ static int dhdsdio_readconsole(dhd_bus_t *bus) · 19 unmodified lines
2052 2458
2053 /* Read the console buffer */2459 /* Read the console buffer */
2054 addr = le32_to_cpu(c->log.buf);2460 addr = le32_to_cpu(c->log.buf);
2055 rv = dhdsdio_membytes(bus, false, addr, c->buf, c->bufsize);2461 rv = brcmf_sdbrcm_membytes(bus, false, addr, c->buf, c->bufsize);
2056 if (rv < 0)2462 if (rv < 0)
2057 return rv;2463 return rv;
2058 2464
@@ -2088,16 +2494,16 @@ break2: · 29 unmodified lines
2088 2494
2089 return 0;2495 return 0;
2090}2496}
2091#endif /* DHD_DEBUG */2497#endif /* BCMDBG */
2092 2498
2093int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len)2499int brcmf_sdbrcm_downloadvars(struct brcmf_bus *bus, void *arg, int len)
2094{2500{
2095 int bcmerror = 0;2501 int bcmerror = 0;
2096 2502
2097 DHD_TRACE(("%s: Enter\n", __func__));2503 BRCMF_TRACE(("%s: Enter\n", __func__));
2098 2504
2099 /* Basic sanity checks */2505 /* Basic sanity checks */
2100 if (bus->dhd->up) {2506 if (bus->drvr->up) {
2101 bcmerror = -EISCONN;2507 bcmerror = -EISCONN;
2102 goto err;2508 goto err;
2103 }2509 }
@@ -2124,7 +2530,7 @@ err: · 20 unmodified lines
2124}2530}
2125 2531
2126static int2532static int
2127dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,2533brcmf_sdbrcm_doiovar(struct brcmf_bus *bus, const struct brcmu_iovar *vi, u32 actionid,
2128 const char *name, void *params, int plen, void *arg, int len,2534 const char *name, void *params, int plen, void *arg, int len,
2129 int val_size)2535 int val_size)
2130{2536{
@@ -2132,11 +2538,11 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 1 unmodified line
2132 s32 int_val = 0;2538 s32 int_val = 0;
2133 bool bool_val = 0;2539 bool bool_val = 0;
2134 2540
2135 DHD_TRACE(("%s: Enter, action %d name %s params %p plen %d arg %p "2541 BRCMF_TRACE(("%s: Enter, action %d name %s params %p plen %d arg %p "
2136 "len %d val_size %d\n",2542 "len %d val_size %d\n", __func__, actionid, name, params,
2137 __func__, actionid, name, params, plen, arg, len, val_size));2543 plen, arg, len, val_size));
2138 2544
2139 bcmerror = bcm_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid));2545 bcmerror = brcmu_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid));
2140 if (bcmerror != 0)2546 if (bcmerror != 0)
2141 goto exit;2547 goto exit;
2142 2548
@@ -2146,10 +2552,10 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines
2146 bool_val = (int_val != 0) ? true : false;2552 bool_val = (int_val != 0) ? true : false;
2147 2553
2148 /* Some ioctls use the bus */2554 /* Some ioctls use the bus */
2149 dhd_os_sdlock(bus->dhd);2555 brcmf_sdbrcm_sdlock(bus);
2150 2556
2151 /* Check if dongle is in reset. If so, only allow DEVRESET iovars */2557 /* Check if dongle is in reset. If so, only allow DEVRESET iovars */
2152 if (bus->dhd->dongle_reset && !(actionid == IOV_SVAL(IOV_DEVRESET) ||2558 if (bus->drvr->dongle_reset && !(actionid == IOV_SVAL(IOV_DEVRESET) ||
2153 actionid == IOV_GVAL(IOV_DEVRESET))) {2559 actionid == IOV_GVAL(IOV_DEVRESET))) {
2154 bcmerror = -EPERM;2560 bcmerror = -EPERM;
2155 goto exit;2561 goto exit;
@@ -2158,7 +2564,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
2158 /* Handle sleep stuff before any clock mucking */2564 /* Handle sleep stuff before any clock mucking */
2159 if (vi->varid == IOV_SLEEP) {2565 if (vi->varid == IOV_SLEEP) {
2160 if (IOV_ISSET(actionid)) {2566 if (IOV_ISSET(actionid)) {
2161 bcmerror = dhdsdio_bussleep(bus, bool_val);2567 bcmerror = brcmf_sdbrcm_bussleep(bus, bool_val);
2162 } else {2568 } else {
2163 int_val = (s32) bus->sleeping;2569 int_val = (s32) bus->sleeping;
2164 memcpy(arg, &int_val, val_size);2570 memcpy(arg, &int_val, val_size);
@@ -2167,9 +2573,9 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
2167 }2573 }
2168 2574
2169 /* Request clock to allow SDIO accesses */2575 /* Request clock to allow SDIO accesses */
2170 if (!bus->dhd->dongle_reset) {2576 if (!bus->drvr->dongle_reset) {
2171 BUS_WAKE(bus);2577 BUS_WAKE(bus);
2172 dhdsdio_clkctl(bus, CLK_AVAIL, false);2578 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
2173 }2579 }
2174 2580
2175 switch (actionid) {2581 switch (actionid) {
@@ -2181,15 +2587,13 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 5 unmodified lines
2181 case IOV_SVAL(IOV_INTR):2587 case IOV_SVAL(IOV_INTR):
2182 bus->intr = bool_val;2588 bus->intr = bool_val;
2183 bus->intdis = false;2589 bus->intdis = false;
2184 if (bus->dhd->up) {2590 if (bus->drvr->up) {
2591 BRCMF_INTR(("%s: %s SDIO interrupts\n", __func__,
2592 bus->intr ? "enable" : "disable"));
2185 if (bus->intr) {2593 if (bus->intr) {
2186 DHD_INTR(("%s: enable SDIO device interrupts\n",2594 brcmf_sdcard_intr_enable(bus->card);
2187 __func__));
2188 bcmsdh_intr_enable(bus->sdh);
2189 } else {2595 } else {
2190 DHD_INTR(("%s: disable SDIO interrupts\n",2596 brcmf_sdcard_intr_disable(bus->card);
2191 __func__));
2192 bcmsdh_intr_disable(bus->sdh);
2193 }2597 }
2194 }2598 }
2195 break;2599 break;
@@ -2210,7 +2614,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 14 unmodified lines
2210 break;2614 break;
2211 2615
2212 case IOV_SVAL(IOV_IDLETIME):2616 case IOV_SVAL(IOV_IDLETIME):
2213 if ((int_val < 0) && (int_val != DHD_IDLE_IMMEDIATE))2617 if ((int_val < 0) && (int_val != BRCMF_IDLE_IMMEDIATE))
2214 bcmerror = -EINVAL;2618 bcmerror = -EINVAL;
2215 else2619 else
2216 bus->idletime = int_val;2620 bus->idletime = int_val;
@@ -2243,8 +2647,6 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 26 unmodified lines
2243 2647
2244 bool set = (actionid == IOV_SVAL(IOV_MEMBYTES));2648 bool set = (actionid == IOV_SVAL(IOV_MEMBYTES));
2245 2649
2246 ASSERT(plen >= 2 * sizeof(int));
2247
2248 address = (u32) int_val;2650 address = (u32) int_val;
2249 memcpy(&int_val, (char *)params + sizeof(int_val),2651 memcpy(&int_val, (char *)params + sizeof(int_val),
2250 sizeof(int_val));2652 sizeof(int_val));
@@ -2253,25 +2655,25 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
2253 /* Do some validation */2655 /* Do some validation */
2254 dsize = set ? plen - (2 * sizeof(int)) : len;2656 dsize = set ? plen - (2 * sizeof(int)) : len;
2255 if (dsize < size) {2657 if (dsize < size) {
2256 DHD_ERROR(("%s: error on %s membytes, addr "2658 BRCMF_ERROR(("%s: error on %s membytes, addr "
2257 "0x%08x size %d dsize %d\n",2659 "0x%08x size %d dsize %d\n",
2258 __func__, (set ? "set" : "get"),2660 __func__, (set ? "set" : "get"),
2259 address, size, dsize));2661 address, size, dsize));
2260 bcmerror = -EINVAL;2662 bcmerror = -EINVAL;
2261 break;2663 break;
2262 }2664 }
2263 2665
2264 DHD_INFO(("%s: Request to %s %d bytes at address "2666 BRCMF_INFO(("%s: Request to %s %d bytes at address "
2265 "0x%08x\n",2667 "0x%08x\n", __func__,
2266 __func__, (set ? "write" : "read"), size, address));2668 (set ? "write" : "read"), size, address));
2267 2669
2268 /* If we know about SOCRAM, check for a fit */2670 /* If we know about SOCRAM, check for a fit */
2269 if ((bus->orig_ramsize) &&2671 if ((bus->orig_ramsize) &&
2270 ((address > bus->orig_ramsize)2672 ((address > bus->orig_ramsize)
2271 || (address + size > bus->orig_ramsize))) {2673 || (address + size > bus->orig_ramsize))) {
2272 DHD_ERROR(("%s: ramsize 0x%08x doesn't have %d "2674 BRCMF_ERROR(("%s: ramsize 0x%08x doesn't have"
2273 "bytes at 0x%08x\n",2675 " %d bytes at 0x%08x\n", __func__,
2274 __func__, bus->orig_ramsize, size, address));2676 bus->orig_ramsize, size, address));
2275 bcmerror = -EINVAL;2677 bcmerror = -EINVAL;
2276 break;2678 break;
2277 }2679 }
@@ -2282,8 +2684,8 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 4 unmodified lines
2282 2 * sizeof(int) : (u8 *) arg;2684 2 * sizeof(int) : (u8 *) arg;
2283 2685
2284 /* Call to do the transfer */2686 /* Call to do the transfer */
2285 bcmerror =2687 bcmerror = brcmf_sdbrcm_membytes(bus, set, address,
2286 dhdsdio_membytes(bus, set, address, data, size);2688 data, size);
2287 2689
2288 break;2690 break;
2289 }2691 }
@@ -2294,33 +2696,33 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 4 unmodified lines
2294 break;2696 break;
2295 2697
2296 case IOV_GVAL(IOV_SDIOD_DRIVE):2698 case IOV_GVAL(IOV_SDIOD_DRIVE):
2297 int_val = (s32) dhd_sdiod_drive_strength;2699 int_val = (s32) brcmf_sdiod_drive_strength;
2298 memcpy(arg, &int_val, val_size);2700 memcpy(arg, &int_val, val_size);
2299 break;2701 break;
2300 2702
2301 case IOV_SVAL(IOV_SDIOD_DRIVE):2703 case IOV_SVAL(IOV_SDIOD_DRIVE):
2302 dhd_sdiod_drive_strength = int_val;2704 brcmf_sdiod_drive_strength = int_val;
2303 dhdsdio_sdiod_drive_strength_init(bus,2705 brcmf_sdbrcm_sdiod_drive_strength_init(bus,
2304 dhd_sdiod_drive_strength);2706 brcmf_sdiod_drive_strength);
2305 break;2707 break;
2306 2708
2307 case IOV_SVAL(IOV_DOWNLOAD):2709 case IOV_SVAL(IOV_DOWNLOAD):
2308 bcmerror = dhdsdio_download_state(bus, bool_val);2710 bcmerror = brcmf_sdbrcm_download_state(bus, bool_val);
2309 break;2711 break;
2310 2712
2311 case IOV_SVAL(IOV_VARS):2713 case IOV_SVAL(IOV_VARS):
2312 bcmerror = dhdsdio_downloadvars(bus, arg, len);2714 bcmerror = brcmf_sdbrcm_downloadvars(bus, arg, len);
2313 break;2715 break;
2314 2716
2315 case IOV_GVAL(IOV_READAHEAD):2717 case IOV_GVAL(IOV_READAHEAD):
2316 int_val = (s32) dhd_readahead;2718 int_val = (s32) brcmf_readahead;
2317 memcpy(arg, &int_val, val_size);2719 memcpy(arg, &int_val, val_size);
2318 break;2720 break;
2319 2721
2320 case IOV_SVAL(IOV_READAHEAD):2722 case IOV_SVAL(IOV_READAHEAD):
2321 if (bool_val && !dhd_readahead)2723 if (bool_val && !brcmf_readahead)
2322 bus->nextlen = 0;2724 bus->nextlen = 0;
2323 dhd_readahead = bool_val;2725 brcmf_readahead = bool_val;
2324 break;2726 break;
2325 2727
2326 case IOV_GVAL(IOV_SDRXCHAIN):2728 case IOV_GVAL(IOV_SDRXCHAIN):
@@ -2335,40 +2737,56 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 8 unmodified lines
2335 bus->use_rxchain = bool_val;2737 bus->use_rxchain = bool_val;
2336 break;2738 break;
2337 case IOV_GVAL(IOV_ALIGNCTL):2739 case IOV_GVAL(IOV_ALIGNCTL):
2338 int_val = (s32) dhd_alignctl;2740 int_val = (s32) brcmf_alignctl;
2339 memcpy(arg, &int_val, val_size);2741 memcpy(arg, &int_val, val_size);
2340 break;2742 break;
2341 2743
2342 case IOV_SVAL(IOV_ALIGNCTL):2744 case IOV_SVAL(IOV_ALIGNCTL):
2343 dhd_alignctl = bool_val;2745 brcmf_alignctl = bool_val;
2344 break;2746 break;
2345 2747
2346 case IOV_GVAL(IOV_SDALIGN):2748 case IOV_GVAL(IOV_SDALIGN):
2347 int_val = DHD_SDALIGN;2749 int_val = BRCMF_SDALIGN;
2348 memcpy(arg, &int_val, val_size);2750 memcpy(arg, &int_val, val_size);
2349 break;2751 break;
2350 2752
2351#ifdef DHD_DEBUG2753#ifdef BCMDBG
2352 case IOV_GVAL(IOV_VARS):2754 case IOV_GVAL(IOV_VARS):
2353 if (bus->varsz < (uint) len)2755 if (bus->varsz < (uint) len)
2354 memcpy(arg, bus->vars, bus->varsz);2756 memcpy(arg, bus->vars, bus->varsz);
2355 else2757 else
2356 bcmerror = -EOVERFLOW;2758 bcmerror = -EOVERFLOW;
2357 break;2759 break;
2358#endif /* DHD_DEBUG */2760#endif /* BCMDBG */
2761
2762#ifdef BCMDBG
2763 case IOV_GVAL(IOV_DCONSOLE_POLL):
2764 int_val = (s32) brcmf_console_ms;
2765 memcpy(arg, &int_val, val_size);
2766 break;
2767
2768 case IOV_SVAL(IOV_DCONSOLE_POLL):
2769 brcmf_console_ms = (uint) int_val;
2770 break;
2771
2772 case IOV_SVAL(IOV_CONS):
2773 if (len > 0)
2774 bcmerror = brcmf_sdbrcm_bus_console_in(bus->drvr,
2775 arg, len - 1);
2776 break;
2359 2777
2360#ifdef DHD_DEBUG
2361 case IOV_GVAL(IOV_SDREG):2778 case IOV_GVAL(IOV_SDREG):
2362 {2779 {
2363 sdreg_t *sd_ptr;2780 struct brcmf_sdreg *sd_ptr;
2364 u32 addr, size;2781 u32 addr, size;
2365 2782
2366 sd_ptr = (sdreg_t *) params;2783 sd_ptr = (struct brcmf_sdreg *) params;
2367 2784
2368 addr = (unsigned long)bus->regs + sd_ptr->offset;2785 addr = bus->ci->buscorebase + sd_ptr->offset;
2369 size = sd_ptr->func;2786 size = sd_ptr->func;
2370 int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size);2787 int_val = (s32) brcmf_sdcard_reg_read(bus->card, addr,
2371 if (bcmsdh_regfail(bus->sdh))2788 size);
2789 if (brcmf_sdcard_regfail(bus->card))
2372 bcmerror = -EIO;2790 bcmerror = -EIO;
2373 memcpy(arg, &int_val, sizeof(s32));2791 memcpy(arg, &int_val, sizeof(s32));
2374 break;2792 break;
@@ -2376,15 +2794,16 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 1 unmodified line
2376 2794
2377 case IOV_SVAL(IOV_SDREG):2795 case IOV_SVAL(IOV_SDREG):
2378 {2796 {
2379 sdreg_t *sd_ptr;2797 struct brcmf_sdreg *sd_ptr;
2380 u32 addr, size;2798 u32 addr, size;
2381 2799
2382 sd_ptr = (sdreg_t *) params;2800 sd_ptr = (struct brcmf_sdreg *) params;
2383 2801
2384 addr = (unsigned long)bus->regs + sd_ptr->offset;2802 addr = bus->ci->buscorebase + sd_ptr->offset;
2385 size = sd_ptr->func;2803 size = sd_ptr->func;
2386 bcmsdh_reg_write(bus->sdh, addr, size, sd_ptr->value);2804 brcmf_sdcard_reg_write(bus->card, addr, size,
2387 if (bcmsdh_regfail(bus->sdh))2805 sd_ptr->value);
2806 if (brcmf_sdcard_regfail(bus->card))
2388 bcmerror = -EIO;2807 bcmerror = -EIO;
2389 break;2808 break;
2390 }2809 }
@@ -2393,15 +2812,16 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
2393 (not SDIO core) */2812 (not SDIO core) */
2394 case IOV_GVAL(IOV_SBREG):2813 case IOV_GVAL(IOV_SBREG):
2395 {2814 {
2396 sdreg_t sdreg;2815 struct brcmf_sdreg sdreg;
2397 u32 addr, size;2816 u32 addr, size;
2398 2817
2399 memcpy(&sdreg, params, sizeof(sdreg));2818 memcpy(&sdreg, params, sizeof(sdreg));
2400 2819
2401 addr = SI_ENUM_BASE + sdreg.offset;2820 addr = SI_ENUM_BASE + sdreg.offset;
2402 size = sdreg.func;2821 size = sdreg.func;
2403 int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size);2822 int_val = (s32) brcmf_sdcard_reg_read(bus->card, addr,
2404 if (bcmsdh_regfail(bus->sdh))2823 size);
2824 if (brcmf_sdcard_regfail(bus->card))
2405 bcmerror = -EIO;2825 bcmerror = -EIO;
2406 memcpy(arg, &int_val, sizeof(s32));2826 memcpy(arg, &int_val, sizeof(s32));
2407 break;2827 break;
@@ -2409,15 +2829,16 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 1 unmodified line
2409 2829
2410 case IOV_SVAL(IOV_SBREG):2830 case IOV_SVAL(IOV_SBREG):
2411 {2831 {
2412 sdreg_t sdreg;2832 struct brcmf_sdreg sdreg;
2413 u32 addr, size;2833 u32 addr, size;
2414 2834
2415 memcpy(&sdreg, params, sizeof(sdreg));2835 memcpy(&sdreg, params, sizeof(sdreg));
2416 2836
2417 addr = SI_ENUM_BASE + sdreg.offset;2837 addr = SI_ENUM_BASE + sdreg.offset;
2418 size = sdreg.func;2838 size = sdreg.func;
2419 bcmsdh_reg_write(bus->sdh, addr, size, sdreg.value);2839 brcmf_sdcard_reg_write(bus->card, addr, size,
2420 if (bcmsdh_regfail(bus->sdh))2840 sdreg.value);
2841 if (brcmf_sdcard_regfail(bus->card))
2421 bcmerror = -EIO;2842 bcmerror = -EIO;
2422 break;2843 break;
2423 }2844 }
@@ -2427,15 +2848,15 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines
2427 *(char *)arg = 0;2848 *(char *)arg = 0;
2428 2849
2429 strcat(arg, "\nFunc 0\n");2850 strcat(arg, "\nFunc 0\n");
2430 bcmsdh_cis_read(bus->sdh, 0x10,2851 brcmf_sdcard_cis_read(bus->card, 0x10,
2431 (u8 *) arg + strlen(arg),2852 (u8 *) arg + strlen(arg),
2432 SBSDIO_CIS_SIZE_LIMIT);2853 SBSDIO_CIS_SIZE_LIMIT);
2433 strcat(arg, "\nFunc 1\n");2854 strcat(arg, "\nFunc 1\n");
2434 bcmsdh_cis_read(bus->sdh, 0x11,2855 brcmf_sdcard_cis_read(bus->card, 0x11,
2435 (u8 *) arg + strlen(arg),2856 (u8 *) arg + strlen(arg),
2436 SBSDIO_CIS_SIZE_LIMIT);2857 SBSDIO_CIS_SIZE_LIMIT);
2437 strcat(arg, "\nFunc 2\n");2858 strcat(arg, "\nFunc 2\n");
2438 bcmsdh_cis_read(bus->sdh, 0x12,2859 brcmf_sdcard_cis_read(bus->card, 0x12,
2439 (u8 *) arg + strlen(arg),2860 (u8 *) arg + strlen(arg),
2440 SBSDIO_CIS_SIZE_LIMIT);2861 SBSDIO_CIS_SIZE_LIMIT);
2441 break;2862 break;
@@ -2451,32 +2872,32 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 9 unmodified lines
2451 break;2872 break;
2452 2873
2453 case IOV_GVAL(IOV_TXBOUND):2874 case IOV_GVAL(IOV_TXBOUND):
2454 int_val = (s32) dhd_txbound;2875 int_val = (s32) brcmf_txbound;
2455 memcpy(arg, &int_val, val_size);2876 memcpy(arg, &int_val, val_size);
2456 break;2877 break;
2457 2878
2458 case IOV_SVAL(IOV_TXBOUND):2879 case IOV_SVAL(IOV_TXBOUND):
2459 dhd_txbound = (uint) int_val;2880 brcmf_txbound = (uint) int_val;
2460 break;2881 break;
2461 2882
2462 case IOV_GVAL(IOV_RXBOUND):2883 case IOV_GVAL(IOV_RXBOUND):
2463 int_val = (s32) dhd_rxbound;2884 int_val = (s32) brcmf_rxbound;
2464 memcpy(arg, &int_val, val_size);2885 memcpy(arg, &int_val, val_size);
2465 break;2886 break;
2466 2887
2467 case IOV_SVAL(IOV_RXBOUND):2888 case IOV_SVAL(IOV_RXBOUND):
2468 dhd_rxbound = (uint) int_val;2889 brcmf_rxbound = (uint) int_val;
2469 break;2890 break;
2470 2891
2471 case IOV_GVAL(IOV_TXMINMAX):2892 case IOV_GVAL(IOV_TXMINMAX):
2472 int_val = (s32) dhd_txminmax;2893 int_val = (s32) brcmf_txminmax;
2473 memcpy(arg, &int_val, val_size);2894 memcpy(arg, &int_val, val_size);
2474 break;2895 break;
2475 2896
2476 case IOV_SVAL(IOV_TXMINMAX):2897 case IOV_SVAL(IOV_TXMINMAX):
2477 dhd_txminmax = (uint) int_val;2898 brcmf_txminmax = (uint) int_val;
2478 break;2899 break;
2479#endif /* DHD_DEBUG */2900#endif /* BCMDBG */
2480 2901
2481#ifdef SDTEST2902#ifdef SDTEST
2482 case IOV_GVAL(IOV_EXTLOOP):2903 case IOV_GVAL(IOV_EXTLOOP):
@@ -2489,31 +2910,44 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 6 unmodified lines
2489 break;2910 break;
2490 2911
2491 case IOV_GVAL(IOV_PKTGEN):2912 case IOV_GVAL(IOV_PKTGEN):
2492 bcmerror = dhdsdio_pktgen_get(bus, arg);2913 bcmerror = brcmf_sdbrcm_pktgen_get(bus, arg);
2493 break;2914 break;
2494 2915
2495 case IOV_SVAL(IOV_PKTGEN):2916 case IOV_SVAL(IOV_PKTGEN):
2496 bcmerror = dhdsdio_pktgen_set(bus, arg);2917 bcmerror = brcmf_sdbrcm_pktgen_set(bus, arg);
2497 break;2918 break;
2498#endif /* SDTEST */2919#endif /* SDTEST */
2499 2920
2500 case IOV_SVAL(IOV_DEVRESET):2921 case IOV_SVAL(IOV_DEVRESET):
2501 DHD_TRACE(("%s: Called set IOV_DEVRESET=%d dongle_reset=%d "2922 BRCMF_TRACE(("%s: Called set IOV_DEVRESET=%d dongle_reset=%d "
2502 "busstate=%d\n",2923 "busstate=%d\n",
2503 __func__, bool_val, bus->dhd->dongle_reset,2924 __func__, bool_val, bus->drvr->dongle_reset,
2504 bus->dhd->busstate));2925 bus->drvr->busstate));
2505 2926
2506 dhd_bus_devreset(bus->dhd, (u8) bool_val);2927 brcmf_bus_devreset(bus->drvr, (u8) bool_val);
2507 2928
2508 break;2929 break;
2509 2930
2510 case IOV_GVAL(IOV_DEVRESET):2931 case IOV_GVAL(IOV_DEVRESET):
2511 DHD_TRACE(("%s: Called get IOV_DEVRESET\n", __func__));2932 BRCMF_TRACE(("%s: Called get IOV_DEVRESET\n", __func__));
2512 2933
2513 /* Get its status */2934 /* Get its status */
2514 int_val = (bool) bus->dhd->dongle_reset;2935 int_val = (bool) bus->drvr->dongle_reset;
2936 memcpy(arg, &int_val, val_size);
2937
2938 break;
2939
2940 case IOV_GVAL(IOV_WDTICK):
2941 int_val = (s32) brcmf_watchdog_ms;
2515 memcpy(arg, &int_val, val_size);2942 memcpy(arg, &int_val, val_size);
2943 break;
2516 2944
2945 case IOV_SVAL(IOV_WDTICK):
2946 if (!bus->drvr->up) {
2947 bcmerror = -ENOLINK;
2948 break;
2949 }
2950 brcmf_sdbrcm_wd_timer(bus, (uint) int_val);
2517 break;2951 break;
2518 2952
2519 default:2953 default:
@@ -2522,29 +2956,29 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
2522 }2956 }
2523 2957
2524exit:2958exit:
2525 if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) {2959 if ((bus->idletime == BRCMF_IDLE_IMMEDIATE) && !bus->dpc_sched) {
2526 bus->activity = false;2960 bus->activity = false;
2527 dhdsdio_clkctl(bus, CLK_NONE, true);2961 brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
2528 }2962 }
2529 2963
2530 dhd_os_sdunlock(bus->dhd);2964 brcmf_sdbrcm_sdunlock(bus);
2531 2965
2532 if (actionid == IOV_SVAL(IOV_DEVRESET) && bool_val == false)2966 if (actionid == IOV_SVAL(IOV_DEVRESET) && bool_val == false)
2533 dhd_preinit_ioctls((dhd_pub_t *) bus->dhd);2967 brcmf_c_preinit_ioctls(bus->drvr);
2534 2968
2535 return bcmerror;2969 return bcmerror;
2536}2970}
2537 2971
2538static int dhdsdio_write_vars(dhd_bus_t *bus)2972static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
2539{2973{
2540 int bcmerror = 0;2974 int bcmerror = 0;
2541 u32 varsize;2975 u32 varsize;
2542 u32 varaddr;2976 u32 varaddr;
2543 u8 *vbuffer;2977 u8 *vbuffer;
2544 u32 varsizew;2978 u32 varsizew;
2545#ifdef DHD_DEBUG2979#ifdef BCMDBG
2546 char *nvram_ularray;2980 char *nvram_ularray;
2547#endif /* DHD_DEBUG */2981#endif /* BCMDBG */
2548 2982
2549 /* Even if there are no vars are to be written, we still2983 /* Even if there are no vars are to be written, we still
2550 need to set the ramsize. */2984 need to set the ramsize. */
@@ -2560,10 +2994,10 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) · 9 unmodified lines
2560 2994
2561 /* Write the vars list */2995 /* Write the vars list */
2562 bcmerror =2996 bcmerror =
2563 dhdsdio_membytes(bus, true, varaddr, vbuffer, varsize);2997 brcmf_sdbrcm_membytes(bus, true, varaddr, vbuffer, varsize);
2564#ifdef DHD_DEBUG2998#ifdef BCMDBG
2565 /* Verify NVRAM bytes */2999 /* Verify NVRAM bytes */
2566 DHD_INFO(("Compare NVRAM dl & ul; varsize=%d\n", varsize));3000 BRCMF_INFO(("Compare NVRAM dl & ul; varsize=%d\n", varsize));
2567 nvram_ularray = kmalloc(varsize, GFP_ATOMIC);3001 nvram_ularray = kmalloc(varsize, GFP_ATOMIC);
2568 if (!nvram_ularray)3002 if (!nvram_ularray)
2569 return -ENOMEM;3003 return -ENOMEM;
@@ -2573,30 +3007,31 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) · 3 unmodified lines
2573 3007
2574 /* Read the vars list to temp buffer for comparison */3008 /* Read the vars list to temp buffer for comparison */
2575 bcmerror =3009 bcmerror =
2576 dhdsdio_membytes(bus, false, varaddr, nvram_ularray,3010 brcmf_sdbrcm_membytes(bus, false, varaddr, nvram_ularray,
2577 varsize);3011 varsize);
2578 if (bcmerror) {3012 if (bcmerror) {
2579 DHD_ERROR(("%s: error %d on reading %d nvram bytes at "3013 BRCMF_ERROR(("%s: error %d on reading %d nvram bytes"
2580 "0x%08x\n", __func__, bcmerror, varsize, varaddr));3014 " at 0x%08x\n", __func__, bcmerror,
3015 varsize, varaddr));
2581 }3016 }
2582 /* Compare the org NVRAM with the one read from RAM */3017 /* Compare the org NVRAM with the one read from RAM */
2583 if (memcmp(vbuffer, nvram_ularray, varsize)) {3018 if (memcmp(vbuffer, nvram_ularray, varsize)) {
2584 DHD_ERROR(("%s: Downloaded NVRAM image is corrupted.\n",3019 BRCMF_ERROR(("%s: Downloaded NVRAM image is "
2585 __func__));3020 "corrupted.\n", __func__));
2586 } else3021 } else
2587 DHD_ERROR(("%s: Download/Upload/Compare of NVRAM ok.\n",3022 BRCMF_ERROR(("%s: Download/Upload/Compare of"
2588 __func__));3023 " NVRAM ok.\n", __func__));
2589 3024
2590 kfree(nvram_ularray);3025 kfree(nvram_ularray);
2591#endif /* DHD_DEBUG */3026#endif /* BCMDBG */
2592 3027
2593 kfree(vbuffer);3028 kfree(vbuffer);
2594 }3029 }
2595 3030
2596 /* adjust to the user specified RAM */3031 /* adjust to the user specified RAM */
2597 DHD_INFO(("Physical memory size: %d, usable memory size: %d\n",3032 BRCMF_INFO(("Physical memory size: %d, usable memory size: %d\n",
2598 bus->orig_ramsize, bus->ramsize));3033 bus->orig_ramsize, bus->ramsize));
2599 DHD_INFO(("Vars are at %d, orig varsize is %d\n", varaddr, varsize));3034 BRCMF_INFO(("Vars are at %d, orig varsize is %d\n", varaddr, varsize));
2600 varsize = ((bus->orig_ramsize - 4) - varaddr);3035 varsize = ((bus->orig_ramsize - 4) - varaddr);
2601 3036
2602 /*3037 /*
@@ -2612,17 +3047,17 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) · 9 unmodified lines
2612 varsizew = cpu_to_le32(varsizew);3047 varsizew = cpu_to_le32(varsizew);
2613 }3048 }
2614 3049
2615 DHD_INFO(("New varsize is %d, length token=0x%08x\n", varsize,3050 BRCMF_INFO(("New varsize is %d, length token=0x%08x\n", varsize,
2616 varsizew));3051 varsizew));
2617 3052
2618 /* Write the length token to the last word */3053 /* Write the length token to the last word */
2619 bcmerror = dhdsdio_membytes(bus, true, (bus->orig_ramsize - 4),3054 bcmerror = brcmf_sdbrcm_membytes(bus, true, (bus->orig_ramsize - 4),
2620 (u8 *)&varsizew, 4);3055 (u8 *)&varsizew, 4);
2621 3056
2622 return bcmerror;3057 return bcmerror;
2623}3058}
2624 3059
2625static int dhdsdio_download_state(dhd_bus_t *bus, bool enter)3060static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter)
2626{3061{
2627 uint retries;3062 uint retries;
2628 u32 regdata;3063 u32 regdata;
@@ -2634,139 +3069,114 @@ static int dhdsdio_download_state(dhd_bus_t *bus, bool enter) · 5 unmodified lines
2634 if (enter) {3069 if (enter) {
2635 bus->alp_only = true;3070 bus->alp_only = true;
2636 3071
2637 dhdsdio_chip_disablecore(bus->sdh, bus->ci->armcorebase);3072 brcmf_sdbrcm_chip_disablecore(bus->card, bus->ci->armcorebase);
2638 3073
2639 dhdsdio_chip_resetcore(bus->sdh, bus->ci->ramcorebase);3074 brcmf_sdbrcm_chip_resetcore(bus->card, bus->ci->ramcorebase);
2640 3075
2641 /* Clear the top bit of memory */3076 /* Clear the top bit of memory */
2642 if (bus->ramsize) {3077 if (bus->ramsize) {
2643 u32 zeros = 0;3078 u32 zeros = 0;
2644 dhdsdio_membytes(bus, true, bus->ramsize - 4,3079 brcmf_sdbrcm_membytes(bus, true, bus->ramsize - 4,
2645 (u8 *)&zeros, 4);3080 (u8 *)&zeros, 4);
2646 }3081 }
2647 } else {3082 } else {
2648 regdata = bcmsdh_reg_read(bus->sdh,3083 regdata = brcmf_sdcard_reg_read(bus->card,
2649 CORE_SB(bus->ci->ramcorebase, sbtmstatelow), 4);3084 CORE_SB(bus->ci->ramcorebase, sbtmstatelow), 4);
2650 regdata &= (SBTML_RESET | SBTML_REJ_MASK |3085 regdata &= (SBTML_RESET | SBTML_REJ_MASK |
2651 (SICF_CLOCK_EN << SBTML_SICF_SHIFT));3086 (SICF_CLOCK_EN << SBTML_SICF_SHIFT));
2652 if ((SICF_CLOCK_EN << SBTML_SICF_SHIFT) != regdata) {3087 if ((SICF_CLOCK_EN << SBTML_SICF_SHIFT) != regdata) {
2653 DHD_ERROR(("%s: SOCRAM core is down after reset?\n",3088 BRCMF_ERROR(("%s: SOCRAM core is down after reset?\n",
2654 __func__));3089 __func__));
2655 bcmerror = -EBADE;3090 bcmerror = -EBADE;
2656 goto fail;3091 goto fail;
2657 }3092 }
2658 3093
2659 bcmerror = dhdsdio_write_vars(bus);3094 bcmerror = brcmf_sdbrcm_write_vars(bus);
2660 if (bcmerror) {3095 if (bcmerror) {
2661 DHD_ERROR(("%s: no vars written to RAM\n", __func__));3096 BRCMF_ERROR(("%s: no vars written to RAM\n", __func__));
2662 bcmerror = 0;3097 bcmerror = 0;
2663 }3098 }
2664 3099
2665 W_SDREG(0xFFFFFFFF, &bus->regs->intstatus, retries);3100 w_sdreg32(bus, 0xFFFFFFFF,
3101 offsetof(struct sdpcmd_regs, intstatus), &retries);
2666 3102
2667 dhdsdio_chip_resetcore(bus->sdh, bus->ci->armcorebase);3103 brcmf_sdbrcm_chip_resetcore(bus->card, bus->ci->armcorebase);
2668 3104
2669 /* Allow HT Clock now that the ARM is running. */3105 /* Allow HT Clock now that the ARM is running. */
2670 bus->alp_only = false;3106 bus->alp_only = false;
2671 3107
2672 bus->dhd->busstate = DHD_BUS_LOAD;3108 bus->drvr->busstate = BRCMF_BUS_LOAD;
2673 }3109 }
2674fail:3110fail:
2675 return bcmerror;3111 return bcmerror;
2676}3112}
2677 3113
2678int3114int
2679dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name,3115brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name,
2680 void *params, int plen, void *arg, int len, bool set)3116 void *params, int plen, void *arg, int len, bool set)
2681{3117{
2682 dhd_bus_t *bus = dhdp->bus;3118 struct brcmf_bus *bus = drvr->bus;
2683 const bcm_iovar_t *vi = NULL;3119 const struct brcmu_iovar *vi = NULL;
2684 int bcmerror = 0;3120 int bcmerror = 0;
2685 int val_size;3121 int val_size;
2686 u32 actionid;3122 u32 actionid;
2687 3123
2688 DHD_TRACE(("%s: Enter\n", __func__));3124 BRCMF_TRACE(("%s: Enter\n", __func__));
2689 3125
2690 ASSERT(name);3126 if (name == NULL || len <= 0)
2691 ASSERT(len >= 0);3127 return -EINVAL;
2692 3128
2693 /* Get MUST have return space */3129 /* Set does not take qualifiers */
2694 ASSERT(set || (arg && len));3130 if (set && (params || plen))
3131 return -EINVAL;
2695 3132
2696 /* Set does NOT take qualifiers */3133 /* Get must have return space;*/
2697 ASSERT(!set || (!params && !plen));3134 if (!set && !(arg && len))
3135 return -EINVAL;
2698 3136
2699 /* Look up var locally; if not found pass to host driver */3137 /* Look up var locally; if not found pass to host driver */
2700 vi = bcm_iovar_lookup(dhdsdio_iovars, name);3138 vi = brcmu_iovar_lookup(brcmf_sdio_iovars, name);
2701 if (vi == NULL) {3139 if (vi == NULL) {
2702 dhd_os_sdlock(bus->dhd);3140 brcmf_sdbrcm_sdlock(bus);
2703 3141
2704 BUS_WAKE(bus);3142 BUS_WAKE(bus);
2705 3143
2706 /* Turn on clock in case SD command needs backplane */3144 /* Turn on clock in case SD command needs backplane */
2707 dhdsdio_clkctl(bus, CLK_AVAIL, false);3145 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
3146
3147 bcmerror = brcmf_sdcard_iovar_op(bus->card, name, params, plen,
3148 arg, len, set);
2708 3149
2709 bcmerror =
2710 bcmsdh_iovar_op(bus->sdh, name, params, plen, arg, len,
2711 set);
2712
2713 /* Check for bus configuration changes of interest */
2714
2715 /* If it was divisor change, read the new one */
2716 if (set && strcmp(name, "sd_divisor") == 0) {
2717 if (bcmsdh_iovar_op(bus->sdh, "sd_divisor", NULL, 0,
2718 &bus->sd_divisor, sizeof(s32),
2719 false) != 0) {
2720 bus->sd_divisor = -1;
2721 DHD_ERROR(("%s: fail on %s get\n", __func__,
2722 name));
2723 } else {
2724 DHD_INFO(("%s: noted %s update, value now %d\n",
2725 __func__, name, bus->sd_divisor));
2726 }
2727 }
2728 /* If it was a mode change, read the new one */
2729 if (set && strcmp(name, "sd_mode") == 0) {
2730 if (bcmsdh_iovar_op(bus->sdh, "sd_mode", NULL, 0,
2731 &bus->sd_mode, sizeof(s32),
2732 false) != 0) {
2733 bus->sd_mode = -1;
2734 DHD_ERROR(("%s: fail on %s get\n", __func__,
2735 name));
2736 } else {
2737 DHD_INFO(("%s: noted %s update, value now %d\n",
2738 __func__, name, bus->sd_mode));
2739 }
2740 }
2741 /* Similar check for blocksize change */3150 /* Similar check for blocksize change */
2742 if (set && strcmp(name, "sd_blocksize") == 0) {3151 if (set && strcmp(name, "sd_blocksize") == 0) {
2743 s32 fnum = 2;3152 s32 fnum = 2;
2744 if (bcmsdh_iovar_op3153 if (brcmf_sdcard_iovar_op
2745 (bus->sdh, "sd_blocksize", &fnum, sizeof(s32),3154 (bus->card, "sd_blocksize", &fnum, sizeof(s32),
2746 &bus->blocksize, sizeof(s32),3155 &bus->blocksize, sizeof(s32),
2747 false) != 0) {3156 false) != 0) {
2748 bus->blocksize = 0;3157 bus->blocksize = 0;
2749 DHD_ERROR(("%s: fail on %s get\n", __func__,3158 BRCMF_ERROR(("%s: fail on %s get\n", __func__,
2750 "sd_blocksize"));3159 "sd_blocksize"));
2751 } else {3160 } else {
2752 DHD_INFO(("%s: noted %s update, value now %d\n",3161 BRCMF_INFO(("%s: noted sd_blocksize update,"
2753 __func__, "sd_blocksize",3162 " value now %d\n", __func__,
2754 bus->blocksize));3163 bus->blocksize));
2755 }3164 }
2756 }3165 }
2757 bus->roundup = min(max_roundup, bus->blocksize);3166 bus->roundup = min(max_roundup, bus->blocksize);
2758 3167
2759 if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) {3168 if (bus->idletime == BRCMF_IDLE_IMMEDIATE &&
3169 !bus->dpc_sched) {
2760 bus->activity = false;3170 bus->activity = false;
2761 dhdsdio_clkctl(bus, CLK_NONE, true);3171 brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
2762 }3172 }
2763 3173
2764 dhd_os_sdunlock(bus->dhd);3174 brcmf_sdbrcm_sdunlock(bus);
2765 goto exit;3175 goto exit;
2766 }3176 }
2767 3177
2768 DHD_CTL(("%s: %s %s, len %d plen %d\n", __func__,3178 BRCMF_CTL(("%s: %s %s, len %d plen %d\n", __func__,
2769 name, (set ? "set" : "get"), len, plen));3179 name, (set ? "set" : "get"), len, plen));
2770 3180
2771 /* set up 'params' pointer in case this is a set command so that3181 /* set up 'params' pointer in case this is a set command so that
2772 * the convenience int and bool code can be common to set and get3182 * the convenience int and bool code can be common to set and get
@@ -2785,168 +3195,188 @@ dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name, · 12 unmodified lines
2785 val_size = sizeof(int);3195 val_size = sizeof(int);
2786 3196
2787 actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);3197 actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
2788 bcmerror =3198 bcmerror = brcmf_sdbrcm_doiovar(bus, vi, actionid, name, params, plen,
2789 dhdsdio_doiovar(bus, vi, actionid, name, params, plen, arg, len,3199 arg, len, val_size);
2790 val_size);
2791 3200
2792exit:3201exit:
2793 return bcmerror;3202 return bcmerror;
2794}3203}
2795 3204
2796void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex)3205void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex)
2797{3206{
2798 u32 local_hostintmask;3207 u32 local_hostintmask;
2799 u8 saveclk;3208 u8 saveclk;
2800 uint retries;3209 uint retries;
2801 int err;3210 int err;
2802 3211
2803 DHD_TRACE(("%s: Enter\n", __func__));3212 BRCMF_TRACE(("%s: Enter\n", __func__));
2804 3213
2805 if (enforce_mutex)3214 if (enforce_mutex)
2806 dhd_os_sdlock(bus->dhd);3215 brcmf_sdbrcm_sdlock(bus);
2807 3216
2808 BUS_WAKE(bus);3217 BUS_WAKE(bus);
2809 3218
2810 /* Enable clock for device interrupts */3219 /* Enable clock for device interrupts */
2811 dhdsdio_clkctl(bus, CLK_AVAIL, false);3220 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
3221
3222 if (bus->watchdog_tsk) {
3223 send_sig(SIGTERM, bus->watchdog_tsk, 1);
3224 kthread_stop(bus->watchdog_tsk);
3225 bus->watchdog_tsk = NULL;
3226 }
3227
3228 if (bus->dpc_tsk) {
3229 send_sig(SIGTERM, bus->dpc_tsk, 1);
3230 kthread_stop(bus->dpc_tsk);
3231 bus->dpc_tsk = NULL;
3232 } else
3233 tasklet_kill(&bus->tasklet);
2812 3234
2813 /* Disable and clear interrupts at the chip level also */3235 /* Disable and clear interrupts at the chip level also */
2814 W_SDREG(0, &bus->regs->hostintmask, retries);3236 w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, hostintmask), &retries);
2815 local_hostintmask = bus->hostintmask;3237 local_hostintmask = bus->hostintmask;
2816 bus->hostintmask = 0;3238 bus->hostintmask = 0;
2817 3239
2818 /* Change our idea of bus state */3240 /* Change our idea of bus state */
2819 bus->dhd->busstate = DHD_BUS_DOWN;3241 bus->drvr->busstate = BRCMF_BUS_DOWN;
2820 3242
2821 /* Force clocks on backplane to be sure F2 interrupt propagates */3243 /* Force clocks on backplane to be sure F2 interrupt propagates */
2822 saveclk =3244 saveclk = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1,
2823 bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,3245 SBSDIO_FUNC1_CHIPCLKCSR, &err);
2824 &err);
2825 if (!err) {3246 if (!err) {
2826 bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,3247 brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
2827 (saveclk | SBSDIO_FORCE_HT), &err);3248 SBSDIO_FUNC1_CHIPCLKCSR,
3249 (saveclk | SBSDIO_FORCE_HT), &err);
2828 }3250 }
2829 if (err) {3251 if (err) {
2830 DHD_ERROR(("%s: Failed to force clock for F2: err %d\n",3252 BRCMF_ERROR(("%s: Failed to force clock for F2: err %d\n",
2831 __func__, err));3253 __func__, err));
2832 }3254 }
2833 3255
2834 /* Turn off the bus (F2), free any pending packets */3256 /* Turn off the bus (F2), free any pending packets */
2835 DHD_INTR(("%s: disable SDIO interrupts\n", __func__));3257 BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__));
2836 bcmsdh_intr_disable(bus->sdh);3258 brcmf_sdcard_intr_disable(bus->card);
2837 bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN,3259 brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx,
2838 SDIO_FUNC_ENABLE_1, NULL);3260 SDIO_FUNC_ENABLE_1, NULL);
2839 3261
2840 /* Clear any pending interrupts now that F2 is disabled */3262 /* Clear any pending interrupts now that F2 is disabled */
2841 W_SDREG(local_hostintmask, &bus->regs->intstatus, retries);3263 w_sdreg32(bus, local_hostintmask,
3264 offsetof(struct sdpcmd_regs, intstatus), &retries);
2842 3265
2843 /* Turn off the backplane clock (only) */3266 /* Turn off the backplane clock (only) */
2844 dhdsdio_clkctl(bus, CLK_SDONLY, false);3267 brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false);
2845 3268
2846 /* Clear the data packet queues */3269 /* Clear the data packet queues */
2847 bcm_pktq_flush(&bus->txq, true, NULL, NULL);3270 brcmu_pktq_flush(&bus->txq, true, NULL, NULL);
2848 3271
2849 /* Clear any held glomming stuff */3272 /* Clear any held glomming stuff */
2850 if (bus->glomd)3273 if (bus->glomd)
2851 bcm_pkt_buf_free_skb(bus->glomd);3274 brcmu_pkt_buf_free_skb(bus->glomd);
2852 3275
2853 if (bus->glom)3276 if (bus->glom)
2854 bcm_pkt_buf_free_skb(bus->glom);3277 brcmu_pkt_buf_free_skb(bus->glom);
2855 3278
2856 bus->glom = bus->glomd = NULL;3279 bus->glom = bus->glomd = NULL;
2857 3280
2858 /* Clear rx control and wake any waiters */3281 /* Clear rx control and wake any waiters */
2859 bus->rxlen = 0;3282 bus->rxlen = 0;
2860 dhd_os_ioctl_resp_wake(bus->dhd);3283 brcmf_os_ioctl_resp_wake(bus->drvr);
2861 3284
2862 /* Reset some F2 state stuff */3285 /* Reset some F2 state stuff */
2863 bus->rxskip = false;3286 bus->rxskip = false;
2864 bus->tx_seq = bus->rx_seq = 0;3287 bus->tx_seq = bus->rx_seq = 0;
2865 3288
2866 if (enforce_mutex)3289 if (enforce_mutex)
2867 dhd_os_sdunlock(bus->dhd);3290 brcmf_sdbrcm_sdunlock(bus);
2868}3291}
2869 3292
2870int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)3293int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
2871{3294{
2872 dhd_bus_t *bus = dhdp->bus;3295 struct brcmf_bus *bus = drvr->bus;
2873 dhd_timeout_t tmo;3296 struct brcmf_timeout tmo;
2874 uint retries = 0;3297 uint retries = 0;
2875 u8 ready, enable;3298 u8 ready, enable;
2876 int err, ret = 0;3299 int err, ret = 0;
2877 u8 saveclk;3300 u8 saveclk;
2878 3301
2879 DHD_TRACE(("%s: Enter\n", __func__));3302 BRCMF_TRACE(("%s: Enter\n", __func__));
3303
3304 /* try to download image and nvram to the dongle */
3305 if (drvr->busstate == BRCMF_BUS_DOWN) {
3306 if (!(brcmf_sdbrcm_download_firmware(bus, bus->card)))
3307 return -1;
3308 }
2880 3309
2881 ASSERT(bus->dhd);3310 if (!bus->drvr)
2882 if (!bus->dhd)
2883 return 0;3311 return 0;
2884 3312
3313 /* Start the watchdog timer */
3314 bus->drvr->tickcnt = 0;
3315 brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
3316
2885 if (enforce_mutex)3317 if (enforce_mutex)
2886 dhd_os_sdlock(bus->dhd);3318 brcmf_sdbrcm_sdlock(bus);
2887 3319
2888 /* Make sure backplane clock is on, needed to generate F2 interrupt */3320 /* Make sure backplane clock is on, needed to generate F2 interrupt */
2889 dhdsdio_clkctl(bus, CLK_AVAIL, false);3321 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
2890 if (bus->clkstate != CLK_AVAIL)3322 if (bus->clkstate != CLK_AVAIL)
2891 goto exit;3323 goto exit;
2892 3324
2893 /* Force clocks on backplane to be sure F2 interrupt propagates */3325 /* Force clocks on backplane to be sure F2 interrupt propagates */
2894 saveclk =3326 saveclk =
2895 bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,3327 brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1,
2896 &err);3328 SBSDIO_FUNC1_CHIPCLKCSR, &err);
2897 if (!err) {3329 if (!err) {
2898 bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,3330 brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
2899 (saveclk | SBSDIO_FORCE_HT), &err);3331 SBSDIO_FUNC1_CHIPCLKCSR,
3332 (saveclk | SBSDIO_FORCE_HT), &err);
2900 }3333 }
2901 if (err) {3334 if (err) {
2902 DHD_ERROR(("%s: Failed to force clock for F2: err %d\n",3335 BRCMF_ERROR(("%s: Failed to force clock for F2: err %d\n",
2903 __func__, err));3336 __func__, err));
2904 goto exit;3337 goto exit;
2905 }3338 }
2906 3339
2907 /* Enable function 2 (frame transfers) */3340 /* Enable function 2 (frame transfers) */
2908 W_SDREG((SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT),3341 w_sdreg32(bus, SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT,
2909 &bus->regs->tosbmailboxdata, retries);3342 offsetof(struct sdpcmd_regs, tosbmailboxdata), &retries);
2910 enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2);3343 enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2);
2911 3344
2912 bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, enable, NULL);3345 brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx, enable,
3346 NULL);
2913 3347
2914 /* Give the dongle some time to do its thing and set IOR2 */3348 /* Give the dongle some time to do its thing and set IOR2 */
2915 dhd_timeout_start(&tmo, DHD_WAIT_F2RDY * 1000);3349 brcmf_timeout_start(&tmo, BRCMF_WAIT_F2RDY * 1000);
2916 3350
2917 ready = 0;3351 ready = 0;
2918 while (ready != enable && !dhd_timeout_expired(&tmo))3352 while (ready != enable && !brcmf_timeout_expired(&tmo))
2919 ready =3353 ready = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_0,
2920 bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IORDY,3354 SDIO_CCCR_IORx, NULL);
2921 NULL);
2922 3355
2923 DHD_INFO(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n",3356 BRCMF_INFO(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n",
2924 __func__, enable, ready, tmo.elapsed));3357 __func__, enable, ready, tmo.elapsed));
2925 3358
2926 /* If F2 successfully enabled, set core and enable interrupts */3359 /* If F2 successfully enabled, set core and enable interrupts */
2927 if (ready == enable) {3360 if (ready == enable) {
2928 /* Set up the interrupt mask and enable interrupts */3361 /* Set up the interrupt mask and enable interrupts */
2929 bus->hostintmask = HOSTINTMASK;3362 bus->hostintmask = HOSTINTMASK;
2930 W_SDREG(bus->hostintmask,3363 w_sdreg32(bus, bus->hostintmask,
2931 (unsigned int *)CORE_BUS_REG(bus->ci->buscorebase,3364 offsetof(struct sdpcmd_regs, hostintmask), &retries);
2932 hostintmask), retries);
2933 3365
2934 bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_WATERMARK,3366 brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_WATERMARK,
2935 (u8) watermark, &err);3367 (u8) watermark, &err);
2936 3368
2937 /* Set bus state according to enable result */3369 /* Set bus state according to enable result */
2938 dhdp->busstate = DHD_BUS_DATA;3370 drvr->busstate = BRCMF_BUS_DATA;
2939
2940 /* bcmsdh_intr_unmask(bus->sdh); */
2941 3371
2942 bus->intdis = false;3372 bus->intdis = false;
2943 if (bus->intr) {3373 if (bus->intr) {
2944 DHD_INTR(("%s: enable SDIO device interrupts\n",3374 BRCMF_INTR(("%s: enable SDIO device interrupts\n",
2945 __func__));3375 __func__));
2946 bcmsdh_intr_enable(bus->sdh);3376 brcmf_sdcard_intr_enable(bus->card);
2947 } else {3377 } else {
2948 DHD_INTR(("%s: disable SDIO interrupts\n", __func__));3378 BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__));
2949 bcmsdh_intr_disable(bus->sdh);3379 brcmf_sdcard_intr_disable(bus->card);
2950 }3380 }
2951 3381
2952 }3382 }
@@ -2954,75 +3384,90 @@ int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex) · 1 unmodified line
2954 else {3384 else {
2955 /* Disable F2 again */3385 /* Disable F2 again */
2956 enable = SDIO_FUNC_ENABLE_1;3386 enable = SDIO_FUNC_ENABLE_1;
2957 bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, enable,3387 brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx,
2958 NULL);3388 enable, NULL);
2959 }3389 }
2960 3390
2961 /* Restore previous clock setting */3391 /* Restore previous clock setting */
2962 bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,3392 brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
2963 saveclk, &err);3393 saveclk, &err);
2964 3394
3395#if defined(OOB_INTR_ONLY)
3396 /* Host registration for OOB interrupt */
3397 if (brcmf_sdio_register_oob_intr(bus->dhd)) {
3398 brcmf_sdbrcm_wd_timer(bus, 0);
3399 BRCMF_ERROR(("%s Host failed to resgister for OOB\n",
3400 __func__));
3401 ret = -ENODEV;
3402 goto exit;
3403 }
3404
3405 /* Enable oob at firmware */
3406 brcmf_sdbrcm_enable_oob_intr(bus, true);
3407#endif /* defined(OOB_INTR_ONLY) */
3408
2965 /* If we didn't come up, turn off backplane clock */3409 /* If we didn't come up, turn off backplane clock */
2966 if (dhdp->busstate != DHD_BUS_DATA)3410 if (drvr->busstate != BRCMF_BUS_DATA)
2967 dhdsdio_clkctl(bus, CLK_NONE, false);3411 brcmf_sdbrcm_clkctl(bus, CLK_NONE, false);
2968 3412
2969exit:3413exit:
2970 if (enforce_mutex)3414 if (enforce_mutex)
2971 dhd_os_sdunlock(bus->dhd);3415 brcmf_sdbrcm_sdunlock(bus);
2972 3416
2973 return ret;3417 return ret;
2974}3418}
2975 3419
2976static void dhdsdio_rxfail(dhd_bus_t *bus, bool abort, bool rtx)3420static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx)
2977{3421{
2978 bcmsdh_info_t *sdh = bus->sdh;3422 struct brcmf_sdio_card *card = bus->card;
2979 sdpcmd_regs_t *regs = bus->regs;
2980 uint retries = 0;3423 uint retries = 0;
2981 u16 lastrbc;3424 u16 lastrbc;
2982 u8 hi, lo;3425 u8 hi, lo;
2983 int err;3426 int err;
2984 3427
2985 DHD_ERROR(("%s: %sterminate frame%s\n", __func__,3428 BRCMF_ERROR(("%s: %sterminate frame%s\n", __func__,
2986 (abort ? "abort command, " : ""),3429 (abort ? "abort command, " : ""),
2987 (rtx ? ", send NAK" : "")));3430 (rtx ? ", send NAK" : "")));
2988 3431
2989 if (abort)3432 if (abort)
2990 bcmsdh_abort(sdh, SDIO_FUNC_2);3433 brcmf_sdcard_abort(card, SDIO_FUNC_2);
2991 3434
2992 bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL, SFC_RF_TERM,3435 brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL,
2993 &err);3436 SFC_RF_TERM, &err);
2994 bus->f1regdata++;3437 bus->f1regdata++;
2995 3438
2996 /* Wait until the packet has been flushed (device/FIFO stable) */3439 /* Wait until the packet has been flushed (device/FIFO stable) */
2997 for (lastrbc = retries = 0xffff; retries > 0; retries--) {3440 for (lastrbc = retries = 0xffff; retries > 0; retries--) {
2998 hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCHI,3441 hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
2999 NULL);3442 SBSDIO_FUNC1_RFRAMEBCHI, NULL);
3000 lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCLO,3443 lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
3001 NULL);3444 SBSDIO_FUNC1_RFRAMEBCLO, NULL);
3002 bus->f1regdata += 2;3445 bus->f1regdata += 2;
3003 3446
3004 if ((hi == 0) && (lo == 0))3447 if ((hi == 0) && (lo == 0))
3005 break;3448 break;
3006 3449
3007 if ((hi > (lastrbc >> 8)) && (lo > (lastrbc & 0x00ff))) {3450 if ((hi > (lastrbc >> 8)) && (lo > (lastrbc & 0x00ff))) {
3008 DHD_ERROR(("%s: count growing: last 0x%04x now "3451 BRCMF_ERROR(("%s: count growing: last 0x%04x now "
3009 "0x%04x\n",3452 "0x%04x\n",
3010 __func__, lastrbc, ((hi << 8) + lo)));3453 __func__, lastrbc, ((hi << 8) + lo)));
3011 }3454 }
3012 lastrbc = (hi << 8) + lo;3455 lastrbc = (hi << 8) + lo;
3013 }3456 }
3014 3457
3015 if (!retries) {3458 if (!retries) {
3016 DHD_ERROR(("%s: count never zeroed: last 0x%04x\n",3459 BRCMF_ERROR(("%s: count never zeroed: last 0x%04x\n",
3017 __func__, lastrbc));3460 __func__, lastrbc));
3018 } else {3461 } else {
3019 DHD_INFO(("%s: flush took %d iterations\n", __func__,3462 BRCMF_INFO(("%s: flush took %d iterations\n", __func__,
3020 (0xffff - retries)));3463 (0xffff - retries)));
3021 }3464 }
3022 3465
3023 if (rtx) {3466 if (rtx) {
3024 bus->rxrtx++;3467 bus->rxrtx++;
3025 W_SDREG(SMB_NAK, &regs->tosbmailbox, retries);3468 w_sdreg32(bus, SMB_NAK,
3469 offsetof(struct sdpcmd_regs, tosbmailbox), &retries);
3470
3026 bus->f1regdata++;3471 bus->f1regdata++;
3027 if (retries <= retry_limit)3472 if (retries <= retry_limit)
3028 bus->rxskip = true;3473 bus->rxskip = true;
@@ -3032,35 +3477,33 @@ static void dhdsdio_rxfail(dhd_bus_t *bus, bool abort, bool rtx) · 3 unmodified lines
3032 bus->nextlen = 0;3477 bus->nextlen = 0;
3033 3478
3034 /* If we can't reach the device, signal failure */3479 /* If we can't reach the device, signal failure */
3035 if (err || bcmsdh_regfail(sdh))3480 if (err || brcmf_sdcard_regfail(card))
3036 bus->dhd->busstate = DHD_BUS_DOWN;3481 bus->drvr->busstate = BRCMF_BUS_DOWN;
3037}3482}
3038 3483
3039static void3484static void
3040dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff)3485brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)
3041{3486{
3042 bcmsdh_info_t *sdh = bus->sdh;3487 struct brcmf_sdio_card *card = bus->card;
3043 uint rdlen, pad;3488 uint rdlen, pad;
3044 3489
3045 int sdret;3490 int sdret;
3046 3491
3047 DHD_TRACE(("%s: Enter\n", __func__));3492 BRCMF_TRACE(("%s: Enter\n", __func__));
3048 3493
3049 /* Control data already received in aligned rxctl */3494 /* Control data already received in aligned rxctl */
3050 if ((bus->bus == SPI_BUS) && (!bus->usebufpool))3495 if ((bus->bus == SPI_BUS) && (!bus->usebufpool))
3051 goto gotpkt;3496 goto gotpkt;
3052 3497
3053 ASSERT(bus->rxbuf);
3054 /* Set rxctl for frame (w/optional alignment) */3498 /* Set rxctl for frame (w/optional alignment) */
3055 bus->rxctl = bus->rxbuf;3499 bus->rxctl = bus->rxbuf;
3056 if (dhd_alignctl) {3500 if (brcmf_alignctl) {
3057 bus->rxctl += firstread;3501 bus->rxctl += firstread;
3058 pad = ((unsigned long)bus->rxctl % DHD_SDALIGN);3502 pad = ((unsigned long)bus->rxctl % BRCMF_SDALIGN);
3059 if (pad)3503 if (pad)
3060 bus->rxctl += (DHD_SDALIGN - pad);3504 bus->rxctl += (BRCMF_SDALIGN - pad);
3061 bus->rxctl -= firstread;3505 bus->rxctl -= firstread;
3062 }3506 }
3063 ASSERT(bus->rxctl >= bus->rxbuf);
3064 3507
3065 /* Copy the already-read portion over */3508 /* Copy the already-read portion over */
3066 memcpy(bus->rxctl, hdr, firstread);3509 memcpy(bus->rxctl, hdr, firstread);
@@ -3078,10 +3521,10 @@ dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) · 11 unmodified lines
3078 if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) {3521 if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) {
3079 pad = bus->blocksize - (rdlen % bus->blocksize);3522 pad = bus->blocksize - (rdlen % bus->blocksize);
3080 if ((pad <= bus->roundup) && (pad < bus->blocksize) &&3523 if ((pad <= bus->roundup) && (pad < bus->blocksize) &&
3081 ((len + pad) < bus->dhd->maxctl))3524 ((len + pad) < bus->drvr->maxctl))
3082 rdlen += pad;3525 rdlen += pad;
3083 } else if (rdlen % DHD_SDALIGN) {3526 } else if (rdlen % BRCMF_SDALIGN) {
3084 rdlen += DHD_SDALIGN - (rdlen % DHD_SDALIGN);3527 rdlen += BRCMF_SDALIGN - (rdlen % BRCMF_SDALIGN);
3085 }3528 }
3086 3529
3087 /* Satisfy length-alignment requirements */3530 /* Satisfy length-alignment requirements */
@@ -3089,44 +3532,44 @@ dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) · 1 unmodified line
3089 rdlen = roundup(rdlen, ALIGNMENT);3532 rdlen = roundup(rdlen, ALIGNMENT);
3090 3533
3091 /* Drop if the read is too big or it exceeds our maximum */3534 /* Drop if the read is too big or it exceeds our maximum */
3092 if ((rdlen + firstread) > bus->dhd->maxctl) {3535 if ((rdlen + firstread) > bus->drvr->maxctl) {
3093 DHD_ERROR(("%s: %d-byte control read exceeds %d-byte buffer\n",3536 BRCMF_ERROR(("%s: %d-byte control read exceeds %d-byte"
3094 __func__, rdlen, bus->dhd->maxctl));3537 " buffer\n", __func__, rdlen, bus->drvr->maxctl));
3095 bus->dhd->rx_errors++;3538 bus->drvr->rx_errors++;
3096 dhdsdio_rxfail(bus, false, false);3539 brcmf_sdbrcm_rxfail(bus, false, false);
3097 goto done;3540 goto done;
3098 }3541 }
3099 3542
3100 if ((len - doff) > bus->dhd->maxctl) {3543 if ((len - doff) > bus->drvr->maxctl) {
3101 DHD_ERROR(("%s: %d-byte ctl frame (%d-byte ctl data) exceeds "3544 BRCMF_ERROR(("%s: %d-byte ctl frame (%d-byte ctl data) exceeds "
3102 "%d-byte limit\n",3545 "%d-byte limit\n",
3103 __func__, len, (len - doff), bus->dhd->maxctl));3546 __func__, len, (len - doff), bus->drvr->maxctl));
3104 bus->dhd->rx_errors++;3547 bus->drvr->rx_errors++;
3105 bus->rx_toolong++;3548 bus->rx_toolong++;
3106 dhdsdio_rxfail(bus, false, false);3549 brcmf_sdbrcm_rxfail(bus, false, false);
3107 goto done;3550 goto done;
3108 }3551 }
3109 3552
3110 /* Read remainder of frame body into the rxctl buffer */3553 /* Read remainder of frame body into the rxctl buffer */
3111 sdret = bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2,3554 sdret = brcmf_sdcard_recv_buf(card, brcmf_sdcard_cur_sbwad(card),
3555 SDIO_FUNC_2,
3112 F2SYNC, (bus->rxctl + firstread), rdlen,3556 F2SYNC, (bus->rxctl + firstread), rdlen,
3113 NULL, NULL, NULL);3557 NULL, NULL, NULL);
3114 bus->f2rxdata++;3558 bus->f2rxdata++;
3115 ASSERT(sdret != -BCME_PENDING);
3116 3559
3117 /* Control frame failures need retransmission */3560 /* Control frame failures need retransmission */
3118 if (sdret < 0) {3561 if (sdret < 0) {
3119 DHD_ERROR(("%s: read %d control bytes failed: %d\n",3562 BRCMF_ERROR(("%s: read %d control bytes failed: %d\n",
3120 __func__, rdlen, sdret));3563 __func__, rdlen, sdret));
3121 bus->rxc_errors++; /* dhd.rx_ctlerrs is higher level */3564 bus->rxc_errors++;
3122 dhdsdio_rxfail(bus, true, true);3565 brcmf_sdbrcm_rxfail(bus, true, true);
3123 goto done;3566 goto done;
3124 }3567 }
3125 3568
3126gotpkt:3569gotpkt:
3127 3570
3128#ifdef DHD_DEBUG3571#ifdef BCMDBG
3129 if (DHD_BYTES_ON() && DHD_CTL_ON()) {3572 if (BRCMF_BYTES_ON() && BRCMF_CTL_ON()) {
3130 printk(KERN_DEBUG "RxCtrl:\n");3573 printk(KERN_DEBUG "RxCtrl:\n");
3131 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, bus->rxctl, len);3574 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, bus->rxctl, len);
3132 }3575 }
@@ -3138,10 +3581,10 @@ gotpkt: · 5 unmodified lines
3138 3581
3139done:3582done:
3140 /* Awake any waiters */3583 /* Awake any waiters */
3141 dhd_os_ioctl_resp_wake(bus->dhd);3584 brcmf_os_ioctl_resp_wake(bus->drvr);
3142}3585}
3143 3586
3144static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)3587static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
3145{3588{
3146 u16 dlen, totlen;3589 u16 dlen, totlen;
3147 u8 *dptr, num = 0;3590 u8 *dptr, num = 0;
@@ -3159,19 +3602,18 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 11 unmodified lines
3159 /* If packets, issue read(s) and send up packet chain */3602 /* If packets, issue read(s) and send up packet chain */
3160 /* Return sequence numbers consumed? */3603 /* Return sequence numbers consumed? */
3161 3604
3162 DHD_TRACE(("dhdsdio_rxglom: start: glomd %p glom %p\n", bus->glomd,3605 BRCMF_TRACE(("brcmf_sdbrcm_rxglom: start: glomd %p glom %p\n",
3163 bus->glom));3606 bus->glomd, bus->glom));
3164 3607
3165 /* If there's a descriptor, generate the packet chain */3608 /* If there's a descriptor, generate the packet chain */
3166 if (bus->glomd) {3609 if (bus->glomd) {
3167 dhd_os_sdlock_rxq(bus->dhd);
3168
3169 pfirst = plast = pnext = NULL;3610 pfirst = plast = pnext = NULL;
3170 dlen = (u16) (bus->glomd->len);3611 dlen = (u16) (bus->glomd->len);
3171 dptr = bus->glomd->data;3612 dptr = bus->glomd->data;
3172 if (!dlen || (dlen & 1)) {3613 if (!dlen || (dlen & 1)) {
3173 DHD_ERROR(("%s: bad glomd len(%d), ignore descriptor\n",3614 BRCMF_ERROR(("%s: bad glomd len(%d),"
3174 __func__, dlen));3615 " ignore descriptor\n",
3616 __func__, dlen));
3175 dlen = 0;3617 dlen = 0;
3176 }3618 }
3177 3619
@@ -3182,14 +3624,15 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines
3182 dptr += sizeof(u16);3624 dptr += sizeof(u16);
3183 if ((sublen < SDPCM_HDRLEN) ||3625 if ((sublen < SDPCM_HDRLEN) ||
3184 ((num == 0) && (sublen < (2 * SDPCM_HDRLEN)))) {3626 ((num == 0) && (sublen < (2 * SDPCM_HDRLEN)))) {
3185 DHD_ERROR(("%s: descriptor len %d bad: %d\n",3627 BRCMF_ERROR(("%s: descriptor len %d bad: %d\n",
3186 __func__, num, sublen));3628 __func__, num, sublen));
3187 pnext = NULL;3629 pnext = NULL;
3188 break;3630 break;
3189 }3631 }
3190 if (sublen % DHD_SDALIGN) {3632 if (sublen % BRCMF_SDALIGN) {
3191 DHD_ERROR(("%s: sublen %d not multiple of %d\n",3633 BRCMF_ERROR(("%s: sublen %d not multiple of"
3192 __func__, sublen, DHD_SDALIGN));3634 " %d\n", __func__, sublen,
3635 BRCMF_SDALIGN));
3193 usechain = false;3636 usechain = false;
3194 }3637 }
3195 totlen += sublen;3638 totlen += sublen;
@@ -3203,123 +3646,120 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 7 unmodified lines
3203 }3646 }
3204 3647
3205 /* Allocate/chain packet for next subframe */3648 /* Allocate/chain packet for next subframe */
3206 pnext = bcm_pkt_buf_get_skb(sublen + DHD_SDALIGN);3649 pnext = brcmu_pkt_buf_get_skb(sublen + BRCMF_SDALIGN);
3207 if (pnext == NULL) {3650 if (pnext == NULL) {
3208 DHD_ERROR(("%s: bcm_pkt_buf_get_skb failed, "3651 BRCMF_ERROR(("%s: bcm_pkt_buf_get_skb failed, "
3209 "num %d len %d\n", __func__,3652 "num %d len %d\n", __func__,
3210 num, sublen));3653 num, sublen));
3211 break;3654 break;
3212 }3655 }
3213 ASSERT(!(pnext->prev));
3214 if (!pfirst) {3656 if (!pfirst) {
3215 ASSERT(!plast);
3216 pfirst = plast = pnext;3657 pfirst = plast = pnext;
3217 } else {3658 } else {
3218 ASSERT(plast);
3219 plast->next = pnext;3659 plast->next = pnext;
3220 plast = pnext;3660 plast = pnext;
3221 }3661 }
3222 3662
3223 /* Adhere to start alignment requirements */3663 /* Adhere to start alignment requirements */
3224 PKTALIGN(pnext, sublen, DHD_SDALIGN);3664 PKTALIGN(pnext, sublen, BRCMF_SDALIGN);
3225 }3665 }
3226 3666
3227 /* If all allocations succeeded, save packet chain3667 /* If all allocations succeeded, save packet chain
3228 in bus structure */3668 in bus structure */
3229 if (pnext) {3669 if (pnext) {
3230 DHD_GLOM(("%s: allocated %d-byte packet chain for %d "3670 BRCMF_GLOM(("%s: allocated %d-byte packet chain for %d "
3231 "subframes\n", __func__, totlen, num));3671 "subframes\n", __func__, totlen, num));
3232 if (DHD_GLOM_ON() && bus->nextlen) {3672 if (BRCMF_GLOM_ON() && bus->nextlen) {
3233 if (totlen != bus->nextlen) {3673 if (totlen != bus->nextlen) {
3234 DHD_GLOM(("%s: glomdesc mismatch: nextlen %d glomdesc %d " "rxseq %d\n",3674 BRCMF_GLOM(("%s: glomdesc mismatch: "
3235 __func__, bus->nextlen,3675 "nextlen %d glomdesc %d "
3236 totlen, rxseq));3676 "rxseq %d\n", __func__,
3677 bus->nextlen,
3678 totlen, rxseq));
3237 }3679 }
3238 }3680 }
3239 bus->glom = pfirst;3681 bus->glom = pfirst;
3240 pfirst = pnext = NULL;3682 pfirst = pnext = NULL;
3241 } else {3683 } else {
3242 if (pfirst)3684 if (pfirst)
3243 bcm_pkt_buf_free_skb(pfirst);3685 brcmu_pkt_buf_free_skb(pfirst);
3244 bus->glom = NULL;3686 bus->glom = NULL;
3245 num = 0;3687 num = 0;
3246 }3688 }
3247 3689
3248 /* Done with descriptor packet */3690 /* Done with descriptor packet */
3249 bcm_pkt_buf_free_skb(bus->glomd);3691 brcmu_pkt_buf_free_skb(bus->glomd);
3250 bus->glomd = NULL;3692 bus->glomd = NULL;
3251 bus->nextlen = 0;3693 bus->nextlen = 0;
3252
3253 dhd_os_sdunlock_rxq(bus->dhd);
3254 }3694 }
3255 3695
3256 /* Ok -- either we just generated a packet chain,3696 /* Ok -- either we just generated a packet chain,
3257 or had one from before */3697 or had one from before */
3258 if (bus->glom) {3698 if (bus->glom) {
3259 if (DHD_GLOM_ON()) {3699 if (BRCMF_GLOM_ON()) {
3260 DHD_GLOM(("%s: try superframe read, packet chain:\n",3700 BRCMF_GLOM(("%s: try superframe read, packet chain:\n",
3261 __func__));3701 __func__));
3262 for (pnext = bus->glom; pnext; pnext = pnext->next) {3702 for (pnext = bus->glom; pnext; pnext = pnext->next) {
3263 DHD_GLOM((" %p: %p len 0x%04x (%d)\n",3703 BRCMF_GLOM((" %p: %p len 0x%04x (%d)\n",
3264 pnext, (u8 *) (pnext->data),3704 pnext, (u8 *) (pnext->data),
3265 pnext->len, pnext->len));3705 pnext->len, pnext->len));
3266 }3706 }
3267 }3707 }
3268 3708
3269 pfirst = bus->glom;3709 pfirst = bus->glom;
3270 dlen = (u16) bcm_pkttotlen(pfirst);3710 dlen = (u16) brcmu_pkttotlen(pfirst);
3271 3711
3272 /* Do an SDIO read for the superframe. Configurable iovar to3712 /* Do an SDIO read for the superframe. Configurable iovar to
3273 * read directly into the chained packet, or allocate a large3713 * read directly into the chained packet, or allocate a large
3274 * packet and and copy into the chain.3714 * packet and and copy into the chain.
3275 */3715 */
3276 if (usechain) {3716 if (usechain) {
3277 errcode = bcmsdh_recv_buf(bus,3717 errcode = brcmf_sdcard_recv_buf(bus->card,
3278 bcmsdh_cur_sbwad(bus->sdh), SDIO_FUNC_2,3718 brcmf_sdcard_cur_sbwad(bus->card),
3719 SDIO_FUNC_2,
3279 F2SYNC, (u8 *) pfirst->data, dlen,3720 F2SYNC, (u8 *) pfirst->data, dlen,
3280 pfirst, NULL, NULL);3721 pfirst, NULL, NULL);
3281 } else if (bus->dataptr) {3722 } else if (bus->dataptr) {
3282 errcode = bcmsdh_recv_buf(bus,3723 errcode = brcmf_sdcard_recv_buf(bus->card,
3283 bcmsdh_cur_sbwad(bus->sdh), SDIO_FUNC_2,3724 brcmf_sdcard_cur_sbwad(bus->card),
3725 SDIO_FUNC_2,
3284 F2SYNC, bus->dataptr, dlen,3726 F2SYNC, bus->dataptr, dlen,
3285 NULL, NULL, NULL);3727 NULL, NULL, NULL);
3286 sublen = (u16) bcm_pktfrombuf(pfirst, 0, dlen,3728 sublen = (u16) brcmu_pktfrombuf(pfirst, 0, dlen,
3287 bus->dataptr);3729 bus->dataptr);
3288 if (sublen != dlen) {3730 if (sublen != dlen) {
3289 DHD_ERROR(("%s: FAILED TO COPY, dlen %d sublen %d\n",3731 BRCMF_ERROR(("%s: FAILED TO COPY, dlen %d "
3290 __func__, dlen, sublen));3732 "sublen %d\n",
3733 __func__, dlen, sublen));
3291 errcode = -1;3734 errcode = -1;
3292 }3735 }
3293 pnext = NULL;3736 pnext = NULL;
3294 } else {3737 } else {
3295 DHD_ERROR(("COULDN'T ALLOC %d-BYTE GLOM, FORCE FAILURE\n",3738 BRCMF_ERROR(("COULDN'T ALLOC %d-BYTE GLOM, "
3296 dlen));3739 "FORCE FAILURE\n", dlen));
3297 errcode = -1;3740 errcode = -1;
3298 }3741 }
3299 bus->f2rxdata++;3742 bus->f2rxdata++;
3300 ASSERT(errcode != -BCME_PENDING);
3301 3743
3302 /* On failure, kill the superframe, allow a couple retries */3744 /* On failure, kill the superframe, allow a couple retries */
3303 if (errcode < 0) {3745 if (errcode < 0) {
3304 DHD_ERROR(("%s: glom read of %d bytes failed: %d\n",3746 BRCMF_ERROR(("%s: glom read of %d bytes failed: %d\n",
3305 __func__, dlen, errcode));3747 __func__, dlen, errcode));
3306 bus->dhd->rx_errors++;3748 bus->drvr->rx_errors++;
3307 3749
3308 if (bus->glomerr++ < 3) {3750 if (bus->glomerr++ < 3) {
3309 dhdsdio_rxfail(bus, true, true);3751 brcmf_sdbrcm_rxfail(bus, true, true);
3310 } else {3752 } else {
3311 bus->glomerr = 0;3753 bus->glomerr = 0;
3312 dhdsdio_rxfail(bus, true, false);3754 brcmf_sdbrcm_rxfail(bus, true, false);
3313 dhd_os_sdlock_rxq(bus->dhd);3755 brcmu_pkt_buf_free_skb(bus->glom);
3314 bcm_pkt_buf_free_skb(bus->glom);
3315 dhd_os_sdunlock_rxq(bus->dhd);
3316 bus->rxglomfail++;3756 bus->rxglomfail++;
3317 bus->glom = NULL;3757 bus->glom = NULL;
3318 }3758 }
3319 return 0;3759 return 0;
3320 }3760 }
3321#ifdef DHD_DEBUG3761#ifdef BCMDBG
3322 if (DHD_GLOM_ON()) {3762 if (BRCMF_GLOM_ON()) {
3323 printk(KERN_DEBUG "SUPERFRAME:\n");3763 printk(KERN_DEBUG "SUPERFRAME:\n");
3324 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,3764 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
3325 pfirst->data, min_t(int, pfirst->len, 48));3765 pfirst->data, min_t(int, pfirst->len, 48));
@@ -3335,8 +3775,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 9 unmodified lines
3335 seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);3775 seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);
3336 bus->nextlen = dptr[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET];3776 bus->nextlen = dptr[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET];
3337 if ((bus->nextlen << 4) > MAX_RX_DATASZ) {3777 if ((bus->nextlen << 4) > MAX_RX_DATASZ) {
3338 DHD_INFO(("%s: nextlen too large (%d) seq %d\n",3778 BRCMF_INFO(("%s: nextlen too large (%d) seq %d\n",
3339 __func__, bus->nextlen, seq));3779 __func__, bus->nextlen, seq));
3340 bus->nextlen = 0;3780 bus->nextlen = 0;
3341 }3781 }
3342 doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);3782 doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);
@@ -3344,47 +3784,48 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 1 unmodified line
3344 3784
3345 errcode = 0;3785 errcode = 0;
3346 if ((u16)~(sublen ^ check)) {3786 if ((u16)~(sublen ^ check)) {
3347 DHD_ERROR(("%s (superframe): HW hdr error: len/check "3787 BRCMF_ERROR(("%s (superframe): HW hdr error: len/check "
3348 "0x%04x/0x%04x\n", __func__, sublen, check));3788 "0x%04x/0x%04x\n", __func__, sublen,
3789 check));
3349 errcode = -1;3790 errcode = -1;
3350 } else if (roundup(sublen, bus->blocksize) != dlen) {3791 } else if (roundup(sublen, bus->blocksize) != dlen) {
3351 DHD_ERROR(("%s (superframe): len 0x%04x, rounded "3792 BRCMF_ERROR(("%s (superframe): len 0x%04x, rounded "
3352 "0x%04x, expect 0x%04x\n",3793 "0x%04x, expect 0x%04x\n",
3353 __func__, sublen,3794 __func__, sublen,
3354 roundup(sublen, bus->blocksize), dlen));3795 roundup(sublen, bus->blocksize), dlen));
3355 errcode = -1;3796 errcode = -1;
3356 } else if (SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]) !=3797 } else if (SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]) !=
3357 SDPCM_GLOM_CHANNEL) {3798 SDPCM_GLOM_CHANNEL) {
3358 DHD_ERROR(("%s (superframe): bad channel %d\n",3799 BRCMF_ERROR(("%s (superframe): bad channel %d\n",
3359 __func__,3800 __func__,
3360 SDPCM_PACKET_CHANNEL(&dptr3801 SDPCM_PACKET_CHANNEL(&dptr
3361 [SDPCM_FRAMETAG_LEN])));3802 [SDPCM_FRAMETAG_LEN])));
3362 errcode = -1;3803 errcode = -1;
3363 } else if (SDPCM_GLOMDESC(&dptr[SDPCM_FRAMETAG_LEN])) {3804 } else if (SDPCM_GLOMDESC(&dptr[SDPCM_FRAMETAG_LEN])) {
3364 DHD_ERROR(("%s (superframe): got second descriptor?\n",3805 BRCMF_ERROR(("%s (superframe): got 2nd descriptor?\n",
3365 __func__));3806 __func__));
3366 errcode = -1;3807 errcode = -1;
3367 } else if ((doff < SDPCM_HDRLEN) ||3808 } else if ((doff < SDPCM_HDRLEN) ||
3368 (doff > (pfirst->len - SDPCM_HDRLEN))) {3809 (doff > (pfirst->len - SDPCM_HDRLEN))) {
3369 DHD_ERROR(("%s (superframe): Bad data offset %d: HW %d "3810 BRCMF_ERROR(("%s (superframe): Bad data offset %d: "
3370 "pkt %d min %d\n",3811 "HW %d pkt %d min %d\n",
3371 __func__, doff, sublen,3812 __func__, doff, sublen,
3372 pfirst->len, SDPCM_HDRLEN));3813 pfirst->len, SDPCM_HDRLEN));
3373 errcode = -1;3814 errcode = -1;
3374 }3815 }
3375 3816
3376 /* Check sequence number of superframe SW header */3817 /* Check sequence number of superframe SW header */
3377 if (rxseq != seq) {3818 if (rxseq != seq) {
3378 DHD_INFO(("%s: (superframe) rx_seq %d, expected %d\n",3819 BRCMF_INFO(("%s: (superframe) rx_seq %d, expected %d\n",
3379 __func__, seq, rxseq));3820 __func__, seq, rxseq));
3380 bus->rx_badseq++;3821 bus->rx_badseq++;
3381 rxseq = seq;3822 rxseq = seq;
3382 }3823 }
3383 3824
3384 /* Check window for sanity */3825 /* Check window for sanity */
3385 if ((u8) (txmax - bus->tx_seq) > 0x40) {3826 if ((u8) (txmax - bus->tx_seq) > 0x40) {
3386 DHD_ERROR(("%s: unlikely tx max %d with tx_seq %d\n",3827 BRCMF_ERROR(("%s: unlikely tx max %d with tx_seq %d\n",
3387 __func__, txmax, bus->tx_seq));3828 __func__, txmax, bus->tx_seq));
3388 txmax = bus->tx_seq + 2;3829 txmax = bus->tx_seq + 2;
3389 }3830 }
3390 bus->tx_max = txmax;3831 bus->tx_max = txmax;
@@ -3402,8 +3843,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 11 unmodified lines
3402 check = get_unaligned_le16(dptr + sizeof(u16));3843 check = get_unaligned_le16(dptr + sizeof(u16));
3403 chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);3844 chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
3404 doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);3845 doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);
3405#ifdef DHD_DEBUG3846#ifdef BCMDBG
3406 if (DHD_GLOM_ON()) {3847 if (BRCMF_GLOM_ON()) {
3407 printk(KERN_DEBUG "subframe:\n");3848 printk(KERN_DEBUG "subframe:\n");
3408 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,3849 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
3409 dptr, 32);3850 dptr, 32);
@@ -3411,24 +3852,25 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 1 unmodified line
3411#endif3852#endif
3412 3853
3413 if ((u16)~(sublen ^ check)) {3854 if ((u16)~(sublen ^ check)) {
3414 DHD_ERROR(("%s (subframe %d): HW hdr error: "3855 BRCMF_ERROR(("%s (subframe %d): HW hdr error: "
3415 "len/check 0x%04x/0x%04x\n",3856 "len/check 0x%04x/0x%04x\n",
3416 __func__, num, sublen, check));3857 __func__, num, sublen, check));
3417 errcode = -1;3858 errcode = -1;
3418 } else if ((sublen > dlen) || (sublen < SDPCM_HDRLEN)) {3859 } else if ((sublen > dlen) || (sublen < SDPCM_HDRLEN)) {
3419 DHD_ERROR(("%s (subframe %d): length mismatch: "3860 BRCMF_ERROR(("%s (subframe %d): length mismatch"
3420 "len 0x%04x, expect 0x%04x\n",3861 ": len 0x%04x, expect 0x%04x\n",
3421 __func__, num, sublen, dlen));3862 __func__, num, sublen, dlen));
3422 errcode = -1;3863 errcode = -1;
3423 } else if ((chan != SDPCM_DATA_CHANNEL) &&3864 } else if ((chan != SDPCM_DATA_CHANNEL) &&
3424 (chan != SDPCM_EVENT_CHANNEL)) {3865 (chan != SDPCM_EVENT_CHANNEL)) {
3425 DHD_ERROR(("%s (subframe %d): bad channel %d\n",3866 BRCMF_ERROR(("%s (subframe %d): bad channel"
3426 __func__, num, chan));3867 " %d\n", __func__, num, chan));
3427 errcode = -1;3868 errcode = -1;
3428 } else if ((doff < SDPCM_HDRLEN) || (doff > sublen)) {3869 } else if ((doff < SDPCM_HDRLEN) || (doff > sublen)) {
3429 DHD_ERROR(("%s (subframe %d): Bad data offset %d: HW %d min %d\n",3870 BRCMF_ERROR(("%s (subframe %d): Bad data offset"
3430 __func__, num, doff, sublen,3871 " %d: HW %d min %d\n",
3431 SDPCM_HDRLEN));3872 __func__, num, doff, sublen,
3873 SDPCM_HDRLEN));
3432 errcode = -1;3874 errcode = -1;
3433 }3875 }
3434 }3876 }
@@ -3439,13 +3881,11 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines
3439 if (bus->glomerr++ < 3) {3881 if (bus->glomerr++ < 3) {
3440 /* Restore superframe header space */3882 /* Restore superframe header space */
3441 skb_push(pfirst, sfdoff);3883 skb_push(pfirst, sfdoff);
3442 dhdsdio_rxfail(bus, true, true);3884 brcmf_sdbrcm_rxfail(bus, true, true);
3443 } else {3885 } else {
3444 bus->glomerr = 0;3886 bus->glomerr = 0;
3445 dhdsdio_rxfail(bus, true, false);3887 brcmf_sdbrcm_rxfail(bus, true, false);
3446 dhd_os_sdlock_rxq(bus->dhd);3888 brcmu_pkt_buf_free_skb(bus->glom);
3447 bcm_pkt_buf_free_skb(bus->glom);
3448 dhd_os_sdunlock_rxq(bus->dhd);
3449 bus->rxglomfail++;3889 bus->rxglomfail++;
3450 bus->glom = NULL;3890 bus->glom = NULL;
3451 }3891 }
@@ -3458,7 +3898,6 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 6 unmodified lines
3458 bus->glom = NULL;3898 bus->glom = NULL;
3459 plast = NULL;3899 plast = NULL;
3460 3900
3461 dhd_os_sdlock_rxq(bus->dhd);
3462 for (num = 0; pfirst; rxseq++, pfirst = pnext) {3901 for (num = 0; pfirst; rxseq++, pfirst = pnext) {
3463 pnext = pfirst->next;3902 pnext = pfirst->next;
3464 pfirst->next = NULL;3903 pfirst->next = NULL;
@@ -3469,22 +3908,22 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines
3469 seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);3908 seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);
3470 doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);3909 doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);
3471 3910
3472 DHD_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d "3911 BRCMF_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d "
3473 "chan %d seq %d\n",3912 "chan %d seq %d\n",
3474 __func__, num, pfirst, pfirst->data,3913 __func__, num, pfirst, pfirst->data,
3475 pfirst->len, sublen, chan, seq));3914 pfirst->len, sublen, chan, seq));
3476 3915
3477 ASSERT((chan == SDPCM_DATA_CHANNEL)3916 /* precondition: chan == SDPCM_DATA_CHANNEL ||
3478 || (chan == SDPCM_EVENT_CHANNEL));3917 chan == SDPCM_EVENT_CHANNEL */
3479 3918
3480 if (rxseq != seq) {3919 if (rxseq != seq) {
3481 DHD_GLOM(("%s: rx_seq %d, expected %d\n",3920 BRCMF_GLOM(("%s: rx_seq %d, expected %d\n",
3482 __func__, seq, rxseq));3921 __func__, seq, rxseq));
3483 bus->rx_badseq++;3922 bus->rx_badseq++;
3484 rxseq = seq;3923 rxseq = seq;
3485 }3924 }
3486#ifdef DHD_DEBUG3925#ifdef BCMDBG
3487 if (DHD_BYTES_ON() && DHD_DATA_ON()) {3926 if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) {
3488 printk(KERN_DEBUG "Rx Subframe Data:\n");3927 printk(KERN_DEBUG "Rx Subframe Data:\n");
3489 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,3928 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
3490 dptr, dlen);3929 dptr, dlen);
@@ -3495,24 +3934,22 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines
3495 skb_pull(pfirst, doff);3934 skb_pull(pfirst, doff);
3496 3935
3497 if (pfirst->len == 0) {3936 if (pfirst->len == 0) {
3498 bcm_pkt_buf_free_skb(pfirst);3937 brcmu_pkt_buf_free_skb(pfirst);
3499 if (plast) {3938 if (plast) {
3500 plast->next = pnext;3939 plast->next = pnext;
3501 } else {3940 } else {
3502 ASSERT(save_pfirst == pfirst);
3503 save_pfirst = pnext;3941 save_pfirst = pnext;
3504 }3942 }
3505 continue;3943 continue;
3506 } else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pfirst) !=3944 } else if (brcmf_proto_hdrpull(bus->drvr, &ifidx, pfirst)
3507 0) {3945 != 0) {
3508 DHD_ERROR(("%s: rx protocol error\n",3946 BRCMF_ERROR(("%s: rx protocol error\n",
3509 __func__));3947 __func__));
3510 bus->dhd->rx_errors++;3948 bus->drvr->rx_errors++;
3511 bcm_pkt_buf_free_skb(pfirst);3949 brcmu_pkt_buf_free_skb(pfirst);
3512 if (plast) {3950 if (plast) {
3513 plast->next = pnext;3951 plast->next = pnext;
3514 } else {3952 } else {
3515 ASSERT(save_pfirst == pfirst);
3516 save_pfirst = pnext;3953 save_pfirst = pnext;
3517 }3954 }
3518 continue;3955 continue;
@@ -3524,24 +3961,23 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 5 unmodified lines
3524 plast = pfirst;3961 plast = pfirst;
3525 num++;3962 num++;
3526 3963
3527#ifdef DHD_DEBUG3964#ifdef BCMDBG
3528 if (DHD_GLOM_ON()) {3965 if (BRCMF_GLOM_ON()) {
3529 DHD_GLOM(("%s subframe %d to stack, %p(%p/%d) "3966 BRCMF_GLOM(("%s subframe %d to stack, %p"
3530 "nxt/lnk %p/%p\n",3967 "(%p/%d) nxt/lnk %p/%p\n",
3531 __func__, num, pfirst, pfirst->data,3968 __func__, num, pfirst, pfirst->data,
3532 pfirst->len, pfirst->next,3969 pfirst->len, pfirst->next,
3533 pfirst->prev));3970 pfirst->prev));
3534 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,3971 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
3535 pfirst->data,3972 pfirst->data,
3536 min_t(int, pfirst->len, 32));3973 min_t(int, pfirst->len, 32));
3537 }3974 }
3538#endif /* DHD_DEBUG */3975#endif /* BCMDBG */
3539 }3976 }
3540 dhd_os_sdunlock_rxq(bus->dhd);
3541 if (num) {3977 if (num) {
3542 dhd_os_sdunlock(bus->dhd);3978 brcmf_sdbrcm_sdunlock(bus);
3543 dhd_rx_frame(bus->dhd, ifidx, save_pfirst, num);3979 brcmf_rx_frame(bus->drvr, ifidx, save_pfirst, num);
3544 dhd_os_sdlock(bus->dhd);3980 brcmf_sdbrcm_sdlock(bus);
3545 }3981 }
3546 3982
3547 bus->rxglomframes++;3983 bus->rxglomframes++;
@@ -3551,9 +3987,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 3 unmodified lines
3551}3987}
3552 3988
3553/* Return true if there may be more frames to read */3989/* Return true if there may be more frames to read */
3554static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)3990static uint
3991brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
3555{3992{
3556 bcmsdh_info_t *sdh = bus->sdh;3993 struct brcmf_sdio_card *card = bus->card;
3557 3994
3558 u16 len, check; /* Extracted hardware header fields */3995 u16 len, check; /* Extracted hardware header fields */
3559 u8 chan, seq, doff; /* Extracted software header fields */3996 u8 chan, seq, doff; /* Extracted software header fields */
@@ -3564,7 +4001,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 4 unmodified lines
3564 u16 rdlen; /* Total number of bytes to read */4001 u16 rdlen; /* Total number of bytes to read */
3565 u8 rxseq; /* Next sequence number to expect */4002 u8 rxseq; /* Next sequence number to expect */
3566 uint rxleft = 0; /* Remaining number of frames allowed */4003 uint rxleft = 0; /* Remaining number of frames allowed */
3567 int sdret; /* Return code from bcmsdh calls */4004 int sdret; /* Return code from calls */
3568 u8 txmax; /* Maximum tx sequence offered */4005 u8 txmax; /* Maximum tx sequence offered */
3569 bool len_consistent; /* Result of comparing readahead len and4006 bool len_consistent; /* Result of comparing readahead len and
3570 len from hw-hdr */4007 len from hw-hdr */
@@ -3572,17 +4009,15 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 1 unmodified line
3572 int ifidx = 0;4009 int ifidx = 0;
3573 uint rxcount = 0; /* Total frames read */4010 uint rxcount = 0; /* Total frames read */
3574 4011
3575#if defined(DHD_DEBUG) || defined(SDTEST)4012#if defined(BCMDBG) || defined(SDTEST)
3576 bool sdtest = false; /* To limit message spew from test mode */4013 bool sdtest = false; /* To limit message spew from test mode */
3577#endif4014#endif
3578 4015
3579 DHD_TRACE(("%s: Enter\n", __func__));4016 BRCMF_TRACE(("%s: Enter\n", __func__));
3580
3581 ASSERT(maxframes);
3582 4017
3583#ifdef SDTEST4018#ifdef SDTEST
3584 /* Allow pktgen to override maxframes */4019 /* Allow pktgen to override maxframes */
3585 if (bus->pktgen_count && (bus->pktgen_mode == DHD_PKTGEN_RECV)) {4020 if (bus->pktgen_count && (bus->pktgen_mode == BRCMF_PKTGEN_RECV)) {
3586 maxframes = bus->pktgen_count;4021 maxframes = bus->pktgen_count;
3587 sdtest = true;4022 sdtest = true;
3588 }4023 }
@@ -3592,23 +4027,23 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 3 unmodified lines
3592 *finished = false;4027 *finished = false;
3593 4028
3594 for (rxseq = bus->rx_seq, rxleft = maxframes;4029 for (rxseq = bus->rx_seq, rxleft = maxframes;
3595 !bus->rxskip && rxleft && bus->dhd->busstate != DHD_BUS_DOWN;4030 !bus->rxskip && rxleft && bus->drvr->busstate != BRCMF_BUS_DOWN;
3596 rxseq++, rxleft--) {4031 rxseq++, rxleft--) {
3597 4032
3598 /* Handle glomming separately */4033 /* Handle glomming separately */
3599 if (bus->glom || bus->glomd) {4034 if (bus->glom || bus->glomd) {
3600 u8 cnt;4035 u8 cnt;
3601 DHD_GLOM(("%s: calling rxglom: glomd %p, glom %p\n",4036 BRCMF_GLOM(("%s: calling rxglom: glomd %p, glom %p\n",
3602 __func__, bus->glomd, bus->glom));4037 __func__, bus->glomd, bus->glom));
3603 cnt = dhdsdio_rxglom(bus, rxseq);4038 cnt = brcmf_sdbrcm_rxglom(bus, rxseq);
3604 DHD_GLOM(("%s: rxglom returned %d\n", __func__, cnt));4039 BRCMF_GLOM(("%s: rxglom returned %d\n", __func__, cnt));
3605 rxseq += cnt - 1;4040 rxseq += cnt - 1;
3606 rxleft = (rxleft > cnt) ? (rxleft - cnt) : 1;4041 rxleft = (rxleft > cnt) ? (rxleft - cnt) : 1;
3607 continue;4042 continue;
3608 }4043 }
3609 4044
3610 /* Try doing single read if we can */4045 /* Try doing single read if we can */
3611 if (dhd_readahead && bus->nextlen) {4046 if (brcmf_readahead && bus->nextlen) {
3612 u16 nextlen = bus->nextlen;4047 u16 nextlen = bus->nextlen;
3613 bus->nextlen = 0;4048 bus->nextlen = 0;
3614 4049
@@ -3628,9 +4063,9 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 13 unmodified lines
3628 && ((rdlen + pad + firstread) <4063 && ((rdlen + pad + firstread) <
3629 MAX_RX_DATASZ))4064 MAX_RX_DATASZ))
3630 rdlen += pad;4065 rdlen += pad;
3631 } else if (rdlen % DHD_SDALIGN) {4066 } else if (rdlen % BRCMF_SDALIGN) {
3632 rdlen +=4067 rdlen +=
3633 DHD_SDALIGN - (rdlen % DHD_SDALIGN);4068 BRCMF_SDALIGN - (rdlen % BRCMF_SDALIGN);
3634 }4069 }
3635 }4070 }
3636 4071
@@ -3645,42 +4080,40 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 8 unmodified lines
3645 * or non-data frame.4080 * or non-data frame.
3646 */4081 */
3647 /* Allocate a packet buffer */4082 /* Allocate a packet buffer */
3648 dhd_os_sdlock_rxq(bus->dhd);4083 pkt = brcmu_pkt_buf_get_skb(rdlen + BRCMF_SDALIGN);
3649 pkt = bcm_pkt_buf_get_skb(rdlen + DHD_SDALIGN);
3650 if (!pkt) {4084 if (!pkt) {
3651 if (bus->bus == SPI_BUS) {4085 if (bus->bus == SPI_BUS) {
3652 bus->usebufpool = false;4086 bus->usebufpool = false;
3653 bus->rxctl = bus->rxbuf;4087 bus->rxctl = bus->rxbuf;
3654 if (dhd_alignctl) {4088 if (brcmf_alignctl) {
3655 bus->rxctl += firstread;4089 bus->rxctl += firstread;
3656 pad = ((unsigned long)bus->rxctl %4090 pad = ((unsigned long)bus->rxctl %
3657 DHD_SDALIGN);4091 BRCMF_SDALIGN);
3658 if (pad)4092 if (pad)
3659 bus->rxctl +=4093 bus->rxctl +=
3660 (DHD_SDALIGN - pad);4094 (BRCMF_SDALIGN - pad);
3661 bus->rxctl -= firstread;4095 bus->rxctl -= firstread;
3662 }4096 }
3663 ASSERT(bus->rxctl >= bus->rxbuf);
3664 rxbuf = bus->rxctl;4097 rxbuf = bus->rxctl;
3665 /* Read the entire frame */4098 /* Read the entire frame */
3666 sdret = bcmsdh_recv_buf(bus,4099 sdret = brcmf_sdcard_recv_buf(card,
3667 bcmsdh_cur_sbwad(sdh),4100 brcmf_sdcard_cur_sbwad(card),
3668 SDIO_FUNC_2, F2SYNC,4101 SDIO_FUNC_2, F2SYNC,
3669 rxbuf, rdlen,4102 rxbuf, rdlen,
3670 NULL, NULL, NULL);4103 NULL, NULL, NULL);
3671 bus->f2rxdata++;4104 bus->f2rxdata++;
3672 ASSERT(sdret != -BCME_PENDING);
3673 4105
3674 /* Control frame failures need4106 /* Control frame failures need
3675 retransmission */4107 retransmission */
3676 if (sdret < 0) {4108 if (sdret < 0) {
3677 DHD_ERROR(("%s: read %d control bytes failed: %d\n",4109 BRCMF_ERROR(("%s: read %d "
3678 __func__,4110 "control bytes "
3679 rdlen, sdret));4111 "failed: %d\n",
4112 __func__,
4113 rdlen, sdret));
3680 /* dhd.rx_ctlerrs is higher */4114 /* dhd.rx_ctlerrs is higher */
3681 bus->rxc_errors++;4115 bus->rxc_errors++;
3682 dhd_os_sdunlock_rxq(bus->dhd);4116 brcmf_sdbrcm_rxfail(bus, true,
3683 dhdsdio_rxfail(bus, true,
3684 (bus->bus ==4117 (bus->bus ==
3685 SPI_BUS) ? false4118 SPI_BUS) ? false
3686 : true);4119 : true);
@@ -3689,50 +4122,45 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 2 unmodified lines
3689 } else {4122 } else {
3690 /* Give up on data,4123 /* Give up on data,
3691 request rtx of events */4124 request rtx of events */
3692 DHD_ERROR(("%s (nextlen): "4125 BRCMF_ERROR(("%s (nextlen): "
3693 "bcm_pkt_buf_get_skb failed:"4126 "brcmu_pkt_buf_get_skb "
3694 " len %d rdlen %d expected"4127 "failed:"
3695 " rxseq %d\n", __func__,4128 " len %d rdlen %d expected"
3696 len, rdlen, rxseq));4129 " rxseq %d\n", __func__,
3697 /* Just go try again w/normal4130 len, rdlen, rxseq));
3698 header read */
3699 dhd_os_sdunlock_rxq(bus->dhd);
3700 continue;4131 continue;
3701 }4132 }
3702 } else {4133 } else {
3703 if (bus->bus == SPI_BUS)4134 if (bus->bus == SPI_BUS)
3704 bus->usebufpool = true;4135 bus->usebufpool = true;
3705 4136
3706 ASSERT(!(pkt->prev));4137 PKTALIGN(pkt, rdlen, BRCMF_SDALIGN);
3707 PKTALIGN(pkt, rdlen, DHD_SDALIGN);
3708 rxbuf = (u8 *) (pkt->data);4138 rxbuf = (u8 *) (pkt->data);
3709 /* Read the entire frame */4139 /* Read the entire frame */
3710 sdret = bcmsdh_recv_buf(bus,4140 sdret = brcmf_sdcard_recv_buf(card,
3711 bcmsdh_cur_sbwad(sdh),4141 brcmf_sdcard_cur_sbwad(card),
3712 SDIO_FUNC_2, F2SYNC,4142 SDIO_FUNC_2, F2SYNC,
3713 rxbuf, rdlen,4143 rxbuf, rdlen,
3714 pkt, NULL, NULL);4144 pkt, NULL, NULL);
3715 bus->f2rxdata++;4145 bus->f2rxdata++;
3716 ASSERT(sdret != -BCME_PENDING);
3717 4146
3718 if (sdret < 0) {4147 if (sdret < 0) {
3719 DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n",4148 BRCMF_ERROR(("%s (nextlen): read %d"
3720 __func__, rdlen, sdret));4149 " bytes failed: %d\n",
3721 bcm_pkt_buf_free_skb(pkt);4150 __func__, rdlen, sdret));
3722 bus->dhd->rx_errors++;4151 brcmu_pkt_buf_free_skb(pkt);
3723 dhd_os_sdunlock_rxq(bus->dhd);4152 bus->drvr->rx_errors++;
3724 /* Force retry w/normal header read.4153 /* Force retry w/normal header read.
3725 * Don't attempt NAK for4154 * Don't attempt NAK for
3726 * gSPI4155 * gSPI
3727 */4156 */
3728 dhdsdio_rxfail(bus, true,4157 brcmf_sdbrcm_rxfail(bus, true,
3729 (bus->bus ==4158 (bus->bus ==
3730 SPI_BUS) ? false :4159 SPI_BUS) ? false :
3731 true);4160 true);
3732 continue;4161 continue;
3733 }4162 }
3734 }4163 }
3735 dhd_os_sdunlock_rxq(bus->dhd);
3736 4164
3737 /* Now check the header */4165 /* Now check the header */
3738 memcpy(bus->rxhdr, rxbuf, SDPCM_HDRLEN);4166 memcpy(bus->rxhdr, rxbuf, SDPCM_HDRLEN);
@@ -3743,29 +4171,29 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 4 unmodified lines
3743 4171
3744 /* All zeros means readahead info was bad */4172 /* All zeros means readahead info was bad */
3745 if (!(len | check)) {4173 if (!(len | check)) {
3746 DHD_INFO(("%s (nextlen): read zeros in HW "4174 BRCMF_INFO(("%s (nextlen): read zeros in HW "
3747 "header???\n", __func__));4175 "header???\n", __func__));
3748 dhdsdio_pktfree2(bus, pkt);4176 brcmf_sdbrcm_pktfree2(bus, pkt);
3749 continue;4177 continue;
3750 }4178 }
3751 4179
3752 /* Validate check bytes */4180 /* Validate check bytes */
3753 if ((u16)~(len ^ check)) {4181 if ((u16)~(len ^ check)) {
3754 DHD_ERROR(("%s (nextlen): HW hdr error:"4182 BRCMF_ERROR(("%s (nextlen): HW hdr error:"
3755 " nextlen/len/check"4183 " nextlen/len/check"
3756 " 0x%04x/0x%04x/0x%04x\n",4184 " 0x%04x/0x%04x/0x%04x\n",
3757 __func__, nextlen, len, check));4185 __func__, nextlen, len, check));
3758 bus->rx_badhdr++;4186 bus->rx_badhdr++;
3759 dhdsdio_rxfail(bus, false, false);4187 brcmf_sdbrcm_rxfail(bus, false, false);
3760 dhdsdio_pktfree2(bus, pkt);4188 brcmf_sdbrcm_pktfree2(bus, pkt);
3761 continue;4189 continue;
3762 }4190 }
3763 4191
3764 /* Validate frame length */4192 /* Validate frame length */
3765 if (len < SDPCM_HDRLEN) {4193 if (len < SDPCM_HDRLEN) {
3766 DHD_ERROR(("%s (nextlen): HW hdr length "4194 BRCMF_ERROR(("%s (nextlen): HW hdr length "
3767 "invalid: %d\n", __func__, len));4195 "invalid: %d\n", __func__, len));
3768 dhdsdio_pktfree2(bus, pkt);4196 brcmf_sdbrcm_pktfree2(bus, pkt);
3769 continue;4197 continue;
3770 }4198 }
3771 4199
@@ -3774,13 +4202,14 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 2 unmodified lines
3774 if (len_consistent) {4202 if (len_consistent) {
3775 /* Mismatch, force retry w/normal4203 /* Mismatch, force retry w/normal
3776 header (may be >4K) */4204 header (may be >4K) */
3777 DHD_ERROR(("%s (nextlen): mismatch, "4205 BRCMF_ERROR(("%s (nextlen): mismatch, "
3778 "nextlen %d len %d rnd %d; "4206 "nextlen %d len %d rnd %d; "
3779 "expected rxseq %d\n",4207 "expected rxseq %d\n",
3780 __func__, nextlen,4208 __func__, nextlen,
3781 len, roundup(len, 16), rxseq));4209 len, roundup(len, 16), rxseq));
3782 dhdsdio_rxfail(bus, true, (bus->bus != SPI_BUS));4210 brcmf_sdbrcm_rxfail(bus, true,
3783 dhdsdio_pktfree2(bus, pkt);4211 bus->bus != SPI_BUS);
4212 brcmf_sdbrcm_pktfree2(bus, pkt);
3784 continue;4213 continue;
3785 }4214 }
3786 4215
@@ -3798,12 +4227,13 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 11 unmodified lines
3798 bus->rxhdr[SDPCM_FRAMETAG_LEN +4227 bus->rxhdr[SDPCM_FRAMETAG_LEN +
3799 SDPCM_NEXTLEN_OFFSET];4228 SDPCM_NEXTLEN_OFFSET];
3800 if ((bus->nextlen << 4) > MAX_RX_DATASZ) {4229 if ((bus->nextlen << 4) > MAX_RX_DATASZ) {
3801 DHD_INFO(("%s (nextlen): got frame w/nextlen too large" " (%d), seq %d\n",4230 BRCMF_INFO(("%s (nextlen): got frame w/nextlen"
3802 __func__, bus->nextlen, seq));4231 " too large (%d), seq %d\n",
4232 __func__, bus->nextlen, seq));
3803 bus->nextlen = 0;4233 bus->nextlen = 0;
3804 }4234 }
3805 4235
3806 bus->dhd->rx_readahead_cnt++;4236 bus->drvr->rx_readahead_cnt++;
3807 4237
3808 /* Handle Flow Control */4238 /* Handle Flow Control */
3809 fcbits = SDPCM_FCMASK_VALUE(4239 fcbits = SDPCM_FCMASK_VALUE(
@@ -3822,27 +4252,27 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 12 unmodified lines
3822 4252
3823 /* Check and update sequence number */4253 /* Check and update sequence number */
3824 if (rxseq != seq) {4254 if (rxseq != seq) {
3825 DHD_INFO(("%s (nextlen): rx_seq %d, expected "4255 BRCMF_INFO(("%s (nextlen): rx_seq %d, expected "
3826 "%d\n", __func__, seq, rxseq));4256 "%d\n", __func__, seq, rxseq));
3827 bus->rx_badseq++;4257 bus->rx_badseq++;
3828 rxseq = seq;4258 rxseq = seq;
3829 }4259 }
3830 4260
3831 /* Check window for sanity */4261 /* Check window for sanity */
3832 if ((u8) (txmax - bus->tx_seq) > 0x40) {4262 if ((u8) (txmax - bus->tx_seq) > 0x40) {
3833 DHD_ERROR(("%s: got unlikely tx max %d with "4263 BRCMF_ERROR(("%s: got unlikely tx max %d with "
3834 "tx_seq %d\n",4264 "tx_seq %d\n",
3835 __func__, txmax, bus->tx_seq));4265 __func__, txmax, bus->tx_seq));
3836 txmax = bus->tx_seq + 2;4266 txmax = bus->tx_seq + 2;
3837 }4267 }
3838 bus->tx_max = txmax;4268 bus->tx_max = txmax;
3839 4269
3840#ifdef DHD_DEBUG4270#ifdef BCMDBG
3841 if (DHD_BYTES_ON() && DHD_DATA_ON()) {4271 if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) {
3842 printk(KERN_DEBUG "Rx Data:\n");4272 printk(KERN_DEBUG "Rx Data:\n");
3843 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,4273 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
3844 rxbuf, len);4274 rxbuf, len);
3845 } else if (DHD_HDRS_ON()) {4275 } else if (BRCMF_HDRS_ON()) {
3846 printk(KERN_DEBUG "RxHdr:\n");4276 printk(KERN_DEBUG "RxHdr:\n");
3847 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,4277 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
3848 bus->rxhdr, SDPCM_HDRLEN);4278 bus->rxhdr, SDPCM_HDRLEN);
@@ -3851,31 +4281,35 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 2 unmodified lines
3851 4281
3852 if (chan == SDPCM_CONTROL_CHANNEL) {4282 if (chan == SDPCM_CONTROL_CHANNEL) {
3853 if (bus->bus == SPI_BUS) {4283 if (bus->bus == SPI_BUS) {
3854 dhdsdio_read_control(bus, rxbuf, len,4284 brcmf_sdbrcm_read_control(bus, rxbuf,
3855 doff);4285 len, doff);
3856 } else {4286 } else {
3857 DHD_ERROR(("%s (nextlen): readahead on control" " packet %d?\n",4287 BRCMF_ERROR(("%s (nextlen): readahead"
3858 __func__, seq));4288 " on control packet %d?\n",
4289 __func__, seq));
3859 /* Force retry w/normal header read */4290 /* Force retry w/normal header read */
3860 bus->nextlen = 0;4291 bus->nextlen = 0;
3861 dhdsdio_rxfail(bus, false, true);4292 brcmf_sdbrcm_rxfail(bus, false, true);
3862 }4293 }
3863 dhdsdio_pktfree2(bus, pkt);4294 brcmf_sdbrcm_pktfree2(bus, pkt);
3864 continue;4295 continue;
3865 }4296 }
3866 4297
3867 if ((bus->bus == SPI_BUS) && !bus->usebufpool) {4298 if ((bus->bus == SPI_BUS) && !bus->usebufpool) {
3868 DHD_ERROR(("Received %d bytes on %d channel. Running out of " "rx pktbuf's or not yet malloced.\n",4299 BRCMF_ERROR(("Received %d bytes on %d channel."
3869 len, chan));4300 " Running out of " "rx pktbuf's or"
4301 " not yet malloced.\n",
4302 len, chan));
3870 continue;4303 continue;
3871 }4304 }
3872 4305
3873 /* Validate data offset */4306 /* Validate data offset */
3874 if ((doff < SDPCM_HDRLEN) || (doff > len)) {4307 if ((doff < SDPCM_HDRLEN) || (doff > len)) {
3875 DHD_ERROR(("%s (nextlen): bad data offset %d: HW len %d min %d\n",4308 BRCMF_ERROR(("%s (nextlen): bad data offset %d:"
3876 __func__, doff, len, SDPCM_HDRLEN));4309 " HW len %d min %d\n", __func__,
3877 dhdsdio_rxfail(bus, false, false);4310 doff, len, SDPCM_HDRLEN));
3878 dhdsdio_pktfree2(bus, pkt);4311 brcmf_sdbrcm_rxfail(bus, false, false);
4312 brcmf_sdbrcm_pktfree2(bus, pkt);
3879 continue;4313 continue;
3880 }4314 }
3881 4315
@@ -3887,21 +4321,21 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 5 unmodified lines
3887 break;4321 break;
3888 4322
3889 /* Read frame header (hardware and software) */4323 /* Read frame header (hardware and software) */
3890 sdret = bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh),4324 sdret = brcmf_sdcard_recv_buf(card,
4325 brcmf_sdcard_cur_sbwad(card),
3891 SDIO_FUNC_2, F2SYNC, bus->rxhdr, firstread,4326 SDIO_FUNC_2, F2SYNC, bus->rxhdr, firstread,
3892 NULL, NULL, NULL);4327 NULL, NULL, NULL);
3893 bus->f2rxhdrs++;4328 bus->f2rxhdrs++;
3894 ASSERT(sdret != -BCME_PENDING);
3895 4329
3896 if (sdret < 0) {4330 if (sdret < 0) {
3897 DHD_ERROR(("%s: RXHEADER FAILED: %d\n", __func__,4331 BRCMF_ERROR(("%s: RXHEADER FAILED: %d\n", __func__,
3898 sdret));4332 sdret));
3899 bus->rx_hdrfail++;4333 bus->rx_hdrfail++;
3900 dhdsdio_rxfail(bus, true, true);

3104 more lines aren’t shown here.

drivers/staging/brcm80211/brcmfmac/dhdioctl.h+0−100
@@ -1,100 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _dhdioctl_h_
18#define _dhdioctl_h_
19
20/* Linux network driver ioctl encoding */
21typedef struct dhd_ioctl {
22 uint cmd; /* common ioctl definition */
23 void *buf; /* pointer to user buffer */
24 uint len; /* length of user buffer */
25 bool set; /* get or set request (optional) */
26 uint used; /* bytes read or written (optional) */
27 uint needed; /* bytes needed (optional) */
28 uint driver; /* to identify target driver */
29} dhd_ioctl_t;
30
31/* per-driver magic numbers */
32#define DHD_IOCTL_MAGIC 0x00444944
33
34/* bump this number if you change the ioctl interface */
35#define DHD_IOCTL_VERSION 1
36
37#define DHD_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */
38#define DHD_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */
39
40/* common ioctl definitions */
41#define DHD_GET_MAGIC 0
42#define DHD_GET_VERSION 1
43#define DHD_GET_VAR 2
44#define DHD_SET_VAR 3
45
46/* message levels */
47#define DHD_ERROR_VAL 0x0001
48#define DHD_TRACE_VAL 0x0002
49#define DHD_INFO_VAL 0x0004
50#define DHD_DATA_VAL 0x0008
51#define DHD_CTL_VAL 0x0010
52#define DHD_TIMER_VAL 0x0020
53#define DHD_HDRS_VAL 0x0040
54#define DHD_BYTES_VAL 0x0080
55#define DHD_INTR_VAL 0x0100
56#define DHD_LOG_VAL 0x0200
57#define DHD_GLOM_VAL 0x0400
58#define DHD_EVENT_VAL 0x0800
59#define DHD_BTA_VAL 0x1000
60#define DHD_ISCAN_VAL 0x2000
61
62#ifdef SDTEST
63/* For pktgen iovar */
64typedef struct dhd_pktgen {
65 uint version; /* To allow structure change tracking */
66 uint freq; /* Max ticks between tx/rx attempts */
67 uint count; /* Test packets to send/rcv each attempt */
68 uint print; /* Print counts every <print> attempts */
69 uint total; /* Total packets (or bursts) */
70 uint minlen; /* Minimum length of packets to send */
71 uint maxlen; /* Maximum length of packets to send */
72 uint numsent; /* Count of test packets sent */
73 uint numrcvd; /* Count of test packets received */
74 uint numfail; /* Count of test send failures */
75 uint mode; /* Test mode (type of test packets) */
76 uint stop; /* Stop after this many tx failures */
77} dhd_pktgen_t;
78
79/* Version in case structure changes */
80#define DHD_PKTGEN_VERSION 2
81
82/* Type of test packets to use */
83#define DHD_PKTGEN_ECHO 1 /* Send echo requests */
84#define DHD_PKTGEN_SEND 2 /* Send discard packets */
85#define DHD_PKTGEN_RXBURST 3 /* Request dongle send N packets */
86#define DHD_PKTGEN_RECV 4 /* Continuous rx from continuous
87 tx dongle */
88#endif /* SDTEST */
89
90/* Enter idle immediately (no timeout) */
91#define DHD_IDLE_IMMEDIATE (-1)
92
93/* Values for idleclock iovar: other values are the sd_divisor to use
94 when idle */
95#define DHD_IDLE_ACTIVE 0 /* Do not request any SD clock change
96 when idle */
97#define DHD_IDLE_STOP (-1) /* Request SD clock be stopped
98 (and use SD1 mode) */
99
100#endif /* _dhdioctl_h_ */
drivers/staging/brcm80211/brcmfmac/dngl_stats.h+0−32
@@ -1,32 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _dngl_stats_h_
18#define _dngl_stats_h_
19
20typedef struct {
21 unsigned long rx_packets; /* total packets received */
22 unsigned long tx_packets; /* total packets transmitted */
23 unsigned long rx_bytes; /* total bytes received */
24 unsigned long tx_bytes; /* total bytes transmitted */
25 unsigned long rx_errors; /* bad packets received */
26 unsigned long tx_errors; /* packet transmit problems */
27 unsigned long rx_dropped; /* packets dropped by dongle */
28 unsigned long tx_dropped; /* packets dropped by dongle */
29 unsigned long multicast; /* multicast packets received */
30} dngl_stats_t;
31
32#endif /* _dngl_stats_h_ */
drivers/staging/brcm80211/brcmfmac/hndrte_armtrap.h+0−75
@@ -1,75 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _hndrte_armtrap_h
18#define _hndrte_armtrap_h
19
20/* ARM trap handling */
21
22/* Trap types defined by ARM (see arminc.h) */
23
24/* Trap locations in lo memory */
25#define TRAP_STRIDE 4
26#define FIRST_TRAP TR_RST
27#define LAST_TRAP (TR_FIQ * TRAP_STRIDE)
28
29#if defined(__ARM_ARCH_4T__)
30#define MAX_TRAP_TYPE (TR_FIQ + 1)
31#elif defined(__ARM_ARCH_7M__)
32#define MAX_TRAP_TYPE (TR_ISR + ARMCM3_NUMINTS)
33#endif /* __ARM_ARCH_7M__ */
34
35/* The trap structure is defined here as offsets for assembly */
36#define TR_TYPE 0x00
37#define TR_EPC 0x04
38#define TR_CPSR 0x08
39#define TR_SPSR 0x0c
40#define TR_REGS 0x10
41#define TR_REG(n) (TR_REGS + (n) * 4)
42#define TR_SP TR_REG(13)
43#define TR_LR TR_REG(14)
44#define TR_PC TR_REG(15)
45
46#define TRAP_T_SIZE 80
47
48#ifndef _LANGUAGE_ASSEMBLY
49
50typedef struct _trap_struct {
51 u32 type;
52 u32 epc;
53 u32 cpsr;
54 u32 spsr;
55 u32 r0;
56 u32 r1;
57 u32 r2;
58 u32 r3;
59 u32 r4;
60 u32 r5;
61 u32 r6;
62 u32 r7;
63 u32 r8;
64 u32 r9;
65 u32 r10;
66 u32 r11;
67 u32 r12;
68 u32 r13;
69 u32 r14;
70 u32 pc;
71} trap_t;
72
73#endif /* !_LANGUAGE_ASSEMBLY */
74
75#endif /* _hndrte_armtrap_h */
drivers/staging/brcm80211/brcmfmac/hndrte_cons.h+0−62
@@ -1,62 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16#ifndef _hndrte_cons_h
17#define _hndrte_cons_h
18
19#define CBUF_LEN (128)
20
21#define LOG_BUF_LEN 1024
22
23typedef struct {
24 u32 buf; /* Can't be pointer on (64-bit) hosts */
25 uint buf_size;
26 uint idx;
27 char *_buf_compat; /* Redundant pointer for backward compat. */
28} hndrte_log_t;
29
30typedef struct {
31 /* Virtual UART
32 * When there is no UART (e.g. Quickturn),
33 * the host should write a complete
34 * input line directly into cbuf and then write
35 * the length into vcons_in.
36 * This may also be used when there is a real UART
37 * (at risk of conflicting with
38 * the real UART). vcons_out is currently unused.
39 */
40 volatile uint vcons_in;
41 volatile uint vcons_out;
42
43 /* Output (logging) buffer
44 * Console output is written to a ring buffer log_buf at index log_idx.
45 * The host may read the output when it sees log_idx advance.
46 * Output will be lost if the output wraps around faster than the host
47 * polls.
48 */
49 hndrte_log_t log;
50
51 /* Console input line buffer
52 * Characters are read one at a time into cbuf
53 * until <CR> is received, then
54 * the buffer is processed as a command line.
55 * Also used for virtual UART.
56 */
57 uint cbuf_idx;
58 char cbuf[CBUF_LEN];
59} hndrte_cons_t;
60
61#endif /* _hndrte_cons_h */
62
drivers/staging/brcm80211/brcmfmac/msgtrace.h+0−61
@@ -1,61 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _MSGTRACE_H
18#define _MSGTRACE_H
19
20#define MSGTRACE_VERSION 1
21
22/* Message trace header */
23typedef struct msgtrace_hdr {
24 u8 version;
25 u8 spare;
26 u16 len; /* Len of the trace */
27 u32 seqnum; /* Sequence number of message. Useful
28 * if the messsage has been lost
29 * because of DMA error or a bus reset
30 * (ex: SDIO Func2)
31 */
32 u32 discarded_bytes; /* Number of discarded bytes because of
33 trace overflow */
34 u32 discarded_printf; /* Number of discarded printf
35 because of trace overflow */
36} __attribute__((packed)) msgtrace_hdr_t;
37
38#define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t)
39
40/* The hbus driver generates traces when sending a trace message.
41 * This causes endless traces.
42 * This flag must be set to true in any hbus traces.
43 * The flag is reset in the function msgtrace_put.
44 * This prevents endless traces but generates hasardous
45 * lost of traces only in bus device code.
46 * It is recommendat to set this flag in macro SD_TRACE
47 * but not in SD_ERROR for avoiding missing
48 * hbus error traces. hbus error trace should not generates endless traces.
49 */
50extern bool msgtrace_hbus_trace;
51
52typedef void (*msgtrace_func_send_t) (void *hdl1, void *hdl2, u8 *hdr,
53 u16 hdrlen, u8 *buf,
54 u16 buflen);
55
56extern void msgtrace_sent(void);
57extern void msgtrace_put(char *buf, int count);
58extern void msgtrace_init(void *hdl1, void *hdl2,
59 msgtrace_func_send_t func_send);
60
61#endif /* _MSGTRACE_H */
drivers/staging/brcm80211/brcmfmac/sdio_host.h+347−0
@@ -0,0 +1,347 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _BRCM_SDH_H_
18#define _BRCM_SDH_H_
19
20#include <linux/skbuff.h>
21extern const uint brcmf_sdio_msglevel;
22
23#define SDIO_FUNC_0 0
24#define SDIO_FUNC_1 1
25#define SDIO_FUNC_2 2
26
27#define SDIOD_FBR_SIZE 0x100
28
29/* io_en */
30#define SDIO_FUNC_ENABLE_1 0x02
31#define SDIO_FUNC_ENABLE_2 0x04
32
33/* io_rdys */
34#define SDIO_FUNC_READY_1 0x02
35#define SDIO_FUNC_READY_2 0x04
36
37/* intr_status */
38#define INTR_STATUS_FUNC1 0x2
39#define INTR_STATUS_FUNC2 0x4
40
41/* Maximum number of I/O funcs */
42#define SDIOD_MAX_IOFUNCS 7
43
44#define SBSDIO_NUM_FUNCTION 3 /* as of sdiod rev 0, supports 3 functions */
45
46/* function 1 miscellaneous registers */
47#define SBSDIO_SPROM_CS 0x10000 /* sprom command and status */
48#define SBSDIO_SPROM_INFO 0x10001 /* sprom info register */
49#define SBSDIO_SPROM_DATA_LOW 0x10002 /* sprom indirect access data byte 0 */
50#define SBSDIO_SPROM_DATA_HIGH 0x10003 /* sprom indirect access data byte 1 */
51#define SBSDIO_SPROM_ADDR_LOW 0x10004 /* sprom indirect access addr byte 0 */
52#define SBSDIO_SPROM_ADDR_HIGH 0x10005 /* sprom indirect access addr byte 0 */
53#define SBSDIO_CHIP_CTRL_DATA 0x10006 /* xtal_pu (gpio) output */
54#define SBSDIO_CHIP_CTRL_EN 0x10007 /* xtal_pu (gpio) enable */
55#define SBSDIO_WATERMARK 0x10008 /* rev < 7, watermark for sdio device */
56#define SBSDIO_DEVICE_CTL 0x10009 /* control busy signal generation */
57
58/* registers introduced in rev 8, some content (mask/bits) defs in sbsdpcmdev.h */
59#define SBSDIO_FUNC1_SBADDRLOW 0x1000A /* SB Address Window Low (b15) */
60#define SBSDIO_FUNC1_SBADDRMID 0x1000B /* SB Address Window Mid (b23:b16) */
61#define SBSDIO_FUNC1_SBADDRHIGH 0x1000C /* SB Address Window High (b31:b24) */
62#define SBSDIO_FUNC1_FRAMECTRL 0x1000D /* Frame Control (frame term/abort) */
63#define SBSDIO_FUNC1_CHIPCLKCSR 0x1000E /* ChipClockCSR (ALP/HT ctl/status) */
64#define SBSDIO_FUNC1_SDIOPULLUP 0x1000F /* SdioPullUp (on cmd, d0-d2) */
65#define SBSDIO_FUNC1_WFRAMEBCLO 0x10019 /* Write Frame Byte Count Low */
66#define SBSDIO_FUNC1_WFRAMEBCHI 0x1001A /* Write Frame Byte Count High */
67#define SBSDIO_FUNC1_RFRAMEBCLO 0x1001B /* Read Frame Byte Count Low */
68#define SBSDIO_FUNC1_RFRAMEBCHI 0x1001C /* Read Frame Byte Count High */
69
70#define SBSDIO_FUNC1_MISC_REG_START 0x10000 /* f1 misc register start */
71#define SBSDIO_FUNC1_MISC_REG_LIMIT 0x1001C /* f1 misc register end */
72
73/* function 1 OCP space */
74#define SBSDIO_SB_OFT_ADDR_MASK 0x07FFF /* sb offset addr is <= 15 bits, 32k */
75#define SBSDIO_SB_OFT_ADDR_LIMIT 0x08000
76#define SBSDIO_SB_ACCESS_2_4B_FLAG 0x08000 /* with b15, maps to 32-bit SB access */
77
78/* some duplication with sbsdpcmdev.h here */
79/* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */
80#define SBSDIO_SBADDRLOW_MASK 0x80 /* Valid bits in SBADDRLOW */
81#define SBSDIO_SBADDRMID_MASK 0xff /* Valid bits in SBADDRMID */
82#define SBSDIO_SBADDRHIGH_MASK 0xffU /* Valid bits in SBADDRHIGH */
83#define SBSDIO_SBWINDOW_MASK 0xffff8000 /* Address bits from SBADDR regs */
84
85#define SDIOH_READ 0 /* Read request */
86#define SDIOH_WRITE 1 /* Write request */
87
88#define SDIOH_DATA_FIX 0 /* Fixed addressing */
89#define SDIOH_DATA_INC 1 /* Incremental addressing */
90
91/* internal return code */
92#define SUCCESS 0
93#define ERROR 1
94
95/* forward declarations */
96struct brcmf_sdio_card;
97
98struct brcmf_sdreg {
99 int func;
100 int offset;
101 int value;
102};
103
104struct sdioh_info {
105 struct osl_info *osh; /* osh handler */
106 bool client_intr_enabled; /* interrupt connnected flag */
107 bool intr_handler_valid; /* client driver interrupt handler valid */
108 void (*intr_handler)(void *); /* registered interrupt handler */
109 void *intr_handler_arg; /* argument to call interrupt handler */
110 u16 intmask; /* Current active interrupts */
111 void *sdos_info; /* Pointer to per-OS private data */
112
113 uint irq; /* Client irq */
114 int intrcount; /* Client interrupts */
115 bool sd_blockmode; /* sd_blockmode == false => 64 Byte Cmd 53s. */
116 /* Must be on for sd_multiblock to be effective */
117 bool use_client_ints; /* If this is false, make sure to restore */
118 int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
119 u8 num_funcs; /* Supported funcs on client */
120 u32 com_cis_ptr;
121 u32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
122 uint max_dma_len;
123 uint max_dma_descriptors; /* DMA Descriptors supported by this controller. */
124 /* SDDMA_DESCRIPTOR SGList[32]; *//* Scatter/Gather DMA List */
125};
126
127struct brcmf_sdmmc_instance {
128 struct sdioh_info *sd;
129 struct sdio_func *func[SDIOD_MAX_IOFUNCS];
130 u32 host_claimed;
131};
132
133/* Attach and build an interface to the underlying SD host driver.
134 * - Allocates resources (structs, arrays, mem, OS handles, etc) needed by
135 * brcmf_sdcard.
136 * - Returns the sdio card handle and virtual address base for register access.
137 * The returned handle should be used in all subsequent calls, but the bcmsh
138 * implementation may maintain a single "default" handle (e.g. the first or
139 * most recent one) to enable single-instance implementations to pass NULL.
140 */
141extern struct brcmf_sdio_card*
142brcmf_sdcard_attach(void *cfghdl, u32 *regsva, uint irq);
143
144/* Detach - freeup resources allocated in attach */
145extern int brcmf_sdcard_detach(struct brcmf_sdio_card *card);
146
147/* Enable/disable SD interrupt */
148extern int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card);
149extern int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card);
150
151/* Register/deregister device interrupt handler. */
152extern int
153brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card,
154 void (*fn)(void *), void *argh);
155
156extern int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card);
157
158/* Access SDIO address space (e.g. CCCR) using CMD52 (single-byte interface).
159 * fn: function number
160 * addr: unmodified SDIO-space address
161 * data: data byte to write
162 * err: pointer to error code (or NULL)
163 */
164extern u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint func,
165 u32 addr, int *err);
166extern void brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint func,
167 u32 addr, u8 data, int *err);
168
169/* Read/Write 4bytes from/to cfg space */
170extern u32
171brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
172 u32 addr, int *err);
173
174extern void brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card,
175 uint fnc_num, u32 addr,
176 u32 data, int *err);
177
178/* Read CIS content for specified function.
179 * fn: function whose CIS is being requested (0 is common CIS)
180 * cis: pointer to memory location to place results
181 * length: number of bytes to read
182 * Internally, this routine uses the values from the cis base regs (0x9-0xB)
183 * to form an SDIO-space address to read the data from.
184 */
185extern int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func,
186 u8 *cis, uint length);
187
188/* Synchronous access to device (client) core registers via CMD53 to F1.
189 * addr: backplane address (i.e. >= regsva from attach)
190 * size: register width in bytes (2 or 4)
191 * data: data for register write
192 */
193extern u32
194brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size);
195
196extern u32
197brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
198 u32 data);
199
200/* Indicate if last reg read/write failed */
201extern bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card);
202
203/* Buffer transfer to/from device (client) core via cmd53.
204 * fn: function number
205 * addr: backplane address (i.e. >= regsva from attach)
206 * flags: backplane width, address increment, sync/async
207 * buf: pointer to memory data buffer
208 * nbytes: number of bytes to transfer to/from buf
209 * pkt: pointer to packet associated with buf (if any)
210 * complete: callback function for command completion (async only)
211 * handle: handle for completion callback (first arg in callback)
212 * Returns 0 or error code.
213 * NOTE: Async operation is not currently supported.
214 */
215extern int
216brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
217 uint flags, u8 *buf, uint nbytes, void *pkt,
218 void (*complete)(void *handle, int status,
219 bool sync_waiting),
220 void *handle);
221extern int
222brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
223 uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt,
224 void (*complete)(void *handle, int status,
225 bool sync_waiting),
226 void *handle);
227
228/* Flags bits */
229#define SDIO_REQ_4BYTE 0x1 /* Four-byte target (backplane) width (vs. two-byte) */
230#define SDIO_REQ_FIXED 0x2 /* Fixed address (FIFO) (vs. incrementing address) */
231#define SDIO_REQ_ASYNC 0x4 /* Async request (vs. sync request) */
232
233/* Pending (non-error) return code */
234#define BCME_PENDING 1
235
236/* Read/write to memory block (F1, no FIFO) via CMD53 (sync only).
237 * rw: read or write (0/1)
238 * addr: direct SDIO address
239 * buf: pointer to memory data buffer
240 * nbytes: number of bytes to transfer to/from buf
241 * Returns 0 or error code.
242 */
243extern int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr,
244 u8 *buf, uint nbytes);
245
246/* Issue an abort to the specified function */
247extern int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn);
248
249/* Returns the "Device ID" of target device on the SDIO bus. */
250extern int brcmf_sdcard_query_device(struct brcmf_sdio_card *card);
251
252/* Miscellaneous knob tweaker. */
253extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name,
254 void *params, int plen, void *arg, int len,
255 bool set);
256
257/* helper functions */
258
259/* callback functions */
260struct brcmf_sdioh_driver {
261 /* attach to device */
262 void *(*attach) (u16 vend_id, u16 dev_id, u16 bus, u16 slot,
263 u16 func, uint bustype, u32 regsva, void *param);
264 /* detach from device */
265 void (*detach) (void *ch);
266};
267
268struct sdioh_info;
269
270/* platform specific/high level functions */
271extern int brcmf_sdio_function_init(void);
272extern int brcmf_sdio_register(struct brcmf_sdioh_driver *driver);
273extern void brcmf_sdio_unregister(void);
274extern void brcmf_sdio_function_cleanup(void);
275extern int brcmf_sdio_probe(struct device *dev);
276extern int brcmf_sdio_remove(struct device *dev);
277
278/* Function to return current window addr */
279extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card);
280
281/* Allocate/init/free per-OS private data */
282extern int brcmf_sdioh_osinit(struct sdioh_info *sd);
283extern void brcmf_sdioh_osfree(struct sdioh_info *sd);
284
285/* Core interrupt enable/disable of device interrupts */
286extern void brcmf_sdioh_dev_intr_on(struct sdioh_info *sd);
287extern void brcmf_sdioh_dev_intr_off(struct sdioh_info *sd);
288
289/* attach, return handler on success, NULL if failed.
290 * The handler shall be provided by all subsequent calls. No local cache
291 * cfghdl points to the starting address of pci device mapped memory
292 */
293extern struct sdioh_info *brcmf_sdioh_attach(void *cfghdl, uint irq);
294extern int brcmf_sdioh_detach(struct sdioh_info *si);
295
296extern int
297brcmf_sdioh_interrupt_register(struct sdioh_info *si,
298 void (*sdioh_cb_fn)(void *), void *argh);
299
300extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *si);
301
302/* enable or disable SD interrupt */
303extern int
304brcmf_sdioh_interrupt_set(struct sdioh_info *si, bool enable_disable);
305
306/* read or write one byte using cmd52 */
307extern int
308brcmf_sdioh_request_byte(struct sdioh_info *si, uint rw, uint fnc, uint addr,
309 u8 *byte);
310
311/* read or write 2/4 bytes using cmd53 */
312extern int
313brcmf_sdioh_request_word(struct sdioh_info *si, uint cmd_type,
314 uint rw, uint fnc, uint addr,
315 u32 *word, uint nbyte);
316
317/* read or write any buffer using cmd53 */
318extern int
319brcmf_sdioh_request_buffer(struct sdioh_info *si, uint pio_dma,
320 uint fix_inc, uint rw, uint fnc_num,
321 u32 addr, uint regwidth,
322 u32 buflen, u8 *buffer, struct sk_buff *pkt);
323
324/* get cis data */
325extern int
326brcmf_sdioh_cis_read(struct sdioh_info *si, uint fuc, u8 *cis, u32 length);
327
328extern int
329brcmf_sdioh_cfg_read(struct sdioh_info *si, uint fuc, u32 addr, u8 *data);
330extern int
331brcmf_sdioh_cfg_write(struct sdioh_info *si, uint fuc, u32 addr, u8 *data);
332
333/* handle iovars */
334extern int brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,
335 void *params, int plen, void *arg, int len, bool set);
336
337/* Issue abort to the specified function and clear controller as needed */
338extern int brcmf_sdioh_abort(struct sdioh_info *si, uint fnc);
339
340/* Watchdog timer interface for pm ops */
341extern void brcmf_sdio_wdtmr_enable(bool enable);
342
343extern uint sd_msglevel; /* Debug message level */
344
345extern struct brcmf_sdmmc_instance *gInstance;
346
347#endif /* _BRCM_SDH_H_ */
drivers/staging/brcm80211/brcmfmac/sdioh.h+0−63
@@ -1,63 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _SDIOH_H
18#define _SDIOH_H
19
20#define SD_SysAddr 0x000
21#define SD_BlockSize 0x004
22#define SD_BlockCount 0x006
23#define SD_Arg0 0x008
24#define SD_Arg1 0x00A
25#define SD_TransferMode 0x00C
26#define SD_Command 0x00E
27#define SD_Response0 0x010
28#define SD_Response1 0x012
29#define SD_Response2 0x014
30#define SD_Response3 0x016
31#define SD_Response4 0x018
32#define SD_Response5 0x01A
33#define SD_Response6 0x01C
34#define SD_Response7 0x01E
35#define SD_BufferDataPort0 0x020
36#define SD_BufferDataPort1 0x022
37#define SD_PresentState 0x024
38#define SD_HostCntrl 0x028
39#define SD_PwrCntrl 0x029
40#define SD_BlockGapCntrl 0x02A
41#define SD_WakeupCntrl 0x02B
42#define SD_ClockCntrl 0x02C
43#define SD_TimeoutCntrl 0x02E
44#define SD_SoftwareReset 0x02F
45#define SD_IntrStatus 0x030
46#define SD_ErrorIntrStatus 0x032
47#define SD_IntrStatusEnable 0x034
48#define SD_ErrorIntrStatusEnable 0x036
49#define SD_IntrSignalEnable 0x038
50#define SD_ErrorIntrSignalEnable 0x03A
51#define SD_CMD12ErrorStatus 0x03C
52#define SD_Capabilities 0x040
53#define SD_Capabilities_Reserved 0x044
54#define SD_MaxCurCap 0x048
55#define SD_MaxCurCap_Reserved 0x04C
56#define SD_ADMA_SysAddr 0x58
57#define SD_SlotInterruptStatus 0x0FC
58#define SD_HostControllerVersion 0x0FE
59
60/* SD specific registers in PCI config space */
61#define SD_SlotInfo 0x40
62
63#endif /* _SDIOH_H */
drivers/staging/brcm80211/brcmfmac/sdiovar.h+0−38
@@ -1,38 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _sdiovar_h_
18#define _sdiovar_h_
19
20typedef struct sdreg {
21 int func;
22 int offset;
23 int value;
24} sdreg_t;
25
26/* Common msglevel constants */
27#define SDH_ERROR_VAL 0x0001 /* Error */
28#define SDH_TRACE_VAL 0x0002 /* Trace */
29#define SDH_INFO_VAL 0x0004 /* Info */
30#define SDH_DEBUG_VAL 0x0008 /* Debug */
31#define SDH_DATA_VAL 0x0010 /* Data */
32#define SDH_CTRL_VAL 0x0020 /* Control Regs */
33#define SDH_LOG_VAL 0x0040 /* Enable bcmlog */
34#define SDH_DMA_VAL 0x0080 /* DMA */
35
36#define NUM_PREV_TRANSACTIONS 16
37
38#endif /* _sdiovar_h_ */
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c+1102−1378
@@ -16,336 +16,325 @@ · 15 unmodified lines
16 16
17#include <linux/kernel.h>17#include <linux/kernel.h>
18#include <linux/if_arp.h>18#include <linux/if_arp.h>
19 19#include <linux/sched.h>
20#include <bcmutils.h>
21
22#include <asm/uaccess.h>
23
24#include <dngl_stats.h>
25#include <dhd.h>
26#include <dhdioctl.h>
27#include <wlioctl.h>
28
29#include <linux/kthread.h>20#include <linux/kthread.h>
30#include <linux/netdevice.h>21#include <linux/netdevice.h>
31#include <linux/sched.h>22#include <linux/sched.h>
32#include <linux/etherdevice.h>23#include <linux/etherdevice.h>
33#include <linux/wireless.h>24#include <linux/wireless.h>
34#include <linux/ieee80211.h>25#include <linux/ieee80211.h>
26#include <linux/mmc/sdio_func.h>
27#include <linux/uaccess.h>
35#include <net/cfg80211.h>28#include <net/cfg80211.h>
36
37#include <net/rtnetlink.h>29#include <net/rtnetlink.h>
38#include <linux/mmc/sdio_func.h>
39#include <linux/firmware.h>
40#include <wl_cfg80211.h>
41 30
42void sdioh_sdio_set_host_pm_flags(int flag);31#include <brcmu_utils.h>
32#include <defs.h>
33#include <brcmu_wifi.h>
34#include "dhd.h"
35#include "wl_cfg80211.h"
43 36
44static struct sdio_func *cfg80211_sdio_func;37static struct sdio_func *cfg80211_sdio_func;
45static struct wl_dev *wl_cfg80211_dev;38static struct brcmf_cfg80211_dev *cfg80211_dev;
46static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255};39static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255};
47 40
48u32 wl_dbg_level = WL_DBG_ERR;41u32 brcmf_dbg_level = WL_DBG_ERR;
49
50#define WL_4329_FW_FILE "brcm/bcm4329-fullmac-4.bin"
51#define WL_4329_NVRAM_FILE "brcm/bcm4329-fullmac-4.txt"
52 42
53/*43/*
54** cfg80211_ops api/callback list44** cfg80211_ops api/callback list
55*/45*/
56static s32 wl_cfg80211_change_iface(struct wiphy *wiphy,46static s32 brcmf_cfg80211_change_iface(struct wiphy *wiphy,
57 struct net_device *ndev,47 struct net_device *ndev,
58 enum nl80211_iftype type, u32 *flags,48 enum nl80211_iftype type, u32 *flags,
59 struct vif_params *params);49 struct vif_params *params);
60static s32 __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,50static s32 __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
61 struct cfg80211_scan_request *request,51 struct cfg80211_scan_request *request,
62 struct cfg80211_ssid *this_ssid);52 struct cfg80211_ssid *this_ssid);
63static s32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,53static s32 brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
64 struct cfg80211_scan_request *request);54 struct cfg80211_scan_request *request);
65static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed);55static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed);
66static s32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,56static s32 brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
67 struct cfg80211_ibss_params *params);57 struct cfg80211_ibss_params *params);
68static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy,58static s32 brcmf_cfg80211_leave_ibss(struct wiphy *wiphy,
69 struct net_device *dev);59 struct net_device *dev);
70static s32 wl_cfg80211_get_station(struct wiphy *wiphy,60static s32 brcmf_cfg80211_get_station(struct wiphy *wiphy,
71 struct net_device *dev, u8 *mac,61 struct net_device *dev, u8 *mac,
72 struct station_info *sinfo);62 struct station_info *sinfo);
73static s32 wl_cfg80211_set_power_mgmt(struct wiphy *wiphy,63static s32 brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy,
74 struct net_device *dev, bool enabled,64 struct net_device *dev, bool enabled,
75 s32 timeout);65 s32 timeout);
76static s32 wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy,66static s32 brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
77 struct net_device *dev,67 struct net_device *dev,
78 const u8 *addr,68 const u8 *addr,
79 const struct cfg80211_bitrate_mask69 const struct cfg80211_bitrate_mask
80 *mask);70 *mask);
81static int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,71static int brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
82 struct cfg80211_connect_params *sme);72 struct cfg80211_connect_params *sme);
83static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,73static s32 brcmf_cfg80211_disconnect(struct wiphy *wiphy,
84 u16 reason_code);74 struct net_device *dev,
85static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,75 u16 reason_code);
76static s32 brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
86 enum nl80211_tx_power_setting type,77 enum nl80211_tx_power_setting type,
87 s32 dbm);78 s32 dbm);
88static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);79static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
89static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,80static s32 brcmf_cfg80211_config_default_key(struct wiphy *wiphy,
90 struct net_device *dev, u8 key_idx,81 struct net_device *dev, u8 key_idx,
91 bool unicast, bool multicast);82 bool unicast, bool multicast);
92static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,83static s32 brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
93 u8 key_idx, bool pairwise, const u8 *mac_addr,84 u8 key_idx, bool pairwise, const u8 *mac_addr,
94 struct key_params *params);85 struct key_params *params);
95static s32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,86static s32 brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
96 u8 key_idx, bool pairwise, const u8 *mac_addr);87 u8 key_idx, bool pairwise, const u8 *mac_addr);
97static s32 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,88static s32 brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
98 u8 key_idx, bool pairwise, const u8 *mac_addr,89 u8 key_idx, bool pairwise, const u8 *mac_addr,
99 void *cookie, void (*callback) (void *cookie,90 void *cookie, void (*callback) (void *cookie,
100 struct91 struct
101 key_params *92 key_params *
102 params));93 params));
103static s32 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,94static s32 brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
104 struct net_device *dev,95 struct net_device *dev,
105 u8 key_idx);96 u8 key_idx);
106static s32 wl_cfg80211_resume(struct wiphy *wiphy);97static s32 brcmf_cfg80211_resume(struct wiphy *wiphy);
107static s32 wl_cfg80211_suspend(struct wiphy *wiphy);98static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
108static s32 wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,99 struct cfg80211_wowlan *wow);
100static s32 brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
109 struct cfg80211_pmksa *pmksa);101 struct cfg80211_pmksa *pmksa);
110static s32 wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,102static s32 brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
111 struct cfg80211_pmksa *pmksa);103 struct cfg80211_pmksa *pmksa);
112static s32 wl_cfg80211_flush_pmksa(struct wiphy *wiphy,104static s32 brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy,
113 struct net_device *dev);105 struct net_device *dev);
114/*106/*
115** event & event Q handlers for cfg80211 interfaces107** event & event Q handlers for cfg80211 interfaces
116*/108*/
117static s32 wl_create_event_handler(struct wl_priv *wl);109static s32 brcmf_create_event_handler(struct brcmf_cfg80211_priv *cfg_priv);
118static void wl_destroy_event_handler(struct wl_priv *wl);110static void brcmf_destroy_event_handler(struct brcmf_cfg80211_priv *cfg_priv);
119static s32 wl_event_handler(void *data);111static s32 brcmf_event_handler(void *data);
120static void wl_init_eq(struct wl_priv *wl);112static void brcmf_init_eq(struct brcmf_cfg80211_priv *cfg_priv);
121static void wl_flush_eq(struct wl_priv *wl);113static void brcmf_flush_eq(struct brcmf_cfg80211_priv *cfg_priv);
122static void wl_lock_eq(struct wl_priv *wl);114static void brcmf_lock_eq(struct brcmf_cfg80211_priv *cfg_priv);
123static void wl_unlock_eq(struct wl_priv *wl);115static void brcmf_unlock_eq(struct brcmf_cfg80211_priv *cfg_priv);
124static void wl_init_eq_lock(struct wl_priv *wl);116static void brcmf_init_eq_lock(struct brcmf_cfg80211_priv *cfg_priv);
125static void wl_init_eloop_handler(struct wl_event_loop *el);117static void brcmf_init_eloop_handler(struct brcmf_cfg80211_event_loop *el);
126static struct wl_event_q *wl_deq_event(struct wl_priv *wl);118static struct brcmf_cfg80211_event_q *
127static s32 wl_enq_event(struct wl_priv *wl, u32 type,119brcmf_deq_event(struct brcmf_cfg80211_priv *cfg_priv);
128 const wl_event_msg_t *msg, void *data);120static s32 brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 type,
129static void wl_put_event(struct wl_event_q *e);121 const struct brcmf_event_msg *msg, void *data);
130static void wl_wakeup_event(struct wl_priv *wl);122static void brcmf_put_event(struct brcmf_cfg80211_event_q *e);
131static s32 wl_notify_connect_status(struct wl_priv *wl,123static void brcmf_wakeup_event(struct brcmf_cfg80211_priv *cfg_priv);
132 struct net_device *ndev,124static s32 brcmf_notify_connect_status(struct brcmf_cfg80211_priv *cfg_priv,
133 const wl_event_msg_t *e, void *data);125 struct net_device *ndev,
134static s32 wl_notify_roaming_status(struct wl_priv *wl,126 const struct brcmf_event_msg *e,
135 struct net_device *ndev,127 void *data);
136 const wl_event_msg_t *e, void *data);128static s32 brcmf_notify_roaming_status(struct brcmf_cfg80211_priv *cfg_priv,
137static s32 wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev,129 struct net_device *ndev,
138 const wl_event_msg_t *e, void *data);130 const struct brcmf_event_msg *e,
139static s32 wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev,131 void *data);
140 const wl_event_msg_t *e, void *data,132static s32 brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
141 bool completed);133 struct net_device *ndev,
142static s32 wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev,134 const struct brcmf_event_msg *e,
143 const wl_event_msg_t *e, void *data);135 void *data);
144static s32 wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev,136static s32 brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv,
145 const wl_event_msg_t *e, void *data);137 struct net_device *ndev,
138 const struct brcmf_event_msg *e, void *data,
139 bool completed);
140static s32 brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv,
141 struct net_device *ndev,
142 const struct brcmf_event_msg *e, void *data);
143static s32 brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv,
144 struct net_device *ndev,
145 const struct brcmf_event_msg *e, void *data);
146 146
147/*147/*
148** register/deregister sdio function148** register/deregister sdio function
149*/149*/
150struct sdio_func *wl_cfg80211_get_sdio_func(void);150static void brcmf_clear_sdio_func(void);
151static void wl_clear_sdio_func(void);
152 151
153/*152/*
154** ioctl utilites153** ioctl utilites
155*/154*/
156static s32 wl_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf,155static s32 brcmf_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf,
157 s32 buf_len);156 s32 buf_len);
158static __used s32 wl_dev_bufvar_set(struct net_device *dev, s8 *name,157static __used s32 brcmf_dev_bufvar_set(struct net_device *dev, s8 *name,
159 s8 *buf, s32 len);158 s8 *buf, s32 len);
160static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val);159static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val);
161static s32 wl_dev_intvar_get(struct net_device *dev, s8 *name,160static s32 brcmf_dev_intvar_get(struct net_device *dev, s8 *name,
162 s32 *retval);161 s32 *retval);
163static s32 wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg,162static s32 brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg,
164 u32 len);163 u32 len);
165 164
166/*165/*
167** cfg80211 set_wiphy_params utilities166** cfg80211 set_wiphy_params utilities
168*/167*/
169static s32 wl_set_frag(struct net_device *dev, u32 frag_threshold);168static s32 brcmf_set_frag(struct net_device *dev, u32 frag_threshold);
170static s32 wl_set_rts(struct net_device *dev, u32 frag_threshold);169static s32 brcmf_set_rts(struct net_device *dev, u32 frag_threshold);
171static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l);170static s32 brcmf_set_retry(struct net_device *dev, u32 retry, bool l);
172 171
173/*172/*
174** wl profile utilities173** wl profile utilities
175*/174*/
176static s32 wl_update_prof(struct wl_priv *wl, const wl_event_msg_t *e,175static s32 brcmf_update_prof(struct brcmf_cfg80211_priv *cfg_priv,
177 void *data, s32 item);176 const struct brcmf_event_msg *e,
178static void *wl_read_prof(struct wl_priv *wl, s32 item);177 void *data, s32 item);
179static void wl_init_prof(struct wl_profile *prof);178static void *brcmf_read_prof(struct brcmf_cfg80211_priv *cfg_priv, s32 item);
179static void brcmf_init_prof(struct brcmf_cfg80211_profile *prof);
180 180
181/*181/*
182** cfg80211 connect utilites182** cfg80211 connect utilites
183*/183*/
184static s32 wl_set_wpa_version(struct net_device *dev,184static s32 brcmf_set_wpa_version(struct net_device *dev,
185 struct cfg80211_connect_params *sme);185 struct cfg80211_connect_params *sme);
186static s32 wl_set_auth_type(struct net_device *dev,186static s32 brcmf_set_auth_type(struct net_device *dev,
187 struct cfg80211_connect_params *sme);187 struct cfg80211_connect_params *sme);
188static s32 wl_set_set_cipher(struct net_device *dev,188static s32 brcmf_set_set_cipher(struct net_device *dev,
189 struct cfg80211_connect_params *sme);189 struct cfg80211_connect_params *sme);
190static s32 wl_set_key_mgmt(struct net_device *dev,190static s32 brcmf_set_key_mgmt(struct net_device *dev,
191 struct cfg80211_connect_params *sme);191 struct cfg80211_connect_params *sme);
192static s32 wl_set_set_sharedkey(struct net_device *dev,192static s32 brcmf_set_set_sharedkey(struct net_device *dev,
193 struct cfg80211_connect_params *sme);193 struct cfg80211_connect_params *sme);
194static s32 wl_get_assoc_ies(struct wl_priv *wl);194static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv);
195static void wl_clear_assoc_ies(struct wl_priv *wl);195static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv);
196static void wl_ch_to_chanspec(int ch,196static void brcmf_ch_to_chanspec(int ch,
197 struct wl_join_params *join_params, size_t *join_params_size);197 struct brcmf_join_params *join_params, size_t *join_params_size);
198 198
199/*199/*
200** information element utilities200** information element utilities
201*/201*/
202static __used s32 wl_add_ie(struct wl_priv *wl, u8 t, u8 l, u8 *v);202static __used s32 brcmf_add_ie(struct brcmf_cfg80211_priv *cfg_priv,
203static s32 wl_mode_to_nl80211_iftype(s32 mode);203 u8 t, u8 l, u8 *v);
204static struct wireless_dev *wl_alloc_wdev(s32 sizeof_iface,204static s32 brcmf_mode_to_nl80211_iftype(s32 mode);
205static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface,
205 struct device *dev);206 struct device *dev);
206static void wl_free_wdev(struct wl_priv *wl);207static void brcmf_free_wdev(struct brcmf_cfg80211_priv *cfg_priv);
207static s32 wl_inform_bss(struct wl_priv *wl);208static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv);
208static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi);209static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_priv *cfg_priv,
209static s32 wl_update_bss_info(struct wl_priv *wl);210 struct brcmf_bss_info *bi);
210static s32 wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,211static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv);
212static s32 brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
211 u8 key_idx, const u8 *mac_addr,213 u8 key_idx, const u8 *mac_addr,
212 struct key_params *params);214 struct key_params *params);
213 215
214/*216/*
215** key indianess swap utilities217** key indianess swap utilities
216*/218*/
217static void swap_key_from_BE(struct wl_wsec_key *key);219static void swap_key_from_BE(struct brcmf_wsec_key *key);
218static void swap_key_to_BE(struct wl_wsec_key *key);220static void swap_key_to_BE(struct brcmf_wsec_key *key);
219 221
220/*222/*
221** wl_priv memory init/deinit utilities223** brcmf_cfg80211_priv memory init/deinit utilities
222*/224*/
223static s32 wl_init_priv_mem(struct wl_priv *wl);225static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_priv *cfg_priv);
224static void wl_deinit_priv_mem(struct wl_priv *wl);226static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv);
225 227
226static void wl_delay(u32 ms);228static void brcmf_delay(u32 ms);
227 229
228/*230/*
229** store/restore cfg80211 instance data231** store/restore cfg80211 instance data
230*/232*/
231static void wl_set_drvdata(struct wl_dev *dev, void *data);233static void brcmf_set_drvdata(struct brcmf_cfg80211_dev *dev, void *data);
232static void *wl_get_drvdata(struct wl_dev *dev);234static void *brcmf_get_drvdata(struct brcmf_cfg80211_dev *dev);
233 235
234/*236/*
235** ibss mode utilities237** ibss mode utilities
236*/238*/
237static bool wl_is_ibssmode(struct wl_priv *wl);239static bool brcmf_is_ibssmode(struct brcmf_cfg80211_priv *cfg_priv);
238 240
239/*241/*
240** dongle up/down , default configuration utilities242** dongle up/down , default configuration utilities
241*/243*/
242static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e);244static bool brcmf_is_linkdown(struct brcmf_cfg80211_priv *cfg_priv,
243static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e);245 const struct brcmf_event_msg *e);
244static bool wl_is_nonetwork(struct wl_priv *wl, const wl_event_msg_t *e);246static bool brcmf_is_linkup(struct brcmf_cfg80211_priv *cfg_priv,
245static void wl_link_down(struct wl_priv *wl);247 const struct brcmf_event_msg *e);
246static s32 wl_dongle_mode(struct net_device *ndev, s32 iftype);248static bool brcmf_is_nonetwork(struct brcmf_cfg80211_priv *cfg_priv,
247static s32 __wl_cfg80211_up(struct wl_priv *wl);249 const struct brcmf_event_msg *e);
248static s32 __wl_cfg80211_down(struct wl_priv *wl);250static void brcmf_link_down(struct brcmf_cfg80211_priv *cfg_priv);
249static s32 wl_dongle_probecap(struct wl_priv *wl);251static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype);
250static void wl_init_conf(struct wl_conf *conf);252static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv);
253static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv);
254static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_priv *cfg_priv);
255static void brcmf_init_conf(struct brcmf_cfg80211_conf *conf);
251 256
252/*257/*
253** dongle configuration utilities258** dongle configuration utilities
254*/259*/
255#ifndef EMBEDDED_PLATFORM260static s32 brcmf_dongle_eventmsg(struct net_device *ndev);
256static s32 wl_dongle_mode(struct net_device *ndev, s32 iftype);261static s32 brcmf_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time,
257static s32 wl_dongle_country(struct net_device *ndev, u8 ccode);262 s32 scan_unassoc_time, s32 scan_passive_time);
258static s32 wl_dongle_up(struct net_device *ndev, u32 up);263static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
259static s32 wl_dongle_power(struct net_device *ndev, u32 power_mode);264 bool need_lock);
260static s32 wl_dongle_glom(struct net_device *ndev, u32 glom,265static s32 brcmf_dongle_roam(struct net_device *ndev, u32 roamvar,
261 u32 dongle_align);
262static s32 wl_dongle_offload(struct net_device *ndev, s32 arpoe,
263 s32 arp_ol);
264static s32 wl_pattern_atoh(s8 *src, s8 *dst);
265static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode);
266static s32 wl_update_wiphybands(struct wl_priv *wl);
267#endif /* !EMBEDDED_PLATFORM */
268
269static s32 wl_dongle_eventmsg(struct net_device *ndev);
270static s32 wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time,
271 s32 scan_unassoc_time, s32 scan_passive_time);
272static s32 wl_config_dongle(struct wl_priv *wl, bool need_lock);
273static s32 wl_dongle_roam(struct net_device *ndev, u32 roamvar,
274 u32 bcn_timeout);266 u32 bcn_timeout);
275 267
276/*268/*
277** iscan handler269** iscan handler
278*/270*/
279static void wl_iscan_timer(unsigned long data);271static void brcmf_iscan_timer(unsigned long data);
280static void wl_term_iscan(struct wl_priv *wl);272static void brcmf_term_iscan(struct brcmf_cfg80211_priv *cfg_priv);
281static s32 wl_init_iscan(struct wl_priv *wl);273static s32 brcmf_init_iscan(struct brcmf_cfg80211_priv *cfg_priv);
282static s32 wl_iscan_thread(void *data);274static s32 brcmf_iscan_thread(void *data);
283static s32 wl_dev_iovar_setbuf(struct net_device *dev, s8 *iovar,275static s32 brcmf_dev_iovar_setbuf(struct net_device *dev, s8 *iovar,
284 void *param, s32 paramlen, void *bufptr,276 void *param, s32 paramlen, void *bufptr,
285 s32 buflen);277 s32 buflen);
286static s32 wl_dev_iovar_getbuf(struct net_device *dev, s8 *iovar,278static s32 brcmf_dev_iovar_getbuf(struct net_device *dev, s8 *iovar,
287 void *param, s32 paramlen, void *bufptr,279 void *param, s32 paramlen, void *bufptr,
288 s32 buflen);280 s32 buflen);
289static s32 wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid,281static s32 brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
290 u16 action);282 struct brcmf_ssid *ssid, u16 action);
291static s32 wl_do_iscan(struct wl_priv *wl);283static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv);
292static s32 wl_wakeup_iscan(struct wl_iscan_ctrl *iscan);284static s32 brcmf_wakeup_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan);
293static s32 wl_invoke_iscan(struct wl_priv *wl);285static s32 brcmf_invoke_iscan(struct brcmf_cfg80211_priv *cfg_priv);
294static s32 wl_get_iscan_results(struct wl_iscan_ctrl *iscan, u32 *status,286static s32 brcmf_get_iscan_results(struct brcmf_cfg80211_iscan_ctrl *iscan,
295 struct wl_scan_results **bss_list);287 u32 *status,
296static void wl_notify_iscan_complete(struct wl_iscan_ctrl *iscan, bool aborted);288 struct brcmf_scan_results **bss_list);
297static void wl_init_iscan_eloop(struct wl_iscan_eloop *el);289static void brcmf_notify_iscan_complete(struct brcmf_cfg80211_iscan_ctrl *iscan,
298static s32 wl_iscan_done(struct wl_priv *wl);290 bool aborted);
299static s32 wl_iscan_pending(struct wl_priv *wl);291static void brcmf_init_iscan_eloop(struct brcmf_cfg80211_iscan_eloop *el);
300static s32 wl_iscan_inprogress(struct wl_priv *wl);292static s32 brcmf_iscan_done(struct brcmf_cfg80211_priv *cfg_priv);
301static s32 wl_iscan_aborted(struct wl_priv *wl);293static s32 brcmf_iscan_pending(struct brcmf_cfg80211_priv *cfg_priv);
302 294static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv);
303/*295static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv);
304** fw/nvram downloading handler
305*/
306static void wl_init_fw(struct wl_fw_ctrl *fw);
307 296
308/*297/*
309* find most significant bit set298* find most significant bit set
310*/299*/
311static __used u32 wl_find_msb(u16 bit16);300static __used u32 brcmf_find_msb(u16 bit16);
312 301
313/*302/*
314* update pmklist to dongle303* update pmklist to dongle
315*/304*/
316static __used s32 wl_update_pmklist(struct net_device *dev,305static __used s32 brcmf_update_pmklist(struct net_device *dev,
317 struct wl_pmk_list *pmk_list, s32 err);306 struct brcmf_cfg80211_pmk_list *pmk_list,
307 s32 err);
318 308
319static void wl_set_mpc(struct net_device *ndev, int mpc);309static void brcmf_set_mpc(struct net_device *ndev, int mpc);
320 310
321/*311/*
322* debufs support312* debufs support
323*/313*/
324static int wl_debugfs_add_netdev_params(struct wl_priv *wl);314static int
325static void wl_debugfs_remove_netdev(struct wl_priv *wl);315brcmf_debugfs_add_netdev_params(struct brcmf_cfg80211_priv *cfg_priv);
316static void brcmf_debugfs_remove_netdev(struct brcmf_cfg80211_priv *cfg_priv);
326 317
327#define WL_PRIV_GET() \318#define WL_PRIV_GET() \
328 ({ \319 ({ \
329 struct wl_iface *ci; \320 struct brcmf_cfg80211_iface *ci = brcmf_get_drvdata(cfg80211_dev); \
330 if (unlikely(!(wl_cfg80211_dev && \321 if (unlikely(!ci)) { \
331 (ci = wl_get_drvdata(wl_cfg80211_dev))))) { \
332 WL_ERR("wl_cfg80211_dev is unavailable\n"); \322 WL_ERR("wl_cfg80211_dev is unavailable\n"); \
333 BUG(); \323 BUG(); \
334 } \324 } \
335 ci_to_wl(ci); \325 ci->cfg_priv; \
336})326})
337 327
338#define CHECK_SYS_UP() \328#define CHECK_SYS_UP() \
339do { \329do { \
340 struct wl_priv *wl = wiphy_to_wl(wiphy); \330 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); \
341 if (unlikely(!test_bit(WL_STATUS_READY, &wl->status))) { \331 if (unlikely(!test_bit(WL_STATUS_READY, &cfg_priv->status))) { \
342 WL_INFO("device is not ready : status (%d)\n", \332 WL_INFO("device is not ready : status (%d)\n", \
343 (int)wl->status); \333 (int)cfg_priv->status); \
344 return -EIO; \334 return -EIO; \
345 } \335 } \
346} while (0)336} while (0)
347 337
348extern int dhd_wait_pend8021x(struct net_device *dev);
349#define CHAN2G(_channel, _freq, _flags) { \338#define CHAN2G(_channel, _freq, _flags) { \
350 .band = IEEE80211_BAND_2GHZ, \339 .band = IEEE80211_BAND_2GHZ, \
351 .center_freq = (_freq), \340 .center_freq = (_freq), \
@@ -373,18 +362,18 @@ extern int dhd_wait_pend8021x(struct net_device *dev); · 21 unmodified lines
373 }362 }
374 363
375static struct ieee80211_rate __wl_rates[] = {364static struct ieee80211_rate __wl_rates[] = {
376 RATETAB_ENT(WLC_RATE_1M, 0),365 RATETAB_ENT(BRCM_RATE_1M, 0),
377 RATETAB_ENT(WLC_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE),366 RATETAB_ENT(BRCM_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE),
378 RATETAB_ENT(WLC_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE),367 RATETAB_ENT(BRCM_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE),
379 RATETAB_ENT(WLC_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE),368 RATETAB_ENT(BRCM_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE),
380 RATETAB_ENT(WLC_RATE_6M, 0),369 RATETAB_ENT(BRCM_RATE_6M, 0),
381 RATETAB_ENT(WLC_RATE_9M, 0),370 RATETAB_ENT(BRCM_RATE_9M, 0),
382 RATETAB_ENT(WLC_RATE_12M, 0),371 RATETAB_ENT(BRCM_RATE_12M, 0),
383 RATETAB_ENT(WLC_RATE_18M, 0),372 RATETAB_ENT(BRCM_RATE_18M, 0),
384 RATETAB_ENT(WLC_RATE_24M, 0),373 RATETAB_ENT(BRCM_RATE_24M, 0),
385 RATETAB_ENT(WLC_RATE_36M, 0),374 RATETAB_ENT(BRCM_RATE_36M, 0),
386 RATETAB_ENT(WLC_RATE_48M, 0),375 RATETAB_ENT(BRCM_RATE_48M, 0),
387 RATETAB_ENT(WLC_RATE_54M, 0),376 RATETAB_ENT(BRCM_RATE_54M, 0),
388};377};
389 378
390#define wl_a_rates (__wl_rates + 4)379#define wl_a_rates (__wl_rates + 4)
@@ -521,7 +510,7 @@ static const u32 __wl_cipher_suites[] = { · 130 unmodified lines
521 WLAN_CIPHER_SUITE_AES_CMAC,510 WLAN_CIPHER_SUITE_AES_CMAC,
522};511};
523 512
524static void swap_key_from_BE(struct wl_wsec_key *key)513static void swap_key_from_BE(struct brcmf_wsec_key *key)
525{514{
526 key->index = cpu_to_le32(key->index);515 key->index = cpu_to_le32(key->index);
527 key->len = cpu_to_le32(key->len);516 key->len = cpu_to_le32(key->len);
@@ -532,7 +521,7 @@ static void swap_key_from_BE(struct wl_wsec_key *key) · 4 unmodified lines
532 key->iv_initialized = cpu_to_le32(key->iv_initialized);521 key->iv_initialized = cpu_to_le32(key->iv_initialized);
533}522}
534 523
535static void swap_key_to_BE(struct wl_wsec_key *key)524static void swap_key_to_BE(struct brcmf_wsec_key *key)
536{525{
537 key->index = le32_to_cpu(key->index);526 key->index = le32_to_cpu(key->index);
538 key->len = le32_to_cpu(key->len);527 key->len = le32_to_cpu(key->len);
@@ -544,10 +533,10 @@ static void swap_key_to_BE(struct wl_wsec_key *key) · 5 unmodified lines
544}533}
545 534
546static s32535static s32
547wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)536brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
548{537{
549 struct ifreq ifr;538 struct ifreq ifr;
550 struct wl_ioctl ioc;539 struct brcmf_ioctl ioc;
551 mm_segment_t fs;540 mm_segment_t fs;
552 s32 err = 0;541 s32 err = 0;
553 542
@@ -567,11 +556,11 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len) · 13 unmodified lines
567}556}
568 557
569static s32558static s32
570wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,559brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
571 enum nl80211_iftype type, u32 *flags,560 enum nl80211_iftype type, u32 *flags,
572 struct vif_params *params)561 struct vif_params *params)
573{562{
574 struct wl_priv *wl = wiphy_to_wl(wiphy);563 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
575 struct wireless_dev *wdev;564 struct wireless_dev *wdev;
576 s32 infra = 0;565 s32 infra = 0;
577 s32 err = 0;566 s32 err = 0;
@@ -586,11 +575,11 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, · 8 unmodified lines
586 type);575 type);
587 return -EOPNOTSUPP;576 return -EOPNOTSUPP;
588 case NL80211_IFTYPE_ADHOC:577 case NL80211_IFTYPE_ADHOC:
589 wl->conf->mode = WL_MODE_IBSS;578 cfg_priv->conf->mode = WL_MODE_IBSS;
590 infra = 0;579 infra = 0;
591 break;580 break;
592 case NL80211_IFTYPE_STATION:581 case NL80211_IFTYPE_STATION:
593 wl->conf->mode = WL_MODE_BSS;582 cfg_priv->conf->mode = WL_MODE_BSS;
594 infra = 1;583 infra = 1;
595 break;584 break;
596 default:585 default:
@@ -599,7 +588,7 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines
599 }588 }
600 589
601 infra = cpu_to_le32(infra);590 infra = cpu_to_le32(infra);
602 err = wl_dev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(infra));591 err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_INFRA, &infra, sizeof(infra));
603 if (unlikely(err)) {592 if (unlikely(err)) {
604 WL_ERR("WLC_SET_INFRA error (%d)\n", err);593 WL_ERR("WLC_SET_INFRA error (%d)\n", err);
605 err = -EAGAIN;594 err = -EAGAIN;
@@ -609,7 +598,7 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, · 3 unmodified lines
609 }598 }
610 599
611 WL_INFO("IF Type = %s\n",600 WL_INFO("IF Type = %s\n",
612 (wl->conf->mode == WL_MODE_IBSS) ? "Adhoc" : "Infra");601 (cfg_priv->conf->mode == WL_MODE_IBSS) ? "Adhoc" : "Infra");
613 602
614done:603done:
615 WL_TRACE("Exit\n");604 WL_TRACE("Exit\n");
@@ -617,7 +606,8 @@ done: · 1 unmodified line
617 return err;606 return err;
618}607}
619 608
620static void wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid)609static void wl_iscan_prep(struct brcmf_scan_params *params,
610 struct brcmf_ssid *ssid)
621{611{
622 memcpy(params->bssid, ether_bcast, ETH_ALEN);612 memcpy(params->bssid, ether_bcast, ETH_ALEN);
623 params->bss_type = DOT11_BSSTYPE_ANY;613 params->bss_type = DOT11_BSSTYPE_ANY;
@@ -633,58 +623,59 @@ static void wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid) · 9 unmodified lines
633 params->passive_time = cpu_to_le32(params->passive_time);623 params->passive_time = cpu_to_le32(params->passive_time);
634 params->home_time = cpu_to_le32(params->home_time);624 params->home_time = cpu_to_le32(params->home_time);
635 if (ssid && ssid->SSID_len)625 if (ssid && ssid->SSID_len)
636 memcpy(&params->ssid, ssid, sizeof(wlc_ssid_t));626 memcpy(&params->ssid, ssid, sizeof(struct brcmf_ssid));
637 627
638}628}
639 629
640static s32630static s32
641wl_dev_iovar_setbuf(struct net_device *dev, s8 * iovar, void *param,631brcmf_dev_iovar_setbuf(struct net_device *dev, s8 * iovar, void *param,
642 s32 paramlen, void *bufptr, s32 buflen)632 s32 paramlen, void *bufptr, s32 buflen)
643{633{
644 s32 iolen;634 s32 iolen;
645 635
646 iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen);636 iolen = brcmu_mkiovar(iovar, param, paramlen, bufptr, buflen);
647 BUG_ON(!iolen);637 BUG_ON(!iolen);
648 638
649 return wl_dev_ioctl(dev, WLC_SET_VAR, bufptr, iolen);639 return brcmf_dev_ioctl(dev, BRCMF_C_SET_VAR, bufptr, iolen);
650}640}
651 641
652static s32642static s32
653wl_dev_iovar_getbuf(struct net_device *dev, s8 * iovar, void *param,643brcmf_dev_iovar_getbuf(struct net_device *dev, s8 * iovar, void *param,
654 s32 paramlen, void *bufptr, s32 buflen)644 s32 paramlen, void *bufptr, s32 buflen)
655{645{
656 s32 iolen;646 s32 iolen;
657 647
658 iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen);648 iolen = brcmu_mkiovar(iovar, param, paramlen, bufptr, buflen);
659 BUG_ON(!iolen);649 BUG_ON(!iolen);
660 650
661 return wl_dev_ioctl(dev, WLC_GET_VAR, bufptr, buflen);651 return brcmf_dev_ioctl(dev, BRCMF_C_GET_VAR, bufptr, buflen);
662}652}
663 653
664static s32654static s32
665wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, u16 action)655brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
656 struct brcmf_ssid *ssid, u16 action)
666{657{
667 s32 params_size =658 s32 params_size = (BRCMF_SCAN_PARAMS_FIXED_SIZE +
668 (WL_SCAN_PARAMS_FIXED_SIZE + offsetof(wl_iscan_params_t, params));659 offsetof(struct brcmf_iscan_params, params));
669 struct wl_iscan_params *params;660 struct brcmf_iscan_params *params;
670 s32 err = 0;661 s32 err = 0;
671 662
672 if (ssid && ssid->SSID_len)663 if (ssid && ssid->SSID_len)
673 params_size += sizeof(struct wlc_ssid);664 params_size += sizeof(struct brcmf_ssid);
674 params = kzalloc(params_size, GFP_KERNEL);665 params = kzalloc(params_size, GFP_KERNEL);
675 if (unlikely(!params))666 if (unlikely(!params))
676 return -ENOMEM;667 return -ENOMEM;
677 BUG_ON(params_size >= WLC_IOCTL_SMLEN);668 BUG_ON(params_size >= BRCMF_C_IOCTL_SMLEN);
678 669
679 wl_iscan_prep(&params->params, ssid);670 wl_iscan_prep(&params->params, ssid);
680 671
681 params->version = cpu_to_le32(ISCAN_REQ_VERSION);672 params->version = cpu_to_le32(BRCMF_ISCAN_REQ_VERSION);
682 params->action = cpu_to_le16(action);673 params->action = cpu_to_le16(action);
683 params->scan_duration = cpu_to_le16(0);674 params->scan_duration = cpu_to_le16(0);
684 675
685 /* params_size += offsetof(wl_iscan_params_t, params); */676 /* params_size += offsetof(struct brcmf_iscan_params, params); */
686 err = wl_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size,677 err = brcmf_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size,
687 iscan->ioctl_buf, WLC_IOCTL_SMLEN);678 iscan->ioctl_buf, BRCMF_C_IOCTL_SMLEN);
688 if (unlikely(err)) {679 if (unlikely(err)) {
689 if (err == -EBUSY) {680 if (err == -EBUSY) {
690 WL_INFO("system busy : iscan canceled\n");681 WL_INFO("system busy : iscan canceled\n");
@@ -696,11 +687,11 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, u16 action) · 5 unmodified lines
696 return err;687 return err;
697}688}
698 689
699static s32 wl_do_iscan(struct wl_priv *wl)690static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv)
700{691{
701 struct wl_iscan_ctrl *iscan = wl_to_iscan(wl);692 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv);
702 struct net_device *ndev = wl_to_ndev(wl);693 struct net_device *ndev = cfg_to_ndev(cfg_priv);
703 struct wlc_ssid ssid;694 struct brcmf_ssid ssid;
704 s32 passive_scan;695 s32 passive_scan;
705 s32 err = 0;696 s32 err = 0;
706 697
@@ -709,16 +700,16 @@ static s32 wl_do_iscan(struct wl_priv *wl) · 2 unmodified lines
709 700
710 iscan->state = WL_ISCAN_STATE_SCANING;701 iscan->state = WL_ISCAN_STATE_SCANING;
711 702
712 passive_scan = wl->active_scan ? 0 : 1;703 passive_scan = cfg_priv->active_scan ? 0 : 1;
713 err = wl_dev_ioctl(wl_to_ndev(wl), WLC_SET_PASSIVE_SCAN,704 err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), BRCMF_C_SET_PASSIVE_SCAN,
714 &passive_scan, sizeof(passive_scan));705 &passive_scan, sizeof(passive_scan));
715 if (unlikely(err)) {706 if (unlikely(err)) {
716 WL_ERR("error (%d)\n", err);707 WL_ERR("error (%d)\n", err);
717 return err;708 return err;
718 }709 }
719 wl_set_mpc(ndev, 0);710 brcmf_set_mpc(ndev, 0);
720 wl->iscan_kickstart = true;711 cfg_priv->iscan_kickstart = true;
721 wl_run_iscan(iscan, &ssid, WL_SCAN_ACTION_START);712 brcmf_run_iscan(iscan, &ssid, BRCMF_SCAN_ACTION_START);
722 mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);713 mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
723 iscan->timer_on = 1;714 iscan->timer_on = 1;
724 715
@@ -726,30 +717,30 @@ static s32 wl_do_iscan(struct wl_priv *wl) · 1 unmodified line
726}717}
727 718
728static s32719static s32
729__wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,720__brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
730 struct cfg80211_scan_request *request,721 struct cfg80211_scan_request *request,
731 struct cfg80211_ssid *this_ssid)722 struct cfg80211_ssid *this_ssid)
732{723{
733 struct wl_priv *wl = ndev_to_wl(ndev);724 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
734 struct cfg80211_ssid *ssids;725 struct cfg80211_ssid *ssids;
735 struct wl_scan_req *sr = wl_to_sr(wl);726 struct brcmf_cfg80211_scan_req *sr = cfg_priv->scan_req_int;
736 s32 passive_scan;727 s32 passive_scan;
737 bool iscan_req;728 bool iscan_req;
738 bool spec_scan;729 bool spec_scan;
739 s32 err = 0;730 s32 err = 0;
740 731
741 if (unlikely(test_bit(WL_STATUS_SCANNING, &wl->status))) {732 if (unlikely(test_bit(WL_STATUS_SCANNING, &cfg_priv->status))) {
742 WL_ERR("Scanning already : status (%d)\n", (int)wl->status);733 WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status);
743 return -EAGAIN;734 return -EAGAIN;
744 }735 }
745 if (unlikely(test_bit(WL_STATUS_SCAN_ABORTING, &wl->status))) {736 if (unlikely(test_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status))) {
746 WL_ERR("Scanning being aborted : status (%d)\n",737 WL_ERR("Scanning being aborted : status (%lu)\n",
747 (int)wl->status);738 cfg_priv->status);
748 return -EAGAIN;739 return -EAGAIN;
749 }740 }
750 if (test_bit(WL_STATUS_CONNECTING, &wl->status)) {741 if (test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) {
751 WL_ERR("Connecting : status (%d)\n",742 WL_ERR("Connecting : status (%lu)\n",
752 (int)wl->status);743 cfg_priv->status);
753 return -EAGAIN;744 return -EAGAIN;
754 }745 }
755 746
@@ -758,7 +749,7 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines
758 if (request) {749 if (request) {
759 /* scan bss */750 /* scan bss */
760 ssids = request->ssids;751 ssids = request->ssids;
761 if (wl->iscan_on && (!ssids || !ssids->ssid_len))752 if (cfg_priv->iscan_on && (!ssids || !ssids->ssid_len))
762 iscan_req = true;753 iscan_req = true;
763 } else {754 } else {
764 /* scan in ibss */755 /* scan in ibss */
@@ -766,10 +757,10 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 1 unmodified line
766 ssids = this_ssid;757 ssids = this_ssid;
767 }758 }
768 759
769 wl->scan_request = request;760 cfg_priv->scan_request = request;
770 set_bit(WL_STATUS_SCANNING, &wl->status);761 set_bit(WL_STATUS_SCANNING, &cfg_priv->status);
771 if (iscan_req) {762 if (iscan_req) {
772 err = wl_do_iscan(wl);763 err = brcmf_do_iscan(cfg_priv);
773 if (likely(!err))764 if (likely(!err))
774 return err;765 return err;
775 else766 else
@@ -788,15 +779,15 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 12 unmodified lines
788 WL_SCAN("Broadcast scan\n");779 WL_SCAN("Broadcast scan\n");
789 }780 }
790 781
791 passive_scan = wl->active_scan ? 0 : 1;782 passive_scan = cfg_priv->active_scan ? 0 : 1;
792 err = wl_dev_ioctl(ndev, WLC_SET_PASSIVE_SCAN,783 err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_PASSIVE_SCAN,
793 &passive_scan, sizeof(passive_scan));784 &passive_scan, sizeof(passive_scan));
794 if (unlikely(err)) {785 if (unlikely(err)) {
795 WL_ERR("WLC_SET_PASSIVE_SCAN error (%d)\n", err);786 WL_ERR("WLC_SET_PASSIVE_SCAN error (%d)\n", err);
796 goto scan_out;787 goto scan_out;
797 }788 }
798 wl_set_mpc(ndev, 0);789 brcmf_set_mpc(ndev, 0);
799 err = wl_dev_ioctl(ndev, WLC_SCAN, &sr->ssid,790 err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN, &sr->ssid,
800 sizeof(sr->ssid));791 sizeof(sr->ssid));
801 if (err) {792 if (err) {
802 if (err == -EBUSY) {793 if (err == -EBUSY) {
@@ -805,7 +796,7 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines
805 } else {796 } else {
806 WL_ERR("WLC_SCAN error (%d)\n", err);797 WL_ERR("WLC_SCAN error (%d)\n", err);
807 }798 }
808 wl_set_mpc(ndev, 1);799 brcmf_set_mpc(ndev, 1);
809 goto scan_out;800 goto scan_out;
810 }801 }
811 }802 }
@@ -813,13 +804,13 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 1 unmodified line
813 return 0;804 return 0;
814 805
815scan_out:806scan_out:
816 clear_bit(WL_STATUS_SCANNING, &wl->status);807 clear_bit(WL_STATUS_SCANNING, &cfg_priv->status);
817 wl->scan_request = NULL;808 cfg_priv->scan_request = NULL;
818 return err;809 return err;
819}810}
820 811
821static s32812static s32
822wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,813brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
823 struct cfg80211_scan_request *request)814 struct cfg80211_scan_request *request)
824{815{
825 s32 err = 0;816 s32 err = 0;
@@ -828,7 +819,7 @@ wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines
828 819
829 CHECK_SYS_UP();820 CHECK_SYS_UP();
830 821
831 err = __wl_cfg80211_scan(wiphy, ndev, request, NULL);822 err = __brcmf_cfg80211_scan(wiphy, ndev, request, NULL);
832 if (unlikely(err))823 if (unlikely(err))
833 WL_ERR("scan error (%d)\n", err);824 WL_ERR("scan error (%d)\n", err);
834 825
@@ -836,17 +827,18 @@ wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 1 unmodified line
836 return err;827 return err;
837}828}
838 829
839static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val)830static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val)
840{831{
841 s8 buf[WLC_IOCTL_SMLEN];832 s8 buf[BRCMF_C_IOCTL_SMLEN];
842 u32 len;833 u32 len;
843 s32 err = 0;834 s32 err = 0;
844 835
845 val = cpu_to_le32(val);836 val = cpu_to_le32(val);
846 len = bcm_mkiovar(name, (char *)(&val), sizeof(val), buf, sizeof(buf));837 len = brcmu_mkiovar(name, (char *)(&val), sizeof(val), buf,
838 sizeof(buf));
847 BUG_ON(!len);839 BUG_ON(!len);
848 840
849 err = wl_dev_ioctl(dev, WLC_SET_VAR, buf, len);841 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_VAR, buf, len);
850 if (unlikely(err))842 if (unlikely(err))
851 WL_ERR("error (%d)\n", err);843 WL_ERR("error (%d)\n", err);
852 844
@@ -854,10 +846,10 @@ static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val) · 1 unmodified line
854}846}
855 847
856static s32848static s32
857wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval)849brcmf_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval)
858{850{
859 union {851 union {
860 s8 buf[WLC_IOCTL_SMLEN];852 s8 buf[BRCMF_C_IOCTL_SMLEN];
861 s32 val;853 s32 val;
862 } var;854 } var;
863 u32 len;855 u32 len;
@@ -865,10 +857,10 @@ wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) · 1 unmodified line
865 s32 err = 0;857 s32 err = 0;
866 858
867 len =859 len =
868 bcm_mkiovar(name, (char *)(&data_null), 0, (char *)(&var),860 brcmu_mkiovar(name, (char *)(&data_null), 0, (char *)(&var),
869 sizeof(var.buf));861 sizeof(var.buf));
870 BUG_ON(!len);862 BUG_ON(!len);
871 err = wl_dev_ioctl(dev, WLC_GET_VAR, &var, len);863 err = brcmf_dev_ioctl(dev, BRCMF_C_GET_VAR, &var, len);
872 if (unlikely(err))864 if (unlikely(err))
873 WL_ERR("error (%d)\n", err);865 WL_ERR("error (%d)\n", err);
874 866
@@ -877,35 +869,35 @@ wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) · 2 unmodified lines
877 return err;869 return err;
878}870}
879 871
880static s32 wl_set_rts(struct net_device *dev, u32 rts_threshold)872static s32 brcmf_set_rts(struct net_device *dev, u32 rts_threshold)
881{873{
882 s32 err = 0;874 s32 err = 0;
883 875
884 err = wl_dev_intvar_set(dev, "rtsthresh", rts_threshold);876 err = brcmf_dev_intvar_set(dev, "rtsthresh", rts_threshold);
885 if (unlikely(err))877 if (unlikely(err))
886 WL_ERR("Error (%d)\n", err);878 WL_ERR("Error (%d)\n", err);
887 879
888 return err;880 return err;
889}881}
890 882
891static s32 wl_set_frag(struct net_device *dev, u32 frag_threshold)883static s32 brcmf_set_frag(struct net_device *dev, u32 frag_threshold)
892{884{
893 s32 err = 0;885 s32 err = 0;
894 886
895 err = wl_dev_intvar_set(dev, "fragthresh", frag_threshold);887 err = brcmf_dev_intvar_set(dev, "fragthresh", frag_threshold);
896 if (unlikely(err))888 if (unlikely(err))
897 WL_ERR("Error (%d)\n", err);889 WL_ERR("Error (%d)\n", err);
898 890
899 return err;891 return err;
900}892}
901 893
902static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l)894static s32 brcmf_set_retry(struct net_device *dev, u32 retry, bool l)
903{895{
904 s32 err = 0;896 s32 err = 0;
905 u32 cmd = (l ? WLC_SET_LRL : WLC_SET_SRL);897 u32 cmd = (l ? BRCM_SET_LRL : BRCM_SET_SRL);
906 898
907 retry = cpu_to_le32(retry);899 retry = cpu_to_le32(retry);
908 err = wl_dev_ioctl(dev, cmd, &retry, sizeof(retry));900 err = brcmf_dev_ioctl(dev, cmd, &retry, sizeof(retry));
909 if (unlikely(err)) {901 if (unlikely(err)) {
910 WL_ERR("cmd (%d) , error (%d)\n", cmd, err);902 WL_ERR("cmd (%d) , error (%d)\n", cmd, err);
911 return err;903 return err;
@@ -913,40 +905,40 @@ static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l) · 1 unmodified line
913 return err;905 return err;
914}906}
915 907
916static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)908static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
917{909{
918 struct wl_priv *wl = wiphy_to_wl(wiphy);910 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
919 struct net_device *ndev = wl_to_ndev(wl);911 struct net_device *ndev = cfg_to_ndev(cfg_priv);
920 s32 err = 0;912 s32 err = 0;
921 913
922 WL_TRACE("Enter\n");914 WL_TRACE("Enter\n");
923 CHECK_SYS_UP();915 CHECK_SYS_UP();
924 916
925 if (changed & WIPHY_PARAM_RTS_THRESHOLD &&917 if (changed & WIPHY_PARAM_RTS_THRESHOLD &&
926 (wl->conf->rts_threshold != wiphy->rts_threshold)) {918 (cfg_priv->conf->rts_threshold != wiphy->rts_threshold)) {
927 wl->conf->rts_threshold = wiphy->rts_threshold;919 cfg_priv->conf->rts_threshold = wiphy->rts_threshold;
928 err = wl_set_rts(ndev, wl->conf->rts_threshold);920 err = brcmf_set_rts(ndev, cfg_priv->conf->rts_threshold);
929 if (!err)921 if (!err)
930 goto done;922 goto done;
931 }923 }
932 if (changed & WIPHY_PARAM_FRAG_THRESHOLD &&924 if (changed & WIPHY_PARAM_FRAG_THRESHOLD &&
933 (wl->conf->frag_threshold != wiphy->frag_threshold)) {925 (cfg_priv->conf->frag_threshold != wiphy->frag_threshold)) {
934 wl->conf->frag_threshold = wiphy->frag_threshold;926 cfg_priv->conf->frag_threshold = wiphy->frag_threshold;
935 err = wl_set_frag(ndev, wl->conf->frag_threshold);927 err = brcmf_set_frag(ndev, cfg_priv->conf->frag_threshold);
936 if (!err)928 if (!err)
937 goto done;929 goto done;
938 }930 }
939 if (changed & WIPHY_PARAM_RETRY_LONG931 if (changed & WIPHY_PARAM_RETRY_LONG
940 && (wl->conf->retry_long != wiphy->retry_long)) {932 && (cfg_priv->conf->retry_long != wiphy->retry_long)) {
941 wl->conf->retry_long = wiphy->retry_long;933 cfg_priv->conf->retry_long = wiphy->retry_long;
942 err = wl_set_retry(ndev, wl->conf->retry_long, true);934 err = brcmf_set_retry(ndev, cfg_priv->conf->retry_long, true);
943 if (!err)935 if (!err)
944 goto done;936 goto done;
945 }937 }
946 if (changed & WIPHY_PARAM_RETRY_SHORT938 if (changed & WIPHY_PARAM_RETRY_SHORT
947 && (wl->conf->retry_short != wiphy->retry_short)) {939 && (cfg_priv->conf->retry_short != wiphy->retry_short)) {
948 wl->conf->retry_short = wiphy->retry_short;940 cfg_priv->conf->retry_short = wiphy->retry_short;
949 err = wl_set_retry(ndev, wl->conf->retry_short, false);941 err = brcmf_set_retry(ndev, cfg_priv->conf->retry_short, false);
950 if (!err)942 if (!err)
951 goto done;943 goto done;
952 }944 }
@@ -957,11 +949,11 @@ done: · 4 unmodified lines
957}949}
958 950
959static s32951static s32
960wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,952brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
961 struct cfg80211_ibss_params *params)953 struct cfg80211_ibss_params *params)
962{954{
963 struct wl_priv *wl = wiphy_to_wl(wiphy);955 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
964 struct wl_join_params join_params;956 struct brcmf_join_params join_params;
965 size_t join_params_size = 0;957 size_t join_params_size = 0;
966 s32 err = 0;958 s32 err = 0;
967 s32 wsec = 0;959 s32 wsec = 0;
@@ -977,6 +969,8 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 9 unmodified lines
977 return -EOPNOTSUPP;969 return -EOPNOTSUPP;
978 }970 }
979 971
972 set_bit(WL_STATUS_CONNECTING, &cfg_priv->status);
973
980 if (params->bssid)974 if (params->bssid)
981 WL_CONN("BSSID: %02X %02X %02X %02X %02X %02X\n",975 WL_CONN("BSSID: %02X %02X %02X %02X %02X %02X\n",
982 params->bssid[0], params->bssid[1], params->bssid[2],976 params->bssid[0], params->bssid[1], params->bssid[2],
@@ -1018,7 +1012,7 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 35 unmodified lines
1018 if (params->privacy)1012 if (params->privacy)
1019 wsec |= WEP_ENABLED;1013 wsec |= WEP_ENABLED;
1020 1014
1021 err = wl_dev_intvar_set(dev, "wsec", wsec);1015 err = brcmf_dev_intvar_set(dev, "wsec", wsec);
1022 if (unlikely(err)) {1016 if (unlikely(err)) {
1023 WL_ERR("wsec failed (%d)\n", err);1017 WL_ERR("wsec failed (%d)\n", err);
1024 goto done;1018 goto done;
@@ -1030,14 +1024,14 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 5 unmodified lines
1030 else1024 else
1031 bcnprd = cpu_to_le32(100);1025 bcnprd = cpu_to_le32(100);
1032 1026
1033 err = wl_dev_ioctl(dev, WLC_SET_BCNPRD, &bcnprd, sizeof(bcnprd));1027 err = brcmf_dev_ioctl(dev, BRCM_SET_BCNPRD, &bcnprd, sizeof(bcnprd));
1034 if (unlikely(err)) {1028 if (unlikely(err)) {
1035 WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err);1029 WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err);
1036 goto done;1030 goto done;
1037 }1031 }
1038 1032
1039 /* Configure required join parameter */1033 /* Configure required join parameter */
1040 memset(&join_params, 0, sizeof(wl_join_params_t));1034 memset(&join_params, 0, sizeof(struct brcmf_join_params));
1041 1035
1042 /* SSID */1036 /* SSID */
1043 join_params.ssid.SSID_len =1037 join_params.ssid.SSID_len =
@@ -1045,67 +1039,69 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 1 unmodified line
1045 memcpy(join_params.ssid.SSID, params->ssid, join_params.ssid.SSID_len);1039 memcpy(join_params.ssid.SSID, params->ssid, join_params.ssid.SSID_len);
1046 join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);1040 join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);
1047 join_params_size = sizeof(join_params.ssid);1041 join_params_size = sizeof(join_params.ssid);
1048 wl_update_prof(wl, NULL, &join_params.ssid, WL_PROF_SSID);1042 brcmf_update_prof(cfg_priv, NULL, &join_params.ssid, WL_PROF_SSID);
1049 1043
1050 /* BSSID */1044 /* BSSID */
1051 if (params->bssid) {1045 if (params->bssid) {
1052 memcpy(join_params.params.bssid, params->bssid, ETH_ALEN);1046 memcpy(join_params.params.bssid, params->bssid, ETH_ALEN);
1053 join_params_size =1047 join_params_size = sizeof(join_params.ssid) +
1054 sizeof(join_params.ssid) + WL_ASSOC_PARAMS_FIXED_SIZE;1048 BRCMF_ASSOC_PARAMS_FIXED_SIZE;
1055 } else {1049 } else {
1056 memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);1050 memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);
1057 }1051 }
1058 wl_update_prof(wl, NULL, &join_params.params.bssid, WL_PROF_BSSID);1052 brcmf_update_prof(cfg_priv, NULL,
1053 &join_params.params.bssid, WL_PROF_BSSID);
1059 1054
1060 /* Channel */1055 /* Channel */
1061 if (params->channel) {1056 if (params->channel) {
1062 u32 target_channel;1057 u32 target_channel;
1063 1058
1064 wl->channel =1059 cfg_priv->channel =
1065 ieee80211_frequency_to_channel(1060 ieee80211_frequency_to_channel(
1066 params->channel->center_freq);1061 params->channel->center_freq);
1067 if (params->channel_fixed) {1062 if (params->channel_fixed) {
1068 /* adding chanspec */1063 /* adding chanspec */
1069 wl_ch_to_chanspec(wl->channel,1064 brcmf_ch_to_chanspec(cfg_priv->channel,
1070 &join_params, &join_params_size);1065 &join_params, &join_params_size);
1071 }1066 }
1072 1067
1073 /* set channel for starter */1068 /* set channel for starter */
1074 target_channel = cpu_to_le32(wl->channel);1069 target_channel = cpu_to_le32(cfg_priv->channel);
1075 err = wl_dev_ioctl(dev, WLC_SET_CHANNEL,1070 err = brcmf_dev_ioctl(dev, BRCM_SET_CHANNEL,
1076 &target_channel, sizeof(target_channel));1071 &target_channel, sizeof(target_channel));
1077 if (unlikely(err)) {1072 if (unlikely(err)) {
1078 WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err);1073 WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err);
1079 goto done;1074 goto done;
1080 }1075 }
1081 } else1076 } else
1082 wl->channel = 0;1077 cfg_priv->channel = 0;
1083 1078
1084 wl->ibss_starter = false;1079 cfg_priv->ibss_starter = false;
1085 1080
1086 1081
1087 err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);1082 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_SSID,
1083 &join_params, join_params_size);
1088 if (unlikely(err)) {1084 if (unlikely(err)) {
1089 WL_ERR("WLC_SET_SSID failed (%d)\n", err);1085 WL_ERR("WLC_SET_SSID failed (%d)\n", err);
1090 goto done;1086 goto done;
1091 }1087 }
1092 1088
1093 set_bit(WL_STATUS_CONNECTING, &wl->status);
1094
1095done:1089done:
1090 if (err)
1091 clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status);
1096 WL_TRACE("Exit\n");1092 WL_TRACE("Exit\n");
1097 return err;1093 return err;
1098}1094}
1099 1095
1100static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)1096static s32 brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
1101{1097{
1102 struct wl_priv *wl = wiphy_to_wl(wiphy);1098 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1103 s32 err = 0;1099 s32 err = 0;
1104 1100
1105 WL_TRACE("Enter\n");1101 WL_TRACE("Enter\n");
1106 CHECK_SYS_UP();1102 CHECK_SYS_UP();
1107 1103
1108 wl_link_down(wl);1104 brcmf_link_down(cfg_priv);
1109 1105
1110 WL_TRACE("Exit\n");1106 WL_TRACE("Exit\n");
1111 1107
@@ -1113,10 +1109,10 @@ static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) · 1 unmodified line
1113}1109}
1114 1110
1115static s321111static s32
1116wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme)1112brcmf_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme)
1117{1113{
1118 struct wl_priv *wl = ndev_to_wl(dev);1114 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
1119 struct wl_security *sec;1115 struct brcmf_cfg80211_security *sec;
1120 s32 val = 0;1116 s32 val = 0;
1121 s32 err = 0;1117 s32 err = 0;
1122 1118
@@ -1127,21 +1123,21 @@ wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme) · 4 unmodified lines
1127 else1123 else
1128 val = WPA_AUTH_DISABLED;1124 val = WPA_AUTH_DISABLED;
1129 WL_CONN("setting wpa_auth to 0x%0x\n", val);1125 WL_CONN("setting wpa_auth to 0x%0x\n", val);
1130 err = wl_dev_intvar_set(dev, "wpa_auth", val);1126 err = brcmf_dev_intvar_set(dev, "wpa_auth", val);
1131 if (unlikely(err)) {1127 if (unlikely(err)) {
1132 WL_ERR("set wpa_auth failed (%d)\n", err);1128 WL_ERR("set wpa_auth failed (%d)\n", err);
1133 return err;1129 return err;
1134 }1130 }
1135 sec = wl_read_prof(wl, WL_PROF_SEC);1131 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
1136 sec->wpa_versions = sme->crypto.wpa_versions;1132 sec->wpa_versions = sme->crypto.wpa_versions;
1137 return err;1133 return err;
1138}1134}
1139 1135
1140static s321136static s32
1141wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)1137brcmf_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
1142{1138{
1143 struct wl_priv *wl = ndev_to_wl(dev);1139 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
1144 struct wl_security *sec;1140 struct brcmf_cfg80211_security *sec;
1145 s32 val = 0;1141 s32 val = 0;
1146 s32 err = 0;1142 s32 err = 0;
1147 1143
@@ -1166,21 +1162,21 @@ wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme) · 18 unmodified lines
1166 break;1162 break;
1167 }1163 }
1168 1164
1169 err = wl_dev_intvar_set(dev, "auth", val);1165 err = brcmf_dev_intvar_set(dev, "auth", val);
1170 if (unlikely(err)) {1166 if (unlikely(err)) {
1171 WL_ERR("set auth failed (%d)\n", err);1167 WL_ERR("set auth failed (%d)\n", err);
1172 return err;1168 return err;
1173 }1169 }
1174 sec = wl_read_prof(wl, WL_PROF_SEC);1170 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
1175 sec->auth_type = sme->auth_type;1171 sec->auth_type = sme->auth_type;
1176 return err;1172 return err;
1177}1173}
1178 1174
1179static s321175static s32
1180wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme)1176brcmf_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme)
1181{1177{
1182 struct wl_priv *wl = ndev_to_wl(dev);1178 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
1183 struct wl_security *sec;1179 struct brcmf_cfg80211_security *sec;
1184 s32 pval = 0;1180 s32 pval = 0;
1185 s32 gval = 0;1181 s32 gval = 0;
1186 s32 err = 0;1182 s32 err = 0;
@@ -1229,13 +1225,13 @@ wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) · 42 unmodified lines
1229 }1225 }
1230 1226
1231 WL_CONN("pval (%d) gval (%d)\n", pval, gval);1227 WL_CONN("pval (%d) gval (%d)\n", pval, gval);
1232 err = wl_dev_intvar_set(dev, "wsec", pval | gval);1228 err = brcmf_dev_intvar_set(dev, "wsec", pval | gval);
1233 if (unlikely(err)) {1229 if (unlikely(err)) {
1234 WL_ERR("error (%d)\n", err);1230 WL_ERR("error (%d)\n", err);
1235 return err;1231 return err;
1236 }1232 }
1237 1233
1238 sec = wl_read_prof(wl, WL_PROF_SEC);1234 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
1239 sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0];1235 sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0];
1240 sec->cipher_group = sme->crypto.cipher_group;1236 sec->cipher_group = sme->crypto.cipher_group;
1241 1237
@@ -1243,15 +1239,15 @@ wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) · 1 unmodified line
1243}1239}
1244 1240
1245static s321241static s32
1246wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme)1242brcmf_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme)
1247{1243{
1248 struct wl_priv *wl = ndev_to_wl(dev);1244 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
1249 struct wl_security *sec;1245 struct brcmf_cfg80211_security *sec;
1250 s32 val = 0;1246 s32 val = 0;
1251 s32 err = 0;1247 s32 err = 0;
1252 1248
1253 if (sme->crypto.n_akm_suites) {1249 if (sme->crypto.n_akm_suites) {
1254 err = wl_dev_intvar_get(dev, "wpa_auth", &val);1250 err = brcmf_dev_intvar_get(dev, "wpa_auth", &val);
1255 if (unlikely(err)) {1251 if (unlikely(err)) {
1256 WL_ERR("could not get wpa_auth (%d)\n", err);1252 WL_ERR("could not get wpa_auth (%d)\n", err);
1257 return err;1253 return err;
@@ -1285,31 +1281,31 @@ wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme) · 27 unmodified lines
1285 }1281 }
1286 1282
1287 WL_CONN("setting wpa_auth to %d\n", val);1283 WL_CONN("setting wpa_auth to %d\n", val);
1288 err = wl_dev_intvar_set(dev, "wpa_auth", val);1284 err = brcmf_dev_intvar_set(dev, "wpa_auth", val);
1289 if (unlikely(err)) {1285 if (unlikely(err)) {
1290 WL_ERR("could not set wpa_auth (%d)\n", err);1286 WL_ERR("could not set wpa_auth (%d)\n", err);
1291 return err;1287 return err;
1292 }1288 }
1293 }1289 }
1294 sec = wl_read_prof(wl, WL_PROF_SEC);1290 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
1295 sec->wpa_auth = sme->crypto.akm_suites[0];1291 sec->wpa_auth = sme->crypto.akm_suites[0];
1296 1292
1297 return err;1293 return err;
1298}1294}
1299 1295
1300static s321296static s32
1301wl_set_set_sharedkey(struct net_device *dev,1297brcmf_set_set_sharedkey(struct net_device *dev,
1302 struct cfg80211_connect_params *sme)1298 struct cfg80211_connect_params *sme)
1303{1299{
1304 struct wl_priv *wl = ndev_to_wl(dev);1300 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
1305 struct wl_security *sec;1301 struct brcmf_cfg80211_security *sec;
1306 struct wl_wsec_key key;1302 struct brcmf_wsec_key key;
1307 s32 val;1303 s32 val;
1308 s32 err = 0;1304 s32 err = 0;
1309 1305
1310 WL_CONN("key len (%d)\n", sme->key_len);1306 WL_CONN("key len (%d)\n", sme->key_len);
1311 if (sme->key_len) {1307 if (sme->key_len) {
1312 sec = wl_read_prof(wl, WL_PROF_SEC);1308 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
1313 WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n",1309 WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n",
1314 sec->wpa_versions, sec->cipher_pairwise);1310 sec->wpa_versions, sec->cipher_pairwise);
1315 if (!1311 if (!
@@ -1325,7 +1321,7 @@ wl_set_set_sharedkey(struct net_device *dev, · 9 unmodified lines
1325 return -EINVAL;1321 return -EINVAL;
1326 }1322 }
1327 memcpy(key.data, sme->key, key.len);1323 memcpy(key.data, sme->key, key.len);
1328 key.flags = WL_PRIMARY_KEY;1324 key.flags = BRCMF_PRIMARY_KEY;
1329 switch (sec->cipher_pairwise) {1325 switch (sec->cipher_pairwise) {
1330 case WLAN_CIPHER_SUITE_WEP40:1326 case WLAN_CIPHER_SUITE_WEP40:
1331 key.algo = CRYPTO_ALGO_WEP1;1327 key.algo = CRYPTO_ALGO_WEP1;
@@ -1343,7 +1339,7 @@ wl_set_set_sharedkey(struct net_device *dev, · 11 unmodified lines
1343 key.len, key.index, key.algo);1339 key.len, key.index, key.algo);
1344 WL_CONN("key \"%s\"\n", key.data);1340 WL_CONN("key \"%s\"\n", key.data);
1345 swap_key_from_BE(&key);1341 swap_key_from_BE(&key);
1346 err = wl_dev_ioctl(dev, WLC_SET_KEY, &key,1342 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key,
1347 sizeof(key));1343 sizeof(key));
1348 if (unlikely(err)) {1344 if (unlikely(err)) {
1349 WL_ERR("WLC_SET_KEY error (%d)\n", err);1345 WL_ERR("WLC_SET_KEY error (%d)\n", err);
@@ -1352,7 +1348,7 @@ wl_set_set_sharedkey(struct net_device *dev, · 2 unmodified lines
1352 if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) {1348 if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) {
1353 WL_CONN("set auth_type to shared key\n");1349 WL_CONN("set auth_type to shared key\n");
1354 val = 1; /* shared key */1350 val = 1; /* shared key */
1355 err = wl_dev_intvar_set(dev, "auth", val);1351 err = brcmf_dev_intvar_set(dev, "auth", val);
1356 if (unlikely(err)) {1352 if (unlikely(err)) {
1357 WL_ERR("set auth failed (%d)\n", err);1353 WL_ERR("set auth failed (%d)\n", err);
1358 return err;1354 return err;
@@ -1364,12 +1360,12 @@ wl_set_set_sharedkey(struct net_device *dev, · 5 unmodified lines
1364}1360}
1365 1361
1366static s321362static s32
1367wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,1363brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
1368 struct cfg80211_connect_params *sme)1364 struct cfg80211_connect_params *sme)
1369{1365{
1370 struct wl_priv *wl = wiphy_to_wl(wiphy);1366 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1371 struct ieee80211_channel *chan = sme->channel;1367 struct ieee80211_channel *chan = sme->channel;
1372 struct wl_join_params join_params;1368 struct brcmf_join_params join_params;
1373 size_t join_params_size;1369 size_t join_params_size;
1374 1370
1375 s32 err = 0;1371 s32 err = 0;
@@ -1382,37 +1378,49 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, · 6 unmodified lines
1382 return -EOPNOTSUPP;1378 return -EOPNOTSUPP;
1383 }1379 }
1384 1380
1381 set_bit(WL_STATUS_CONNECTING, &cfg_priv->status);
1382
1385 if (chan) {1383 if (chan) {
1386 wl->channel =1384 cfg_priv->channel =
1387 ieee80211_frequency_to_channel(chan->center_freq);1385 ieee80211_frequency_to_channel(chan->center_freq);
1388 WL_CONN("channel (%d), center_req (%d)\n",1386 WL_CONN("channel (%d), center_req (%d)\n",
1389 wl->channel, chan->center_freq);1387 cfg_priv->channel, chan->center_freq);
1390 } else1388 } else
1391 wl->channel = 0;1389 cfg_priv->channel = 0;
1392 1390
1393 WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len);1391 WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len);
1394 1392
1395 err = wl_set_wpa_version(dev, sme);1393 err = brcmf_set_wpa_version(dev, sme);
1396 if (unlikely(err))1394 if (err) {
1397 return err;1395 WL_ERR("wl_set_wpa_version failed (%d)\n", err);
1396 goto done;
1397 }
1398 1398
1399 err = wl_set_auth_type(dev, sme);1399 err = brcmf_set_auth_type(dev, sme);
1400 if (unlikely(err))1400 if (err) {
1401 return err;1401 WL_ERR("wl_set_auth_type failed (%d)\n", err);
1402 goto done;
1403 }
1402 1404
1403 err = wl_set_set_cipher(dev, sme);1405 err = brcmf_set_set_cipher(dev, sme);
1404 if (unlikely(err))1406 if (err) {
1405 return err;1407 WL_ERR("wl_set_set_cipher failed (%d)\n", err);
1408 goto done;
1409 }
1406 1410
1407 err = wl_set_key_mgmt(dev, sme);1411 err = brcmf_set_key_mgmt(dev, sme);
1408 if (unlikely(err))1412 if (err) {
1409 return err;1413 WL_ERR("wl_set_key_mgmt failed (%d)\n", err);
1414 goto done;
1415 }
1410 1416
1411 err = wl_set_set_sharedkey(dev, sme);1417 err = brcmf_set_set_sharedkey(dev, sme);
1412 if (unlikely(err))1418 if (err) {
1413 return err;1419 WL_ERR("wl_set_set_sharedkey failed (%d)\n", err);
1420 goto done;
1421 }
1414 1422
1415 wl_update_prof(wl, NULL, sme->bssid, WL_PROF_BSSID);1423 brcmf_update_prof(cfg_priv, NULL, sme->bssid, WL_PROF_BSSID);
1416 /*1424 /*
1417 ** Join with specific BSSID and cached SSID1425 ** Join with specific BSSID and cached SSID
1418 ** If SSID is zero join based on BSSID only1426 ** If SSID is zero join based on BSSID only
@@ -1423,7 +1431,7 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, · 4 unmodified lines
1423 join_params.ssid.SSID_len = min(sizeof(join_params.ssid.SSID), sme->ssid_len);1431 join_params.ssid.SSID_len = min(sizeof(join_params.ssid.SSID), sme->ssid_len);
1424 memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len);1432 memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len);
1425 join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);1433 join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);
1426 wl_update_prof(wl, NULL, &join_params.ssid, WL_PROF_SSID);1434 brcmf_update_prof(cfg_priv, NULL, &join_params.ssid, WL_PROF_SSID);
1427 1435
1428 if (sme->bssid)1436 if (sme->bssid)
1429 memcpy(join_params.params.bssid, sme->bssid, ETH_ALEN);1437 memcpy(join_params.params.bssid, sme->bssid, ETH_ALEN);
@@ -1435,52 +1443,54 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, · 5 unmodified lines
1435 join_params.ssid.SSID, join_params.ssid.SSID_len);1443 join_params.ssid.SSID, join_params.ssid.SSID_len);
1436 }1444 }
1437 1445
1438 wl_ch_to_chanspec(wl->channel, &join_params, &join_params_size);1446 brcmf_ch_to_chanspec(cfg_priv->channel,
1439 err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);1447 &join_params, &join_params_size);
1440 if (unlikely(err)) {1448 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_SSID,
1441 WL_ERR("error (%d)\n", err);1449 &join_params, join_params_size);
1442 return err;1450 if (err)
1443 }1451 WL_ERR("WLC_SET_SSID failed (%d)\n", err);
1444 set_bit(WL_STATUS_CONNECTING, &wl->status);
1445 1452
1453done:
1454 if (err)
1455 clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status);
1446 WL_TRACE("Exit\n");1456 WL_TRACE("Exit\n");
1447 return err;1457 return err;
1448}1458}
1449 1459
1450static s321460static s32
1451wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,1461brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
1452 u16 reason_code)1462 u16 reason_code)
1453{1463{
1454 struct wl_priv *wl = wiphy_to_wl(wiphy);1464 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1455 scb_val_t scbval;1465 struct brcmf_scb_val scbval;
1456 s32 err = 0;1466 s32 err = 0;
1457 1467
1458 WL_TRACE("Enter. Reason code = %d\n", reason_code);1468 WL_TRACE("Enter. Reason code = %d\n", reason_code);
1459 CHECK_SYS_UP();1469 CHECK_SYS_UP();
1460 1470
1461 clear_bit(WL_STATUS_CONNECTED, &wl->status);1471 clear_bit(WL_STATUS_CONNECTED, &cfg_priv->status);
1462 1472
1463 scbval.val = reason_code;1473 scbval.val = reason_code;
1464 memcpy(&scbval.ea, wl_read_prof(wl, WL_PROF_BSSID), ETH_ALEN);1474 memcpy(&scbval.ea, brcmf_read_prof(cfg_priv, WL_PROF_BSSID), ETH_ALEN);
1465 scbval.val = cpu_to_le32(scbval.val);1475 scbval.val = cpu_to_le32(scbval.val);
1466 err = wl_dev_ioctl(dev, WLC_DISASSOC, &scbval,1476 err = brcmf_dev_ioctl(dev, BRCMF_C_DISASSOC, &scbval,
1467 sizeof(scb_val_t));1477 sizeof(struct brcmf_scb_val));
1468 if (unlikely(err))1478 if (unlikely(err))
1469 WL_ERR("error (%d)\n", err);1479 WL_ERR("error (%d)\n", err);
1470 1480
1471 wl->link_up = false;1481 cfg_priv->link_up = false;
1472 1482
1473 WL_TRACE("Exit\n");1483 WL_TRACE("Exit\n");
1474 return err;1484 return err;
1475}1485}
1476 1486
1477static s321487static s32
1478wl_cfg80211_set_tx_power(struct wiphy *wiphy,1488brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
1479 enum nl80211_tx_power_setting type, s32 dbm)1489 enum nl80211_tx_power_setting type, s32 dbm)
1480{1490{
1481 1491
1482 struct wl_priv *wl = wiphy_to_wl(wiphy);1492 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1483 struct net_device *ndev = wl_to_ndev(wl);1493 struct net_device *ndev = cfg_to_ndev(cfg_priv);
1484 u16 txpwrmw;1494 u16 txpwrmw;
1485 s32 err = 0;1495 s32 err = 0;
1486 s32 disable = 0;1496 s32 disable = 0;
@@ -1509,7 +1519,7 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, · 22 unmodified lines
1509 /* Make sure radio is off or on as far as software is concerned */1519 /* Make sure radio is off or on as far as software is concerned */
1510 disable = WL_RADIO_SW_DISABLE << 16;1520 disable = WL_RADIO_SW_DISABLE << 16;
1511 disable = cpu_to_le32(disable);1521 disable = cpu_to_le32(disable);
1512 err = wl_dev_ioctl(ndev, WLC_SET_RADIO, &disable, sizeof(disable));1522 err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_RADIO, &disable, sizeof(disable));
1513 if (unlikely(err))1523 if (unlikely(err))
1514 WL_ERR("WLC_SET_RADIO error (%d)\n", err);1524 WL_ERR("WLC_SET_RADIO error (%d)\n", err);
1515 1525
@@ -1517,21 +1527,21 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, · 1 unmodified line
1517 txpwrmw = 0xffff;1527 txpwrmw = 0xffff;
1518 else1528 else
1519 txpwrmw = (u16) dbm;1529 txpwrmw = (u16) dbm;
1520 err = wl_dev_intvar_set(ndev, "qtxpower",1530 err = brcmf_dev_intvar_set(ndev, "qtxpower",
1521 (s32) (bcm_mw_to_qdbm(txpwrmw)));1531 (s32) (brcmu_mw_to_qdbm(txpwrmw)));
1522 if (unlikely(err))1532 if (unlikely(err))
1523 WL_ERR("qtxpower error (%d)\n", err);1533 WL_ERR("qtxpower error (%d)\n", err);
1524 wl->conf->tx_power = dbm;1534 cfg_priv->conf->tx_power = dbm;
1525 1535
1526done:1536done:
1527 WL_TRACE("Exit\n");1537 WL_TRACE("Exit\n");
1528 return err;1538 return err;
1529}1539}
1530 1540
1531static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)1541static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
1532{1542{
1533 struct wl_priv *wl = wiphy_to_wl(wiphy);1543 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1534 struct net_device *ndev = wl_to_ndev(wl);1544 struct net_device *ndev = cfg_to_ndev(cfg_priv);
1535 s32 txpwrdbm;1545 s32 txpwrdbm;
1536 u8 result;1546 u8 result;
1537 s32 err = 0;1547 s32 err = 0;
@@ -1539,14 +1549,14 @@ static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm) · 1 unmodified line
1539 WL_TRACE("Enter\n");1549 WL_TRACE("Enter\n");
1540 CHECK_SYS_UP();1550 CHECK_SYS_UP();
1541 1551
1542 err = wl_dev_intvar_get(ndev, "qtxpower", &txpwrdbm);1552 err = brcmf_dev_intvar_get(ndev, "qtxpower", &txpwrdbm);
1543 if (unlikely(err)) {1553 if (unlikely(err)) {
1544 WL_ERR("error (%d)\n", err);1554 WL_ERR("error (%d)\n", err);
1545 goto done;1555 goto done;
1546 }1556 }
1547 1557
1548 result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);1558 result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);
1549 *dbm = (s32) bcm_qdbm_to_mw(result);1559 *dbm = (s32) brcmu_qdbm_to_mw(result);
1550 1560
1551done:1561done:
1552 WL_TRACE("Exit\n");1562 WL_TRACE("Exit\n");
@@ -1554,7 +1564,7 @@ done: · 1 unmodified line
1554}1564}
1555 1565
1556static s321566static s32
1557wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,1567brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
1558 u8 key_idx, bool unicast, bool multicast)1568 u8 key_idx, bool unicast, bool multicast)
1559{1569{
1560 u32 index;1570 u32 index;
@@ -1565,7 +1575,7 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, · 4 unmodified lines
1565 WL_CONN("key index (%d)\n", key_idx);1575 WL_CONN("key index (%d)\n", key_idx);
1566 CHECK_SYS_UP();1576 CHECK_SYS_UP();
1567 1577
1568 err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec));1578 err = brcmf_dev_ioctl(dev, BRCMF_C_GET_WSEC, &wsec, sizeof(wsec));
1569 if (unlikely(err)) {1579 if (unlikely(err)) {
1570 WL_ERR("WLC_GET_WSEC error (%d)\n", err);1580 WL_ERR("WLC_GET_WSEC error (%d)\n", err);
1571 goto done;1581 goto done;
@@ -1576,7 +1586,7 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, · 4 unmodified lines
1576 /* Just select a new current key */1586 /* Just select a new current key */
1577 index = (u32) key_idx;1587 index = (u32) key_idx;
1578 index = cpu_to_le32(index);1588 index = cpu_to_le32(index);
1579 err = wl_dev_ioctl(dev, WLC_SET_KEY_PRIMARY, &index,1589 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY_PRIMARY, &index,
1580 sizeof(index));1590 sizeof(index));
1581 if (unlikely(err))1591 if (unlikely(err))
1582 WL_ERR("error (%d)\n", err);1592 WL_ERR("error (%d)\n", err);
@@ -1587,10 +1597,10 @@ done: · 4 unmodified lines
1587}1597}
1588 1598
1589static s321599static s32
1590wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,1600brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
1591 u8 key_idx, const u8 *mac_addr, struct key_params *params)1601 u8 key_idx, const u8 *mac_addr, struct key_params *params)
1592{1602{
1593 struct wl_wsec_key key;1603 struct brcmf_wsec_key key;
1594 s32 err = 0;1604 s32 err = 0;
1595 1605
1596 memset(&key, 0, sizeof(key));1606 memset(&key, 0, sizeof(key));
@@ -1604,7 +1614,7 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, · 7 unmodified lines
1604 if (key.len == 0) {1614 if (key.len == 0) {
1605 /* key delete */1615 /* key delete */
1606 swap_key_from_BE(&key);1616 swap_key_from_BE(&key);
1607 err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));1617 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key));
1608 if (unlikely(err)) {1618 if (unlikely(err)) {
1609 WL_ERR("key delete error (%d)\n", err);1619 WL_ERR("key delete error (%d)\n", err);
1610 return err;1620 return err;
@@ -1663,8 +1673,8 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, · 52 unmodified lines
1663 }1673 }
1664 swap_key_from_BE(&key);1674 swap_key_from_BE(&key);
1665 1675
1666 dhd_wait_pend8021x(dev);1676 brcmf_netdev_wait_pend8021x(dev);
1667 err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));1677 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key));
1668 if (unlikely(err)) {1678 if (unlikely(err)) {
1669 WL_ERR("WLC_SET_KEY error (%d)\n", err);1679 WL_ERR("WLC_SET_KEY error (%d)\n", err);
1670 return err;1680 return err;
@@ -1674,11 +1684,11 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines
1674}1684}
1675 1685
1676static s321686static s32
1677wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,1687brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
1678 u8 key_idx, bool pairwise, const u8 *mac_addr,1688 u8 key_idx, bool pairwise, const u8 *mac_addr,
1679 struct key_params *params)1689 struct key_params *params)
1680{1690{
1681 struct wl_wsec_key key;1691 struct brcmf_wsec_key key;
1682 s32 val;1692 s32 val;
1683 s32 wsec;1693 s32 wsec;
1684 s32 err = 0;1694 s32 err = 0;
@@ -1690,7 +1700,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 5 unmodified lines
1690 1700
1691 if (mac_addr) {1701 if (mac_addr) {
1692 WL_TRACE("Exit");1702 WL_TRACE("Exit");
1693 return wl_add_keyext(wiphy, dev, key_idx, mac_addr, params);1703 return brcmf_add_keyext(wiphy, dev, key_idx, mac_addr, params);
1694 }1704 }
1695 memset(&key, 0, sizeof(key));1705 memset(&key, 0, sizeof(key));
1696 1706
@@ -1704,7 +1714,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 7 unmodified lines
1704 }1714 }
1705 memcpy(key.data, params->key, key.len);1715 memcpy(key.data, params->key, key.len);
1706 1716
1707 key.flags = WL_PRIMARY_KEY;1717 key.flags = BRCMF_PRIMARY_KEY;
1708 switch (params->cipher) {1718 switch (params->cipher) {
1709 case WLAN_CIPHER_SUITE_WEP40:1719 case WLAN_CIPHER_SUITE_WEP40:
1710 key.algo = CRYPTO_ALGO_WEP1;1720 key.algo = CRYPTO_ALGO_WEP1;
@@ -1737,21 +1747,21 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 26 unmodified lines
1737 1747
1738 /* Set the new key/index */1748 /* Set the new key/index */
1739 swap_key_from_BE(&key);1749 swap_key_from_BE(&key);
1740 err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));1750 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key));
1741 if (unlikely(err)) {1751 if (unlikely(err)) {
1742 WL_ERR("WLC_SET_KEY error (%d)\n", err);1752 WL_ERR("WLC_SET_KEY error (%d)\n", err);
1743 goto done;1753 goto done;
1744 }1754 }
1745 1755
1746 val = WEP_ENABLED;1756 val = WEP_ENABLED;
1747 err = wl_dev_intvar_get(dev, "wsec", &wsec);1757 err = brcmf_dev_intvar_get(dev, "wsec", &wsec);
1748 if (unlikely(err)) {1758 if (unlikely(err)) {
1749 WL_ERR("get wsec error (%d)\n", err);1759 WL_ERR("get wsec error (%d)\n", err);
1750 goto done;1760 goto done;
1751 }1761 }
1752 wsec &= ~(WEP_ENABLED);1762 wsec &= ~(WEP_ENABLED);
1753 wsec |= val;1763 wsec |= val;
1754 err = wl_dev_intvar_set(dev, "wsec", wsec);1764 err = brcmf_dev_intvar_set(dev, "wsec", wsec);
1755 if (unlikely(err)) {1765 if (unlikely(err)) {
1756 WL_ERR("set wsec error (%d)\n", err);1766 WL_ERR("set wsec error (%d)\n", err);
1757 goto done;1767 goto done;
@@ -1759,7 +1769,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 1 unmodified line
1759 1769
1760 val = 1; /* assume shared key. otherwise 0 */1770 val = 1; /* assume shared key. otherwise 0 */
1761 val = cpu_to_le32(val);1771 val = cpu_to_le32(val);
1762 err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val));1772 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_AUTH, &val, sizeof(val));
1763 if (unlikely(err))1773 if (unlikely(err))
1764 WL_ERR("WLC_SET_AUTH error (%d)\n", err);1774 WL_ERR("WLC_SET_AUTH error (%d)\n", err);
1765done:1775done:
@@ -1768,10 +1778,10 @@ done: · 2 unmodified lines
1768}1778}
1769 1779
1770static s321780static s32
1771wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,1781brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
1772 u8 key_idx, bool pairwise, const u8 *mac_addr)1782 u8 key_idx, bool pairwise, const u8 *mac_addr)
1773{1783{
1774 struct wl_wsec_key key;1784 struct brcmf_wsec_key key;
1775 s32 err = 0;1785 s32 err = 0;
1776 s32 val;1786 s32 val;
1777 s32 wsec;1787 s32 wsec;
@@ -1781,13 +1791,13 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines
1781 memset(&key, 0, sizeof(key));1791 memset(&key, 0, sizeof(key));
1782 1792
1783 key.index = (u32) key_idx;1793 key.index = (u32) key_idx;
1784 key.flags = WL_PRIMARY_KEY;1794 key.flags = BRCMF_PRIMARY_KEY;
1785 key.algo = CRYPTO_ALGO_OFF;1795 key.algo = CRYPTO_ALGO_OFF;
1786 1796
1787 WL_CONN("key index (%d)\n", key_idx);1797 WL_CONN("key index (%d)\n", key_idx);
1788 /* Set the new key/index */1798 /* Set the new key/index */
1789 swap_key_from_BE(&key);1799 swap_key_from_BE(&key);
1790 err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));1800 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key));
1791 if (unlikely(err)) {1801 if (unlikely(err)) {
1792 if (err == -EINVAL) {1802 if (err == -EINVAL) {
1793 if (key.index >= DOT11_MAX_DEFAULT_KEYS)1803 if (key.index >= DOT11_MAX_DEFAULT_KEYS)
@@ -1802,7 +1812,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, · 8 unmodified lines
1802 }1812 }
1803 1813
1804 val = 0;1814 val = 0;
1805 err = wl_dev_intvar_get(dev, "wsec", &wsec);1815 err = brcmf_dev_intvar_get(dev, "wsec", &wsec);
1806 if (unlikely(err)) {1816 if (unlikely(err)) {
1807 WL_ERR("get wsec error (%d)\n", err);1817 WL_ERR("get wsec error (%d)\n", err);
1808 /* Ignore this error, may happen during DISASSOC */1818 /* Ignore this error, may happen during DISASSOC */
@@ -1811,7 +1821,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, · 2 unmodified lines
1811 }1821 }
1812 wsec &= ~(WEP_ENABLED);1822 wsec &= ~(WEP_ENABLED);
1813 wsec |= val;1823 wsec |= val;
1814 err = wl_dev_intvar_set(dev, "wsec", wsec);1824 err = brcmf_dev_intvar_set(dev, "wsec", wsec);
1815 if (unlikely(err)) {1825 if (unlikely(err)) {
1816 WL_ERR("set wsec error (%d)\n", err);1826 WL_ERR("set wsec error (%d)\n", err);
1817 /* Ignore this error, may happen during DISASSOC */1827 /* Ignore this error, may happen during DISASSOC */
@@ -1821,7 +1831,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines
1821 1831
1822 val = 0; /* assume open key. otherwise 1 */1832 val = 0; /* assume open key. otherwise 1 */
1823 val = cpu_to_le32(val);1833 val = cpu_to_le32(val);
1824 err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val));1834 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_AUTH, &val, sizeof(val));
1825 if (unlikely(err)) {1835 if (unlikely(err)) {
1826 WL_ERR("WLC_SET_AUTH error (%d)\n", err);1836 WL_ERR("WLC_SET_AUTH error (%d)\n", err);
1827 /* Ignore this error, may happen during DISASSOC */1837 /* Ignore this error, may happen during DISASSOC */
@@ -1833,14 +1843,14 @@ done: · 5 unmodified lines
1833}1843}
1834 1844
1835static s321845static s32
1836wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,1846brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
1837 u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,1847 u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
1838 void (*callback) (void *cookie, struct key_params * params))1848 void (*callback) (void *cookie, struct key_params * params))
1839{1849{
1840 struct key_params params;1850 struct key_params params;
1841 struct wl_wsec_key key;1851 struct brcmf_wsec_key key;
1842 struct wl_priv *wl = wiphy_to_wl(wiphy);1852 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1843 struct wl_security *sec;1853 struct brcmf_cfg80211_security *sec;
1844 s32 wsec;1854 s32 wsec;
1845 s32 err = 0;1855 s32 err = 0;
1846 1856
@@ -1855,7 +1865,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, · 8 unmodified lines
1855 params.key_len = (u8) min_t(u8, WLAN_MAX_KEY_LEN, key.len);1865 params.key_len = (u8) min_t(u8, WLAN_MAX_KEY_LEN, key.len);
1856 memcpy(params.key, key.data, params.key_len);1866 memcpy(params.key, key.data, params.key_len);
1857 1867
1858 err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec));1868 err = brcmf_dev_ioctl(dev, BRCMF_C_GET_WSEC, &wsec, sizeof(wsec));
1859 if (unlikely(err)) {1869 if (unlikely(err)) {
1860 WL_ERR("WLC_GET_WSEC error (%d)\n", err);1870 WL_ERR("WLC_GET_WSEC error (%d)\n", err);
1861 /* Ignore this error, may happen during DISASSOC */1871 /* Ignore this error, may happen during DISASSOC */
@@ -1865,7 +1875,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines
1865 wsec = le32_to_cpu(wsec);1875 wsec = le32_to_cpu(wsec);
1866 switch (wsec) {1876 switch (wsec) {
1867 case WEP_ENABLED:1877 case WEP_ENABLED:
1868 sec = wl_read_prof(wl, WL_PROF_SEC);1878 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
1869 if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) {1879 if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) {
1870 params.cipher = WLAN_CIPHER_SUITE_WEP40;1880 params.cipher = WLAN_CIPHER_SUITE_WEP40;
1871 WL_CONN("WLAN_CIPHER_SUITE_WEP40\n");1881 WL_CONN("WLAN_CIPHER_SUITE_WEP40\n");
@@ -1895,7 +1905,7 @@ done: · 23 unmodified lines
1895}1905}
1896 1906
1897static s321907static s32
1898wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,1908brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
1899 struct net_device *dev, u8 key_idx)1909 struct net_device *dev, u8 key_idx)
1900{1910{
1901 WL_INFO("Not supported\n");1911 WL_INFO("Not supported\n");
@@ -1905,15 +1915,15 @@ wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, · 3 unmodified lines
1905}1915}
1906 1916
1907static s321917static s32
1908wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,1918brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
1909 u8 *mac, struct station_info *sinfo)1919 u8 *mac, struct station_info *sinfo)
1910{1920{
1911 struct wl_priv *wl = wiphy_to_wl(wiphy);1921 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1912 scb_val_t scb_val;1922 struct brcmf_scb_val scb_val;
1913 int rssi;1923 int rssi;
1914 s32 rate;1924 s32 rate;
1915 s32 err = 0;1925 s32 err = 0;
1916 u8 *bssid = wl_read_prof(wl, WL_PROF_BSSID);1926 u8 *bssid = brcmf_read_prof(cfg_priv, WL_PROF_BSSID);
1917 1927
1918 WL_TRACE("Enter\n");1928 WL_TRACE("Enter\n");
1919 CHECK_SYS_UP();1929 CHECK_SYS_UP();
@@ -1930,7 +1940,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, · 10 unmodified lines
1930 }1940 }
1931 1941
1932 /* Report the current tx rate */1942 /* Report the current tx rate */
1933 err = wl_dev_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate));1943 err = brcmf_dev_ioctl(dev, BRCMF_C_GET_RATE, &rate, sizeof(rate));
1934 if (err) {1944 if (err) {
1935 WL_ERR("Could not get rate (%d)\n", err);1945 WL_ERR("Could not get rate (%d)\n", err);
1936 } else {1946 } else {
@@ -1940,10 +1950,10 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines
1940 WL_CONN("Rate %d Mbps\n", rate / 2);1950 WL_CONN("Rate %d Mbps\n", rate / 2);
1941 }1951 }
1942 1952
1943 if (test_bit(WL_STATUS_CONNECTED, &wl->status)) {1953 if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) {
1944 scb_val.val = 0;1954 scb_val.val = 0;
1945 err = wl_dev_ioctl(dev, WLC_GET_RSSI, &scb_val,1955 err = brcmf_dev_ioctl(dev, BRCMF_C_GET_RSSI, &scb_val,
1946 sizeof(scb_val_t));1956 sizeof(struct brcmf_scb_val));
1947 if (unlikely(err)) {1957 if (unlikely(err)) {
1948 WL_ERR("Could not get rssi (%d)\n", err);1958 WL_ERR("Could not get rssi (%d)\n", err);
1949 }1959 }
@@ -1959,7 +1969,7 @@ done: · 9 unmodified lines
1959}1969}
1960 1970
1961static s321971static s32
1962wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,1972brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
1963 bool enabled, s32 timeout)1973 bool enabled, s32 timeout)
1964{1974{
1965 s32 pm;1975 s32 pm;
@@ -1972,7 +1982,7 @@ wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, · 6 unmodified lines
1972 pm = cpu_to_le32(pm);1982 pm = cpu_to_le32(pm);
1973 WL_INFO("power save %s\n", (pm ? "enabled" : "disabled"));1983 WL_INFO("power save %s\n", (pm ? "enabled" : "disabled"));
1974 1984
1975 err = wl_dev_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm));1985 err = brcmf_dev_ioctl(dev, BRCMF_C_SET_PM, &pm, sizeof(pm));
1976 if (unlikely(err)) {1986 if (unlikely(err)) {
1977 if (err == -ENODEV)1987 if (err == -ENODEV)
1978 WL_ERR("net_device is not ready yet\n");1988 WL_ERR("net_device is not ready yet\n");
@@ -1983,7 +1993,7 @@ wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, · 4 unmodified lines
1983 return err;1993 return err;
1984}1994}
1985 1995
1986static __used u32 wl_find_msb(u16 bit16)1996static __used u32 brcmf_find_msb(u16 bit16)
1987{1997{
1988 u32 ret = 0;1998 u32 ret = 0;
1989 1999
@@ -2011,7 +2021,7 @@ static __used u32 wl_find_msb(u16 bit16) · 21 unmodified lines
2011}2021}
2012 2022
2013static s322023static s32
2014wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,2024brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
2015 const u8 *addr,2025 const u8 *addr,
2016 const struct cfg80211_bitrate_mask *mask)2026 const struct cfg80211_bitrate_mask *mask)
2017{2027{
@@ -2028,7 +2038,7 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, · 10 unmodified lines
2028 2038
2029 /* addr param is always NULL. ignore it */2039 /* addr param is always NULL. ignore it */
2030 /* Get current rateset */2040 /* Get current rateset */
2031 err = wl_dev_ioctl(dev, WLC_GET_CURR_RATESET, &rateset,2041 err = brcmf_dev_ioctl(dev, BRCM_GET_CURR_RATESET, &rateset,
2032 sizeof(rateset));2042 sizeof(rateset));
2033 if (unlikely(err)) {2043 if (unlikely(err)) {
2034 WL_ERR("could not get current rateset (%d)\n", err);2044 WL_ERR("could not get current rateset (%d)\n", err);
@@ -2037,9 +2047,9 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, · 2 unmodified lines
2037 2047
2038 rateset.count = le32_to_cpu(rateset.count);2048 rateset.count = le32_to_cpu(rateset.count);
2039 2049
2040 legacy = wl_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy);2050 legacy = brcmf_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy);
2041 if (!legacy)2051 if (!legacy)
2042 legacy = wl_find_msb(mask->control[IEEE80211_BAND_5GHZ].legacy);2052 legacy = brcmf_find_msb(mask->control[IEEE80211_BAND_5GHZ].legacy);
2043 2053
2044 val = wl_g_rates[legacy - 1].bitrate * 100000;2054 val = wl_g_rates[legacy - 1].bitrate * 100000;
2045 2055
@@ -2057,8 +2067,8 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, · 11 unmodified lines
2057 * Set rate override,2067 * Set rate override,
2058 * Since the is a/b/g-blind, both a/bg_rate are enforced.2068 * Since the is a/b/g-blind, both a/bg_rate are enforced.
2059 */2069 */
2060 err_bg = wl_dev_intvar_set(dev, "bg_rate", rate);2070 err_bg = brcmf_dev_intvar_set(dev, "bg_rate", rate);
2061 err_a = wl_dev_intvar_set(dev, "a_rate", rate);2071 err_a = brcmf_dev_intvar_set(dev, "a_rate", rate);
2062 if (unlikely(err_bg && err_a)) {2072 if (unlikely(err_bg && err_a)) {
2063 WL_ERR("could not set fixed rate (%d) (%d)\n", err_bg, err_a);2073 WL_ERR("could not set fixed rate (%d) (%d)\n", err_bg, err_a);
2064 err = err_bg | err_a;2074 err = err_bg | err_a;
@@ -2069,10 +2079,9 @@ done: · 4 unmodified lines
2069 return err;2079 return err;
2070}2080}
2071 2081
2072static s32 wl_cfg80211_resume(struct wiphy *wiphy)2082static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
2073{2083{
2074 struct wl_priv *wl = wiphy_to_wl(wiphy);2084 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
2075 struct net_device *ndev = wl_to_ndev(wl);
2076 2085
2077 /*2086 /*
2078 * Check for WL_STATUS_READY before any function call which2087 * Check for WL_STATUS_READY before any function call which
@@ -2082,23 +2091,21 @@ static s32 wl_cfg80211_resume(struct wiphy *wiphy) · 3 unmodified lines
2082 WL_TRACE("Enter\n");2091 WL_TRACE("Enter\n");
2083 2092
2084#if defined(CONFIG_PM_SLEEP)2093#if defined(CONFIG_PM_SLEEP)
2085 atomic_set(&dhd_mmc_suspend, false);2094 atomic_set(&brcmf_mmc_suspend, false);
2086#endif /* defined(CONFIG_PM_SLEEP) */2095#endif /* defined(CONFIG_PM_SLEEP) */
2087 2096
2088 if (test_bit(WL_STATUS_READY, &wl->status)) {

2688 more lines aren’t shown here.

drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h+75−132

This diff is large: its 395 lines aren’t shown here.

drivers/staging/brcm80211/brcmfmac/wl_iw.c+0−3689

This diff is large: its 3690 lines aren’t shown here.

drivers/staging/brcm80211/brcmfmac/wl_iw.h+0−142

This diff is large: its 143 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/Makefile+22−23

This diff is large: its 53 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/aiutils.c+471−246

This diff is large: its 1296 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/aiutils.h+134−96

This diff is large: its 320 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/alloc.crenamed from drivers/staging/brcm80211/brcmsmac/wlc_alloc.c+64−89

This diff is large: its 333 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/alloc.hrenamed from drivers/staging/brcm80211/brcmsmac/wlc_alloc.h+3−2

This diff is large: its 9 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/ampdu.crenamed from drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c+188−222

This diff is large: its 902 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/ampdu.hrenamed from drivers/staging/brcm80211/brcmsmac/wlc_types.h+12−19

This diff is large: its 37 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/antsel.crenamed from drivers/staging/brcm80211/brcmsmac/wlc_antsel.c+52−61

This diff is large: its 230 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/antsel.hrenamed from drivers/staging/brcm80211/brcmsmac/wlc_antsel.h+8−8

This diff is large: its 25 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/bcmotp.c+0−936

This diff is large: its 937 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/bcmsrom.c+0−714

This diff is large: its 715 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/bmac.crenamed from drivers/staging/brcm80211/brcmsmac/wlc_bmac.c+551−561

This diff is large: its 2953 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/bmac.h+174−0

This diff is large: its 175 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/channel.crenamed from drivers/staging/brcm80211/brcmsmac/wlc_channel.c+298−296

This diff is large: its 1281 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/channel.hrenamed from drivers/staging/brcm80211/brcmsmac/wlc_channel.h+47−35

This diff is large: its 127 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/d11.h+81−79

This diff is large: its 385 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/dma.crenamed from drivers/staging/brcm80211/brcmsmac/hnddma.c+362−201

This diff is large: its 1258 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/dma.hrenamed from drivers/staging/brcm80211/include/hnddma.h+85−61

This diff is large: its 206 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/mac80211_if.crenamed from drivers/staging/brcm80211/brcmsmac/wl_mac80211.c+404−418

This diff is large: its 1879 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/mac80211_if.hrenamed from drivers/staging/brcm80211/brcmsmac/wl_mac80211.h+49−26

This diff is large: its 124 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/main.crenamed from drivers/staging/brcm80211/brcmsmac/wlc_main.c+1431−2858

This diff is large: its 7555 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/main.hrenamed from drivers/staging/brcm80211/brcmsmac/wlc_main.h+440−354

This diff is large: its 1163 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/nicpci.c+343−329

This diff is large: its 1040 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/nicpci.h+85−0

This diff is large: its 86 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/nvram.c+0−215

This diff is large: its 216 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/otp.c+544−0

This diff is large: its 545 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/otp.hrenamed from drivers/staging/brcm80211/include/bcmotp.h+8−5

This diff is large: its 26 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.crenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c+318−400

This diff is large: its 1856 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h+294−0

This diff is large: its 295 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phy_int.hrenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_int.h+238−229

This diff is large: its 806 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.crenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c+288−296

This diff is large: its 1639 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.hrenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.h+7−5

This diff is large: its 31 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phy_n.crenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c+472−559

This diff is large: its 2914 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phy_qmath.crenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_qmath.c+1−3

This diff is large: its 11 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phy_qmath.hrenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_qmath.h+5−3

This diff is large: its 19 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phy_radio.hrenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_radio.h+3−3

This diff is large: its 17 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phy_version.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phyreg_n.hrenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phyreg_n.h+7−7

This diff is large: its 21 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.crenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phytbl_lcn.c+26−27

This diff is large: its 165 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.hrenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phytbl_lcn.h+20−15

This diff is large: its 57 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phytbl_n.crenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phytbl_n.c+25−28

This diff is large: its 142 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/phytbl_n.hrenamed from drivers/staging/brcm80211/brcmsmac/phy/wlc_phytbl_n.h+11−10

This diff is large: its 36 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_hal.h+0−256

This diff is large: its 257 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy_shim.c+218−0

This diff is large: its 219 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/phy_shim.h+164−0

This diff is large: its 165 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/pmu.c+474−0

This diff is large: its 475 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/pmu.hrenamed from drivers/staging/brcm80211/brcmsmac/wlc_pmu.h+19−25

This diff is large: its 57 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/pub.hrenamed from drivers/staging/brcm80211/brcmsmac/wlc_pub.h+254−173

This diff is large: its 620 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/rate.crenamed from drivers/staging/brcm80211/brcmsmac/wlc_rate.c+103−104

This diff is large: its 456 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/rate.hrenamed from drivers/staging/brcm80211/brcmsmac/wlc_rate.h+60−56

This diff is large: its 171 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/scb.hrenamed from drivers/staging/brcm80211/brcmsmac/wlc_scb.h+18−13

This diff is large: its 71 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/srom.crenamed from drivers/staging/brcm80211/brcmsmac/bcmsrom_tbl.h+807−83

This diff is large: its 929 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/srom.hrenamed from drivers/staging/brcm80211/include/bcmsrom.h+6−6

This diff is large: its 28 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/stf.crenamed from drivers/staging/brcm80211/brcmsmac/wlc_stf.c+79−125

This diff is large: its 468 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/stf.h+42−0

This diff is large: its 43 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/types.h+398−0

This diff is large: its 399 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/ucode_loader.crenamed from drivers/staging/brcm80211/brcmsmac/wl_ucode_loader.c+42−38

This diff is large: its 112 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/ucode_loader.hrenamed from drivers/staging/brcm80211/brcmsmac/wl_ucode.h+9−6

This diff is large: its 28 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wl_dbg.h+0−92

This diff is large: its 93 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wl_export.h+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wlc_ampdu.h+0−29

This diff is large: its 30 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wlc_bmac.h+0−178

This diff is large: its 179 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wlc_bsscfg.h+0−135

This diff is large: its 136 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wlc_cfg.h+0−280

This diff is large: its 281 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wlc_key.h+0−140

This diff is large: its 141 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wlc_phy_shim.c+0−243

This diff is large: its 244 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wlc_phy_shim.h+0−112

This diff is large: its 113 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wlc_pmu.c+0−1929

This diff is large: its 1930 lines aren’t shown here.

drivers/staging/brcm80211/brcmsmac/wlc_stf.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/brcm80211/brcmutil/Makefilerenamed from drivers/staging/brcm80211/util/Makefile+3−3

This diff is large: its 16 lines aren’t shown here.

drivers/staging/brcm80211/brcmutil/utils.crenamed from drivers/staging/brcm80211/util/bcmutils.c+72−81

This diff is large: its 460 lines aren’t shown here.

drivers/staging/brcm80211/brcmutil/wifi.crenamed from drivers/staging/brcm80211/util/bcmwifi.c+7−13

This diff is large: its 65 lines aren’t shown here.

drivers/staging/brcm80211/include/aidmp.h+0−374

This diff is large: its 375 lines aren’t shown here.

drivers/staging/brcm80211/include/bcmdefs.h+0−150

This diff is large: its 151 lines aren’t shown here.

drivers/staging/brcm80211/include/bcmdevs.h+0−124

This diff is large: its 125 lines aren’t shown here.

drivers/staging/brcm80211/include/bcmnvram.h+0−153

This diff is large: its 154 lines aren’t shown here.

drivers/staging/brcm80211/include/bcmsdh.h+0−205

This diff is large: its 206 lines aren’t shown here.

drivers/staging/brcm80211/include/bcmsdpcm.h+0−208

This diff is large: its 209 lines aren’t shown here.

drivers/staging/brcm80211/include/bcmsrom_fmt.h+0−367

This diff is large: its 368 lines aren’t shown here.

drivers/staging/brcm80211/include/bcmutils.h+0−500

This diff is large: its 501 lines aren’t shown here.

drivers/staging/brcm80211/include/brcm_hw_ids.h+59−0

This diff is large: its 60 lines aren’t shown here.

drivers/staging/brcm80211/include/brcmu_utils.h+301−0

This diff is large: its 302 lines aren’t shown here.

drivers/staging/brcm80211/include/brcmu_wifi.hrenamed from drivers/staging/brcm80211/include/bcmwifi.h+101−25

This diff is large: its 175 lines aren’t shown here.

drivers/staging/brcm80211/include/chipcommon.h+281−0

This diff is large: its 282 lines aren’t shown here.

drivers/staging/brcm80211/include/defs.h+112−0

This diff is large: its 113 lines aren’t shown here.

drivers/staging/brcm80211/include/hndsoc.h+0−199

This diff is large: its 200 lines aren’t shown here.

drivers/staging/brcm80211/include/nicpci.h+0−79

This diff is large: its 80 lines aren’t shown here.

drivers/staging/brcm80211/include/pci_core.h+0−122

This diff is large: its 123 lines aren’t shown here.

drivers/staging/brcm80211/include/pcicfg.h+0−50

This diff is large: its 51 lines aren’t shown here.

drivers/staging/brcm80211/include/pcie_core.h+0−299

This diff is large: its 300 lines aren’t shown here.

drivers/staging/brcm80211/include/proto/802.11.h+0−200

This diff is large: its 201 lines aren’t shown here.

drivers/staging/brcm80211/include/proto/bcmeth.h+0−44

This diff is large: its 45 lines aren’t shown here.

drivers/staging/brcm80211/include/proto/bcmevent.h+0−207

This diff is large: its 208 lines aren’t shown here.

drivers/staging/brcm80211/include/sbchipc.h+0−1588

This diff is large: its 1589 lines aren’t shown here.

drivers/staging/brcm80211/include/sbconfig.h+0−272

This diff is large: its 273 lines aren’t shown here.

drivers/staging/brcm80211/include/sbhnddma.h+0−315

This diff is large: its 316 lines aren’t shown here.

drivers/staging/brcm80211/include/sbsdio.h+0−152

This diff is large: its 153 lines aren’t shown here.

drivers/staging/brcm80211/include/sbsdpcmdev.h+0−281

This diff is large: its 282 lines aren’t shown here.

drivers/staging/brcm80211/include/sdio.h+0−552

This diff is large: its 553 lines aren’t shown here.

drivers/staging/brcm80211/include/soc.h+95−0

This diff is large: its 96 lines aren’t shown here.

drivers/staging/brcm80211/include/wlioctl.h+0−1365

This diff is large: its 1366 lines aren’t shown here.

drivers/staging/comedi/Kconfig+10−0

This diff is large: its 17 lines aren’t shown here.

drivers/staging/comedi/comedi.h+5−1

This diff is large: its 18 lines aren’t shown here.

drivers/staging/comedi/comedi_fops.c+8−10

This diff is large: its 49 lines aren’t shown here.

drivers/staging/comedi/comedidev.h+0−3

This diff is large: its 10 lines aren’t shown here.

drivers/staging/comedi/drivers.c+4−0

This diff is large: its 12 lines aren’t shown here.

drivers/staging/comedi/drivers/Makefile+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/comedi/drivers/addi-data/addi_common.c+1−1

This diff is large: its 10 lines aren’t shown here.

drivers/staging/comedi/drivers/adl_pci9118.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/comedi/drivers/adv_pci1723.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/comedi/drivers/das1800.c+12−16

This diff is large: its 105 lines aren’t shown here.

drivers/staging/comedi/drivers/dt282x.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/comedi/drivers/dyna_pci10xx.c+462−0

This diff is large: its 463 lines aren’t shown here.

drivers/staging/comedi/drivers/ni_at_a2150.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/comedi/drivers/ni_daq_700.c+5−5

This diff is large: its 41 lines aren’t shown here.

drivers/staging/comedi/drivers/ni_labpc.c+34−3

This diff is large: its 189 lines aren’t shown here.

drivers/staging/comedi/drivers/pcl812.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/comedi/drivers/pcl816.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/comedi/drivers/pcl818.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/comedi/drivers/rtd520.c+13−9

This diff is large: its 74 lines aren’t shown here.

drivers/staging/comedi/drivers/serial2002.c+16−29

This diff is large: its 170 lines aren’t shown here.

drivers/staging/comedi/drivers/unioxx5.c+29−17

This diff is large: its 137 lines aren’t shown here.

drivers/staging/comedi/drivers/usbdux.c+3−4

This diff is large: its 29 lines aren’t shown here.

drivers/staging/cs5535_gpio/Kconfig+0−11

This diff is large: its 12 lines aren’t shown here.

drivers/staging/cs5535_gpio/Makefile+0−1

This diff is large: its 2 lines aren’t shown here.

drivers/staging/cs5535_gpio/TODO+0−6

This diff is large: its 7 lines aren’t shown here.

drivers/staging/cs5535_gpio/cs5535_gpio.c+0−260

This diff is large: its 261 lines aren’t shown here.

drivers/staging/cxd2099/cxd2099.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/cxt1e1/sbecom_inline_linux.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/dt3155v4l/Kconfig+9−1

This diff is large: its 21 lines aren’t shown here.

drivers/staging/dt3155v4l/dt3155v4l.c+169−317

This diff is large: its 787 lines aren’t shown here.

drivers/staging/dt3155v4l/dt3155v4l.h+6−16

This diff is large: its 43 lines aren’t shown here.

drivers/staging/easycap/Kconfig+2−30

This diff is large: its 45 lines aren’t shown here.

drivers/staging/easycap/Makefile+1−3

This diff is large: its 11 lines aren’t shown here.

drivers/staging/easycap/README+2−26

This diff is large: its 49 lines aren’t shown here.

drivers/staging/easycap/easycap.h+0−46

This diff is large: its 115 lines aren’t shown here.

drivers/staging/easycap/easycap_ioctl.c+1−16

This diff is large: its 47 lines aren’t shown here.

drivers/staging/easycap/easycap_main.c+7−149

This diff is large: its 335 lines aren’t shown here.

drivers/staging/easycap/easycap_settings.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/easycap/easycap_sound.c+0−35

This diff is large: its 106 lines aren’t shown here.

drivers/staging/easycap/easycap_sound_oss.c+0−954

This diff is large: its 955 lines aren’t shown here.

drivers/staging/echo/echo.c+2−9

This diff is large: its 72 lines aren’t shown here.

drivers/staging/et131x/et1310_address_map.h+137−186

This diff is large: its 533 lines aren’t shown here.

drivers/staging/et131x/et1310_mac.c+149−116

This diff is large: its 380 lines aren’t shown here.

drivers/staging/et131x/et1310_phy.c+16−17

This diff is large: its 111 lines aren’t shown here.

drivers/staging/et131x/et1310_phy.h+58−111

This diff is large: its 202 lines aren’t shown here.

drivers/staging/et131x/et1310_pm.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/et131x/et1310_rx.c+106−108

This diff is large: its 299 lines aren’t shown here.

drivers/staging/et131x/et1310_tx.c+6−6

This diff is large: its 42 lines aren’t shown here.

drivers/staging/et131x/et131x.h+2−2

This diff is large: its 15 lines aren’t shown here.

drivers/staging/et131x/et131x_adapter.h+8−13

This diff is large: its 79 lines aren’t shown here.

drivers/staging/et131x/et131x_defs.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/et131x/et131x_initpci.c+17−17

This diff is large: its 75 lines aren’t shown here.

drivers/staging/et131x/et131x_isr.c+10−10

This diff is large: its 58 lines aren’t shown here.

drivers/staging/et131x/et131x_netdev.c+61−78

This diff is large: its 215 lines aren’t shown here.

drivers/staging/ft1000/ft1000-pcmcia/ft1000.conf+0−14

This diff is large: its 15 lines aren’t shown here.

drivers/staging/ft1000/ft1000-pcmcia/ft1000.h+80−400

This diff is large: its 490 lines aren’t shown here.

drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c+20−170

This diff is large: its 291 lines aren’t shown here.

drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h+0−66

This diff is large: its 67 lines aren’t shown here.

drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c+198−363

This diff is large: its 790 lines aren’t shown here.

drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c+84−140

This diff is large: its 714 lines aren’t shown here.

drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c+12−14

This diff is large: its 61 lines aren’t shown here.

drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h+0−32

This diff is large: its 39 lines aren’t shown here.

drivers/staging/ft1000/ft1000-usb/ft1000_usb.h+10−403

This diff is large: its 455 lines aren’t shown here.

drivers/staging/ft1000/ft1000.h+252−0

This diff is large: its 253 lines aren’t shown here.

drivers/staging/generic_serial/Kconfig+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/generic_serial/Makefile+0−6

This diff is large: its 7 lines aren’t shown here.

drivers/staging/generic_serial/TODO+0−6

This diff is large: its 7 lines aren’t shown here.

drivers/staging/generic_serial/generic_serial.c+0−844

This diff is large: its 845 lines aren’t shown here.

drivers/staging/generic_serial/rio/Makefile+0−12

This diff is large: its 13 lines aren’t shown here.

drivers/staging/generic_serial/rio/board.h+0−132

This diff is large: its 133 lines aren’t shown here.

drivers/staging/generic_serial/rio/cirrus.h+0−210

This diff is large: its 211 lines aren’t shown here.

drivers/staging/generic_serial/rio/cmdblk.h+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/generic_serial/rio/cmdpkt.h+0−177

This diff is large: its 178 lines aren’t shown here.

drivers/staging/generic_serial/rio/daemon.h+0−307

This diff is large: its 308 lines aren’t shown here.

drivers/staging/generic_serial/rio/errors.h+0−98

This diff is large: its 99 lines aren’t shown here.

drivers/staging/generic_serial/rio/func.h+0−143

This diff is large: its 144 lines aren’t shown here.

drivers/staging/generic_serial/rio/host.h+0−123

This diff is large: its 124 lines aren’t shown here.

drivers/staging/generic_serial/rio/link.h+0−96

This diff is large: its 97 lines aren’t shown here.

drivers/staging/generic_serial/rio/linux_compat.h+0−77

This diff is large: its 78 lines aren’t shown here.

drivers/staging/generic_serial/rio/map.h+0−98

This diff is large: its 99 lines aren’t shown here.

drivers/staging/generic_serial/rio/param.h+0−55

This diff is large: its 56 lines aren’t shown here.

drivers/staging/generic_serial/rio/parmmap.h+0−81

This diff is large: its 82 lines aren’t shown here.

drivers/staging/generic_serial/rio/pci.h+0−72

This diff is large: its 73 lines aren’t shown here.

drivers/staging/generic_serial/rio/phb.h+0−142

This diff is large: its 143 lines aren’t shown here.

drivers/staging/generic_serial/rio/pkt.h+0−77

This diff is large: its 78 lines aren’t shown here.

drivers/staging/generic_serial/rio/port.h+0−179

This diff is large: its 180 lines aren’t shown here.

drivers/staging/generic_serial/rio/protsts.h+0−110

This diff is large: its 111 lines aren’t shown here.

drivers/staging/generic_serial/rio/rio.h+0−208

This diff is large: its 209 lines aren’t shown here.

drivers/staging/generic_serial/rio/rio_linux.c+0−1204

This diff is large: its 1205 lines aren’t shown here.

drivers/staging/generic_serial/rio/rio_linux.h+0−197

This diff is large: its 198 lines aren’t shown here.

drivers/staging/generic_serial/rio/rioboard.h+0−275

This diff is large: its 276 lines aren’t shown here.

drivers/staging/generic_serial/rio/rioboot.c+0−1113

This diff is large: its 1114 lines aren’t shown here.

drivers/staging/generic_serial/rio/riocmd.c+0−939

This diff is large: its 940 lines aren’t shown here.

drivers/staging/generic_serial/rio/rioctrl.c+0−1504

This diff is large: its 1505 lines aren’t shown here.

drivers/staging/generic_serial/rio/riodrvr.h+0−138

This diff is large: its 139 lines aren’t shown here.

drivers/staging/generic_serial/rio/rioinfo.h+0−92

This diff is large: its 93 lines aren’t shown here.

drivers/staging/generic_serial/rio/rioinit.c+0−421

This diff is large: its 422 lines aren’t shown here.

drivers/staging/generic_serial/rio/riointr.c+0−645

This diff is large: its 646 lines aren’t shown here.

drivers/staging/generic_serial/rio/rioioctl.h+0−57

This diff is large: its 58 lines aren’t shown here.

drivers/staging/generic_serial/rio/rioparam.c+0−663

This diff is large: its 664 lines aren’t shown here.

drivers/staging/generic_serial/rio/rioroute.c+0−1039

This diff is large: its 1040 lines aren’t shown here.

drivers/staging/generic_serial/rio/riospace.h+0−154

This diff is large: its 155 lines aren’t shown here.

drivers/staging/generic_serial/rio/riotable.c+0−941

This diff is large: its 942 lines aren’t shown here.

drivers/staging/generic_serial/rio/riotty.c+0−654

This diff is large: its 655 lines aren’t shown here.

drivers/staging/generic_serial/rio/route.h+0−101

This diff is large: its 102 lines aren’t shown here.

drivers/staging/generic_serial/rio/rup.h+0−69

This diff is large: its 70 lines aren’t shown here.

drivers/staging/generic_serial/rio/unixrup.h+0−51

This diff is large: its 52 lines aren’t shown here.

drivers/staging/generic_serial/ser_a2232.c+0−831

This diff is large: its 832 lines aren’t shown here.

drivers/staging/generic_serial/ser_a2232.h+0−202

This diff is large: its 203 lines aren’t shown here.

drivers/staging/generic_serial/ser_a2232fw.ax+0−529

This diff is large: its 530 lines aren’t shown here.

drivers/staging/generic_serial/ser_a2232fw.h+0−306

This diff is large: its 307 lines aren’t shown here.

drivers/staging/generic_serial/sx.c+0−2894

This diff is large: its 2895 lines aren’t shown here.

drivers/staging/generic_serial/sx.h+0−201

This diff is large: its 202 lines aren’t shown here.

drivers/staging/generic_serial/sxboards.h+0−206

This diff is large: its 207 lines aren’t shown here.

drivers/staging/generic_serial/sxwindow.h+0−393

This diff is large: its 394 lines aren’t shown here.

drivers/staging/generic_serial/vme_scc.c+0−1145

This diff is large: its 1146 lines aren’t shown here.

drivers/staging/gma500/Kconfig+24−3

This diff is large: its 37 lines aren’t shown here.

drivers/staging/gma500/Makefile+37−11

This diff is large: its 62 lines aren’t shown here.

drivers/staging/gma500/TODO+9−20

This diff is large: its 36 lines aren’t shown here.

drivers/staging/gma500/accel_2d.crenamed from drivers/staging/gma500/psb_2d.c+150−148

This diff is large: its 414 lines aren’t shown here.

drivers/staging/gma500/backlight.c+49−0

This diff is large: its 50 lines aren’t shown here.

drivers/staging/gma500/cdv_device.c+351−0

This diff is large: its 352 lines aren’t shown here.

drivers/staging/gma500/cdv_device.h+36−0

This diff is large: its 37 lines aren’t shown here.

drivers/staging/gma500/cdv_intel_crt.c+326−0

This diff is large: its 327 lines aren’t shown here.

drivers/staging/gma500/cdv_intel_display.c+1508−0

This diff is large: its 1509 lines aren’t shown here.

drivers/staging/gma500/cdv_intel_hdmi.c+376−0

This diff is large: its 377 lines aren’t shown here.

drivers/staging/gma500/cdv_intel_lvds.c+721−0

This diff is large: its 722 lines aren’t shown here.

drivers/staging/gma500/displays/hdmi.h+33−0

This diff is large: its 34 lines aren’t shown here.

drivers/staging/gma500/displays/pyr_cmd.h+34−0

This diff is large: its 35 lines aren’t shown here.

drivers/staging/gma500/displays/pyr_vid.h+34−0

This diff is large: its 35 lines aren’t shown here.

drivers/staging/gma500/displays/tmd_cmd.h+34−0

This diff is large: its 35 lines aren’t shown here.

drivers/staging/gma500/displays/tmd_vid.h+34−0

This diff is large: its 35 lines aren’t shown here.

drivers/staging/gma500/displays/tpo_cmd.h+35−0

This diff is large: its 36 lines aren’t shown here.

drivers/staging/gma500/displays/tpo_vid.h+33−0

This diff is large: its 34 lines aren’t shown here.

drivers/staging/gma500/framebuffer.crenamed from drivers/staging/gma500/psb_fb.c+245−285

This diff is large: its 893 lines aren’t shown here.

drivers/staging/gma500/framebuffer.hrenamed from drivers/staging/gma500/psb_fb.h+5−6

This diff is large: its 37 lines aren’t shown here.

drivers/staging/gma500/gem.crenamed from drivers/staging/gma500/psb_gem.c+70−95

This diff is large: its 267 lines aren’t shown here.

drivers/staging/gma500/gem_glue.c+110−0

This diff is large: its 111 lines aren’t shown here.

drivers/staging/gma500/gem_glue.h+4−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/gma500/gtt.crenamed from drivers/staging/gma500/psb_gtt.c+104−143

This diff is large: its 492 lines aren’t shown here.

drivers/staging/gma500/gtt.hrenamed from drivers/staging/gma500/psb_gtt.h+7−7

This diff is large: its 37 lines aren’t shown here.

drivers/staging/gma500/intel_bios.crenamed from drivers/staging/gma500/psb_intel_bios.c+11−14

This diff is large: its 80 lines aren’t shown here.

drivers/staging/gma500/intel_bios.hrenamed from drivers/staging/gma500/psb_intel_bios.h+0−0

File renamed without changes.

drivers/staging/gma500/intel_i2c.crenamed from drivers/staging/gma500/psb_intel_i2c.c+0−0

File renamed without changes.

drivers/staging/gma500/intel_opregion.crenamed from drivers/staging/gma500/psb_intel_opregion.c+15−13

This diff is large: its 62 lines aren’t shown here.

drivers/staging/gma500/mdfld_device.c+714−0

This diff is large: its 715 lines aren’t shown here.

drivers/staging/gma500/mdfld_dsi_dbi.c+760−0

This diff is large: its 761 lines aren’t shown here.

drivers/staging/gma500/mdfld_dsi_dbi.h+176−0

This diff is large: its 177 lines aren’t shown here.

drivers/staging/gma500/mdfld_dsi_dbi_dpu.c+778−0

This diff is large: its 779 lines aren’t shown here.

drivers/staging/gma500/mdfld_dsi_dbi_dpu.h+154−0

This diff is large: its 155 lines aren’t shown here.

drivers/staging/gma500/mdfld_dsi_dpi.c+800−0

This diff is large: its 801 lines aren’t shown here.

drivers/staging/gma500/mdfld_dsi_dpi.h+78−0

This diff is large: its 79 lines aren’t shown here.

drivers/staging/gma500/mdfld_dsi_output.c+1011−0

This diff is large: its 1012 lines aren’t shown here.

drivers/staging/gma500/mdfld_dsi_output.h+138−0

This diff is large: its 139 lines aren’t shown here.

drivers/staging/gma500/mdfld_dsi_pkg_sender.c+1484−0

This diff is large: its 1485 lines aren’t shown here.

drivers/staging/gma500/mdfld_dsi_pkg_sender.h+184−0

This diff is large: its 185 lines aren’t shown here.

drivers/staging/gma500/mdfld_intel_display.c+1402−0

This diff is large: its 1403 lines aren’t shown here.

drivers/staging/gma500/mdfld_msic.h+31−0

This diff is large: its 32 lines aren’t shown here.

drivers/staging/gma500/mdfld_output.c+170−0

This diff is large: its 171 lines aren’t shown here.

drivers/staging/gma500/mdfld_output.h+41−0

This diff is large: its 42 lines aren’t shown here.

drivers/staging/gma500/mdfld_pyr_cmd.c+558−0

This diff is large: its 559 lines aren’t shown here.

drivers/staging/gma500/mdfld_tmd_vid.c+206−0

This diff is large: its 207 lines aren’t shown here.

drivers/staging/gma500/mdfld_tpo_cmd.c+509−0

This diff is large: its 510 lines aren’t shown here.

drivers/staging/gma500/mdfld_tpo_vid.c+140−0

This diff is large: its 141 lines aren’t shown here.

drivers/staging/gma500/medfield.h+270−0

This diff is large: its 271 lines aren’t shown here.

drivers/staging/gma500/mid_bios.c+269−0

This diff is large: its 270 lines aren’t shown here.

drivers/staging/gma500/mid_bios.h+21−0

This diff is large: its 22 lines aren’t shown here.

drivers/staging/gma500/mmu.crenamed from drivers/staging/gma500/psb_mmu.c+0−0

File renamed without changes.

drivers/staging/gma500/mrst.h+54−19

This diff is large: its 141 lines aren’t shown here.

drivers/staging/gma500/mrst_crtc.c+11−20

This diff is large: its 120 lines aren’t shown here.

drivers/staging/gma500/mrst_device.c+634−0

This diff is large: its 635 lines aren’t shown here.

drivers/staging/gma500/mrst_hdmi.c+852−0

This diff is large: its 853 lines aren’t shown here.

drivers/staging/gma500/mrst_hdmi_i2c.c+327−0

This diff is large: its 328 lines aren’t shown here.

drivers/staging/gma500/mrst_lvds.c+64−28

This diff is large: its 202 lines aren’t shown here.

drivers/staging/gma500/power.crenamed from drivers/staging/gma500/psb_powermgmt.c+32−205

This diff is large: its 396 lines aren’t shown here.

drivers/staging/gma500/power.hrenamed from drivers/staging/gma500/psb_powermgmt.h+3−3

This diff is large: its 18 lines aren’t shown here.

drivers/staging/gma500/psb_bl.c+0−227

This diff is large: its 228 lines aren’t shown here.

drivers/staging/gma500/psb_device.c+353−0

This diff is large: its 354 lines aren’t shown here.

drivers/staging/gma500/psb_drm.h+48−104

This diff is large: its 200 lines aren’t shown here.

drivers/staging/gma500/psb_drv.c+110−346

This diff is large: its 743 lines aren’t shown here.

drivers/staging/gma500/psb_drv.h+299−195

This diff is large: its 854 lines aren’t shown here.

drivers/staging/gma500/psb_intel_display.c+56−115

This diff is large: its 423 lines aren’t shown here.

drivers/staging/gma500/psb_intel_display.h+3−0

This diff is large: its 9 lines aren’t shown here.

drivers/staging/gma500/psb_intel_drv.h+8−16

This diff is large: its 64 lines aren’t shown here.

drivers/staging/gma500/psb_intel_lvds.c+56−92

This diff is large: its 381 lines aren’t shown here.

drivers/staging/gma500/psb_intel_reg.h+621−523

This diff is large: its 1544 lines aren’t shown here.

drivers/staging/gma500/psb_intel_sdvo.c+15−20

This diff is large: its 106 lines aren’t shown here.

drivers/staging/gma500/psb_intel_sdvo_regs.h+7−7

This diff is large: its 58 lines aren’t shown here.

drivers/staging/gma500/psb_irq.c+70−29

This diff is large: its 186 lines aren’t shown here.

drivers/staging/gma500/psb_irq.h+2−6

This diff is large: its 24 lines aren’t shown here.

drivers/staging/gma500/psb_lid.c+3−3

This diff is large: its 22 lines aren’t shown here.

drivers/staging/gma500/psb_reg.h+418−424

This diff is large: its 980 lines aren’t shown here.

drivers/staging/hv/blkvsc_drv.c+23−19

This diff is large: its 76 lines aren’t shown here.

drivers/staging/hv/channel.c+31−82

This diff is large: its 280 lines aren’t shown here.

drivers/staging/hv/channel_mgmt.c+1−7

This diff is large: its 36 lines aren’t shown here.

drivers/staging/hv/connection.c+7−45

This diff is large: its 106 lines aren’t shown here.

drivers/staging/hv/hv.c+2−2

This diff is large: its 14 lines aren’t shown here.

drivers/staging/hv/hv_mouse.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/hv/hv_timesource.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/hv/hyperv.h+45−41

This diff is large: its 107 lines aren’t shown here.

drivers/staging/hv/hyperv_net.h+2−12

This diff is large: its 36 lines aren’t shown here.

drivers/staging/hv/hyperv_vmbus.h+0−2

This diff is large: its 9 lines aren’t shown here.

drivers/staging/hv/netvsc.c+6−167

This diff is large: its 222 lines aren’t shown here.

drivers/staging/hv/netvsc_drv.c+23−37

This diff is large: its 165 lines aren’t shown here.

drivers/staging/hv/ring_buffer.c+4−2

This diff is large: its 27 lines aren’t shown here.

drivers/staging/hv/rndis_filter.c+21−38

This diff is large: its 164 lines aren’t shown here.

drivers/staging/hv/storvsc.c+4−4

This diff is large: its 36 lines aren’t shown here.

drivers/staging/hv/storvsc_drv.c+31−57

This diff is large: its 213 lines aren’t shown here.

drivers/staging/hv/vmbus_drv.c+34−102

This diff is large: its 313 lines aren’t shown here.

drivers/staging/iio/Documentation/sysfs-bus-iio-light+8−0

This diff is large: its 12 lines aren’t shown here.

drivers/staging/iio/accel/adis16201.h+5−7

This diff is large: its 25 lines aren’t shown here.

drivers/staging/iio/accel/adis16201_core.c+55−78

This diff is large: its 286 lines aren’t shown here.

drivers/staging/iio/accel/adis16201_ring.c+4−4

This diff is large: its 36 lines aren’t shown here.

drivers/staging/iio/accel/adis16201_trigger.c+5−6

This diff is large: its 39 lines aren’t shown here.

drivers/staging/iio/accel/adis16203.h+5−7

This diff is large: its 25 lines aren’t shown here.

drivers/staging/iio/accel/adis16203_core.c+31−54

This diff is large: its 158 lines aren’t shown here.

drivers/staging/iio/accel/adis16203_ring.c+4−4

This diff is large: its 36 lines aren’t shown here.

drivers/staging/iio/accel/adis16203_trigger.c+8−9

This diff is large: its 44 lines aren’t shown here.

drivers/staging/iio/accel/adis16204.h+5−7

This diff is large: its 25 lines aren’t shown here.

drivers/staging/iio/accel/adis16204_core.c+30−54

This diff is large: its 158 lines aren’t shown here.

drivers/staging/iio/accel/adis16204_ring.c+4−4

This diff is large: its 36 lines aren’t shown here.

drivers/staging/iio/accel/adis16204_trigger.c+5−6

This diff is large: its 39 lines aren’t shown here.

drivers/staging/iio/accel/adis16209.h+5−7

This diff is large: its 25 lines aren’t shown here.

drivers/staging/iio/accel/adis16209_core.c+29−53

This diff is large: its 159 lines aren’t shown here.

drivers/staging/iio/accel/adis16209_ring.c+4−4

This diff is large: its 36 lines aren’t shown here.

drivers/staging/iio/accel/adis16209_trigger.c+8−9

This diff is large: its 44 lines aren’t shown here.

drivers/staging/iio/accel/adis16220.h+4−10

This diff is large: its 26 lines aren’t shown here.

drivers/staging/iio/accel/adis16220_core.c+39−66

This diff is large: its 231 lines aren’t shown here.

drivers/staging/iio/accel/adis16240.h+6−8

This diff is large: its 38 lines aren’t shown here.

drivers/staging/iio/accel/adis16240_core.c+30−52

This diff is large: its 160 lines aren’t shown here.

drivers/staging/iio/accel/adis16240_ring.c+4−4

This diff is large: its 36 lines aren’t shown here.

drivers/staging/iio/accel/adis16240_trigger.c+8−9

This diff is large: its 44 lines aren’t shown here.

drivers/staging/iio/accel/kxsd9.c+26−76

This diff is large: its 194 lines aren’t shown here.

drivers/staging/iio/accel/lis3l02dq_core.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/iio/accel/sca3000.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/iio/accel/sca3000_core.c+46−54

This diff is large: its 312 lines aren’t shown here.

drivers/staging/iio/accel/sca3000_ring.c+7−7

This diff is large: its 63 lines aren’t shown here.

drivers/staging/iio/adc/Kconfig+14−0

This diff is large: its 21 lines aren’t shown here.

drivers/staging/iio/adc/Makefile+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/iio/adc/ad7150.c+41−50

This diff is large: its 316 lines aren’t shown here.

drivers/staging/iio/adc/ad7152.c+32−41

This diff is large: its 237 lines aren’t shown here.

drivers/staging/iio/adc/ad7291.c+38−48

This diff is large: its 251 lines aren’t shown here.

drivers/staging/iio/adc/ad7314.c+19−29

This diff is large: its 106 lines aren’t shown here.

drivers/staging/iio/adc/ad7476.h+2−3

This diff is large: its 22 lines aren’t shown here.

drivers/staging/iio/adc/ad7476_core.c+41−43

This diff is large: its 155 lines aren’t shown here.

drivers/staging/iio/adc/ad7476_ring.c+5−5

This diff is large: its 39 lines aren’t shown here.

drivers/staging/iio/adc/ad7745.c+35−44

This diff is large: its 260 lines aren’t shown here.

drivers/staging/iio/adc/ad7793.c+987−0

This diff is large: its 988 lines aren’t shown here.

drivers/staging/iio/adc/ad7793.h+107−0

This diff is large: its 108 lines aren’t shown here.

drivers/staging/iio/adc/ad7816.c+33−41

This diff is large: its 195 lines aren’t shown here.

drivers/staging/iio/adc/ad7887_core.c+1−2

This diff is large: its 17 lines aren’t shown here.

drivers/staging/iio/adc/ad7887_ring.c+3−3

This diff is large: its 27 lines aren’t shown here.

drivers/staging/iio/adc/ad799x_core.c+6−7

This diff is large: its 62 lines aren’t shown here.

drivers/staging/iio/adc/ad799x_ring.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/iio/adc/adt7310.c+42−52

This diff is large: its 261 lines aren’t shown here.

drivers/staging/iio/adc/adt7410.c+38−48

This diff is large: its 247 lines aren’t shown here.

drivers/staging/iio/adc/adt75.c+56−67

This diff is large: its 377 lines aren’t shown here.

drivers/staging/iio/adc/max1363_core.c+11−9

This diff is large: its 44 lines aren’t shown here.

drivers/staging/iio/addac/adt7316.c+107−117

This diff is large: its 836 lines aren’t shown here.

drivers/staging/iio/dac/Kconfig+11−0

This diff is large: its 18 lines aren’t shown here.

drivers/staging/iio/dac/Makefile+1−0

This diff is large: its 6 lines aren’t shown here.

drivers/staging/iio/dac/ad5446.c+38−44

This diff is large: its 174 lines aren’t shown here.

drivers/staging/iio/dac/ad5446.h+0−2

This diff is large: its 16 lines aren’t shown here.

drivers/staging/iio/dac/ad5504.c+41−48

This diff is large: its 193 lines aren’t shown here.

drivers/staging/iio/dac/ad5504.h+0−2

This diff is large: its 16 lines aren’t shown here.

drivers/staging/iio/dac/ad5624r.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/iio/dac/ad5624r_spi.c+39−45

This diff is large: its 164 lines aren’t shown here.

drivers/staging/iio/dac/ad5686.c+497−0

This diff is large: its 498 lines aren’t shown here.

drivers/staging/iio/dac/ad5791.c+55−57

This diff is large: its 231 lines aren’t shown here.

drivers/staging/iio/dac/ad5791.h+0−2

This diff is large: its 16 lines aren’t shown here.

drivers/staging/iio/dac/max517.c+14−26

This diff is large: its 94 lines aren’t shown here.

drivers/staging/iio/dds/ad5930.c+12−25

This diff is large: its 91 lines aren’t shown here.

drivers/staging/iio/dds/ad9832.c+32−37

This diff is large: its 120 lines aren’t shown here.

drivers/staging/iio/dds/ad9832.h+0−2

This diff is large: its 16 lines aren’t shown here.

drivers/staging/iio/dds/ad9834.c+37−44

This diff is large: its 158 lines aren’t shown here.

drivers/staging/iio/dds/ad9834.h+0−2

This diff is large: its 16 lines aren’t shown here.

drivers/staging/iio/dds/ad9850.c+12−25

This diff is large: its 87 lines aren’t shown here.

drivers/staging/iio/dds/ad9852.c+14−24

This diff is large: its 84 lines aren’t shown here.

drivers/staging/iio/dds/ad9910.c+12−24

This diff is large: its 79 lines aren’t shown here.

drivers/staging/iio/dds/ad9951.c+13−23

This diff is large: its 80 lines aren’t shown here.

drivers/staging/iio/gyro/adis16060_core.c+25−34

This diff is large: its 130 lines aren’t shown here.

drivers/staging/iio/gyro/adis16080_core.c+19−29

This diff is large: its 105 lines aren’t shown here.

drivers/staging/iio/gyro/adis16130_core.c+20−30

This diff is large: its 111 lines aren’t shown here.

drivers/staging/iio/gyro/adis16260.h+8−10

This diff is large: its 30 lines aren’t shown here.

drivers/staging/iio/gyro/adis16260_core.c+38−62

This diff is large: its 224 lines aren’t shown here.

drivers/staging/iio/gyro/adis16260_ring.c+4−5

This diff is large: its 44 lines aren’t shown here.

drivers/staging/iio/gyro/adis16260_trigger.c+7−8

This diff is large: its 42 lines aren’t shown here.

drivers/staging/iio/gyro/adxrs450.h+6−7

This diff is large: its 24 lines aren’t shown here.

drivers/staging/iio/gyro/adxrs450_core.c+24−47

This diff is large: its 136 lines aren’t shown here.

drivers/staging/iio/iio.h+16−0

This diff is large: its 57 lines aren’t shown here.

drivers/staging/iio/imu/adis16400.h+3−0

This diff is large: its 10 lines aren’t shown here.

drivers/staging/iio/imu/adis16400_core.c+27−23

This diff is large: its 129 lines aren’t shown here.

drivers/staging/iio/industrialio-core.c+35−12

This diff is large: its 109 lines aren’t shown here.

drivers/staging/iio/industrialio-trigger.c+19−1

This diff is large: its 34 lines aren’t shown here.

drivers/staging/iio/kfifo_buf.c+0−2

This diff is large: its 10 lines aren’t shown here.

drivers/staging/iio/light/Kconfig+1−1

This diff is large: its 6 lines aren’t shown here.

drivers/staging/iio/light/isl29018.c+105−92

This diff is large: its 354 lines aren’t shown here.

drivers/staging/iio/light/tsl2563.c+56−69

This diff is large: its 267 lines aren’t shown here.

drivers/staging/iio/magnetometer/ak8975.c+40−51

This diff is large: its 174 lines aren’t shown here.

drivers/staging/iio/magnetometer/hmc5843.c+21−29

This diff is large: its 147 lines aren’t shown here.

drivers/staging/iio/meter/ade7753.c+30−53

This diff is large: its 182 lines aren’t shown here.

drivers/staging/iio/meter/ade7753.h+4−6

This diff is large: its 22 lines aren’t shown here.

drivers/staging/iio/meter/ade7754.c+29−51

This diff is large: its 174 lines aren’t shown here.

drivers/staging/iio/meter/ade7754.h+5−7

This diff is large: its 23 lines aren’t shown here.

drivers/staging/iio/meter/ade7759.c+27−53

This diff is large: its 169 lines aren’t shown here.

drivers/staging/iio/meter/ade7759.h+5−7

This diff is large: its 23 lines aren’t shown here.

drivers/staging/iio/meter/ade7854-i2c.c+19−20

This diff is large: its 109 lines aren’t shown here.

drivers/staging/iio/meter/ade7854-spi.c+20−20

This diff is large: its 110 lines aren’t shown here.

drivers/staging/iio/meter/ade7854.c+24−52

This diff is large: its 184 lines aren’t shown here.

drivers/staging/iio/meter/ade7854.h+18−18

This diff is large: its 48 lines aren’t shown here.

drivers/staging/iio/resolver/Kconfig+0−27

This diff is large: its 31 lines aren’t shown here.

drivers/staging/iio/resolver/ad2s120x.c+31−165

This diff is large: its 273 lines aren’t shown here.

drivers/staging/iio/resolver/ad2s1210.c+399−457

This diff is large: its 1199 lines aren’t shown here.

drivers/staging/iio/resolver/ad2s1210.h+17−0

This diff is large: its 18 lines aren’t shown here.

drivers/staging/iio/resolver/ad2s90.c+12−36

This diff is large: its 104 lines aren’t shown here.

drivers/staging/iio/trigger.h+28−24

This diff is large: its 80 lines aren’t shown here.

drivers/staging/iio/trigger/iio-trig-gpio.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/intel_sst/intel_sst.c+4−1

This diff is large: its 12 lines aren’t shown here.

drivers/staging/intel_sst/intel_sst_app_interface.c+3−1

This diff is large: its 12 lines aren’t shown here.

drivers/staging/intel_sst/intel_sst_common.h+2−0

This diff is large: its 9 lines aren’t shown here.

drivers/staging/intel_sst/intel_sst_drv_interface.c+10−0

This diff is large: its 24 lines aren’t shown here.

drivers/staging/intel_sst/intelmid_v2_control.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/keucr/Kconfig+3−3

This diff is large: its 13 lines aren’t shown here.

drivers/staging/keucr/Makefile+0−2

This diff is large: its 9 lines aren’t shown here.

drivers/staging/keucr/init.c+1−70

This diff is large: its 92 lines aren’t shown here.

drivers/staging/keucr/init.h+0−773

This diff is large: its 780 lines aren’t shown here.

drivers/staging/keucr/ms.c+0−1034

This diff is large: its 1035 lines aren’t shown here.

drivers/staging/keucr/ms.h+0−401

This diff is large: its 402 lines aren’t shown here.

drivers/staging/keucr/msscsi.c+0−344

This diff is large: its 345 lines aren’t shown here.

drivers/staging/keucr/transport.c+1−3

This diff is large: its 18 lines aren’t shown here.

drivers/staging/keucr/transport.h+0−46

This diff is large: its 60 lines aren’t shown here.

drivers/staging/keucr/usb.c+1−4

This diff is large: its 26 lines aren’t shown here.

drivers/staging/keucr/usb.h+1−2

This diff is large: its 17 lines aren’t shown here.

drivers/staging/lirc/lirc_bt829.c+2−2

This diff is large: its 13 lines aren’t shown here.

drivers/staging/lirc/lirc_parallel.c+3−3

This diff is large: its 20 lines aren’t shown here.

drivers/staging/lirc/lirc_ttusbir.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/lirc/lirc_zilog.c+0−2

This diff is large: its 9 lines aren’t shown here.

drivers/staging/mei/init.c+72−77

This diff is large: its 358 lines aren’t shown here.

drivers/staging/mei/interface.c+4−5

This diff is large: its 37 lines aren’t shown here.

drivers/staging/mei/interrupt.c+23−24

This diff is large: its 197 lines aren’t shown here.

drivers/staging/mei/iorw.c+16−16

This diff is large: its 121 lines aren’t shown here.

drivers/staging/mei/main.c+16−23

This diff is large: its 157 lines aren’t shown here.

drivers/staging/mei/mei_dev.h+63−60

This diff is large: its 234 lines aren’t shown here.

drivers/staging/mei/wd.c+9−9

This diff is large: its 64 lines aren’t shown here.

drivers/staging/msm/Kconfig+0−124

This diff is large: its 125 lines aren’t shown here.

drivers/staging/msm/Makefile+0−88

This diff is large: its 89 lines aren’t shown here.

drivers/staging/msm/TODO+0−3

This diff is large: its 4 lines aren’t shown here.

drivers/staging/msm/ebi2_l2f.c+0−569

This diff is large: its 570 lines aren’t shown here.

drivers/staging/msm/ebi2_lcd.c+0−250

This diff is large: its 251 lines aren’t shown here.

drivers/staging/msm/ebi2_tmd20.c+0−1122

This diff is large: its 1123 lines aren’t shown here.

drivers/staging/msm/hdmi_sii9022.c+0−248

This diff is large: its 249 lines aren’t shown here.

drivers/staging/msm/lcdc.c+0−239

This diff is large: its 240 lines aren’t shown here.

drivers/staging/msm/lcdc_external.c+0−54

This diff is large: its 55 lines aren’t shown here.

drivers/staging/msm/lcdc_gordon.c+0−446

This diff is large: its 447 lines aren’t shown here.

drivers/staging/msm/lcdc_panel.c+0−88

This diff is large: its 89 lines aren’t shown here.

drivers/staging/msm/lcdc_prism.c+0−64

This diff is large: its 65 lines aren’t shown here.

drivers/staging/msm/lcdc_sharp_wvga_pt.c+0−290

This diff is large: its 291 lines aren’t shown here.

drivers/staging/msm/lcdc_st15.c+0−237

This diff is large: its 238 lines aren’t shown here.

drivers/staging/msm/lcdc_toshiba_wvga_pt.c+0−374

This diff is large: its 375 lines aren’t shown here.

drivers/staging/msm/logo.c+0−98

This diff is large: its 99 lines aren’t shown here.

drivers/staging/msm/mddi.c+0−375

This diff is large: its 376 lines aren’t shown here.

drivers/staging/msm/mddi_ext.c+0−320

This diff is large: its 321 lines aren’t shown here.

drivers/staging/msm/mddi_ext_lcd.c+0−91

This diff is large: its 92 lines aren’t shown here.

drivers/staging/msm/mddi_prism.c+0−114

This diff is large: its 115 lines aren’t shown here.

drivers/staging/msm/mddi_sharp.c+0−892

This diff is large: its 893 lines aren’t shown here.

drivers/staging/msm/mddi_toshiba.c+0−1741

This diff is large: its 1742 lines aren’t shown here.

drivers/staging/msm/mddi_toshiba.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/msm/mddi_toshiba_vga.c+0−136

This diff is large: its 137 lines aren’t shown here.

drivers/staging/msm/mddi_toshiba_wvga_pt.c+0−64

This diff is large: its 65 lines aren’t shown here.

drivers/staging/msm/mddihost.c+0−377

This diff is large: its 378 lines aren’t shown here.

drivers/staging/msm/mddihost.h+0−207

This diff is large: its 208 lines aren’t shown here.

drivers/staging/msm/mddihost_e.c+0−63

This diff is large: its 64 lines aren’t shown here.

drivers/staging/msm/mddihosti.c+0−2239

This diff is large: its 2240 lines aren’t shown here.

drivers/staging/msm/mddihosti.h+0−531

This diff is large: its 532 lines aren’t shown here.

drivers/staging/msm/mdp.c+0−1113

This diff is large: its 1114 lines aren’t shown here.

drivers/staging/msm/mdp.h+0−679

This diff is large: its 680 lines aren’t shown here.

drivers/staging/msm/mdp4.h+0−336

This diff is large: its 337 lines aren’t shown here.

drivers/staging/msm/mdp4_debugfs.c+0−175

This diff is large: its 176 lines aren’t shown here.

drivers/staging/msm/mdp4_overlay.c+0−1259

This diff is large: its 1260 lines aren’t shown here.

drivers/staging/msm/mdp4_overlay_lcdc.c+0−313

This diff is large: its 314 lines aren’t shown here.

drivers/staging/msm/mdp4_overlay_mddi.c+0−254

This diff is large: its 255 lines aren’t shown here.

drivers/staging/msm/mdp4_util.c+0−1686

This diff is large: its 1687 lines aren’t shown here.

drivers/staging/msm/mdp_cursor.c+0−104

This diff is large: its 105 lines aren’t shown here.

drivers/staging/msm/mdp_dma.c+0−561

This diff is large: its 562 lines aren’t shown here.

drivers/staging/msm/mdp_dma_lcdc.c+0−379

This diff is large: its 380 lines aren’t shown here.

drivers/staging/msm/mdp_dma_s.c+0−139

This diff is large: its 140 lines aren’t shown here.

drivers/staging/msm/mdp_dma_tv.c+0−142

This diff is large: its 143 lines aren’t shown here.

drivers/staging/msm/mdp_hw_init.c+0−720

This diff is large: its 721 lines aren’t shown here.

drivers/staging/msm/mdp_ppp.c+0−1502

This diff is large: its 1503 lines aren’t shown here.

drivers/staging/msm/mdp_ppp_dq.c+0−347

This diff is large: its 348 lines aren’t shown here.

drivers/staging/msm/mdp_ppp_dq.h+0−69

This diff is large: its 70 lines aren’t shown here.

drivers/staging/msm/mdp_ppp_v20.c+0−2486

This diff is large: its 2487 lines aren’t shown here.

drivers/staging/msm/mdp_ppp_v31.c+0−828

This diff is large: its 829 lines aren’t shown here.

drivers/staging/msm/mdp_vsync.c+0−389

This diff is large: its 390 lines aren’t shown here.

drivers/staging/msm/memory.c+0−214

This diff is large: its 215 lines aren’t shown here.

drivers/staging/msm/memory_ll.h+0−61

This diff is large: its 62 lines aren’t shown here.

drivers/staging/msm/msm_fb.c+0−2354

This diff is large: its 2355 lines aren’t shown here.

drivers/staging/msm/msm_fb.h+0−158

This diff is large: its 159 lines aren’t shown here.

drivers/staging/msm/msm_fb_bl.c+0−79

This diff is large: its 80 lines aren’t shown here.

drivers/staging/msm/msm_fb_def.h+0−181

This diff is large: its 182 lines aren’t shown here.

drivers/staging/msm/msm_fb_panel.c+0−136

This diff is large: its 137 lines aren’t shown here.

drivers/staging/msm/msm_fb_panel.h+0−129

This diff is large: its 130 lines aren’t shown here.

drivers/staging/msm/msm_mdp.h+0−245

This diff is large: its 246 lines aren’t shown here.

drivers/staging/msm/staging-devices.c+0−312

This diff is large: its 313 lines aren’t shown here.

drivers/staging/msm/tv_ntsc.c+0−163

This diff is large: its 164 lines aren’t shown here.

drivers/staging/msm/tv_pal.c+0−213

This diff is large: its 214 lines aren’t shown here.

drivers/staging/msm/tvenc.c+0−296

This diff is large: its 297 lines aren’t shown here.

drivers/staging/msm/tvenc.h+0−101

This diff is large: its 102 lines aren’t shown here.

drivers/staging/octeon/ethernet-mdio.c+14−13

This diff is large: its 44 lines aren’t shown here.

drivers/staging/octeon/ethernet-rgmii.c+17−16

This diff is large: its 58 lines aren’t shown here.

drivers/staging/octeon/ethernet-rx.c+13−11

This diff is large: its 78 lines aren’t shown here.

drivers/staging/octeon/ethernet-sgmii.c+8−6

This diff is large: its 36 lines aren’t shown here.

drivers/staging/octeon/ethernet-tx.c+6−5

This diff is large: its 39 lines aren’t shown here.

drivers/staging/octeon/ethernet-util.h+0−4

This diff is large: its 11 lines aren’t shown here.

drivers/staging/octeon/ethernet-xaui.c+12−10

This diff is large: its 40 lines aren’t shown here.

drivers/staging/panel/panel.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8187se/ieee80211/ieee80211.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8187se/ieee80211/ieee80211_module.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c+2−6

This diff is large: its 30 lines aren’t shown here.

drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8192e/dot11d.h+12−11

This diff is large: its 69 lines aren’t shown here.

drivers/staging/rtl8192e/ieee80211/ieee80211.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192e/ieee80211/ieee80211_crypt.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_ccmp.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_tkip.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_wep.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192e/ieee80211/ieee80211_module.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c+1−2

This diff is large: its 17 lines aren’t shown here.

drivers/staging/rtl8192e/ieee80211/ieee80211_tx.c+1−2

This diff is large: its 17 lines aren’t shown here.

drivers/staging/rtl8192e/r8192E.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192e/r8192E_core.c+6−0

This diff is large: its 20 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_module.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c+1−6

This diff is large: its 29 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8192u/r8192U.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192u/r8192U_core.c+0−4

This diff is large: its 12 lines aren’t shown here.

drivers/staging/rtl8712/ieee80211.h+16−15

This diff is large: its 135 lines aren’t shown here.

drivers/staging/rtl8712/osdep_service.h+1−5

This diff is large: its 27 lines aren’t shown here.

drivers/staging/rtl8712/rtl8712_hal.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8712/wifi.h+4−3

This diff is large: its 35 lines aren’t shown here.

drivers/staging/rts_pstor/ms.c+1−2

This diff is large: its 13 lines aren’t shown here.

drivers/staging/rts_pstor/rtsx.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rts_pstor/rtsx_chip.c+2−4

This diff is large: its 21 lines aren’t shown here.

drivers/staging/rts_pstor/sd.c+42−22

This diff is large: its 168 lines aren’t shown here.

drivers/staging/rts_pstor/sd.h+5−0

This diff is large: its 12 lines aren’t shown here.

drivers/staging/sep/sep_driver.c+3−3

This diff is large: its 21 lines aren’t shown here.

drivers/staging/sep/sep_driver_config.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/main.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/speakup/speakup.h+0−1

This diff is large: its 7 lines aren’t shown here.

drivers/staging/speakup/speakup_soft.c+1−8

This diff is large: its 17 lines aren’t shown here.

drivers/staging/spectra/lld_nand.c+10−8

This diff is large: its 55 lines aren’t shown here.

drivers/staging/ste_rmi4/Makefile+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/ste_rmi4/board-mop500-u8500uib-rmi4.c+32−0

This diff is large: its 33 lines aren’t shown here.

drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c+20−23

This diff is large: its 79 lines aren’t shown here.

drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h+0−2

This diff is large: its 16 lines aren’t shown here.

drivers/staging/tidspbridge/include/dspbridge/host_os.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/tm6000/tm6000-alsa.c+4−4

This diff is large: its 36 lines aren’t shown here.

drivers/staging/tm6000/tm6000-cards.c+1−6

This diff is large: its 21 lines aren’t shown here.

drivers/staging/tm6000/tm6000-dvb.c+5−5

This diff is large: its 45 lines aren’t shown here.

drivers/staging/tm6000/tm6000-i2c.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/tm6000/tm6000-input.c+1−2

This diff is large: its 11 lines aren’t shown here.

drivers/staging/tm6000/tm6000-video.c+20−23

This diff is large: its 145 lines aren’t shown here.

drivers/staging/tm6000/tm6000.h+1−2

This diff is large: its 10 lines aren’t shown here.

drivers/staging/tty/Kconfig+0−87

This diff is large: its 88 lines aren’t shown here.

drivers/staging/tty/Makefile+0−7

This diff is large: its 8 lines aren’t shown here.

drivers/staging/tty/TODO+0−6

This diff is large: its 7 lines aren’t shown here.

drivers/staging/tty/cd1865.h+0−263

This diff is large: its 264 lines aren’t shown here.

drivers/staging/tty/digi1.h+0−100

This diff is large: its 101 lines aren’t shown here.

drivers/staging/tty/digiFep1.h+0−136

This diff is large: its 137 lines aren’t shown here.

drivers/staging/tty/digiPCI.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/tty/epca.c+0−2784

This diff is large: its 2785 lines aren’t shown here.

drivers/staging/tty/epca.h+0−158

This diff is large: its 159 lines aren’t shown here.

drivers/staging/tty/epcaconfig.h+0−7

This diff is large: its 8 lines aren’t shown here.

drivers/staging/tty/ip2/Makefile+0−8

This diff is large: its 9 lines aren’t shown here.

drivers/staging/tty/ip2/i2cmd.c+0−210

This diff is large: its 211 lines aren’t shown here.

drivers/staging/tty/ip2/i2cmd.h+0−630

This diff is large: its 631 lines aren’t shown here.

drivers/staging/tty/ip2/i2ellis.c+0−1403

This diff is large: its 1404 lines aren’t shown here.

drivers/staging/tty/ip2/i2ellis.h+0−566

This diff is large: its 567 lines aren’t shown here.

drivers/staging/tty/ip2/i2hw.h+0−652

This diff is large: its 653 lines aren’t shown here.

drivers/staging/tty/ip2/i2lib.c+0−2214

This diff is large: its 2215 lines aren’t shown here.

drivers/staging/tty/ip2/i2lib.h+0−351

This diff is large: its 352 lines aren’t shown here.

drivers/staging/tty/ip2/i2pack.h+0−364

This diff is large: its 365 lines aren’t shown here.

drivers/staging/tty/ip2/ip2.h+0−107

This diff is large: its 108 lines aren’t shown here.

drivers/staging/tty/ip2/ip2ioctl.h+0−35

This diff is large: its 36 lines aren’t shown here.

drivers/staging/tty/ip2/ip2main.c+0−3234

This diff is large: its 3235 lines aren’t shown here.

drivers/staging/tty/ip2/ip2trace.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/tty/ip2/ip2types.h+0−57

This diff is large: its 58 lines aren’t shown here.

drivers/staging/tty/istallion.c+0−4507

This diff is large: its 4508 lines aren’t shown here.

drivers/staging/tty/riscom8.c+0−1560

This diff is large: its 1561 lines aren’t shown here.

drivers/staging/tty/riscom8.h+0−91

This diff is large: its 92 lines aren’t shown here.

drivers/staging/tty/riscom8_reg.h+0−254

This diff is large: its 255 lines aren’t shown here.

drivers/staging/tty/serial167.c+0−2489

This diff is large: its 2490 lines aren’t shown here.

drivers/staging/tty/specialix.c+0−2368

This diff is large: its 2369 lines aren’t shown here.

drivers/staging/tty/specialix_io8.h+0−140

This diff is large: its 141 lines aren’t shown here.

drivers/staging/tty/stallion.c+0−4651

This diff is large: its 4652 lines aren’t shown here.

drivers/staging/usbip/README+1−0

This diff is large: its 7 lines aren’t shown here.

drivers/staging/usbip/stub.h+3−1

This diff is large: its 11 lines aren’t shown here.

drivers/staging/usbip/stub_dev.c+21−34

This diff is large: its 144 lines aren’t shown here.

drivers/staging/usbip/stub_main.c+87−106

This diff is large: its 343 lines aren’t shown here.

drivers/staging/usbip/stub_rx.c+3−3

This diff is large: its 22 lines aren’t shown here.

drivers/staging/usbip/stub_tx.c+7−8

This diff is large: its 40 lines aren’t shown here.

drivers/staging/usbip/usbip_common.c+17−18

This diff is large: its 105 lines aren’t shown here.

drivers/staging/usbip/usbip_common.h+122−116

This diff is large: its 334 lines aren’t shown here.

drivers/staging/usbip/userspace/AUTHORS+1−0

This diff is large: its 4 lines aren’t shown here.

drivers/staging/usbip/userspace/Makefile.am+2−7

This diff is large: its 14 lines aren’t shown here.

drivers/staging/usbip/userspace/README+142−156

This diff is large: its 358 lines aren’t shown here.

drivers/staging/usbip/userspace/cleanup.sh+6−4

This diff is large: its 17 lines aren’t shown here.

drivers/staging/usbip/userspace/configure.ac+6−20

This diff is large: its 58 lines aren’t shown here.

drivers/staging/usbip/userspace/libsrc/Makefile.am+4−4

This diff is large: its 12 lines aren’t shown here.

drivers/staging/usbip/userspace/libsrc/stub_driver.c+0−391

This diff is large: its 392 lines aren’t shown here.

drivers/staging/usbip/userspace/libsrc/stub_driver.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/usbip/userspace/libsrc/usbip.h+0−19

This diff is large: its 20 lines aren’t shown here.

drivers/staging/usbip/userspace/libsrc/usbip_common.c+16−12

This diff is large: its 106 lines aren’t shown here.

drivers/staging/usbip/userspace/libsrc/usbip_common.h+68−70

This diff is large: its 182 lines aren’t shown here.

drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c+401−0

This diff is large: its 402 lines aren’t shown here.

drivers/staging/usbip/userspace/libsrc/usbip_host_driver.h+48−0

This diff is large: its 49 lines aren’t shown here.

drivers/staging/usbip/userspace/libsrc/vhci_driver.c+90−77

This diff is large: its 380 lines aren’t shown here.

drivers/staging/usbip/userspace/libsrc/vhci_driver.h+19−13

This diff is large: its 60 lines aren’t shown here.

drivers/staging/usbip/userspace/src/Makefile.am+9−8

This diff is large: its 20 lines aren’t shown here.

drivers/staging/usbip/userspace/src/bind-driver.c+0−643

This diff is large: its 644 lines aren’t shown here.

drivers/staging/usbip/userspace/src/usbip.c+142−675

This diff is large: its 866 lines aren’t shown here.

drivers/staging/usbip/userspace/src/usbip.h+39−0

This diff is large: its 40 lines aren’t shown here.

drivers/staging/usbip/userspace/src/usbip_attach.c+228−0

This diff is large: its 229 lines aren’t shown here.

drivers/staging/usbip/userspace/src/usbip_bind.c+277−0

This diff is large: its 278 lines aren’t shown here.

drivers/staging/usbip/userspace/src/usbip_detach.c+103−0

This diff is large: its 104 lines aren’t shown here.

drivers/staging/usbip/userspace/src/usbip_list.c+303−0

This diff is large: its 304 lines aren’t shown here.

drivers/staging/usbip/userspace/src/usbip_network.c+102−96

This diff is large: its 342 lines aren’t shown here.

drivers/staging/usbip/userspace/src/usbip_network.h+40−54

This diff is large: its 183 lines aren’t shown here.

drivers/staging/usbip/userspace/src/usbip_unbind.c+186−0

This diff is large: its 187 lines aren’t shown here.

drivers/staging/usbip/userspace/src/usbipd.c+351−354

This diff is large: its 914 lines aren’t shown here.

drivers/staging/usbip/userspace/src/utils.c+52−231

This diff is large: its 308 lines aren’t shown here.

drivers/staging/usbip/userspace/src/utils.h+21−34

This diff is large: its 59 lines aren’t shown here.

drivers/staging/usbip/userspace/usb.ids+0−13209

This diff is large: its 13210 lines aren’t shown here.

drivers/staging/usbip/vhci.h+1−10

This diff is large: its 25 lines aren’t shown here.

drivers/staging/usbip/vhci_hcd.c+36−23

This diff is large: its 133 lines aren’t shown here.

drivers/staging/usbip/vhci_rx.c+0−2

This diff is large: its 9 lines aren’t shown here.

drivers/staging/usbip/vhci_sysfs.c+3−3

This diff is large: its 26 lines aren’t shown here.

drivers/staging/vme/boards/vme_vmivme7805.c+2−2

This diff is large: its 12 lines aren’t shown here.

drivers/staging/vme/bridges/vme_ca91cx42.c+16−3

This diff is large: its 47 lines aren’t shown here.

drivers/staging/vme/bridges/vme_tsi148.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/vme/devices/vme_user.c+39−14

This diff is large: its 145 lines aren’t shown here.

drivers/staging/vme/devices/vme_user.h+6−0

This diff is large: its 17 lines aren’t shown here.

drivers/staging/vme/vme.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/westbridge/Kconfig+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/westbridge/TODO+0−7

This diff is large: its 8 lines aren’t shown here.

drivers/staging/westbridge/astoria/Kconfig+0−9

This diff is large: its 10 lines aren’t shown here.

drivers/staging/westbridge/astoria/Makefile+0−11

This diff is large: its 12 lines aren’t shown here.

drivers/staging/westbridge/astoria/api/Makefile+0−14

This diff is large: its 15 lines aren’t shown here.

drivers/staging/westbridge/astoria/api/src/cyasdma.c+0−1107

This diff is large: its 1108 lines aren’t shown here.

drivers/staging/westbridge/astoria/api/src/cyasintr.c+0−143

This diff is large: its 144 lines aren’t shown here.

drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c+0−358

This diff is large: its 359 lines aren’t shown here.

drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c+0−1264

This diff is large: its 1265 lines aren’t shown here.

drivers/staging/westbridge/astoria/api/src/cyasmisc.c+0−3488

This diff is large: its 3489 lines aren’t shown here.

drivers/staging/westbridge/astoria/api/src/cyasmtp.c+0−1136

This diff is large: its 1137 lines aren’t shown here.

drivers/staging/westbridge/astoria/api/src/cyasstorage.c+0−4125

This diff is large: its 4126 lines aren’t shown here.

drivers/staging/westbridge/astoria/api/src/cyasusb.c+0−3740

This diff is large: its 3741 lines aren’t shown here.

drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c+0−2441

This diff is large: its 2442 lines aren’t shown here.

drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/cyashaldef.h+0−55

This diff is large: its 56 lines aren’t shown here.

drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h+0−319

This diff is large: its 320 lines aren’t shown here.

drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasmemmap.h+0−558

This diff is large: its 559 lines aren’t shown here.

drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasomapdev_kernel.h+0−72

This diff is large: its 73 lines aren’t shown here.

drivers/staging/westbridge/astoria/block/Kconfig+0−9

This diff is large: its 10 lines aren’t shown here.

drivers/staging/westbridge/astoria/block/Makefile+0−11

This diff is large: its 12 lines aren’t shown here.

drivers/staging/westbridge/astoria/block/cyasblkdev_block.c+0−1631

This diff is large: its 1632 lines aren’t shown here.

drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c+0−417

This diff is large: its 418 lines aren’t shown here.

drivers/staging/westbridge/astoria/block/cyasblkdev_queue.h+0−64

This diff is large: its 65 lines aren’t shown here.

drivers/staging/westbridge/astoria/device/Kconfig+0−9

This diff is large: its 10 lines aren’t shown here.

drivers/staging/westbridge/astoria/device/Makefile+0−23

This diff is large: its 24 lines aren’t shown here.

drivers/staging/westbridge/astoria/device/cyasdevice.c+0−409

This diff is large: its 410 lines aren’t shown here.

drivers/staging/westbridge/astoria/gadget/Kconfig+0−9

This diff is large: its 10 lines aren’t shown here.

drivers/staging/westbridge/astoria/gadget/Makefile+0−11

This diff is large: its 12 lines aren’t shown here.

drivers/staging/westbridge/astoria/gadget/cyasgadget.c+0−2177

This diff is large: its 2178 lines aren’t shown here.

drivers/staging/westbridge/astoria/gadget/cyasgadget.h+0−193

This diff is large: its 194 lines aren’t shown here.

drivers/staging/westbridge/astoria/gadget/cyasgadget_ioctl.h+0−99

This diff is large: its 100 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyanerr.h+0−418

This diff is large: its 419 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmedia.h+0−59

This diff is large: its 60 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h+0−614

This diff is large: its 615 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyanregs.h+0−180

This diff is large: its 181 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyansdkversion.h+0−30

This diff is large: its 31 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h+0−419

This diff is large: its 420 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyantioch.h+0−35

This diff is large: its 36 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h+0−31

This diff is large: its 32 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h+0−619

This diff is large: its 620 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_end.h+0−11

This diff is large: its 12 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_start.h+0−11

This diff is large: its 12 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyascast.h+0−35

This diff is large: its 36 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h+0−1057

This diff is large: its 1058 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h+0−375

This diff is large: its 376 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h+0−1094

This diff is large: its 1095 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyashal.h+0−108

This diff is large: its 109 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h+0−44

This diff is large: its 45 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h+0−800

This diff is large: its 801 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h+0−104

This diff is large: its 105 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h+0−366

This diff is large: its 367 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h+0−54

This diff is large: its 55 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h+0−1549

This diff is large: its 1550 lines aren’t shown here.

drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc_dep.h+0−53

This diff is large: its 54 lines aren’t shown here.

This diff is larger than a page shows: the files after these aren’t listed. Clone the repository to see all of it.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t