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
193193
194194 ---------------------------
195195
196−What: CS5535/CS5536 obsolete GPIO driver
197−When: June 2011
198−Files: drivers/staging/cs5535_gpio/*
199−Check: drivers/staging/cs5535_gpio/cs5535_gpio.c
200−Why: 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.
206−Who: Andres Salomon <dilinger@queued.net>
207−
208−--------------------------
209−
210196 What: remove EXPORT_SYMBOL(kernel_thread)
211197 When: August 2006
212198 Files: arch/*/kernel/*_ksyms.c
MAINTAINERS+141−8
@@ -1546,9 +1546,10 @@ F: drivers/net/tg3.* · 1545 unmodified lines
15461546 BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER
15471547 M: Brett Rudley <brudley@broadcom.com>
15481548 M: Henry Ptasinski <henryp@broadcom.com>
1549−M: Dowan Kim <dowan@broadcom.com>
15501549 M: Roland Vossen <rvossen@broadcom.com>
15511550 M: Arend van Spriel <arend@broadcom.com>
1551+M: Franky (Zhenhui) Lin <frankyl@broadcom.com>
1552+M: Kan Yan <kanyan@broadcom.com>
15521553 L: linux-wireless@vger.kernel.org
15531554 S: Supported
15541555 F: drivers/staging/brcm80211/
@@ -6092,6 +6093,145 @@ L: devel@driverdev.osuosl.org · 4537 unmodified lines
60926093 S: Maintained
60936094 F: drivers/staging/
60946095
6096+STAGING - AGERE HERMES II and II.5 WIRELESS DRIVERS
6097+M: Henk de Groot <pe1dnn@amsat.org>
6098+S: Odd Fixes
6099+F: drivers/staging/wlags49_h2/
6100+F: drivers/staging/wlags49_h25/
6101+
6102+STAGING - ASUS OLED
6103+M: Jakub Schmidtke <sjakub@gmail.com>
6104+S: Odd Fixes
6105+F: drivers/staging/asus_oled/
6106+
6107+STAGING - ATHEROS ATH6KL WIRELESS DRIVER
6108+M: Luis R. Rodriguez <mcgrof@gmail.com>
6109+M: Naveen Singh <nsingh@atheros.com>
6110+S: Odd Fixes
6111+F: drivers/staging/ath6kl/
6112+
6113+STAGING - COMEDI
6114+M: Ian Abbott <abbotti@mev.co.uk>
6115+M: Mori Hess <fmhess@users.sourceforge.net>
6116+S: Odd Fixes
6117+F: drivers/staging/comedi/
6118+
6119+STAGING - CRYSTAL HD VIDEO DECODER
6120+M: Naren Sankar <nsankar@broadcom.com>
6121+M: Jarod Wilson <jarod@wilsonet.com>
6122+M: Scott Davilla <davilla@4pi.com>
6123+M: Manu Abraham <abraham.manu@gmail.com>
6124+S: Odd Fixes
6125+F: drivers/staging/crystalhd/
6126+
6127+STAGING - CYPRESS WESTBRIDGE SUPPORT
6128+M: David Cross <david.cross@cypress.com>
6129+S: Odd Fixes
6130+F: drivers/staging/westbridge/
6131+
6132+STAGING - ECHO CANCELLER
6133+M: Steve Underwood <steveu@coppice.org>
6134+M: David Rowe <david@rowetel.com>
6135+S: Odd Fixes
6136+F: drivers/staging/echo/
6137+
6138+STAGING - FLARION FT1000 DRIVERS
6139+M: Marek Belisko <marek.belisko@gmail.com>
6140+S: Odd Fixes
6141+F: drivers/staging/ft1000/
6142+
6143+STAGING - FRONTIER TRANZPORT AND ALPHATRACK
6144+M: David Täht <d@teklibre.com>
6145+S: Odd Fixes
6146+F: drivers/staging/frontier/
6147+
6148+STAGING - HYPER-V (MICROSOFT)
6149+M: Hank Janssen <hjanssen@microsoft.com>
6150+M: Haiyang Zhang <haiyangz@microsoft.com>
6151+S: Odd Fixes
6152+F: drivers/staging/hv/
6153+
6154+STAGING - INDUSTRIAL IO
6155+M: Jonathan Cameron <jic23@cam.ac.uk>
6156+L: linux-iio@vger.kernel.org
6157+S: Odd Fixes
6158+F: drivers/staging/iio/
6159+
6160+STAGING - LIRC (LINUX INFRARED REMOTE CONTROL) DRIVERS
6161+M: Jarod Wilson <jarod@wilsonet.com>
6162+W: http://www.lirc.org/
6163+S: Odd Fixes
6164+F: drivers/staging/lirc/
6165+
6166+STAGING - OLPC SECONDARY DISPLAY CONTROLLER (DCON)
6167+M: Andres Salomon <dilinger@queued.net>
6168+M: Chris Ball <cjb@laptop.org>
6169+M: Jon Nettleton <jon.nettleton@gmail.com>
6170+W: http://wiki.laptop.org/go/DCON
6171+S: Odd Fixes
6172+F: drivers/staging/olpc_dcon/
6173+
6174+STAGING - PARALLEL LCD/KEYPAD PANEL DRIVER
6175+M: Willy Tarreau <willy@meta-x.org>
6176+S: Odd Fixes
6177+F: drivers/staging/panel/
6178+
6179+STAGING - REALTEK RTL8712U DRIVERS
6180+M: Larry Finger <Larry.Finger@lwfinger.net>
6181+M: Florian Schilhabel <florian.c.schilhabel@googlemail.com>.
6182+S: Odd Fixes
6183+F: drivers/staging/rtl8712/
6184+
6185+STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER
6186+M: Teddy Wang <teddy.wang@siliconmotion.com.cn>
6187+S: Odd Fixes
6188+F: drivers/staging/sm7xx/
6189+
6190+STAGING - SOFTLOGIC 6x10 MPEG CODEC
6191+M: Ben Collins <bcollins@bluecherry.net>
6192+S: Odd Fixes
6193+F: drivers/staging/solo6x10/
6194+
6195+STAGING - SPEAKUP CONSOLE SPEECH DRIVER
6196+M: William Hubbs <w.d.hubbs@gmail.com>
6197+M: Chris Brannon <chris@the-brannons.com>
6198+M: Kirk Reiser <kirk@braille.uwo.ca>
6199+M: Samuel Thibault <samuel.thibault@ens-lyon.org>
6200+L: speakup@braille.uwo.ca
6201+W: http://www.linux-speakup.org/
6202+S: Odd Fixes
6203+F: drivers/staging/speakup/
6204+
6205+STAGING - TI DSP BRIDGE DRIVERS
6206+M: Omar Ramirez Luna <omar.ramirez@ti.com>
6207+S: Odd Fixes
6208+F: drivers/staging/tidspbridge/
6209+
6210+STAGING - TRIDENT TVMASTER TMxxxx USB VIDEO CAPTURE DRIVERS
6211+L: linux-media@vger.kernel.org
6212+S: Odd Fixes
6213+F: drivers/staging/tm6000/
6214+
6215+STAGING - USB ENE SM/MS CARD READER DRIVER
6216+M: Al Cho <acho@novell.com>
6217+S: Odd Fixes
6218+F: drivers/staging/keucr/
6219+
6220+STAGING - VIA VT665X DRIVERS
6221+M: Forest Bond <forest@alittletooquiet.net>
6222+S: Odd Fixes
6223+F: drivers/staging/vt665?/
6224+
6225+STAGING - WINBOND IS89C35 WLAN USB DRIVER
6226+M: Pavel Machek <pavel@ucw.cz>
6227+S: Odd Fixes
6228+F: drivers/staging/winbond/
6229+
6230+STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER
6231+M: Arnaud Patard <apatard@mandriva.com>
6232+S: Odd Fixes
6233+F: drivers/staging/xgifb/
6234+
60956235 STARFIRE/DURALAN NETWORK DRIVER
60966236 M: Ion Badulescu <ionut@badula.org>
60976237 S: Odd Fixes
@@ -6594,13 +6734,6 @@ W: http://pegasus2.sourceforge.net/ · 496 unmodified lines
65946734 S: Maintained
65956735 F: drivers/net/usb/rtl8150.c
65966736
6597−USB SE401 DRIVER
6598−L: linux-usb@vger.kernel.org
6599−W: http://www.chello.nl/~j.vreeken/se401/
6600−S: Orphan
6601−F: Documentation/video4linux/se401.txt
6602−F: drivers/staging/se401/
6603−
66046737 USB SERIAL BELKIN F5U103 DRIVER
66056738 M: William Greathouse <wgreathouse@smva.com>
66066739 L: linux-usb@vger.kernel.org
arch/arm/mach-ux500/board-mop500-u8500uib.c+2−22
@@ -12,34 +12,14 @@ · 11 unmodified lines
1212 #include <linux/interrupt.h>
1313 #include <linux/mfd/tc3589x.h>
1414 #include <linux/input/matrix_keypad.h>
15−#include <../drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h>
1615
1716 #include <mach/gpio.h>
1817 #include <mach/irqs.h>
1918
2019 #include "board-mop500.h"
2120
22−/*
23− * Synaptics RMI4 touchscreen interface on the U8500 UIB
24− */
25−
26−/*
27− * Descriptor structure.
28− * Describes the number of i2c devices on the bus that speak RMI.
29− */
30−static 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−
38−static 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− },
21+/* Dummy data that can be overridden by staging driver */
22+struct i2c_board_info __initdata __weak mop500_i2c3_devices_u8500[] = {
4323 };
4424
4525 /*
drivers/staging/Kconfig+0−10
@@ -24,10 +24,6 @@ menuconfig STAGING · 23 unmodified lines
2424
2525 if STAGING
2626
27−source "drivers/staging/tty/Kconfig"
28−
29−source "drivers/staging/generic_serial/Kconfig"
30−
3127 source "drivers/staging/et131x/Kconfig"
3228
3329 source "drivers/staging/slicoss/Kconfig"
@@ -100,8 +96,6 @@ source "drivers/staging/sep/Kconfig" · 66 unmodified lines
10096
10197 source "drivers/staging/iio/Kconfig"
10298
103−source "drivers/staging/cs5535_gpio/Kconfig"
104−
10599 source "drivers/staging/zram/Kconfig"
106100
107101 source "drivers/staging/zcache/Kconfig"
@@ -120,8 +114,6 @@ source "drivers/staging/cxt1e1/Kconfig" · 12 unmodified lines
120114
121115 source "drivers/staging/xgifb/Kconfig"
122116
123−source "drivers/staging/msm/Kconfig"
124−
125117 source "drivers/staging/lirc/Kconfig"
126118
127119 source "drivers/staging/easycap/Kconfig"
@@ -132,8 +124,6 @@ source "drivers/staging/tidspbridge/Kconfig" · 4 unmodified lines
132124
133125 source "drivers/staging/quickstart/Kconfig"
134126
135−source "drivers/staging/westbridge/Kconfig"
136−
137127 source "drivers/staging/sbe-2t3e3/Kconfig"
138128
139129 source "drivers/staging/ath6kl/Kconfig"
drivers/staging/Makefile+0−5
@@ -3,8 +3,6 @@ · 2 unmodified lines
33 # fix for build system bug...
44 obj-$(CONFIG_STAGING) += staging.o
55
6−obj-y += tty/
7−obj-y += generic_serial/
86 obj-$(CONFIG_ET131X) += et131x/
97 obj-$(CONFIG_SLICOSS) += slicoss/
108 obj-$(CONFIG_VIDEO_GO7007) += go7007/
@@ -41,7 +39,6 @@ obj-$(CONFIG_HYPERV) += hv/ · 30 unmodified lines
4139 obj-$(CONFIG_VME_BUS) += vme/
4240 obj-$(CONFIG_DX_SEP) += sep/
4341 obj-$(CONFIG_IIO) += iio/
44−obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio/
4542 obj-$(CONFIG_ZRAM) += zram/
4643 obj-$(CONFIG_XVMALLOC) += zram/
4744 obj-$(CONFIG_ZCACHE) += zcache/
@@ -52,12 +49,10 @@ obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ · 4 unmodified lines
5249 obj-$(CONFIG_CRYSTALHD) += crystalhd/
5350 obj-$(CONFIG_CXT1E1) += cxt1e1/
5451 obj-$(CONFIG_FB_XGI) += xgifb/
55−obj-$(CONFIG_MSM_STAGING) += msm/
5652 obj-$(CONFIG_EASYCAP) += easycap/
5753 obj-$(CONFIG_SOLO6X10) += solo6x10/
5854 obj-$(CONFIG_TIDSPBRIDGE) += tidspbridge/
5955 obj-$(CONFIG_ACPI_QUICKSTART) += quickstart/
60−obj-$(CONFIG_WESTBRIDGE_ASTORIA) += westbridge/astoria/
6156 obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3/
6257 obj-$(CONFIG_ATH6K_LEGACY) += ath6kl/
6358 obj-$(CONFIG_USB_ENESTORAGE) += keucr/
drivers/staging/altera-stapl/Kconfig+0−2
@@ -1,5 +1,3 @@
1−comment "Altera FPGA firmware download module"
2−
31 config ALTERA_STAPL
42 tristate "Altera FPGA firmware download module"
53 depends on I2C
drivers/staging/altera-stapl/Makefile+1−1
@@ -1,3 +1,3 @@
1−altera-stapl-objs = altera-lpt.o altera-jtag.o altera-comp.o altera.o
1+altera-stapl-y := altera-lpt.o altera-jtag.o altera-comp.o altera.o
22
33 obj-$(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
24302430 int index = 0;
24312431 s32 offset = 0L;
24322432 s32 error_address = 0L;
2433+ int retval = 0;
24332434
2434− key = kzalloc(33 * sizeof(char), GFP_KERNEL);
2435− if (!key)
2436− return -ENOMEM;
2437− value = kzalloc(257 * sizeof(char), GFP_KERNEL);
2438− if (!value)
2439− return -ENOMEM;
2435+ key = kzalloc(33, GFP_KERNEL);
2436+ if (!key) {
2437+ retval = -ENOMEM;
2438+ goto out;
2439+ }
2440+ value = kzalloc(257, GFP_KERNEL);
2441+ if (!value) {
2442+ retval = -ENOMEM;
2443+ goto free_key;
2444+ }
24402445 astate = kzalloc(sizeof(struct altera_state), GFP_KERNEL);
2441− if (!astate)
2442− return -ENOMEM;
2446+ if (!astate) {
2447+ retval = -ENOMEM;
2448+ goto free_value;
2449+ }
24432450
24442451 astate->config = config;
24452452 if (!astate->config->jtag_io) {
@@ -2518,10 +2525,12 @@ int altera_init(struct altera_config *config, const struct firmware *fw) · 72 unmodified lines
25182525 } else if (exec_result)
25192526 printk(KERN_ERR "%s: error %d\n", __func__, exec_result);
25202527
2521− kfree(key);
2522− kfree(value);
25232528 kfree(astate);
2524−
2525− return 0;
2529+free_value:
2530+ kfree(value);
2531+free_key:
2532+ kfree(key);
2533+out:
2534+ return retval;
25262535 }
25272536 EXPORT_SYMBOL(altera_init);
drivers/staging/ath6kl/TODO+1−1
@@ -1,7 +1,7 @@
11 TODO:
22
33 We are working hard on cleaning up the driver. There's sooooooooo much todo
4−so instead of editign this file please use the wiki:
4+so instead of editing this file please use the wiki:
55
66 http://wireless.kernel.org/en/users/Drivers/ath6kl
77
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
954954 const char *filename;
955955 const struct firmware *fw_entry;
956956 u32 fw_entry_size;
957+ u8 **buf;
958+ size_t *buf_len;
957959
958960 switch (file) {
959961 case AR6K_OTP_FILE:
962+ buf = &ar->fw_otp;
963+ buf_len = &ar->fw_otp_len;
960964 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
961965 filename = AR6003_REV1_OTP_FILE;
962966 } 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
970974 break;
971975
972976 case AR6K_FIRMWARE_FILE:
977+ buf = &ar->fw;
978+ buf_len = &ar->fw_len;
973979 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
974980 filename = AR6003_REV1_FIRMWARE_FILE;
975981 } 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
10281034 break;
10291035
10301036 case AR6K_PATCH_FILE:
1037+ buf = &ar->fw_patch;
1038+ buf_len = &ar->fw_patch_len;
10311039 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
10321040 filename = AR6003_REV1_PATCH_FILE;
10331041 } 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
10411049 break;
10421050
10431051 case AR6K_BOARD_DATA_FILE:
1052+ buf = &ar->fw_data;
1053+ buf_len = &ar->fw_data_len;
10441054 if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
10451055 filename = AR6003_REV1_BOARD_DATA_FILE;
10461056 } 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
10571067 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown file type: %d\n", file));
10581068 return A_ERROR;
10591069 }
1060− if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0)
1061− {
1062− AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename));
1063− return A_ENOENT;
1070+
1071+ if (*buf == NULL) {
1072+ if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0) {
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);
10641080 }
10651081
10661082 #ifdef SOFTMAC_FILE_USED
1067− if (file==AR6K_BOARD_DATA_FILE && fw_entry->data) {
1068− ar6000_softmac_update(ar, (u8 *)fw_entry->data, fw_entry->size);
1083+ if (file==AR6K_BOARD_DATA_FILE && *buf_len) {
1084+ ar6000_softmac_update(ar, *buf, *buf_len);
10691085 }
10701086 #endif
10711087
10721088
1073− fw_entry_size = fw_entry->size;
1089+ fw_entry_size = *buf_len;
10741090
10751091 /* Load extended board data for AR6003 */
1076− if ((file==AR6K_BOARD_DATA_FILE) && (fw_entry->data)) {
1092+ if ((file==AR6K_BOARD_DATA_FILE) && *buf) {
10771093 u32 board_ext_address;
10781094 u32 board_ext_data_size;
10791095 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
10891105 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("Board extended Data download address: 0x%x\n", board_ext_address));
10901106
10911107 /* 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))) {
10931109 u32 param;
10941110
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);
10961112
10971113 if (status) {
10981114 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__));
1099− A_RELEASE_FIRMWARE(fw_entry);
11001115 return A_ERROR;
11011116 }
11021117
@@ -1110,17 +1125,16 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 7 unmodified lines
11101125 }
11111126
11121127 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);
11141129 } else {
1115− status = BMIWriteMemory(ar->arHifDevice, address, (u8 *)fw_entry->data, fw_entry_size);
1130+ status = BMIWriteMemory(ar->arHifDevice, address, *buf, fw_entry_size);
11161131 }
11171132
11181133 if (status) {
11191134 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__));
1120− A_RELEASE_FIRMWARE(fw_entry);
11211135 return A_ERROR;
11221136 }
1123− A_RELEASE_FIRMWARE(fw_entry);
1137+
11241138 return 0;
11251139 }
11261140
@@ -2088,6 +2102,11 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister) · 961 unmodified lines
20882102 ar6000_remove_ap_interface();
20892103 #endif /*CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
20902104
2105+ kfree(ar->fw_otp);
2106+ kfree(ar->fw);
2107+ kfree(ar->fw_patch);
2108+ kfree(ar->fw_data);
2109+
20912110 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("-ar6000_destroy \n"));
20922111 }
20932112
@@ -4114,6 +4133,13 @@ ar6000_ready_event(void *devt, u8 *datap, u8 phyCap, u32 sw_ver, u32 abi_ver) · 2020 unmodified lines
41144133 ar->arVersion.wlan_ver = sw_ver;
41154134 ar->arVersion.abi_ver = abi_ver;
41164135
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+
41174143 /* Indicate to the waiting thread that the ready event was received */
41184144 ar->arWmiReady = true;
41194145 wake_up(&arEvent);
drivers/staging/ath6kl/os/linux/cfg80211.c+198−13
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <linux/wireless.h>
2525 #include <linux/ieee80211.h>
2626 #include <net/cfg80211.h>
27+#include <net/netlink.h>
2728
2829 #include "ar6000_drv.h"
2930
@@ -867,26 +868,31 @@ ar6k_cfg80211_scanComplete_event(struct ar6_softc *ar, int status) · 837 unmodified lines
867868
868869 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: status %d\n", __func__, status));
869870
870− if(ar->scan_request)
871− {
872− /* Translate data to cfg80211 mgmt format */
873− if (ar->arWmi)
874− wmi_iterate_nodes(ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy);
871+ if (!ar->scan_request)
872+ return;
873+
874+ if ((status == A_ECANCELED) || (status == A_EBUSY)) {
875+ cfg80211_scan_done(ar->scan_request, true);
876+ goto out;
877+ }
875878
876− cfg80211_scan_done(ar->scan_request,
877− ((status & A_ECANCELED) || (status & A_EBUSY)) ? true : false);
879+ /* Translate data to cfg80211 mgmt format */
880+ wmi_iterate_nodes(ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy);
878881
879− if(ar->scan_request->n_ssids &&
880− ar->scan_request->ssids[0].ssid_len) {
882+ cfg80211_scan_done(ar->scan_request, false);
883+
884+ if(ar->scan_request->n_ssids &&
885+ ar->scan_request->ssids[0].ssid_len) {
881886 u8 i;
882887
883888 for (i = 0; i < ar->scan_request->n_ssids; i++) {
884− wmi_probedSsid_cmd(ar->arWmi, i+1, DISABLE_SSID_FLAG,
885− 0, NULL);
889+ wmi_probedSsid_cmd(ar->arWmi, i+1, DISABLE_SSID_FLAG,
890+ 0, NULL);
886891 }
887− }
888− ar->scan_request = NULL;
889892 }
893+
894+out:
895+ ar->scan_request = NULL;
890896 }
891897
892898 static int
@@ -1453,6 +1459,159 @@ ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) · 560 unmodified lines
14531459 return 0;
14541460 }
14551461
1462+#ifdef CONFIG_NL80211_TESTMODE
1463+enum 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+
1473+enum 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+
1480+static 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+
1486+void 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+
1502+static 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+
1552+out:
1553+ up(&ar->arSem);
1554+
1555+ return ret;
1556+
1557+nla_put_failure:
1558+ ret = -ENOBUFS;
1559+ goto out;
1560+}
1561+
1562+static 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
14561615
14571616 static const
14581617 u32 cipher_suites[] = {
@@ -1607,6 +1766,28 @@ static int ar6k_get_station(struct wiphy *wiphy, struct net_device *dev, · 148 unmodified lines
16071766 return 0;
16081767 }
16091768
1769+static 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+
1776+static 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+
1783+static 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+
16101791 static struct
16111792 cfg80211_ops ar6k_cfg80211_ops = {
16121793 .change_virtual_intf = ar6k_cfg80211_change_iface,
@@ -1628,6 +1809,10 @@ cfg80211_ops ar6k_cfg80211_ops = { · 15 unmodified lines
16281809 .join_ibss = ar6k_cfg80211_join_ibss,
16291810 .leave_ibss = ar6k_cfg80211_leave_ibss,
16301811 .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)
16311816 };
16321817
16331818 struct wireless_dev *
drivers/staging/ath6kl/os/linux/include/ar6000_drv.h+11−8
@@ -545,15 +545,9 @@ struct ar6_softc { · 544 unmodified lines
545545 s8 arMaxRetries;
546546 u8 arPhyCapability;
547547 #ifdef CONFIG_HOST_TCMD_SUPPORT
548− u8 tcmdRxReport;
549− u32 tcmdRxTotalPkt;
550− s32 tcmdRxRssi;
551− u32 tcmdPm;
552548 u32 arTargetMode;
553− u32 tcmdRxcrcErrPkt;
554− u32 tcmdRxsecErrPkt;
555− u16 tcmdRateCnt[TCMD_MAX_RATES];
556− u16 tcmdRateCntShortGuard[TCMD_MAX_RATES];
549+ void *tcmd_rx_report;
550+ int tcmd_rx_report_len;
557551 #endif
558552 AR6000_WLAN_STATE arWlanState;
559553 struct ar_node_mapping arNodeMap[MAX_NODE_NUM];
@@ -650,6 +644,15 @@ struct ar6_softc { · 90 unmodified lines
650644 void *arApDev;
651645 #endif
652646 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;
653656 };
654657
655658 #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
4141
4242 void ar6k_cfg80211_tkip_micerr_event(struct ar6_softc *ar, u8 keyid, bool ismcast);
4343
44+#ifdef CONFIG_NL80211_TESTMODE
45+void ar6000_testmode_rx_report_event(struct ar6_softc *ar, void *buf,
46+ int buf_len);
47+#else
48+static inline void ar6000_testmode_rx_report_event(struct ar6_softc *ar,
49+ void *buf, int buf_len)
50+{
51+}
52+#endif
53+
54+
4455 #endif /* _AR6K_CFG80211_H_ */
4556
4657
drivers/staging/ath6kl/os/linux/include/config_linux.h+0−2
@@ -28,8 +28,6 @@ · 27 unmodified lines
2828 extern "C" {
2929 #endif
3030
31−#include <linux/version.h>
32−
3331 /*
3432 * Host side Test Command support
3533 */
drivers/staging/ath6kl/os/linux/include/ieee80211_ioctl.h+0−2
@@ -24,8 +24,6 @@ · 23 unmodified lines
2424 #ifndef _IEEE80211_IOCTL_H_
2525 #define _IEEE80211_IOCTL_H_
2626
27−#include <linux/version.h>
28−
2927 #ifdef __cplusplus
3028 extern "C" {
3129 #endif
drivers/staging/ath6kl/os/linux/include/osapi_linux.h+0−1
@@ -29,7 +29,6 @@ · 28 unmodified lines
2929
3030 #ifdef __KERNEL__
3131
32−#include <linux/version.h>
3332 #include <linux/types.h>
3433 #include <linux/kernel.h>
3534 #include <linux/string.h>
drivers/staging/ath6kl/wmi/wmi.c+3−3
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141 #include "a_debug.h"
4242 #include "dbglog_api.h"
4343 #include "roaming.h"
44+#include "cfg80211.h"
4445
4546 #define ATH_DEBUG_WMI ATH_DEBUG_MAKE_MODULE_MASK(0)
4647
@@ -4465,10 +4466,9 @@ wmi_verify_tspec_params(WMI_CREATE_PSTREAM_CMD *pCmd, int tspecCompliance) · 4418 unmodified lines
44654466 static int
44664467 wmi_tcmd_test_report_rx(struct wmi_t *wmip, u8 *datap, int len)
44674468 {
4469+ ar6000_testmode_rx_report_event(wmip->wmi_devt, datap, len);
44684470
4469− A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG));
4470−
4471− return 0;
4471+ return 0;
44724472 }
44734473
44744474 #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
131131
132132 // TODO - put PHS_SEND in Tx PHS_RECEIVE in Rx path ?
133133 #define PHS_SEND (OTHERS<<16)
134−#define PHS_RECIEVE (OTHERS<<17)
134+#define PHS_RECEIVE (OTHERS<<17)
135135 #define PHS_MODULE (OTHERS<<18)
136136
137137 #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
157157 {
158158 /* Moving ahead by ETH_HLEN to the data ptr as received from FW */
159159 skb_pull(skb, ETH_HLEN);
160− PHSRecieve(Adapter, pLeader->Vcid, skb, &skb->len,
160+ PHSReceive(Adapter, pLeader->Vcid, skb, &skb->len,
161161 NULL,bHeaderSupressionEnabled);
162162
163163 if(!Adapter->PackInfo[QueueIndex].bEthCSSupport)
@@ -229,7 +229,7 @@ static int ReceiveRcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_RCB pRcb) · 65 unmodified lines
229229 /*
230230 Function: InterfaceRx
231231
232−Description: This is the hardware specific Function for Recieveing
232+Description: This is the hardware specific Function for Receiving
233233 data packet/control packets from the device.
234234
235235 Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context
drivers/staging/bcm/Macros.h+2−2
@@ -176,8 +176,8 @@ enum enLinkStatus { · 175 unmodified lines
176176 PHY_SYNC_ACHIVED = 2,
177177 LINKUP_IN_PROGRESS = 3,
178178 LINKUP_DONE = 4,
179− DREG_RECIEVED = 5,
180− LINK_STATUS_RESET_RECIEVED = 6,
179+ DREG_RECEIVED = 5,
180+ LINK_STATUS_RESET_RECEIVED = 6,
181181 PERIODIC_WAKE_UP_NOTIFICATION_FRM_FW = 7,
182182 LINK_SHUTDOWN_REQ_FROM_FIRMWARE = 8,
183183 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
14471447
14481448 int rdm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize)
14491449 {
1450− INT uiRetVal =0;
1451−
1452− uiRetVal = Adapter->interface_rdm(Adapter->pvInterfaceAdapter,
1450+ return Adapter->interface_rdm(Adapter->pvInterfaceAdapter,
14531451 uiAddress, pucBuff, sSize);
1454−
1455− if(uiRetVal < 0)
1456− return uiRetVal;
1457−
1458− return uiRetVal;
14591452 }
1453+
14601454 int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize)
14611455 {
14621456 int iRetVal;
drivers/staging/bcm/PHSModule.c+12−12
@@ -209,7 +209,7 @@ int PHSTransmit(PMINI_ADAPTER Adapter, · 208 unmodified lines
209209 return STATUS_SUCCESS;
210210 }
211211
212−int PHSRecieve(PMINI_ADAPTER Adapter,
212+int PHSReceive(PMINI_ADAPTER Adapter,
213213 USHORT usVcid,
214214 struct sk_buff *packet,
215215 UINT *punPacketLen,
@@ -223,7 +223,7 @@ int PHSRecieve(PMINI_ADAPTER Adapter, · 7 unmodified lines
223223 UINT TotalBytesAdded = 0;
224224 if(!bHeaderSuppressionEnabled)
225225 {
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");
227227 return ulPhsStatus;
228228 }
229229
@@ -238,7 +238,7 @@ int PHSRecieve(PMINI_ADAPTER Adapter, · 8 unmodified lines
238238 &nTotalsupressedPktHdrBytes,
239239 &nStandardPktHdrLen);
240240
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",
242242 nTotalsupressedPktHdrBytes,nStandardPktHdrLen);
243243
244244 if(ulPhsStatus != STATUS_PHS_COMPRESSED)
@@ -786,14 +786,14 @@ ULONG PhsDeCompress(IN void* pvContext, · 541 unmodified lines
786786
787787 if(pDeviceExtension == NULL)
788788 {
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");
790790 return ERR_PHS_INVALID_DEVICE_EXETENSION;
791791 }
792792
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");
794794
795795 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);
797797 if(phsi == UNCOMPRESSED_PACKET )
798798 {
799799 return STATUS_PHS_NOCOMPRESSION;
@@ -804,7 +804,7 @@ ULONG PhsDeCompress(IN void* pvContext, · 4 unmodified lines
804804 uiVcid,&pstServiceFlowEntry);
805805 if(nSFIndex == PHS_INVALID_TABLE_INDEX)
806806 {
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");
808808 return ERR_SF_MATCH_FAIL;
809809 }
810810
@@ -1417,7 +1417,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 606 unmodified lines
14171417 int in_buf_len = *header_size-1;
14181418 PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
14191419 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");
14211421 *header_size = 0;
14221422
14231423 if((decomp_phs_rules == NULL ))
@@ -1425,7 +1425,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 1 unmodified line
14251425
14261426
14271427 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));
14291429 //*header_size = tmp_memb->u8PHSFLength;
14301430 phss = tmp_memb->u8PHSS;
14311431 phsf = tmp_memb->u8PHSF;
@@ -1433,7 +1433,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 1 unmodified line
14331433
14341434 if(phss > MAX_PHS_LENGTHS)
14351435 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));
14371437 while((phss > 0) && (size < in_buf_len))
14381438 {
14391439 bit = ((*phsm << i)& SUPPRESS);
@@ -1441,13 +1441,13 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 1 unmodified line
14411441 if(bit == SUPPRESS)
14421442 {
14431443 *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",
14451445 phss,*phsf,*out_buf);
14461446 }
14471447 else
14481448 {
14491449 *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",
14511451 phss,*in_buf,*out_buf);
14521452 in_buf++;
14531453 size++;
drivers/staging/bcm/PHSModule.h+1−1
@@ -9,7 +9,7 @@ int PHSTransmit(PMINI_ADAPTER Adapter, · 8 unmodified lines
99 PUINT PacketLen,
1010 UCHAR bEthCSSupport);
1111
12−int PHSRecieve(PMINI_ADAPTER Adapter,
12+int PHSReceive(PMINI_ADAPTER Adapter,
1313 USHORT usVcid,
1414 struct sk_buff *packet,
1515 UINT *punPacketLen,
drivers/staging/bcm/headers.h+0−1
@@ -23,7 +23,6 @@ · 22 unmodified lines
2323 #include <linux/wait.h>
2424 #include <linux/proc_fs.h>
2525 #include <linux/interrupt.h>
26−#include <linux/version.h>
2726 #include <linux/stddef.h>
2827 #include <linux/stat.h>
2928 #include <linux/fcntl.h>
drivers/staging/bcm/sort.c+33−44
@@ -1,4 +1,5 @@
11 #include "headers.h"
2+#include <linux/sort.h>
23
34 /*
45 * File Name: sort.c
@@ -10,54 +11,42 @@ · 5 unmodified lines
1011 * Copyright (c) 2007 Beceem Communications Pvt. Ltd
1112 */
1213
14+static 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+
1325 VOID SortPackInfo(PMINI_ADAPTER Adapter)
1426 {
15− UINT nIndex1;
16− UINT nIndex2;
17−
18− BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=======");
19−
20− for(nIndex1 = 0; nIndex1 < NO_OF_QUEUES -2 ; nIndex1++)
21− {
22− for(nIndex2 = nIndex1 + 1 ; nIndex2 < NO_OF_QUEUES -1 ; nIndex2++)
23− {
24− if(Adapter->PackInfo[nIndex1].bValid && Adapter->PackInfo[nIndex2].bValid)
25− {
26− if(Adapter->PackInfo[nIndex2].u8TrafficPriority <
27− Adapter->PackInfo[nIndex1].u8TrafficPriority)
28− {
29− PacketInfo stTemppackInfo = Adapter->PackInfo[nIndex2];
30− Adapter->PackInfo[nIndex2] = Adapter->PackInfo[nIndex1];
31− Adapter->PackInfo[nIndex1] = stTemppackInfo;
32−
33− }
34− }
35− }
36− }
27+ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG,
28+ DBG_LVL_ALL, "<=======");
29+
30+ sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(PacketInfo),
31+ compare_packet_info, NULL);
32+}
33+
34+static int compare_classifiers(void const *a, void const *b)
35+{
36+ S_CLASSIFIER_RULE const *pa = a;
37+ S_CLASSIFIER_RULE const *pb = b;
38+
39+ if (!pa->bUsed || !pb->bUsed)
40+ return 0;
41+
42+ return pa->u8ClassifierRulePriority - pb->u8ClassifierRulePriority;
3743 }
3844
3945 VOID SortClassifiers(PMINI_ADAPTER Adapter)
4046 {
41− UINT nIndex1;
42− UINT nIndex2;
43−
44− BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=======");
45−
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− }
47+ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG,
48+ DBG_LVL_ALL, "<=======");
49+
50+ sort(Adapter->astClassifierTable, MAX_CLASSIFIERS,
51+ sizeof(S_CLASSIFIER_RULE), compare_classifiers, NULL);
6352 }
drivers/staging/brcm80211/Makefile+2−2
@@ -17,8 +17,8 @@ · 16 unmodified lines
1717
1818 # common flags
1919 subdir-ccflags-y := -DBCMDMA32
20−subdir-ccflags-$(CONFIG_BRCMDBG) += -DBCMDBG -DBCMDBG_ASSERT
20+subdir-ccflags-$(CONFIG_BRCMDBG) += -DBCMDBG
2121
22−obj-$(CONFIG_BRCMUTIL) += util/
22+obj-$(CONFIG_BRCMUTIL) += brcmutil/
2323 obj-$(CONFIG_BRCMFMAC) += brcmfmac/
2424 obj-$(CONFIG_BRCMSMAC) += brcmsmac/
drivers/staging/brcm80211/README+1−64
@@ -1,64 +1 @@
1−Broadcom brcmsmac (mac80211-based softmac PCIe) and brcmfmac (SDIO) drivers.
2−
3−Completely open source host drivers, no binary object files.
4−
5−Support 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−
18−Both brcmsmac and brcmfmac drivers require firmware files that need to be
19−separately downloaded.
20−
21−Firmware
22−======================
23−Firmware 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−===============================================================
31−Broadcom brcmsmac driver
32−===============================================================
33−- Support for both 32 and 64 bit Linux kernels
34−
35−
36−Firmware installation
37−======================
38−Copy brcm/bcm43xx-0.fw and brcm/bcm43xx_hdr-0.fw to
39−/lib/firmware/brcm (or wherever firmware is normally installed
40−on your system).
41−
42−
43−===============================================================
44−Broadcom brcmfmac driver
45−===============================================================
46−- Support for 32 bit Linux kernel, 64 bit untested
47−
48−
49−Firmware installation
50−======================
51−Copy brcm/bcm4329-fullmac-4.bin and brcm/bcm4329-fullmac-4.txt
52−to /lib/firmware/brcm (or wherever firmware is normally installed on your
53−system).
54−
55−
56−Contact Info:
57−=============
58−Brett Rudley brudley@broadcom.com
59−Henry Ptasinski henryp@broadcom.com
60−Dowan Kim dowan@broadcom.com
61−Roland Vossen rvossen@broadcom.com
62−Arend van Spriel arend@broadcom.com
63−
64−For more info, refer to: http://linuxwireless.org/en/users/Drivers/brcm80211
1+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
22
33 Bugs
44 ====
5−- Oops on AMPDU traffic, to be solved by new ucode (currently under test)
5+- none known at this moment
66
7−brcmfmac and brcmsmac
7+brcmfmac
88 =====================
9−- ASSERTS not allowed in mainline, replace by warning + error handling
10−- Replace printk and WL_ERROR() with proper routines
9+- ASSERTS deprecated in mainline, replace by warning + error handling
1110
12−brcmfmac
11+brcm80211 info page
1312 =====================
14−- Replace driver's proprietary ssb interface with generic kernel ssb module
15−- Build and test on 64 bit linux kernel
13+http://linuxwireless.org/en/users/Drivers/brcm80211
drivers/staging/brcm80211/brcmfmac/Makefile+5−22
@@ -16,23 +16,11 @@ · 15 unmodified lines
1616 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1717
1818 ccflags-y := \
19− -DARP_OFFLOAD_SUPPORT \
20− -DBCMLXSDMMC \
21− -DBCMPLATFORM_BUS \
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
19+ -DBRCMF_FIRSTREAD=64 \
20+ -DBRCMF_SDALIGN=64 \
21+ -DMAX_HDR_READ=64
3422
35−ccflags-$(CONFIG_BRCMDBG) += -DDHD_DEBUG
23+ccflags-$(CONFIG_BRCMDBG) += -DSHOW_EVENTS
3624
3725 ccflags-y += \
3826 -Idrivers/staging/brcm80211/brcmfmac \
@@ -40,17 +28,12 @@ ccflags-y += \ · 1 unmodified line
4028
4129 DHDOFILES = \
4230 wl_cfg80211.o \
43− wl_iw.o \
4431 dhd_cdc.o \
4532 dhd_common.o \
46− dhd_custom_gpio.o \
4733 dhd_sdio.o \
4834 dhd_linux.o \
49− dhd_linux_sched.o \
5035 bcmsdh.o \
51− bcmsdh_linux.o \
52− bcmsdh_sdmmc.o \
53− bcmsdh_sdmmc_linux.o
36+ bcmsdh_sdmmc.o
5437
5538 obj-$(CONFIG_BRCMFMAC) += brcmfmac.o
5639 brcmfmac-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−
18−typedef 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−
92−struct 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
1717 #ifndef _bcmchip_h_
1818 #define _bcmchip_h_
1919
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−
2620 /* bcm4329 */
2721 /* SDIO device core, ID 0x829 */
2822 #define BCM4329_CORE_BUS_BASE 0x18011000
@@ -31,5 +25,8 @@ · 2 unmodified lines
3125 /* ARM Cortex M3 core, ID 0x82a */
3226 #define BCM4329_CORE_ARM_BASE 0x18002000
3327 #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"
3431
3532 #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−
37−typedef int SDIOH_API_RC;
38−
39−/* SDio Host structure */
40−typedef struct sdioh_info sdioh_info_t;
41−
42−/* callback function, taking one arg */
43−typedef 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− */
49−extern sdioh_info_t *sdioh_attach(void *cfghdl, uint irq);
50−extern SDIOH_API_RC sdioh_detach(sdioh_info_t *si);
51−extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si,
52− sdioh_cb_fn_t fn, void *argh);
53−extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si);
54−
55−/* query whether SD interrupt is enabled or not */
56−extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *si, bool *onoff);
57−
58−/* enable or disable SD interrupt */
59−extern SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *si, bool enable_disable);
60−
61−#if defined(DHD_DEBUG)
62−extern bool sdioh_interrupt_pending(sdioh_info_t *si);
63−#endif
64−
65−extern int sdioh_claim_host_and_lock(sdioh_info_t *si);
66−extern int sdioh_release_host_and_unlock(sdioh_info_t *si);
67−
68−/* read or write one byte using cmd52 */
69−extern 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 */
73−extern 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 */
78−extern 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 */
85−extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, u8 *cis,
86− u32 length);
87−
88−extern SDIOH_API_RC sdioh_cfg_read(sdioh_info_t *si, uint fuc, u32 addr,
89− u8 *data);
90−extern SDIOH_API_RC sdioh_cfg_write(sdioh_info_t *si, uint fuc, u32 addr,
91− u8 *data);
92−
93−/* query number of io functions */
94−extern uint sdioh_query_iofnum(sdioh_info_t *si);
95−
96−/* handle iovars */
97−extern 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 */
101−extern int sdioh_abort(sdioh_info_t *si, uint fnc);
102−
103−/* Start and Stop SDIO without re-enumerating the SD card. */
104−extern int sdioh_start(sdioh_info_t *si, int stage);
105−extern int sdioh_stop(sdioh_info_t *si);
106−
107−/* Reset and re-initialize the device */
108−extern int sdioh_sdio_reset(sdioh_info_t *si);
109−
110−/* Helper function */
111−void *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
1313 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
1414 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515 */
16−/* ****************** BCMSDH Interface Functions *************************** */
16+/* ****************** SDIO CARD Interface Functions **************************/
1717
1818 #include <linux/types.h>
1919 #include <linux/netdevice.h>
20+#include <linux/pci.h>
2021 #include <linux/pci_ids.h>
21−#include <bcmdefs.h>
22−#include <bcmdevs.h>
23−#include <bcmutils.h>
24−#include <hndsoc.h>
25−
26−#include <bcmsdh.h> /* BRCM API for SDIO
27− clients (such as wl, dhd) */
28−#include <bcmsdbus.h> /* common SDIO/controller interface */
29−#include <sbsdio.h> /* BRCM sdio device core */
30−
31−#include <sdio.h> /* sdio spec */
32−#include "dngl_stats.h"
22+#include <linux/sched.h>
23+#include <linux/completion.h>
24+
25+#include <defs.h>
26+#include <brcm_hw_ids.h>
27+#include <brcmu_utils.h>
28+#include <brcmu_wifi.h>
29+#include <soc.h>
3330 #include "dhd.h"
31+#include "dhd_bus.h"
32+#include "sdio_host.h"
3433
3534 #define SDIOH_API_ACCESS_RETRY_LIMIT 2
36−const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL;
3735
38−struct 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+
68+struct brcmf_sdio_card {
3969 bool init_success; /* underlying driver successfully attached */
4070 void *sdioh; /* handler for sdioh */
4171 u32 vendevid; /* Target Vendor and Device ID on SD bus */
@@ -43,282 +73,232 @@ struct bcmsdh_info { · 1 unmodified line
4373 reg_read/reg_write call */
4474 u32 sbwad; /* Save backplane window address */
4575 };
76+
77+/**
78+ * SDIO Host Controller info
79+ */
80+struct 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+
4692 /* local copy of bcm sd handler */
47−bcmsdh_info_t *l_bcmsdh;
93+static struct brcmf_sdio_card *l_card;
4894
49−#if defined(OOB_INTR_ONLY) && defined(HW_OOB)
50−extern int sdioh_enable_hw_oob_intr(void *sdioh, bool enable);
95+const uint brcmf_sdio_msglevel = BRCMF_SD_ERROR_VAL;
5196
52−void bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable)
53−{
54− sdioh_enable_hw_oob_intr(sdh->sdioh, enable);
55−}
56−#endif
97+static struct sdio_hc *sdhcinfo;
98+
99+/* driver info, initialized when brcmf_sdio_register is called */
100+static struct brcmf_sdioh_driver drvinfo = { NULL, NULL };
101+
102+/* Module parameters specific to each host-controller driver */
103+
104+module_param(sd_msglevel, uint, 0);
57105
58−bcmsdh_info_t *bcmsdh_attach(void *cfghdl, void **regsva, uint irq)
106+extern uint sd_f2_blocksize;
107+module_param(sd_f2_blocksize, int, 0);
108+
109+/* forward declarations */
110+int brcmf_sdio_probe(struct device *dev);
111+EXPORT_SYMBOL(brcmf_sdio_probe);
112+
113+int brcmf_sdio_remove(struct device *dev);
114+EXPORT_SYMBOL(brcmf_sdio_remove);
115+
116+struct brcmf_sdio_card*
117+brcmf_sdcard_attach(void *cfghdl, u32 *regsva, uint irq)
59118 {
60− bcmsdh_info_t *bcmsdh;
119+ struct brcmf_sdio_card *card;
61120
62− bcmsdh = kzalloc(sizeof(bcmsdh_info_t), GFP_ATOMIC);
63− if (bcmsdh == NULL) {
64− BCMSDH_ERROR(("bcmsdh_attach: out of memory"));
121+ card = kzalloc(sizeof(struct brcmf_sdio_card), GFP_ATOMIC);
122+ if (card == NULL) {
123+ BRCMF_SD_ERROR(("sdcard_attach: out of memory"));
65124 return NULL;
66125 }
67126
68127 /* save the handler locally */
69− l_bcmsdh = bcmsdh;
128+ l_card = card;
70129
71− bcmsdh->sdioh = sdioh_attach(cfghdl, irq);
72− if (!bcmsdh->sdioh) {
73− bcmsdh_detach(bcmsdh);
130+ card->sdioh = brcmf_sdioh_attach(cfghdl, irq);
131+ if (!card->sdioh) {
132+ brcmf_sdcard_detach(card);
74133 return NULL;
75134 }
76135
77− bcmsdh->init_success = true;
136+ card->init_success = true;
78137
79− *regsva = (u32 *) SI_ENUM_BASE;
138+ *regsva = SI_ENUM_BASE;
80139
81140 /* Report the BAR, to fix if needed */
82− bcmsdh->sbwad = SI_ENUM_BASE;
83− return bcmsdh;
141+ card->sbwad = SI_ENUM_BASE;
142+ return card;
84143 }
85144
86−int bcmsdh_detach(void *sdh)
145+int brcmf_sdcard_detach(struct brcmf_sdio_card *card)
87146 {
88− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
89−
90− if (bcmsdh != NULL) {
91− if (bcmsdh->sdioh) {
92− sdioh_detach(bcmsdh->sdioh);
93− bcmsdh->sdioh = NULL;
147+ if (card != NULL) {
148+ if (card->sdioh) {
149+ brcmf_sdioh_detach(card->sdioh);
150+ card->sdioh = NULL;
94151 }
95− kfree(bcmsdh);
152+ kfree(card);
96153 }
97154
98− l_bcmsdh = NULL;
155+ l_card = NULL;
99156 return 0;
100157 }
101158
102159 int
103−bcmsdh_iovar_op(void *sdh, const char *name,
160+brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name,
104161 void *params, int plen, void *arg, int len, bool set)
105162 {
106− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
107− return sdioh_iovar_op(bcmsdh->sdioh, name, params, plen, arg, len, set);
108−}
109−
110−bool 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−
124−int 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;
163+ return brcmf_sdioh_iovar_op(card->sdioh, name, params, plen, arg,
164+ len, set);
132165 }
133166
134−int bcmsdh_intr_disable(void *sdh)
167+int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card)
135168 {
136− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
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;
169+ return brcmf_sdioh_interrupt_set(card->sdioh, true);
142170 }
143171
144−int bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
172+int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card)
145173 {
146− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
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;
174+ return brcmf_sdioh_interrupt_set(card->sdioh, false);
152175 }
153176
154−int bcmsdh_intr_dereg(void *sdh)
177+int brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card,
178+ void (*fn)(void *), void *argh)
155179 {
156− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
157− SDIOH_API_RC status;
158− ASSERT(bcmsdh);
159−
160− status = sdioh_interrupt_deregister(bcmsdh->sdioh);
161− return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
180+ return brcmf_sdioh_interrupt_register(card->sdioh, fn, argh);
162181 }
163182
164−#if defined(DHD_DEBUG)
165−bool bcmsdh_intr_pending(void *sdh)
183+int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card)
166184 {
167− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
168−
169− ASSERT(sdh);
170− return sdioh_interrupt_pending(bcmsdh->sdioh);
185+ return brcmf_sdioh_interrupt_deregister(card->sdioh);
171186 }
172−#endif
173187
174−int bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
188+u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
189+ int *err)
175190 {
176− ASSERT(sdh);
177−
178− /* don't support yet */
179− return -ENOTSUPP;
180−}
181−
182−u8 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
191+ int status;
187192 s32 retry = 0;
188−#endif
189193 u8 data = 0;
190194
191− if (!bcmsdh)
192− bcmsdh = l_bcmsdh;
193−
194− ASSERT(bcmsdh->init_success);
195+ if (!card)
196+ card = l_card;
195197
196−#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
197198 do {
198199 if (retry) /* wait for 1 ms till bus get settled down */
199200 udelay(1000);
200−#endif
201201 status =
202− sdioh_cfg_read(bcmsdh->sdioh, fnc_num, addr,
202+ brcmf_sdioh_cfg_read(card->sdioh, fnc_num, addr,
203203 (u8 *) &data);
204−#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
205− } while (!SDIOH_API_SUCCESS(status)
204+ } while (status != 0
206205 && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
207−#endif
208206 if (err)
209− *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO);
207+ *err = status;
210208
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",
212210 __func__, fnc_num, addr, data));
213211
214212 return data;
215213 }
216214
217215 void
218−bcmsdh_cfg_write(void *sdh, uint fnc_num, u32 addr, u8 data, int *err)
216+brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
217+ u8 data, int *err)
219218 {
220− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
221− SDIOH_API_RC status;
222−#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
219+ int status;
223220 s32 retry = 0;
224−#endif
225221
226− if (!bcmsdh)
227− bcmsdh = l_bcmsdh;
222+ if (!card)
223+ card = l_card;
228224
229− ASSERT(bcmsdh->init_success);
230−
231−#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
232225 do {
233226 if (retry) /* wait for 1 ms till bus get settled down */
234227 udelay(1000);
235−#endif
236228 status =
237− sdioh_cfg_write(bcmsdh->sdioh, fnc_num, addr,
229+ brcmf_sdioh_cfg_write(card->sdioh, fnc_num, addr,
238230 (u8 *) &data);
239−#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
240− } while (!SDIOH_API_SUCCESS(status)
231+ } while (status != 0
241232 && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
242−#endif
243233 if (err)
244− *err = SDIOH_API_SUCCESS(status) ? 0 : -EIO;
234+ *err = status;
245235
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",
247237 __func__, fnc_num, addr, data));
248238 }
249239
250−u32 bcmsdh_cfg_read_word(void *sdh, uint fnc_num, u32 addr, int *err)
240+u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
241+ u32 addr, int *err)
251242 {
252− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
253− SDIOH_API_RC status;
243+ int status;
254244 u32 data = 0;
255245
256− if (!bcmsdh)
257− bcmsdh = l_bcmsdh;
258−
259− ASSERT(bcmsdh->init_success);
246+ if (!card)
247+ card = l_card;
260248
261− status =
262− sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_READ,
263− fnc_num, addr, &data, 4);
249+ status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
250+ SDIOH_READ, fnc_num, addr, &data, 4);
264251
265252 if (err)
266− *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO);
253+ *err = status;
267254
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",
269256 __func__, fnc_num, addr, data));
270257
271258 return data;
272259 }
273260
274261 void
275−bcmsdh_cfg_write_word(void *sdh, uint fnc_num, u32 addr, u32 data,
276− int *err)
262+brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num,
263+ u32 addr, u32 data, int *err)
277264 {
278− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
279− SDIOH_API_RC status;
280−
281− if (!bcmsdh)
282− bcmsdh = l_bcmsdh;
265+ int status;
283266
284− ASSERT(bcmsdh->init_success);
267+ if (!card)
268+ card = l_card;
285269
286270 status =
287− sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL,
271+ brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
288272 SDIOH_WRITE, fnc_num, addr, &data, 4);
289273
290274 if (err)
291− *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO);
275+ *err = status;
292276
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",
294278 __func__, fnc_num, addr, data));
295279 }
296280
297−int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length)
281+int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis,
282+ uint length)
298283 {
299− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
300− SDIOH_API_RC status;
284+ int status;
301285
302286 u8 *tmp_buf, *tmp_ptr;
303287 u8 *ptr;
304288 bool ascii = func & ~0xf;
305289 func &= 0x7;
306290
307− if (!bcmsdh)
308− bcmsdh = l_bcmsdh;
291+ if (!card)
292+ card = l_card;
309293
310− ASSERT(bcmsdh->init_success);
311− ASSERT(cis);
312− ASSERT(length <= SBSDIO_CIS_SIZE_LIMIT);
313−
314− status = sdioh_cis_read(bcmsdh->sdioh, func, cis, length);
294+ status = brcmf_sdioh_cis_read(card->sdioh, func, cis, length);
315295
316296 if (ascii) {
317297 /* Move binary bits to tmp and format them
318298 into the provided buffer. */
319299 tmp_buf = kmalloc(length, GFP_ATOMIC);
320300 if (tmp_buf == NULL) {
321− BCMSDH_ERROR(("%s: out of memory\n", __func__));
301+ BRCMF_SD_ERROR(("%s: out of memory\n", __func__));
322302 return -ENOMEM;
323303 }
324304 memcpy(tmp_buf, cis, length);
@@ -331,60 +311,60 @@ int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length) · 6 unmodified lines
331311 kfree(tmp_buf);
332312 }
333313
334− return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
314+ return status;
335315 }
336316
337−static int bcmsdhsdio_set_sbaddr_window(void *sdh, u32 address)
317+static int
318+brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_card *card, u32 address)
338319 {
339320 int err = 0;
340− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
341− bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
321+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
342322 (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
343323 if (!err)
344− bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID,
345− (address >> 16) & SBSDIO_SBADDRMID_MASK, &err);
324+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
325+ SBSDIO_FUNC1_SBADDRMID,
326+ (address >> 16) & SBSDIO_SBADDRMID_MASK,
327+ &err);
346328 if (!err)
347− bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH,
348− (address >> 24) & SBSDIO_SBADDRHIGH_MASK,
349− &err);
329+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
330+ SBSDIO_FUNC1_SBADDRHIGH,
331+ (address >> 24) & SBSDIO_SBADDRHIGH_MASK,
332+ &err);
350333
351334 return err;
352335 }
353336
354−u32 bcmsdh_reg_read(void *sdh, u32 addr, uint size)
337+u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
355338 {
356− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
357− SDIOH_API_RC status;
339+ int status;
358340 u32 word = 0;
359341 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
360342
361− BCMSDH_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr));
362−
363− if (!bcmsdh)
364− bcmsdh = l_bcmsdh;
343+ BRCMF_SD_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr));
365344
366− ASSERT(bcmsdh->init_success);
345+ if (!card)
346+ card = l_card;
367347
368− if (bar0 != bcmsdh->sbwad) {
369− if (bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0))
348+ if (bar0 != card->sbwad) {
349+ if (brcmf_sdcard_set_sbaddr_window(card, bar0))
370350 return 0xFFFFFFFF;
371351
372− bcmsdh->sbwad = bar0;
352+ card->sbwad = bar0;
373353 }
374354
375355 addr &= SBSDIO_SB_OFT_ADDR_MASK;
376356 if (size == 4)
377357 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
378358
379− status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL,
359+ status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
380360 SDIOH_READ, SDIO_FUNC_1, addr, &word, size);
381361
382− bcmsdh->regfail = !(SDIOH_API_SUCCESS(status));
362+ card->regfail = (status != 0);
383363
384− BCMSDH_INFO(("u32data = 0x%x\n", word));
364+ BRCMF_SD_INFO(("u32data = 0x%x\n", word));
385365
386366 /* if ok, return appropriately masked word */
387− if (SDIOH_API_SUCCESS(status)) {
367+ if (status == 0) {
388368 switch (size) {
389369 case sizeof(u8):
390370 return word & 0xff;
@@ -393,90 +373,86 @@ u32 bcmsdh_reg_read(void *sdh, u32 addr, uint size) · 2 unmodified lines
393373 case sizeof(u32):
394374 return word;
395375 default:
396− bcmsdh->regfail = true;
376+ card->regfail = true;
397377
398378 }
399379 }
400380
401381 /* 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__,
403383 addr, size));
404384 return 0xFFFFFFFF;
405385 }
406386
407−u32 bcmsdh_reg_write(void *sdh, u32 addr, uint size, u32 data)
387+u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
388+ u32 data)
408389 {
409− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
410− SDIOH_API_RC status;
390+ int status;
411391 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
412392 int err = 0;
413393
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",
415395 __func__, addr, size * 8, data));
416396
417− if (!bcmsdh)
418− bcmsdh = l_bcmsdh;
419−
420− ASSERT(bcmsdh->init_success);
397+ if (!card)
398+ card = l_card;
421399
422− if (bar0 != bcmsdh->sbwad) {
423− err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0);
400+ if (bar0 != card->sbwad) {
401+ err = brcmf_sdcard_set_sbaddr_window(card, bar0);
424402 if (err)
425403 return err;
426404
427− bcmsdh->sbwad = bar0;
405+ card->sbwad = bar0;
428406 }
429407
430408 addr &= SBSDIO_SB_OFT_ADDR_MASK;
431409 if (size == 4)
432410 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
433411 status =
434− sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL,
412+ brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
435413 SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size);
436− bcmsdh->regfail = !(SDIOH_API_SUCCESS(status));
414+ card->regfail = (status != 0);
437415
438− if (SDIOH_API_SUCCESS(status))
416+ if (status == 0)
439417 return 0;
440418
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",
442420 __func__, data, addr, size));
443421 return 0xFFFFFFFF;
444422 }
445423
446−bool bcmsdh_regfail(void *sdh)
424+bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card)
447425 {
448− return ((bcmsdh_info_t *) sdh)->regfail;
426+ return card->regfail;
449427 }
450428
451429 int
452−bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags,
453− u8 *buf, uint nbytes, struct sk_buff *pkt,
454− bcmsdh_cmplt_fn_t complete, void *handle)
455−{
456− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
457− SDIOH_API_RC status;
430+brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
431+ uint flags,
432+ u8 *buf, uint nbytes, struct sk_buff *pkt,
433+ void (*complete)(void *handle, int status,
434+ bool sync_waiting),
435+ void *handle)
436+{
437+ int status;
458438 uint incr_fix;
459439 uint width;
460440 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
461441 int err = 0;
462442
463− ASSERT(bcmsdh);
464− ASSERT(bcmsdh->init_success);
465−
466− BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
443+ BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
467444 __func__, fn, addr, nbytes));
468445
469446 /* Async not implemented yet */
470− ASSERT(!(flags & SDIO_REQ_ASYNC));
471447 if (flags & SDIO_REQ_ASYNC)
472448 return -ENOTSUPP;
473449
474− if (bar0 != bcmsdh->sbwad) {
475− err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0);
450+ if (bar0 != card->sbwad) {
451+ err = brcmf_sdcard_set_sbaddr_window(card, bar0);
476452 if (err)
477453 return err;
478454
479− bcmsdh->sbwad = bar0;
455+ card->sbwad = bar0;
480456 }
481457
482458 addr &= SBSDIO_SB_OFT_ADDR_MASK;
@@ -486,42 +462,37 @@ bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags, · 3 unmodified lines
486462 if (width == 4)
487463 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
488464
489− status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix,
490− SDIOH_READ, fn, addr, width, nbytes, buf,
491− pkt);
465+ status = brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO,
466+ incr_fix, SDIOH_READ, fn, addr, width, nbytes, buf, pkt);
492467
493− return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
468+ return status;
494469 }
495470
496471 int
497−bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags,
498− u8 *buf, uint nbytes, void *pkt,
499− bcmsdh_cmplt_fn_t complete, void *handle)
472+brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
473+ uint flags, u8 *buf, uint nbytes, void *pkt,
474+ void (*complete)(void *handle, int status,
475+ bool sync_waiting),
476+ void *handle)
500477 {
501− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
502− SDIOH_API_RC status;
503478 uint incr_fix;
504479 uint width;
505480 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
506481 int err = 0;
507482
508− ASSERT(bcmsdh);
509− ASSERT(bcmsdh->init_success);
510−
511− BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
483+ BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
512484 __func__, fn, addr, nbytes));
513485
514486 /* Async not implemented yet */
515− ASSERT(!(flags & SDIO_REQ_ASYNC));
516487 if (flags & SDIO_REQ_ASYNC)
517488 return -ENOTSUPP;
518489
519− if (bar0 != bcmsdh->sbwad) {
520− err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0);
490+ if (bar0 != card->sbwad) {
491+ err = brcmf_sdcard_set_sbaddr_window(card, bar0);
521492 if (err)
522493 return err;
523494
524− bcmsdh->sbwad = bar0;
495+ card->sbwad = bar0;
525496 }
526497
527498 addr &= SBSDIO_SB_OFT_ADDR_MASK;
@@ -531,101 +502,141 @@ bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags, · 3 unmodified lines
531502 if (width == 4)
532503 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
533504
534− status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix,
535− SDIOH_WRITE, fn, addr, width, nbytes, buf,
536− pkt);
537−
538− return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
505+ return brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO,
506+ incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt);
539507 }
540508
541−int bcmsdh_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, uint nbytes)
509+int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr,
510+ u8 *buf, uint nbytes)
542511 {
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−
550512 addr &= SBSDIO_SB_OFT_ADDR_MASK;
551513 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
552514
553− status =
554− sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, SDIOH_DATA_INC,
555− (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,
556− addr, 4, nbytes, buf, NULL);
557−
558− return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
515+ return brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO,
516+ SDIOH_DATA_INC, (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,
517+ addr, 4, nbytes, buf, NULL);
559518 }
560519
561−int bcmsdh_abort(void *sdh, uint fn)
520+int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn)
562521 {
563− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
564−
565− return sdioh_abort(bcmsdh->sdioh, fn);
522+ return brcmf_sdioh_abort(card->sdioh, fn);
566523 }
567524
568−int bcmsdh_start(void *sdh, int stage)
525+int brcmf_sdcard_query_device(struct brcmf_sdio_card *card)
569526 {
570− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
571−
572− return sdioh_start(bcmsdh->sdioh, stage);
527+ card->vendevid = (PCI_VENDOR_ID_BROADCOM << 16) | 0;
528+ return card->vendevid;
573529 }
574530
575−int bcmsdh_stop(void *sdh)
531+u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card)
576532 {
577− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
533+ if (!card)
534+ card = l_card;
578535
579− return sdioh_stop(bcmsdh->sdioh);
536+ return card->sbwad;
580537 }
581538
582−int bcmsdh_query_device(void *sdh)
539+int brcmf_sdio_probe(struct device *dev)
583540 {
584− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
585− bcmsdh->vendevid = (PCI_VENDOR_ID_BROADCOM << 16) | 0;
586− return bcmsdh->vendevid;
587−}
541+ struct sdio_hc *sdhc = NULL;
542+ u32 regs = 0;
543+ struct brcmf_sdio_card *card = NULL;
544+ int irq = 0;
545+ u32 vendevid;
546+ unsigned long irq_flags = 0;
588547
589−uint bcmsdh_query_iofnum(void *sdh)
590−{
591− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
548+ /* allocate SDIO Host Controller state info */
549+ sdhc = kzalloc(sizeof(struct sdio_hc), GFP_ATOMIC);
550+ if (!sdhc) {
551+ SDLX_MSG(("%s: out of memory\n", __func__));
552+ goto err;
553+ }
554+ sdhc->dev = (void *)dev;
592555
593− if (!bcmsdh)
594− bcmsdh = l_bcmsdh;
556+ card = brcmf_sdcard_attach((void *)0, &regs, irq);
557+ if (!card) {
558+ SDLX_MSG(("%s: attach failed\n", __func__));
559+ goto err;
560+ }
595561
596− return sdioh_query_iofnum(bcmsdh->sdioh);
597−}
562+ sdhc->card = card;
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+ }
598580
599−int bcmsdh_reset(bcmsdh_info_t *sdh)
600−{
601− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
581+ return 0;
602582
603− return sdioh_sdio_reset(bcmsdh->sdioh);
604−}
583+ /* error handling */
584+err:
585+ if (sdhc) {
586+ if (sdhc->card)
587+ brcmf_sdcard_detach(sdhc->card);
588+ kfree(sdhc);
589+ }
605590
606−void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh)
607−{
608− ASSERT(sdh);
609− return sdh->sdioh;
591+ return -ENODEV;
610592 }
611593
612−/* Function to pass device-status bits to DHD. */
613−u32 bcmsdh_get_dstatus(void *sdh)
594+int brcmf_sdio_remove(struct device *dev)
614595 {
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);
615620 return 0;
616621 }
617622
618−u32 bcmsdh_cur_sbwad(void *sdh)
623+int brcmf_sdio_register(struct brcmf_sdioh_driver *driver)
619624 {
620− bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh;
625+ drvinfo = *driver;
621626
622− if (!bcmsdh)
623− bcmsdh = l_bcmsdh;
627+ SDLX_MSG(("Linux Kernel SDIO/MMC Driver\n"));
628+ return brcmf_sdio_function_init();
629+}
624630
625− return bcmsdh->sbwad;
631+void brcmf_sdio_unregister(void)
632+{
633+ brcmf_sdio_function_cleanup();
626634 }
627635
628−void bcmsdh_chipinfo(void *sdh, u32 chip, u32 chiprev)
636+void brcmf_sdio_wdtmr_enable(bool enable)
629637 {
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);
631642 }
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>
34−extern 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− */
52−typedef struct bcmsdh_hc bcmsdh_hc_t;
53−
54−struct 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−};
72−static bcmsdh_hc_t *sdhcinfo;
73−
74−/* driver info, initialized when bcmsdh_register is called */
75−static 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− */
83−bool 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 */
128−int bcmsdh_probe(struct device *dev);
129−EXPORT_SYMBOL(bcmsdh_probe);
130−
131−int bcmsdh_remove(struct device *dev);
132−EXPORT_SYMBOL(bcmsdh_remove);
133−
134−#else
135−/* forward declarations */
136−static int __devinit bcmsdh_probe(struct device *dev);
137−static int __devexit bcmsdh_remove(struct device *dev);
138−#endif /* BCMLXSDMMC */
139−
140−#ifndef BCMLXSDMMC
141−static
142−#endif /* BCMLXSDMMC */
143−int 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 */
224−err:
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
235−static
236−#endif /* BCMLXSDMMC */
237−int 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−
272−extern int sdio_function_init(void);
273−
274−int 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−
282−extern void sdio_function_cleanup(void);
283−
284−void bcmsdh_unregister(void)
285−{
286− sdio_function_cleanup();
287−}
288−
289−#if defined(OOB_INTR_ONLY)
290−void 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−
306−static 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−
324−int 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−
353−void 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−
365−extern uint sd_msglevel; /* Debug message level */
366−module_param(sd_msglevel, uint, 0);
367−
368−extern uint sd_power; /* 0 = SD Power OFF,
369− 1 = SD Power ON. */
370−module_param(sd_power, uint, 0);
371−
372−extern uint sd_clock; /* SD Clock Control, 0 = SD Clock OFF,
373− 1 = SD Clock ON */
374−module_param(sd_clock, uint, 0);
375−
376−extern uint sd_divisor; /* Divisor (-1 means external clock) */
377−module_param(sd_divisor, uint, 0);
378−
379−extern uint sd_sdmode; /* Default is SD4, 0=SPI, 1=SD1, 2=SD4 */
380−module_param(sd_sdmode, uint, 0);
381−
382−extern uint sd_hiok; /* Ok to use hi-speed mode */
383−module_param(sd_hiok, uint, 0);
384−
385−extern uint sd_f2_blocksize;
386−module_param(sd_f2_blocksize, int, 0);
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c+441−484
@@ -15,64 +15,179 @@ · 14 unmodified lines
1515 */
1616 #include <linux/types.h>
1717 #include <linux/netdevice.h>
18−#include <bcmdefs.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−
18+#include <linux/mmc/sdio.h>
2619 #include <linux/mmc/core.h>
2720 #include <linux/mmc/sdio_func.h>
2821 #include <linux/mmc/sdio_ids.h>
22+#include <linux/mmc/card.h>
2923 #include <linux/suspend.h>
24+#include <linux/errno.h>
25+#include <linux/sched.h> /* request_irq() */
26+#include <net/cfg80211.h>
3027
31−#include <dngl_stats.h>
32−#include <dhd.h>
28+#include <defs.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"
3336
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
3541
36−extern int sdio_function_init(void);
37−extern void sdio_function_cleanup(void);
42+/* private bus modes */
43+#define SDIOH_MODE_SD4 2
3844
39−#if !defined(OOB_INTR_ONLY)
40−static void IRQHandler(struct sdio_func *func);
41−static void IRQHandlerF2(struct sdio_func *func);
42−#endif /* !defined(OOB_INTR_ONLY) */
43−static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr);
44−extern int sdio_reset_comm(struct mmc_card *card);
45+#define CLIENT_INTR 0x100 /* Get rid of this! */
4546
46−extern 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) */
4750
48−uint sd_sdmode = SDIOH_MODE_SD4; /* Use SD4 mode by default */
49−uint sd_f2_blocksize = 512; /* Default blocksize */
51+#define SDIO_DEVICE_ID_BROADCOM_DEFAULT 0x0000
52+
53+#define DMA_ALIGN_MASK 0x03
5054
51−uint 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+
118+struct sdos_info {
119+ struct sdioh_info *sd;
120+ spinlock_t lock;
121+};
122+
123+static void brcmf_sdioh_irqhandler(struct sdio_func *func);
124+static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func);
125+static int brcmf_sdioh_get_cisaddr(struct sdioh_info *sd, u32 regaddr);
126+static int brcmf_ops_sdio_probe(struct sdio_func *func,
127+ const struct sdio_device_id *id);
128+static void brcmf_ops_sdio_remove(struct sdio_func *func);
129+
130+#ifdef CONFIG_PM
131+static int brcmf_sdio_suspend(struct device *dev);
132+static int brcmf_sdio_resume(struct device *dev);
133+#endif /* CONFIG_PM */
134+
135+uint sd_f2_blocksize = 512; /* Default blocksize */
52136
53−uint sd_power = 1; /* Default to SD Slot powered ON */
54−uint sd_clock = 1; /* Default to SD Clock turned ON */
55−uint sd_hiok = false; /* Don't use hi-speed mode by default */
56137 uint sd_msglevel = 0x01;
57−uint sd_use_dma = true;
58−DHD_PM_RESUME_WAIT_INIT(sdioh_request_byte_wait);
59−DHD_PM_RESUME_WAIT_INIT(sdioh_request_word_wait);
60−DHD_PM_RESUME_WAIT_INIT(sdioh_request_packet_wait);
61−DHD_PM_RESUME_WAIT_INIT(sdioh_request_buffer_wait);
62138
63−#define DMA_ALIGN_MASK 0x03
139+/* module param defaults */
140+static int clockoverride;
64141
65−int sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, u32 regaddr,
66− int regsize, u32 *data);
142+module_param(clockoverride, int, 0644);
143+MODULE_PARM_DESC(clockoverride, "SDIO card clock override");
67144
68−void sdioh_sdio_set_host_pm_flags(int flag)
69−{
70− if (sdio_set_host_pm_flags(gInstance->func[1], flag))
71− printk(KERN_ERR "%s: Failed to set pm_flags 0x%08x\n",\
72− __func__, (unsigned int)flag);
73−}
145+struct brcmf_sdmmc_instance *gInstance;
146+
147+struct device sdmmc_dev;
148+
149+/* devices we support, null terminated */
150+static 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
161+static 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+
167+static 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+
179+MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);
180+
181+BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_byte_wait);
182+BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_word_wait);
183+BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_packet_wait);
184+BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_buffer_wait);
74185
75−static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd)
186+static int
187+brcmf_sdioh_card_regread(struct sdioh_info *sd, int func, u32 regaddr,
188+ int regsize, u32 *data);
189+
190+static int brcmf_sdioh_enablefuncs(struct sdioh_info *sd)
76191 {
77192 int err_ret;
78193 u32 fbraddr;
@@ -81,16 +196,16 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) · 2 unmodified lines
81196 sd_trace(("%s\n", __func__));
82197
83198 /* 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);
85200 sd->func_cis_ptr[0] = sd->com_cis_ptr;
86201 sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __func__,
87202 sd->com_cis_ptr));
88203
89204 /* 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;
91206 func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) {
92207 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);
94209 sd_info(("%s: Function %d CIS Ptr = 0x%x\n", __func__, func,
95210 sd->func_cis_ptr[func]));
96211 }
@@ -104,8 +219,8 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) · 7 unmodified lines
104219 err_ret = sdio_enable_func(gInstance->func[1]);
105220 sdio_release_host(gInstance->func[1]);
106221 if (err_ret) {
107− sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: 0x%08x",
108− err_ret));
222+ sd_err(("brcmf_sdioh_enablefuncs: Failed to enable F1 "
223+ "Err: 0x%08x\n", err_ret));
109224 }
110225
111226 return false;
@@ -114,9 +229,9 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) · 2 unmodified lines
114229 /*
115230 * Public entry points & extern's
116231 */
117−sdioh_info_t *sdioh_attach(void *bar0, uint irq)
232+struct sdioh_info *brcmf_sdioh_attach(void *bar0, uint irq)
118233 {
119− sdioh_info_t *sd;
234+ struct sdioh_info *sd;
120235 int err_ret;
121236
122237 sd_trace(("%s\n", __func__));
@@ -126,19 +241,18 @@ sdioh_info_t *sdioh_attach(void *bar0, uint irq) · 3 unmodified lines
126241 return NULL;
127242 }
128243
129− sd = kzalloc(sizeof(sdioh_info_t), GFP_ATOMIC);
244+ sd = kzalloc(sizeof(struct sdioh_info), GFP_ATOMIC);
130245 if (sd == NULL) {
131246 sd_err(("sdioh_attach: out of memory\n"));
132247 return NULL;
133248 }
134− if (sdioh_sdmmc_osinit(sd) != 0) {
249+ if (brcmf_sdioh_osinit(sd) != 0) {
135250 sd_err(("%s:sdioh_sdmmc_osinit() failed\n", __func__));
136251 kfree(sd);
137252 return NULL;
138253 }
139254
140255 sd->num_funcs = 2;
141− sd->sd_blockmode = true;
142256 sd->use_client_ints = true;
143257 sd->client_block_size[0] = 64;
144258
@@ -150,7 +264,7 @@ sdioh_info_t *sdioh_attach(void *bar0, uint irq) · 5 unmodified lines
150264 sd->client_block_size[1] = 64;
151265 err_ret = sdio_set_block_size(gInstance->func[1], 64);
152266 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"));
154268
155269 /* Release host controller F1 */
156270 sdio_release_host(gInstance->func[1]);
@@ -163,20 +277,20 @@ sdioh_info_t *sdioh_attach(void *bar0, uint irq) · 6 unmodified lines
163277 err_ret =
164278 sdio_set_block_size(gInstance->func[2], sd_f2_blocksize);
165279 if (err_ret)
166− sd_err(("bcmsdh_sdmmc: Failed to set F2 blocksize "
167− "to %d\n", sd_f2_blocksize));
280+ sd_err(("brcmf_sdioh_attach: Failed to set F2 blocksize"
281+ " to %d\n", sd_f2_blocksize));
168282
169283 /* Release host controller F2 */
170284 sdio_release_host(gInstance->func[2]);
171285 }
172286
173− sdioh_sdmmc_card_enablefuncs(sd);
287+ brcmf_sdioh_enablefuncs(sd);
174288
175289 sd_trace(("%s: Done\n", __func__));
176290 return sd;
177291 }
178292
179−extern SDIOH_API_RC sdioh_detach(sdioh_info_t *sd)
293+extern int brcmf_sdioh_detach(struct sdioh_info *sd)
180294 {
181295 sd_trace(("%s\n", __func__));
182296
@@ -193,92 +307,25 @@ extern SDIOH_API_RC sdioh_detach(sdioh_info_t *sd) · 10 unmodified lines
193307 sdio_release_host(gInstance->func[1]);
194308
195309 /* deregister irq */
196− sdioh_sdmmc_osfree(sd);
310+ brcmf_sdioh_osfree(sd);
197311
198312 kfree(sd);
199313 }
200− return SDIOH_API_RC_SUCCESS;
201−}
202−
203−#if defined(OOB_INTR_ONLY) && defined(HW_OOB)
204−
205−extern 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−
239−extern 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;
314+ return 0;
268315 }
269−#endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */
270316
271317 /* Configure callback to client when we receive client interrupt */
272−extern SDIOH_API_RC
273−sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh)
318+extern int
319+brcmf_sdioh_interrupt_register(struct sdioh_info *sd, void (*fn)(void *),
320+ void *argh)
274321 {
275322 sd_trace(("%s: Entering\n", __func__));
276323 if (fn == NULL) {
277324 sd_err(("%s: interrupt handler is NULL, not registering\n",
278325 __func__));
279− return SDIOH_API_RC_FAIL;
326+ return -EINVAL;
280327 }
281−#if !defined(OOB_INTR_ONLY)
328+
282329 sd->intr_handler = fn;
283330 sd->intr_handler_arg = argh;
284331 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
286333 /* register and unmask irq */
287334 if (gInstance->func[2]) {
288335 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);
290337 sdio_release_host(gInstance->func[2]);
291338 }
292339
293340 if (gInstance->func[1]) {
294341 sdio_claim_host(gInstance->func[1]);
295− sdio_claim_irq(gInstance->func[1], IRQHandler);
342+ sdio_claim_irq(gInstance->func[1], brcmf_sdioh_irqhandler);
296343 sdio_release_host(gInstance->func[1]);
297344 }
298−#elif defined(HW_OOB)
299− sdioh_enable_func_intr();
300−#endif /* defined(OOB_INTR_ONLY) */
301− return SDIOH_API_RC_SUCCESS;
345+
346+ return 0;
302347 }
303348
304−extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *sd)
349+extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *sd)
305350 {
306351 sd_trace(("%s: Entering\n", __func__));
307352
308−#if !defined(OOB_INTR_ONLY)
309353 if (gInstance->func[1]) {
310354 /* register and unmask irq */
311355 sdio_claim_host(gInstance->func[1]);
@@ -324,73 +368,28 @@ extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *sd) · 12 unmodified lines
324368 sd->intr_handler_valid = false;
325369 sd->intr_handler = NULL;
326370 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−
333−extern 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−}
339371
340−#if defined(DHD_DEBUG)
341−extern bool sdioh_interrupt_pending(sdioh_info_t *sd)
342−{
343372 return 0;
344373 }
345−#endif
346−
347−uint sdioh_query_iofnum(sdioh_info_t *sd)
348−{
349− return sd->num_funcs;
350−}
351374
352375 /* IOVar table */
353376 enum {
354377 IOV_MSGLEVEL = 1,
355− IOV_BLOCKMODE,
356378 IOV_BLOCKSIZE,
357− IOV_DMA,
358379 IOV_USEINTS,
359380 IOV_NUMINTS,
360− IOV_NUMLOCALINTS,
361− IOV_HOSTREG,
362381 IOV_DEVREG,
363− IOV_DIVISOR,
364− IOV_SDMODE,
365− IOV_HISPEED,
366382 IOV_HCIREGS,
367− IOV_POWER,
368− IOV_CLOCK,
369383 IOV_RXCHAIN
370384 };
371385
372−const bcm_iovar_t sdioh_iovars[] = {
386+const struct brcmu_iovar sdioh_iovars[] = {
373387 {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0},
374− {"sd_blockmode", IOV_BLOCKMODE, 0, IOVT_BOOL, 0},
375388 {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0},/* ((fn << 16) |
376389 size) */
377− {"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0},
378390 {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0},
379391 {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0},
380− {"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0},
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}
392+ {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)}
394393 ,
395394 {"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0}
396395 ,
@@ -398,33 +397,37 @@ const bcm_iovar_t sdioh_iovars[] = { · 1 unmodified line
398397 };
399398
400399 int
401−sdioh_iovar_op(sdioh_info_t *si, const char *name,
402− void *params, int plen, void *arg, int len, bool set)
400+brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,
401+ void *params, int plen, void *arg, int len, bool set)
403402 {
404− const bcm_iovar_t *vi = NULL;
403+ const struct brcmu_iovar *vi = NULL;
405404 int bcmerror = 0;
406405 int val_size;
407406 s32 int_val = 0;
408407 bool bool_val;
409408 u32 actionid;
410409
411− ASSERT(name);
412− ASSERT(len >= 0);
410+ if (name == NULL || len <= 0)
411+ return -EINVAL;
412+
413+ /* Set does not take qualifiers */
414+ if (set && (params || plen))
415+ return -EINVAL;
413416
414− /* Get must have return space; Set does not take qualifiers */
415− ASSERT(set || (arg && len));
416− ASSERT(!set || (!params && !plen));
417+ /* Get must have return space;*/
418+ if (!set && !(arg && len))
419+ return -EINVAL;
417420
418421 sd_trace(("%s: Enter (%s %s)\n", __func__, (set ? "set" : "get"),
419422 name));
420423
421− vi = bcm_iovar_lookup(sdioh_iovars, name);
424+ vi = brcmu_iovar_lookup(sdioh_iovars, name);
422425 if (vi == NULL) {
423426 bcmerror = -ENOTSUPP;
424427 goto exit;
425428 }
426429
427− bcmerror = bcm_iovar_lencheck(vi, arg, len, set);
430+ bcmerror = brcmu_iovar_lencheck(vi, arg, len, set);
428431 if (bcmerror != 0)
429432 goto exit;
430433
@@ -457,16 +460,6 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 26 unmodified lines
457460 sd_msglevel = int_val;
458461 break;
459462
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−
470463 case IOV_GVAL(IOV_BLOCKSIZE):
471464 if ((u32) int_val > si->num_funcs) {
472465 bcmerror = -EINVAL;
@@ -518,15 +511,6 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 45 unmodified lines
518511 memcpy(arg, &int_val, val_size);
519512 break;
520513
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−
530514 case IOV_GVAL(IOV_USEINTS):
531515 int_val = (s32) si->use_client_ints;
532516 memcpy(arg, &int_val, val_size);
@@ -541,117 +525,18 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 8 unmodified lines
541525
542526 break;
543527
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−
589528 case IOV_GVAL(IOV_NUMINTS):
590529 int_val = (s32) si->intrcount;
591530 memcpy(arg, &int_val, val_size);
592531 break;
593532
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−
649533 case IOV_GVAL(IOV_DEVREG):
650534 {
651− sdreg_t *sd_ptr = (sdreg_t *) params;
535+ struct brcmf_sdreg *sd_ptr =
536+ (struct brcmf_sdreg *) params;
652537 u8 data = 0;
653538
654− if (sdioh_cfg_read
539+ if (brcmf_sdioh_cfg_read
655540 (si, sd_ptr->func, sd_ptr->offset, &data)) {
656541 bcmerror = -EIO;
657542 break;
@@ -664,10 +549,11 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 6 unmodified lines
664549
665550 case IOV_SVAL(IOV_DEVREG):
666551 {
667− sdreg_t *sd_ptr = (sdreg_t *) params;
552+ struct brcmf_sdreg *sd_ptr =
553+ (struct brcmf_sdreg *) params;
668554 u8 data = (u8) sd_ptr->value;
669555
670− if (sdioh_cfg_write
556+ if (brcmf_sdioh_cfg_write
671557 (si, sd_ptr->func, sd_ptr->offset, &data)) {
672558 bcmerror = -EIO;
673559 break;
@@ -684,50 +570,32 @@ exit: · 10 unmodified lines
684570 return bcmerror;
685571 }
686572
687−#if defined(OOB_INTR_ONLY) && defined(HW_OOB)
688−
689−SDIOH_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−
705−extern SDIOH_API_RC
706−sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, u32 addr, u8 *data)
573+extern int
574+brcmf_sdioh_cfg_read(struct sdioh_info *sd, uint fnc_num, u32 addr, u8 *data)
707575 {
708− SDIOH_API_RC status;
709− /* No lock needed since sdioh_request_byte does locking */
710− status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data);
576+ int status;
577+ /* No lock needed since brcmf_sdioh_request_byte does locking */
578+ status = brcmf_sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data);
711579 return status;
712580 }
713581
714−extern SDIOH_API_RC
715−sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, u32 addr, u8 *data)
582+extern int
583+brcmf_sdioh_cfg_write(struct sdioh_info *sd, uint fnc_num, u32 addr, u8 *data)
716584 {
717− /* No lock needed since sdioh_request_byte does locking */
718− SDIOH_API_RC status;
719− status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data);
585+ /* No lock needed since brcmf_sdioh_request_byte does locking */
586+ int status;
587+ status = brcmf_sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data);
720588 return status;
721589 }
722590
723−static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr)
591+static int brcmf_sdioh_get_cisaddr(struct sdioh_info *sd, u32 regaddr)
724592 {
725593 /* read 24 bits and return valid 17 bit addr */
726594 int i;
727595 u32 scratch, regdata;
728596 u8 *ptr = (u8 *)&scratch;
729597 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)) !=
731599 SUCCESS)
732600 sd_err(("%s: Can't read!\n", __func__));
733601
@@ -741,8 +609,8 @@ static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr) · 7 unmodified lines
741609 return scratch;
742610 }
743611
744−extern SDIOH_API_RC
745−sdioh_cis_read(sdioh_info_t *sd, uint func, u8 *cisd, u32 length)
612+extern int
613+brcmf_sdioh_cis_read(struct sdioh_info *sd, uint func, u8 *cisd, u32 length)
746614 {
747615 u32 count;
748616 int offset;
@@ -754,7 +622,7 @@ sdioh_cis_read(sdioh_info_t *sd, uint func, u8 *cisd, u32 length) · 5 unmodified lines
754622 if (!sd->func_cis_ptr[func]) {
755623 memset(cis, 0, length);
756624 sd_err(("%s: no func_cis_ptr[%d]\n", __func__, func));
757− return SDIOH_API_RC_FAIL;
625+ return -ENOTSUPP;
758626 }
759627
760628 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
762630
763631 for (count = 0; count < length; count++) {
764632 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) {
766634 sd_err(("%s: regread failed: Can't read CIS\n",
767635 __func__));
768− return SDIOH_API_RC_FAIL;
636+ return -EIO;
769637 }
770638
771639 *cis = (u8) (foo & 0xff);
772640 cis++;
773641 }
774642
775− return SDIOH_API_RC_SUCCESS;
643+ return 0;
776644 }
777645
778−extern SDIOH_API_RC
779−sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr,
780− u8 *byte)
646+extern int
647+brcmf_sdioh_request_byte(struct sdioh_info *sd, uint rw, uint func,
648+ uint regaddr, u8 *byte)
781649 {
782650 int err_ret;
783651
784652 sd_info(("%s: rw=%d, func=%d, addr=0x%05x\n", __func__, rw, func,
785653 regaddr));
786654
787− DHD_PM_RESUME_WAIT(sdioh_request_byte_wait);
788− DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
655+ BRCMF_PM_RESUME_WAIT(sdioh_request_byte_wait);
656+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
789657 if (rw) { /* CMD52 Write */
790658 if (func == 0) {
791659 /* Can only directly write to some F0 registers.
792660 * Handle F2 enable
793661 * as a special case.
794662 */
795− if (regaddr == SDIOD_CCCR_IOEN) {
663+ if (regaddr == SDIO_CCCR_IOEx) {
796664 if (gInstance->func[2]) {
797665 sdio_claim_host(gInstance->func[2]);
798666 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
801669 sdio_enable_func
802670 (gInstance->func[2]);
803671 if (err_ret)
804− sd_err(("bcmsdh_sdmmc: enable F2 failed:%d",
672+ sd_err(("request_byte: "
673+ "enable F2 "
674+ "failed:%d\n",
805675 err_ret));
806676 } else {
807677 /* Disable Function 2 */
@@ -809,15 +679,16 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, · 1 unmodified line
809679 sdio_disable_func
810680 (gInstance->func[2]);
811681 if (err_ret)
812− sd_err(("bcmsdh_sdmmc: Disab F2 failed:%d",
682+ sd_err(("request_byte: "
683+ "Disab F2 "
684+ "failed:%d\n",
813685 err_ret));
814686 }
815687 sdio_release_host(gInstance->func[2]);
816688 }
817689 }
818−#if defined(MMC_SDIO_ABORT)
819690 /* to allow abort command through F1 */
820− else if (regaddr == SDIOD_CCCR_IOABORT) {
691+ else if (regaddr == SDIO_CCCR_ABORT) {
821692 sdio_claim_host(gInstance->func[func]);
822693 /*
823694 * 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
828699 sdio_writeb(gInstance->func[func], *byte,
829700 regaddr, &err_ret);
830701 sdio_release_host(gInstance->func[func]);
831− }
832−#endif /* MMC_SDIO_ABORT */
833− else if (regaddr < 0xF0) {
834− sd_err(("bcmsdh_sdmmc: F0 Wr:0x%02x: write "
702+ } else if (regaddr < 0xF0) {
703+ sd_err(("brcmf: F0 Wr:0x%02x: write "
835704 "disallowed\n", regaddr));
836705 } else {
837706 /* 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
867736 }
868737
869738 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, "
871740 "Err: %d\n", rw ? "Write" : "Read", func, regaddr,
872741 *byte, err_ret));
873742
874− return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
743+ return err_ret;
875744 }
876745
877−extern SDIOH_API_RC
878−sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func,
879− uint addr, u32 *word, uint nbytes)
746+extern int
747+brcmf_sdioh_request_word(struct sdioh_info *sd, uint cmd_type, uint rw,
748+ uint func, uint addr, u32 *word, uint nbytes)
880749 {
881− int err_ret = SDIOH_API_RC_FAIL;
750+ int err_ret = -EIO;
882751
883752 if (func == 0) {
884753 sd_err(("%s: Only CMD52 allowed to F0.\n", __func__));
885− return SDIOH_API_RC_FAIL;
754+ return -EINVAL;
886755 }
887756
888757 sd_info(("%s: cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
889758 __func__, cmd_type, rw, func, addr, nbytes));
890759
891− DHD_PM_RESUME_WAIT(sdioh_request_word_wait);
892− DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
760+ BRCMF_PM_RESUME_WAIT(sdioh_request_word_wait);
761+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
893762 /* Claim host controller */
894763 sdio_claim_host(gInstance->func[func]);
895764
@@ -920,16 +789,16 @@ sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, · 24 unmodified lines
920789 sdio_release_host(gInstance->func[func]);
921790
922791 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",
924793 rw ? "Write" : "Read", err_ret));
925794 }
926795
927− return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
796+ return err_ret;
928797 }
929798
930−static SDIOH_API_RC
931−sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
932− uint addr, struct sk_buff *pkt)
799+static int
800+brcmf_sdioh_request_packet(struct sdioh_info *sd, uint fix_inc, uint write,
801+ uint func, uint addr, struct sk_buff *pkt)
933802 {
934803 bool fifo = (fix_inc == SDIOH_DATA_FIX);
935804 u32 SGCount = 0;
@@ -939,9 +808,8 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 3 unmodified lines
939808
940809 sd_trace(("%s: Enter\n", __func__));
941810
942− ASSERT(pkt);
943− DHD_PM_RESUME_WAIT(sdioh_request_packet_wait);
944− DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
811+ BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait);
812+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
945813
946814 /* Claim host controller */
947815 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
950818 pkt_len += 3;
951819 pkt_len &= 0xFFFFFFFC;
952820
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−
968821 if ((write) && (!fifo)) {
969822 err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
970823 ((u8 *) (pnext->data)),
@@ -1005,7 +858,7 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 34 unmodified lines
1005858 sdio_release_host(gInstance->func[func]);
1006859
1007860 sd_trace(("%s: Exit\n", __func__));
1008− return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
861+ return err_ret;
1009862 }
1010863
1011864 /*
@@ -1023,114 +876,101 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 11 unmodified lines
1023876 * aligned packet.
1024877 *
1025878 */
1026−extern SDIOH_API_RC
1027−sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
1028− uint func, uint addr, uint reg_width, uint buflen_u,
1029− u8 *buffer, struct sk_buff *pkt)
879+extern int
880+brcmf_sdioh_request_buffer(struct sdioh_info *sd, uint pio_dma, uint fix_inc,
881+ uint write, uint func, uint addr, uint reg_width,
882+ uint buflen_u, u8 *buffer, struct sk_buff *pkt)
1030883 {
1031− SDIOH_API_RC Status;
884+ int Status;
1032885 struct sk_buff *mypkt = NULL;
1033886
1034887 sd_trace(("%s: Enter\n", __func__));
1035888
1036− DHD_PM_RESUME_WAIT(sdioh_request_buffer_wait);
1037− DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
889+ BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait);
890+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
1038891 /* Case 1: we don't have a packet. */
1039892 if (pkt == NULL) {
1040893 sd_data(("%s: Creating new %s Packet, len=%d\n",
1041894 __func__, write ? "TX" : "RX", buflen_u));
1042− mypkt = bcm_pkt_buf_get_skb(buflen_u);
895+ mypkt = brcmu_pkt_buf_get_skb(buflen_u);
1043896 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",
1045898 __func__, buflen_u));
1046− return SDIOH_API_RC_FAIL;
899+ return -EIO;
1047900 }
1048901
1049902 /* For a write, copy the buffer data into the packet. */
1050903 if (write)
1051904 memcpy(mypkt->data, buffer, buflen_u);
1052905
1053− Status =
1054− sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
906+ Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func,
907+ addr, mypkt);
1055908
1056909 /* For a read, copy the packet data back to the buffer. */
1057910 if (!write)
1058911 memcpy(buffer, mypkt->data, buflen_u);
1059912
1060− bcm_pkt_buf_free_skb(mypkt);
1061− } else if (((u32) (pkt->data) & DMA_ALIGN_MASK) != 0) {
1062− /* Case 2: We have a packet, but it is unaligned. */
1063−
1064− /* In this case, we cannot have a chain. */
1065− ASSERT(pkt->next == NULL);
1066−
913+ brcmu_pkt_buf_free_skb(mypkt);
914+ } else if (((ulong) (pkt->data) & DMA_ALIGN_MASK) != 0) {
915+ /*
916+ * Case 2: We have a packet, but it is unaligned.
917+ * In this case, we cannot have a chain (pkt->next == NULL)
918+ */
1067919 sd_data(("%s: Creating aligned %s Packet, len=%d\n",
1068920 __func__, write ? "TX" : "RX", pkt->len));
1069− mypkt = bcm_pkt_buf_get_skb(pkt->len);
921+ mypkt = brcmu_pkt_buf_get_skb(pkt->len);
1070922 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",
1072924 __func__, pkt->len));
1073− return SDIOH_API_RC_FAIL;
925+ return -EIO;
1074926 }
1075927
1076928 /* For a write, copy the buffer data into the packet. */
1077929 if (write)
1078930 memcpy(mypkt->data, pkt->data, pkt->len);
1079931
1080− Status =
1081− sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
932+ Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func,
933+ addr, mypkt);
1082934
1083935 /* For a read, copy the packet data back to the buffer. */
1084936 if (!write)
1085937 memcpy(pkt->data, mypkt->data, mypkt->len);
1086938
1087− bcm_pkt_buf_free_skb(mypkt);
939+ brcmu_pkt_buf_free_skb(mypkt);
1088940 } else { /* case 3: We have a packet and
1089941 it is aligned. */
1090942 sd_data(("%s: Aligned %s Packet, direct DMA\n",
1091943 __func__, write ? "Tx" : "Rx"));
1092− Status =
1093− sdioh_request_packet(sd, fix_inc, write, func, addr, pkt);
944+ Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func,
945+ addr, pkt);
1094946 }
1095947
1096948 return Status;
1097949 }
1098950
1099951 /* this function performs "abort" for both of host & device */
1100−extern int sdioh_abort(sdioh_info_t *sd, uint func)
952+extern int brcmf_sdioh_abort(struct sdioh_info *sd, uint func)
1101953 {
1102−#if defined(MMC_SDIO_ABORT)
1103954 char t_func = (char)func;
1104−#endif /* defined(MMC_SDIO_ABORT) */
1105955 sd_trace(("%s: Enter\n", __func__));
1106956
1107−#if defined(MMC_SDIO_ABORT)
1108− /* issue abort cmd52 command through F1 */
1109− sdioh_request_byte(sd, SD_IO_OP_WRITE, SDIO_FUNC_0, SDIOD_CCCR_IOABORT,
957+ /* issue abort cmd52 command through F0 */
958+ brcmf_sdioh_request_byte(sd, SDIOH_WRITE, SDIO_FUNC_0, SDIO_CCCR_ABORT,
1110959 &t_func);
1111−#endif /* defined(MMC_SDIO_ABORT) */
1112−
1113− sd_trace(("%s: Exit\n", __func__));
1114− return SDIOH_API_RC_SUCCESS;
1115−}
1116960
1117−/* Reset and re-initialize the device */
1118−int sdioh_sdio_reset(sdioh_info_t *si)
1119−{
1120− sd_trace(("%s: Enter\n", __func__));
1121961 sd_trace(("%s: Exit\n", __func__));
1122− return SDIOH_API_RC_SUCCESS;
962+ return 0;
1123963 }
1124964
1125965 /* Disable device interrupt */
1126−void sdioh_sdmmc_devintr_off(sdioh_info_t *sd)
966+void brcmf_sdioh_dev_intr_off(struct sdioh_info *sd)
1127967 {
1128968 sd_trace(("%s: %d\n", __func__, sd->use_client_ints));
1129969 sd->intmask &= ~CLIENT_INTR;
1130970 }
1131971
1132972 /* Enable device interrupt */
1133−void sdioh_sdmmc_devintr_on(sdioh_info_t *sd)
973+void brcmf_sdioh_dev_intr_on(struct sdioh_info *sd)
1134974 {
1135975 sd_trace(("%s: %d\n", __func__, sd->use_client_ints));
1136976 sd->intmask |= CLIENT_INTR;
@@ -1138,19 +978,19 @@ void sdioh_sdmmc_devintr_on(sdioh_info_t *sd) · 1 unmodified line
1138978
1139979 /* Read client card reg */
1140980 int
1141−sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, u32 regaddr,
981+brcmf_sdioh_card_regread(struct sdioh_info *sd, int func, u32 regaddr,
1142982 int regsize, u32 *data)
1143983 {
1144984
1145985 if ((func == 0) || (regsize == 1)) {
1146986 u8 temp = 0;
1147987
1148− sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp);
988+ brcmf_sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp);
1149989 *data = temp;
1150990 *data &= 0xff;
1151991 sd_data(("%s: byte read data=0x%02x\n", __func__, *data));
1152992 } else {
1153− sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, data,
993+ brcmf_sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, data,
1154994 regsize);
1155995 if (regsize == 2)
1156996 *data &= 0xffff;
@@ -1161,25 +1001,20 @@ sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, u32 regaddr, · 4 unmodified lines
11611001 return SUCCESS;
11621002 }
11631003
1164−#if !defined(OOB_INTR_ONLY)
1165−/* bcmsdh_sdmmc interrupt handler */
1166−static void IRQHandler(struct sdio_func *func)
1004+static void brcmf_sdioh_irqhandler(struct sdio_func *func)
11671005 {
1168− sdioh_info_t *sd;
1006+ struct sdioh_info *sd;
11691007
1170− sd_trace(("bcmsdh_sdmmc: ***IRQHandler\n"));
1008+ sd_trace(("brcmf: ***IRQHandler\n"));
11711009 sd = gInstance->sd;
11721010
1173− ASSERT(sd != NULL);
11741011 sdio_release_host(gInstance->func[0]);
11751012
11761013 if (sd->use_client_ints) {
11771014 sd->intrcount++;
1178− ASSERT(sd->intr_handler);
1179− ASSERT(sd->intr_handler_arg);
11801015 (sd->intr_handler) (sd->intr_handler_arg);
11811016 } else {
1182− sd_err(("bcmsdh_sdmmc: ***IRQHandler\n"));
1017+ sd_err(("brcmf: ***IRQHandler\n"));
11831018
11841019 sd_err(("%s: Not ready for intr: enabled %d, handler %p\n",
11851020 __func__, sd->client_intr_enabled, sd->intr_handler));
@@ -1188,52 +1023,174 @@ static void IRQHandler(struct sdio_func *func) · 2 unmodified lines
11881023 sdio_claim_host(gInstance->func[0]);
11891024 }
11901025
1191−/* bcmsdh_sdmmc interrupt handler for F2 (dummy handler) */
1192−static void IRQHandlerF2(struct sdio_func *func)
1026+/* interrupt handler for F2 (dummy handler) */
1027+static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func)
11931028 {
1194− sdioh_info_t *sd;
1029+ struct sdioh_info *sd;
11951030
1196− sd_trace(("bcmsdh_sdmmc: ***IRQHandlerF2\n"));
1031+ sd_trace(("brcmf: ***IRQHandlerF2\n"));
11971032
11981033 sd = gInstance->sd;
1034+}
1035+
1036+static 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+ }
11991057
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;
12011067 }
1202−#endif /* !defined(OOB_INTR_ONLY) */
12031068
1204−#ifdef NOTUSED
1205−/* Write client card reg */
1206−static int
1207−sdioh_sdmmc_card_regwrite(sdioh_info_t *sd, int func, u32 regaddr,
1208− int regsize, u32 data)
1069+static void brcmf_ops_sdio_remove(struct sdio_func *func)
12091070 {
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+}
12101082
1211− if ((func == 0) || (regsize == 1)) {
1212− u8 temp;
12131083
1214− temp = data & 0xff;
1215− sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp);
1216− sd_data(("%s: byte write data=0x%02x\n", __func__, data));
1217− } else {
1218− if (regsize == 2)
1219− data &= 0xffff;
1084+#ifdef CONFIG_PM
1085+static int brcmf_sdio_suspend(struct device *dev)
1086+{
1087+ mmc_pm_flag_t sdio_flags;
1088+ int ret = 0;
12201089
1221− sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, &data,
1222− regsize);
1090+ sd_trace(("%s\n", __func__));
12231091
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;
12251096 }
12261097
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+
1109+static int brcmf_sdio_resume(struct device *dev)
1110+{
1111+ brcmf_sdio_wdtmr_enable(true);
1112+ return 0;
12281113 }
1229−#endif /* NOTUSED */
1114+#endif /* CONFIG_PM */
12301115
1231−int sdioh_start(sdioh_info_t *si, int stage)
1116+int brcmf_sdioh_osinit(struct sdioh_info *sd)
12321117 {
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);
12331127 return 0;
12341128 }
12351129
1236−int sdioh_stop(sdioh_info_t *si)
1130+void 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 */
1139+int brcmf_sdioh_interrupt_set(struct sdioh_info *sd, bool enable)
12371140 {
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+
12381165 return 0;
12391166 }
1167+
1168+/*
1169+ * module init
1170+*/
1171+int 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+*/
1189+void 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 */
61−extern int sdioh_sdmmc_osinit(sdioh_info_t *sd);
62−extern 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−
77−struct 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 */
107−extern uint sd_msglevel;
108−
109−/* OS-independent interrupt handler */
110−extern bool check_client_intr(sdioh_info_t *sd);
111−
112−/* Core interrupt enable/disable of device interrupts */
113−extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd);
114−extern 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 */
121−extern u32 *sdioh_sdmmc_reg_map(s32 addr, int size);
122−extern void sdioh_sdmmc_reg_unmap(s32 addr, int size);
123−
124−/* Interrupt (de)registration routines */
125−extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq);
126−extern void sdioh_sdmmc_free_irq(uint irq, sdioh_info_t *sd);
127−
128−typedef 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−
57−extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd);
58−extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd);
59−
60−int sdio_function_init(void);
61−void sdio_function_cleanup(void);
62−
63−/* module param defaults */
64−static int clockoverride;
65−
66−module_param(clockoverride, int, 0644);
67−MODULE_PARM_DESC(clockoverride, "SDIO card clock override");
68−
69−PBCMSDH_SDMMC_INSTANCE gInstance;
70−
71−/* Maximum number of bcmsdh_sdmmc devices supported by driver */
72−#define BCMSDH_SDMMC_MAX_DEVICES 1
73−
74−extern int bcmsdh_probe(struct device *dev);
75−extern int bcmsdh_remove(struct device *dev);
76−struct device sdmmc_dev;
77−
78−static 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−
111−static 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 */
126−static 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−
136−MODULE_DEVICE_TABLE(sdio, bcmsdh_sdmmc_ids);
137−
138−static 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−
145−struct sdos_info {
146− sdioh_info_t *sd;
147− spinlock_t lock;
148−};
149−
150−int 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−
164−void 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 */
174−SDIOH_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−*/
209−int 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−*/
227−extern int bcmsdh_remove(struct device *dev);
228−void 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
1818 * Common types *
1919 */
2020
21−#ifndef _dhd_h_
22−#define _dhd_h_
23−
24−#include <linux/sched.h>
25−#include <linux/init.h>
26−#include <linux/kernel.h>
27−#include <linux/slab.h>
28−#include <linux/skbuff.h>
29−#include <linux/netdevice.h>
30−#include <linux/etherdevice.h>
31−#include <linux/random.h>
32−#include <linux/spinlock.h>
33−#include <linux/ethtool.h>
34−#include <linux/suspend.h>
35−#include <asm/uaccess.h>
36−#include <asm/unaligned.h>
37−/* The kernel threading is sdio-specific */
38−
39−#include <wlioctl.h>
40−
41−/* Forward decls */
42−struct dhd_bus;
43−struct dhd_prot;
44−struct dhd_info;
21+#ifndef _BRCMF_H_
22+#define _BRCMF_H_
23+
24+#define BRCMF_VERSION_STR "4.218.248.5"
25+
26+#define BRCMF_C_IOCTL_SMLEN 256 /* "small" ioctl buffer required */
27+#define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */
28+#define BRCMF_C_IOCTL_MAXLEN 8192
29+
30+#define BRCMF_C_UP 2
31+#define BRCMF_C_SET_PROMISC 10
32+#define BRCMF_C_GET_RATE 12
33+#define BRCMF_C_GET_INFRA 19
34+#define BRCMF_C_SET_INFRA 20
35+#define BRCMF_C_GET_AUTH 21
36+#define BRCMF_C_SET_AUTH 22
37+#define BRCMF_C_GET_BSSID 23
38+#define BRCMF_C_GET_SSID 25
39+#define BRCMF_C_SET_SSID 26
40+#define BRCMF_C_GET_CHANNEL 29
41+#define BRCMF_C_GET_SRL 31
42+#define BRCMF_C_GET_LRL 33
43+#define BRCMF_C_GET_RADIO 37
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+
138+struct 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+
150+struct brcm_ethhdr {
151+ u16 subtype;
152+ u16 length;
153+ u8 version;
154+ u8 oui[3];
155+ u16 usr_subtype;
156+} __packed;
157+
158+struct brcmf_event {
159+ struct ethhdr eth;
160+ struct brcm_ethhdr hdr;
161+ struct brcmf_event_msg msg;
162+} __packed;
163+
164+struct 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
45323
46324 /* The level of bus communication with the dongle */
47−enum dhd_bus_state {
48− DHD_BUS_DOWN, /* Not ready for frame transfers */
49− DHD_BUS_LOAD, /* Download access only (CPU reset) */
50− DHD_BUS_DATA /* Ready for frame transfers */
325+enum brcmf_bus_state {
326+ BRCMF_BUS_DOWN, /* Not ready for frame transfers */
327+ BRCMF_BUS_LOAD, /* Download access only (CPU reset) */
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+ */
335+struct 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. */
346+struct 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. */
356+struct 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+ */
365+struct 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+
400+struct brcmf_ssid {
401+ u32 SSID_len;
402+ unsigned char SSID[32];
403+};
404+
405+struct 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 */
442+struct 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+
454+struct 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 */
462+struct 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 */
473+struct 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 */
483+struct 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+
493+struct 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 */
514+struct brcmf_scb_val {
515+ u32 val;
516+ u8 ea[ETH_ALEN];
517+};
518+
519+/* channel encoding */
520+struct brcmf_channel_info {
521+ int hw_channel;
522+ int target_channel;
523+ int scan_channel;
51524 };
52525
526+/* Linux network driver ioctl encoding */
527+struct 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) */
537+struct brcmf_bus; /* device bus info */
538+struct brcmf_proto; /* device communication protocol info */
539+struct brcmf_info; /* device driver info */
540+
53541 /* Common structure for module and instance linkage */
54−typedef struct dhd_pub {
542+struct brcmf_pub {
55543 /* Linkage ponters */
56− struct dhd_bus *bus; /* Bus module handle */
57− struct dhd_prot *prot; /* Protocol module handle */
58− struct dhd_info *info; /* Info module handle */
544+ struct brcmf_bus *bus;
545+ struct brcmf_proto *prot;
546+ struct brcmf_info *info;
59547
60− /* Internal dhd items */
548+ /* Internal brcmf items */
61549 bool up; /* Driver up/down (to OS) */
62550 bool txoff; /* Transmit flow-controlled */
63551 bool dongle_reset; /* true = DEVRESET put dongle into reset */
64− enum dhd_bus_state busstate;
65− uint hdrlen; /* Total DHD header length (proto + bus) */
552+ enum brcmf_bus_state busstate;
553+ uint hdrlen; /* Total BRCMF header length (proto + bus) */
66554 uint maxctl; /* Max size rxctl request from proto to bus */
67555 uint rxsz; /* Rx buffer size bus module should use */
68556 u8 wme_dp; /* wme discard priority */
@@ -71,7 +559,7 @@ typedef struct dhd_pub { · 2 unmodified lines
71559 bool iswl; /* Dongle-resident driver is wl */
72560 unsigned long drv_version; /* Version of dongle-resident driver */
73561 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 */
75563
76564 /* Additional stats for the bus level */
77565 unsigned long tx_packets; /* Data packets sent to dongle */
@@ -88,7 +576,7 @@ typedef struct dhd_pub { · 10 unmodified lines
88576 unsigned long rx_dropped; /* Packets dropped locally (no memory) */
89577 unsigned long rx_flushed; /* Packets flushed due to
90578 unscheduled sendup thread */
91− unsigned long wd_dpc_sched; /* Number of times dhd dpc scheduled by
579+ unsigned long wd_dpc_sched; /* Number of times dpc scheduled by
92580 watchdog timer */
93581
94582 unsigned long rx_readahead_cnt; /* Number of packets where header read-ahead
@@ -108,40 +596,51 @@ typedef struct dhd_pub { · 13 unmodified lines
108596 int suspend_disable_flag; /* "1" to disable all extra powersaving
109597 during suspend */
110598 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 */
114599 int dtim_skip; /* dtim skip , default 0 means wake each dtim */
115600
116601 /* Pkt filter defination */
117602 char *pktfilter[100];
118603 int pktfilter_count;
119604
120− u8 country_code[WLC_CNTRY_BUF_SZ];
121− char eventmask[WL_EVENTING_MASK_LEN];
605+ u8 country_code[BRCM_CNTRY_BUF_SZ];
606+ char eventmask[BRCMF_EVENTING_MASK_LEN];
607+
608+};
609+
610+struct brcmf_if_event {
611+ u8 ifidx;
612+ u8 action;
613+ u8 flags;
614+ u8 bssidx;
615+};
616+
617+struct 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+};
122623
123−} dhd_pub_t;
624+struct bcmevent_name {
625+ uint event;
626+ const char *name;
627+};
124628
125629 #if defined(CONFIG_PM_SLEEP)
126−extern atomic_t dhd_mmc_suspend;
127−#define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
128−#define _DHD_PM_RESUME_WAIT(a, b) do { \
630+extern atomic_t brcmf_mmc_suspend;
631+#define BRCMF_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
632+#define _BRCMF_PM_RESUME_WAIT(a, b) do { \
129633 int retry = 0; \
130− while (atomic_read(&dhd_mmc_suspend) && retry++ != b) { \
634+ while (atomic_read(&brcmf_mmc_suspend) && retry++ != b) { \
131635 wait_event_timeout(a, false, HZ/100); \
132636 } \
133637 } while (0)
134−#define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 30)
135−#define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0)
136−#define DHD_PM_RESUME_RETURN_ERROR(a) \
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)
638+#define BRCMF_PM_RESUME_WAIT(a) _BRCMF_PM_RESUME_WAIT(a, 30)
639+#define BRCMF_PM_RESUME_RETURN_ERROR(a) \
640+ do { if (atomic_read(&brcmf_mmc_suspend)) return a; } while (0)
142641
143−#define DHD_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
144−#define SPINWAIT_SLEEP(a, exp, us) do { \
642+#define BRCMF_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
643+#define BRCMF_SPINWAIT_SLEEP(a, exp, us) do { \
145644 uint countdown = (us) + 9999; \
146645 while ((exp) && (countdown >= 10000)) { \
147646 wait_event_timeout(a, false, HZ/100); \
@@ -151,14 +650,12 @@ extern atomic_t dhd_mmc_suspend; · 3 unmodified lines
151650
152651 #else
153652
154−#define DHD_PM_RESUME_WAIT_INIT(a)
155−#define DHD_PM_RESUME_WAIT(a)
156−#define DHD_PM_RESUME_WAIT_FOREVER(a)
157−#define DHD_PM_RESUME_RETURN_ERROR(a)
158−#define DHD_PM_RESUME_RETURN
653+#define BRCMF_PM_RESUME_WAIT_INIT(a)
654+#define BRCMF_PM_RESUME_WAIT(a)
655+#define BRCMF_PM_RESUME_RETURN_ERROR(a)
159656
160−#define DHD_SPINWAIT_SLEEP_INIT(a)
161−#define SPINWAIT_SLEEP(a, exp, us) do { \
657+#define BRCMF_SPINWAIT_SLEEP_INIT(a)
658+#define BRCMF_SPINWAIT_SLEEP(a, exp, us) do { \
162659 uint countdown = (us) + 9; \
163660 while ((exp) && (countdown >= 10)) { \
164661 udelay(10); \
@@ -167,29 +664,82 @@ extern atomic_t dhd_mmc_suspend; · 2 unmodified lines
167664 } while (0)
168665
169666 #endif /* defined(CONFIG_PM_SLEEP) */
170−#define DHD_IF_VIF 0x01 /* Virtual IF (Hidden from user) */
171667
172−static inline void MUTEX_LOCK_INIT(dhd_pub_t *dhdp)
668+/*
669+ * Insmod parameters for debug/test
670+ */
671+
672+/* Use interrupts */
673+extern uint brcmf_intr;
674+
675+/* Use polling */
676+extern uint brcmf_poll;
677+
678+/* ARP offload agent mode */
679+extern uint brcmf_arp_mode;
680+
681+/* ARP offload enable */
682+extern uint brcmf_arp_enable;
683+
684+/* Pkt filte enable control */
685+extern uint brcmf_pkt_filter_enable;
686+
687+/* Pkt filter init setup */
688+extern uint brcmf_pkt_filter_init;
689+
690+/* Pkt filter mode control */
691+extern uint brcmf_master_mode;
692+
693+/* Roaming mode control */
694+extern uint brcmf_roam;
695+
696+/* Roaming mode control */
697+extern uint brcmf_radio_up;
698+
699+/* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */
700+extern int brcmf_idletime;
701+#define BRCMF_IDLETIME_TICKS 1
702+
703+/* SDIO Drive Strength */
704+extern uint brcmf_sdiod_drive_strength;
705+
706+/* Override to force tx queueing all the time */
707+extern uint brcmf_force_tx_queueing;
708+
709+#ifdef SDTEST
710+/* Echo packet generator (SDIO), pkts/s */
711+extern uint brcmf_pktgen;
712+
713+/* Echo packet len (0 => sawtooth, max 1800) */
714+extern uint brcmf_pktgen_len;
715+#define BRCMF_MAX_PKTGEN_LEN 1800
716+#endif
717+
718+extern const struct bcmevent_name bcmevent_names[];
719+extern const int bcmevent_names_size;
720+
721+
722+static inline void MUTEX_LOCK_INIT(struct brcmf_pub *drvr)
173723 {
174724 }
175725
176−static inline void MUTEX_LOCK(dhd_pub_t *dhdp)
726+static inline void MUTEX_LOCK(struct brcmf_pub *drvr)
177727 {
178728 }
179729
180−static inline void MUTEX_UNLOCK(dhd_pub_t *dhdp)
730+static inline void MUTEX_UNLOCK(struct brcmf_pub *drvr)
181731 {
182732 }
183733
184−static inline void MUTEX_LOCK_SOFTAP_SET_INIT(dhd_pub_t *dhdp)
734+static inline void MUTEX_LOCK_SOFTAP_SET_INIT(struct brcmf_pub *drvr)
185735 {
186736 }
187737
188−static inline void MUTEX_LOCK_SOFTAP_SET(dhd_pub_t *dhdp)
738+static inline void MUTEX_LOCK_SOFTAP_SET(struct brcmf_pub *drvr)
189739 {
190740 }
191741
192−static inline void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t *dhdp)
742+static inline void MUTEX_UNLOCK_SOFTAP_SET(struct brcmf_pub *drvr)
193743 {
194744 }
195745
@@ -205,210 +755,150 @@ static inline void MUTEX_UNLOCK_WL_SCAN_SET(void) · 9 unmodified lines
205755 {
206756 }
207757
208−typedef 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−
219758 /* 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.
221760 * Returned structure should have bus and prot pointers filled in.
222761 * bus_hdrlen specifies required headroom for bus module header.
223762 */
224−extern dhd_pub_t *dhd_attach(struct dhd_bus *bus,
225− uint bus_hdrlen);
226−extern int dhd_net_attach(dhd_pub_t *dhdp, int idx);
763+extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus,
764+ uint bus_hdrlen);
765+extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx);
766+extern int brcmf_netdev_wait_pend8021x(struct net_device *dev);
227767
228768 /* Indication from bus module regarding removal/absence of dongle */
229−extern void dhd_detach(dhd_pub_t *dhdp);
769+extern void brcmf_detach(struct brcmf_pub *drvr);
230770
231771 /* Indication from bus module to change flow-control state */
232−extern void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on);
772+extern void brcmf_txflowcontrol(struct brcmf_pub *drvr, int ifidx, bool on);
233773
234−extern bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q,
774+extern bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q,
235775 struct sk_buff *pkt, int prec);
236776
237777 /* Receive frame for delivery to OS. Callee disposes of rxp. */
238−extern void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx,
778+extern void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx,
239779 struct sk_buff *rxp, int numpkt);
240780
241781 /* Return pointer to interface name */
242−extern char *dhd_ifname(dhd_pub_t *dhdp, int idx);
243−
244−/* Request scheduling of the bus dpc */
245−extern void dhd_sched_dpc(dhd_pub_t *dhdp);
782+extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
246783
247784 /* Notify tx completion */
248−extern void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success);
785+extern void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp,
786+ bool success);
249787
250788 /* Query ioctl */
251−extern int dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
252− uint len);
789+extern int brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx,
790+ uint cmd, void *buf, uint len);
253791
254792 /* OS independent layer functions */
255−extern int dhd_os_proto_block(dhd_pub_t *pub);
256−extern int dhd_os_proto_unblock(dhd_pub_t *pub);
257−extern int dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition,
793+extern int brcmf_os_proto_block(struct brcmf_pub *drvr);
794+extern int brcmf_os_proto_unblock(struct brcmf_pub *drvr);
795+extern int brcmf_os_ioctl_resp_wait(struct brcmf_pub *drvr, uint *condition,
258796 bool *pending);
259−extern int dhd_os_ioctl_resp_wake(dhd_pub_t *pub);
260−extern unsigned int dhd_os_get_ioctl_resp_timeout(void);
261−extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec);
262−extern void *dhd_os_open_image(char *filename);
263−extern int dhd_os_get_image_block(char *buf, int len, void *image);
264−extern void dhd_os_close_image(void *image);
265−extern void dhd_os_wd_timer(void *bus, uint wdtick);
266−extern void dhd_os_sdlock(dhd_pub_t *pub);
267−extern void dhd_os_sdunlock(dhd_pub_t *pub);
268−extern void dhd_os_sdlock_txq(dhd_pub_t *pub);
269−extern void dhd_os_sdunlock_txq(dhd_pub_t *pub);
270−extern void dhd_os_sdlock_rxq(dhd_pub_t *pub);
271−extern void dhd_os_sdunlock_rxq(dhd_pub_t *pub);
272−extern void dhd_os_sdlock_sndup_rxq(dhd_pub_t *pub);
273−extern void dhd_customer_gpio_wlan_ctrl(int onoff);
274−extern int dhd_custom_get_mac_address(unsigned char *buf);
275−extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t *pub);
276−extern void dhd_os_sdlock_eventq(dhd_pub_t *pub);
277−extern void dhd_os_sdunlock_eventq(dhd_pub_t *pub);
278−#ifdef DHD_DEBUG
279−extern int write_to_file(dhd_pub_t *dhd, u8 *buf, int size);
280−#endif /* DHD_DEBUG */
281−#if defined(OOB_INTR_ONLY)
282−extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr);
283−#endif /* defined(OOB_INTR_ONLY) */
284−extern void dhd_os_sdtxlock(dhd_pub_t *pub);
285−extern void dhd_os_sdtxunlock(dhd_pub_t *pub);
286−
287−int setScheduler(struct task_struct *p, int policy, struct sched_param *param);
288−
289−typedef 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;
797+extern int brcmf_os_ioctl_resp_wake(struct brcmf_pub *drvr);
798+extern unsigned int brcmf_os_get_ioctl_resp_timeout(void);
799+extern void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec);
800+#ifdef BCMDBG
801+extern int brcmf_write_to_file(struct brcmf_pub *drvr, u8 *buf, int size);
802+#endif /* BCMDBG */
295803
296−extern void dhd_timeout_start(dhd_timeout_t *tmo, uint usec);
297−extern int dhd_timeout_expired(dhd_timeout_t *tmo);
804+extern void brcmf_timeout_start(struct brcmf_timeout *tmo, uint usec);
805+extern int brcmf_timeout_expired(struct brcmf_timeout *tmo);
298806
299−extern int dhd_ifname2idx(struct dhd_info *dhd, char *name);
300−extern u8 *dhd_bssidx2bssid(dhd_pub_t *dhd, int idx);
301−extern int wl_host_event(struct dhd_info *dhd, int *idx, void *pktdata,
302− wl_event_msg_t *, void **data_ptr);
807+extern int brcmf_ifname2idx(struct brcmf_info *drvr_priv, char *name);
808+extern int brcmf_c_host_event(struct brcmf_info *drvr_priv, int *idx,
809+ void *pktdata, struct brcmf_event_msg *,
810+ void **data_ptr);
303811
304−extern void dhd_common_init(void);
812+extern void brcmf_c_init(void);
305813
306−extern int dhd_add_if(struct dhd_info *dhd, int ifidx, void *handle,
814+extern int brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle,
307815 char *name, u8 *mac_addr, u32 flags, u8 bssidx);
308−extern void dhd_del_if(struct dhd_info *dhd, int ifidx);
309−
310−extern void dhd_vif_add(struct dhd_info *dhd, int ifidx, char *name);
311−extern void dhd_vif_del(struct dhd_info *dhd, int ifidx);
312−
313−extern void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx);
314−extern void dhd_vif_sendup(struct dhd_info *dhd, int ifidx, unsigned char * cp,
315− int len);
816+extern void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx);
316817
317818 /* Send packet to dongle via data channel */
318−extern int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pkt);
319−
320−/* Send event to host */
321−extern void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event,
322− void *data);
323−extern int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag);
324−extern uint dhd_bus_status(dhd_pub_t *dhdp);
325−extern int dhd_bus_start(dhd_pub_t *dhdp);
326−
327−enum cust_gpio_modes {
328− WLAN_RESET_ON,
329− WLAN_RESET_OFF,
330− WLAN_POWER_ON,
331− WLAN_POWER_OFF
819+extern int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx,\
820+ struct sk_buff *pkt);
821+
822+extern int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag);
823+extern int brcmf_bus_start(struct brcmf_pub *drvr);
824+
825+extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg);
826+extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg,
827+ int enable, int master_mode);
828+
829+/* Linux network driver ioctl encoding */
830+struct brcmf_c_ioctl {
831+ uint cmd; /* common ioctl definition */
832+ 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 */
332838 };
333−/*
334− * Insmod parameters for debug/test
335− */
336−
337−/* Watchdog timer interval */
338−extern uint dhd_watchdog_ms;
339−
340−#if defined(DHD_DEBUG)
341−/* Console output poll interval */
342−extern uint dhd_console_ms;
343−#endif /* defined(DHD_DEBUG) */
344−
345−/* Use interrupts */
346−extern uint dhd_intr;
347−
348−/* Use polling */
349−extern uint dhd_poll;
350−
351−/* ARP offload agent mode */
352−extern uint dhd_arp_mode;
353−
354−/* ARP offload enable */
355−extern uint dhd_arp_enable;
356−
357−/* Pkt filte enable control */
358−extern uint dhd_pkt_filter_enable;
359−
360−/* Pkt filter init setup */
361−extern uint dhd_pkt_filter_init;
362−
363−/* Pkt filter mode control */
364−extern uint dhd_master_mode;
365839
366−/* Roaming mode control */
367−extern uint dhd_roam;
368−
369−/* Roaming mode control */
370−extern uint dhd_radio_up;
371−
372−/* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */
373−extern int dhd_idletime;
374−#define DHD_IDLETIME_TICKS 1
375−
376−/* SDIO Drive Strength */
377−extern uint dhd_sdiod_drive_strength;
378−
379−/* Override to force tx queueing all the time */
380−extern uint dhd_force_tx_queueing;
840+/* per-driver magic numbers */
841+#define BRCMF_IOCTL_MAGIC 0x00444944
842+
843+/* bump this number if you change the ioctl interface */
844+#define BRCMF_IOCTL_VERSION 1
845+#define BRCMF_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */
846+
847+/* common ioctl definitions */
848+#define BRCMF_GET_MAGIC 0
849+#define BRCMF_GET_VERSION 1
850+#define BRCMF_GET_VAR 2
851+#define BRCMF_SET_VAR 3
852+
853+/* message levels */
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
381867
382868 #ifdef SDTEST
383−/* Echo packet generator (SDIO), pkts/s */
384−extern uint dhd_pktgen;
385−
386−/* Echo packet len (0 => sawtooth, max 1800) */
387−extern uint dhd_pktgen_len;
388−#define MAX_PKTGEN_LEN 1800
389−#endif
390−
391−/* optionally set by a module_param_string() */
392−#define MOD_PARAM_PATHLEN 2048
393−extern char fw_path[MOD_PARAM_PATHLEN];
394−extern char nv_path[MOD_PARAM_PATHLEN];
869+/* For pktgen iovar */
870+struct brcmf_pktgen {
871+ uint version; /* To allow structure change tracking */
872+ uint freq; /* Max ticks between tx/rx attempts */
873+ uint count; /* Test packets to send/rcv each attempt */
874+ uint print; /* Print counts every <print> attempts */
875+ uint total; /* Total packets (or bursts) */
876+ uint minlen; /* Minimum length of packets to send */
877+ uint maxlen; /* Maximum length of packets to send */
878+ uint numsent; /* Count of test packets sent */
879+ uint numrcvd; /* Count of test packets received */
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+};
395884
396−/* For supporting multiple interfaces */
397−#define DHD_MAX_IFS 16
398−#define DHD_DEL_IF -0xe
399−#define DHD_BAD_IF -0xf
885+/* Version in case structure changes */
886+#define BRCMF_PKTGEN_VERSION 2
400887
401−extern void dhd_wait_for_event(dhd_pub_t *dhd, bool * lockvar);
402−extern void dhd_wait_event_wakeup(dhd_pub_t *dhd);
888+/* Type of test packets to use */
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 */
403895
404−extern u32 g_assert_type;
896+/* Enter idle immediately (no timeout) */
897+#define BRCMF_IDLE_IMMEDIATE (-1)
405898
406−#ifdef BCMDBG
407−#define ASSERT(exp) \
408− do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
409−extern void osl_assert(char *exp, char *file, int line);
410−#else
411−#define ASSERT(exp) do {} while (0)
412−#endif /* defined(BCMDBG) */
899+/* Values for idleclock iovar: other values are the sd_divisor to use
900+ when idle */
901+#define BRCMF_IDLE_ACTIVE 0 /* Do not request any SD clock change
902+ when idle */
413903
414−#endif /* _dhd_h_ */
904+#endif /* _BRCMF_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_bus.h+36−40
@@ -14,69 +14,65 @@ · 13 unmodified lines
1414 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515 */
1616
17−#ifndef _dhd_bus_h_
18−#define _dhd_bus_h_
17+#ifndef _BRCMF_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
1927
2028 /*
21− * Exported from dhd bus module (dhd_usb, dhd_sdio)
29+ * Exported from brcmf bus module (brcmf_usb, brcmf_sdio)
2230 */
2331
24−/* Indicate (dis)interest in finding dongles. */
25−extern int dhd_bus_register(void);
26−extern void dhd_bus_unregister(void);
32+/* dongle ram module parameter */
33+extern int brcmf_dongle_memsize;
34+
35+/* Tx/Rx bounds module parameters */
36+extern uint brcmf_txbound;
37+extern uint brcmf_rxbound;
2738
28−/* Download firmware image and nvram image */
29−extern bool dhd_bus_download_firmware(struct dhd_bus *bus,
30− char *fw_path, char *nv_path);
39+/* Watchdog timer interval */
40+extern uint brcmf_watchdog_ms;
41+
42+/* Indicate (dis)interest in finding dongles. */
43+extern int brcmf_bus_register(void);
44+extern void brcmf_bus_unregister(void);
3145
3246 /* Stop bus module: clear pending frames, disable data flow */
33−extern void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex);
47+extern void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex);
3448
3549 /* Initialize bus module: prepare for communication w/dongle */
36−extern int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex);
50+extern int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex);
3751
3852 /* Send a data frame to the dongle. Callee disposes of txp. */
39−extern int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *txp);
53+extern int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *txp);
4054
4155 /* Send/receive a control message to/from the dongle.
4256 * Expects caller to enforce a single outstanding transaction.
4357 */
44−extern int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen);
45−extern int dhd_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen);
58+extern int
59+brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen);
4660
47−/* Watchdog timer function */
48−extern bool dhd_bus_watchdog(dhd_pub_t *dhd);
49−
50−#ifdef DHD_DEBUG
51−/* Device console input function */
52−extern 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 */
56−extern bool dhd_bus_dpc(struct dhd_bus *bus);
57−extern void dhd_bus_isr(bool *InterruptRecognized,
58− bool *QueueMiniportHandleInterrupt, void *arg);
61+extern int
62+brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen);
5963
6064 /* Check for and handle local prot-specific iovar commands */
61−extern int dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name,
65+extern int brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name,
6266 void *params, int plen, void *arg, int len,
6367 bool set);
6468
6569 /* Add bus dump output to a buffer */
66−extern void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf);
70+extern void brcmf_sdbrcm_bus_dump(struct brcmf_pub *drvr,
71+ struct brcmu_strbuf *strbuf);
6772
6873 /* Clear any bus counters */
69−extern void dhd_bus_clearcounts(dhd_pub_t *dhdp);
70−
71−/* return the dongle chipid */
72−extern uint dhd_bus_chip(struct dhd_bus *bus);
73−
74−/* Set user-specified nvram parameters. */
75−extern void dhd_bus_set_nvram_params(struct dhd_bus *bus,
76− const char *nvram_params);
74+extern void brcmf_bus_clearcounts(struct brcmf_pub *drvr);
7775
78−extern void *dhd_bus_pub(struct dhd_bus *bus);
79−extern void *dhd_bus_txq(struct dhd_bus *bus);
80−extern uint dhd_bus_hdrlen(struct dhd_bus *bus);
76+extern void brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick);
8177
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
1616
1717 #include <linux/types.h>
1818 #include <linux/netdevice.h>
19−#include <bcmdefs.h>
20−
21−#include <bcmutils.h>
22−#include <bcmcdc.h>
23−
24−#include <dngl_stats.h>
25−#include <dhd.h>
26−#include <dhd_proto.h>
27−#include <dhd_bus.h>
28−#include <dhd_dbg.h>
29−#ifdef CUSTOMER_HW2
30−int wifi_get_mac_addr(unsigned char *buf);
31−#endif
32−
33−extern int dhd_preinit_ioctls(dhd_pub_t *dhd);
34−
35−/* Packet alignment for most efficient SDIO (can change based on platform) */
36−#ifndef DHD_SDALIGN
37−#define DHD_SDALIGN 32
38−#endif
39−#if !ISPOWEROF2(DHD_SDALIGN)
40−#error DHD_SDALIGN is not a power of 2!
41−#endif
19+#include <linux/sched.h>
20+#include <defs.h>
21+
22+#include <brcmu_utils.h>
23+#include <brcmu_wifi.h>
24+
25+#include "dhd.h"
26+#include "dhd_proto.h"
27+#include "dhd_bus.h"
28+#include "dhd_dbg.h"
29+
30+struct brcmf_proto_cdc_ioctl {
31+ u32 cmd; /* ioctl command value */
32+ u32 len; /* lower 16: output buflen;
33+ * upper 16: input buflen (excludes header) */
34+ u32 flags; /* flag defns given below */
35+ u32 status; /* status code returned from the device */
36+};
37+
38+/* Max valid buffer size that can be sent to the dongle */
39+#define CDC_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN)
40+
41+/* 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+
74+struct 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+
4281
4382 #define RETRIES 2 /* # of retries to retrieve matching ioctl response */
44−#define BUS_HEADER_LEN (16+DHD_SDALIGN) /* Must be atleast SDPCM_RESERVE
45− * defined in dhd_sdio.c
83+#define BUS_HEADER_LEN (16+BRCMF_SDALIGN) /* Must be atleast SDPCM_RESERVE
4684 * (amount of header tha might be added)
4785 * plus any space that might be needed
4886 * for alignment padding.
@@ -51,21 +89,22 @@ extern int dhd_preinit_ioctls(dhd_pub_t *dhd); · 2 unmodified lines
5189 * round off at the end of buffer
5290 */
5391
54−typedef struct dhd_prot {
92+struct brcmf_proto {
5593 u16 reqid;
5694 u8 pending;
5795 u32 lastcmd;
5896 u8 bus_header[BUS_HEADER_LEN];
59− cdc_ioctl_t msg;
60− unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN];
61−} dhd_prot_t;
97+ struct brcmf_proto_cdc_ioctl msg;
98+ unsigned char buf[BRCMF_C_IOCTL_MAXLEN + ROUND_UP_MARGIN];
99+};
62100
63−static int dhdcdc_msg(dhd_pub_t *dhd)
101+static int brcmf_proto_cdc_msg(struct brcmf_pub *drvr)
64102 {
65− dhd_prot_t *prot = dhd->prot;
66− int len = le32_to_cpu(prot->msg.len) + sizeof(cdc_ioctl_t);
103+ struct brcmf_proto *prot = drvr->prot;
104+ int len = le32_to_cpu(prot->msg.len) +
105+ sizeof(struct brcmf_proto_cdc_ioctl);
67106
68− DHD_TRACE(("%s: Enter\n", __func__));
107+ BRCMF_TRACE(("%s: Enter\n", __func__));
69108
70109 /* NOTE : cdc->msg.len holds the desired length of the buffer to be
71110 * 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
75114 len = CDC_MAX_MSG_SIZE;
76115
77116 /* 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);
79119 }
80120
81−static int dhdcdc_cmplt(dhd_pub_t *dhd, u32 id, u32 len)
121+static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len)
82122 {
83123 int ret;
84− dhd_prot_t *prot = dhd->prot;
124+ struct brcmf_proto *prot = drvr->prot;
85125
86− DHD_TRACE(("%s: Enter\n", __func__));
126+ BRCMF_TRACE(("%s: Enter\n", __func__));
87127
88128 do {
89− ret =
90− dhd_bus_rxctl(dhd->bus, (unsigned char *)&prot->msg,
91− len + sizeof(cdc_ioctl_t));
129+ ret = brcmf_sdbrcm_bus_rxctl(drvr->bus,
130+ (unsigned char *)&prot->msg,
131+ len + sizeof(struct brcmf_proto_cdc_ioctl));
92132 if (ret < 0)
93133 break;
94134 } 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
97137 }
98138
99139 int
100−dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
140+brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
141+ void *buf, uint len)
101142 {
102− dhd_prot_t *prot = dhd->prot;
103− cdc_ioctl_t *msg = &prot->msg;
143+ struct brcmf_proto *prot = drvr->prot;
144+ struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
104145 void *info;
105146 int ret = 0, retries = 0;
106147 u32 id, flags = 0;
107148
108− DHD_TRACE(("%s: Enter\n", __func__));
109− DHD_CTL(("%s: cmd %d len %d\n", __func__, cmd, len));
149+ BRCMF_TRACE(("%s: Enter\n", __func__));
150+ BRCMF_CTL(("%s: cmd %d len %d\n", __func__, cmd, len));
110151
111152 /* Respond "bcmerror" and "bcmerrorstr" with local cache */
112− if (cmd == WLC_GET_VAR && buf) {
153+ if (cmd == BRCMF_C_GET_VAR && buf) {
113154 if (!strcmp((char *)buf, "bcmerrorstr")) {
114155 strncpy((char *)buf, "bcm_error",
115156 BCME_STRLEN);
116157 goto done;
117158 } else if (!strcmp((char *)buf, "bcmerror")) {
118− *(int *)buf = dhd->dongle_error;
159+ *(int *)buf = drvr->dongle_error;
119160 goto done;
120161 }
121162 }
122163
123− memset(msg, 0, sizeof(cdc_ioctl_t));
164+ memset(msg, 0, sizeof(struct brcmf_proto_cdc_ioctl));
124165
125166 msg->cmd = cpu_to_le32(cmd);
126167 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
131172 if (buf)
132173 memcpy(prot->buf, buf, len);
133174
134− ret = dhdcdc_msg(dhd);
175+ ret = brcmf_proto_cdc_msg(drvr);
135176 if (ret < 0) {
136− DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status "
137− "%d\n", ret));
177+ BRCMF_ERROR(("brcmf_proto_cdc_query_ioctl: brcmf_proto_cdc_msg "
178+ "failed w/status %d\n", ret));
138179 goto done;
139180 }
140181
141182 retry:
142183 /* 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);
144185 if (ret < 0)
145186 goto done;
146187
@@ -150,8 +191,9 @@ retry: · 3 unmodified lines
150191 if ((id < prot->reqid) && (++retries < RETRIES))
151192 goto retry;
152193 if (id != prot->reqid) {
153− DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
154− dhd_ifname(dhd, ifidx), __func__, id, prot->reqid));
194+ BRCMF_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
195+ brcmf_ifname(drvr, ifidx), __func__, id,
196+ prot->reqid));
155197 ret = -EINVAL;
156198 goto done;
157199 }
@@ -170,24 +212,25 @@ retry: · 12 unmodified lines
170212 if (flags & CDCF_IOC_ERROR) {
171213 ret = le32_to_cpu(msg->status);
172214 /* Cache error from dongle */
173− dhd->dongle_error = ret;
215+ drvr->dongle_error = ret;
174216 }
175217
176218 done:
177219 return ret;
178220 }
179221
180−int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
222+int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
223+ void *buf, uint len)
181224 {
182− dhd_prot_t *prot = dhd->prot;
183− cdc_ioctl_t *msg = &prot->msg;
225+ struct brcmf_proto *prot = drvr->prot;
226+ struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
184227 int ret = 0;
185228 u32 flags, id;
186229
187− DHD_TRACE(("%s: Enter\n", __func__));
188− DHD_CTL(("%s: cmd %d len %d\n", __func__, cmd, len));
230+ BRCMF_TRACE(("%s: Enter\n", __func__));
231+ BRCMF_CTL(("%s: cmd %d len %d\n", __func__, cmd, len));
189232
190− memset(msg, 0, sizeof(cdc_ioctl_t));
233+ memset(msg, 0, sizeof(struct brcmf_proto_cdc_ioctl));
191234
192235 msg->cmd = cpu_to_le32(cmd);
193236 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
198241 if (buf)
199242 memcpy(prot->buf, buf, len);
200243
201− ret = dhdcdc_msg(dhd);
244+ ret = brcmf_proto_cdc_msg(drvr);
202245 if (ret < 0)
203246 goto done;
204247
205− ret = dhdcdc_cmplt(dhd, prot->reqid, len);
248+ ret = brcmf_proto_cdc_cmplt(drvr, prot->reqid, len);
206249 if (ret < 0)
207250 goto done;
208251
@@ -210,8 +253,9 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) · 1 unmodified line
210253 id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
211254
212255 if (id != prot->reqid) {
213− DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
214− dhd_ifname(dhd, ifidx), __func__, id, prot->reqid));
256+ BRCMF_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
257+ brcmf_ifname(drvr, ifidx), __func__, id,
258+ prot->reqid));
215259 ret = -EINVAL;
216260 goto done;
217261 }
@@ -220,41 +264,40 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) · 2 unmodified lines
220264 if (flags & CDCF_IOC_ERROR) {
221265 ret = le32_to_cpu(msg->status);
222266 /* Cache error from dongle */
223− dhd->dongle_error = ret;
267+ drvr->dongle_error = ret;
224268 }
225269
226270 done:
227271 return ret;
228272 }
229273
230−extern int dhd_bus_interface(struct dhd_bus *bus, uint arg, void *arg2);
231274 int
232−dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len)
275+brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc,
276+ void *buf, int len)
233277 {
234− dhd_prot_t *prot = dhd->prot;
278+ struct brcmf_proto *prot = drvr->prot;
235279 int ret = -1;
236280
237− if (dhd->busstate == DHD_BUS_DOWN) {
238− DHD_ERROR(("%s : bus is down. we have nothing to do\n",
239− __func__));
281+ if (drvr->busstate == BRCMF_BUS_DOWN) {
282+ BRCMF_ERROR(("%s : bus is down. we have nothing to do\n",
283+ __func__));
240284 return ret;
241285 }
242− dhd_os_proto_block(dhd);
243−
244− DHD_TRACE(("%s: Enter\n", __func__));
286+ brcmf_os_proto_block(drvr);
245287
246− ASSERT(len <= WLC_IOCTL_MAXLEN);
288+ BRCMF_TRACE(("%s: Enter\n", __func__));
247289
248− if (len > WLC_IOCTL_MAXLEN)
290+ if (len > BRCMF_C_IOCTL_MAXLEN)
249291 goto done;
250292
251293 if (prot->pending == true) {
252− DHD_TRACE(("CDC packet is pending!!!! cmd=0x%x (%lu) "
253− "lastcmd=0x%x (%lu)\n",
254− ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd,
255− (unsigned long)prot->lastcmd));
256− if ((ioc->cmd == WLC_SET_VAR) || (ioc->cmd == WLC_GET_VAR))
257− DHD_TRACE(("iovar cmd=%s\n", (char *)buf));
294+ BRCMF_TRACE(("CDC packet is pending!!!! cmd=0x%x (%lu) "
295+ "lastcmd=0x%x (%lu)\n",
296+ ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd,
297+ (unsigned long)prot->lastcmd));
298+ if ((ioc->cmd == BRCMF_C_SET_VAR) ||
299+ (ioc->cmd == BRCMF_C_GET_VAR))
300+ BRCMF_TRACE(("iovar cmd=%s\n", (char *)buf));
258301
259302 goto done;
260303 }
@@ -262,36 +305,39 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len) · 1 unmodified line
262305 prot->pending = true;
263306 prot->lastcmd = ioc->cmd;
264307 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);
266310 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);
268313 if (ret > 0)
269− ioc->used = ret - sizeof(cdc_ioctl_t);
314+ ioc->used = ret - sizeof(struct brcmf_proto_cdc_ioctl);
270315 }
271316
272317 /* Too many programs assume ioctl() returns 0 on success */
273318 if (ret >= 0)
274319 ret = 0;
275320 else {
276− cdc_ioctl_t *msg = &prot->msg;
321+ struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
277322 /* len == needed when set/query fails from dongle */
278323 ioc->needed = le32_to_cpu(msg->len);
279324 }
280325
281326 /* 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")) {
283329 int slen, val = 0;
284330
285331 slen = strlen("wme_dp") + 1;
286332 if (len >= (int)(slen + sizeof(int)))
287333 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);
289335 }
290336
291337 prot->pending = false;
292338
293339 done:
294− dhd_os_proto_unblock(dhd);
340+ brcmf_os_proto_unblock(drvr);
295341
296342 return ret;
297343 }
@@ -302,35 +348,23 @@ done: · 4 unmodified lines
302348 (((struct sk_buff *)(skb))->ip_summed = \
303349 ((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE))
304350
305−/* PKTSETSUMNEEDED and PKTSUMGOOD are not possible because
306− skb->ip_summed is overloaded */
307−
308−int
309−dhd_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−
315−void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
351+void brcmf_proto_dump(struct brcmf_pub *drvr, struct brcmu_strbuf *strbuf)
316352 {
317− bcm_bprintf(strbuf, "Protocol CDC: reqid %d\n", dhdp->prot->reqid);
353+ brcmu_bprintf(strbuf, "Protocol CDC: reqid %d\n", drvr->prot->reqid);
318354 }
319355
320−void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf)
356+void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx,
357+ struct sk_buff *pktbuf)
321358 {
322−#ifdef BDC
323− struct bdc_header *h;
324−#endif /* BDC */
359+ struct brcmf_proto_bdc_header *h;
325360
326− DHD_TRACE(("%s: Enter\n", __func__));
361+ BRCMF_TRACE(("%s: Enter\n", __func__));
327362
328−#ifdef BDC
329363 /* Push BDC header used to convey priority for buses that don't */
330364
331365 skb_push(pktbuf, BDC_HEADER_LEN);
332366
333− h = (struct bdc_header *)(pktbuf->data);
367+ h = (struct brcmf_proto_bdc_header *)(pktbuf->data);
334368
335369 h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT);
336370 if (PKTSUMNEEDED(pktbuf))
@@ -339,79 +373,74 @@ void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf) · 2 unmodified lines
339373 h->priority = (pktbuf->priority & BDC_PRIORITY_MASK);
340374 h->flags2 = 0;
341375 h->rssi = 0;
342−#endif /* BDC */
343376 BDC_SET_IF_IDX(h, ifidx);
344377 }
345378
346−int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
379+int brcmf_proto_hdrpull(struct brcmf_pub *drvr, int *ifidx,
380+ struct sk_buff *pktbuf)
347381 {
348−#ifdef BDC
349− struct bdc_header *h;
350−#endif
382+ struct brcmf_proto_bdc_header *h;
351383
352− DHD_TRACE(("%s: Enter\n", __func__));
384+ BRCMF_TRACE(("%s: Enter\n", __func__));
353385
354−#ifdef BDC
355386 /* Pop BDC header used to convey priority for buses that don't */
356387
357388 if (pktbuf->len < BDC_HEADER_LEN) {
358− DHD_ERROR(("%s: rx data too short (%d < %d)\n", __func__,
359− pktbuf->len, BDC_HEADER_LEN));
389+ BRCMF_ERROR(("%s: rx data too short (%d < %d)\n", __func__,
390+ pktbuf->len, BDC_HEADER_LEN));
360391 return -EBADE;
361392 }
362393
363− h = (struct bdc_header *)(pktbuf->data);
394+ h = (struct brcmf_proto_bdc_header *)(pktbuf->data);
364395
365396 *ifidx = BDC_GET_IF_IDX(h);
366− if (*ifidx >= DHD_MAX_IFS) {
367− DHD_ERROR(("%s: rx data ifnum out of range (%d)\n",
368− __func__, *ifidx));
397+ if (*ifidx >= BRCMF_MAX_IFS) {
398+ BRCMF_ERROR(("%s: rx data ifnum out of range (%d)\n",
399+ __func__, *ifidx));
369400 return -EBADE;
370401 }
371402
372403 if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) !=
373404 BDC_PROTO_VER) {
374− DHD_ERROR(("%s: non-BDC packet received, flags 0x%x\n",
375− dhd_ifname(dhd, *ifidx), h->flags));
405+ BRCMF_ERROR(("%s: non-BDC packet received, flags 0x%x\n",
406+ brcmf_ifname(drvr, *ifidx), h->flags));
376407 return -EBADE;
377408 }
378409
379410 if (h->flags & BDC_FLAG_SUM_GOOD) {
380− DHD_INFO(("%s: BDC packet received with good rx-csum, "
381− "flags 0x%x\n",
382− dhd_ifname(dhd, *ifidx), h->flags));
411+ BRCMF_INFO(("%s: BDC packet received with good rx-csum, "
412+ "flags 0x%x\n",
413+ brcmf_ifname(drvr, *ifidx), h->flags));
383414 PKTSETSUMGOOD(pktbuf, true);
384415 }
385416
386417 pktbuf->priority = h->priority & BDC_PRIORITY_MASK;
387418
388419 skb_pull(pktbuf, BDC_HEADER_LEN);
389−#endif /* BDC */
390420
391421 return 0;
392422 }
393423
394−int dhd_prot_attach(dhd_pub_t *dhd)
424+int brcmf_proto_attach(struct brcmf_pub *drvr)
395425 {
396− dhd_prot_t *cdc;
426+ struct brcmf_proto *cdc;
397427
398− cdc = kzalloc(sizeof(dhd_prot_t), GFP_ATOMIC);
428+ cdc = kzalloc(sizeof(struct brcmf_proto), GFP_ATOMIC);
399429 if (!cdc) {
400− DHD_ERROR(("%s: kmalloc failed\n", __func__));
430+ BRCMF_ERROR(("%s: kmalloc failed\n", __func__));
401431 goto fail;
402432 }
403433
404434 /* ensure that the msg buf directly follows the cdc msg struct */
405435 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"));
407437 goto fail;
408438 }
409439
410− dhd->prot = cdc;
411−#ifdef BDC
412− dhd->hdrlen += BDC_HEADER_LEN;
413−#endif
414− dhd->maxctl = WLC_IOCTL_MAXLEN + sizeof(cdc_ioctl_t) + ROUND_UP_MARGIN;
440+ drvr->prot = cdc;
441+ drvr->hdrlen += BDC_HEADER_LEN;
442+ drvr->maxctl = BRCMF_C_IOCTL_MAXLEN +
443+ sizeof(struct brcmf_proto_cdc_ioctl) + ROUND_UP_MARGIN;
415444 return 0;
416445
417446 fail:
@@ -420,55 +449,54 @@ fail: · 2 unmodified lines
420449 }
421450
422451 /* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */
423−void dhd_prot_detach(dhd_pub_t *dhd)
452+void brcmf_proto_detach(struct brcmf_pub *drvr)
424453 {
425− kfree(dhd->prot);
426− dhd->prot = NULL;
454+ kfree(drvr->prot);
455+ drvr->prot = NULL;
427456 }
428457
429−void dhd_prot_dstats(dhd_pub_t *dhd)
458+void brcmf_proto_dstats(struct brcmf_pub *drvr)
430459 {
431460 /* No stats from dongle added yet, copy bus stats */
432− dhd->dstats.tx_packets = dhd->tx_packets;
433− dhd->dstats.tx_errors = dhd->tx_errors;
434− dhd->dstats.rx_packets = dhd->rx_packets;
435− dhd->dstats.rx_errors = dhd->rx_errors;
436− dhd->dstats.rx_dropped = dhd->rx_dropped;
437− dhd->dstats.multicast = dhd->rx_multicast;
461+ drvr->dstats.tx_packets = drvr->tx_packets;
462+ drvr->dstats.tx_errors = drvr->tx_errors;
463+ drvr->dstats.rx_packets = drvr->rx_packets;
464+ drvr->dstats.rx_errors = drvr->rx_errors;
465+ drvr->dstats.rx_dropped = drvr->rx_dropped;
466+ drvr->dstats.multicast = drvr->rx_multicast;
438467 return;
439468 }
440469
441−int dhd_prot_init(dhd_pub_t *dhd)
470+int brcmf_proto_init(struct brcmf_pub *drvr)
442471 {
443472 int ret = 0;
444473 char buf[128];
445474
446− DHD_TRACE(("%s: Enter\n", __func__));
475+ BRCMF_TRACE(("%s: Enter\n", __func__));
447476
448− dhd_os_proto_block(dhd);
477+ brcmf_os_proto_block(drvr);
449478
450479 /* Get the device MAC address */
451480 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));
453483 if (ret < 0) {
454− dhd_os_proto_unblock(dhd);
484+ brcmf_os_proto_unblock(drvr);
455485 return ret;
456486 }
457− memcpy(dhd->mac, buf, ETH_ALEN);
487+ memcpy(drvr->mac, buf, ETH_ALEN);
458488
459− dhd_os_proto_unblock(dhd);
489+ brcmf_os_proto_unblock(drvr);
460490
461−#ifdef EMBEDDED_PLATFORM
462− ret = dhd_preinit_ioctls(dhd);
463−#endif /* EMBEDDED_PLATFORM */
491+ ret = brcmf_c_preinit_ioctls(drvr);
464492
465493 /* Always assumes wl for now */
466− dhd->iswl = true;
494+ drvr->iswl = true;
467495
468496 return ret;
469497 }
470498
471−void dhd_prot_stop(dhd_pub_t *dhd)
499+void brcmf_proto_stop(struct brcmf_pub *drvr)
472500 {
473501 /* Nothing to do for CDC */
474502 }
drivers/staging/brcm80211/brcmfmac/dhd_common.c+477−1129
@@ -15,64 +15,41 @@ · 14 unmodified lines
1515 */
1616 #include <linux/kernel.h>
1717 #include <linux/string.h>
18−#include <bcmdefs.h>
18+#include <linux/sched.h>
1919 #include <linux/netdevice.h>
20−#include <bcmutils.h>
21−#include <dngl_stats.h>
22−#include <dhd.h>
23−#include <dhd_bus.h>
24−#include <dhd_proto.h>
25−#include <dhd_dbg.h>
26−#include <msgtrace.h>
27−#include <wlioctl.h>
28−
29−int dhd_msg_level;
30−char fw_path[MOD_PARAM_PATHLEN];
31−char nv_path[MOD_PARAM_PATHLEN];
32−
33−/* Last connection success/failure status */
34−u32 dhd_conn_event;
35−u32 dhd_conn_status;
36−u32 dhd_conn_reason;
37−
38−extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
39− uint len);
40−extern void dhd_ind_scan_confirm(void *h, bool status);
41−extern int dhd_wl_ioctl(dhd_pub_t *dhd, uint cmd, char *buf, uint buflen);
42−void dhd_iscan_lock(void);
43−void 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
55−const char dhd_version[] =
56−"Dongle Host Driver, version " EPI_VERSION_STR "\nCompiled on " __DATE__
20+#include <asm/unaligned.h>
21+#include <defs.h>
22+#include <brcmu_wifi.h>
23+#include <brcmu_utils.h>
24+#include "dhd.h"
25+#include "dhd_bus.h"
26+#include "dhd_proto.h"
27+#include "dhd_dbg.h"
28+
29+#define BRCM_OUI "\x00\x10\x18"
30+#define DOT11_OUI_LEN 3
31+#define BCMILCP_BCM_SUBTYPE_EVENT 1
32+#define PKTFILTER_BUF_SIZE 2048
33+
34+int brcmf_msg_level;
35+
36+#define MSGTRACE_VERSION 1
37+
38+#ifdef BCMDBG
39+const char brcmf_version[] =
40+"Dongle Host Driver, version " BRCMF_VERSION_STR "\nCompiled on " __DATE__
5741 " at " __TIME__;
5842 #else
59−const char dhd_version[] = "Dongle Host Driver, version " EPI_VERSION_STR;
43+const char brcmf_version[] = "Dongle Host Driver, version " BRCMF_VERSION_STR;
6044 #endif
6145
62−void dhd_set_timer(void *bus, uint wdtick);
63−
6446 /* IOVar table */
6547 enum {
6648 IOV_VERSION = 1,
6749 IOV_MSGLEVEL,
6850 IOV_BCMERRORSTR,
6951 IOV_BCMERROR,
70− IOV_WDTICK,
7152 IOV_DUMP,
72−#ifdef DHD_DEBUG
73− IOV_CONS,
74− IOV_DCONSOLE_POLL,
75−#endif
7653 IOV_CLEARCOUNTS,
7754 IOV_LOGDUMP,
7855 IOV_LOGCAL,
@@ -82,27 +59,19 @@ enum { · 3 unmodified lines
8259 IOV_LAST
8360 };
8461
85−const bcm_iovar_t dhd_iovars[] = {
86− {"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(dhd_version)}
62+const struct brcmu_iovar brcmf_iovars[] = {
63+ {"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(brcmf_version)}
8764 ,
88−#ifdef DHD_DEBUG
65+#ifdef BCMDBG
8966 {"msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0}
9067 ,
91−#endif /* DHD_DEBUG */
68+#endif /* BCMDBG */
9269 {"bcmerrorstr", IOV_BCMERRORSTR, 0, IOVT_BUFFER, BCME_STRLEN}
9370 ,
9471 {"bcmerror", IOV_BCMERROR, 0, IOVT_INT8, 0}
9572 ,
96− {"wdtick", IOV_WDTICK, 0, IOVT_UINT32, 0}
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}
73+ {"dump", IOV_DUMP, 0, IOVT_BUFFER, BRCMF_IOCTL_MAXLEN}
10274 ,
103− {"cons", IOV_CONS, 0, IOVT_BUFFER, 0}
104− ,
105−#endif
10675 {"clearcounts", IOV_CLEARCOUNTS, 0, IOVT_VOID, 0}
10776 ,
10877 {"gpioob", IOV_GPIOOB, 0, IOVT_UINT32, 0}
@@ -112,7 +81,23 @@ const bcm_iovar_t dhd_iovars[] = { · 3 unmodified lines
11281 {NULL, 0, 0, 0, 0}
11382 };
11483
115−void dhd_common_init(void)
84+/* Message trace header */
85+struct 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+
100+void brcmf_c_init(void)
116101 {
117102 /* Init global variables at run-time, not as part of the declaration.
118103 * This is required to support init/de-init of the driver.
@@ -122,87 +107,77 @@ void dhd_common_init(void) · 3 unmodified lines
122107 * first time that the driver is initialized vs subsequent
123108 * initializations.
124109 */
125− dhd_msg_level = DHD_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
110+ brcmf_msg_level = BRCMF_ERROR_VAL;
136111 }
137112
138−static int dhd_dump(dhd_pub_t *dhdp, char *buf, int buflen)
113+static int brcmf_c_dump(struct brcmf_pub *drvr, char *buf, int buflen)
139114 {
140− struct bcmstrbuf b;
141− struct bcmstrbuf *strbuf = &b;
142−
143− bcm_binit(strbuf, buf, buflen);
144−
145− /* Base DHD info */
146− bcm_bprintf(strbuf, "%s\n", dhd_version);
147− bcm_bprintf(strbuf, "\n");
148− bcm_bprintf(strbuf, "pub.up %d pub.txoff %d pub.busstate %d\n",
149− dhdp->up, dhdp->txoff, dhdp->busstate);
150− bcm_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n",
151− dhdp->hdrlen, dhdp->maxctl, dhdp->rxsz);
152− bcm_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %pM\n",
153− dhdp->iswl, dhdp->drv_version, &dhdp->mac);
154− bcm_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", dhdp->bcmerror,
155− dhdp->tickcnt);
156−
157− bcm_bprintf(strbuf, "dongle stats:\n");
158− bcm_bprintf(strbuf,
115+ struct brcmu_strbuf b;
116+ struct brcmu_strbuf *strbuf = &b;
117+
118+ brcmu_binit(strbuf, buf, buflen);
119+
120+ /* Base info */
121+ brcmu_bprintf(strbuf, "%s\n", brcmf_version);
122+ brcmu_bprintf(strbuf, "\n");
123+ brcmu_bprintf(strbuf, "pub.up %d pub.txoff %d pub.busstate %d\n",
124+ drvr->up, drvr->txoff, drvr->busstate);
125+ brcmu_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n",
126+ drvr->hdrlen, drvr->maxctl, drvr->rxsz);
127+ brcmu_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %pM\n",
128+ drvr->iswl, drvr->drv_version, &drvr->mac);
129+ brcmu_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", drvr->bcmerror,
130+ drvr->tickcnt);
131+
132+ brcmu_bprintf(strbuf, "dongle stats:\n");
133+ brcmu_bprintf(strbuf,
159134 "tx_packets %ld tx_bytes %ld tx_errors %ld tx_dropped %ld\n",
160− dhdp->dstats.tx_packets, dhdp->dstats.tx_bytes,
161− dhdp->dstats.tx_errors, dhdp->dstats.tx_dropped);
162− bcm_bprintf(strbuf,
135+ drvr->dstats.tx_packets, drvr->dstats.tx_bytes,
136+ drvr->dstats.tx_errors, drvr->dstats.tx_dropped);
137+ brcmu_bprintf(strbuf,
163138 "rx_packets %ld rx_bytes %ld rx_errors %ld rx_dropped %ld\n",
164− dhdp->dstats.rx_packets, dhdp->dstats.rx_bytes,
165− dhdp->dstats.rx_errors, dhdp->dstats.rx_dropped);
166− bcm_bprintf(strbuf, "multicast %ld\n", dhdp->dstats.multicast);
167−
168− bcm_bprintf(strbuf, "bus stats:\n");
169− bcm_bprintf(strbuf, "tx_packets %ld tx_multicast %ld tx_errors %ld\n",
170− dhdp->tx_packets, dhdp->tx_multicast, dhdp->tx_errors);
171− bcm_bprintf(strbuf, "tx_ctlpkts %ld tx_ctlerrs %ld\n",
172− dhdp->tx_ctlpkts, dhdp->tx_ctlerrs);
173− bcm_bprintf(strbuf, "rx_packets %ld rx_multicast %ld rx_errors %ld\n",
174− dhdp->rx_packets, dhdp->rx_multicast, dhdp->rx_errors);
175− bcm_bprintf(strbuf,
139+ drvr->dstats.rx_packets, drvr->dstats.rx_bytes,
140+ drvr->dstats.rx_errors, drvr->dstats.rx_dropped);
141+ brcmu_bprintf(strbuf, "multicast %ld\n", drvr->dstats.multicast);
142+
143+ brcmu_bprintf(strbuf, "bus stats:\n");
144+ brcmu_bprintf(strbuf, "tx_packets %ld tx_multicast %ld tx_errors %ld\n",
145+ drvr->tx_packets, drvr->tx_multicast, drvr->tx_errors);
146+ brcmu_bprintf(strbuf, "tx_ctlpkts %ld tx_ctlerrs %ld\n",
147+ drvr->tx_ctlpkts, drvr->tx_ctlerrs);
148+ brcmu_bprintf(strbuf, "rx_packets %ld rx_multicast %ld rx_errors %ld\n",
149+ drvr->rx_packets, drvr->rx_multicast, drvr->rx_errors);
150+ brcmu_bprintf(strbuf,
176151 "rx_ctlpkts %ld rx_ctlerrs %ld rx_dropped %ld rx_flushed %ld\n",
177− dhdp->rx_ctlpkts, dhdp->rx_ctlerrs, dhdp->rx_dropped,
178− dhdp->rx_flushed);
179− bcm_bprintf(strbuf,
152+ drvr->rx_ctlpkts, drvr->rx_ctlerrs, drvr->rx_dropped,
153+ drvr->rx_flushed);
154+ brcmu_bprintf(strbuf,
180155 "rx_readahead_cnt %ld tx_realloc %ld fc_packets %ld\n",
181− dhdp->rx_readahead_cnt, dhdp->tx_realloc, dhdp->fc_packets);
182− bcm_bprintf(strbuf, "wd_dpc_sched %ld\n", dhdp->wd_dpc_sched);
183− bcm_bprintf(strbuf, "\n");
156+ drvr->rx_readahead_cnt, drvr->tx_realloc, drvr->fc_packets);
157+ brcmu_bprintf(strbuf, "wd_dpc_sched %ld\n", drvr->wd_dpc_sched);
158+ brcmu_bprintf(strbuf, "\n");
184159
185160 /* Add any prot info */
186− dhd_prot_dump(dhdp, strbuf);
187− bcm_bprintf(strbuf, "\n");
161+ brcmf_proto_dump(drvr, strbuf);
162+ brcmu_bprintf(strbuf, "\n");
188163
189164 /* Add any bus info */
190− dhd_bus_dump(dhdp, strbuf);
165+ brcmf_sdbrcm_bus_dump(drvr, strbuf);
191166
192167 return !strbuf->size ? -EOVERFLOW : 0;
193168 }
194169
195170 static int
196−dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid,
197− const char *name, void *params, int plen, void *arg, int len,
198− int val_size)
171+brcmf_c_doiovar(struct brcmf_pub *drvr, const struct brcmu_iovar *vi,
172+ u32 actionid, const char *name, void *params, int plen,
173+ void *arg, int len, int val_size)
199174 {
200175 int bcmerror = 0;
201176 s32 int_val = 0;
202177
203− DHD_TRACE(("%s: Enter\n", __func__));
178+ BRCMF_TRACE(("%s: Enter\n", __func__));
204179
205− bcmerror = bcm_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid));
180+ bcmerror = brcmu_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid));
206181 if (bcmerror != 0)
207182 goto exit;
208183
@@ -212,16 +187,16 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines
212187 switch (actionid) {
213188 case IOV_GVAL(IOV_VERSION):
214189 /* Need to have checked buffer length */
215− strncpy((char *)arg, dhd_version, len);
190+ strncpy((char *)arg, brcmf_version, len);
216191 break;
217192
218193 case IOV_GVAL(IOV_MSGLEVEL):
219− int_val = (s32) dhd_msg_level;
194+ int_val = (s32) brcmf_msg_level;
220195 memcpy(arg, &int_val, val_size);
221196 break;
222197
223198 case IOV_SVAL(IOV_MSGLEVEL):
224− dhd_msg_level = int_val;
199+ brcmf_msg_level = int_val;
225200 break;
226201
227202 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
231206 break;
232207
233208 case IOV_GVAL(IOV_BCMERROR):
234− int_val = (s32) dhd_pub->bcmerror;
209+ int_val = (s32) drvr->bcmerror;
235210 memcpy(arg, &int_val, val_size);
236211 break;
237212
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−
251213 case IOV_GVAL(IOV_DUMP):
252− bcmerror = dhd_dump(dhd_pub, 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);
214+ bcmerror = brcmf_c_dump(drvr, arg, len);
268215 break;
269−#endif
270216
271217 case IOV_SVAL(IOV_CLEARCOUNTS):
272− dhd_pub->tx_packets = dhd_pub->rx_packets = 0;
273− dhd_pub->tx_errors = dhd_pub->rx_errors = 0;
274− dhd_pub->tx_ctlpkts = dhd_pub->rx_ctlpkts = 0;
275− dhd_pub->tx_ctlerrs = dhd_pub->rx_ctlerrs = 0;
276− dhd_pub->rx_dropped = 0;
277− dhd_pub->rx_readahead_cnt = 0;
278− dhd_pub->tx_realloc = 0;
279− dhd_pub->wd_dpc_sched = 0;
280− memset(&dhd_pub->dstats, 0, sizeof(dhd_pub->dstats));
281− dhd_bus_clearcounts(dhd_pub);
218+ drvr->tx_packets = drvr->rx_packets = 0;
219+ drvr->tx_errors = drvr->rx_errors = 0;
220+ drvr->tx_ctlpkts = drvr->rx_ctlpkts = 0;
221+ drvr->tx_ctlerrs = drvr->rx_ctlerrs = 0;
222+ drvr->rx_dropped = 0;
223+ drvr->rx_readahead_cnt = 0;
224+ drvr->tx_realloc = 0;
225+ drvr->wd_dpc_sched = 0;
226+ memset(&drvr->dstats, 0, sizeof(drvr->dstats));
227+ brcmf_bus_clearcounts(drvr);
282228 break;
283229
284230 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();
286232 memcpy(arg, &int_val, sizeof(int_val));
287233 break;
288234 }
@@ -291,7 +237,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
291237 if (int_val <= 0)
292238 bcmerror = -EINVAL;
293239 else
294− dhd_os_set_ioctl_resp_timeout((unsigned int)
240+ brcmf_os_set_ioctl_resp_timeout((unsigned int)
295241 int_val);
296242 break;
297243 }
@@ -305,8 +251,8 @@ exit: · 7 unmodified lines
305251 return bcmerror;
306252 }
307253
308−bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt,
309− int prec)
254+bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q,
255+ struct sk_buff *pkt, int prec)
310256 {
311257 struct sk_buff *p;
312258 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
316262 * exceeding total queue length
317263 */
318264 if (!pktq_pfull(q, prec) && !pktq_full(q)) {
319− bcm_pktq_penq(q, prec, pkt);
265+ brcmu_pktq_penq(q, prec, pkt);
320266 return true;
321267 }
322268
@@ -324,8 +270,7 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, · 1 unmodified line
324270 if (pktq_pfull(q, prec))
325271 eprec = prec;
326272 else if (pktq_full(q)) {
327− p = bcm_pktq_peek_tail(q, &eprec);
328− ASSERT(p);
273+ p = brcmu_pktq_peek_tail(q, &eprec);
329274 if (eprec > prec)
330275 return false;
331276 }
@@ -333,60 +278,58 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, · 1 unmodified line
333278 /* Evict if needed */
334279 if (eprec >= 0) {
335280 /* Detect queueing to unconfigured precedence */
336− ASSERT(!pktq_pempty(q, eprec));
337− discard_oldest = AC_BITMAP_TST(dhdp->wme_dp, eprec);
281+ discard_oldest = AC_BITMAP_TST(drvr->wme_dp, eprec);
338282 if (eprec == prec && !discard_oldest)
339283 return false; /* refuse newer (incoming) packet */
340284 /* Evict packet according to discard policy */
341− p = discard_oldest ? bcm_pktq_pdeq(q, eprec) :
342− bcm_pktq_pdeq_tail(q, eprec);
285+ p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) :
286+ brcmu_pktq_pdeq_tail(q, eprec);
343287 if (p == NULL) {
344− DHD_ERROR(("%s: bcm_pktq_penq() failed, oldest %d.",
345− __func__, discard_oldest));
346− ASSERT(p);
288+ BRCMF_ERROR(("%s: brcmu_pktq_penq() failed, oldest %d.",
289+ __func__, discard_oldest));
347290 }
348−
349− bcm_pkt_buf_free_skb(p);
291+ brcmu_pkt_buf_free_skb(p);
350292 }
351293
352294 /* Enqueue */
353− p = bcm_pktq_penq(q, prec, pkt);
295+ p = brcmu_pktq_penq(q, prec, pkt);
354296 if (p == NULL) {
355− DHD_ERROR(("%s: bcm_pktq_penq() failed.", __func__));
356− ASSERT(p);
297+ BRCMF_ERROR(("%s: brcmu_pktq_penq() failed.", __func__));
357298 }
358299
359− return true;
300+ return p != NULL;
360301 }
361302
362303 static int
363−dhd_iovar_op(dhd_pub_t *dhd_pub, const char *name,
304+brcmf_c_iovar_op(struct brcmf_pub *drvr, const char *name,
364305 void *params, int plen, void *arg, int len, bool set)
365306 {
366307 int bcmerror = 0;
367308 int val_size;
368− const bcm_iovar_t *vi = NULL;
309+ const struct brcmu_iovar *vi = NULL;
369310 u32 actionid;
370311
371− DHD_TRACE(("%s: Enter\n", __func__));
312+ BRCMF_TRACE(("%s: Enter\n", __func__));
372313
373− ASSERT(name);
374− ASSERT(len >= 0);
314+ if (name == NULL || len <= 0)
315+ return -EINVAL;
375316
376− /* Get MUST have return space */
377− ASSERT(set || (arg && len));
317+ /* Set does not take qualifiers */
318+ if (set && (params || plen))
319+ return -EINVAL;
378320
379− /* Set does NOT take qualifiers */
380− ASSERT(!set || (!params && !plen));
321+ /* Get must have return space;*/
322+ if (!set && !(arg && len))
323+ return -EINVAL;
381324
382− vi = bcm_iovar_lookup(dhd_iovars, name);
325+ vi = brcmu_iovar_lookup(brcmf_iovars, name);
383326 if (vi == NULL) {
384327 bcmerror = -ENOTSUPP;
385328 goto exit;
386329 }
387330
388− DHD_CTL(("%s: %s %s, len %d plen %d\n", __func__,
389− name, (set ? "set" : "get"), len, plen));
331+ BRCMF_CTL(("%s: %s %s, len %d plen %d\n", __func__,
332+ name, (set ? "set" : "get"), len, plen));
390333
391334 /* set up 'params' pointer in case this is a set command so that
392335 * 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
406349
407350 actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
408351 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,
410353 val_size);
411354
412355 exit:
413356 return bcmerror;
414357 }
415358
416−int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen)
359+int brcmf_c_ioctl(struct brcmf_pub *drvr, struct brcmf_c_ioctl *ioc, void *buf,
360+ uint buflen)
417361 {
418362 int bcmerror = 0;
419363
420− DHD_TRACE(("%s: Enter\n", __func__));
364+ BRCMF_TRACE(("%s: Enter\n", __func__));
421365
422366 if (!buf)
423367 return -EINVAL;
424368
425369 switch (ioc->cmd) {
426− case DHD_GET_MAGIC:
370+ case BRCMF_GET_MAGIC:
427371 if (buflen < sizeof(int))
428372 bcmerror = -EOVERFLOW;
429373 else
430− *(int *)buf = DHD_IOCTL_MAGIC;
374+ *(int *)buf = BRCMF_IOCTL_MAGIC;
431375 break;
432376
433− case DHD_GET_VERSION:
377+ case BRCMF_GET_VERSION:
434378 if (buflen < sizeof(int))
435379 bcmerror = -EOVERFLOW;
436380 else
437− *(int *)buf = DHD_IOCTL_VERSION;
381+ *(int *)buf = BRCMF_IOCTL_VERSION;
438382 break;
439383
440− case DHD_GET_VAR:
441− case DHD_SET_VAR:{
384+ case BRCMF_GET_VAR:
385+ case BRCMF_SET_VAR:{
442386 char *arg;
443387 uint arglen;
444388
@@ -456,38 +400,25 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) · 11 unmodified lines
456400 arg++, arglen--;
457401
458402 /* call with the appropriate arguments */
459− if (ioc->cmd == DHD_GET_VAR)
460− bcmerror =
461− dhd_iovar_op(dhd_pub, buf, arg, arglen, buf,
462− buflen, IOV_GET);
403+ if (ioc->cmd == BRCMF_GET_VAR)
404+ bcmerror = brcmf_c_iovar_op(drvr, buf, arg,
405+ arglen, buf, buflen, IOV_GET);
463406 else
464407 bcmerror =
465− dhd_iovar_op(dhd_pub, buf, NULL, 0, arg,
466− 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);
408+ brcmf_c_iovar_op(drvr, buf, NULL, 0, arg,
409+ arglen, IOV_SET);
479410 if (bcmerror != -ENOTSUPP)
480411 break;
481412
482413 /* if still not found, try bus module */
483− if (ioc->cmd == DHD_GET_VAR)
484− bcmerror = dhd_bus_iovar_op(dhd_pub, buf,
485− arg, arglen, buf,
486− buflen, IOV_GET);
414+ if (ioc->cmd == BRCMF_GET_VAR)
415+ bcmerror = brcmf_sdbrcm_bus_iovar_op(drvr,
416+ buf, arg, arglen, buf, buflen,
417+ IOV_GET);
487418 else
488− bcmerror = dhd_bus_iovar_op(dhd_pub, buf,
489− NULL, 0, arg,
490− arglen, IOV_SET);
419+ bcmerror = brcmf_sdbrcm_bus_iovar_op(drvr,
420+ buf, NULL, 0, arg, arglen,
421+ IOV_SET);
491422
492423 break;
493424 }
@@ -500,7 +431,8 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) · 6 unmodified lines
500431 }
501432
502433 #ifdef SHOW_EVENTS
503−static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
434+static void
435+brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
504436 {
505437 uint i, status, reason;
506438 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
512444 char *event_name;
513445 } event_names[] = {
514446 {
515− WLC_E_SET_SSID, "SET_SSID"}, {
516− WLC_E_JOIN, "JOIN"}, {
517− WLC_E_START, "START"}, {
518− WLC_E_AUTH, "AUTH"}, {
519− WLC_E_AUTH_IND, "AUTH_IND"}, {
520− WLC_E_DEAUTH, "DEAUTH"}, {
521− WLC_E_DEAUTH_IND, "DEAUTH_IND"}, {
522− WLC_E_ASSOC, "ASSOC"}, {
523− WLC_E_ASSOC_IND, "ASSOC_IND"}, {
524− WLC_E_REASSOC, "REASSOC"}, {
525− WLC_E_REASSOC_IND, "REASSOC_IND"}, {
526− WLC_E_DISASSOC, "DISASSOC"}, {
527− WLC_E_DISASSOC_IND, "DISASSOC_IND"}, {
528− WLC_E_QUIET_START, "START_QUIET"}, {
529− WLC_E_QUIET_END, "END_QUIET"}, {
530− WLC_E_BEACON_RX, "BEACON_RX"}, {
531− WLC_E_LINK, "LINK"}, {
532− WLC_E_MIC_ERROR, "MIC_ERROR"}, {
533− WLC_E_NDIS_LINK, "NDIS_LINK"}, {
534− WLC_E_ROAM, "ROAM"}, {
535− WLC_E_TXFAIL, "TXFAIL"}, {
536− WLC_E_PMKID_CACHE, "PMKID_CACHE"}, {
537− WLC_E_RETROGRADE_TSF, "RETROGRADE_TSF"}, {
538− WLC_E_PRUNE, "PRUNE"}, {
539− WLC_E_AUTOAUTH, "AUTOAUTH"}, {
540− WLC_E_EAPOL_MSG, "EAPOL_MSG"}, {
541− WLC_E_SCAN_COMPLETE, "SCAN_COMPLETE"}, {
542− WLC_E_ADDTS_IND, "ADDTS_IND"}, {
543− WLC_E_DELTS_IND, "DELTS_IND"}, {
544− WLC_E_BCNSENT_IND, "BCNSENT_IND"}, {
545− WLC_E_BCNRX_MSG, "BCNRX_MSG"}, {
546− WLC_E_BCNLOST_MSG, "BCNLOST_MSG"}, {
547− WLC_E_ROAM_PREP, "ROAM_PREP"}, {
548− WLC_E_PFN_NET_FOUND, "PNO_NET_FOUND"}, {
549− WLC_E_PFN_NET_LOST, "PNO_NET_LOST"}, {
550− WLC_E_RESET_COMPLETE, "RESET_COMPLETE"}, {
551− WLC_E_JOIN_START, "JOIN_START"}, {
552− WLC_E_ROAM_START, "ROAM_START"}, {
553− WLC_E_ASSOC_START, "ASSOC_START"}, {
554− WLC_E_IBSS_ASSOC, "IBSS_ASSOC"}, {
555− WLC_E_RADIO, "RADIO"}, {
556− WLC_E_PSM_WATCHDOG, "PSM_WATCHDOG"}, {
557− WLC_E_PROBREQ_MSG, "PROBREQ_MSG"}, {
558− WLC_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND"}, {
559− WLC_E_PSK_SUP, "PSK_SUP"}, {
560− WLC_E_COUNTRY_CODE_CHANGED, "COUNTRY_CODE_CHANGED"}, {
561− WLC_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME"}, {
562− WLC_E_ICV_ERROR, "ICV_ERROR"}, {
563− WLC_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR"}, {
564− WLC_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR"}, {
565− WLC_E_TRACE, "TRACE"}, {
566− WLC_E_ACTION_FRAME, "ACTION FRAME"}, {
567− WLC_E_ACTION_FRAME_COMPLETE, "ACTION FRAME TX COMPLETE"}, {
568− WLC_E_IF, "IF"}, {
569− WLC_E_RSSI, "RSSI"}, {
570− WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"}
447+ BRCMF_E_SET_SSID, "SET_SSID"}, {
448+ BRCMF_E_JOIN, "JOIN"}, {
449+ BRCMF_E_START, "START"}, {
450+ BRCMF_E_AUTH, "AUTH"}, {
451+ BRCMF_E_AUTH_IND, "AUTH_IND"}, {
452+ BRCMF_E_DEAUTH, "DEAUTH"}, {
453+ BRCMF_E_DEAUTH_IND, "DEAUTH_IND"}, {
454+ BRCMF_E_ASSOC, "ASSOC"}, {
455+ BRCMF_E_ASSOC_IND, "ASSOC_IND"}, {
456+ BRCMF_E_REASSOC, "REASSOC"}, {
457+ BRCMF_E_REASSOC_IND, "REASSOC_IND"}, {
458+ BRCMF_E_DISASSOC, "DISASSOC"}, {
459+ BRCMF_E_DISASSOC_IND, "DISASSOC_IND"}, {
460+ BRCMF_E_QUIET_START, "START_QUIET"}, {
461+ BRCMF_E_QUIET_END, "END_QUIET"}, {
462+ BRCMF_E_BEACON_RX, "BEACON_RX"}, {
463+ BRCMF_E_LINK, "LINK"}, {
464+ BRCMF_E_MIC_ERROR, "MIC_ERROR"}, {
465+ BRCMF_E_NDIS_LINK, "NDIS_LINK"}, {
466+ BRCMF_E_ROAM, "ROAM"}, {
467+ BRCMF_E_TXFAIL, "TXFAIL"}, {
468+ BRCMF_E_PMKID_CACHE, "PMKID_CACHE"}, {
469+ BRCMF_E_RETROGRADE_TSF, "RETROGRADE_TSF"}, {
470+ BRCMF_E_PRUNE, "PRUNE"}, {
471+ BRCMF_E_AUTOAUTH, "AUTOAUTH"}, {
472+ BRCMF_E_EAPOL_MSG, "EAPOL_MSG"}, {
473+ BRCMF_E_SCAN_COMPLETE, "SCAN_COMPLETE"}, {
474+ BRCMF_E_ADDTS_IND, "ADDTS_IND"}, {
475+ BRCMF_E_DELTS_IND, "DELTS_IND"}, {
476+ BRCMF_E_BCNSENT_IND, "BCNSENT_IND"}, {
477+ BRCMF_E_BCNRX_MSG, "BCNRX_MSG"}, {
478+ BRCMF_E_BCNLOST_MSG, "BCNLOST_MSG"}, {
479+ BRCMF_E_ROAM_PREP, "ROAM_PREP"}, {
480+ BRCMF_E_PFN_NET_FOUND, "PNO_NET_FOUND"}, {
481+ BRCMF_E_PFN_NET_LOST, "PNO_NET_LOST"}, {
482+ BRCMF_E_RESET_COMPLETE, "RESET_COMPLETE"}, {
483+ BRCMF_E_JOIN_START, "JOIN_START"}, {
484+ BRCMF_E_ROAM_START, "ROAM_START"}, {
485+ BRCMF_E_ASSOC_START, "ASSOC_START"}, {
486+ BRCMF_E_IBSS_ASSOC, "IBSS_ASSOC"}, {
487+ BRCMF_E_RADIO, "RADIO"}, {
488+ BRCMF_E_PSM_WATCHDOG, "PSM_WATCHDOG"}, {
489+ BRCMF_E_PROBREQ_MSG, "PROBREQ_MSG"}, {
490+ BRCMF_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND"}, {
491+ BRCMF_E_PSK_SUP, "PSK_SUP"}, {
492+ BRCMF_E_COUNTRY_CODE_CHANGED, "COUNTRY_CODE_CHANGED"}, {
493+ BRCMF_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME"}, {
494+ BRCMF_E_ICV_ERROR, "ICV_ERROR"}, {
495+ BRCMF_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR"}, {
496+ BRCMF_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR"}, {
497+ BRCMF_E_TRACE, "TRACE"}, {
498+ BRCMF_E_ACTION_FRAME, "ACTION FRAME"}, {
499+ BRCMF_E_ACTION_FRAME_COMPLETE, "ACTION FRAME TX COMPLETE"}, {
500+ BRCMF_E_IF, "IF"}, {
501+ BRCMF_E_RSSI, "RSSI"}, {
502+ BRCMF_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"}
571503 };
572504 uint event_type, flags, auth_type, datalen;
573505 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
585517 event_name = event_names[i].event_name;
586518 }
587519
588− DHD_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",
590− flags, status, reason, auth_type, eabuf));
520+ BRCMF_EVENT(("EVENT: %s, event ID = %d\n", event_name, event_type));
521+ BRCMF_EVENT(("flags 0x%04x, status %d, reason %d, auth_type %d"
522+ " MAC %s\n", flags, status, reason, auth_type, eabuf));
591523
592− if (flags & WLC_EVENT_MSG_LINK)
524+ if (flags & BRCMF_EVENT_MSG_LINK)
593525 link = true;
594− if (flags & WLC_EVENT_MSG_GROUP)
526+ if (flags & BRCMF_EVENT_MSG_GROUP)
595527 group = true;
596− if (flags & WLC_EVENT_MSG_FLUSHTXQ)
528+ if (flags & BRCMF_EVENT_MSG_FLUSHTXQ)
597529 flush_txq = true;
598530
599531 switch (event_type) {
600− case WLC_E_START:
601− case WLC_E_DEAUTH:
602− case WLC_E_DISASSOC:
603− DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));
532+ case BRCMF_E_START:
533+ case BRCMF_E_DEAUTH:
534+ case BRCMF_E_DISASSOC:
535+ BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));
604536 break;
605537
606− case WLC_E_ASSOC_IND:
607− case WLC_E_REASSOC_IND:
608− DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));
538+ case BRCMF_E_ASSOC_IND:
539+ case BRCMF_E_REASSOC_IND:
540+ BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));
609541 break;
610542
611− case WLC_E_ASSOC:
612− case WLC_E_REASSOC:
613− if (status == WLC_E_STATUS_SUCCESS) {
614− DHD_EVENT(("MACEVENT: %s, MAC %s, SUCCESS\n",
615− event_name, eabuf));
616− } else if (status == WLC_E_STATUS_TIMEOUT) {
617− DHD_EVENT(("MACEVENT: %s, MAC %s, TIMEOUT\n",
618− event_name, eabuf));
619− } else if (status == WLC_E_STATUS_FAIL) {
620− DHD_EVENT(("MACEVENT: %s, MAC %s, FAILURE, reason %d\n",
621− event_name, eabuf, (int)reason));
543+ case BRCMF_E_ASSOC:
544+ case BRCMF_E_REASSOC:
545+ if (status == BRCMF_E_STATUS_SUCCESS) {
546+ BRCMF_EVENT(("MACEVENT: %s, MAC %s, SUCCESS\n",
547+ event_name, eabuf));
548+ } else if (status == BRCMF_E_STATUS_TIMEOUT) {
549+ BRCMF_EVENT(("MACEVENT: %s, MAC %s, TIMEOUT\n",
550+ event_name, eabuf));
551+ } else if (status == BRCMF_E_STATUS_FAIL) {
552+ BRCMF_EVENT(("MACEVENT: %s, MAC %s, FAILURE,"
553+ " reason %d\n", event_name, eabuf,
554+ (int)reason));
622555 } else {
623− DHD_EVENT(("MACEVENT: %s, MAC %s, unexpected status "
624− "%d\n", event_name, eabuf, (int)status));
556+ BRCMF_EVENT(("MACEVENT: %s, MAC %s, unexpected status "
557+ "%d\n", event_name, eabuf, (int)status));
625558 }
626559 break;
627560
628− case WLC_E_DEAUTH_IND:
629− case WLC_E_DISASSOC_IND:
630− DHD_EVENT(("MACEVENT: %s, MAC %s, reason %d\n", event_name,
631− eabuf, (int)reason));
561+ case BRCMF_E_DEAUTH_IND:
562+ case BRCMF_E_DISASSOC_IND:
563+ BRCMF_EVENT(("MACEVENT: %s, MAC %s, reason %d\n", event_name,
564+ eabuf, (int)reason));
632565 break;
633566
634− case WLC_E_AUTH:
635− case WLC_E_AUTH_IND:
567+ case BRCMF_E_AUTH:
568+ case BRCMF_E_AUTH_IND:
636569 if (auth_type == WLAN_AUTH_OPEN)
637570 auth_str = "Open System";
638571 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
641574 sprintf(err_msg, "AUTH unknown: %d", (int)auth_type);
642575 auth_str = err_msg;
643576 }
644− if (event_type == WLC_E_AUTH_IND) {
645− DHD_EVENT(("MACEVENT: %s, MAC %s, %s\n", event_name,
646− eabuf, auth_str));
647− } else if (status == WLC_E_STATUS_SUCCESS) {
648− DHD_EVENT(("MACEVENT: %s, MAC %s, %s, SUCCESS\n",
649− event_name, eabuf, auth_str));
650− } else if (status == WLC_E_STATUS_TIMEOUT) {
651− DHD_EVENT(("MACEVENT: %s, MAC %s, %s, TIMEOUT\n",
652− event_name, eabuf, auth_str));
653− } else if (status == WLC_E_STATUS_FAIL) {
654− DHD_EVENT(("MACEVENT: %s, MAC %s, %s, FAILURE, "
655− "reason %d\n",
656− event_name, eabuf, auth_str, (int)reason));
577+ if (event_type == BRCMF_E_AUTH_IND) {
578+ BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s\n", event_name,
579+ eabuf, auth_str));
580+ } else if (status == BRCMF_E_STATUS_SUCCESS) {
581+ BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, SUCCESS\n",
582+ event_name, eabuf, auth_str));
583+ } else if (status == BRCMF_E_STATUS_TIMEOUT) {
584+ BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, TIMEOUT\n",
585+ event_name, eabuf, auth_str));
586+ } else if (status == BRCMF_E_STATUS_FAIL) {
587+ BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, FAILURE, "
588+ "reason %d\n",
589+ event_name, eabuf, auth_str, (int)reason));
657590 }
658591
659592 break;
660593
661− case WLC_E_JOIN:
662− case WLC_E_ROAM:
663− case WLC_E_SET_SSID:
664− if (status == WLC_E_STATUS_SUCCESS) {
665− DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name,
666− eabuf));
667− } else if (status == WLC_E_STATUS_FAIL) {
668− DHD_EVENT(("MACEVENT: %s, failed\n", event_name));
669− } else if (status == WLC_E_STATUS_NO_NETWORKS) {
670− DHD_EVENT(("MACEVENT: %s, no networks found\n",
671− event_name));
594+ case BRCMF_E_JOIN:
595+ case BRCMF_E_ROAM:
596+ case BRCMF_E_SET_SSID:
597+ if (status == BRCMF_E_STATUS_SUCCESS) {
598+ BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name,
599+ eabuf));
600+ } else if (status == BRCMF_E_STATUS_FAIL) {
601+ BRCMF_EVENT(("MACEVENT: %s, failed\n", event_name));
602+ } else if (status == BRCMF_E_STATUS_NO_NETWORKS) {
603+ BRCMF_EVENT(("MACEVENT: %s, no networks found\n",
604+ event_name));
672605 } else {
673− DHD_EVENT(("MACEVENT: %s, unexpected status %d\n",
674− event_name, (int)status));
606+ BRCMF_EVENT(("MACEVENT: %s, unexpected status %d\n",
607+ event_name, (int)status));
675608 }
676609 break;
677610
678− case WLC_E_BEACON_RX:
679− if (status == WLC_E_STATUS_SUCCESS) {
680− DHD_EVENT(("MACEVENT: %s, SUCCESS\n", event_name));
681− } else if (status == WLC_E_STATUS_FAIL) {
682− DHD_EVENT(("MACEVENT: %s, FAIL\n", event_name));
611+ case BRCMF_E_BEACON_RX:
612+ if (status == BRCMF_E_STATUS_SUCCESS) {
613+ BRCMF_EVENT(("MACEVENT: %s, SUCCESS\n", event_name));
614+ } else if (status == BRCMF_E_STATUS_FAIL) {
615+ BRCMF_EVENT(("MACEVENT: %s, FAIL\n", event_name));
683616 } else {
684− DHD_EVENT(("MACEVENT: %s, status %d\n", event_name,
685− status));
617+ BRCMF_EVENT(("MACEVENT: %s, status %d\n", event_name,
618+ status));
686619 }
687620 break;
688621
689− case WLC_E_LINK:
690− DHD_EVENT(("MACEVENT: %s %s\n", event_name,
691− link ? "UP" : "DOWN"));
622+ case BRCMF_E_LINK:
623+ BRCMF_EVENT(("MACEVENT: %s %s\n", event_name,
624+ link ? "UP" : "DOWN"));
692625 break;
693626
694− case WLC_E_MIC_ERROR:
695− DHD_EVENT(("MACEVENT: %s, MAC %s, Group %d, Flush %d\n",
696− event_name, eabuf, group, flush_txq));
627+ case BRCMF_E_MIC_ERROR:
628+ BRCMF_EVENT(("MACEVENT: %s, MAC %s, Group %d, Flush %d\n",
629+ event_name, eabuf, group, flush_txq));
697630 break;
698631
699− case WLC_E_ICV_ERROR:
700− case WLC_E_UNICAST_DECODE_ERROR:
701− case WLC_E_MULTICAST_DECODE_ERROR:
702− DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));
632+ case BRCMF_E_ICV_ERROR:
633+ case BRCMF_E_UNICAST_DECODE_ERROR:
634+ case BRCMF_E_MULTICAST_DECODE_ERROR:
635+ BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf));
703636 break;
704637
705− case WLC_E_TXFAIL:
706− DHD_EVENT(("MACEVENT: %s, RA %s\n", event_name, eabuf));
638+ case BRCMF_E_TXFAIL:
639+ BRCMF_EVENT(("MACEVENT: %s, RA %s\n", event_name, eabuf));
707640 break;
708641
709− case WLC_E_SCAN_COMPLETE:
710− case WLC_E_PMKID_CACHE:
711− DHD_EVENT(("MACEVENT: %s\n", event_name));
642+ case BRCMF_E_SCAN_COMPLETE:
643+ case BRCMF_E_PMKID_CACHE:
644+ BRCMF_EVENT(("MACEVENT: %s\n", event_name));
712645 break;
713646
714− case WLC_E_PFN_NET_FOUND:
715− case WLC_E_PFN_NET_LOST:
716− case WLC_E_PFN_SCAN_COMPLETE:
717− DHD_EVENT(("PNOEVENT: %s\n", event_name));
647+ case BRCMF_E_PFN_NET_FOUND:
648+ case BRCMF_E_PFN_NET_LOST:
649+ case BRCMF_E_PFN_SCAN_COMPLETE:
650+ BRCMF_EVENT(("PNOEVENT: %s\n", event_name));
718651 break;
719652
720− case WLC_E_PSK_SUP:
721− case WLC_E_PRUNE:
722− DHD_EVENT(("MACEVENT: %s, status %d, reason %d\n",
653+ case BRCMF_E_PSK_SUP:
654+ case BRCMF_E_PRUNE:
655+ BRCMF_EVENT(("MACEVENT: %s, status %d, reason %d\n",
723656 event_name, (int)status, (int)reason));
724657 break;
725658
726− case WLC_E_TRACE:
659+ case BRCMF_E_TRACE:
727660 {
728661 static u32 seqnum_prev;
729− msgtrace_hdr_t hdr;
662+ struct msgtrace_hdr hdr;
730663 u32 nblost;
731664 char *s, *p;
732665
733666 buf = (unsigned char *) event_data;
734− memcpy(&hdr, buf, MSGTRACE_HDRLEN);
667+ memcpy(&hdr, buf, sizeof(struct msgtrace_hdr));
735668
736669 if (hdr.version != MSGTRACE_VERSION) {
737− DHD_ERROR(
670+ BRCMF_ERROR(
738671 ("\nMACEVENT: %s [unsupported version --> "
739− "dhd version:%d dongle version:%d]\n",
672+ "brcmf version:%d dongle version:%d]\n",
740673 event_name, MSGTRACE_VERSION, hdr.version)
741674 );
742675 /* 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
745678 }
746679
747680 /* 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';
749683
750684 if (be32_to_cpu(hdr.discarded_bytes)
751685 || be32_to_cpu(hdr.discarded_printf)) {
752− DHD_ERROR(
686+ BRCMF_ERROR(
753687 ("\nWLC_E_TRACE: [Discarded traces in dongle -->"
754688 "discarded_bytes %d discarded_printf %d]\n",
755689 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
758692
759693 nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1;
760694 if (nblost > 0) {
761− DHD_ERROR(
695+ BRCMF_ERROR(
762696 ("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n",
763697 be32_to_cpu(hdr.seqnum), nblost));
764698 }
@@ -768,7 +702,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 3 unmodified lines
768702 * avoid display big
769703 * printf (issue with Linux printk )
770704 */
771− p = (char *)&buf[MSGTRACE_HDRLEN];
705+ p = (char *)&buf[sizeof(struct msgtrace_hdr)];
772706 while ((s = strstr(p, "\n")) != NULL) {
773707 *s = '\0';
774708 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
781715 }
782716 break;
783717
784− case WLC_E_RSSI:
785− DHD_EVENT(("MACEVENT: %s %d\n", event_name,
786− be32_to_cpu(*((int *)event_data))));
718+ case BRCMF_E_RSSI:
719+ BRCMF_EVENT(("MACEVENT: %s %d\n", event_name,
720+ be32_to_cpu(*((int *)event_data))));
787721 break;
788722
789723 default:
790− DHD_EVENT(("MACEVENT: %s %d, MAC %s, status %d, reason %d, "
791− "auth %d\n", event_name, event_type, eabuf,
792− (int)status, (int)reason, (int)auth_type));
724+ BRCMF_EVENT(("MACEVENT: %s %d, MAC %s, status %d, reason %d, "
725+ "auth %d\n", event_name, event_type, eabuf,
726+ (int)status, (int)reason, (int)auth_type));
793727 break;
794728 }
795729
796730 /* show any appended data */
797731 if (datalen) {
798732 buf = (unsigned char *) event_data;
799− DHD_EVENT((" data (%d) : ", datalen));
733+ BRCMF_EVENT((" data (%d) : ", datalen));
800734 for (i = 0; i < datalen; i++)
801− DHD_EVENT((" 0x%02x ", *buf++));
802− DHD_EVENT(("\n"));
735+ BRCMF_EVENT((" 0x%02x ", *buf++));
736+ BRCMF_EVENT(("\n"));
803737 }
804738 }
805739 #endif /* SHOW_EVENTS */
806740
807741 int
808−wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata,
809− wl_event_msg_t *event, void **data_ptr)
742+brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
743+ struct brcmf_event_msg *event, void **data_ptr)
810744 {
811745 /* 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;
813747 char *event_data;
814748 u32 type, status;
815749 u16 flags;
816750 int evlen;
817751
818− if (memcmp(BRCM_OUI, &pvt_data->bcm_hdr.oui[0], DOT11_OUI_LEN)) {
819− DHD_ERROR(("%s: mismatched OUI, bailing\n", __func__));
752+ if (memcmp(BRCM_OUI, &pvt_data->hdr.oui[0], DOT11_OUI_LEN)) {
753+ BRCMF_ERROR(("%s: mismatched OUI, bailing\n", __func__));
820754 return -EBADE;
821755 }
822756
823757 /* 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) !=
825759 BCMILCP_BCM_SUBTYPE_EVENT) {
826− DHD_ERROR(("%s: mismatched subtype, bailing\n", __func__));
760+ BRCMF_ERROR(("%s: mismatched subtype, bailing\n", __func__));
827761 return -EBADE;
828762 }
829763
@@ -831,93 +765,87 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata, · 1 unmodified line
831765 event_data = *data_ptr;
832766
833767 /* 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));
835769
836770 type = get_unaligned_be32(&event->event_type);
837771 flags = get_unaligned_be16(&event->flags);
838772 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);
840775
841776 switch (type) {
842− case WLC_E_IF:
777+ case BRCMF_E_IF:
843778 {
844− dhd_if_event_t *ifevent = (dhd_if_event_t *) event_data;
845− DHD_TRACE(("%s: if event\n", __func__));
779+ struct brcmf_if_event *ifevent =
780+ (struct brcmf_if_event *) event_data;
781+ BRCMF_TRACE(("%s: if event\n", __func__));
846782
847783 if (ifevent->ifidx > 0 &&
848− ifevent->ifidx < DHD_MAX_IFS) {
849− if (ifevent->action == WLC_E_IF_ADD)
850− dhd_add_if(dhd, ifevent->ifidx,
784+ ifevent->ifidx < BRCMF_MAX_IFS) {
785+ if (ifevent->action == BRCMF_E_IF_ADD)
786+ brcmf_add_if(drvr_priv, ifevent->ifidx,
851787 NULL, event->ifname,
852788 pvt_data->eth.h_dest,
853789 ifevent->flags,
854790 ifevent->bssidx);
855791 else
856− dhd_del_if(dhd, ifevent->ifidx);
792+ brcmf_del_if(drvr_priv, ifevent->ifidx);
857793 } else {
858− DHD_ERROR(("%s: Invalid ifidx %d for %s\n",
859− __func__, ifevent->ifidx,
860− event->ifname));
794+ BRCMF_ERROR(("%s: Invalid ifidx %d for %s\n",
795+ __func__, ifevent->ifidx,
796+ event->ifname));
861797 }
862798 }
863799 /* send up the if event: btamp user needs it */
864− *ifidx = dhd_ifname2idx(dhd, event->ifname);
865− /* push up to external supp/auth */
866− dhd_event(dhd, (char *)pvt_data, evlen, *ifidx);
800+ *ifidx = brcmf_ifname2idx(drvr_priv, event->ifname);
867801 break;
868802
869−#ifdef P2P
870− case WLC_E_NDIS_LINK:
871− break;
872−#endif
873− /* fall through */
874803 /* These are what external supplicant/authenticator wants */
875− case WLC_E_LINK:
876− case WLC_E_ASSOC_IND:
877− case WLC_E_REASSOC_IND:
878− case WLC_E_DISASSOC_IND:
879− case WLC_E_MIC_ERROR:
804+ case BRCMF_E_LINK:
805+ case BRCMF_E_ASSOC_IND:
806+ case BRCMF_E_REASSOC_IND:
807+ case BRCMF_E_DISASSOC_IND:
808+ case BRCMF_E_MIC_ERROR:
880809 default:
881810 /* Fall through: this should get _everything_ */
882811
883− *ifidx = dhd_ifname2idx(dhd, event->ifname);
884− /* push up to external supp/auth */
885− dhd_event(dhd, (char *)pvt_data, evlen, *ifidx);
886− DHD_TRACE(("%s: MAC event %d, flags %x, status %x\n",
887− __func__, type, flags, status));
812+ *ifidx = brcmf_ifname2idx(drvr_priv, event->ifname);
813+ BRCMF_TRACE(("%s: MAC event %d, flags %x, status %x\n",
814+ __func__, type, flags, status));
888815
889− /* put it back to WLC_E_NDIS_LINK */
890− if (type == WLC_E_NDIS_LINK) {
816+ /* put it back to BRCMF_E_NDIS_LINK */
817+ if (type == BRCMF_E_NDIS_LINK) {
891818 u32 temp;
892819
893820 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));
895823
896− temp = be32_to_cpu(WLC_E_NDIS_LINK);
897− memcpy((void *)(&pvt_data->event.event_type), &temp,
898− sizeof(pvt_data->event.event_type));
824+ temp = be32_to_cpu(BRCMF_E_NDIS_LINK);
825+ memcpy((void *)(&pvt_data->msg.event_type), &temp,
826+ sizeof(pvt_data->msg.event_type));
899827 }
900828 break;
901829 }
902830
903831 #ifdef SHOW_EVENTS
904− wl_show_host_event(event, event_data);
832+ brcmf_c_show_host_event(event, event_data);
905833 #endif /* SHOW_EVENTS */
906834
907835 return 0;
908836 }
909837
910838 /* Convert user's input in hex pattern to byte-size mask */
911−static int wl_pattern_atoh(char *src, char *dst)
839+static int brcmf_c_pattern_atoh(char *src, char *dst)
912840 {
913841 int i;
914842 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"));
916844 return -1;
917845 }
918846 src = src + 2; /* Skip past 0x */
919847 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"));
921849 return -1;
922850 }
923851 for (i = 0; *src != '\0'; i++) {
@@ -931,7 +859,7 @@ static int wl_pattern_atoh(char *src, char *dst) · 7 unmodified lines
931859 }
932860
933861 void
934−dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable,
862+brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable,
935863 int master_mode)
936864 {
937865 char *argv[8];
@@ -942,12 +870,12 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 4 unmodified lines
942870 char *arg_save = 0, *arg_org = 0;
943871 int rc;
944872 char buf[128];
945− wl_pkt_filter_enable_t enable_parm;
946− wl_pkt_filter_enable_t *pkt_filterp;
873+ struct brcmf_pkt_filter_enable enable_parm;
874+ struct brcmf_pkt_filter_enable *pkt_filterp;
947875
948876 arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);
949877 if (!arg_save) {
950− DHD_ERROR(("%s: kmalloc failed\n", __func__));
878+ BRCMF_ERROR(("%s: kmalloc failed\n", __func__));
951879 goto fail;
952880 }
953881 arg_org = arg_save;
@@ -957,7 +885,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 3 unmodified lines
957885
958886 i = 0;
959887 if (NULL == argv[i]) {
960− DHD_ERROR(("No args provided\n"));
888+ BRCMF_ERROR(("No args provided\n"));
961889 goto fail;
962890 }
963891
@@ -967,7 +895,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 3 unmodified lines
967895 buf[str_len] = '\0';
968896 buf_len = str_len + 1;
969897
970− pkt_filterp = (wl_pkt_filter_enable_t *) (buf + str_len + 1);
898+ pkt_filterp = (struct brcmf_pkt_filter_enable *) (buf + str_len + 1);
971899
972900 /* Parse packet filter id. */
973901 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
979907 memcpy((char *)pkt_filterp, &enable_parm, sizeof(enable_parm));
980908
981909 /* 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);
983911 rc = rc >= 0 ? 0 : rc;
984912 if (rc)
985− DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",
986− __func__, arg, rc));
913+ BRCMF_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",
914+ __func__, arg, rc));
987915 else
988− DHD_TRACE(("%s: successfully added pktfilter %s\n",
989− __func__, arg));
916+ BRCMF_TRACE(("%s: successfully added pktfilter %s\n",
917+ __func__, arg));
990918
991919 /* 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,
993921 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));
995924 rc = rc >= 0 ? 0 : rc;
996925 if (rc)
997− DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",
998− __func__, arg, rc));
926+ BRCMF_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",
927+ __func__, arg, rc));
999928
1000929 fail:
1001930 kfree(arg_org);
1002931 }
1003932
1004−void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
933+void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg)
1005934 {
1006935 const char *str;
1007− wl_pkt_filter_t pkt_filter;
1008− wl_pkt_filter_t *pkt_filterp;
936+ struct brcmf_pkt_filter pkt_filter;
937+ struct brcmf_pkt_filter *pkt_filterp;
1009938 int buf_len;
1010939 int str_len;
1011940 int rc;
@@ -1014,29 +943,22 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 2 unmodified lines
1014943 char *argv[8], *buf = 0;
1015944 int i = 0;
1016945 char *arg_save = 0, *arg_org = 0;
1017−#define BUF_SIZE 2048
1018946
1019947 arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);
1020948 if (!arg_save) {
1021− DHD_ERROR(("%s: kmalloc failed\n", __func__));
949+ BRCMF_ERROR(("%s: kmalloc failed\n", __func__));
1022950 goto fail;
1023951 }
1024952
1025953 arg_org = arg_save;
1026954
1027− buf = kmalloc(BUF_SIZE, GFP_ATOMIC);
955+ buf = kmalloc(PKTFILTER_BUF_SIZE, GFP_ATOMIC);
1028956 if (!buf) {
1029− DHD_ERROR(("%s: kmalloc failed\n", __func__));
957+ BRCMF_ERROR(("%s: kmalloc failed\n", __func__));
1030958 goto fail;
1031959 }
1032960
1033− memcpy(arg_save, arg, strlen(arg) + 1);
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− }
961+ strcpy(arg_save, arg);
1040962
1041963 argv[i] = strsep(&arg_save, " ");
1042964 while (argv[i++])
@@ -1044,23 +966,22 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line
1044966
1045967 i = 0;
1046968 if (NULL == argv[i]) {
1047− DHD_ERROR(("No args provided\n"));
969+ BRCMF_ERROR(("No args provided\n"));
1048970 goto fail;
1049971 }
1050972
1051973 str = "pkt_filter_add";
974+ strcpy(buf, str);
1052975 str_len = strlen(str);
1053− strncpy(buf, str, str_len);
1054− buf[str_len] = '\0';
1055976 buf_len = str_len + 1;
1056977
1057− pkt_filterp = (wl_pkt_filter_t *) (buf + str_len + 1);
978+ pkt_filterp = (struct brcmf_pkt_filter *) (buf + str_len + 1);
1058979
1059980 /* Parse packet filter id. */
1060981 pkt_filter.id = simple_strtoul(argv[i], NULL, 0);
1061982
1062983 if (NULL == argv[++i]) {
1063− DHD_ERROR(("Polarity not provided\n"));
984+ BRCMF_ERROR(("Polarity not provided\n"));
1064985 goto fail;
1065986 }
1066987
@@ -1068,7 +989,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line
1068989 pkt_filter.negate_match = simple_strtoul(argv[i], NULL, 0);
1069990
1070991 if (NULL == argv[++i]) {
1071− DHD_ERROR(("Filter type not provided\n"));
992+ BRCMF_ERROR(("Filter type not provided\n"));
1072993 goto fail;
1073994 }
1074995
@@ -1076,7 +997,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line
1076997 pkt_filter.type = simple_strtoul(argv[i], NULL, 0);
1077998
1078999 if (NULL == argv[++i]) {
1079− DHD_ERROR(("Offset not provided\n"));
1000+ BRCMF_ERROR(("Offset not provided\n"));
10801001 goto fail;
10811002 }
10821003
@@ -1084,34 +1005,34 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line
10841005 pkt_filter.u.pattern.offset = simple_strtoul(argv[i], NULL, 0);
10851006
10861007 if (NULL == argv[++i]) {
1087− DHD_ERROR(("Bitmask not provided\n"));
1008+ BRCMF_ERROR(("Bitmask not provided\n"));
10881009 goto fail;
10891010 }
10901011
10911012 /* Parse pattern filter mask. */
10921013 mask_size =
1093− wl_pattern_atoh
1014+ brcmf_c_pattern_atoh
10941015 (argv[i], (char *)pkt_filterp->u.pattern.mask_and_pattern);
10951016
10961017 if (NULL == argv[++i]) {
1097− DHD_ERROR(("Pattern not provided\n"));
1018+ BRCMF_ERROR(("Pattern not provided\n"));
10981019 goto fail;
10991020 }
11001021
11011022 /* Parse pattern filter pattern. */
11021023 pattern_size =
1103− wl_pattern_atoh(argv[i],
1024+ brcmf_c_pattern_atoh(argv[i],
11041025 (char *)&pkt_filterp->u.pattern.
11051026 mask_and_pattern[mask_size]);
11061027
11071028 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"));
11091030 goto fail;
11101031 }
11111032
11121033 pkt_filter.u.pattern.size_bytes = mask_size;
1113− buf_len += WL_PKT_FILTER_FIXED_LEN;
1114− buf_len += (WL_PKT_FILTER_PATTERN_FIXED_LEN + 2 * mask_size);
1034+ buf_len += BRCMF_PKT_FILTER_FIXED_LEN;
1035+ buf_len += (BRCMF_PKT_FILTER_PATTERN_FIXED_LEN + 2 * mask_size);
11151036
11161037 /* Keep-alive attributes are set in local
11171038 * variable (keep_alive_pkt), and
@@ -1120,17 +1041,17 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 2 unmodified lines
11201041 */
11211042 memcpy((char *)pkt_filterp,
11221043 &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);
11241045
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);
11261047 rc = rc >= 0 ? 0 : rc;
11271048
11281049 if (rc)
1129− DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",
1130− __func__, arg, rc));
1050+ BRCMF_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",
1051+ __func__, arg, rc));
11311052 else
1132− DHD_TRACE(("%s: successfully added pktfilter %s\n",
1133− __func__, arg));
1053+ BRCMF_TRACE(("%s: successfully added pktfilter %s\n",
1054+ __func__, arg));
11341055
11351056 fail:
11361057 kfree(arg_org);
@@ -1138,711 +1059,138 @@ fail: · 1 unmodified line
11381059 kfree(buf);
11391060 }
11401061
1141−void dhd_arp_offload_set(dhd_pub_t *dhd, int arp_mode)
1062+void brcmf_c_arp_offload_set(struct brcmf_pub *drvr, int arp_mode)
11421063 {
11431064 char iovbuf[32];
11441065 int retcode;
11451066
1146− bcm_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf));
1147− retcode = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
1067+ brcmu_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf));
1068+ retcode = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR,
1069+ iovbuf, sizeof(iovbuf));
11481070 retcode = retcode >= 0 ? 0 : retcode;
11491071 if (retcode)
1150− DHD_TRACE(("%s: failed to set ARP offload mode to 0x%x, "
1151− "retcode = %d\n", __func__, arp_mode, retcode));
1072+ BRCMF_TRACE(("%s: failed to set ARP offload mode to 0x%x, "
1073+ "retcode = %d\n", __func__, arp_mode, retcode));
11521074 else
1153− DHD_TRACE(("%s: successfully set ARP offload mode to 0x%x\n",
1154− __func__, arp_mode));
1075+ BRCMF_TRACE(("%s: successfully set ARP offload mode to 0x%x\n",
1076+ __func__, arp_mode));
11551077 }
11561078
1157−void dhd_arp_offload_enable(dhd_pub_t *dhd, int arp_enable)
1079+void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable)
11581080 {
11591081 char iovbuf[32];
11601082 int retcode;
11611083
1162− bcm_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf));
1163− retcode = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
1084+ brcmu_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf));
1085+ retcode = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR,
1086+ iovbuf, sizeof(iovbuf));
11641087 retcode = retcode >= 0 ? 0 : retcode;
11651088 if (retcode)
1166− DHD_TRACE(("%s: failed to enabe ARP offload to %d, "
1167− "retcode = %d\n", __func__, arp_enable, retcode));
1089+ BRCMF_TRACE(("%s: failed to enabe ARP offload to %d, "
1090+ "retcode = %d\n", __func__, arp_enable, retcode));
11681091 else
1169− DHD_TRACE(("%s: successfully enabed ARP offload to %d\n",
1170− __func__, arp_enable));
1092+ BRCMF_TRACE(("%s: successfully enabed ARP offload to %d\n",
1093+ __func__, arp_enable));
11711094 }
11721095
1173−int dhd_preinit_ioctls(dhd_pub_t *dhd)
1096+int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
11741097 {
1175− char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for
1098+ char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for
11761099 "event_msgs" + '\0' + bitvec */
11771100 uint up = 0;
11781101 char buf[128], *ptr;
11791102 uint power_mode = PM_FAST;
1180− u32 dongle_align = DHD_SDALIGN;
1103+ u32 dongle_align = BRCMF_SDALIGN;
11811104 u32 glom = 0;
11821105 uint bcn_timeout = 3;
11831106 int scan_assoc_time = 40;
11841107 int scan_unassoc_time = 40;
1185−#ifdef GET_CUSTOM_MAC_ENABLE
1186− int ret = 0;
1187− u8 ea_addr[ETH_ALEN];
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 */
1108+ int i;
1109+
1110+ brcmf_os_proto_block(drvr);
12121111
12131112 /* Set Country code */
1214− if (dhd->country_code[0] != 0) {
1215− if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_COUNTRY,
1216− dhd->country_code,
1217− sizeof(dhd->country_code)) < 0) {
1218− DHD_ERROR(("%s: country code setting failed\n",
1219− __func__));
1113+ if (drvr->country_code[0] != 0) {
1114+ if (brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_COUNTRY,
1115+ drvr->country_code,
1116+ sizeof(drvr->country_code)) < 0) {
1117+ BRCMF_ERROR(("%s: country code setting failed\n",
1118+ __func__));
12201119 }
12211120 }
12221121
12231122 /* query for 'ver' to get version info from firmware */
12241123 memset(buf, 0, sizeof(buf));
12251124 ptr = buf;
1226− bcm_mkiovar("ver", 0, 0, buf, sizeof(buf));
1227− dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf));
1125+ brcmu_mkiovar("ver", 0, 0, buf, sizeof(buf));
1126+ brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, buf, sizeof(buf));
12281127 strsep(&ptr, "\n");
12291128 /* Print fw version info */
1230− DHD_ERROR(("Firmware version = %s\n", buf));
1129+ BRCMF_ERROR(("Firmware version = %s\n", buf));
12311130
12321131 /* 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,
12341133 sizeof(power_mode));
12351134
12361135 /* 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,
12381137 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));
12401140
12411141 /* disable glom option per default */
1242− bcm_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf));
1243− dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
1142+ brcmu_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf));
1143+ brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
1144+ sizeof(iovbuf));
12441145
12451146 /* Setup timeout if Beacons are lost and roam is off to report
12461147 link down */
1247− bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf,
1148+ brcmu_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf,
12481149 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));
12501152
12511153 /* Enable/Disable build-in roaming to allowed ext supplicant to take
12521154 of romaing */
1253− bcm_mkiovar("roam_off", (char *)&dhd_roam, 4, iovbuf, sizeof(iovbuf));
1254− dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
1155+ brcmu_mkiovar("roam_off", (char *)&brcmf_roam, 4,
1156+ iovbuf, sizeof(iovbuf));
1157+ brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
1158+ sizeof(iovbuf));
12551159
12561160 /* Force STA UP */
1257− if (dhd_radio_up)
1258− dhdcdc_set_ioctl(dhd, 0, WLC_UP, (char *)&up, sizeof(up));
1161+ if (brcmf_radio_up)
1162+ brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_UP, (char *)&up,
1163+ sizeof(up));
12591164
12601165 /* Setup event_msgs */
1261− bcm_mkiovar("event_msgs", dhd->eventmask, WL_EVENTING_MASK_LEN, iovbuf,
1262− sizeof(iovbuf));
1263− dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
1166+ brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN,
1167+ iovbuf, sizeof(iovbuf));
1168+ brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
1169+ sizeof(iovbuf));
12641170
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,
12661172 (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,
12681174 (char *)&scan_unassoc_time, sizeof(scan_unassoc_time));
12691175
1270−#ifdef ARP_OFFLOAD_SUPPORT
12711176 /* Set and enable ARP offload feature */
1272− if (dhd_arp_enable)
1273− dhd_arp_offload_set(dhd, dhd_arp_mode);
1274− dhd_arp_offload_enable(dhd, dhd_arp_enable);
1275−#endif /* ARP_OFFLOAD_SUPPORT */
1276−
1277−#ifdef PKT_FILTER_SUPPORT
1278− {
1279− int i;
1280− /* Set up pkt filter */
1281− if (dhd_pkt_filter_enable) {
1282− for (i = 0; i < dhd->pktfilter_count; i++) {
1283− dhd_pktfilter_offload_set(dhd,
1284− dhd->pktfilter[i]);
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
1300−uint iscan_thread_id;
1301−iscan_buf_t *iscan_chain;
1302−
1303−iscan_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−
1332−fail:
1333− dhd_iscan_unlock();
1334− return iscanbuf_alloc;
1335−}
1336−
1337−void 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−
1375−iscan_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−*/
1384−int 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−
1429−done:
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−*/
1438−int 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− }
1177+ if (brcmf_arp_enable)
1178+ brcmf_c_arp_offload_set(drvr, brcmf_arp_mode);
1179+ brcmf_c_arp_offload_enable(drvr, brcmf_arp_enable);
1180+
1181+ /* Set up pkt filter */
1182+ if (brcmf_pkt_filter_enable) {
1183+ for (i = 0; i < drvr->pktfilter_count; i++) {
1184+ brcmf_c_pktfilter_offload_set(drvr,
1185+ drvr->pktfilter[i]);
1186+ brcmf_c_pktfilter_offload_enable(drvr,
1187+ drvr->pktfilter[i],
1188+ brcmf_pkt_filter_init,
1189+ brcmf_master_mode);
15351190 }
1536− iscan_cur = iscan_cur->next;
1537− l++;
1538− }
1539−
1540−done:
1541− dhd_iscan_unlock();
1542− return 0;
1543−}
1544−
1545−int 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;
15721191 }
15731192
1574− bi = results->bss_info;
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);
1193+ brcmf_os_proto_unblock(drvr);
15861194
1587− bi = (wl_bss_info_t *)((unsigned long)bi + bi->length);
1588− }
1589−
1590−done:
1591− DHD_ISCAN(("%s: Scan cache after delete\n", __func__));
1592− dhd_iscan_print_cache(iscan_cur);
1593− dhd_iscan_unlock();
15941195 return 0;
15951196 }
1596−
1597−void dhd_iscan_ind_scan_confirm(void *dhdp, bool status)
1598−{
1599−
1600− dhd_ind_scan_confirm(dhdp, status);
1601−}
1602−
1603−int 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−
1633−static 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−
1679−fail:
1680− return status;
1681−}
1682−#endif /* SIMPLE_ISCAN */
1683−
1684−#ifdef PNO_SUPPORT
1685−int 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−
1716−int 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 */
1747−int
1748−dhd_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−
1836−int 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
30−extern void bcm_wlan_power_off(int);
31−extern void bcm_wlan_power_on(int);
32−#endif /* CUSTOMER_HW */
33−#ifdef CUSTOMER_HW2
34−int wifi_set_carddetect(int on);
35−int wifi_set_power(int on, unsigned long msec);
36−int wifi_get_irq_number(unsigned long *irq_flags_ptr);
37−#endif
38−
39−#if defined(OOB_INTR_ONLY)
40−
41−#if defined(BCMLXSDMMC)
42−extern 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 */
50−static int dhd_oob_gpio_num = -1; /* GG 19 */
51−
52−module_param(dhd_oob_gpio_num, int, 0644);
53−MODULE_PARM_DESC(dhd_oob_gpio_num, "DHD oob gpio number");
54−
55−int 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 */
91−void 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 */
140−int 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
1414 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515 */
1616
17−#ifndef _dhd_dbg_
18−#define _dhd_dbg_
17+#ifndef _BRCMF_DBG_H_
18+#define _BRCMF_DBG_H_
1919
20−#if defined(DHD_DEBUG)
20+#if defined(BCMDBG)
2121
22−#define DHD_ERROR(args) \
23− do {if ((dhd_msg_level & DHD_ERROR_VAL) && (net_ratelimit())) \
22+#define BRCMF_ERROR(args) \
23+ do {if ((brcmf_msg_level & BRCMF_ERROR_VAL) && (net_ratelimit())) \
2424 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) \
2626 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) \
2828 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) \
3030 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) \
3232 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) \
3434 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) \
3636 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) \
3838 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) \
4040 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)
6341
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)
6547
66−#define DHD_ERROR(args) do {if (net_ratelimit()) printk args; } while (0)
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)
48+#else /* (defined BCMDBG) || (defined BCMDBG) */
7949
80−#define DHD_ERROR_ON() 0
81−#define DHD_TRACE_ON() 0
82−#define DHD_INFO_ON() 0
83−#define DHD_DATA_ON() 0
84−#define DHD_CTL_ON() 0
85−#define DHD_TIMER_ON() 0
86−#define DHD_HDRS_ON() 0
87−#define DHD_BYTES_ON() 0
88−#define DHD_INTR_ON() 0
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) */
50+#define BRCMF_ERROR(args) do {if (net_ratelimit()) printk args; } while (0)
51+#define BRCMF_TRACE(args)
52+#define BRCMF_INFO(args)
53+#define BRCMF_DATA(args)
54+#define BRCMF_CTL(args)
55+#define BRCMF_TIMER(args)
56+#define BRCMF_INTR(args)
57+#define BRCMF_GLOM(args)
58+#define BRCMF_EVENT(args)
9459
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
9665
97−#define DHD_NONE(args)
98−extern int dhd_msg_level;
66+#endif /* defined(BCMDBG) */
9967
100−/* Defines msg bits */
101−#include <dhdioctl.h>
68+extern int brcmf_msg_level;
10269
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
1414 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515 */
1616
17−#ifdef CONFIG_WIFI_CONTROL_FUNC
18−#include <linux/platform_device.h>
19−#endif
2017 #include <linux/init.h>
2118 #include <linux/kernel.h>
2219 #include <linux/kthread.h>
@@ -33,177 +30,32 @@ · 10 unmodified lines
3330 #include <linux/uaccess.h>
3431 #include <linux/interrupt.h>
3532 #include <linux/hardirq.h>
36−#include <bcmdefs.h>
37−#include <bcmutils.h>
38−
39−#include <dngl_stats.h>
40−#include <dhd.h>
41−#include <dhd_bus.h>
42−#include <dhd_proto.h>
43−#include <dhd_dbg.h>
44−
45−#include <wl_cfg80211.h>
46−
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−
53−struct semaphore wifi_control_sem;
54−
55−struct dhd_bus *g_bus;
56−
57−static struct wifi_platform_data *wifi_control_data;
58−static struct resource *wifi_irqres;
59−
60−int 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−
73−int 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−
81−int 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−
91−int 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−
101−static 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−
119−static 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−
134−static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
135−{
136− DHD_TRACE(("##> %s\n", __func__));
137− return 0;
138−}
139−
140−static int wifi_resume(struct platform_device *pdev)
141−{
142− DHD_TRACE(("##> %s\n", __func__));
143− return 0;
144−}
145−
146−static 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−
156−int wifi_add_dev(void)
157−{
158− DHD_TRACE(("## Calling platform_driver_register\n"));
159− return platform_driver_register(&wifi_device);
160−}
161−
162−void 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) */
33+#include <net/cfg80211.h>
34+#include <defs.h>
35+#include <brcmu_utils.h>
36+#include <brcmu_wifi.h>
37+
38+#include "dhd.h"
39+#include "dhd_bus.h"
40+#include "dhd_proto.h"
41+#include "dhd_dbg.h"
42+#include "wl_cfg80211.h"
43+#include "bcmchip.h"
16844
16945 #if defined(CONFIG_PM_SLEEP)
17046 #include <linux/suspend.h>
171−atomic_t dhd_mmc_suspend;
172−DECLARE_WAIT_QUEUE_HEAD(dhd_dpc_wait);
47+atomic_t brcmf_mmc_suspend;
17348 #endif /* defined(CONFIG_PM_SLEEP) */
17449
175−#if defined(OOB_INTR_ONLY)
176−extern void dhd_enable_oob_intr(struct dhd_bus *bus, bool enable);
177−#endif /* defined(OOB_INTR_ONLY) */
178−
17950 MODULE_AUTHOR("Broadcom Corporation");
18051 MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN fullmac driver.");
18152 MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN fullmac cards");
18253 MODULE_LICENSE("Dual BSD/GPL");
18354
184−#define DRV_MODULE_NAME "brcmfmac"
185−
186−/* Linux wireless extension support */
187−#if defined(CONFIG_WIRELESS_EXT)
188−#include <wl_iw.h>
189−extern 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>
194−extern 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
199−extern void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg);
200−extern void dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable,
201− int master_mode);
202−#endif
20355
20456 /* Interface control information */
205−typedef struct dhd_if {
206− struct dhd_info *info; /* back pointer to dhd_info */
57+struct brcmf_if {
58+ struct brcmf_info *info; /* back pointer to brcmf_info */
20759 /* OS/stack specifics */
20860 struct net_device *net;
20961 struct net_device_stats stats;
@@ -214,33 +66,17 @@ typedef struct dhd_if { · 4 unmodified lines
21466 bool attached; /* Delayed attachment when unset */
21567 bool txflowcontrol; /* Per interface flow control indicator */
21668 char name[IFNAMSIZ]; /* linux interface name */
217−} dhd_if_t;
69+};
21870
21971 /* Local private structure (extension of pub) */
220−typedef struct dhd_info {
221−#if defined(CONFIG_WIRELESS_EXT)
222− wl_iw_t iw; /* wireless extensions state (must be first) */
223−#endif /* defined(CONFIG_WIRELESS_EXT) */
224−
225− dhd_pub_t pub;
72+struct brcmf_info {
73+ struct brcmf_pub pub;
22674
22775 /* OS/stack specifics */
228− dhd_if_t *iflist[DHD_MAX_IFS];
76+ struct brcmf_if *iflist[BRCMF_MAX_IFS];
22977
23078 struct semaphore proto_sem;
23179 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;
24480
24581 /* Thread to issue ioctl for multicast */
24682 struct task_struct *sysioc_tsk;
@@ -248,83 +84,44 @@ typedef struct dhd_info { · 1 unmodified line
24884 bool set_multicast;
24985 bool set_macaddress;
25086 u8 macvalue[ETH_ALEN];
251− wait_queue_head_t ctrl_wait;
25287 atomic_t pend_8021x_cnt;
253−
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− */
262−char firmware_path[MOD_PARAM_PATHLEN];
263−char nvram_path[MOD_PARAM_PATHLEN];
264−
265−/* load firmware and/or nvram values from the filesystem */
266−module_param_string(firmware_path, firmware_path, MOD_PARAM_PATHLEN, 0);
267−module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0);
88+};
26889
26990 /* Error bits */
270−module_param(dhd_msg_level, int, 0);
91+module_param(brcmf_msg_level, int, 0);
27192
27293 /* Spawn a thread for system ioctls (set mac, set mcast) */
273−uint dhd_sysioc = true;
274−module_param(dhd_sysioc, uint, 0);
275−
276−/* Watchdog interval */
277−uint dhd_watchdog_ms = 10;
278−module_param(dhd_watchdog_ms, uint, 0);
279−
280−#ifdef DHD_DEBUG
281−/* Console poll interval */
282−uint dhd_console_ms;
283−module_param(dhd_console_ms, uint, 0);
284−#endif /* DHD_DEBUG */
94+uint brcmf_sysioc = true;
95+module_param(brcmf_sysioc, uint, 0);
28596
28697 /* ARP offload agent mode : Enable ARP Host Auto-Reply
28798 and ARP Peer Auto-Reply */
288−uint dhd_arp_mode = 0xb;
289−module_param(dhd_arp_mode, uint, 0);
99+uint brcmf_arp_mode = 0xb;
100+module_param(brcmf_arp_mode, uint, 0);
290101
291102 /* ARP offload enable */
292−uint dhd_arp_enable = true;
293−module_param(dhd_arp_enable, uint, 0);
103+uint brcmf_arp_enable = true;
104+module_param(brcmf_arp_enable, uint, 0);
294105
295106 /* Global Pkt filter enable control */
296−uint dhd_pkt_filter_enable = true;
297−module_param(dhd_pkt_filter_enable, uint, 0);
107+uint brcmf_pkt_filter_enable = true;
108+module_param(brcmf_pkt_filter_enable, uint, 0);
298109
299110 /* Pkt filter init setup */
300−uint dhd_pkt_filter_init;
301−module_param(dhd_pkt_filter_init, uint, 0);
111+uint brcmf_pkt_filter_init;
112+module_param(brcmf_pkt_filter_init, uint, 0);
302113
303114 /* Pkt filter mode control */
304−uint dhd_master_mode = true;
305−module_param(dhd_master_mode, uint, 1);
306−
307−/* Watchdog thread priority, -1 to use kernel timer */
308−int dhd_watchdog_prio = 97;
309−module_param(dhd_watchdog_prio, int, 0);
310−
311−/* DPC thread priority, -1 to use tasklet */
312−int dhd_dpc_prio = 98;
313−module_param(dhd_dpc_prio, int, 0);
115+uint brcmf_master_mode = true;
116+module_param(brcmf_master_mode, uint, 0);
314117
315−/* DPC thread priority, -1 to use tasklet */
316−extern int dhd_dongle_memsize;
317−module_param(dhd_dongle_memsize, int, 0);
118+module_param(brcmf_dongle_memsize, int, 0);
318119
319120 /* Contorl fw roaming */
320−#ifdef CUSTOMER_HW2
321−uint dhd_roam;
322−#else
323−uint dhd_roam = 1;
324−#endif
121+uint brcmf_roam = 1;
325122
326123 /* Control radio state */
327−uint dhd_radio_up = 1;
124+uint brcmf_radio_up = 1;
328125
329126 /* Network inteface name */
330127 char iface_name[IFNAMSIZ] = "wlan";
@@ -333,252 +130,58 @@ module_param_string(iface_name, iface_name, IFNAMSIZ, 0); · 2 unmodified lines
333130 /* The following are specific to the SDIO dongle */
334131
335132 /* IOCTL response timeout */
336−int dhd_ioctl_timeout_msec = IOCTL_RESP_TIMEOUT;
133+int brcmf_ioctl_timeout_msec = IOCTL_RESP_TIMEOUT;
337134
338135 /* Idle timeout for backplane clock */
339−int dhd_idletime = DHD_IDLETIME_TICKS;
340−module_param(dhd_idletime, int, 0);
136+int brcmf_idletime = BRCMF_IDLETIME_TICKS;
137+module_param(brcmf_idletime, int, 0);
341138
342139 /* Use polling */
343−uint dhd_poll = false;
344−module_param(dhd_poll, uint, 0);
345−
346−/* Use cfg80211 */
347−uint dhd_cfg80211 = true;
348−module_param(dhd_cfg80211, uint, 0);
140+uint brcmf_poll;
141+module_param(brcmf_poll, uint, 0);
349142
350143 /* Use interrupts */
351−uint dhd_intr = true;
352−module_param(dhd_intr, uint, 0);
144+uint brcmf_intr = true;
145+module_param(brcmf_intr, uint, 0);
353146
354147 /* SDIO Drive Strength (in milliamps) */
355−uint dhd_sdiod_drive_strength = 6;
356−module_param(dhd_sdiod_drive_strength, uint, 0);
148+uint brcmf_sdiod_drive_strength = 6;
149+module_param(brcmf_sdiod_drive_strength, uint, 0);
357150
358151 /* Tx/Rx bounds */
359−extern uint dhd_txbound;
360−extern uint dhd_rxbound;
361−module_param(dhd_txbound, uint, 0);
362−module_param(dhd_rxbound, uint, 0);
363−
364−/* Deferred transmits */
365−extern uint dhd_deferred_tx;
366−module_param(dhd_deferred_tx, uint, 0);
152+module_param(brcmf_txbound, uint, 0);
153+module_param(brcmf_rxbound, uint, 0);
367154
368155 #ifdef SDTEST
369156 /* Echo packet generator (pkts/s) */
370−uint dhd_pktgen;
371−module_param(dhd_pktgen, uint, 0);
157+uint brcmf_pktgen;
158+module_param(brcmf_pktgen, uint, 0);
372159
373160 /* Echo packet len (0 => sawtooth, max 2040) */
374−uint dhd_pktgen_len;
375−module_param(dhd_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
161+uint brcmf_pktgen_len;
162+module_param(brcmf_pktgen_len, uint, 0);
388163 #endif
389164
390−static void dhd_dpc(unsigned long data);
391−/* forward decl */
392−extern int dhd_wait_pend8021x(struct net_device *dev);
393−
394−#ifdef TOE
395−#ifndef BDC
396−#error TOE requires BDC
397−#endif /* !BDC */
398−static int dhd_toe_get(dhd_info_t *dhd, int idx, u32 *toe_ol);
399−static int dhd_toe_set(dhd_info_t *dhd, int idx, u32 toe_ol);
400−#endif /* TOE */
401−
402−static 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)
406−static 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−
422−static struct notifier_block dhd_sleep_pm_notifier = {
423− .notifier_call = dhd_sleep_pm_callback,
424− .priority = 0
425−};
426−
427−extern int register_pm_notifier(struct notifier_block *nb);
428−extern int unregister_pm_notifier(struct notifier_block *nb);
429−#endif /* defined(CONFIG_PM_SLEEP) */
430− /* && defined(DHD_GPL) */
431−static 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)
450−static 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−
534−static 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−
546−static 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−
557−static 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) */
165+static int brcmf_toe_get(struct brcmf_info *drvr_priv, int idx, u32 *toe_ol);
166+static int brcmf_toe_set(struct brcmf_info *drvr_priv, int idx, u32 toe_ol);
167+static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
168+ struct brcmf_event_msg *event_ptr,
169+ void **data_ptr);
567170
568171 /*
569172 * Generalized timeout mechanism. Uses spin sleep with exponential
570173 * back-off until
571174 * the sleep time reaches one jiffy, then switches over to task delay. Usage:
572175 *
573− * dhd_timeout_start(&tmo, usec);
574− * while (!dhd_timeout_expired(&tmo))
176+ * brcmf_timeout_start(&tmo, usec);
177+ * while (!brcmf_timeout_expired(&tmo))
575178 * if (poll_something())
576179 * break;
577− * if (dhd_timeout_expired(&tmo))
180+ * if (brcmf_timeout_expired(&tmo))
578181 * fatal();
579182 */
580183
581−void dhd_timeout_start(dhd_timeout_t *tmo, uint usec)
184+void brcmf_timeout_start(struct brcmf_timeout *tmo, uint usec)
582185 {
583186 tmo->limit = usec;
584187 tmo->increment = 0;
@@ -586,7 +189,7 @@ void dhd_timeout_start(dhd_timeout_t *tmo, uint usec) · 1 unmodified line
586189 tmo->tick = 1000000 / HZ;
587190 }
588191
589−int dhd_timeout_expired(dhd_timeout_t *tmo)
192+int brcmf_timeout_expired(struct brcmf_timeout *tmo)
590193 {
591194 /* Does nothing the first call */
592195 if (tmo->increment == 0) {
@@ -623,74 +226,68 @@ int dhd_timeout_expired(dhd_timeout_t *tmo) · 30 unmodified lines
623226 return 0;
624227 }
625228
626−static int dhd_net2idx(dhd_info_t *dhd, struct net_device *net)
229+static int brcmf_net2idx(struct brcmf_info *drvr_priv, struct net_device *net)
627230 {
628231 int i = 0;
629232
630− ASSERT(dhd);
631− while (i < DHD_MAX_IFS) {
632− if (dhd->iflist[i] && (dhd->iflist[i]->net == net))
233+ while (i < BRCMF_MAX_IFS) {
234+ if (drvr_priv->iflist[i] && (drvr_priv->iflist[i]->net == net))
633235 return i;
634236 i++;
635237 }
636238
637− return DHD_BAD_IF;
239+ return BRCMF_BAD_IF;
638240 }
639241
640−int dhd_ifname2idx(dhd_info_t *dhd, char *name)
242+int brcmf_ifname2idx(struct brcmf_info *drvr_priv, char *name)
641243 {
642− int i = DHD_MAX_IFS;
643−
644− ASSERT(dhd);
244+ int i = BRCMF_MAX_IFS;
645245
646246 if (name == NULL || *name == '\0')
647247 return 0;
648248
649249 while (--i > 0)
650− if (dhd->iflist[i]
651− && !strncmp(dhd->iflist[i]->name, name, IFNAMSIZ))
250+ if (drvr_priv->iflist[i]
251+ && !strncmp(drvr_priv->iflist[i]->name, name, IFNAMSIZ))
652252 break;
653253
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));
655255
656256 return i; /* default - the primary interface */
657257 }
658258
659−char *dhd_ifname(dhd_pub_t *dhdp, int ifidx)
259+char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
660260 {
661− dhd_info_t *dhd = (dhd_info_t *) dhdp->info;
662−
663− ASSERT(dhd);
261+ struct brcmf_info *drvr_priv = drvr->info;
664262
665− if (ifidx < 0 || ifidx >= DHD_MAX_IFS) {
666− DHD_ERROR(("%s: ifidx %d out of range\n", __func__, ifidx));
263+ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
264+ BRCMF_ERROR(("%s: ifidx %d out of range\n", __func__, ifidx));
667265 return "<if_bad>";
668266 }
669267
670− if (dhd->iflist[ifidx] == NULL) {
671− DHD_ERROR(("%s: null i/f %d\n", __func__, ifidx));
268+ if (drvr_priv->iflist[ifidx] == NULL) {
269+ BRCMF_ERROR(("%s: null i/f %d\n", __func__, ifidx));
672270 return "<if_null>";
673271 }
674272
675− if (dhd->iflist[ifidx]->net)
676− return dhd->iflist[ifidx]->net->name;
273+ if (drvr_priv->iflist[ifidx]->net)
274+ return drvr_priv->iflist[ifidx]->net->name;
677275
678276 return "<if_none>";
679277 }
680278
681−static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
279+static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
682280 {
683281 struct net_device *dev;
684282 struct netdev_hw_addr *ha;
685283 u32 allmulti, cnt;
686284
687− wl_ioctl_t ioc;
285+ struct brcmf_ioctl ioc;
688286 char *buf, *bufp;
689287 uint buflen;
690288 int ret;
691289
692− ASSERT(dhd && dhd->iflist[ifidx]);
693− dev = dhd->iflist[ifidx]->net;
290+ dev = drvr_priv->iflist[ifidx]->net;
694291 cnt = netdev_mc_count(dev);
695292
696293 /* 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
701298 buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETH_ALEN);
702299 bufp = buf = kmalloc(buflen, GFP_ATOMIC);
703300 if (!bufp) {
704− DHD_ERROR(("%s: out of memory for mcast_list, cnt %d\n",
705− dhd_ifname(&dhd->pub, ifidx), cnt));
301+ BRCMF_ERROR(("%s: out of memory for mcast_list, cnt %d\n",
302+ brcmf_ifname(&drvr_priv->pub, ifidx), cnt));
706303 return;
707304 }
708305
@@ -722,15 +319,15 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 13 unmodified lines
722319 }
723320
724321 memset(&ioc, 0, sizeof(ioc));
725− ioc.cmd = WLC_SET_VAR;
322+ ioc.cmd = BRCMF_C_SET_VAR;
726323 ioc.buf = buf;
727324 ioc.len = buflen;
728325 ioc.set = true;
729326
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);
731328 if (ret < 0) {
732− DHD_ERROR(("%s: set mcast_list failed, cnt %d\n",
733− dhd_ifname(&dhd->pub, ifidx), cnt));
329+ BRCMF_ERROR(("%s: set mcast_list failed, cnt %d\n",
330+ brcmf_ifname(&drvr_priv->pub, ifidx), cnt));
734331 allmulti = cnt ? true : allmulti;
735332 }
736333
@@ -744,32 +341,33 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 7 unmodified lines
744341 buflen = sizeof("allmulti") + sizeof(allmulti);
745342 buf = kmalloc(buflen, GFP_ATOMIC);
746343 if (!buf) {
747− DHD_ERROR(("%s: out of memory for allmulti\n",
748− dhd_ifname(&dhd->pub, ifidx)));
344+ BRCMF_ERROR(("%s: out of memory for allmulti\n",
345+ brcmf_ifname(&drvr_priv->pub, ifidx)));
749346 return;
750347 }
751348 allmulti = cpu_to_le32(allmulti);
752349
753− if (!bcm_mkiovar
350+ if (!brcmu_mkiovar
754351 ("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) {
755− DHD_ERROR(("%s: mkiovar failed for allmulti, datalen %d "
756− "buflen %u\n", dhd_ifname(&dhd->pub, ifidx),
757− (int)sizeof(allmulti), buflen));
352+ BRCMF_ERROR(("%s: mkiovar failed for allmulti, datalen %d "
353+ "buflen %u\n",
354+ brcmf_ifname(&drvr_priv->pub, ifidx),
355+ (int)sizeof(allmulti), buflen));
758356 kfree(buf);
759357 return;
760358 }
761359
762360 memset(&ioc, 0, sizeof(ioc));
763− ioc.cmd = WLC_SET_VAR;
361+ ioc.cmd = BRCMF_C_SET_VAR;
764362 ioc.buf = buf;
765363 ioc.len = buflen;
766364 ioc.set = true;
767365
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);
769367 if (ret < 0) {
770− DHD_ERROR(("%s: set allmulti %d failed\n",
771− dhd_ifname(&dhd->pub, ifidx),
772− le32_to_cpu(allmulti)));
368+ BRCMF_ERROR(("%s: set allmulti %d failed\n",
369+ brcmf_ifname(&drvr_priv->pub, ifidx),
370+ le32_to_cpu(allmulti)));
773371 }
774372
775373 kfree(buf);
@@ -781,45 +379,44 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 5 unmodified lines
781379 allmulti = cpu_to_le32(allmulti);
782380
783381 memset(&ioc, 0, sizeof(ioc));
784− ioc.cmd = WLC_SET_PROMISC;
382+ ioc.cmd = BRCMF_C_SET_PROMISC;
785383 ioc.buf = &allmulti;
786384 ioc.len = sizeof(allmulti);
787385 ioc.set = true;
788386
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);
790388 if (ret < 0) {
791− DHD_ERROR(("%s: set promisc %d failed\n",
792− dhd_ifname(&dhd->pub, ifidx),
793− le32_to_cpu(allmulti)));
389+ BRCMF_ERROR(("%s: set promisc %d failed\n",
390+ brcmf_ifname(&drvr_priv->pub, ifidx),
391+ le32_to_cpu(allmulti)));
794392 }
795393 }
796394
797−static int
798−_dhd_set_mac_address(dhd_info_t *dhd, int ifidx, u8 *addr)
395+static int _brcmf_set_mac_address(struct brcmf_info *drvr_priv, int ifidx, u8 *addr)
799396 {
800397 char buf[32];
801− wl_ioctl_t ioc;
398+ struct brcmf_ioctl ioc;
802399 int ret;
803400
804− DHD_TRACE(("%s enter\n", __func__));
805− if (!bcm_mkiovar
401+ BRCMF_TRACE(("%s enter\n", __func__));
402+ if (!brcmu_mkiovar
806403 ("cur_etheraddr", (char *)addr, ETH_ALEN, buf, 32)) {
807− DHD_ERROR(("%s: mkiovar failed for cur_etheraddr\n",
808− dhd_ifname(&dhd->pub, ifidx)));
404+ BRCMF_ERROR(("%s: mkiovar failed for cur_etheraddr\n",
405+ brcmf_ifname(&drvr_priv->pub, ifidx)));
809406 return -1;
810407 }
811408 memset(&ioc, 0, sizeof(ioc));
812− ioc.cmd = WLC_SET_VAR;
409+ ioc.cmd = BRCMF_C_SET_VAR;
813410 ioc.buf = buf;
814411 ioc.len = 32;
815412 ioc.set = true;
816413
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);
818415 if (ret < 0) {
819− DHD_ERROR(("%s: set cur_etheraddr failed\n",
820− dhd_ifname(&dhd->pub, ifidx)));
416+ BRCMF_ERROR(("%s: set cur_etheraddr failed\n",
417+ brcmf_ifname(&drvr_priv->pub, ifidx)));
821418 } else {
822− memcpy(dhd->iflist[ifidx]->net->dev_addr, addr, ETH_ALEN);
419+ memcpy(drvr_priv->iflist[ifidx]->net->dev_addr, addr, ETH_ALEN);
823420 }
824421
825422 return ret;
@@ -829,45 +426,44 @@ _dhd_set_mac_address(dhd_info_t *dhd, int ifidx, u8 *addr) · 3 unmodified lines
829426 extern struct net_device *ap_net_dev;
830427 #endif
831428
832−static void dhd_op_if(dhd_if_t *ifp)
429+/* Virtual interfaces only ((ifp && ifp->info && ifp->idx == true) */
430+static void brcmf_op_if(struct brcmf_if *ifp)
833431 {
834− dhd_info_t *dhd;
432+ struct brcmf_info *drvr_priv;
835433 int ret = 0, err = 0;
836434
837− ASSERT(ifp && ifp->info && ifp->idx); /* Virtual interfaces only */
838−
839− dhd = ifp->info;
435+ drvr_priv = ifp->info;
840436
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));
842438
843439 switch (ifp->state) {
844− case WLC_E_IF_ADD:
440+ case BRCMF_E_IF_ADD:
845441 /*
846442 * 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.
848444 */
849445 if (ifp->net != NULL) {
850− DHD_ERROR(("%s: ERROR: netdev:%s already exists, "
851− "try free & unregister\n",
852− __func__, ifp->net->name));
446+ BRCMF_ERROR(("%s: ERROR: netdev:%s already exists, "
447+ "try free & unregister\n",
448+ __func__, ifp->net->name));
853449 netif_stop_queue(ifp->net);
854450 unregister_netdev(ifp->net);
855451 free_netdev(ifp->net);
856452 }
857453 /* Allocate etherdev, including space for private structure */
858− ifp->net = alloc_etherdev(sizeof(dhd));
454+ ifp->net = alloc_etherdev(sizeof(drvr_priv));
859455 if (!ifp->net) {
860− DHD_ERROR(("%s: OOM - alloc_etherdev\n", __func__));
456+ BRCMF_ERROR(("%s: OOM - alloc_etherdev\n", __func__));
861457 ret = -ENOMEM;
862458 }
863459 if (ret == 0) {
864460 strcpy(ifp->net->name, ifp->name);
865− memcpy(netdev_priv(ifp->net), &dhd, sizeof(dhd));
866− err = dhd_net_attach(&dhd->pub, ifp->idx);
461+ memcpy(netdev_priv(ifp->net), &drvr_priv, sizeof(drvr_priv));
462+ err = brcmf_net_attach(&drvr_priv->pub, ifp->idx);
867463 if (err != 0) {
868− DHD_ERROR(("%s: dhd_net_attach failed, "
869− "err %d\n",
870− __func__, err));
464+ BRCMF_ERROR(("%s: brcmf_net_attach failed, "
465+ "err %d\n",
466+ __func__, err));
871467 ret = -EOPNOTSUPP;
872468 } else {
873469 #ifdef SOFTAP
@@ -882,26 +478,25 @@ static void dhd_op_if(dhd_if_t *ifp) · 8 unmodified lines
882478 wl0.1 is ready */
883479 up(&ap_eth_sema);
884480 #endif
885− DHD_TRACE(("\n ==== pid:%x, net_device for "
886− "if:%s created ===\n\n",
887− current->pid, ifp->net->name));
481+ BRCMF_TRACE(("\n ==== pid:%x, net_device for "
482+ "if:%s created ===\n\n",
483+ current->pid, ifp->net->name));
888484 ifp->state = 0;
889485 }
890486 }
891487 break;
892− case WLC_E_IF_DEL:
488+ case BRCMF_E_IF_DEL:
893489 if (ifp->net != NULL) {
894− DHD_TRACE(("\n%s: got 'WLC_E_IF_DEL' state\n",
895− __func__));
490+ BRCMF_TRACE(("\n%s: got 'WLC_E_IF_DEL' state\n",
491+ __func__));
896492 netif_stop_queue(ifp->net);
897493 unregister_netdev(ifp->net);
898− ret = DHD_DEL_IF; /* Make sure the free_netdev()
494+ ret = BRCMF_DEL_IF; /* Make sure the free_netdev()
899495 is called */
900496 }
901497 break;
902498 default:
903− DHD_ERROR(("%s: bad op %d\n", __func__, ifp->state));
904− ASSERT(!ifp->state);
499+ BRCMF_ERROR(("%s: bad op %d\n", __func__, ifp->state));
905500 break;
906501 }
907502
@@ -909,7 +504,7 @@ static void dhd_op_if(dhd_if_t *ifp) · 1 unmodified line
909504 if (ifp->net)
910505 free_netdev(ifp->net);
911506
912− dhd->iflist[ifp->idx] = NULL;
507+ drvr_priv->iflist[ifp->idx] = NULL;
913508 kfree(ifp);
914509 #ifdef SOFTAP
915510 if (ifp->net == ap_net_dev)
@@ -919,9 +514,9 @@ static void dhd_op_if(dhd_if_t *ifp) · 3 unmodified lines
919514 }
920515 }
921516
922−static int _dhd_sysioc_thread(void *data)
517+static int _brcmf_sysioc_thread(void *data)
923518 {
924− dhd_info_t *dhd = (dhd_info_t *) data;
519+ struct brcmf_info *drvr_priv = (struct brcmf_info *) data;
925520 int i;
926521 #ifdef SOFTAP
927522 bool in_ap = false;
@@ -929,46 +524,51 @@ static int _dhd_sysioc_thread(void *data) · 1 unmodified line
929524
930525 allow_signal(SIGTERM);
931526
932− while (down_interruptible(&dhd->sysioc_sem) == 0) {
527+ while (down_interruptible(&drvr_priv->sysioc_sem) == 0) {
933528 if (kthread_should_stop())
934529 break;
935− for (i = 0; i < DHD_MAX_IFS; i++) {
936− if (dhd->iflist[i]) {
530+ for (i = 0; i < BRCMF_MAX_IFS; i++) {
531+ struct brcmf_if *ifentry = drvr_priv->iflist[i];
532+ if (ifentry) {
937533 #ifdef SOFTAP
938534 in_ap = (ap_net_dev != NULL);
939535 #endif /* SOFTAP */
940− if (dhd->iflist[i]->state)
941− dhd_op_if(dhd->iflist[i]);
536+ if (ifentry->state)
537+ brcmf_op_if(ifentry);
942538 #ifdef SOFTAP
943− if (dhd->iflist[i] == NULL) {
944− DHD_TRACE(("\n\n %s: interface %d "
945− "removed!\n", __func__, i));
539+ if (drvr_priv->iflist[i] == NULL) {
540+ BRCMF_TRACE(("\n\n %s: interface %d "
541+ "removed!\n", __func__,
542+ i));
946543 continue;
947544 }
948545
949− if (in_ap && dhd->set_macaddress) {
950− DHD_TRACE(("attempt to set MAC for %s "
951− "in AP Mode," "blocked. \n",
952− dhd->iflist[i]->net->name));
953− dhd->set_macaddress = false;
546+ if (in_ap && drvr_priv->set_macaddress) {
547+ BRCMF_TRACE(("attempt to set MAC for"
548+ " %s in AP Mode,"
549+ " blocked.\n",
550+ ifentry->net->name));
551+ drvr_priv->set_macaddress = false;
954552 continue;
955553 }
956554
957− if (in_ap && dhd->set_multicast) {
958− DHD_TRACE(("attempt to set MULTICAST list for %s" "in AP Mode, blocked. \n",
959− dhd->iflist[i]->net->name));
960− dhd->set_multicast = false;
555+ if (in_ap && drvr_priv->set_multicast) {
556+ BRCMF_TRACE(("attempt to set MULTICAST "
557+ "list for %s in AP Mode, "
558+ "blocked.\n",
559+ ifentry->net->name));
560+ drvr_priv->set_multicast = false;
961561 continue;
962562 }
963563 #endif /* SOFTAP */
964− if (dhd->set_multicast) {
965− dhd->set_multicast = false;
966− _dhd_set_multicast_list(dhd, i);
564+ if (drvr_priv->set_multicast) {
565+ drvr_priv->set_multicast = false;
566+ _brcmf_set_multicast_list(drvr_priv, i);
967567 }
968− if (dhd->set_macaddress) {
969− dhd->set_macaddress = false;
970− _dhd_set_mac_address(dhd, i,
971− dhd->macvalue);
568+ if (drvr_priv->set_macaddress) {
569+ drvr_priv->set_macaddress = false;
570+ _brcmf_set_mac_address(drvr_priv, i,
571+ drvr_priv->macvalue);
972572 }
973573 }
974574 }
@@ -976,47 +576,44 @@ static int _dhd_sysioc_thread(void *data) · 1 unmodified line
976576 return 0;
977577 }
978578
979−static int dhd_set_mac_address(struct net_device *dev, void *addr)
579+static int brcmf_netdev_set_mac_address(struct net_device *dev, void *addr)
980580 {
981581 int ret = 0;
982582
983− dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(dev);
583+ struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(dev);
984584 struct sockaddr *sa = (struct sockaddr *)addr;
985585 int ifidx;
986586
987− ifidx = dhd_net2idx(dhd, dev);
988− if (ifidx == DHD_BAD_IF)
587+ ifidx = brcmf_net2idx(drvr_priv, dev);
588+ if (ifidx == BRCMF_BAD_IF)
989589 return -1;
990590
991− ASSERT(dhd->sysioc_tsk);
992− memcpy(&dhd->macvalue, sa->sa_data, ETH_ALEN);
993− dhd->set_macaddress = true;
994− up(&dhd->sysioc_sem);
591+ memcpy(&drvr_priv->macvalue, sa->sa_data, ETH_ALEN);
592+ drvr_priv->set_macaddress = true;
593+ up(&drvr_priv->sysioc_sem);
995594
996595 return ret;
997596 }
998597
999−static void dhd_set_multicast_list(struct net_device *dev)
598+static void brcmf_netdev_set_multicast_list(struct net_device *dev)
1000599 {
1001− dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(dev);
600+ struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(dev);
1002601 int ifidx;
1003602
1004− ifidx = dhd_net2idx(dhd, dev);
1005− if (ifidx == DHD_BAD_IF)
603+ ifidx = brcmf_net2idx(drvr_priv, dev);
604+ if (ifidx == BRCMF_BAD_IF)
1006605 return;
1007606
1008− ASSERT(dhd->sysioc_tsk);
1009− dhd->set_multicast = true;
1010− up(&dhd->sysioc_sem);
607+ drvr_priv->set_multicast = true;
608+ up(&drvr_priv->sysioc_sem);
1011609 }
1012610
1013−int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
611+int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx, struct sk_buff *pktbuf)
1014612 {
1015− int ret;
1016− dhd_info_t *dhd = (dhd_info_t *) (dhdp->info);
613+ struct brcmf_info *drvr_priv = drvr->info;
1017614
1018615 /* Reject if down */
1019− if (!dhdp->up || (dhdp->busstate == DHD_BUS_DOWN))
616+ if (!drvr->up || (drvr->busstate == BRCMF_BUS_DOWN))
1020617 return -ENODEV;
1021618
1022619 /* Update multicast statistic */
@@ -1025,143 +622,107 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf) · 2 unmodified lines
1025622 struct ethhdr *eh = (struct ethhdr *)pktdata;
1026623
1027624 if (is_multicast_ether_addr(eh->h_dest))
1028− dhdp->tx_multicast++;
625+ drvr->tx_multicast++;
1029626 if (ntohs(eh->h_proto) == ETH_P_PAE)
1030− atomic_inc(&dhd->pend_8021x_cnt);
627+ atomic_inc(&drvr_priv->pend_8021x_cnt);
1031628 }
1032629
1033630 /* If the protocol uses a data header, apply it */
1034− dhd_prot_hdrpush(dhdp, ifidx, pktbuf);
631+ brcmf_proto_hdrpush(drvr, ifidx, pktbuf);
1035632
1036633 /* Use bus module to send data frame */
1037−#ifdef BCMDBUS
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−
1046−static inline void *
1047−osl_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−
1054−static inline struct sk_buff *
1055−osl_pkt_tonative(void *pkt)
1056−{
1057− return (struct sk_buff *)pkt;
634+ return brcmf_sdbrcm_bus_txdata(drvr->bus, pktbuf);
1058635 }
1059−#define PKTTONATIVE(osh, pkt) \
1060− osl_pkt_tonative((pkt))
1061636
1062−static int dhd_start_xmit(struct sk_buff *skb, struct net_device *net)
637+static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *net)
1063638 {
1064639 int ret;
1065− void *pktbuf;
1066− dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
640+ struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
1067641 int ifidx;
1068642
1069− DHD_TRACE(("%s: Enter\n", __func__));
643+ BRCMF_TRACE(("%s: Enter\n", __func__));
1070644
1071645 /* Reject if down */
1072− if (!dhd->pub.up || (dhd->pub.busstate == DHD_BUS_DOWN)) {
1073− DHD_ERROR(("%s: xmit rejected pub.up=%d busstate=%d\n",
1074− __func__, dhd->pub.up, dhd->pub.busstate));
646+ if (!drvr_priv->pub.up || (drvr_priv->pub.busstate == BRCMF_BUS_DOWN)) {
647+ BRCMF_ERROR(("%s: xmit rejected pub.up=%d busstate=%d\n",
648+ __func__, drvr_priv->pub.up,
649+ drvr_priv->pub.busstate));
1075650 netif_stop_queue(net);
1076651 return -ENODEV;
1077652 }
1078653
1079− ifidx = dhd_net2idx(dhd, net);
1080− if (ifidx == DHD_BAD_IF) {
1081− DHD_ERROR(("%s: bad ifidx %d\n", __func__, ifidx));
654+ ifidx = brcmf_net2idx(drvr_priv, net);
655+ if (ifidx == BRCMF_BAD_IF) {
656+ BRCMF_ERROR(("%s: bad ifidx %d\n", __func__, ifidx));
1082657 netif_stop_queue(net);
1083658 return -ENODEV;
1084659 }
1085660
1086661 /* 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) {
1088663 struct sk_buff *skb2;
1089664
1090− DHD_INFO(("%s: insufficient headroom\n",
1091− dhd_ifname(&dhd->pub, ifidx)));
1092− dhd->pub.tx_realloc++;
1093− skb2 = skb_realloc_headroom(skb, dhd->pub.hdrlen);
665+ BRCMF_INFO(("%s: insufficient headroom\n",
666+ brcmf_ifname(&drvr_priv->pub, ifidx)));
667+ drvr_priv->pub.tx_realloc++;
668+ skb2 = skb_realloc_headroom(skb, drvr_priv->pub.hdrlen);
1094669 dev_kfree_skb(skb);
1095670 skb = skb2;
1096671 if (skb == NULL) {
1097− DHD_ERROR(("%s: skb_realloc_headroom failed\n",
1098− dhd_ifname(&dhd->pub, ifidx)));
672+ BRCMF_ERROR(("%s: skb_realloc_headroom failed\n",
673+ brcmf_ifname(&drvr_priv->pub, ifidx)));
1099674 ret = -ENOMEM;
1100675 goto done;
1101676 }
1102677 }
1103678
1104− /* Convert to packet */
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);
679+ ret = brcmf_sendpkt(&drvr_priv->pub, ifidx, skb);
1115680
1116681 done:
1117682 if (ret)
1118− dhd->pub.dstats.tx_dropped++;
683+ drvr_priv->pub.dstats.tx_dropped++;
1119684 else
1120− dhd->pub.tx_packets++;
685+ drvr_priv->pub.tx_packets++;
1121686
1122687 /* Return ok: we always eat the packet */
1123688 return 0;
1124689 }
1125690
1126−void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool state)
691+void brcmf_txflowcontrol(struct brcmf_pub *drvr, int ifidx, bool state)
1127692 {
1128693 struct net_device *net;
1129− dhd_info_t *dhd = dhdp->info;
694+ struct brcmf_info *drvr_priv = drvr->info;
1130695
1131− DHD_TRACE(("%s: Enter\n", __func__));
696+ BRCMF_TRACE(("%s: Enter\n", __func__));
1132697
1133− dhdp->txoff = state;
1134− ASSERT(dhd && dhd->iflist[ifidx]);
1135− net = dhd->iflist[ifidx]->net;
698+ drvr->txoff = state;
699+ net = drvr_priv->iflist[ifidx]->net;
1136700 if (state == ON)
1137701 netif_stop_queue(net);
1138702 else
1139703 netif_wake_queue(net);
1140704 }
1141705
1142−void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf,
706+void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, struct sk_buff *skb,
1143707 int numpkt)
1144708 {
1145− dhd_info_t *dhd = (dhd_info_t *) dhdp->info;
1146− struct sk_buff *skb;
709+ struct brcmf_info *drvr_priv = drvr->info;
1147710 unsigned char *eth;
1148711 uint len;
1149712 void *data;
1150713 struct sk_buff *pnext, *save_pktbuf;
1151714 int i;
1152− dhd_if_t *ifp;
1153− wl_event_msg_t event;
1154−
1155− DHD_TRACE(("%s: Enter\n", __func__));
715+ struct brcmf_if *ifp;
716+ struct brcmf_event_msg event;
1156717
1157− save_pktbuf = pktbuf;
718+ BRCMF_TRACE(("%s: Enter\n", __func__));
1158719
1159− for (i = 0; pktbuf && i < numpkt; i++, pktbuf = pnext) {
720+ save_pktbuf = skb;
1160721
1161− pnext = pktbuf->next;
1162− pktbuf->next = NULL;
722+ for (i = 0; skb && i < numpkt; i++, skb = pnext) {
1163723
1164− skb = PKTTONATIVE(dhdp->osh, pktbuf);
724+ pnext = skb->next;
725+ skb->next = NULL;
1165726
1166727 /* Get the protocol, maintain skb around eth_type_trans()
1167728 * 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
1178739 eth = skb->data;
1179740 len = skb->len;
1180741
1181− ifp = dhd->iflist[ifidx];
742+ ifp = drvr_priv->iflist[ifidx];
1182743 if (ifp == NULL)
1183− ifp = dhd->iflist[0];
744+ ifp = drvr_priv->iflist[0];
1184745
1185− ASSERT(ifp);
1186746 skb->dev = ifp->net;
1187747 skb->protocol = eth_type_trans(skb, skb->dev);
1188748
1189749 if (skb->pkt_type == PACKET_MULTICAST)
1190− dhd->pub.rx_multicast++;
750+ drvr_priv->pub.rx_multicast++;
1191751
1192752 skb->data = eth;
1193753 skb->len = len;
@@ -1196,20 +756,20 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, · 2 unmodified lines
1196756 skb_pull(skb, ETH_HLEN);
1197757
1198758 /* Process special event packets and then discard them */
1199− if (ntohs(skb->protocol) == ETH_P_BRCM)
1200− dhd_wl_host_event(dhd, &ifidx,
759+ if (ntohs(skb->protocol) == ETH_P_LINK_CTL)
760+ brcmf_host_event(drvr_priv, &ifidx,
1201761 skb_mac_header(skb),
1202762 &event, &data);
1203763
1204− ASSERT(ifidx < DHD_MAX_IFS && dhd->iflist[ifidx]);
1205− if (dhd->iflist[ifidx] && !dhd->iflist[ifidx]->state)
1206− ifp = dhd->iflist[ifidx];
764+ if (drvr_priv->iflist[ifidx] &&
765+ !drvr_priv->iflist[ifidx]->state)
766+ ifp = drvr_priv->iflist[ifidx];
1207767
1208768 if (ifp->net)
1209769 ifp->net->last_rx = jiffies;
1210770
1211− dhdp->dstats.rx_bytes += skb->len;
1212− dhdp->rx_packets++; /* Local count */
771+ drvr->dstats.rx_bytes += skb->len;
772+ drvr->rx_packets++; /* Local count */
1213773
1214774 if (in_interrupt()) {
1215775 netif_rx(skb);
@@ -1225,216 +785,83 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, · 9 unmodified lines
1225785 }
1226786 }
1227787
1228−void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx)
1229−{
1230− /* Linux version has nothing to do */
1231− return;
1232−}
1233−
1234−void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success)
788+void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp, bool success)
1235789 {
1236790 uint ifidx;
1237− dhd_info_t *dhd = (dhd_info_t *) (dhdp->info);
791+ struct brcmf_info *drvr_priv = drvr->info;
1238792 struct ethhdr *eh;
1239793 u16 type;
1240794
1241− dhd_prot_hdrpull(dhdp, &ifidx, txp);
795+ brcmf_proto_hdrpull(drvr, &ifidx, txp);
1242796
1243797 eh = (struct ethhdr *)(txp->data);
1244798 type = ntohs(eh->h_proto);
1245799
1246800 if (type == ETH_P_PAE)
1247− atomic_dec(&dhd->pend_8021x_cnt);
801+ atomic_dec(&drvr_priv->pend_8021x_cnt);
1248802
1249803 }
1250804
1251−static struct net_device_stats *dhd_get_stats(struct net_device *net)
805+static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *net)
1252806 {
1253− dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
1254− dhd_if_t *ifp;
807+ struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
808+ struct brcmf_if *ifp;
1255809 int ifidx;
1256810
1257− DHD_TRACE(("%s: Enter\n", __func__));
811+ BRCMF_TRACE(("%s: Enter\n", __func__));
1258812
1259− ifidx = dhd_net2idx(dhd, net);
1260− if (ifidx == DHD_BAD_IF)
813+ ifidx = brcmf_net2idx(drvr_priv, net);
814+ if (ifidx == BRCMF_BAD_IF)
1261815 return NULL;
1262816
1263− ifp = dhd->iflist[ifidx];
1264− ASSERT(dhd && ifp);
817+ ifp = drvr_priv->iflist[ifidx];
1265818
1266− if (dhd->pub.up) {
819+ if (drvr_priv->pub.up) {
1267820 /* Use the protocol to get dongle stats */
1268− dhd_prot_dstats(&dhd->pub);
821+ brcmf_proto_dstats(&drvr_priv->pub);
1269822 }
1270823
1271824 /* Copy dongle stats to net device stats */
1272− ifp->stats.rx_packets = dhd->pub.dstats.rx_packets;
1273− ifp->stats.tx_packets = dhd->pub.dstats.tx_packets;
1274− ifp->stats.rx_bytes = dhd->pub.dstats.rx_bytes;
1275− ifp->stats.tx_bytes = dhd->pub.dstats.tx_bytes;
1276− ifp->stats.rx_errors = dhd->pub.dstats.rx_errors;
1277− ifp->stats.tx_errors = dhd->pub.dstats.tx_errors;
1278− ifp->stats.rx_dropped = dhd->pub.dstats.rx_dropped;
1279− ifp->stats.tx_dropped = dhd->pub.dstats.tx_dropped;
1280− ifp->stats.multicast = dhd->pub.dstats.multicast;
825+ ifp->stats.rx_packets = drvr_priv->pub.dstats.rx_packets;
826+ ifp->stats.tx_packets = drvr_priv->pub.dstats.tx_packets;
827+ ifp->stats.rx_bytes = drvr_priv->pub.dstats.rx_bytes;
828+ ifp->stats.tx_bytes = drvr_priv->pub.dstats.tx_bytes;
829+ ifp->stats.rx_errors = drvr_priv->pub.dstats.rx_errors;
830+ ifp->stats.tx_errors = drvr_priv->pub.dstats.tx_errors;
831+ ifp->stats.rx_dropped = drvr_priv->pub.dstats.rx_dropped;
832+ ifp->stats.tx_dropped = drvr_priv->pub.dstats.tx_dropped;
833+ ifp->stats.multicast = drvr_priv->pub.dstats.multicast;
1281834
1282835 return &ifp->stats;
1283836 }
1284837
1285−static 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−
1319−static 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−
1345−static 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−
1383−static 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−
1398−void 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
1411838 /* Retrieve current toe component enables, which are kept
1412839 as a bitmap in toe_ol iovar */
1413−static int dhd_toe_get(dhd_info_t *dhd, int ifidx, u32 *toe_ol)
840+static int brcmf_toe_get(struct brcmf_info *drvr_priv, int ifidx, u32 *toe_ol)
1414841 {
1415− wl_ioctl_t ioc;
842+ struct brcmf_ioctl ioc;
1416843 char buf[32];
1417844 int ret;
1418845
1419846 memset(&ioc, 0, sizeof(ioc));
1420847
1421− ioc.cmd = WLC_GET_VAR;
848+ ioc.cmd = BRCMF_C_GET_VAR;
1422849 ioc.buf = buf;
1423850 ioc.len = (uint) sizeof(buf);
1424851 ioc.set = false;
1425852
1426853 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);
1428855 if (ret < 0) {
1429856 /* Check for older dongle image that doesn't support toe_ol */
1430857 if (ret == -EIO) {
1431− DHD_ERROR(("%s: toe not supported by device\n",
1432− dhd_ifname(&dhd->pub, ifidx)));
858+ BRCMF_ERROR(("%s: toe not supported by device\n",
859+ brcmf_ifname(&drvr_priv->pub, ifidx)));
1433860 return -EOPNOTSUPP;
1434861 }
1435862
1436− DHD_INFO(("%s: could not get toe_ol: ret=%d\n",
1437− dhd_ifname(&dhd->pub, ifidx), ret));
863+ BRCMF_INFO(("%s: could not get toe_ol: ret=%d\n",
864+ brcmf_ifname(&drvr_priv->pub, ifidx), ret));
1438865 return ret;
1439866 }
1440867
@@ -1444,15 +871,15 @@ static int dhd_toe_get(dhd_info_t *dhd, int ifidx, u32 *toe_ol) · 3 unmodified lines
1444871
1445872 /* Set current toe component enables in toe_ol iovar,
1446873 and set toe global enable iovar */
1447−static int dhd_toe_set(dhd_info_t *dhd, int ifidx, u32 toe_ol)
874+static int brcmf_toe_set(struct brcmf_info *drvr_priv, int ifidx, u32 toe_ol)
1448875 {
1449− wl_ioctl_t ioc;
876+ struct brcmf_ioctl ioc;
1450877 char buf[32];
1451878 int toe, ret;
1452879
1453880 memset(&ioc, 0, sizeof(ioc));
1454881
1455− ioc.cmd = WLC_SET_VAR;
882+ ioc.cmd = BRCMF_C_SET_VAR;
1456883 ioc.buf = buf;
1457884 ioc.len = (uint) sizeof(buf);
1458885 ioc.set = true;
@@ -1462,10 +889,10 @@ static int dhd_toe_set(dhd_info_t *dhd, int ifidx, u32 toe_ol) · 3 unmodified lines
1462889 strcpy(buf, "toe_ol");
1463890 memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(u32));
1464891
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);
1466893 if (ret < 0) {
1467− DHD_ERROR(("%s: could not set toe_ol: ret=%d\n",
1468− dhd_ifname(&dhd->pub, ifidx), ret));
894+ BRCMF_ERROR(("%s: could not set toe_ol: ret=%d\n",
895+ brcmf_ifname(&drvr_priv->pub, ifidx), ret));
1469896 return ret;
1470897 }
1471898
@@ -1476,44 +903,42 @@ static int dhd_toe_set(dhd_info_t *dhd, int ifidx, u32 toe_ol) · 4 unmodified lines
1476903 strcpy(buf, "toe");
1477904 memcpy(&buf[sizeof("toe")], &toe, sizeof(u32));
1478905
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);
1480907 if (ret < 0) {
1481− DHD_ERROR(("%s: could not set toe: ret=%d\n",
1482− dhd_ifname(&dhd->pub, ifidx), ret));
908+ BRCMF_ERROR(("%s: could not set toe: ret=%d\n",
909+ brcmf_ifname(&drvr_priv->pub, ifidx), ret));
1483910 return ret;
1484911 }
1485912
1486913 return 0;
1487914 }
1488−#endif /* TOE */
1489915
1490−static void dhd_ethtool_get_drvinfo(struct net_device *net,
916+static void brcmf_ethtool_get_drvinfo(struct net_device *net,
1491917 struct ethtool_drvinfo *info)
1492918 {
1493− dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
919+ struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
1494920
1495− sprintf(info->driver, DRV_MODULE_NAME);
1496− sprintf(info->version, "%lu", dhd->pub.drv_version);
1497− sprintf(info->fw_version, "%s", wl_cfg80211_get_fwname());
1498− sprintf(info->bus_info, "%s", dev_name(&wl_cfg80211_get_sdio_func()->dev));
921+ sprintf(info->driver, KBUILD_MODNAME);
922+ sprintf(info->version, "%lu", drvr_priv->pub.drv_version);
923+ sprintf(info->fw_version, "%s", BCM4329_FW_NAME);
924+ sprintf(info->bus_info, "%s",
925+ dev_name(&brcmf_cfg80211_get_sdio_func()->dev));
1499926 }
1500927
1501−struct ethtool_ops dhd_ethtool_ops = {
1502− .get_drvinfo = dhd_ethtool_get_drvinfo
928+struct ethtool_ops brcmf_ethtool_ops = {
929+ .get_drvinfo = brcmf_ethtool_get_drvinfo
1503930 };
1504931
1505−static int dhd_ethtool(dhd_info_t *dhd, void *uaddr)
932+static int brcmf_ethtool(struct brcmf_info *drvr_priv, void *uaddr)
1506933 {
1507934 struct ethtool_drvinfo info;
1508935 char drvname[sizeof(info.driver)];
1509936 u32 cmd;
1510−#ifdef TOE
1511937 struct ethtool_value edata;
1512938 u32 toe_cmpnt, csum_dir;
1513939 int ret;
1514−#endif
1515940
1516− DHD_TRACE(("%s: Enter\n", __func__));
941+ BRCMF_TRACE(("%s: Enter\n", __func__));
1517942
1518943 /* all ethtool calls start with a cmd word */
1519944 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
1531956 memset(&info, 0, sizeof(info));
1532957 info.cmd = cmd;
1533958
1534− /* if dhd requested, identify ourselves */
959+ /* if requested, identify ourselves */
1535960 if (strcmp(drvname, "?dhd") == 0) {
1536961 sprintf(info.driver, "dhd");
1537− strcpy(info.version, EPI_VERSION_STR);
962+ strcpy(info.version, BRCMF_VERSION_STR);
1538963 }
1539964
1540965 /* otherwise, require dongle to be up */
1541− else if (!dhd->pub.up) {
1542− DHD_ERROR(("%s: dongle is not up\n", __func__));
966+ else if (!drvr_priv->pub.up) {
967+ BRCMF_ERROR(("%s: dongle is not up\n", __func__));
1543968 return -ENODEV;
1544969 }
1545970
1546971 /* finally, report dongle driver type */
1547− else if (dhd->pub.iswl)
972+ else if (drvr_priv->pub.iswl)
1548973 sprintf(info.driver, "wl");
1549974 else
1550975 sprintf(info.driver, "xx");
1551976
1552− sprintf(info.version, "%lu", dhd->pub.drv_version);
977+ sprintf(info.version, "%lu", drvr_priv->pub.drv_version);
1553978 if (copy_to_user(uaddr, &info, sizeof(info)))
1554979 return -EFAULT;
1555− DHD_CTL(("%s: given %*s, returning %s\n", __func__,
1556− (int)sizeof(drvname), drvname, info.driver));
980+ BRCMF_CTL(("%s: given %*s, returning %s\n", __func__,
981+ (int)sizeof(drvname), drvname, info.driver));
1557982 break;
1558983
1559−#ifdef TOE
1560984 /* Get toe offload components from dongle */
1561985 case ETHTOOL_GRXCSUM:
1562986 case ETHTOOL_GTXCSUM:
1563− ret = dhd_toe_get(dhd, 0, &toe_cmpnt);
987+ ret = brcmf_toe_get(drvr_priv, 0, &toe_cmpnt);
1564988 if (ret < 0)
1565989 return ret;
1566990
@@ -1581,7 +1005,7 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 14 unmodified lines
15811005 return -EFAULT;
15821006
15831007 /* 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);
15851009 if (ret < 0)
15861010 return ret;
15871011
@@ -1593,22 +1017,21 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 5 unmodified lines
15931017 else
15941018 toe_cmpnt &= ~csum_dir;
15951019
1596− ret = dhd_toe_set(dhd, 0, toe_cmpnt);
1020+ ret = brcmf_toe_set(drvr_priv, 0, toe_cmpnt);
15971021 if (ret < 0)
15981022 return ret;
15991023
16001024 /* If setting TX checksum mode, tell Linux the new mode */
16011025 if (cmd == ETHTOOL_STXCSUM) {
16021026 if (edata.data)
1603− dhd->iflist[0]->net->features |=
1027+ drvr_priv->iflist[0]->net->features |=
16041028 NETIF_F_IP_CSUM;
16051029 else
1606− dhd->iflist[0]->net->features &=
1030+ drvr_priv->iflist[0]->net->features &=
16071031 ~NETIF_F_IP_CSUM;
16081032 }
16091033
16101034 break;
1611−#endif /* TOE */
16121035
16131036 default:
16141037 return -EOPNOTSUPP;
@@ -1617,10 +1040,11 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 2 unmodified lines
16171040 return 0;
16181041 }
16191042
1620−static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
1043+static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr,
1044+ int cmd)
16211045 {
1622− dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
1623− dhd_ioctl_t ioc;
1046+ struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
1047+ struct brcmf_c_ioctl ioc;
16241048 int bcmerror = 0;
16251049 int buflen = 0;
16261050 void *buf = NULL;
@@ -1628,22 +1052,14 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 1 unmodified line
16281052 int ifidx;
16291053 bool is_set_key_cmd;
16301054
1631− ifidx = dhd_net2idx(dhd, net);
1632− DHD_TRACE(("%s: ifidx %d, cmd 0x%04x\n", __func__, ifidx, cmd));
1055+ ifidx = brcmf_net2idx(drvr_priv, net);
1056+ BRCMF_TRACE(("%s: ifidx %d, cmd 0x%04x\n", __func__, ifidx, cmd));
16331057
1634− if (ifidx == DHD_BAD_IF)
1058+ if (ifidx == BRCMF_BAD_IF)
16351059 return -1;
16361060
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−
16451061 if (cmd == SIOCETHTOOL)
1646− return dhd_ethtool(dhd, (void *)ifr->ifr_data);
1062+ return brcmf_ethtool(drvr_priv, (void *)ifr->ifr_data);
16471063
16481064 if (cmd != SIOCDEVPRIVATE)
16491065 return -EOPNOTSUPP;
@@ -1651,14 +1067,14 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 1 unmodified line
16511067 memset(&ioc, 0, sizeof(ioc));
16521068
16531069 /* 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))) {
16551071 bcmerror = -EINVAL;
16561072 goto done;
16571073 }
16581074
16591075 /* Copy out any buffer passed */
16601076 if (ioc.buf) {
1661− buflen = min_t(int, ioc.len, DHD_IOCTL_MAXLEN);
1077+ buflen = min_t(int, ioc.len, BRCMF_IOCTL_MAXLEN);
16621078 /* optimization for direct ioctl calls from kernel */
16631079 /*
16641080 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
16781094 }
16791095 }
16801096
1681− /* To differentiate between wl and dhd read 4 more byes */
1682− if ((copy_from_user(&driver, (char *)ifr->ifr_data + sizeof(wl_ioctl_t),
1683− sizeof(uint)) != 0)) {
1097+ /* To differentiate read 4 more byes */
1098+ if ((copy_from_user(&driver, (char *)ifr->ifr_data +
1099+ sizeof(struct brcmf_ioctl), sizeof(uint)) != 0)) {
16841100 bcmerror = -EINVAL;
16851101 goto done;
16861102 }
@@ -1690,39 +1106,41 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 3 unmodified lines
16901106 goto done;
16911107 }
16921108
1693− /* check for local dhd ioctl and handle it */
1694− if (driver == DHD_IOCTL_MAGIC) {
1695− bcmerror = dhd_ioctl((void *)&dhd->pub, &ioc, buf, buflen);
1109+ /* check for local brcmf ioctl and handle it */
1110+ if (driver == BRCMF_IOCTL_MAGIC) {
1111+ bcmerror = brcmf_c_ioctl((void *)&drvr_priv->pub, &ioc, buf, buflen);
16961112 if (bcmerror)
1697− dhd->pub.bcmerror = bcmerror;
1113+ drvr_priv->pub.bcmerror = bcmerror;
16981114 goto done;
16991115 }
17001116
17011117 /* send to dongle (must be up, and wl) */
1702− if ((dhd->pub.busstate != DHD_BUS_DATA)) {
1703− DHD_ERROR(("%s DONGLE_DOWN,__func__\n", __func__));
1118+ if ((drvr_priv->pub.busstate != BRCMF_BUS_DATA)) {
1119+ BRCMF_ERROR(("%s DONGLE_DOWN,__func__\n", __func__));
17041120 bcmerror = -EIO;
17051121 goto done;
17061122 }
17071123
1708− if (!dhd->pub.iswl) {
1124+ if (!drvr_priv->pub.iswl) {
17091125 bcmerror = -EIO;
17101126 goto done;
17111127 }
17121128
1713− /* Intercept WLC_SET_KEY IOCTL - serialize M4 send and set key IOCTL to
1714− * prevent M4 encryption.
1129+ /*
1130+ * Intercept BRCMF_C_SET_KEY IOCTL - serialize M4 send and
1131+ * set key IOCTL to prevent M4 encryption.
17151132 */
1716− is_set_key_cmd = ((ioc.cmd == WLC_SET_KEY) ||
1717− ((ioc.cmd == WLC_SET_VAR) &&
1133+ is_set_key_cmd = ((ioc.cmd == BRCMF_C_SET_KEY) ||
1134+ ((ioc.cmd == BRCMF_C_SET_VAR) &&
17181135 !(strncmp("wsec_key", ioc.buf, 9))) ||
1719− ((ioc.cmd == WLC_SET_VAR) &&
1136+ ((ioc.cmd == BRCMF_C_SET_VAR) &&
17201137 !(strncmp("bsscfg:wsec_key", ioc.buf, 15))));
17211138 if (is_set_key_cmd)
1722− dhd_wait_pend8021x(net);
1139+ brcmf_netdev_wait_pend8021x(net);
17231140
17241141 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);
17261144
17271145 done:
17281146 if (!bcmerror && buf && ioc.buf) {
@@ -1738,159 +1156,146 @@ done: · 9 unmodified lines
17381156 return bcmerror;
17391157 }
17401158
1741−static int dhd_stop(struct net_device *net)
1159+static int brcmf_netdev_stop(struct net_device *net)
17421160 {
17431161 #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);
17451163
1746− DHD_TRACE(("%s: Enter\n", __func__));
1747− if (IS_CFG80211_FAVORITE()) {
1748− wl_cfg80211_down();
1749− }
1750− if (dhd->pub.up == 0)
1164+ BRCMF_TRACE(("%s: Enter\n", __func__));
1165+ brcmf_cfg80211_down();
1166+ if (drvr_priv->pub.up == 0)
17511167 return 0;
17521168
17531169 /* Set state and stop OS transmissions */
1754− dhd->pub.up = 0;
1170+ drvr_priv->pub.up = 0;
17551171 netif_stop_queue(net);
17561172 #else
1757− DHD_ERROR(("BYPASS %s:due to BRCM compilation : under investigation\n",
1758− __func__));
1173+ BRCMF_ERROR(("BYPASS %s:due to BRCM compilation: under investigation\n",
1174+ __func__));
17591175 #endif /* !defined(IGNORE_ETH0_DOWN) */
17601176
17611177 return 0;
17621178 }
17631179
1764−static int dhd_open(struct net_device *net)
1180+static int brcmf_netdev_open(struct net_device *net)
17651181 {
1766− dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
1767−#ifdef TOE
1182+ struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
17681183 u32 toe_ol;
1769−#endif
1770− int ifidx = dhd_net2idx(dhd, net);
1184+ int ifidx = brcmf_net2idx(drvr_priv, net);
17711185 s32 ret = 0;
17721186
1773− DHD_TRACE(("%s: ifidx %d\n", __func__, ifidx));
1187+ BRCMF_TRACE(("%s: ifidx %d\n", __func__, ifidx));
17741188
17751189 if (ifidx == 0) { /* do it only for primary eth0 */
17761190
17771191 /* try to bring up bus */
1778− ret = dhd_bus_start(&dhd->pub);
1192+ ret = brcmf_bus_start(&drvr_priv->pub);
17791193 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));
17811196 return -1;
17821197 }
1783− atomic_set(&dhd->pend_8021x_cnt, 0);
1198+ atomic_set(&drvr_priv->pend_8021x_cnt, 0);
17841199
1785− memcpy(net->dev_addr, dhd->pub.mac, ETH_ALEN);
1200+ memcpy(net->dev_addr, drvr_priv->pub.mac, ETH_ALEN);
17861201
1787−#ifdef TOE
17881202 /* Get current TOE mode from dongle */
1789− if (dhd_toe_get(dhd, ifidx, &toe_ol) >= 0
1203+ if (brcmf_toe_get(drvr_priv, ifidx, &toe_ol) >= 0
17901204 && (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;
17921207 else
1793− dhd->iflist[ifidx]->net->features &= ~NETIF_F_IP_CSUM;
1794−#endif
1208+ drvr_priv->iflist[ifidx]->net->features &=
1209+ ~NETIF_F_IP_CSUM;
17951210 }
17961211 /* Allow transmit calls */
17971212 netif_start_queue(net);
1798− dhd->pub.up = 1;
1799− if (IS_CFG80211_FAVORITE()) {
1800− if (unlikely(wl_cfg80211_up())) {
1801− DHD_ERROR(("%s: failed to bring up cfg80211\n",
1802− __func__));
1803− return -1;
1804− }
1213+ drvr_priv->pub.up = 1;
1214+ if (unlikely(brcmf_cfg80211_up())) {
1215+ BRCMF_ERROR(("%s: failed to bring up cfg80211\n",
1216+ __func__));
1217+ return -1;
18051218 }
18061219
18071220 return ret;
18081221 }
18091222
18101223 int
1811−dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name,
1224+brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle, char *name,
18121225 u8 *mac_addr, u32 flags, u8 bssidx)
18131226 {
1814− dhd_if_t *ifp;
1815−
1816− DHD_TRACE(("%s: idx %d, handle->%p\n", __func__, ifidx, handle));
1227+ struct brcmf_if *ifp;
18171228
1818− ASSERT(dhd && (ifidx < DHD_MAX_IFS));
1229+ BRCMF_TRACE(("%s: idx %d, handle->%p\n", __func__, ifidx, handle));
18191230
1820− ifp = dhd->iflist[ifidx];
1821− if (!ifp && !(ifp = kmalloc(sizeof(dhd_if_t), GFP_ATOMIC))) {
1822− DHD_ERROR(("%s: OOM - dhd_if_t\n", __func__));
1823− return -ENOMEM;
1231+ ifp = drvr_priv->iflist[ifidx];
1232+ if (!ifp) {
1233+ ifp = kmalloc(sizeof(struct brcmf_if), GFP_ATOMIC);
1234+ if (!ifp) {
1235+ BRCMF_ERROR(("%s: OOM - struct brcmf_if\n", __func__));
1236+ return -ENOMEM;
1237+ }
18241238 }
18251239
1826− memset(ifp, 0, sizeof(dhd_if_t));
1827− ifp->info = dhd;
1828− dhd->iflist[ifidx] = ifp;
1240+ memset(ifp, 0, sizeof(struct brcmf_if));
1241+ ifp->info = drvr_priv;
1242+ drvr_priv->iflist[ifidx] = ifp;
18291243 strlcpy(ifp->name, name, IFNAMSIZ);
18301244 if (mac_addr != NULL)
18311245 memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN);
18321246
18331247 if (handle == NULL) {
1834− ifp->state = WLC_E_IF_ADD;
1248+ ifp->state = BRCMF_E_IF_ADD;
18351249 ifp->idx = ifidx;
1836− ASSERT(dhd->sysioc_tsk);
1837− up(&dhd->sysioc_sem);
1250+ up(&drvr_priv->sysioc_sem);
18381251 } else
18391252 ifp->net = (struct net_device *)handle;
18401253
18411254 return 0;
18421255 }
18431256
1844−void dhd_del_if(dhd_info_t *dhd, int ifidx)
1257+void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx)
18451258 {
1846− dhd_if_t *ifp;
1259+ struct brcmf_if *ifp;
18471260
1848− DHD_TRACE(("%s: idx %d\n", __func__, ifidx));
1261+ BRCMF_TRACE(("%s: idx %d\n", __func__, ifidx));
18491262
1850− ASSERT(dhd && ifidx && (ifidx < DHD_MAX_IFS));
1851− ifp = dhd->iflist[ifidx];
1263+ ifp = drvr_priv->iflist[ifidx];
18521264 if (!ifp) {
1853− DHD_ERROR(("%s: Null interface\n", __func__));
1265+ BRCMF_ERROR(("%s: Null interface\n", __func__));
18541266 return;
18551267 }
18561268
1857− ifp->state = WLC_E_IF_DEL;
1269+ ifp->state = BRCMF_E_IF_DEL;
18581270 ifp->idx = ifidx;
1859− ASSERT(dhd->sysioc_tsk);
1860− up(&dhd->sysioc_sem);
1271+ up(&drvr_priv->sysioc_sem);
18611272 }
18621273
1863−dhd_pub_t *dhd_attach(struct dhd_bus *bus, uint bus_hdrlen)
1274+struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
18641275 {
1865− dhd_info_t *dhd = NULL;
1276+ struct brcmf_info *drvr_priv = NULL;
18661277 struct net_device *net;
18671278
1868− DHD_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);
1279+ BRCMF_TRACE(("%s: Enter\n", __func__));
18751280
18761281 /* Allocate etherdev, including space for private structure */
1877− net = alloc_etherdev(sizeof(dhd));
1282+ net = alloc_etherdev(sizeof(drvr_priv));
18781283 if (!net) {
1879− DHD_ERROR(("%s: OOM - alloc_etherdev\n", __func__));
1284+ BRCMF_ERROR(("%s: OOM - alloc_etherdev\n", __func__));
18801285 goto fail;
18811286 }
18821287
1883− /* Allocate primary dhd_info */
1884− dhd = kzalloc(sizeof(dhd_info_t), GFP_ATOMIC);
1885− if (!dhd) {
1886− DHD_ERROR(("%s: OOM - alloc dhd_info\n", __func__));
1288+ /* Allocate primary brcmf_info */
1289+ drvr_priv = kzalloc(sizeof(struct brcmf_info), GFP_ATOMIC);
1290+ if (!drvr_priv) {
1291+ BRCMF_ERROR(("%s: OOM - alloc brcmf_info\n", __func__));
18871292 goto fail;
18881293 }
18891294
18901295 /*
1891− * Save the dhd_info into the priv
1296+ * Save the brcmf_info into the priv
18921297 */
1893− memcpy(netdev_priv(net), &dhd, sizeof(dhd));
1298+ memcpy(netdev_priv(net), &drvr_priv, sizeof(drvr_priv));
18941299
18951300 /* Set network interface name if it was provided as module parameter */
18961301 if (iface_name[0]) {
@@ -1904,317 +1309,180 @@ dhd_pub_t *dhd_attach(struct dhd_bus *bus, uint bus_hdrlen) · 7 unmodified lines
19041309 strcat(net->name, "%d");
19051310 }
19061311
1907− if (dhd_add_if(dhd, 0, (void *)net, net->name, NULL, 0, 0) ==
1908− DHD_BAD_IF)
1312+ if (brcmf_add_if(drvr_priv, 0, (void *)net, net->name, NULL, 0, 0) ==
1313+ BRCMF_BAD_IF)
19091314 goto fail;
19101315
19111316 net->netdev_ops = NULL;
1912− sema_init(&dhd->proto_sem, 1);
1317+ sema_init(&drvr_priv->proto_sem, 1);
19131318 /* Initialize other structure content */
1914− init_waitqueue_head(&dhd->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);
1319+ init_waitqueue_head(&drvr_priv->ioctl_resp_wait);
19201320
19211321 /* Link to info module */
1922− dhd->pub.info = dhd;
1322+ drvr_priv->pub.info = drvr_priv;
19231323
19241324 /* Link to bus module */
1925− dhd->pub.bus = bus;
1926− dhd->pub.hdrlen = bus_hdrlen;
1325+ drvr_priv->pub.bus = bus;
1326+ drvr_priv->pub.hdrlen = bus_hdrlen;
19271327
19281328 /* Attach and link in the protocol */
1929− if (dhd_prot_attach(&dhd->pub) != 0) {
1930− DHD_ERROR(("dhd_prot_attach failed\n"));
1329+ if (brcmf_proto_attach(&drvr_priv->pub) != 0) {
1330+ BRCMF_ERROR(("brcmf_prot_attach failed\n"));
19311331 goto fail;
19321332 }
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) */
19401333
19411334 /* Attach and link in the cfg80211 */
1942− if (IS_CFG80211_FAVORITE()) {
1943− if (unlikely(wl_cfg80211_attach(net, &dhd->pub))) {
1944− DHD_ERROR(("wl_cfg80211_attach failed\n"));
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;
1335+ if (unlikely(brcmf_cfg80211_attach(net, &drvr_priv->pub))) {
1336+ BRCMF_ERROR(("wl_cfg80211_attach failed\n"));
1337+ goto fail;
19921338 }
19931339
1994− if (dhd_sysioc) {
1995− sema_init(&dhd->sysioc_sem, 0);
1996− dhd->sysioc_tsk = kthread_run(_dhd_sysioc_thread, dhd,
1997− "_dhd_sysioc");
1998− if (IS_ERR(dhd->sysioc_tsk)) {
1340+ if (brcmf_sysioc) {
1341+ sema_init(&drvr_priv->sysioc_sem, 0);
1342+ drvr_priv->sysioc_tsk = kthread_run(_brcmf_sysioc_thread, drvr_priv,
1343+ "_brcmf_sysioc");
1344+ if (IS_ERR(drvr_priv->sysioc_tsk)) {
19991345 printk(KERN_WARNING
2000− "_dhd_sysioc thread failed to start\n");
2001− dhd->sysioc_tsk = NULL;
1346+ "_brcmf_sysioc thread failed to start\n");
1347+ drvr_priv->sysioc_tsk = NULL;
20021348 }
20031349 } else
2004− dhd->sysioc_tsk = NULL;
1350+ drvr_priv->sysioc_tsk = NULL;
20051351
20061352 /*
2007− * Save the dhd_info into the priv
1353+ * Save the brcmf_info into the priv
20081354 */
2009− memcpy(netdev_priv(net), &dhd, sizeof(dhd));
1355+ memcpy(netdev_priv(net), &drvr_priv, sizeof(drvr_priv));
20101356
2011−#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
2012− g_bus = bus;
2013−#endif
20141357 #if defined(CONFIG_PM_SLEEP)
2015− atomic_set(&dhd_mmc_suspend, false);
2016− if (!IS_CFG80211_FAVORITE())
2017− register_pm_notifier(&dhd_sleep_pm_notifier);
1358+ atomic_set(&brcmf_mmc_suspend, false);
20181359 #endif /* defined(CONFIG_PM_SLEEP) */
2019− /* && defined(DHD_GPL) */
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;
1360+ return &drvr_priv->pub;
20291361
20301362 fail:
20311363 if (net)
20321364 free_netdev(net);
2033− if (dhd)
2034− dhd_detach(&dhd->pub);
1365+ if (drvr_priv)
1366+ brcmf_detach(&drvr_priv->pub);
20351367
20361368 return NULL;
20371369 }
20381370
2039−int dhd_bus_start(dhd_pub_t *dhdp)
1371+int brcmf_bus_start(struct brcmf_pub *drvr)
20401372 {
20411373 int ret = -1;
2042− dhd_info_t *dhd = (dhd_info_t *) dhdp->info;
2043−#ifdef EMBEDDED_PLATFORM
2044− char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" +
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− }
1374+ struct brcmf_info *drvr_priv = drvr->info;
1375+ /* Room for "event_msgs" + '\0' + bitvec */
1376+ char iovbuf[BRCMF_EVENTING_MASK_LEN + 12];
20621377
2063− /* Start the watchdog timer */
2064− dhd->pub.tickcnt = 0;
2065− dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms);
1378+ BRCMF_TRACE(("%s:\n", __func__));
20661379
20671380 /* Bring up the bus */
2068− ret = dhd_bus_init(&dhd->pub, true);
1381+ ret = brcmf_sdbrcm_bus_init(&drvr_priv->pub, true);
20691382 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));
20711385 return ret;
20721386 }
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) */
20851387
20861388 /* If bus is not ready, can't come up */
2087− if (dhd->pub.busstate != DHD_BUS_DATA) {
2088− del_timer_sync(&dhd->timer);
2089− dhd->wd_timer_valid = false;
2090− DHD_ERROR(("%s failed bus is not ready\n", __func__));
1389+ if (drvr_priv->pub.busstate != BRCMF_BUS_DATA) {
1390+ BRCMF_ERROR(("%s failed bus is not ready\n", __func__));
20911391 return -ENODEV;
20921392 }
2093−#ifdef EMBEDDED_PLATFORM
2094− bcm_mkiovar("event_msgs", dhdp->eventmask, WL_EVENTING_MASK_LEN, iovbuf,
2095− sizeof(iovbuf));
2096− dhdcdc_query_ioctl(dhdp, 0, WLC_GET_VAR, iovbuf, sizeof(iovbuf));
2097− memcpy(dhdp->eventmask, iovbuf, WL_EVENTING_MASK_LEN);
2098−
2099− setbit(dhdp->eventmask, WLC_E_SET_SSID);
2100− setbit(dhdp->eventmask, WLC_E_PRUNE);
2101− setbit(dhdp->eventmask, WLC_E_AUTH);
2102− setbit(dhdp->eventmask, WLC_E_REASSOC);
2103− setbit(dhdp->eventmask, WLC_E_REASSOC_IND);
2104− setbit(dhdp->eventmask, WLC_E_DEAUTH_IND);
2105− setbit(dhdp->eventmask, WLC_E_DISASSOC_IND);
2106− setbit(dhdp->eventmask, WLC_E_DISASSOC);
2107− setbit(dhdp->eventmask, WLC_E_JOIN);
2108− setbit(dhdp->eventmask, WLC_E_ASSOC_IND);
2109− setbit(dhdp->eventmask, WLC_E_PSK_SUP);
2110− setbit(dhdp->eventmask, WLC_E_LINK);
2111− setbit(dhdp->eventmask, WLC_E_NDIS_LINK);
2112− setbit(dhdp->eventmask, WLC_E_MIC_ERROR);
2113− setbit(dhdp->eventmask, WLC_E_PMKID_CACHE);
2114− setbit(dhdp->eventmask, WLC_E_TXFAIL);
2115− setbit(dhdp->eventmask, WLC_E_JOIN_START);
2116− setbit(dhdp->eventmask, WLC_E_SCAN_COMPLETE);
2117−#ifdef PNO_SUPPORT
2118− setbit(dhdp->eventmask, WLC_E_PFN_NET_FOUND);
2119−#endif /* PNO_SUPPORT */
1393+
1394+ brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN,
1395+ iovbuf, sizeof(iovbuf));
1396+ brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, iovbuf,
1397+ sizeof(iovbuf));
1398+ memcpy(drvr->eventmask, iovbuf, BRCMF_EVENTING_MASK_LEN);
1399+
1400+ setbit(drvr->eventmask, BRCMF_E_SET_SSID);
1401+ setbit(drvr->eventmask, BRCMF_E_PRUNE);
1402+ setbit(drvr->eventmask, BRCMF_E_AUTH);
1403+ setbit(drvr->eventmask, BRCMF_E_REASSOC);
1404+ setbit(drvr->eventmask, BRCMF_E_REASSOC_IND);
1405+ setbit(drvr->eventmask, BRCMF_E_DEAUTH_IND);
1406+ setbit(drvr->eventmask, BRCMF_E_DISASSOC_IND);
1407+ setbit(drvr->eventmask, BRCMF_E_DISASSOC);
1408+ setbit(drvr->eventmask, BRCMF_E_JOIN);
1409+ setbit(drvr->eventmask, BRCMF_E_ASSOC_IND);
1410+ setbit(drvr->eventmask, BRCMF_E_PSK_SUP);
1411+ setbit(drvr->eventmask, BRCMF_E_LINK);
1412+ setbit(drvr->eventmask, BRCMF_E_NDIS_LINK);
1413+ setbit(drvr->eventmask, BRCMF_E_MIC_ERROR);
1414+ setbit(drvr->eventmask, BRCMF_E_PMKID_CACHE);
1415+ setbit(drvr->eventmask, BRCMF_E_TXFAIL);
1416+ setbit(drvr->eventmask, BRCMF_E_JOIN_START);
1417+ setbit(drvr->eventmask, BRCMF_E_SCAN_COMPLETE);
21201418
21211419 /* enable dongle roaming event */
21221420
2123− dhdp->pktfilter_count = 1;
1421+ drvr->pktfilter_count = 1;
21241422 /* Setup filter to allow only unicast */
2125− dhdp->pktfilter[0] = "100 0 0 0 0x01 0x00";
2126−#endif /* EMBEDDED_PLATFORM */
1423+ drvr->pktfilter[0] = "100 0 0 0 0x01 0x00";
21271424
21281425 /* Bus is ready, do any protocol initialization */
2129− ret = dhd_prot_init(&dhd->pub);
1426+ ret = brcmf_proto_init(&drvr_priv->pub);
21301427 if (ret < 0)
21311428 return ret;
21321429
21331430 return 0;
21341431 }
21351432
2136−int
2137−dhd_iovar(dhd_pub_t *pub, int ifidx, char *name, char *cmd_buf, uint cmd_len,
2138− int set)
2139−{
2140− char buf[strlen(name) + 1 + cmd_len];
2141− int len = sizeof(buf);
2142− wl_ioctl_t ioc;
2143− int ret;
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−
2161−static 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
1433+static struct net_device_ops brcmf_netdev_ops_pri = {
1434+ .ndo_open = brcmf_netdev_open,
1435+ .ndo_stop = brcmf_netdev_stop,
1436+ .ndo_get_stats = brcmf_netdev_get_stats,
1437+ .ndo_do_ioctl = brcmf_netdev_ioctl_entry,
1438+ .ndo_start_xmit = brcmf_netdev_start_xmit,
1439+ .ndo_set_mac_address = brcmf_netdev_set_mac_address,
1440+ .ndo_set_multicast_list = brcmf_netdev_set_multicast_list
21691441 };
21701442
2171−int dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
1443+int brcmf_net_attach(struct brcmf_pub *drvr, int ifidx)
21721444 {
2173− dhd_info_t *dhd = (dhd_info_t *) dhdp->info;
1445+ struct brcmf_info *drvr_priv = drvr->info;
21741446 struct net_device *net;
21751447 u8 temp_addr[ETH_ALEN] = {
21761448 0x00, 0x90, 0x4c, 0x11, 0x22, 0x33};
21771449
2178− DHD_TRACE(("%s: ifidx %d\n", __func__, ifidx));
2179−
2180− ASSERT(dhd && dhd->iflist[ifidx]);
1450+ BRCMF_TRACE(("%s: ifidx %d\n", __func__, ifidx));
21811451
2182− net = dhd->iflist[ifidx]->net;
2183− ASSERT(net);
2184−
2185− ASSERT(!net->netdev_ops);
2186− net->netdev_ops = &dhd_ops_pri;
1452+ net = drvr_priv->iflist[ifidx]->net;
1453+ net->netdev_ops = &brcmf_netdev_ops_pri;
21871454
21881455 /*
21891456 * We have to use the primary MAC for virtual interfaces
21901457 */
21911458 if (ifidx != 0) {
21921459 /* 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);
21941461
21951462 }
21961463
21971464 if (ifidx == 1) {
2198− DHD_TRACE(("%s ACCESS POINT MAC: \n", __func__));
1465+ BRCMF_TRACE(("%s ACCESS POINT MAC:\n", __func__));
21991466 /* ACCESSPOINT INTERFACE CASE */
22001467 temp_addr[0] |= 0X02; /* set bit 2 ,
22011468 - Locally Administered address */
22021469
22031470 }
2204− net->hard_header_len = ETH_HLEN + dhd->pub.hdrlen;
2205− net->ethtool_ops = &dhd_ethtool_ops;
1471+ net->hard_header_len = ETH_HLEN + drvr_priv->pub.hdrlen;
1472+ net->ethtool_ops = &brcmf_ethtool_ops;
22061473
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;
22081476
22091477 memcpy(net->dev_addr, temp_addr, ETH_ALEN);
22101478
22111479 if (register_netdev(net) != 0) {
2212− DHD_ERROR(("%s: couldn't register the net device\n",
2213− __func__));
1480+ BRCMF_ERROR(("%s: couldn't register the net device\n",
1481+ __func__));
22141482 goto fail;
22151483 }
22161484
2217− DHD_INFO(("%s: Broadcom Dongle Host Driver\n", net->name));
1485+ BRCMF_INFO(("%s: Broadcom Dongle Host Driver\n", net->name));
22181486
22191487 return 0;
22201488
@@ -2223,221 +1491,139 @@ fail: · 2 unmodified lines
22231491 return -EBADE;
22241492 }
22251493
2226−void dhd_bus_detach(dhd_pub_t *dhdp)
1494+static void brcmf_bus_detach(struct brcmf_pub *drvr)
22271495 {
2228− dhd_info_t *dhd;
1496+ struct brcmf_info *drvr_priv;
22291497
2230− DHD_TRACE(("%s: Enter\n", __func__));
1498+ BRCMF_TRACE(("%s: Enter\n", __func__));
22311499
2232− if (dhdp) {
2233− dhd = (dhd_info_t *) dhdp->info;
2234− if (dhd) {
1500+ if (drvr) {
1501+ drvr_priv = drvr->info;
1502+ if (drvr_priv) {
22351503 /* Stop the protocol module */
2236− dhd_prot_stop(&dhd->pub);
1504+ brcmf_proto_stop(&drvr_priv->pub);
22371505
22381506 /* Stop the bus module */
2239− dhd_bus_stop(dhd->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;
1507+ brcmf_sdbrcm_bus_stop(drvr_priv->pub.bus, true);
22471508 }
22481509 }
22491510 }
22501511
2251−void dhd_detach(dhd_pub_t *dhdp)
1512+void brcmf_detach(struct brcmf_pub *drvr)
22521513 {
2253− dhd_info_t *dhd;
1514+ struct brcmf_info *drvr_priv;
22541515
2255− DHD_TRACE(("%s: Enter\n", __func__));
1516+ BRCMF_TRACE(("%s: Enter\n", __func__));
22561517
2257− if (dhdp) {
2258− dhd = (dhd_info_t *) dhdp->info;
2259− if (dhd) {
2260− dhd_if_t *ifp;
1518+ if (drvr) {
1519+ drvr_priv = drvr->info;
1520+ if (drvr_priv) {
1521+ struct brcmf_if *ifp;
22611522 int i;
22621523
2263−#if defined(CONFIG_HAS_EARLYSUSPEND)
2264− if (dhd->early_suspend.suspend)
2265− unregister_early_suspend(&dhd->early_suspend);
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);
1524+ for (i = 1; i < BRCMF_MAX_IFS; i++)
1525+ if (drvr_priv->iflist[i])
1526+ brcmf_del_if(drvr_priv, i);
22711527
2272− ifp = dhd->iflist[0];
2273− ASSERT(ifp);
2274− if (ifp->net->netdev_ops == &dhd_ops_pri) {
2275− dhd_stop(ifp->net);
1528+ ifp = drvr_priv->iflist[0];
1529+ if (ifp->net->netdev_ops == &brcmf_netdev_ops_pri) {
1530+ brcmf_netdev_stop(ifp->net);
22761531 unregister_netdev(ifp->net);
22771532 }
22781533
2279− if (dhd->watchdog_tsk) {
2280− send_sig(SIGTERM, dhd->watchdog_tsk, 1);
2281− kthread_stop(dhd->watchdog_tsk);
2282− dhd->watchdog_tsk = NULL;
1534+ if (drvr_priv->sysioc_tsk) {
1535+ send_sig(SIGTERM, drvr_priv->sysioc_tsk, 1);
1536+ kthread_stop(drvr_priv->sysioc_tsk);
1537+ drvr_priv->sysioc_tsk = NULL;
22831538 }
22841539
2285− if (dhd->dpc_tsk) {
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− }
1540+ brcmf_bus_detach(drvr);
22971541
2298− dhd_bus_detach(dhdp);
1542+ if (drvr->prot)
1543+ brcmf_proto_detach(drvr);
22991544
2300− if (dhdp->prot)
2301− dhd_prot_detach(dhdp);
1545+ brcmf_cfg80211_detach();
23021546
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) */
23151547 free_netdev(ifp->net);
23161548 kfree(ifp);
2317− kfree(dhd);
1549+ kfree(drvr_priv);
23181550 }
23191551 }
23201552 }
23211553
2322−static void __exit dhd_module_cleanup(void)
1554+static void __exit brcmf_module_cleanup(void)
23231555 {
2324− DHD_TRACE(("%s: Enter\n", __func__));
1556+ BRCMF_TRACE(("%s: Enter\n", __func__));
23251557
2326− dhd_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);
1558+ brcmf_bus_unregister();
23321559 }
23331560
2334−static int __init dhd_module_init(void)
1561+static int __init brcmf_module_init(void)
23351562 {
23361563 int error;
23371564
2338− DHD_TRACE(("%s: Enter\n", __func__));
1565+ BRCMF_TRACE(("%s: Enter\n", __func__));
23391566
2340− /* Sanity check on the module parameters */
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();
1567+ error = brcmf_bus_register();
23781568
23791569 if (error) {
2380− DHD_ERROR(("%s: sdio_register_driver failed\n", __func__));
1570+ BRCMF_ERROR(("%s: brcmf_bus_register failed\n", __func__));
23811571 goto failed;
23821572 }
2383− return error;
1573+ return 0;
23841574
23851575 failed:
2386− /* turn off power and exit */
2387− dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
23881576 return -EINVAL;
23891577 }
23901578
2391−module_init(dhd_module_init);
2392−module_exit(dhd_module_cleanup);
1579+module_init(brcmf_module_init);
1580+module_exit(brcmf_module_cleanup);
23931581
2394−/*
2395− * OS specific functions required to implement DHD driver in OS independent way
2396− */
2397−int dhd_os_proto_block(dhd_pub_t *pub)
1582+int brcmf_os_proto_block(struct brcmf_pub *drvr)
23981583 {
2399− dhd_info_t *dhd = (dhd_info_t *) (pub->info);
1584+ struct brcmf_info *drvr_priv = drvr->info;
24001585
2401− if (dhd) {
2402− down(&dhd->proto_sem);
1586+ if (drvr_priv) {
1587+ down(&drvr_priv->proto_sem);
24031588 return 1;
24041589 }
24051590 return 0;
24061591 }
24071592
2408−int dhd_os_proto_unblock(dhd_pub_t *pub)
1593+int brcmf_os_proto_unblock(struct brcmf_pub *drvr)
24091594 {
2410− dhd_info_t *dhd = (dhd_info_t *) (pub->info);
1595+ struct brcmf_info *drvr_priv = drvr->info;
24111596
2412− if (dhd) {
2413− up(&dhd->proto_sem);
1597+ if (drvr_priv) {
1598+ up(&drvr_priv->proto_sem);
24141599 return 1;
24151600 }
24161601
24171602 return 0;
24181603 }
24191604
2420−unsigned int dhd_os_get_ioctl_resp_timeout(void)
1605+unsigned int brcmf_os_get_ioctl_resp_timeout(void)
24211606 {
2422− return (unsigned int)dhd_ioctl_timeout_msec;
1607+ return (unsigned int)brcmf_ioctl_timeout_msec;
24231608 }
24241609
2425−void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec)
1610+void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec)
24261611 {
2427− dhd_ioctl_timeout_msec = (int)timeout_msec;
1612+ brcmf_ioctl_timeout_msec = (int)timeout_msec;
24281613 }
24291614
2430−int dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool *pending)
1615+int brcmf_os_ioctl_resp_wait(struct brcmf_pub *drvr, uint *condition,
1616+ bool *pending)
24311617 {
2432− dhd_info_t *dhd = (dhd_info_t *) (pub->info);
1618+ struct brcmf_info *drvr_priv = drvr->info;
24331619 DECLARE_WAITQUEUE(wait, current);
2434− int timeout = dhd_ioctl_timeout_msec;
1620+ int timeout = brcmf_ioctl_timeout_msec;
24351621
24361622 /* Convert timeout in millsecond to jiffies */
24371623 timeout = timeout * HZ / 1000;
24381624
24391625 /* 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);
24411627 set_current_state(TASK_INTERRUPTIBLE);
24421628
24431629 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
24471633 *pending = true;
24481634
24491635 set_current_state(TASK_RUNNING);
2450− remove_wait_queue(&dhd->ioctl_resp_wait, &wait);
1636+ remove_wait_queue(&drvr_priv->ioctl_resp_wait, &wait);
24511637
24521638 return timeout;
24531639 }
24541640
2455−int dhd_os_ioctl_resp_wake(dhd_pub_t *pub)
1641+int brcmf_os_ioctl_resp_wake(struct brcmf_pub *drvr)
24561642 {
2457− dhd_info_t *dhd = (dhd_info_t *) (pub->info);
1643+ struct brcmf_info *drvr_priv = drvr->info;
24581644
2459− if (waitqueue_active(&dhd->ioctl_resp_wait))
2460− wake_up_interruptible(&dhd->ioctl_resp_wait);
1645+ if (waitqueue_active(&drvr_priv->ioctl_resp_wait))
1646+ wake_up_interruptible(&drvr_priv->ioctl_resp_wait);
24611647
24621648 return 0;
24631649 }
24641650
2465−void dhd_os_wd_timer(void *bus, uint wdtick)
2466−{
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−
2510−void *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−
2530−int 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−
2548−void 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−
2556−void 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−
2568−void 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−
2580−void 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−
2588−void 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−
2596−void dhd_os_sdlock_rxq(dhd_pub_t *pub)
2597−{
2598−}
2599−
2600−void dhd_os_sdunlock_rxq(dhd_pub_t *pub)
2601−{
2602−}
2603−
2604−void dhd_os_sdtxlock(dhd_pub_t *pub)
2605−{
2606− dhd_os_sdlock(pub);
2607−}
2608−
2609−void dhd_os_sdtxunlock(dhd_pub_t *pub)
2610−{
2611− dhd_os_sdunlock(pub);
2612−}
2613−
2614−static int
2615−dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
2616− wl_event_msg_t *event, void **data)
1651+static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
1652+ struct brcmf_event_msg *event, void **data)
26171653 {
26181654 int bcmerror = 0;
26191655
2620− ASSERT(dhd != NULL);
2621−
2622− bcmerror = wl_host_event(dhd, ifidx, pktdata, event, data);
1656+ bcmerror = brcmf_c_host_event(drvr_priv, ifidx, pktdata, event, data);
26231657 if (bcmerror != 0)
26241658 return bcmerror;
26251659
2626−#if defined(CONFIG_WIRELESS_EXT)
2627− if (!IS_CFG80211_FAVORITE()) {
2628− if ((dhd->iflist[*ifidx] == NULL)
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− }
1660+ if (drvr_priv->iflist[*ifidx]->net)
1661+ brcmf_cfg80211_event(drvr_priv->iflist[*ifidx]->net,
1662+ event, *data);
26461663
26471664 return bcmerror;
26481665 }
26491666
2650−/* send up locally generated event */
2651−void 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−
2659−void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar)
1667+int brcmf_netdev_reset(struct net_device *dev, u8 flag)
26601668 {
2661− struct dhd_info *dhdinfo = dhd->info;
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−}
1669+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)netdev_priv(dev);
26681670
2669−void dhd_wait_event_wakeup(dhd_pub_t *dhd)
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−
2677−int 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__));
1671+ brcmf_bus_devreset(&drvr_priv->pub, flag);
26911672
26921673 return 1;
26931674 }
26941675
2695−int net_os_set_suspend_disable(struct net_device *dev, int val)
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−
2707−int net_os_set_suspend(struct net_device *dev, int val)
1676+static int brcmf_get_pend_8021x_cnt(struct brcmf_info *drvr_priv)
27081677 {
2709− int ret = 0;
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−
2722−int 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−
2732−int 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−
2753−void 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 */
2762−int 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 */
2770−int 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 */
2778−int
2779−dhd_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 */
2788−int 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−
2797−static int dhd_get_pend_8021x_cnt(dhd_info_t *dhd)
2798−{
2799− return atomic_read(&dhd->pend_8021x_cnt);
1678+ return atomic_read(&drvr_priv->pend_8021x_cnt);
28001679 }
28011680
28021681 #define MAX_WAIT_FOR_8021X_TX 10
28031682
2804−int dhd_wait_pend8021x(struct net_device *dev)
1683+int brcmf_netdev_wait_pend8021x(struct net_device *dev)
28051684 {
2806− dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
1685+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)netdev_priv(dev);
28071686 int timeout = 10 * HZ / 1000;
28081687 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);
28101689
28111690 while (ntimes && pend) {
28121691 if (pend) {
@@ -2815,20 +1694,13 @@ int dhd_wait_pend8021x(struct net_device *dev) · 2 unmodified lines
28151694 set_current_state(TASK_RUNNING);
28161695 ntimes--;
28171696 }
2818− pend = dhd_get_pend_8021x_cnt(dhd);
1697+ pend = brcmf_get_pend_8021x_cnt(drvr_priv);
28191698 }
28201699 return pend;
28211700 }
28221701
2823−void wl_os_wd_timer(struct net_device *ndev, uint wdtick)
2824−{
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
2831−int write_to_file(dhd_pub_t *dhd, u8 *buf, int size)
1702+#ifdef BCMDBG
1703+int brcmf_write_to_file(struct brcmf_pub *drvr, u8 *buf, int size)
28321704 {
28331705 int ret = 0;
28341706 struct file *fp;
@@ -2842,7 +1714,7 @@ int write_to_file(dhd_pub_t *dhd, u8 *buf, int size) · 7 unmodified lines
28421714 /* open file to write */
28431715 fp = filp_open("/tmp/mem_dump", O_WRONLY | O_CREAT, 0640);
28441716 if (!fp) {
2845− DHD_ERROR(("%s: open file error\n", __func__));
1717+ BRCMF_ERROR(("%s: open file error\n", __func__));
28461718 ret = -1;
28471719 goto exit;
28481720 }
@@ -2861,4 +1733,4 @@ exit: · 12 unmodified lines
28611733
28621734 return ret;
28631735 }
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−
20−int 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
1414 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515 */
1616
17−#ifndef _dhd_proto_h_
18−#define _dhd_proto_h_
19−
20−#include <dhdioctl.h>
21−#include <wlioctl.h>
17+#ifndef _BRCMF_PROTO_H_
18+#define _BRCMF_PROTO_H_
2219
2320 #ifndef IOCTL_RESP_TIMEOUT
2421 #define IOCTL_RESP_TIMEOUT 2000 /* In milli second */
@@ -29,62 +26,50 @@ · 4 unmodified lines
2926 #endif
3027
3128 /*
32− * Exported from the dhd protocol module (dhd_cdc, dhd_rndis)
29+ * Exported from the brcmf protocol module (brcmf_cdc)
3330 */
3431
3532 /* Linkage, sets prot link and updates hdrlen in pub */
36−extern int dhd_prot_attach(dhd_pub_t *dhdp);
33+extern int brcmf_proto_attach(struct brcmf_pub *drvr);
3734
38−/* Unlink, frees allocated protocol memory (including dhd_prot) */
39−extern void dhd_prot_detach(dhd_pub_t *dhdp);
35+/* Unlink, frees allocated protocol memory (including brcmf_proto) */
36+extern void brcmf_proto_detach(struct brcmf_pub *drvr);
4037
4138 /* Initialize protocol: sync w/dongle state.
4239 * Sets dongle media info (iswl, drv_version, mac address).
4340 */
44−extern int dhd_prot_init(dhd_pub_t *dhdp);
41+extern int brcmf_proto_init(struct brcmf_pub *drvr);
4542
4643 /* Stop protocol: sync w/dongle state. */
47−extern void dhd_prot_stop(dhd_pub_t *dhdp);
44+extern void brcmf_proto_stop(struct brcmf_pub *drvr);
4845
4946 /* Add any protocol-specific data header.
5047 * Caller must reserve prot_hdrlen prepend space.
5148 */
52−extern void dhd_prot_hdrpush(dhd_pub_t *, int ifidx, struct sk_buff *txp);
49+extern void brcmf_proto_hdrpush(struct brcmf_pub *, int ifidx,
50+ struct sk_buff *txp);
5351
5452 /* Remove any protocol-specific data header. */
55−extern int dhd_prot_hdrpull(dhd_pub_t *, int *ifidx, struct sk_buff *rxp);
53+extern int brcmf_proto_hdrpull(struct brcmf_pub *, int *ifidx,
54+ struct sk_buff *rxp);
5655
5756 /* Use protocol to issue ioctl to dongle */
58−extern int dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc,
59− void *buf, int len);
60−
61−/* Check for and handle local prot-specific iovar commands */
62−extern int dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name,
63− void *params, int plen, void *arg, int len,
64− bool set);
57+extern int brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx,
58+ struct brcmf_ioctl *ioc, void *buf, int len);
6559
6660 /* Add prot dump output to a buffer */
67−extern void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf);
61+extern void brcmf_proto_dump(struct brcmf_pub *drvr,
62+ struct brcmu_strbuf *strbuf);
6863
6964 /* Update local copy of dongle statistics */
70−extern void dhd_prot_dstats(dhd_pub_t *dhdp);
65+extern void brcmf_proto_dstats(struct brcmf_pub *drvr);
7166
72−extern int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf,
73− uint buflen);
67+extern int brcmf_c_ioctl(struct brcmf_pub *drvr, struct brcmf_c_ioctl *ioc,
68+ void *buf, uint buflen);
7469
75−extern int dhd_preinit_ioctls(dhd_pub_t *dhd);
70+extern int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr);
7671
77−/********************************
78− * For version-string expansion *
79− */
80−#if defined(BDC)
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_ */
72+extern int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx,
73+ uint cmd, void *buf, uint len);
74+
75+#endif /* _BRCMF_PROTO_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c+2564−2181
@@ -16,46 +16,145 @@ · 15 unmodified lines
1616
1717 #include <linux/types.h>
1818 #include <linux/kernel.h>
19+#include <linux/kthread.h>
1920 #include <linux/printk.h>
2021 #include <linux/pci_ids.h>
2122 #include <linux/netdevice.h>
22−#include <bcmdefs.h>
23−#include <bcmsdh.h>
24−
25−#ifdef BCMEMBEDIMAGE
26−#include BCMEMBEDIMAGE
27−#endif /* BCMEMBEDIMAGE */
28−
29−#include <bcmutils.h>
30−#include <bcmdevs.h>
31−
32−#include <hndsoc.h>
33−#ifdef DHD_DEBUG
34−#include <hndrte_armtrap.h>
35−#include <hndrte_cons.h>
36−#endif /* DHD_DEBUG */
37−#include <sbchipc.h>
38−#include <sbhnddma.h>
39−
40−#include <sdio.h>
41−#include <sbsdio.h>
42−#include <sbsdpcmdev.h>
43−#include <bcmsdpcm.h>
44−
45−#include <proto/802.11.h>
46−
47−#include <dngl_stats.h>
48−#include <dhd.h>
49−#include <dhd_bus.h>
50−#include <dhd_proto.h>
51−#include <dhd_dbg.h>
52−#include <dhdioctl.h>
53−#include <sdiovar.h>
54−#include <bcmchip.h>
23+#include <linux/interrupt.h>
24+#include <linux/sched.h>
25+#include <linux/mmc/sdio.h>
26+#include <linux/mmc/sdio_func.h>
27+#include <linux/semaphore.h>
28+#include <linux/firmware.h>
29+#include <asm/unaligned.h>
30+#include <defs.h>
31+#include <brcmu_wifi.h>
32+#include <brcmu_utils.h>
33+#include <brcm_hw_ids.h>
34+#include <soc.h>
35+#include "sdio_host.h"
36+
37+/* register access macros */
38+#ifndef __BIG_ENDIAN
39+#ifndef __mips__
40+#define R_REG(r, typ) \
41+ brcmf_sdcard_reg_read(NULL, (r), sizeof(typ))
42+#else /* __mips__ */
43+#define R_REG(r, typ) \
44+ ({ \
45+ __typeof(*(r)) __osl_v; \
46+ __asm__ __volatile__("sync"); \
47+ __osl_v = brcmf_sdcard_reg_read(NULL, (r),\
48+ sizeof(typ)); \
49+ __asm__ __volatile__("sync"); \
50+ __osl_v; \
51+ })
52+#endif /* __mips__ */
53+
54+#else /* __BIG_ENDIAN */
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+
87+struct 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+};
55109
56−#ifndef DHDSDIO_MEM_DUMP_FNAME
57−#define DHDSDIO_MEM_DUMP_FNAME "mem_dump"
58−#endif
110+#define CBUF_LEN (128)
111+
112+struct 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+
119+struct 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>
59158
60159 #define TXQLEN 2048 /* bulk tx queue length */
61160 #define TXHI (TXQLEN - 256) /* turn on flow control above TXHI */
@@ -64,47 +163,239 @@ · 2 unmodified lines
64163
65164 #define TXRETRIES 2 /* # of retries for tx frames */
66165
67−#if defined(CONFIG_MACH_SANDGATE2G)
68−#define DHD_RXBOUND 250 /* Default for max rx frames in
166+#define BRCMF_RXBOUND 50 /* Default for max rx frames in
69167 one scheduling */
70−#else
71−#define DHD_RXBOUND 50 /* Default for max rx frames in
72− one scheduling */
73−#endif /* defined(CONFIG_MACH_SANDGATE2G) */
74168
75−#define DHD_TXBOUND 20 /* Default for max tx frames in
169+#define BRCMF_TXBOUND 20 /* Default for max tx frames in
76170 one scheduling */
77171
78−#define DHD_TXMINMAX 1 /* Max tx frames if rx still pending */
172+#define BRCMF_TXMINMAX 1 /* Max tx frames if rx still pending */
79173
80174 #define MEMBLOCK 2048 /* Block size used for downloading
81175 of dongle image */
82176 #define MAX_DATA_BUF (32 * 1024) /* Must be large enough to hold
83177 biggest possible glom */
84178
85−/* Packet alignment for most efficient SDIO (can change based on platform) */
86−#ifndef DHD_SDALIGN
87−#define DHD_SDALIGN 32
88−#endif
89−#if !ISPOWEROF2(DHD_SDALIGN)
90−#error DHD_SDALIGN is not a power of 2!
179+#ifndef BRCMF_FIRSTREAD
180+#define BRCMF_FIRSTREAD 32
91181 #endif
92182
93−#ifndef DHD_FIRSTREAD
94−#define DHD_FIRSTREAD 32
95−#endif
96−#if !ISPOWEROF2(DHD_FIRSTREAD)
97−#error DHD_FIRSTREAD is not a power of 2!
183+#if !ISPOWEROF2(BRCMF_FIRSTREAD)
184+#error BRCMF_FIRSTREAD is not a power of 2!
98185 #endif
99186
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+
100283 /* Total length of frame header for dongle protocol */
101284 #define SDPCM_HDRLEN (SDPCM_FRAMETAG_LEN + SDPCM_SWHEADER_LEN)
102285 #ifdef SDTEST
103−#define SDPCM_RESERVE (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN)
286+#define SDPCM_RESERVE (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + BRCMF_SDALIGN)
104287 #else
105−#define SDPCM_RESERVE (SDPCM_HDRLEN + DHD_SDALIGN)
288+#define SDPCM_RESERVE (SDPCM_HDRLEN + BRCMF_SDALIGN)
106289 #endif
107290
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+
108399 /* Space for header read, limit for data packets */
109400 #ifndef MAX_HDR_READ
110401 #define MAX_HDR_READ 32
@@ -116,7 +407,7 @@ · 5 unmodified lines
116407 #define MAX_RX_DATASZ 2048
117408
118409 /* Maximum milliseconds to wait for F2 to come up */
119−#define DHD_WAIT_F2RDY 3000
410+#define BRCMF_WAIT_F2RDY 3000
120411
121412 /* Bump up limit on waiting for HT to account for first startup;
122413 * if the image is doing a CRC calculation before programming the PMU
@@ -129,13 +420,48 @@ · 6 unmodified lines
129420 #endif
130421
131422 /* 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 | \
133424 SBSDIO_ALP_AVAIL_REQ)
134−#define DHD_INIT_CLKCTL2 (SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP)
135425
136426 /* Flags for SDH calls */
137427 #define F2SYNC (SDIO_REQ_4BYTE | SDIO_REQ_FIXED)
138428
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+
139465 /*
140466 * Conversion of 802.1D priority to precedence level
141467 */
@@ -143,21 +469,130 @@ · 1 unmodified line
143469 (((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? \
144470 ((prio^2)) : (prio))
145471
146−DHD_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep);
147−extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
148− uint len);
472+BRCMF_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep);
473+
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 */
485+struct 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+};
149572
150−#ifdef DHD_DEBUG
573+#ifdef BCMDBG
151574 /* Device console log buffer state */
152−typedef struct dhd_console {
575+struct brcmf_console {
153576 uint count; /* Poll interval msec counter */
154577 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) */
156579 uint bufsize; /* Size of log buffer */
157580 u8 *buf; /* Log buffer (host copy) */
158581 uint last; /* Last buffer read index */
159−} dhd_console_t;
160−#endif /* DHD_DEBUG */
582+};
583+#endif /* BCMDBG */
584+
585+struct 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+
161596
162597 /* misc chip info needed by some of the routines */
163598 struct chip_info {
@@ -166,7 +601,7 @@ struct chip_info { · 2 unmodified lines
166601 u32 cccorebase;
167602 u32 ccrev;
168603 u32 cccaps;
169− u32 buscorebase;
604+ u32 buscorebase; /* 32 bits backplane bus address */
170605 u32 buscorerev;
171606 u32 buscoretype;
172607 u32 ramcorebase;
@@ -176,19 +611,14 @@ struct chip_info { · 3 unmodified lines
176611 };
177612
178613 /* Private data for SDIO bus interaction */
179−typedef struct dhd_bus {
180− dhd_pub_t *dhd;
614+struct brcmf_bus {
615+ struct brcmf_pub *drvr;
181616
182− bcmsdh_info_t *sdh; /* Handle for BCMSDH calls */
617+ struct brcmf_sdio_card *card; /* Handle for sdio card calls */
183618 struct chip_info *ci; /* Chip info struct */
184619 char *vars; /* Variables (from CIS and/or other) */
185620 uint varsz; /* Size of variables buffer */
186− u32 sbaddr; /* Current SB window pointer (-1, invalid) */
187621
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 */
192622 u32 ramsize; /* Size of RAM in SOCRAM (bytes) */
193623 u32 orig_ramsize; /* Size of RAM in SOCRAM (bytes) */
194624
@@ -198,10 +628,7 @@ typedef struct dhd_bus { · 3 unmodified lines
198628 bool dpc_sched; /* Indicates DPC schedule (intrpt rcvd) */
199629 bool fcstate; /* State of dongle flow-control */
200630
201− u16 cl_devid; /* cached devid for dhdsdio_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. */
631+ u16 cl_devid; /* cached devid for brcmf_sdio_probe_attach() */
205632
206633 uint blocksize; /* Block size of SDIO transfers */
207634 uint roundup; /* Max roundup limit */
@@ -211,7 +638,7 @@ typedef struct dhd_bus { · 3 unmodified lines
211638 u8 tx_seq; /* Transmit sequence number (next) */
212639 u8 tx_max; /* Maximum transmit sequence allowed */
213640
214− u8 hdrbuf[MAX_HDR_READ + DHD_SDALIGN];
641+ u8 hdrbuf[MAX_HDR_READ + BRCMF_SDALIGN];
215642 u8 *rxhdr; /* Header of current rx frame (in hdrbuf) */
216643 u16 nextlen; /* Next Read Len from last header */
217644 u8 rx_seq; /* Receive sequence number (expected) */
@@ -241,27 +668,23 @@ typedef struct dhd_bus { · 23 unmodified lines
241668 uint polltick; /* Tick counter */
242669 uint pollcnt; /* Count of active polls */
243670
244−#ifdef DHD_DEBUG
245− dhd_console_t console; /* Console output polling support */
671+#ifdef BCMDBG
672+ struct brcmf_console console; /* Console output polling support */
246673 uint console_addr; /* Console address from shared struct */
247−#endif /* DHD_DEBUG */
674+#endif /* BCMDBG */
248675
249− uint regfails; /* Count of R_REG/W_REG failures */
676+ uint regfails; /* Count of R_REG failures */
250677
251678 uint clkstate; /* State of sd and backplane clock(s) */
252679 bool activity; /* Activity flag for clock down */
253680 s32 idletime; /* Control for activity timeout */
254681 s32 idlecount; /* Activity timeout counter */
255682 s32 idleclock; /* How to set bus driver when idle */
256− s32 sd_divisor; /* Speed control to bus driver */
257− s32 sd_mode; /* Mode control to bus driver */
258− s32 sd_rxchain; /* If bcmsdh api accepts PKT chains */
259− bool use_rxchain; /* If dhd should use PKT chains */
683+ s32 sd_rxchain;
684+ bool use_rxchain; /* If brcmf should use PKT chains */
260685 bool sleeping; /* Is SDIO bus sleeping? */
261686 bool rxflow_mode; /* Rx flow control mode */
262687 bool rxflow; /* Is rx flow control on */
263− uint prev_rxlim_hit; /* Is prev rx limit exceeded
264− (per dpc schedule) */
265688 bool alp_only; /* Don't use HT clock (ALP only) */
266689 /* Field to decide if rx of control frames happen in rxbuf or lb-pool */
267690 bool usebufpool;
@@ -313,7 +736,68 @@ typedef struct dhd_bus { · 45 unmodified lines
313736 u8 *ctrl_frame_buf;
314737 u32 ctrl_frame_len;
315738 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+
762+struct 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+};
317801
318802 /* clkstate */
319803 #define CLK_NONE 0
@@ -321,29 +805,45 @@ typedef struct dhd_bus { · 1 unmodified line
321805 #define CLK_PENDING 2 /* Not used yet */
322806 #define CLK_AVAIL 3
323807
324−#define DHD_NOPMU(dhd) (false)
808+#define BRCMF_NOPMU(brcmf) (false)
325809
326−#ifdef DHD_DEBUG
810+#ifdef BCMDBG
327811 static int qcount[NUMPRIO];
328812 static int tx_packets[NUMPRIO];
329−#endif /* DHD_DEBUG */
813+#endif /* BCMDBG */
330814
331815 /* Deferred transmit */
332−const uint dhd_deferred_tx = 1;
816+uint brcmf_deferred_tx = 1;
817+module_param(brcmf_deferred_tx, uint, 0);
818+
819+/* Watchdog thread priority, -1 to use kernel timer */
820+int brcmf_watchdog_prio = 97;
821+module_param(brcmf_watchdog_prio, int, 0);
333822
334−extern uint dhd_watchdog_ms;
335−extern void dhd_os_wd_timer(void *bus, uint wdtick);
823+/* Watchdog interval */
824+uint brcmf_watchdog_ms = 10;
825+module_param(brcmf_watchdog_ms, uint, 0);
826+
827+/* DPC thread priority, -1 to use tasklet */
828+int brcmf_dpc_prio = 98;
829+module_param(brcmf_dpc_prio, int, 0);
830+
831+#ifdef BCMDBG
832+/* Console poll interval */
833+uint brcmf_console_ms;
834+module_param(brcmf_console_ms, uint, 0);
835+#endif /* BCMDBG */
336836
337837 /* Tx/Rx bounds */
338−uint dhd_txbound;
339−uint dhd_rxbound;
340−uint dhd_txminmax;
838+uint brcmf_txbound;
839+uint brcmf_rxbound;
840+uint brcmf_txminmax;
341841
342842 /* override the RAM size if possible */
343843 #define DONGLE_MIN_MEMSIZE (128 * 1024)
344−int dhd_dongle_memsize;
844+int brcmf_dongle_memsize;
345845
346−static bool dhd_alignctl;
846+static bool brcmf_alignctl;
347847
348848 static bool sd1idle;
349849
@@ -351,9 +851,7 @@ static bool retrydata; · 1 unmodified line
351851 #define RETRYCHAN(chan) (((chan) == SDPCM_EVENT_CHANNEL) || retrydata)
352852
353853 static const uint watermark = 8;
354−static const uint firstread = DHD_FIRSTREAD;
355−
356−#define HDATLEN (firstread - (SDPCM_HDRLEN))
854+static const uint firstread = BRCMF_FIRSTREAD;
357855
358856 /* Retry count for register access failures */
359857 static const uint retry_limit = 2;
@@ -363,20 +861,11 @@ static bool forcealign; · 3 unmodified lines
363861
364862 #define ALIGNMENT 4
365863
366−#if defined(OOB_INTR_ONLY) && defined(HW_OOB)
367−extern 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) */
373864 #define PKTALIGN(_p, _len, _align) \
374865 do { \
375866 uint datalign; \
376867 datalign = (unsigned long)((_p)->data); \
377868 datalign = roundup(datalign, (_align)) - datalign; \
378− ASSERT(datalign < (_align)); \
379− ASSERT((_p)->len >= ((_len) + datalign)); \
380869 if (datalign) \
381870 skb_pull((_p), datalign); \
382871 __skb_trim((_p), (_len)); \
@@ -386,146 +875,166 @@ extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable); · 3 unmodified lines
386875 static const uint max_roundup = 512;
387876
388877 /* Try doing readahead */
389−static bool dhd_readahead;
878+static bool brcmf_readahead;
390879
391880 /* To check if there's window offered */
392881 #define DATAOK(bus) \
393882 (((u8)(bus->tx_max - bus->tx_seq) != 0) && \
394883 (((u8)(bus->tx_max - bus->tx_seq) & 0x80) == 0))
395884
396−/* Macros to get register read/write status */
397−/* NOTE: these assume a local dhdsdio_bus_t *bus! */
398−#define R_SDREG(regvar, regaddr, retryvar) \
399−do { \
400− retryvar = 0; \
401− do { \
402− regvar = R_REG(regaddr); \
403− } while (bcmsdh_regfail(bus->sdh) && (++retryvar <= retry_limit)); \
404− if (retryvar) { \
405− bus->regfails += (retryvar-1); \
406− if (retryvar > retry_limit) { \
407− DHD_ERROR(("%s: FAILED" #regvar "READ, LINE %d\n", \
408− __func__, __LINE__)); \
409− regvar = 0; \
410− } \
411− } \
412−} while (0)
413−
414−#define W_SDREG(regval, regaddr, retryvar) \
415−do { \
416− retryvar = 0; \
417− do { \
418− W_REG(regaddr, regval); \
419− } while (bcmsdh_regfail(bus->sdh) && (++retryvar <= retry_limit)); \
420− if (retryvar) { \
421− bus->regfails += (retryvar-1); \
422− if (retryvar > retry_limit) \
423− DHD_ERROR(("%s: FAILED REGISTER WRITE, LINE %d\n", \
424− __func__, __LINE__)); \
425− } \
426−} while (0)
427−
428−#define DHD_BUS SDIO_BUS
885+/*
886+ * Reads a register in the SDIO hardware block. This block occupies a series of
887+ * adresses on the 32 bit backplane bus.
888+ */
889+static void
890+r_sdreg32(struct brcmf_bus *bus, u32 *regvar, u32 reg_offset, u32 *retryvar)
891+{
892+ *retryvar = 0;
893+ do {
894+ *regvar = R_REG(bus->ci->buscorebase + reg_offset, u32);
895+ } while (brcmf_sdcard_regfail(bus->card) &&
896+ (++(*retryvar) <= retry_limit));
897+ if (*retryvar) {
898+ bus->regfails += (*retryvar-1);
899+ if (*retryvar > retry_limit) {
900+ BRCMF_ERROR(("FAILED READ %Xh\n", reg_offset));
901+ *regvar = 0;
902+ }
903+ }
904+}
905+
906+static void
907+w_sdreg32(struct brcmf_bus *bus, u32 regval, u32 reg_offset, u32 *retryvar)
908+{
909+ *retryvar = 0;
910+ do {
911+ brcmf_sdcard_reg_write(NULL, bus->ci->buscorebase + reg_offset,
912+ sizeof(u32), regval);
913+ } while (brcmf_sdcard_regfail(bus->card) &&
914+ (++(*retryvar) <= retry_limit));
915+ if (*retryvar) {
916+ bus->regfails += (*retryvar-1);
917+ if (*retryvar > retry_limit)
918+ BRCMF_ERROR(("FAILED REGISTER WRITE"
919+ " %Xh\n", reg_offset));
920+ }
921+}
922+
923+#define BRCMF_BUS SDIO_BUS
429924
430925 #define PKT_AVAILABLE() (intstatus & I_HMB_FRAME_IND)
431926
432927 #define HOSTINTMASK (I_HMB_SW_MASK | I_CHIPACTIVE)
433928
434929 #ifdef SDTEST
435−static void dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq);
436−static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start);
930+static void brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, void *pkt, uint seq);
931+static void brcmf_sdbrcm_sdtest_set(struct brcmf_bus *bus, bool start);
437932 #endif
438933
439−#ifdef DHD_DEBUG
440−static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size);
441−static int dhdsdio_mem_dump(dhd_bus_t *bus);
442−#endif /* DHD_DEBUG */
443−static int dhdsdio_download_state(dhd_bus_t *bus, bool enter);
444−
445−static void dhdsdio_release(dhd_bus_t *bus);
446−static void dhdsdio_release_malloc(dhd_bus_t *bus);
447−static void dhdsdio_disconnect(void *ptr);
448−static bool dhdsdio_chipmatch(u16 chipid);
449−static bool dhdsdio_probe_attach(dhd_bus_t *bus, void *sdh,
450− void *regsva, u16 devid);
451−static bool dhdsdio_probe_malloc(dhd_bus_t *bus, void *sdh);
452−static bool dhdsdio_probe_init(dhd_bus_t *bus, void *sdh);
453−static void dhdsdio_release_dongle(dhd_bus_t *bus);
454−
455−static uint process_nvram_vars(char *varbuf, uint len);
456−
457−static void dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size);
458−static int dhd_bcmsdh_send_buf(dhd_bus_t *bus, u32 addr, uint fn,
934+#ifdef BCMDBG
935+static int brcmf_sdbrcm_bus_console_in(struct brcmf_pub *drvr,
936+ unsigned char *msg, uint msglen);
937+static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size);
938+static int brcmf_sdbrcm_mem_dump(struct brcmf_bus *bus);
939+#endif /* BCMDBG */
940+static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter);
941+
942+static void brcmf_sdbrcm_release(struct brcmf_bus *bus);
943+static void brcmf_sdbrcm_release_malloc(struct brcmf_bus *bus);
944+static void brcmf_sdbrcm_disconnect(void *ptr);
945+static bool brcmf_sdbrcm_chipmatch(u16 chipid);
946+static bool brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card,
947+ u32 regsva, u16 devid);
948+static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus, void *card);
949+static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card);
950+static void brcmf_sdbrcm_release_dongle(struct brcmf_bus *bus);
951+
952+static uint brcmf_process_nvram_vars(char *varbuf, uint len);
953+
954+static void brcmf_sdbrcm_setmemsize(struct brcmf_bus *bus, int mem_size);
955+static int brcmf_sdbrcm_send_buf(struct brcmf_bus *bus, u32 addr, uint fn,
459956 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),
461960 void *handle);
462961
463−static bool dhdsdio_download_firmware(struct dhd_bus *bus, void *sdh);
464−static int _dhdsdio_download_firmware(struct dhd_bus *bus);
962+static bool brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus, void *card);
963+static int _brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus);
465964
466−static int dhdsdio_download_code_file(struct dhd_bus *bus, char *image_path);
467−static int dhdsdio_download_nvram(struct dhd_bus *bus);
468−#ifdef BCMEMBEDIMAGE
469−static int dhdsdio_download_code_array(struct dhd_bus *bus);
470−#endif
471−static void dhdsdio_chip_disablecore(bcmsdh_info_t *sdh, u32 corebase);
472−static int dhdsdio_chip_attach(struct dhd_bus *bus, void *regs);
473−static void dhdsdio_chip_resetcore(bcmsdh_info_t *sdh, u32 corebase);
474−static void dhdsdio_sdiod_drive_strength_init(struct dhd_bus *bus,
965+static int brcmf_sdbrcm_download_code_file(struct brcmf_bus *bus);
966+static int brcmf_sdbrcm_download_nvram(struct brcmf_bus *bus);
967+
968+static void
969+brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio_card *card, u32 corebase);
970+
971+static int brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs);
972+
973+static void
974+brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_card *card, u32 corebase);
975+
976+static void brcmf_sdbrcm_sdiod_drive_strength_init(struct brcmf_bus *bus,
475977 u32 drivestrength);
476−static void dhdsdio_chip_detach(struct dhd_bus *bus);
978+static void brcmf_sdbrcm_chip_detach(struct brcmf_bus *bus);
979+static void brcmf_sdbrcm_wait_for_event(struct brcmf_bus *bus, bool *lockvar);
980+static void brcmf_sdbrcm_wait_event_wakeup(struct brcmf_bus *bus);
981+static void brcmf_sdbrcm_watchdog(unsigned long data);
982+static int brcmf_sdbrcm_watchdog_thread(void *data);
983+static int brcmf_sdbrcm_dpc_thread(void *data);
984+static void brcmf_sdbrcm_dpc_tasklet(unsigned long data);
985+static void brcmf_sdbrcm_sched_dpc(struct brcmf_bus *bus);
986+static void brcmf_sdbrcm_sdlock(struct brcmf_bus *bus);
987+static void brcmf_sdbrcm_sdunlock(struct brcmf_bus *bus);
988+static int brcmf_sdbrcm_get_image(char *buf, int len, struct brcmf_bus *bus);
477989
478990 /* Packet free applicable unconditionally for sdio and sdspi.
479991 * Conditional if bufpool was present for gspi bus.
480992 */
481−static void dhdsdio_pktfree2(dhd_bus_t *bus, struct sk_buff *pkt)
993+static void brcmf_sdbrcm_pktfree2(struct brcmf_bus *bus, struct sk_buff *pkt)
482994 {
483− dhd_os_sdlock_rxq(bus->dhd);
484995 if ((bus->bus != SPI_BUS) || bus->usebufpool)
485− bcm_pkt_buf_free_skb(pkt);
486− dhd_os_sdunlock_rxq(bus->dhd);
996+ brcmu_pkt_buf_free_skb(pkt);
487997 }
488998
489−static void dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size)
999+static void brcmf_sdbrcm_setmemsize(struct brcmf_bus *bus, int mem_size)
4901000 {
4911001 s32 min_size = DONGLE_MIN_MEMSIZE;
4921002 /* Restrict the memsize to user specified limit */
493− DHD_ERROR(("user: Restrict the dongle ram size to %d, min %d\n",
494− dhd_dongle_memsize, min_size));
495− if ((dhd_dongle_memsize > min_size) &&
496− (dhd_dongle_memsize < (s32) bus->orig_ramsize))
497− bus->ramsize = dhd_dongle_memsize;
1003+ BRCMF_ERROR(("user: Restrict the dongle ram size to %d, min %d\n",
1004+ brcmf_dongle_memsize, min_size));
1005+ if ((brcmf_dongle_memsize > min_size) &&
1006+ (brcmf_dongle_memsize < (s32) bus->orig_ramsize))
1007+ bus->ramsize = brcmf_dongle_memsize;
4981008 }
4991009
500−static int dhdsdio_set_siaddr_window(dhd_bus_t *bus, u32 address)
1010+static int brcmf_sdbrcm_set_siaddr_window(struct brcmf_bus *bus, u32 address)
5011011 {
5021012 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,
5041014 (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
5051015 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,
5071018 (address >> 16) & SBSDIO_SBADDRMID_MASK, &err);
5081019 if (!err)
509− bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH,
510− (address >> 24) & SBSDIO_SBADDRHIGH_MASK,
511− &err);
1020+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
1021+ SBSDIO_FUNC1_SBADDRHIGH,
1022+ (address >> 24) & SBSDIO_SBADDRHIGH_MASK,
1023+ &err);
5121024 return err;
5131025 }
5141026
5151027 /* Turn backplane clock on or off */
516−static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
1028+static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
5171029 {
5181030 int err;
5191031 u8 clkctl, clkreq, devctl;
520− bcmsdh_info_t *sdh;
1032+ struct brcmf_sdio_card *card;
5211033
522− DHD_TRACE(("%s: Enter\n", __func__));
1034+ BRCMF_TRACE(("%s: Enter\n", __func__));
5231035
524−#if defined(OOB_INTR_ONLY)
525− pendok = false;
526−#endif
5271036 clkctl = 0;
528− sdh = bus->sdh;
1037+ card = bus->card;
5291038
5301039 if (on) {
5311040 /* Request HT Avail */
@@ -536,99 +1045,93 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) · 4 unmodified lines
5361045 && (bus->ci->chiprev == 0))
5371046 clkreq |= SBSDIO_FORCE_ALP;
5381047
539− bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
540− clkreq, &err);
1048+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1049+ SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
5411050 if (err) {
542− DHD_ERROR(("%s: HT Avail request error: %d\n",
543− __func__, err));
1051+ BRCMF_ERROR(("%s: HT Avail request error: %d\n",
1052+ __func__, err));
5441053 return -EBADE;
5451054 }
5461055
5471056 if (pendok && ((bus->ci->buscoretype == PCMCIA_CORE_ID)
5481057 && (bus->ci->buscorerev == 9))) {
5491058 u32 dummy, retries;
550− R_SDREG(dummy, &bus->regs->clockctlstatus, retries);
1059+ r_sdreg32(bus, &dummy,
1060+ offsetof(struct sdpcmd_regs, clockctlstatus),
1061+ &retries);
5511062 }
5521063
5531064 /* Check current status */
554− clkctl =
555− bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
556− &err);
1065+ clkctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
1066+ SBSDIO_FUNC1_CHIPCLKCSR, &err);
5571067 if (err) {
558− DHD_ERROR(("%s: HT Avail read error: %d\n",
559− __func__, err));
1068+ BRCMF_ERROR(("%s: HT Avail read error: %d\n",
1069+ __func__, err));
5601070 return -EBADE;
5611071 }
5621072
5631073 /* Go to pending and await interrupt if appropriate */
5641074 if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) {
5651075 /* Allow only clock-available interrupt */
566− devctl =
567− bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,
568− &err);
1076+ devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
1077+ SBSDIO_DEVICE_CTL, &err);
5691078 if (err) {
570− DHD_ERROR(("%s: Devctl error setting CA: %d\n",
571− __func__, err));
1079+ BRCMF_ERROR(("%s: Devctl error setting CA:"
1080+ " %d\n", __func__, err));
5721081 return -EBADE;
5731082 }
5741083
5751084 devctl |= SBSDIO_DEVCTL_CA_INT_ONLY;
576− bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,
577− devctl, &err);
578− DHD_INFO(("CLKCTL: set PENDING\n"));
1085+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1086+ SBSDIO_DEVICE_CTL, devctl, &err);
1087+ BRCMF_INFO(("CLKCTL: set PENDING\n"));
5791088 bus->clkstate = CLK_PENDING;
5801089
5811090 return 0;
5821091 } else if (bus->clkstate == CLK_PENDING) {
5831092 /* Cancel CA-only interrupt filter */
5841093 devctl =
585− bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,
586− &err);
1094+ brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
1095+ SBSDIO_DEVICE_CTL, &err);
5871096 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
588− bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,
589− devctl, &err);
1097+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1098+ SBSDIO_DEVICE_CTL, devctl, &err);
5901099 }
5911100
5921101 /* Otherwise, wait here (polling) for HT Avail */
5931102 if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {
594− SPINWAIT_SLEEP(sdioh_spinwait_sleep,
595− ((clkctl =
596− bcmsdh_cfg_read(sdh, SDIO_FUNC_1,
597− SBSDIO_FUNC1_CHIPCLKCSR,
598− &err)),
599− !SBSDIO_CLKAV(clkctl, bus->alp_only)),
600− PMU_MAX_TRANSITION_DLY);
1103+ BRCMF_SPINWAIT_SLEEP(sdioh_spinwait_sleep,
1104+ ((clkctl =
1105+ brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
1106+ SBSDIO_FUNC1_CHIPCLKCSR,
1107+ &err)),
1108+ !SBSDIO_CLKAV(clkctl, bus->alp_only)),
1109+ PMU_MAX_TRANSITION_DLY);
6011110 }
6021111 if (err) {
603− DHD_ERROR(("%s: HT Avail request error: %d\n",
604− __func__, err));
1112+ BRCMF_ERROR(("%s: HT Avail request error: %d\n",
1113+ __func__, err));
6051114 return -EBADE;
6061115 }
6071116 if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {
608− DHD_ERROR(("%s: HT Avail timeout (%d): clkctl 0x%02x\n",
609− __func__, PMU_MAX_TRANSITION_DLY, clkctl));
1117+ BRCMF_ERROR(("%s: HT Avail timeout (%d): "
1118+ "clkctl 0x%02x\n", __func__,
1119+ PMU_MAX_TRANSITION_DLY, clkctl));
6101120 return -EBADE;
6111121 }
6121122
6131123 /* Mark clock available */
6141124 bus->clkstate = CLK_AVAIL;
615− DHD_INFO(("CLKCTL: turned ON\n"));
616−
617−#if defined(DHD_DEBUG)
618− 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 {
1125+ BRCMF_INFO(("CLKCTL: turned ON\n"));
1126+
1127+#if defined(BCMDBG)
1128+ if (bus->alp_only != true) {
6261129 if (SBSDIO_ALPONLY(clkctl)) {
627− DHD_ERROR(("%s: HT Clock should be on.\n",
628− __func__));
1130+ BRCMF_ERROR(("%s: HT Clock should be on.\n",
1131+ __func__));
6291132 }
6301133 }
631−#endif /* defined (DHD_DEBUG) */
1134+#endif /* defined (BCMDBG) */
6321135
6331136 bus->activity = true;
6341137 } else {
@@ -636,21 +1139,20 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) · 1 unmodified line
6361139
6371140 if (bus->clkstate == CLK_PENDING) {
6381141 /* Cancel CA-only interrupt filter */
639− devctl =
640− bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,
641− &err);
1142+ devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
1143+ SBSDIO_DEVICE_CTL, &err);
6421144 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
643− bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,
644− devctl, &err);
1145+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1146+ SBSDIO_DEVICE_CTL, devctl, &err);
6451147 }
6461148
6471149 bus->clkstate = CLK_SDONLY;
648− bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
649− clkreq, &err);
650− DHD_INFO(("CLKCTL: turned OFF\n"));
1150+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1151+ SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
1152+ BRCMF_INFO(("CLKCTL: turned OFF\n"));
6511153 if (err) {
652− DHD_ERROR(("%s: Failed access turning clock off: %d\n",
653− __func__, err));
1154+ BRCMF_ERROR(("%s: Failed access turning clock off:"
1155+ " %d\n", __func__, err));
6541156 return -EBADE;
6551157 }
6561158 }
@@ -658,105 +1160,31 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) · 1 unmodified line
6581160 }
6591161
6601162 /* Change idle/active SD state */
661−static int dhdsdio_sdclk(dhd_bus_t *bus, bool on)
1163+static int brcmf_sdbrcm_sdclk(struct brcmf_bus *bus, bool on)
6621164 {
663− int err;
664− s32 iovalue;
1165+ BRCMF_TRACE(("%s: Enter\n", __func__));
6651166
666− DHD_TRACE(("%s: Enter\n", __func__));
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− }
1167+ if (on)
6991168 bus->clkstate = CLK_SDONLY;
700− } 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− }
1169+ else
7411170 bus->clkstate = CLK_NONE;
742− }
7431171
7441172 return 0;
7451173 }
7461174
7471175 /* Transition SD and backplane clock readiness */
748−static int dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok)
1176+static int brcmf_sdbrcm_clkctl(struct brcmf_bus *bus, uint target, bool pendok)
7491177 {
750−#ifdef DHD_DEBUG
1178+#ifdef BCMDBG
7511179 uint oldstate = bus->clkstate;
752−#endif /* DHD_DEBUG */
1180+#endif /* BCMDBG */
7531181
754− DHD_TRACE(("%s: Enter\n", __func__));
1182+ BRCMF_TRACE(("%s: Enter\n", __func__));
7551183
7561184 /* Early exit if we're already there */
7571185 if (bus->clkstate == target) {
7581186 if (target == CLK_AVAIL) {
759− dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms);
1187+ brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
7601188 bus->activity = true;
7611189 }
7621190 return 0;
@@ -766,50 +1194,50 @@ static int dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok) · 3 unmodified lines
7661194 case CLK_AVAIL:
7671195 /* Make sure SD clock is available */
7681196 if (bus->clkstate == CLK_NONE)
769− dhdsdio_sdclk(bus, true);
1197+ brcmf_sdbrcm_sdclk(bus, true);
7701198 /* Now request HT Avail on the backplane */
771− dhdsdio_htclk(bus, true, pendok);
772− dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms);
1199+ brcmf_sdbrcm_htclk(bus, true, pendok);
1200+ brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
7731201 bus->activity = true;
7741202 break;
7751203
7761204 case CLK_SDONLY:
7771205 /* Remove HT request, or bring up SD clock */
7781206 if (bus->clkstate == CLK_NONE)
779− dhdsdio_sdclk(bus, true);
1207+ brcmf_sdbrcm_sdclk(bus, true);
7801208 else if (bus->clkstate == CLK_AVAIL)
781− dhdsdio_htclk(bus, false, false);
1209+ brcmf_sdbrcm_htclk(bus, false, false);
7821210 else
783− DHD_ERROR(("dhdsdio_clkctl: request for %d -> %d\n",
784− bus->clkstate, target));
785− dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms);
1211+ BRCMF_ERROR(("brcmf_sdbrcm_clkctl: request for %d -> %d"
1212+ "\n", bus->clkstate, target));
1213+ brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
7861214 break;
7871215
7881216 case CLK_NONE:
7891217 /* Make sure to remove HT request */
7901218 if (bus->clkstate == CLK_AVAIL)
791− dhdsdio_htclk(bus, false, false);
1219+ brcmf_sdbrcm_htclk(bus, false, false);
7921220 /* Now remove the SD clock */
793− dhdsdio_sdclk(bus, false);
794− dhd_os_wd_timer(bus->dhd, 0);
1221+ brcmf_sdbrcm_sdclk(bus, false);
1222+ brcmf_sdbrcm_wd_timer(bus, 0);
7951223 break;
7961224 }
797−#ifdef DHD_DEBUG
798− DHD_INFO(("dhdsdio_clkctl: %d -> %d\n", oldstate, bus->clkstate));
799−#endif /* DHD_DEBUG */
1225+#ifdef BCMDBG
1226+ BRCMF_INFO(("brcmf_sdbrcm_clkctl: %d -> %d\n",
1227+ oldstate, bus->clkstate));
1228+#endif /* BCMDBG */
8001229
8011230 return 0;
8021231 }
8031232
804−int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep)
1233+int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep)
8051234 {
806− bcmsdh_info_t *sdh = bus->sdh;
807− sdpcmd_regs_t *regs = bus->regs;
1235+ struct brcmf_sdio_card *card = bus->card;
8081236 uint retries = 0;
8091237
810− DHD_INFO(("dhdsdio_bussleep: request %s (currently %s)\n",
811− (sleep ? "SLEEP" : "WAKE"),
812− (bus->sleeping ? "SLEEP" : "WAKE")));
1238+ BRCMF_INFO(("brcmf_sdbrcm_bussleep: request %s (currently %s)\n",
1239+ (sleep ? "SLEEP" : "WAKE"),
1240+ (bus->sleeping ? "SLEEP" : "WAKE")));
8131241
8141242 /* Done if we're already in the requested state */
8151243 if (sleep == bus->sleeping)
@@ -822,27 +1250,31 @@ int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep) · 6 unmodified lines
8221250 return -EBUSY;
8231251
8241252 /* Disable SDIO interrupts (no longer interested) */
825− bcmsdh_intr_disable(bus->sdh);
1253+ brcmf_sdcard_intr_disable(bus->card);
8261254
8271255 /* Make sure the controller has the bus up */
828− dhdsdio_clkctl(bus, CLK_AVAIL, false);
1256+ brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
8291257
8301258 /* 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);
8321261 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"));
8341264
8351265 /* Turn off our contribution to the HT clock request */
836− dhdsdio_clkctl(bus, CLK_SDONLY, false);
1266+ brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false);
8371267
838− bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
839− SBSDIO_FORCE_HW_CLKREQ_OFF, NULL);
1268+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1269+ SBSDIO_FUNC1_CHIPCLKCSR,
1270+ SBSDIO_FORCE_HW_CLKREQ_OFF, NULL);
8401271
8411272 /* Isolate the bus */
8421273 if (bus->ci->chip != BCM4329_CHIP_ID
8431274 && bus->ci->chip != BCM4319_CHIP_ID) {
844− bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL,
845− SBSDIO_DEVCTL_PADS_ISO, NULL);
1275+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1276+ SBSDIO_DEVICE_CTL,
1277+ SBSDIO_DEVCTL_PADS_ISO, NULL);
8461278 }
8471279
8481280 /* Change state */
@@ -851,82 +1283,55 @@ int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep) · 2 unmodified lines
8511283 } else {
8521284 /* Waking up: bus power up is ok, set local state */
8531285
854− bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
855− 0, NULL);
1286+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1287+ SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
8561288
8571289 /* Force pad isolation off if possible
8581290 (in case power never toggled) */
8591291 if ((bus->ci->buscoretype == PCMCIA_CORE_ID)
8601292 && (bus->ci->buscorerev >= 10))
861− bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, 0,
862− NULL);
1293+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
1294+ SBSDIO_DEVICE_CTL, 0, NULL);
8631295
8641296 /* Make sure the controller has the bus up */
865− dhdsdio_clkctl(bus, CLK_AVAIL, false);
1297+ brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
8661298
8671299 /* 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);
8691302 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);
8711306
8721307 if (retries > retry_limit)
873− DHD_ERROR(("CANNOT SIGNAL CHIP TO CLEAR OOB!!\n"));
1308+ BRCMF_ERROR(("CANNOT SIGNAL CHIP TO CLEAR OOB!!\n"));
8741309
8751310 /* Make sure we have SD bus access */
876− dhdsdio_clkctl(bus, CLK_SDONLY, false);
1311+ brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false);
8771312
8781313 /* Change state */
8791314 bus->sleeping = false;
8801315
8811316 /* Enable interrupts again */
882− if (bus->intr && (bus->dhd->busstate == DHD_BUS_DATA)) {
1317+ if (bus->intr && (bus->drvr->busstate == BRCMF_BUS_DATA)) {
8831318 bus->intdis = false;
884− bcmsdh_intr_enable(bus->sdh);
1319+ brcmf_sdcard_intr_enable(bus->card);
8851320 }
8861321 }
8871322
8881323 return 0;
8891324 }
8901325
891−#if defined(OOB_INTR_ONLY)
892−void 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−
9211326 #define BUS_WAKE(bus) \
9221327 do { \
9231328 if ((bus)->sleeping) \
924− dhdsdio_bussleep((bus), false); \
1329+ brcmf_sdbrcm_bussleep((bus), false); \
9251330 } while (0);
9261331
9271332 /* Writes a HW/SW header into the packet and sends it. */
9281333 /* Assumes: (a) header space already there, (b) caller holds lock */
929−static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
1334+static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt, uint chan,
9301335 bool free_pkt)
9311336 {
9321337 int ret;
@@ -934,15 +1339,15 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 1 unmodified line
9341339 u16 len, pad = 0;
9351340 u32 swheader;
9361341 uint retries = 0;
937− bcmsdh_info_t *sdh;
1342+ struct brcmf_sdio_card *card;
9381343 struct sk_buff *new;
9391344 int i;
9401345
941− DHD_TRACE(("%s: Enter\n", __func__));
1346+ BRCMF_TRACE(("%s: Enter\n", __func__));
9421347
943− sdh = bus->sdh;
1348+ card = bus->card;
9441349
945− if (bus->dhd->dongle_reset) {
1350+ if (bus->drvr->dongle_reset) {
9461351 ret = -EPERM;
9471352 goto done;
9481353 }
@@ -950,40 +1355,39 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 1 unmodified line
9501355 frame = (u8 *) (pkt->data);
9511356
9521357 /* Add alignment padding, allocate new packet if needed */
953− pad = ((unsigned long)frame % DHD_SDALIGN);
1358+ pad = ((unsigned long)frame % BRCMF_SDALIGN);
9541359 if (pad) {
9551360 if (skb_headroom(pkt) < pad) {
956− DHD_INFO(("%s: insufficient headroom %d for %d pad\n",
957− __func__, skb_headroom(pkt), pad));
958− bus->dhd->tx_realloc++;
959− new = bcm_pkt_buf_get_skb(pkt->len + DHD_SDALIGN);
1361+ BRCMF_INFO(("%s: insufficient headroom %d for %d pad\n",
1362+ __func__, skb_headroom(pkt), pad));
1363+ bus->drvr->tx_realloc++;
1364+ new = brcmu_pkt_buf_get_skb(pkt->len + BRCMF_SDALIGN);
9601365 if (!new) {
961− DHD_ERROR(("%s: couldn't allocate new %d-byte "
962− "packet\n",
963− __func__, pkt->len + DHD_SDALIGN));
1366+ BRCMF_ERROR(("%s: couldn't allocate new "
1367+ "%d-byte packet\n", __func__,
1368+ pkt->len + BRCMF_SDALIGN));
9641369 ret = -ENOMEM;
9651370 goto done;
9661371 }
9671372
968− PKTALIGN(new, pkt->len, DHD_SDALIGN);
1373+ PKTALIGN(new, pkt->len, BRCMF_SDALIGN);
9691374 memcpy(new->data, pkt->data, pkt->len);
9701375 if (free_pkt)
971− bcm_pkt_buf_free_skb(pkt);
1376+ brcmu_pkt_buf_free_skb(pkt);
9721377 /* free the pkt if canned one is not used */
9731378 free_pkt = true;
9741379 pkt = new;
9751380 frame = (u8 *) (pkt->data);
976− ASSERT(((unsigned long)frame % DHD_SDALIGN) == 0);
1381+ /* precondition: (frame % BRCMF_SDALIGN) == 0) */
9771382 pad = 0;
9781383 } else {
9791384 skb_push(pkt, pad);
9801385 frame = (u8 *) (pkt->data);
981−
982− ASSERT((pad + SDPCM_HDRLEN) <= (int)(pkt->len));
1386+ /* precondition: pad + SDPCM_HDRLEN <= pkt->len */
9831387 memset(frame, 0, pad + SDPCM_HDRLEN);
9841388 }
9851389 }
986− ASSERT(pad < DHD_SDALIGN);
1390+ /* precondition: pad < BRCMF_SDALIGN */
9871391
9881392 /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
9891393 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
9991403 put_unaligned_le32(swheader, frame + SDPCM_FRAMETAG_LEN);
10001404 put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
10011405
1002−#ifdef DHD_DEBUG
1406+#ifdef BCMDBG
10031407 tx_packets[pkt->priority]++;
1004− if (DHD_BYTES_ON() &&
1005− (((DHD_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) ||
1006− (DHD_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) {
1408+ if (BRCMF_BYTES_ON() &&
1409+ (((BRCMF_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) ||
1410+ (BRCMF_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) {
10071411 printk(KERN_DEBUG "Tx Frame:\n");
10081412 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, frame, len);
1009− } else if (DHD_HDRS_ON()) {
1413+ } else if (BRCMF_HDRS_ON()) {
10101414 printk(KERN_DEBUG "TxHdr:\n");
10111415 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
10121416 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
10171421 if (bus->roundup && bus->blocksize && (len > bus->blocksize)) {
10181422 u16 pad = bus->blocksize - (len % bus->blocksize);
10191423 if ((pad <= bus->roundup) && (pad < bus->blocksize))
1020−#ifdef NOTUSED
1021− if (pad <= skb_tailroom(pkt))
1022−#endif /* NOTUSED */
10231424 len += pad;
1024− } else if (len % DHD_SDALIGN) {
1025− len += DHD_SDALIGN - (len % DHD_SDALIGN);
1425+ } else if (len % BRCMF_SDALIGN) {
1426+ len += BRCMF_SDALIGN - (len % BRCMF_SDALIGN);
10261427 }
10271428
10281429 /* Some controllers have trouble with odd bytes -- round to even */
10291430 if (forcealign && (len & (ALIGNMENT - 1))) {
1030−#ifdef NOTUSED
1031− if (skb_tailroom(pkt))
1032−#endif
10331431 len = roundup(len, ALIGNMENT);
1034−#ifdef NOTUSED
1035− else
1036− DHD_ERROR(("%s: sending unrounded %d-byte packet\n",
1037− __func__, len));
1038−#endif
10391432 }
10401433
10411434 do {
1042− ret =
1043− dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2,
1044− F2SYNC, frame, len, pkt, NULL, NULL);
1435+ ret = brcmf_sdbrcm_send_buf(bus, brcmf_sdcard_cur_sbwad(card),
1436+ SDIO_FUNC_2, F2SYNC, frame, len, pkt, NULL, NULL);
10451437 bus->f2txdata++;
1046− ASSERT(ret != -BCME_PENDING);
10471438
10481439 if (ret < 0) {
10491440 /* On failure, abort the command
10501441 and terminate the frame */
1051− DHD_INFO(("%s: sdio error %d, abort command and "
1052− "terminate frame.\n", __func__, ret));
1442+ BRCMF_INFO(("%s: sdio error %d, abort command and "
1443+ "terminate frame.\n", __func__, ret));
10531444 bus->tx_sderrs++;
10541445
1055− bcmsdh_abort(sdh, SDIO_FUNC_2);
1056− bcmsdh_cfg_write(sdh, SDIO_FUNC_1,
1446+ brcmf_sdcard_abort(card, SDIO_FUNC_2);
1447+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
10571448 SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM,
10581449 NULL);
10591450 bus->f1regdata++;
10601451
10611452 for (i = 0; i < 3; i++) {
10621453 u8 hi, lo;
1063− hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,
1454+ hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
10641455 SBSDIO_FUNC1_WFRAMEBCHI,
10651456 NULL);
1066− lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,
1457+ lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
10671458 SBSDIO_FUNC1_WFRAMEBCLO,
10681459 NULL);
10691460 bus->f1regdata += 2;
@@ -1080,22 +1471,22 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 10 unmodified lines
10801471 done:
10811472 /* restore pkt buffer pointer before calling tx complete routine */
10821473 skb_pull(pkt, SDPCM_HDRLEN + pad);
1083− dhd_os_sdunlock(bus->dhd);
1084− dhd_txcomplete(bus->dhd, pkt, ret != 0);
1085− dhd_os_sdlock(bus->dhd);
1474+ brcmf_sdbrcm_sdunlock(bus);
1475+ brcmf_txcomplete(bus->drvr, pkt, ret != 0);
1476+ brcmf_sdbrcm_sdlock(bus);
10861477
10871478 if (free_pkt)
1088− bcm_pkt_buf_free_skb(pkt);
1479+ brcmu_pkt_buf_free_skb(pkt);
10891480
10901481 return ret;
10911482 }
10921483
1093−int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
1484+int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *pkt)
10941485 {
10951486 int ret = -EBADE;
10961487 uint datalen, prec;
10971488
1098− DHD_TRACE(("%s: Enter\n", __func__));
1489+ BRCMF_TRACE(("%s: Enter\n", __func__));
10991490
11001491 datalen = pkt->len;
11011492
@@ -1115,79 +1506,80 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) · 13 unmodified lines
11151506
11161507 /* Add space for the header */
11171508 skb_push(pkt, SDPCM_HDRLEN);
1118− ASSERT(IS_ALIGNED((unsigned long)(pkt->data), 2));
1509+ /* precondition: IS_ALIGNED((unsigned long)(pkt->data), 2) */
11191510
11201511 prec = PRIO2PREC((pkt->priority & PRIOMASK));
11211512
11221513 /* Check for existing queue, current flow-control,
11231514 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)
11251516 || bus->dpc_sched || (!DATAOK(bus))
11261517 || (bus->flowcontrol & NBITVAL(prec))
11271518 || (bus->clkstate != CLK_AVAIL)) {
1128− DHD_TRACE(("%s: deferring pktq len %d\n", __func__,
1129− pktq_len(&bus->txq)));
1519+ BRCMF_TRACE(("%s: deferring pktq len %d\n", __func__,
1520+ pktq_len(&bus->txq)));
11301521 bus->fcqueued++;
11311522
11321523 /* Priority based enq */
1133− dhd_os_sdlock_txq(bus->dhd);
1134− if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) {
1524+ spin_lock_bh(&bus->txqlock);
1525+ if (brcmf_c_prec_enq(bus->drvr, &bus->txq, pkt, prec) == false) {
11351526 skb_pull(pkt, SDPCM_HDRLEN);
1136− dhd_txcomplete(bus->dhd, pkt, false);
1137− bcm_pkt_buf_free_skb(pkt);
1138− DHD_ERROR(("%s: out of bus->txq !!!\n", __func__));
1527+ brcmf_txcomplete(bus->drvr, pkt, false);
1528+ brcmu_pkt_buf_free_skb(pkt);
1529+ BRCMF_ERROR(("%s: out of bus->txq !!!\n", __func__));
11391530 ret = -ENOSR;
11401531 } else {
11411532 ret = 0;
11421533 }
1143− dhd_os_sdunlock_txq(bus->dhd);
1534+ spin_unlock_bh(&bus->txqlock);
11441535
11451536 if (pktq_len(&bus->txq) >= TXHI)
1146− dhd_txflowcontrol(bus->dhd, 0, ON);
1537+ brcmf_txflowcontrol(bus->drvr, 0, ON);
11471538
1148−#ifdef DHD_DEBUG
1539+#ifdef BCMDBG
11491540 if (pktq_plen(&bus->txq, prec) > qcount[prec])
11501541 qcount[prec] = pktq_plen(&bus->txq, prec);
11511542 #endif
11521543 /* 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) {
11541545 bus->dpc_sched = true;
1155− dhd_sched_dpc(bus->dhd);
1546+ brcmf_sdbrcm_sched_dpc(bus);
11561547 }
11571548 } else {
11581549 /* Lock: we're about to use shared data/code (and SDIO) */
1159− dhd_os_sdlock(bus->dhd);
1550+ brcmf_sdbrcm_sdlock(bus);
11601551
11611552 /* Otherwise, send it now */
11621553 BUS_WAKE(bus);
11631554 /* 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);
11651556
11661557 #ifndef SDTEST
1167− DHD_TRACE(("%s: calling txpkt\n", __func__));
1168− ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
1558+ BRCMF_TRACE(("%s: calling txpkt\n", __func__));
1559+ ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
11691560 #else
1170− ret = dhdsdio_txpkt(bus, pkt,
1561+ ret = brcmf_sdbrcm_txpkt(bus, pkt,
11711562 (bus->ext_loop ? SDPCM_TEST_CHANNEL :
11721563 SDPCM_DATA_CHANNEL), true);
11731564 #endif
11741565 if (ret)
1175− bus->dhd->tx_errors++;
1566+ bus->drvr->tx_errors++;
11761567 else
1177− bus->dhd->dstats.tx_bytes += datalen;
1568+ bus->drvr->dstats.tx_bytes += datalen;
11781569
1179− if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) {
1570+ if (bus->idletime == BRCMF_IDLE_IMMEDIATE &&
1571+ !bus->dpc_sched) {
11801572 bus->activity = false;
1181− dhdsdio_clkctl(bus, CLK_NONE, true);
1573+ brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
11821574 }
11831575
1184− dhd_os_sdunlock(bus->dhd);
1576+ brcmf_sdbrcm_sdunlock(bus);
11851577 }
11861578
11871579 return ret;
11881580 }
11891581
1190−static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes)
1582+static uint brcmf_sdbrcm_sendfromq(struct brcmf_bus *bus, uint maxframes)
11911583 {
11921584 struct sk_buff *pkt;
11931585 u32 intstatus = 0;
@@ -1197,42 +1589,43 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) · 3 unmodified lines
11971589 uint datalen;
11981590 u8 tx_prec_map;
11991591
1200− dhd_pub_t *dhd = bus->dhd;
1201− sdpcmd_regs_t *regs = bus->regs;
1592+ struct brcmf_pub *drvr = bus->drvr;
12021593
1203− DHD_TRACE(("%s: Enter\n", __func__));
1594+ BRCMF_TRACE(("%s: Enter\n", __func__));
12041595
12051596 tx_prec_map = ~bus->flowcontrol;
12061597
12071598 /* Send frames until the limit or some other event */
12081599 for (cnt = 0; (cnt < maxframes) && DATAOK(bus); cnt++) {
1209− dhd_os_sdlock_txq(bus->dhd);
1210− pkt = bcm_pktq_mdeq(&bus->txq, tx_prec_map, &prec_out);
1600+ spin_lock_bh(&bus->txqlock);
1601+ pkt = brcmu_pktq_mdeq(&bus->txq, tx_prec_map, &prec_out);
12111602 if (pkt == NULL) {
1212− dhd_os_sdunlock_txq(bus->dhd);
1603+ spin_unlock_bh(&bus->txqlock);
12131604 break;
12141605 }
1215− dhd_os_sdunlock_txq(bus->dhd);
1606+ spin_unlock_bh(&bus->txqlock);
12161607 datalen = pkt->len - SDPCM_HDRLEN;
12171608
12181609 #ifndef SDTEST
1219− ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
1610+ ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
12201611 #else
1221− ret = dhdsdio_txpkt(bus, pkt,
1612+ ret = brcmf_sdbrcm_txpkt(bus, pkt,
12221613 (bus->ext_loop ? SDPCM_TEST_CHANNEL :
12231614 SDPCM_DATA_CHANNEL), true);
12241615 #endif
12251616 if (ret)
1226− bus->dhd->tx_errors++;
1617+ bus->drvr->tx_errors++;
12271618 else
1228− bus->dhd->dstats.tx_bytes += datalen;
1619+ bus->drvr->dstats.tx_bytes += datalen;
12291620
12301621 /* In poll mode, need to check for other events */
12311622 if (!bus->intr && cnt) {
12321623 /* 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);
12341627 bus->f2txdata++;
1235− if (bcmsdh_regfail(bus->sdh))
1628+ if (brcmf_sdcard_regfail(bus->card))
12361629 break;
12371630 if (intstatus & bus->hostintmask)
12381631 bus->ipend = true;
@@ -1240,27 +1633,28 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) · 1 unmodified line
12401633 }
12411634
12421635 /* Deflow-control stack if needed */
1243− if (dhd->up && (dhd->busstate == DHD_BUS_DATA) &&
1244− dhd->txoff && (pktq_len(&bus->txq) < TXLOW))
1245− dhd_txflowcontrol(dhd, 0, OFF);
1636+ if (drvr->up && (drvr->busstate == BRCMF_BUS_DATA) &&
1637+ drvr->txoff && (pktq_len(&bus->txq) < TXLOW))
1638+ brcmf_txflowcontrol(drvr, 0, OFF);
12461639
12471640 return cnt;
12481641 }
12491642
1250−int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
1643+int
1644+brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
12511645 {
12521646 u8 *frame;
12531647 u16 len;
12541648 u32 swheader;
12551649 uint retries = 0;
1256− bcmsdh_info_t *sdh = bus->sdh;
1650+ struct brcmf_sdio_card *card = bus->card;
12571651 u8 doff = 0;
12581652 int ret = -1;
12591653 int i;
12601654
1261− DHD_TRACE(("%s: Enter\n", __func__));
1655+ BRCMF_TRACE(("%s: Enter\n", __func__));
12621656
1263− if (bus->dhd->dongle_reset)
1657+ if (bus->drvr->dongle_reset)
12641658 return -EIO;
12651659
12661660 /* 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
12681662 len = (msglen += SDPCM_HDRLEN);
12691663
12701664 /* Add alignment padding (optional for ctl frames) */
1271− if (dhd_alignctl) {
1272− doff = ((unsigned long)frame % DHD_SDALIGN);
1665+ if (brcmf_alignctl) {
1666+ doff = ((unsigned long)frame % BRCMF_SDALIGN);
12731667 if (doff) {
12741668 frame -= doff;
12751669 len += doff;
12761670 msglen += doff;
12771671 memset(frame, 0, doff + SDPCM_HDRLEN);
12781672 }
1279− ASSERT(doff < DHD_SDALIGN);
1673+ /* precondition: doff < BRCMF_SDALIGN */
12801674 }
12811675 doff += SDPCM_HDRLEN;
12821676
@@ -1285,23 +1679,23 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 2 unmodified lines
12851679 u16 pad = bus->blocksize - (len % bus->blocksize);
12861680 if ((pad <= bus->roundup) && (pad < bus->blocksize))
12871681 len += pad;
1288− } else if (len % DHD_SDALIGN) {
1289− len += DHD_SDALIGN - (len % DHD_SDALIGN);
1682+ } else if (len % BRCMF_SDALIGN) {
1683+ len += BRCMF_SDALIGN - (len % BRCMF_SDALIGN);
12901684 }
12911685
12921686 /* Satisfy length-alignment requirements */
12931687 if (forcealign && (len & (ALIGNMENT - 1)))
12941688 len = roundup(len, ALIGNMENT);
12951689
1296− ASSERT(IS_ALIGNED((unsigned long)frame, 2));
1690+ /* precondition: IS_ALIGNED((unsigned long)frame, 2) */
12971691
12981692 /* Need to lock here to protect txseq and SDIO tx calls */
1299− dhd_os_sdlock(bus->dhd);
1693+ brcmf_sdbrcm_sdlock(bus);
13001694
13011695 BUS_WAKE(bus);
13021696
13031697 /* Make sure backplane clock is on */
1304− dhdsdio_clkctl(bus, CLK_AVAIL, false);
1698+ brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
13051699
13061700 /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
13071701 *(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
13171711 put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
13181712
13191713 if (!DATAOK(bus)) {
1320− DHD_INFO(("%s: No bus credit bus->tx_max %d, bus->tx_seq %d\n",
1321− __func__, bus->tx_max, bus->tx_seq));
1714+ BRCMF_INFO(("%s: No bus credit bus->tx_max %d,"
1715+ " bus->tx_seq %d\n", __func__,
1716+ bus->tx_max, bus->tx_seq));
13221717 bus->ctrl_frame_stat = true;
13231718 /* Send from dpc */
13241719 bus->ctrl_frame_buf = frame;
13251720 bus->ctrl_frame_len = len;
13261721
1327− dhd_wait_for_event(bus->dhd, &bus->ctrl_frame_stat);
1722+ brcmf_sdbrcm_wait_for_event(bus, &bus->ctrl_frame_stat);
13281723
13291724 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__));
13311727 ret = 0;
13321728 } else {
1333− DHD_INFO(("%s: ctrl_frame_stat == true\n", __func__));
1729+ BRCMF_INFO(("%s: ctrl_frame_stat == true\n", __func__));
13341730 ret = -1;
13351731 }
13361732 }
13371733
13381734 if (ret == -1) {
1339−#ifdef DHD_DEBUG
1340− if (DHD_BYTES_ON() && DHD_CTL_ON()) {
1735+#ifdef BCMDBG
1736+ if (BRCMF_BYTES_ON() && BRCMF_CTL_ON()) {
13411737 printk(KERN_DEBUG "Tx Frame:\n");
13421738 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
13431739 frame, len);
1344− } else if (DHD_HDRS_ON()) {
1740+ } else if (BRCMF_HDRS_ON()) {
13451741 printk(KERN_DEBUG "TxHdr:\n");
13461742 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
13471743 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
13501746
13511747 do {
13521748 bus->ctrl_frame_stat = false;
1353− ret =
1354− dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh),
1355− SDIO_FUNC_2, F2SYNC, frame, len,
1356− NULL, NULL, NULL);
1357−
1358− ASSERT(ret != -BCME_PENDING);
1749+ ret = brcmf_sdbrcm_send_buf(bus,
1750+ brcmf_sdcard_cur_sbwad(card), SDIO_FUNC_2,
1751+ F2SYNC, frame, len, NULL, NULL, NULL);
13591752
13601753 if (ret < 0) {
13611754 /* On failure, abort the command and
13621755 terminate the frame */
1363− DHD_INFO(("%s: sdio error %d, abort command and terminate frame.\n",
1364− __func__, ret));
1756+ BRCMF_INFO(("%s: sdio error %d, abort command "
1757+ "and terminate frame.\n",
1758+ __func__, ret));
13651759 bus->tx_sderrs++;
13661760
1367− bcmsdh_abort(sdh, SDIO_FUNC_2);
1761+ brcmf_sdcard_abort(card, SDIO_FUNC_2);
13681762
1369− bcmsdh_cfg_write(sdh, SDIO_FUNC_1,
1763+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
13701764 SBSDIO_FUNC1_FRAMECTRL,
13711765 SFC_WF_TERM, NULL);
13721766 bus->f1regdata++;
13731767
13741768 for (i = 0; i < 3; i++) {
13751769 u8 hi, lo;
1376− hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,
1770+ hi = brcmf_sdcard_cfg_read(card,
1771+ SDIO_FUNC_1,
13771772 SBSDIO_FUNC1_WFRAMEBCHI,
13781773 NULL);
1379− lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,
1774+ lo = brcmf_sdcard_cfg_read(card,
1775+ SDIO_FUNC_1,
13801776 SBSDIO_FUNC1_WFRAMEBCLO,
1381− NULL);
1777+ NULL);
13821778 bus->f1regdata += 2;
13831779 if ((hi == 0) && (lo == 0))
13841780 break;
@@ -1392,67 +1788,67 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 7 unmodified lines
13921788 } while ((ret < 0) && retries++ < TXRETRIES);
13931789 }
13941790
1395− if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) {
1791+ if ((bus->idletime == BRCMF_IDLE_IMMEDIATE) && !bus->dpc_sched) {
13961792 bus->activity = false;
1397− dhdsdio_clkctl(bus, CLK_NONE, true);
1793+ brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
13981794 }
13991795
1400− dhd_os_sdunlock(bus->dhd);
1796+ brcmf_sdbrcm_sdunlock(bus);
14011797
14021798 if (ret)
1403− bus->dhd->tx_ctlerrs++;
1799+ bus->drvr->tx_ctlerrs++;
14041800 else
1405− bus->dhd->tx_ctlpkts++;
1801+ bus->drvr->tx_ctlpkts++;
14061802
14071803 return ret ? -EIO : 0;
14081804 }
14091805
1410−int dhd_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
1806+int brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
14111807 {
14121808 int timeleft;
14131809 uint rxlen = 0;
14141810 bool pending;
14151811
1416− DHD_TRACE(("%s: Enter\n", __func__));
1812+ BRCMF_TRACE(("%s: Enter\n", __func__));
14171813
1418− if (bus->dhd->dongle_reset)
1814+ if (bus->drvr->dongle_reset)
14191815 return -EIO;
14201816
14211817 /* 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);
14231819
1424− dhd_os_sdlock(bus->dhd);
1820+ brcmf_sdbrcm_sdlock(bus);
14251821 rxlen = bus->rxlen;
14261822 memcpy(msg, bus->rxctl, min(msglen, rxlen));
14271823 bus->rxlen = 0;
1428− dhd_os_sdunlock(bus->dhd);
1824+ brcmf_sdbrcm_sdunlock(bus);
14291825
14301826 if (rxlen) {
1431− DHD_CTL(("%s: resumed on rxctl frame, got %d expected %d\n",
1432− __func__, rxlen, msglen));
1827+ BRCMF_CTL(("%s: resumed on rxctl frame, got %d expected %d\n",
1828+ __func__, rxlen, msglen));
14331829 } else if (timeleft == 0) {
1434− DHD_ERROR(("%s: resumed on timeout\n", __func__));
1435−#ifdef DHD_DEBUG
1436− dhd_os_sdlock(bus->dhd);
1437− dhdsdio_checkdied(bus, NULL, 0);
1438− dhd_os_sdunlock(bus->dhd);
1439−#endif /* DHD_DEBUG */
1830+ BRCMF_ERROR(("%s: resumed on timeout\n", __func__));
1831+#ifdef BCMDBG
1832+ brcmf_sdbrcm_sdlock(bus);
1833+ brcmf_sdbrcm_checkdied(bus, NULL, 0);
1834+ brcmf_sdbrcm_sdunlock(bus);
1835+#endif /* BCMDBG */
14401836 } else if (pending == true) {
1441− DHD_CTL(("%s: cancelled\n", __func__));
1837+ BRCMF_CTL(("%s: cancelled\n", __func__));
14421838 return -ERESTARTSYS;
14431839 } else {
1444− DHD_CTL(("%s: resumed for unknown reason?\n", __func__));
1445−#ifdef DHD_DEBUG
1446− dhd_os_sdlock(bus->dhd);
1447− dhdsdio_checkdied(bus, NULL, 0);
1448− dhd_os_sdunlock(bus->dhd);
1449−#endif /* DHD_DEBUG */
1840+ BRCMF_CTL(("%s: resumed for unknown reason?\n", __func__));
1841+#ifdef BCMDBG
1842+ brcmf_sdbrcm_sdlock(bus);
1843+ brcmf_sdbrcm_checkdied(bus, NULL, 0);
1844+ brcmf_sdbrcm_sdunlock(bus);
1845+#endif /* BCMDBG */
14501846 }
14511847
14521848 if (rxlen)
1453− bus->dhd->rx_ctlpkts++;
1849+ bus->drvr->rx_ctlpkts++;
14541850 else
1455− bus->dhd->rx_ctlerrs++;
1851+ bus->drvr->rx_ctlerrs++;
14561852
14571853 return rxlen ? (int)rxlen : -ETIMEDOUT;
14581854 }
@@ -1466,8 +1862,10 @@ enum { · 7 unmodified lines
14661862 IOV_SDCIS,
14671863 IOV_MEMBYTES,
14681864 IOV_MEMSIZE,
1469−#ifdef DHD_DEBUG
1865+#ifdef BCMDBG
14701866 IOV_CHECKDIED,
1867+ IOV_CONS,
1868+ IOV_DCONSOLE_POLL,
14711869 #endif
14721870 IOV_DOWNLOAD,
14731871 IOV_FORCEEVEN,
@@ -1490,10 +1888,11 @@ enum { · 16 unmodified lines
14901888 IOV_IDLECLOCK,
14911889 IOV_SD1IDLE,
14921890 IOV_SLEEP,
1891+ IOV_WDTICK,
14931892 IOV_VARS
14941893 };
14951894
1496−const bcm_iovar_t dhdsdio_iovars[] = {
1895+const struct brcmu_iovar brcmf_sdio_iovars[] = {
14971896 {"intr", IOV_INTR, 0, IOVT_BOOL, 0},
14981897 {"sleep", IOV_SLEEP, 0, IOVT_BOOL, 0},
14991898 {"pollrate", IOV_POLLRATE, 0, IOVT_UINT32, 0},
@@ -1510,12 +1909,17 @@ const bcm_iovar_t dhdsdio_iovars[] = { · 10 unmodified lines
15101909 {"alignctl", IOV_ALIGNCTL, 0, IOVT_BOOL, 0},
15111910 {"sdalign", IOV_SDALIGN, 0, IOVT_BOOL, 0},
15121911 {"devreset", IOV_DEVRESET, 0, IOVT_BOOL, 0},
1513−#ifdef DHD_DEBUG
1514− {"sdreg", IOV_SDREG, 0, IOVT_BUFFER, sizeof(sdreg_t)}
1912+ {"wdtick", IOV_WDTICK, 0, IOVT_UINT32, 0},
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)}
15151919 ,
1516− {"sbreg", IOV_SBREG, 0, IOVT_BUFFER, sizeof(sdreg_t)}
1920+ {"sbreg", IOV_SBREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)}
15171921 ,
1518− {"sd_cis", IOV_SDCIS, 0, IOVT_BUFFER, DHD_IOCTL_MAXLEN}
1922+ {"sd_cis", IOV_SDCIS, 0, IOVT_BUFFER, BRCMF_IOCTL_MAXLEN}
15191923 ,
15201924 {"forcealign", IOV_FORCEEVEN, 0, IOVT_BOOL, 0}
15211925 ,
@@ -1527,15 +1931,13 @@ const bcm_iovar_t dhdsdio_iovars[] = { · 5 unmodified lines
15271931 ,
15281932 {"cpu", IOV_CPU, 0, IOVT_BOOL, 0}
15291933 ,
1530−#ifdef DHD_DEBUG
15311934 {"checkdied", IOV_CHECKDIED, 0, IOVT_BUFFER, 0}
15321935 ,
1533−#endif /* DHD_DEBUG */
1534−#endif /* DHD_DEBUG */
1936+#endif /* BCMDBG */
15351937 #ifdef SDTEST
15361938 {"extloop", IOV_EXTLOOP, 0, IOVT_BOOL, 0}
15371939 ,
1538− {"pktgen", IOV_PKTGEN, 0, IOVT_BUFFER, sizeof(dhd_pktgen_t)}
1940+ {"pktgen", IOV_PKTGEN, 0, IOVT_BUFFER, sizeof(struct brcmf_pktgen)}
15391941 ,
15401942 #endif /* SDTEST */
15411943
@@ -1543,122 +1945,122 @@ const bcm_iovar_t dhdsdio_iovars[] = { · 1 unmodified line
15431945 };
15441946
15451947 static void
1546−dhd_dump_pct(struct bcmstrbuf *strbuf, char *desc, uint num, uint div)
1948+brcmf_dump_pct(struct brcmu_strbuf *strbuf, char *desc, uint num, uint div)
15471949 {
15481950 uint q1, q2;
15491951
15501952 if (!div) {
1551− bcm_bprintf(strbuf, "%s N/A", desc);
1953+ brcmu_bprintf(strbuf, "%s N/A", desc);
15521954 } else {
15531955 q1 = num / div;
15541956 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);
15561958 }
15571959 }
15581960
1559−void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
1961+void brcmf_sdbrcm_bus_dump(struct brcmf_pub *drvr, struct brcmu_strbuf *strbuf)
15601962 {
1561− dhd_bus_t *bus = dhdp->bus;
1963+ struct brcmf_bus *bus = drvr->bus;
15621964
1563− bcm_bprintf(strbuf, "Bus SDIO structure:\n");
1564− bcm_bprintf(strbuf,
1965+ brcmu_bprintf(strbuf, "Bus SDIO structure:\n");
1966+ brcmu_bprintf(strbuf,
15651967 "hostintmask 0x%08x intstatus 0x%08x sdpcm_ver %d\n",
15661968 bus->hostintmask, bus->intstatus, bus->sdpcm_ver);
1567− bcm_bprintf(strbuf,
1969+ brcmu_bprintf(strbuf,
15681970 "fcstate %d qlen %d tx_seq %d, max %d, rxskip %d rxlen %d rx_seq %d\n",
15691971 bus->fcstate, pktq_len(&bus->txq), bus->tx_seq, bus->tx_max,
15701972 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",
15721974 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",
15741976 bus->pollrate, bus->pollcnt, bus->regfails);
15751977
1576− bcm_bprintf(strbuf, "\nAdditional counters:\n");
1577− bcm_bprintf(strbuf,
1978+ brcmu_bprintf(strbuf, "\nAdditional counters:\n");
1979+ brcmu_bprintf(strbuf,
15781980 "tx_sderrs %d fcqueued %d rxrtx %d rx_toolong %d rxc_errors %d\n",
15791981 bus->tx_sderrs, bus->fcqueued, bus->rxrtx, bus->rx_toolong,
15801982 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",
15821984 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,
1584− bus->fc_xoff, bus->fc_xon);
1585− bcm_bprintf(strbuf, "rxglomfail %d, rxglomframes %d, rxglompkts %d\n",
1985+ brcmu_bprintf(strbuf, "fc_rcvd %d, fc_xoff %d, fc_xon %d\n",
1986+ bus->fc_rcvd, bus->fc_xoff, bus->fc_xon);
1987+ brcmu_bprintf(strbuf, "rxglomfail %d, rxglomframes %d, rxglompkts %d\n",
15861988 bus->rxglomfail, bus->rxglomframes, bus->rxglompkts);
1587− bcm_bprintf(strbuf, "f2rx (hdrs/data) %d (%d/%d), f2tx %d f1regs %d\n",
1588− (bus->f2rxhdrs + bus->f2rxdata), bus->f2rxhdrs,
1589− bus->f2rxdata, bus->f2txdata, bus->f1regdata);
1989+ brcmu_bprintf(strbuf, "f2rx (hdrs/data) %d (%d/%d), f2tx %d f1regs"
1990+ " %d\n",
1991+ (bus->f2rxhdrs + bus->f2rxdata), bus->f2rxhdrs,
1992+ bus->f2rxdata, bus->f2txdata, bus->f1regdata);
15901993 {
1591− dhd_dump_pct(strbuf, "\nRx: pkts/f2rd", bus->dhd->rx_packets,
1994+ brcmf_dump_pct(strbuf, "\nRx: pkts/f2rd", bus->drvr->rx_packets,
15921995 (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,
15941997 bus->f1regdata);
1595− dhd_dump_pct(strbuf, ", pkts/sd", bus->dhd->rx_packets,
1998+ brcmf_dump_pct(strbuf, ", pkts/sd", bus->drvr->rx_packets,
15961999 (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,
15982001 bus->intrcount);
1599− bcm_bprintf(strbuf, "\n");
2002+ brcmu_bprintf(strbuf, "\n");
16002003
1601− dhd_dump_pct(strbuf, "Rx: glom pct", (100 * bus->rxglompkts),
1602− bus->dhd->rx_packets);
1603− dhd_dump_pct(strbuf, ", pkts/glom", bus->rxglompkts,
2004+ brcmf_dump_pct(strbuf, "Rx: glom pct", (100 * bus->rxglompkts),
2005+ bus->drvr->rx_packets);
2006+ brcmf_dump_pct(strbuf, ", pkts/glom", bus->rxglompkts,
16042007 bus->rxglomframes);
1605− bcm_bprintf(strbuf, "\n");
2008+ brcmu_bprintf(strbuf, "\n");
16062009
1607− dhd_dump_pct(strbuf, "Tx: pkts/f2wr", bus->dhd->tx_packets,
2010+ brcmf_dump_pct(strbuf, "Tx: pkts/f2wr", bus->drvr->tx_packets,
16082011 bus->f2txdata);
1609− dhd_dump_pct(strbuf, ", pkts/f1sd", bus->dhd->tx_packets,
2012+ brcmf_dump_pct(strbuf, ", pkts/f1sd", bus->drvr->tx_packets,
16102013 bus->f1regdata);
1611− dhd_dump_pct(strbuf, ", pkts/sd", bus->dhd->tx_packets,
2014+ brcmf_dump_pct(strbuf, ", pkts/sd", bus->drvr->tx_packets,
16122015 (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,
16142017 bus->intrcount);
1615− bcm_bprintf(strbuf, "\n");
2018+ brcmu_bprintf(strbuf, "\n");
16162019
1617− dhd_dump_pct(strbuf, "Total: pkts/f2rw",
1618− (bus->dhd->tx_packets + bus->dhd->rx_packets),
2020+ brcmf_dump_pct(strbuf, "Total: pkts/f2rw",
2021+ (bus->drvr->tx_packets + bus->drvr->rx_packets),
16192022 (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata));
1620− dhd_dump_pct(strbuf, ", pkts/f1sd",
1621− (bus->dhd->tx_packets + bus->dhd->rx_packets),
2023+ brcmf_dump_pct(strbuf, ", pkts/f1sd",
2024+ (bus->drvr->tx_packets + bus->drvr->rx_packets),
16222025 bus->f1regdata);
1623− dhd_dump_pct(strbuf, ", pkts/sd",
1624− (bus->dhd->tx_packets + bus->dhd->rx_packets),
2026+ brcmf_dump_pct(strbuf, ", pkts/sd",
2027+ (bus->drvr->tx_packets + bus->drvr->rx_packets),
16252028 (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata +
16262029 bus->f1regdata));
1627− dhd_dump_pct(strbuf, ", pkts/int",
1628− (bus->dhd->tx_packets + bus->dhd->rx_packets),
2030+ brcmf_dump_pct(strbuf, ", pkts/int",
2031+ (bus->drvr->tx_packets + bus->drvr->rx_packets),
16292032 bus->intrcount);
1630− bcm_bprintf(strbuf, "\n\n");
2033+ brcmu_bprintf(strbuf, "\n\n");
16312034 }
16322035
16332036 #ifdef SDTEST
16342037 if (bus->pktgen_count) {
1635− bcm_bprintf(strbuf, "pktgen config and count:\n");
1636− bcm_bprintf(strbuf,
2038+ brcmu_bprintf(strbuf, "pktgen config and count:\n");
2039+ brcmu_bprintf(strbuf,
16372040 "freq %d count %d print %d total %d min %d len %d\n",
16382041 bus->pktgen_freq, bus->pktgen_count,
16392042 bus->pktgen_print, bus->pktgen_total,
16402043 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",
16422045 bus->pktgen_sent, bus->pktgen_rcvd,
16432046 bus->pktgen_fail);
16442047 }
16452048 #endif /* SDTEST */
1646−#ifdef DHD_DEBUG
1647− bcm_bprintf(strbuf, "dpc_sched %d host interrupt%spending\n",
1648− bus->dpc_sched,
1649− (bcmsdh_intr_pending(bus->sdh) ? " " : " not "));
1650− bcm_bprintf(strbuf, "blocksize %d roundup %d\n", bus->blocksize,
2049+#ifdef BCMDBG
2050+ brcmu_bprintf(strbuf, "dpc_sched %d host interrupt%spending\n",
2051+ bus->dpc_sched, " not ");
2052+ brcmu_bprintf(strbuf, "blocksize %d roundup %d\n", bus->blocksize,
16512053 bus->roundup);
1652−#endif /* DHD_DEBUG */
1653− bcm_bprintf(strbuf,
2054+#endif /* BCMDBG */
2055+ brcmu_bprintf(strbuf,
16542056 "clkstate %d activity %d idletime %d idlecount %d sleeping %d\n",
16552057 bus->clkstate, bus->activity, bus->idletime, bus->idlecount,
16562058 bus->sleeping);
16572059 }
16582060
1659−void dhd_bus_clearcounts(dhd_pub_t *dhdp)
2061+void brcmf_bus_clearcounts(struct brcmf_pub *drvr)
16602062 {
1661− dhd_bus_t *bus = (dhd_bus_t *) dhdp->bus;
2063+ struct brcmf_bus *bus = (struct brcmf_bus *) drvr->bus;
16622064
16632065 bus->intrcount = bus->lastintrs = bus->spurious = bus->regfails = 0;
16642066 bus->rxrtx = bus->rx_toolong = bus->rxc_errors = 0;
@@ -1669,11 +2071,11 @@ void dhd_bus_clearcounts(dhd_pub_t *dhdp) · 4 unmodified lines
16692071 }
16702072
16712073 #ifdef SDTEST
1672−static int dhdsdio_pktgen_get(dhd_bus_t *bus, u8 *arg)
2074+static int brcmf_sdbrcm_pktgen_get(struct brcmf_bus *bus, u8 *arg)
16732075 {
1674− dhd_pktgen_t pktgen;
2076+ struct brcmf_pktgen pktgen;
16752077
1676− pktgen.version = DHD_PKTGEN_VERSION;
2078+ pktgen.version = BRCMF_PKTGEN_VERSION;
16772079 pktgen.freq = bus->pktgen_freq;
16782080 pktgen.count = bus->pktgen_count;
16792081 pktgen.print = bus->pktgen_print;
@@ -1691,13 +2093,13 @@ static int dhdsdio_pktgen_get(dhd_bus_t *bus, u8 *arg) · 11 unmodified lines
16912093 return 0;
16922094 }
16932095
1694−static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg)
2096+static int brcmf_sdbrcm_pktgen_set(struct brcmf_bus *bus, u8 *arg)
16952097 {
1696− dhd_pktgen_t pktgen;
2098+ struct brcmf_pktgen pktgen;
16972099 uint oldcnt, oldmode;
16982100
16992101 memcpy(&pktgen, arg, sizeof(pktgen));
1700− if (pktgen.version != DHD_PKTGEN_VERSION)
2102+ if (pktgen.version != BRCMF_PKTGEN_VERSION)
17012103 return -EINVAL;
17022104
17032105 oldcnt = bus->pktgen_count;
@@ -1725,7 +2127,7 @@ static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg) · 21 unmodified lines
17252127 #endif /* SDTEST */
17262128
17272129 static int
1728−dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data,
2130+brcmf_sdbrcm_membytes(struct brcmf_bus *bus, bool write, u32 address, u8 *data,
17292131 uint size)
17302132 {
17312133 int bcmerror = 0;
@@ -1740,21 +2142,22 @@ dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data, · 8 unmodified lines
17402142 dsize = size;
17412143
17422144 /* 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);
17442146 if (bcmerror) {
1745− DHD_ERROR(("%s: window change failed\n", __func__));
2147+ BRCMF_ERROR(("%s: window change failed\n", __func__));
17462148 goto xfer_done;
17472149 }
17482150
17492151 /* Do the transfer(s) */
17502152 while (size) {
1751− DHD_INFO(("%s: %s %d bytes at offset 0x%08x in window 0x%08x\n",
1752− __func__, (write ? "write" : "read"), dsize,
1753− sdaddr, (address & SBSDIO_SBWINDOW_MASK)));
2153+ BRCMF_INFO(("%s: %s %d bytes at offset 0x%08x in window"
2154+ " 0x%08x\n", __func__, (write ? "write" : "read"),
2155+ dsize, sdaddr, (address & SBSDIO_SBWINDOW_MASK)));
17542156 bcmerror =
1755− bcmsdh_rwdata(bus->sdh, write, sdaddr, data, dsize);
2157+ brcmf_sdcard_rwdata(bus->card, write, sdaddr, data, dsize);
17562158 if (bcmerror) {
1757− DHD_ERROR(("%s: membytes transfer failed\n", __func__));
2159+ BRCMF_ERROR(("%s: membytes transfer failed\n",
2160+ __func__));
17582161 break;
17592162 }
17602163
@@ -1763,10 +2166,10 @@ dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data, · 2 unmodified lines
17632166 if (size) {
17642167 data += dsize;
17652168 address += dsize;
1766− bcmerror = dhdsdio_set_siaddr_window(bus, address);
2169+ bcmerror = brcmf_sdbrcm_set_siaddr_window(bus, address);
17672170 if (bcmerror) {
1768− DHD_ERROR(("%s: window change failed\n",
1769− __func__));
2171+ BRCMF_ERROR(("%s: window change failed\n",
2172+ __func__));
17702173 break;
17712174 }
17722175 sdaddr = 0;
@@ -1776,43 +2179,45 @@ dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data, · 3 unmodified lines
17762179
17772180 xfer_done:
17782181 /* Return the window to backplane enumeration space for core access */
1779− if (dhdsdio_set_siaddr_window(bus, bcmsdh_cur_sbwad(bus->sdh))) {
1780− DHD_ERROR(("%s: FAILED to set window back to 0x%x\n",
1781− __func__, bcmsdh_cur_sbwad(bus->sdh)));
2182+ if (brcmf_sdbrcm_set_siaddr_window(bus,
2183+ brcmf_sdcard_cur_sbwad(bus->card))) {
2184+ BRCMF_ERROR(("%s: FAILED to set window back to 0x%x\n",
2185+ __func__, brcmf_sdcard_cur_sbwad(bus->card)));
17822186 }
17832187
17842188 return bcmerror;
17852189 }
17862190
1787−#ifdef DHD_DEBUG
1788−static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
2191+#ifdef BCMDBG
2192+static int brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh)
17892193 {
17902194 u32 addr;
17912195 int rv;
17922196
17932197 /* Read last word in memory to determine address of
17942198 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);
17962201 if (rv < 0)
17972202 return rv;
17982203
17992204 addr = le32_to_cpu(addr);
18002205
1801− DHD_INFO(("sdpcm_shared address 0x%08X\n", addr));
2206+ BRCMF_INFO(("sdpcm_shared address 0x%08X\n", addr));
18022207
18032208 /*
18042209 * Check if addr is valid.
18052210 * NVRAM length at the end of memory should have been overwritten.
18062211 */
18072212 if (addr == 0 || ((~addr >> 16) & 0xffff) == (addr & 0xffff)) {
1808− DHD_ERROR(("%s: address (0x%08x) of sdpcm_shared invalid\n",
1809− __func__, addr));
2213+ BRCMF_ERROR(("%s: address (0x%08x) of sdpcm_shared invalid\n",
2214+ __func__, addr));
18102215 return -EBADE;
18112216 }
18122217
1813− /* Read hndrte_shared structure */
1814− rv = dhdsdio_membytes(bus, false, addr, (u8 *) sh,
1815− sizeof(sdpcm_shared_t));
2218+ /* Read rte_shared structure */
2219+ rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *) sh,
2220+ sizeof(struct sdpcm_shared));
18162221 if (rv < 0)
18172222 return rv;
18182223
@@ -1826,28 +2231,28 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh) · 7 unmodified lines
18262231 sh->msgtrace_addr = le32_to_cpu(sh->msgtrace_addr);
18272232
18282233 if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) {
1829− DHD_ERROR(("%s: sdpcm_shared version %d in dhd "
1830− "is different than sdpcm_shared version %d in dongle\n",
1831− __func__, SDPCM_SHARED_VERSION,
1832− sh->flags & SDPCM_SHARED_VERSION_MASK));
2234+ BRCMF_ERROR(("%s: sdpcm_shared version %d in brcmf "
2235+ "is different than sdpcm_shared version %d in dongle\n",
2236+ __func__, SDPCM_SHARED_VERSION,
2237+ sh->flags & SDPCM_SHARED_VERSION_MASK));
18332238 return -EBADE;
18342239 }
18352240
18362241 return 0;
18372242 }
18382243
1839−static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size)
2244+static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size)
18402245 {
18412246 int bcmerror = 0;
18422247 uint msize = 512;
18432248 char *mbuffer = NULL;
18442249 uint maxstrlen = 256;
18452250 char *str = NULL;
1846− trap_t tr;
1847− sdpcm_shared_t sdpcm_shared;
1848− struct bcmstrbuf strbuf;
2251+ struct brcmf_trap tr;
2252+ struct sdpcm_shared sdpcm_shared;
2253+ struct brcmu_strbuf strbuf;
18492254
1850− DHD_TRACE(("%s: Enter\n", __func__));
2255+ BRCMF_TRACE(("%s: Enter\n", __func__));
18512256
18522257 if (data == NULL) {
18532258 /*
@@ -1857,8 +2262,8 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 3 unmodified lines
18572262 size = msize;
18582263 mbuffer = data = kmalloc(msize, GFP_ATOMIC);
18592264 if (mbuffer == NULL) {
1860− DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__,
1861− msize));
2265+ BRCMF_ERROR(("%s: kmalloc(%d) failed\n", __func__,
2266+ msize));
18622267 bcmerror = -ENOMEM;
18632268 goto done;
18642269 }
@@ -1866,18 +2271,18 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 1 unmodified line
18662271
18672272 str = kmalloc(maxstrlen, GFP_ATOMIC);
18682273 if (str == NULL) {
1869− DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__, maxstrlen));
2274+ BRCMF_ERROR(("%s: kmalloc(%d) failed\n", __func__, maxstrlen));
18702275 bcmerror = -ENOMEM;
18712276 goto done;
18722277 }
18732278
1874− bcmerror = dhdsdio_readshared(bus, &sdpcm_shared);
2279+ bcmerror = brcmf_sdbrcm_readshared(bus, &sdpcm_shared);
18752280 if (bcmerror < 0)
18762281 goto done;
18772282
1878− bcm_binit(&strbuf, data, size);
2283+ brcmu_binit(&strbuf, data, size);
18792284
1880− bcm_bprintf(&strbuf,
2285+ brcmu_bprintf(&strbuf,
18812286 "msgtrace address : 0x%08X\nconsole address : 0x%08X\n",
18822287 sdpcm_shared.msgtrace_addr, sdpcm_shared.console_addr);
18832288
@@ -1886,7 +2291,7 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 2 unmodified lines
18862291 * (Avoids conflict with real asserts for programmatic
18872292 * parsing of output.)
18882293 */
1889− bcm_bprintf(&strbuf, "Assrt not built in dongle\n");
2294+ brcmu_bprintf(&strbuf, "Assrt not built in dongle\n");
18902295 }
18912296
18922297 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
18952300 * (Avoids conflict with real asserts for programmatic
18962301 * parsing of output.)
18972302 */
1898− bcm_bprintf(&strbuf, "No trap%s in dongle",
2303+ brcmu_bprintf(&strbuf, "No trap%s in dongle",
18992304 (sdpcm_shared.flags & SDPCM_SHARED_ASSERT_BUILT)
19002305 ? "/assrt" : "");
19012306 } else {
19022307 if (sdpcm_shared.flags & SDPCM_SHARED_ASSERT) {
19032308 /* Download assert */
1904− bcm_bprintf(&strbuf, "Dongle assert");
2309+ brcmu_bprintf(&strbuf, "Dongle assert");
19052310 if (sdpcm_shared.assert_exp_addr != 0) {
19062311 str[0] = '\0';
1907− bcmerror = dhdsdio_membytes(bus, false,
2312+ bcmerror = brcmf_sdbrcm_membytes(bus, false,
19082313 sdpcm_shared.assert_exp_addr,
19092314 (u8 *) str, maxstrlen);
19102315 if (bcmerror < 0)
19112316 goto done;
19122317
19132318 str[maxstrlen - 1] = '\0';
1914− bcm_bprintf(&strbuf, " expr \"%s\"", str);
2319+ brcmu_bprintf(&strbuf, " expr \"%s\"", str);
19152320 }
19162321
19172322 if (sdpcm_shared.assert_file_addr != 0) {
19182323 str[0] = '\0';
1919− bcmerror = dhdsdio_membytes(bus, false,
2324+ bcmerror = brcmf_sdbrcm_membytes(bus, false,
19202325 sdpcm_shared.assert_file_addr,
19212326 (u8 *) str, maxstrlen);
19222327 if (bcmerror < 0)
19232328 goto done;
19242329
19252330 str[maxstrlen - 1] = '\0';
1926− bcm_bprintf(&strbuf, " file \"%s\"", str);
2331+ brcmu_bprintf(&strbuf, " file \"%s\"", str);
19272332 }
19282333
1929− bcm_bprintf(&strbuf, " line %d ",
2334+ brcmu_bprintf(&strbuf, " line %d ",
19302335 sdpcm_shared.assert_line);
19312336 }
19322337
19332338 if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) {
1934− bcmerror = dhdsdio_membytes(bus, false,
2339+ bcmerror = brcmf_sdbrcm_membytes(bus, false,
19352340 sdpcm_shared.trap_addr, (u8 *)&tr,
1936− sizeof(trap_t));
2341+ sizeof(struct brcmf_trap));
19372342 if (bcmerror < 0)
19382343 goto done;
19392344
1940− bcm_bprintf(&strbuf,
2345+ brcmu_bprintf(&strbuf,
19412346 "Dongle trap type 0x%x @ epc 0x%x, cpsr 0x%x, spsr 0x%x, sp 0x%x,"
19422347 "lp 0x%x, rpc 0x%x Trap offset 0x%x, "
19432348 "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
19492354 }
19502355
19512356 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));
19532358
1954−#ifdef DHD_DEBUG
2359+#ifdef BCMDBG
19552360 if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) {
19562361 /* Mem dump to a file on device */
1957− dhdsdio_mem_dump(bus);
2362+ brcmf_sdbrcm_mem_dump(bus);
19582363 }
1959−#endif /* DHD_DEBUG */
2364+#endif /* BCMDBG */
19602365
19612366 done:
19622367 kfree(mbuffer);
@@ -1965,7 +2370,7 @@ done: · 2 unmodified lines
19652370 return bcmerror;
19662371 }
19672372
1968−static int dhdsdio_mem_dump(dhd_bus_t *bus)
2373+static int brcmf_sdbrcm_mem_dump(struct brcmf_bus *bus)
19692374 {
19702375 int ret = 0;
19712376 int size; /* Full mem size */
@@ -1977,7 +2382,7 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus) · 5 unmodified lines
19772382 size = bus->ramsize;
19782383 buf = kmalloc(size, GFP_ATOMIC);
19792384 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));
19812386 return -1;
19822387 }
19832388
@@ -1986,9 +2391,10 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus) · 2 unmodified lines
19862391 databuf = buf;
19872392 while (size) {
19882393 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);
19902396 if (ret) {
1991− DHD_ERROR(("%s: Error membytes %d\n", __func__, ret));
2397+ BRCMF_ERROR(("%s: Error membytes %d\n", __func__, ret));
19922398 kfree(buf);
19932399 return -1;
19942400 }
@@ -2002,20 +2408,20 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus) · 7 unmodified lines
20022408 printk(KERN_DEBUG "Done\n");
20032409
20042410 /* free buf before return !!! */
2005− if (write_to_file(bus->dhd, buf, bus->ramsize)) {
2006− DHD_ERROR(("%s: Error writing to files\n", __func__));
2411+ if (brcmf_write_to_file(bus->drvr, buf, bus->ramsize)) {
2412+ BRCMF_ERROR(("%s: Error writing to files\n", __func__));
20072413 return -1;
20082414 }
20092415
2010− /* buf free handled in write_to_file, not here */
2416+ /* buf free handled in brcmf_write_to_file, not here */
20112417 return 0;
20122418 }
20132419
20142420 #define CONSOLE_LINE_MAX 192
20152421
2016−static int dhdsdio_readconsole(dhd_bus_t *bus)
2422+static int brcmf_sdbrcm_readconsole(struct brcmf_bus *bus)
20172423 {
2018− dhd_console_t *c = &bus->console;
2424+ struct brcmf_console *c = &bus->console;
20192425 u8 line[CONSOLE_LINE_MAX], ch;
20202426 u32 n, idx, addr;
20212427 int rv;
@@ -2025,8 +2431,8 @@ static int dhdsdio_readconsole(dhd_bus_t *bus) · 3 unmodified lines
20252431 return 0;
20262432
20272433 /* Read console log struct */
2028− addr = bus->console_addr + offsetof(hndrte_cons_t, log);
2029− rv = dhdsdio_membytes(bus, false, addr, (u8 *)&c->log,
2434+ addr = bus->console_addr + offsetof(struct rte_console, log);
2435+ rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *)&c->log,
20302436 sizeof(c->log));
20312437 if (rv < 0)
20322438 return rv;
@@ -2052,7 +2458,7 @@ static int dhdsdio_readconsole(dhd_bus_t *bus) · 19 unmodified lines
20522458
20532459 /* Read the console buffer */
20542460 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);
20562462 if (rv < 0)
20572463 return rv;
20582464
@@ -2088,16 +2494,16 @@ break2: · 29 unmodified lines
20882494
20892495 return 0;
20902496 }
2091−#endif /* DHD_DEBUG */
2497+#endif /* BCMDBG */
20922498
2093−int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len)
2499+int brcmf_sdbrcm_downloadvars(struct brcmf_bus *bus, void *arg, int len)
20942500 {
20952501 int bcmerror = 0;
20962502
2097− DHD_TRACE(("%s: Enter\n", __func__));
2503+ BRCMF_TRACE(("%s: Enter\n", __func__));
20982504
20992505 /* Basic sanity checks */
2100− if (bus->dhd->up) {
2506+ if (bus->drvr->up) {
21012507 bcmerror = -EISCONN;
21022508 goto err;
21032509 }
@@ -2124,7 +2530,7 @@ err: · 20 unmodified lines
21242530 }
21252531
21262532 static int
2127−dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
2533+brcmf_sdbrcm_doiovar(struct brcmf_bus *bus, const struct brcmu_iovar *vi, u32 actionid,
21282534 const char *name, void *params, int plen, void *arg, int len,
21292535 int val_size)
21302536 {
@@ -2132,11 +2538,11 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 1 unmodified line
21322538 s32 int_val = 0;
21332539 bool bool_val = 0;
21342540
2135− DHD_TRACE(("%s: Enter, action %d name %s params %p plen %d arg %p "
2136− "len %d val_size %d\n",
2137− __func__, actionid, name, params, plen, arg, len, val_size));
2541+ BRCMF_TRACE(("%s: Enter, action %d name %s params %p plen %d arg %p "
2542+ "len %d val_size %d\n", __func__, actionid, name, params,
2543+ plen, arg, len, val_size));
21382544
2139− bcmerror = bcm_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid));
2545+ bcmerror = brcmu_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid));
21402546 if (bcmerror != 0)
21412547 goto exit;
21422548
@@ -2146,10 +2552,10 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines
21462552 bool_val = (int_val != 0) ? true : false;
21472553
21482554 /* Some ioctls use the bus */
2149− dhd_os_sdlock(bus->dhd);
2555+ brcmf_sdbrcm_sdlock(bus);
21502556
21512557 /* 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) ||
21532559 actionid == IOV_GVAL(IOV_DEVRESET))) {
21542560 bcmerror = -EPERM;
21552561 goto exit;
@@ -2158,7 +2564,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
21582564 /* Handle sleep stuff before any clock mucking */
21592565 if (vi->varid == IOV_SLEEP) {
21602566 if (IOV_ISSET(actionid)) {
2161− bcmerror = dhdsdio_bussleep(bus, bool_val);
2567+ bcmerror = brcmf_sdbrcm_bussleep(bus, bool_val);
21622568 } else {
21632569 int_val = (s32) bus->sleeping;
21642570 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
21672573 }
21682574
21692575 /* Request clock to allow SDIO accesses */
2170− if (!bus->dhd->dongle_reset) {
2576+ if (!bus->drvr->dongle_reset) {
21712577 BUS_WAKE(bus);
2172− dhdsdio_clkctl(bus, CLK_AVAIL, false);
2578+ brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
21732579 }
21742580
21752581 switch (actionid) {
@@ -2181,15 +2587,13 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 5 unmodified lines
21812587 case IOV_SVAL(IOV_INTR):
21822588 bus->intr = bool_val;
21832589 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"));
21852593 if (bus->intr) {
2186− DHD_INTR(("%s: enable SDIO device interrupts\n",
2187− __func__));
2188− bcmsdh_intr_enable(bus->sdh);
2594+ brcmf_sdcard_intr_enable(bus->card);
21892595 } else {
2190− DHD_INTR(("%s: disable SDIO interrupts\n",
2191− __func__));
2192− bcmsdh_intr_disable(bus->sdh);
2596+ brcmf_sdcard_intr_disable(bus->card);
21932597 }
21942598 }
21952599 break;
@@ -2210,7 +2614,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 14 unmodified lines
22102614 break;
22112615
22122616 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))
22142618 bcmerror = -EINVAL;
22152619 else
22162620 bus->idletime = int_val;
@@ -2243,8 +2647,6 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 26 unmodified lines
22432647
22442648 bool set = (actionid == IOV_SVAL(IOV_MEMBYTES));
22452649
2246− ASSERT(plen >= 2 * sizeof(int));
2247−
22482650 address = (u32) int_val;
22492651 memcpy(&int_val, (char *)params + sizeof(int_val),
22502652 sizeof(int_val));
@@ -2253,25 +2655,25 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
22532655 /* Do some validation */
22542656 dsize = set ? plen - (2 * sizeof(int)) : len;
22552657 if (dsize < size) {
2256− DHD_ERROR(("%s: error on %s membytes, addr "
2257− "0x%08x size %d dsize %d\n",
2258− __func__, (set ? "set" : "get"),
2259− address, size, dsize));
2658+ BRCMF_ERROR(("%s: error on %s membytes, addr "
2659+ "0x%08x size %d dsize %d\n",
2660+ __func__, (set ? "set" : "get"),
2661+ address, size, dsize));
22602662 bcmerror = -EINVAL;
22612663 break;
22622664 }
22632665
2264− DHD_INFO(("%s: Request to %s %d bytes at address "
2265− "0x%08x\n",
2266− __func__, (set ? "write" : "read"), size, address));
2666+ BRCMF_INFO(("%s: Request to %s %d bytes at address "
2667+ "0x%08x\n", __func__,
2668+ (set ? "write" : "read"), size, address));
22672669
22682670 /* If we know about SOCRAM, check for a fit */
22692671 if ((bus->orig_ramsize) &&
22702672 ((address > bus->orig_ramsize)
22712673 || (address + size > bus->orig_ramsize))) {
2272− DHD_ERROR(("%s: ramsize 0x%08x doesn't have %d "
2273− "bytes at 0x%08x\n",
2274− __func__, bus->orig_ramsize, size, address));
2674+ BRCMF_ERROR(("%s: ramsize 0x%08x doesn't have"
2675+ " %d bytes at 0x%08x\n", __func__,
2676+ bus->orig_ramsize, size, address));
22752677 bcmerror = -EINVAL;
22762678 break;
22772679 }
@@ -2282,8 +2684,8 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 4 unmodified lines
22822684 2 * sizeof(int) : (u8 *) arg;
22832685
22842686 /* Call to do the transfer */
2285− bcmerror =
2286− dhdsdio_membytes(bus, set, address, data, size);
2687+ bcmerror = brcmf_sdbrcm_membytes(bus, set, address,
2688+ data, size);
22872689
22882690 break;
22892691 }
@@ -2294,33 +2696,33 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 4 unmodified lines
22942696 break;
22952697
22962698 case IOV_GVAL(IOV_SDIOD_DRIVE):
2297− int_val = (s32) dhd_sdiod_drive_strength;
2699+ int_val = (s32) brcmf_sdiod_drive_strength;
22982700 memcpy(arg, &int_val, val_size);
22992701 break;
23002702
23012703 case IOV_SVAL(IOV_SDIOD_DRIVE):
2302− dhd_sdiod_drive_strength = int_val;
2303− dhdsdio_sdiod_drive_strength_init(bus,
2304− dhd_sdiod_drive_strength);
2704+ brcmf_sdiod_drive_strength = int_val;
2705+ brcmf_sdbrcm_sdiod_drive_strength_init(bus,
2706+ brcmf_sdiod_drive_strength);
23052707 break;
23062708
23072709 case IOV_SVAL(IOV_DOWNLOAD):
2308− bcmerror = dhdsdio_download_state(bus, bool_val);
2710+ bcmerror = brcmf_sdbrcm_download_state(bus, bool_val);
23092711 break;
23102712
23112713 case IOV_SVAL(IOV_VARS):
2312− bcmerror = dhdsdio_downloadvars(bus, arg, len);
2714+ bcmerror = brcmf_sdbrcm_downloadvars(bus, arg, len);
23132715 break;
23142716
23152717 case IOV_GVAL(IOV_READAHEAD):
2316− int_val = (s32) dhd_readahead;
2718+ int_val = (s32) brcmf_readahead;
23172719 memcpy(arg, &int_val, val_size);
23182720 break;
23192721
23202722 case IOV_SVAL(IOV_READAHEAD):
2321− if (bool_val && !dhd_readahead)
2723+ if (bool_val && !brcmf_readahead)
23222724 bus->nextlen = 0;
2323− dhd_readahead = bool_val;
2725+ brcmf_readahead = bool_val;
23242726 break;
23252727
23262728 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
23352737 bus->use_rxchain = bool_val;
23362738 break;
23372739 case IOV_GVAL(IOV_ALIGNCTL):
2338− int_val = (s32) dhd_alignctl;
2740+ int_val = (s32) brcmf_alignctl;
23392741 memcpy(arg, &int_val, val_size);
23402742 break;
23412743
23422744 case IOV_SVAL(IOV_ALIGNCTL):
2343− dhd_alignctl = bool_val;
2745+ brcmf_alignctl = bool_val;
23442746 break;
23452747
23462748 case IOV_GVAL(IOV_SDALIGN):
2347− int_val = DHD_SDALIGN;
2749+ int_val = BRCMF_SDALIGN;
23482750 memcpy(arg, &int_val, val_size);
23492751 break;
23502752
2351−#ifdef DHD_DEBUG
2753+#ifdef BCMDBG
23522754 case IOV_GVAL(IOV_VARS):
23532755 if (bus->varsz < (uint) len)
23542756 memcpy(arg, bus->vars, bus->varsz);
23552757 else
23562758 bcmerror = -EOVERFLOW;
23572759 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;
23592777
2360−#ifdef DHD_DEBUG
23612778 case IOV_GVAL(IOV_SDREG):
23622779 {
2363− sdreg_t *sd_ptr;
2780+ struct brcmf_sdreg *sd_ptr;
23642781 u32 addr, size;
23652782
2366− sd_ptr = (sdreg_t *) params;
2783+ sd_ptr = (struct brcmf_sdreg *) params;
23672784
2368− addr = (unsigned long)bus->regs + sd_ptr->offset;
2785+ addr = bus->ci->buscorebase + sd_ptr->offset;
23692786 size = sd_ptr->func;
2370− int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size);
2371− if (bcmsdh_regfail(bus->sdh))
2787+ int_val = (s32) brcmf_sdcard_reg_read(bus->card, addr,
2788+ size);
2789+ if (brcmf_sdcard_regfail(bus->card))
23722790 bcmerror = -EIO;
23732791 memcpy(arg, &int_val, sizeof(s32));
23742792 break;
@@ -2376,15 +2794,16 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 1 unmodified line
23762794
23772795 case IOV_SVAL(IOV_SDREG):
23782796 {
2379− sdreg_t *sd_ptr;
2797+ struct brcmf_sdreg *sd_ptr;
23802798 u32 addr, size;
23812799
2382− sd_ptr = (sdreg_t *) params;
2800+ sd_ptr = (struct brcmf_sdreg *) params;
23832801
2384− addr = (unsigned long)bus->regs + sd_ptr->offset;
2802+ addr = bus->ci->buscorebase + sd_ptr->offset;
23852803 size = sd_ptr->func;
2386− bcmsdh_reg_write(bus->sdh, addr, size, sd_ptr->value);
2387− if (bcmsdh_regfail(bus->sdh))
2804+ brcmf_sdcard_reg_write(bus->card, addr, size,
2805+ sd_ptr->value);
2806+ if (brcmf_sdcard_regfail(bus->card))
23882807 bcmerror = -EIO;
23892808 break;
23902809 }
@@ -2393,15 +2812,16 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
23932812 (not SDIO core) */
23942813 case IOV_GVAL(IOV_SBREG):
23952814 {
2396− sdreg_t sdreg;
2815+ struct brcmf_sdreg sdreg;
23972816 u32 addr, size;
23982817
23992818 memcpy(&sdreg, params, sizeof(sdreg));
24002819
24012820 addr = SI_ENUM_BASE + sdreg.offset;
24022821 size = sdreg.func;
2403− int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size);
2404− if (bcmsdh_regfail(bus->sdh))
2822+ int_val = (s32) brcmf_sdcard_reg_read(bus->card, addr,
2823+ size);
2824+ if (brcmf_sdcard_regfail(bus->card))
24052825 bcmerror = -EIO;
24062826 memcpy(arg, &int_val, sizeof(s32));
24072827 break;
@@ -2409,15 +2829,16 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 1 unmodified line
24092829
24102830 case IOV_SVAL(IOV_SBREG):
24112831 {
2412− sdreg_t sdreg;
2832+ struct brcmf_sdreg sdreg;
24132833 u32 addr, size;
24142834
24152835 memcpy(&sdreg, params, sizeof(sdreg));
24162836
24172837 addr = SI_ENUM_BASE + sdreg.offset;
24182838 size = sdreg.func;
2419− bcmsdh_reg_write(bus->sdh, addr, size, sdreg.value);
2420− if (bcmsdh_regfail(bus->sdh))
2839+ brcmf_sdcard_reg_write(bus->card, addr, size,
2840+ sdreg.value);
2841+ if (brcmf_sdcard_regfail(bus->card))
24212842 bcmerror = -EIO;
24222843 break;
24232844 }
@@ -2427,15 +2848,15 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines
24272848 *(char *)arg = 0;
24282849
24292850 strcat(arg, "\nFunc 0\n");
2430− bcmsdh_cis_read(bus->sdh, 0x10,
2851+ brcmf_sdcard_cis_read(bus->card, 0x10,
24312852 (u8 *) arg + strlen(arg),
24322853 SBSDIO_CIS_SIZE_LIMIT);
24332854 strcat(arg, "\nFunc 1\n");
2434− bcmsdh_cis_read(bus->sdh, 0x11,
2855+ brcmf_sdcard_cis_read(bus->card, 0x11,
24352856 (u8 *) arg + strlen(arg),
24362857 SBSDIO_CIS_SIZE_LIMIT);
24372858 strcat(arg, "\nFunc 2\n");
2438− bcmsdh_cis_read(bus->sdh, 0x12,
2859+ brcmf_sdcard_cis_read(bus->card, 0x12,
24392860 (u8 *) arg + strlen(arg),
24402861 SBSDIO_CIS_SIZE_LIMIT);
24412862 break;
@@ -2451,32 +2872,32 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 9 unmodified lines
24512872 break;
24522873
24532874 case IOV_GVAL(IOV_TXBOUND):
2454− int_val = (s32) dhd_txbound;
2875+ int_val = (s32) brcmf_txbound;
24552876 memcpy(arg, &int_val, val_size);
24562877 break;
24572878
24582879 case IOV_SVAL(IOV_TXBOUND):
2459− dhd_txbound = (uint) int_val;
2880+ brcmf_txbound = (uint) int_val;
24602881 break;
24612882
24622883 case IOV_GVAL(IOV_RXBOUND):
2463− int_val = (s32) dhd_rxbound;
2884+ int_val = (s32) brcmf_rxbound;
24642885 memcpy(arg, &int_val, val_size);
24652886 break;
24662887
24672888 case IOV_SVAL(IOV_RXBOUND):
2468− dhd_rxbound = (uint) int_val;
2889+ brcmf_rxbound = (uint) int_val;
24692890 break;
24702891
24712892 case IOV_GVAL(IOV_TXMINMAX):
2472− int_val = (s32) dhd_txminmax;
2893+ int_val = (s32) brcmf_txminmax;
24732894 memcpy(arg, &int_val, val_size);
24742895 break;
24752896
24762897 case IOV_SVAL(IOV_TXMINMAX):
2477− dhd_txminmax = (uint) int_val;
2898+ brcmf_txminmax = (uint) int_val;
24782899 break;
2479−#endif /* DHD_DEBUG */
2900+#endif /* BCMDBG */
24802901
24812902 #ifdef SDTEST
24822903 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
24892910 break;
24902911
24912912 case IOV_GVAL(IOV_PKTGEN):
2492− bcmerror = dhdsdio_pktgen_get(bus, arg);
2913+ bcmerror = brcmf_sdbrcm_pktgen_get(bus, arg);
24932914 break;
24942915
24952916 case IOV_SVAL(IOV_PKTGEN):
2496− bcmerror = dhdsdio_pktgen_set(bus, arg);
2917+ bcmerror = brcmf_sdbrcm_pktgen_set(bus, arg);
24972918 break;
24982919 #endif /* SDTEST */
24992920
25002921 case IOV_SVAL(IOV_DEVRESET):
2501− DHD_TRACE(("%s: Called set IOV_DEVRESET=%d dongle_reset=%d "
2502− "busstate=%d\n",
2503− __func__, bool_val, bus->dhd->dongle_reset,
2504− bus->dhd->busstate));
2922+ BRCMF_TRACE(("%s: Called set IOV_DEVRESET=%d dongle_reset=%d "
2923+ "busstate=%d\n",
2924+ __func__, bool_val, bus->drvr->dongle_reset,
2925+ bus->drvr->busstate));
25052926
2506− dhd_bus_devreset(bus->dhd, (u8) bool_val);
2927+ brcmf_bus_devreset(bus->drvr, (u8) bool_val);
25072928
25082929 break;
25092930
25102931 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__));
25122933
25132934 /* 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;
25152942 memcpy(arg, &int_val, val_size);
2943+ break;
25162944
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);
25172951 break;
25182952
25192953 default:
@@ -2522,29 +2956,29 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines
25222956 }
25232957
25242958 exit:
2525− if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) {
2959+ if ((bus->idletime == BRCMF_IDLE_IMMEDIATE) && !bus->dpc_sched) {
25262960 bus->activity = false;
2527− dhdsdio_clkctl(bus, CLK_NONE, true);
2961+ brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
25282962 }
25292963
2530− dhd_os_sdunlock(bus->dhd);
2964+ brcmf_sdbrcm_sdunlock(bus);
25312965
25322966 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);
25342968
25352969 return bcmerror;
25362970 }
25372971
2538−static int dhdsdio_write_vars(dhd_bus_t *bus)
2972+static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
25392973 {
25402974 int bcmerror = 0;
25412975 u32 varsize;
25422976 u32 varaddr;
25432977 u8 *vbuffer;
25442978 u32 varsizew;
2545−#ifdef DHD_DEBUG
2979+#ifdef BCMDBG
25462980 char *nvram_ularray;
2547−#endif /* DHD_DEBUG */
2981+#endif /* BCMDBG */
25482982
25492983 /* Even if there are no vars are to be written, we still
25502984 need to set the ramsize. */
@@ -2560,10 +2994,10 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) · 9 unmodified lines
25602994
25612995 /* Write the vars list */
25622996 bcmerror =
2563− dhdsdio_membytes(bus, true, varaddr, vbuffer, varsize);
2564−#ifdef DHD_DEBUG
2997+ brcmf_sdbrcm_membytes(bus, true, varaddr, vbuffer, varsize);
2998+#ifdef BCMDBG
25652999 /* 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));
25673001 nvram_ularray = kmalloc(varsize, GFP_ATOMIC);
25683002 if (!nvram_ularray)
25693003 return -ENOMEM;
@@ -2573,30 +3007,31 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) · 3 unmodified lines
25733007
25743008 /* Read the vars list to temp buffer for comparison */
25753009 bcmerror =
2576− dhdsdio_membytes(bus, false, varaddr, nvram_ularray,
3010+ brcmf_sdbrcm_membytes(bus, false, varaddr, nvram_ularray,
25773011 varsize);
25783012 if (bcmerror) {
2579− DHD_ERROR(("%s: error %d on reading %d nvram bytes at "
2580− "0x%08x\n", __func__, bcmerror, varsize, varaddr));
3013+ BRCMF_ERROR(("%s: error %d on reading %d nvram bytes"
3014+ " at 0x%08x\n", __func__, bcmerror,
3015+ varsize, varaddr));
25813016 }
25823017 /* Compare the org NVRAM with the one read from RAM */
25833018 if (memcmp(vbuffer, nvram_ularray, varsize)) {
2584− DHD_ERROR(("%s: Downloaded NVRAM image is corrupted.\n",
2585− __func__));
3019+ BRCMF_ERROR(("%s: Downloaded NVRAM image is "
3020+ "corrupted.\n", __func__));
25863021 } else
2587− DHD_ERROR(("%s: Download/Upload/Compare of NVRAM ok.\n",
2588− __func__));
3022+ BRCMF_ERROR(("%s: Download/Upload/Compare of"
3023+ " NVRAM ok.\n", __func__));
25893024
25903025 kfree(nvram_ularray);
2591−#endif /* DHD_DEBUG */
3026+#endif /* BCMDBG */
25923027
25933028 kfree(vbuffer);
25943029 }
25953030
25963031 /* adjust to the user specified RAM */
2597− DHD_INFO(("Physical memory size: %d, usable memory size: %d\n",
2598− bus->orig_ramsize, bus->ramsize));
2599− DHD_INFO(("Vars are at %d, orig varsize is %d\n", varaddr, varsize));
3032+ BRCMF_INFO(("Physical memory size: %d, usable memory size: %d\n",
3033+ bus->orig_ramsize, bus->ramsize));
3034+ BRCMF_INFO(("Vars are at %d, orig varsize is %d\n", varaddr, varsize));
26003035 varsize = ((bus->orig_ramsize - 4) - varaddr);
26013036
26023037 /*
@@ -2612,17 +3047,17 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) · 9 unmodified lines
26123047 varsizew = cpu_to_le32(varsizew);
26133048 }
26143049
2615− DHD_INFO(("New varsize is %d, length token=0x%08x\n", varsize,
2616− varsizew));
3050+ BRCMF_INFO(("New varsize is %d, length token=0x%08x\n", varsize,
3051+ varsizew));
26173052
26183053 /* 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),
26203055 (u8 *)&varsizew, 4);
26213056
26223057 return bcmerror;
26233058 }
26243059
2625−static int dhdsdio_download_state(dhd_bus_t *bus, bool enter)
3060+static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter)
26263061 {
26273062 uint retries;
26283063 u32 regdata;
@@ -2634,139 +3069,114 @@ static int dhdsdio_download_state(dhd_bus_t *bus, bool enter) · 5 unmodified lines
26343069 if (enter) {
26353070 bus->alp_only = true;
26363071
2637− dhdsdio_chip_disablecore(bus->sdh, bus->ci->armcorebase);
3072+ brcmf_sdbrcm_chip_disablecore(bus->card, bus->ci->armcorebase);
26383073
2639− dhdsdio_chip_resetcore(bus->sdh, bus->ci->ramcorebase);
3074+ brcmf_sdbrcm_chip_resetcore(bus->card, bus->ci->ramcorebase);
26403075
26413076 /* Clear the top bit of memory */
26423077 if (bus->ramsize) {
26433078 u32 zeros = 0;
2644− dhdsdio_membytes(bus, true, bus->ramsize - 4,
3079+ brcmf_sdbrcm_membytes(bus, true, bus->ramsize - 4,
26453080 (u8 *)&zeros, 4);
26463081 }
26473082 } else {
2648− regdata = bcmsdh_reg_read(bus->sdh,
3083+ regdata = brcmf_sdcard_reg_read(bus->card,
26493084 CORE_SB(bus->ci->ramcorebase, sbtmstatelow), 4);
26503085 regdata &= (SBTML_RESET | SBTML_REJ_MASK |
26513086 (SICF_CLOCK_EN << SBTML_SICF_SHIFT));
26523087 if ((SICF_CLOCK_EN << SBTML_SICF_SHIFT) != regdata) {
2653− DHD_ERROR(("%s: SOCRAM core is down after reset?\n",
2654− __func__));
3088+ BRCMF_ERROR(("%s: SOCRAM core is down after reset?\n",
3089+ __func__));
26553090 bcmerror = -EBADE;
26563091 goto fail;
26573092 }
26583093
2659− bcmerror = dhdsdio_write_vars(bus);
3094+ bcmerror = brcmf_sdbrcm_write_vars(bus);
26603095 if (bcmerror) {
2661− DHD_ERROR(("%s: no vars written to RAM\n", __func__));
3096+ BRCMF_ERROR(("%s: no vars written to RAM\n", __func__));
26623097 bcmerror = 0;
26633098 }
26643099
2665− W_SDREG(0xFFFFFFFF, &bus->regs->intstatus, retries);
3100+ w_sdreg32(bus, 0xFFFFFFFF,
3101+ offsetof(struct sdpcmd_regs, intstatus), &retries);
26663102
2667− dhdsdio_chip_resetcore(bus->sdh, bus->ci->armcorebase);
3103+ brcmf_sdbrcm_chip_resetcore(bus->card, bus->ci->armcorebase);
26683104
26693105 /* Allow HT Clock now that the ARM is running. */
26703106 bus->alp_only = false;
26713107
2672− bus->dhd->busstate = DHD_BUS_LOAD;
3108+ bus->drvr->busstate = BRCMF_BUS_LOAD;
26733109 }
26743110 fail:
26753111 return bcmerror;
26763112 }
26773113
26783114 int
2679−dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name,
2680− void *params, int plen, void *arg, int len, bool set)
3115+brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name,
3116+ void *params, int plen, void *arg, int len, bool set)
26813117 {
2682− dhd_bus_t *bus = dhdp->bus;
2683− const bcm_iovar_t *vi = NULL;
3118+ struct brcmf_bus *bus = drvr->bus;
3119+ const struct brcmu_iovar *vi = NULL;
26843120 int bcmerror = 0;
26853121 int val_size;
26863122 u32 actionid;
26873123
2688− DHD_TRACE(("%s: Enter\n", __func__));
3124+ BRCMF_TRACE(("%s: Enter\n", __func__));
26893125
2690− ASSERT(name);
2691− ASSERT(len >= 0);
3126+ if (name == NULL || len <= 0)
3127+ return -EINVAL;
26923128
2693− /* Get MUST have return space */
2694− ASSERT(set || (arg && len));
3129+ /* Set does not take qualifiers */
3130+ if (set && (params || plen))
3131+ return -EINVAL;
26953132
2696− /* Set does NOT take qualifiers */
2697− ASSERT(!set || (!params && !plen));
3133+ /* Get must have return space;*/
3134+ if (!set && !(arg && len))
3135+ return -EINVAL;
26983136
26993137 /* 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);
27013139 if (vi == NULL) {
2702− dhd_os_sdlock(bus->dhd);
3140+ brcmf_sdbrcm_sdlock(bus);
27033141
27043142 BUS_WAKE(bus);
27053143
27063144 /* 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);
27083149
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− }
27413150 /* Similar check for blocksize change */
27423151 if (set && strcmp(name, "sd_blocksize") == 0) {
27433152 s32 fnum = 2;
2744− if (bcmsdh_iovar_op
2745− (bus->sdh, "sd_blocksize", &fnum, sizeof(s32),
3153+ if (brcmf_sdcard_iovar_op
3154+ (bus->card, "sd_blocksize", &fnum, sizeof(s32),
27463155 &bus->blocksize, sizeof(s32),
27473156 false) != 0) {
27483157 bus->blocksize = 0;
2749− DHD_ERROR(("%s: fail on %s get\n", __func__,
2750− "sd_blocksize"));
3158+ BRCMF_ERROR(("%s: fail on %s get\n", __func__,
3159+ "sd_blocksize"));
27513160 } else {
2752− DHD_INFO(("%s: noted %s update, value now %d\n",
2753− __func__, "sd_blocksize",
2754− bus->blocksize));
3161+ BRCMF_INFO(("%s: noted sd_blocksize update,"
3162+ " value now %d\n", __func__,
3163+ bus->blocksize));
27553164 }
27563165 }
27573166 bus->roundup = min(max_roundup, bus->blocksize);
27583167
2759− if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) {
3168+ if (bus->idletime == BRCMF_IDLE_IMMEDIATE &&
3169+ !bus->dpc_sched) {
27603170 bus->activity = false;
2761− dhdsdio_clkctl(bus, CLK_NONE, true);
3171+ brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
27623172 }
27633173
2764− dhd_os_sdunlock(bus->dhd);
3174+ brcmf_sdbrcm_sdunlock(bus);
27653175 goto exit;
27663176 }
27673177
2768− DHD_CTL(("%s: %s %s, len %d plen %d\n", __func__,
2769− name, (set ? "set" : "get"), len, plen));
3178+ BRCMF_CTL(("%s: %s %s, len %d plen %d\n", __func__,
3179+ name, (set ? "set" : "get"), len, plen));
27703180
27713181 /* set up 'params' pointer in case this is a set command so that
27723182 * 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
27853195 val_size = sizeof(int);
27863196
27873197 actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
2788− bcmerror =
2789− dhdsdio_doiovar(bus, vi, actionid, name, params, plen, arg, len,
2790− val_size);
3198+ bcmerror = brcmf_sdbrcm_doiovar(bus, vi, actionid, name, params, plen,
3199+ arg, len, val_size);
27913200
27923201 exit:
27933202 return bcmerror;
27943203 }
27953204
2796−void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
3205+void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex)
27973206 {
27983207 u32 local_hostintmask;
27993208 u8 saveclk;
28003209 uint retries;
28013210 int err;
28023211
2803− DHD_TRACE(("%s: Enter\n", __func__));
3212+ BRCMF_TRACE(("%s: Enter\n", __func__));
28043213
28053214 if (enforce_mutex)
2806− dhd_os_sdlock(bus->dhd);
3215+ brcmf_sdbrcm_sdlock(bus);
28073216
28083217 BUS_WAKE(bus);
28093218
28103219 /* 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);
28123234
28133235 /* 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);
28153237 local_hostintmask = bus->hostintmask;
28163238 bus->hostintmask = 0;
28173239
28183240 /* Change our idea of bus state */
2819− bus->dhd->busstate = DHD_BUS_DOWN;
3241+ bus->drvr->busstate = BRCMF_BUS_DOWN;
28203242
28213243 /* Force clocks on backplane to be sure F2 interrupt propagates */
2822− saveclk =
2823− bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
2824− &err);
3244+ saveclk = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1,
3245+ SBSDIO_FUNC1_CHIPCLKCSR, &err);
28253246 if (!err) {
2826− bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
2827− (saveclk | SBSDIO_FORCE_HT), &err);
3247+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
3248+ SBSDIO_FUNC1_CHIPCLKCSR,
3249+ (saveclk | SBSDIO_FORCE_HT), &err);
28283250 }
28293251 if (err) {
2830− DHD_ERROR(("%s: Failed to force clock for F2: err %d\n",
2831− __func__, err));
3252+ BRCMF_ERROR(("%s: Failed to force clock for F2: err %d\n",
3253+ __func__, err));
28323254 }
28333255
28343256 /* Turn off the bus (F2), free any pending packets */
2835− DHD_INTR(("%s: disable SDIO interrupts\n", __func__));
2836− bcmsdh_intr_disable(bus->sdh);
2837− bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN,
3257+ BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__));
3258+ brcmf_sdcard_intr_disable(bus->card);
3259+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx,
28383260 SDIO_FUNC_ENABLE_1, NULL);
28393261
28403262 /* 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);
28423265
28433266 /* Turn off the backplane clock (only) */
2844− dhdsdio_clkctl(bus, CLK_SDONLY, false);
3267+ brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false);
28453268
28463269 /* Clear the data packet queues */
2847− bcm_pktq_flush(&bus->txq, true, NULL, NULL);
3270+ brcmu_pktq_flush(&bus->txq, true, NULL, NULL);
28483271
28493272 /* Clear any held glomming stuff */
28503273 if (bus->glomd)
2851− bcm_pkt_buf_free_skb(bus->glomd);
3274+ brcmu_pkt_buf_free_skb(bus->glomd);
28523275
28533276 if (bus->glom)
2854− bcm_pkt_buf_free_skb(bus->glom);
3277+ brcmu_pkt_buf_free_skb(bus->glom);
28553278
28563279 bus->glom = bus->glomd = NULL;
28573280
28583281 /* Clear rx control and wake any waiters */
28593282 bus->rxlen = 0;
2860− dhd_os_ioctl_resp_wake(bus->dhd);
3283+ brcmf_os_ioctl_resp_wake(bus->drvr);
28613284
28623285 /* Reset some F2 state stuff */
28633286 bus->rxskip = false;
28643287 bus->tx_seq = bus->rx_seq = 0;
28653288
28663289 if (enforce_mutex)
2867− dhd_os_sdunlock(bus->dhd);
3290+ brcmf_sdbrcm_sdunlock(bus);
28683291 }
28693292
2870−int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
3293+int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
28713294 {
2872− dhd_bus_t *bus = dhdp->bus;
2873− dhd_timeout_t tmo;
3295+ struct brcmf_bus *bus = drvr->bus;
3296+ struct brcmf_timeout tmo;
28743297 uint retries = 0;
28753298 u8 ready, enable;
28763299 int err, ret = 0;
28773300 u8 saveclk;
28783301
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+ }
28803309
2881− ASSERT(bus->dhd);
2882− if (!bus->dhd)
3310+ if (!bus->drvr)
28833311 return 0;
28843312
3313+ /* Start the watchdog timer */
3314+ bus->drvr->tickcnt = 0;
3315+ brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
3316+
28853317 if (enforce_mutex)
2886− dhd_os_sdlock(bus->dhd);
3318+ brcmf_sdbrcm_sdlock(bus);
28873319
28883320 /* 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);
28903322 if (bus->clkstate != CLK_AVAIL)
28913323 goto exit;
28923324
28933325 /* Force clocks on backplane to be sure F2 interrupt propagates */
28943326 saveclk =
2895− bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
2896− &err);
3327+ brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1,
3328+ SBSDIO_FUNC1_CHIPCLKCSR, &err);
28973329 if (!err) {
2898− bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
2899− (saveclk | SBSDIO_FORCE_HT), &err);
3330+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1,
3331+ SBSDIO_FUNC1_CHIPCLKCSR,
3332+ (saveclk | SBSDIO_FORCE_HT), &err);
29003333 }
29013334 if (err) {
2902− DHD_ERROR(("%s: Failed to force clock for F2: err %d\n",
2903− __func__, err));
3335+ BRCMF_ERROR(("%s: Failed to force clock for F2: err %d\n",
3336+ __func__, err));
29043337 goto exit;
29053338 }
29063339
29073340 /* Enable function 2 (frame transfers) */
2908− W_SDREG((SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT),
2909− &bus->regs->tosbmailboxdata, retries);
3341+ w_sdreg32(bus, SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT,
3342+ offsetof(struct sdpcmd_regs, tosbmailboxdata), &retries);
29103343 enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2);
29113344
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);
29133347
29143348 /* 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);
29163350
29173351 ready = 0;
2918− while (ready != enable && !dhd_timeout_expired(&tmo))
2919− ready =
2920− bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IORDY,
2921− NULL);
3352+ while (ready != enable && !brcmf_timeout_expired(&tmo))
3353+ ready = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_0,
3354+ SDIO_CCCR_IORx, NULL);
29223355
2923− DHD_INFO(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n",
2924− __func__, enable, ready, tmo.elapsed));
3356+ BRCMF_INFO(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n",
3357+ __func__, enable, ready, tmo.elapsed));
29253358
29263359 /* If F2 successfully enabled, set core and enable interrupts */
29273360 if (ready == enable) {
29283361 /* Set up the interrupt mask and enable interrupts */
29293362 bus->hostintmask = HOSTINTMASK;
2930− W_SDREG(bus->hostintmask,
2931− (unsigned int *)CORE_BUS_REG(bus->ci->buscorebase,
2932− hostintmask), retries);
3363+ w_sdreg32(bus, bus->hostintmask,
3364+ offsetof(struct sdpcmd_regs, hostintmask), &retries);
29333365
2934− bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_WATERMARK,
3366+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_WATERMARK,
29353367 (u8) watermark, &err);
29363368
29373369 /* Set bus state according to enable result */
2938− dhdp->busstate = DHD_BUS_DATA;
2939−
2940− /* bcmsdh_intr_unmask(bus->sdh); */
3370+ drvr->busstate = BRCMF_BUS_DATA;
29413371
29423372 bus->intdis = false;
29433373 if (bus->intr) {
2944− DHD_INTR(("%s: enable SDIO device interrupts\n",
2945− __func__));
2946− bcmsdh_intr_enable(bus->sdh);
3374+ BRCMF_INTR(("%s: enable SDIO device interrupts\n",
3375+ __func__));
3376+ brcmf_sdcard_intr_enable(bus->card);
29473377 } else {
2948− DHD_INTR(("%s: disable SDIO interrupts\n", __func__));
2949− bcmsdh_intr_disable(bus->sdh);
3378+ BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__));
3379+ brcmf_sdcard_intr_disable(bus->card);
29503380 }
29513381
29523382 }
@@ -2954,75 +3384,90 @@ int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex) · 1 unmodified line
29543384 else {
29553385 /* Disable F2 again */
29563386 enable = SDIO_FUNC_ENABLE_1;
2957− bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, enable,
2958− NULL);
3387+ brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx,
3388+ enable, NULL);
29593389 }
29603390
29613391 /* 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,
29633393 saveclk, &err);
29643394
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+
29653409 /* If we didn't come up, turn off backplane clock */
2966− if (dhdp->busstate != DHD_BUS_DATA)
2967− dhdsdio_clkctl(bus, CLK_NONE, false);
3410+ if (drvr->busstate != BRCMF_BUS_DATA)
3411+ brcmf_sdbrcm_clkctl(bus, CLK_NONE, false);
29683412
29693413 exit:
29703414 if (enforce_mutex)
2971− dhd_os_sdunlock(bus->dhd);
3415+ brcmf_sdbrcm_sdunlock(bus);
29723416
29733417 return ret;
29743418 }
29753419
2976−static void dhdsdio_rxfail(dhd_bus_t *bus, bool abort, bool rtx)
3420+static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx)
29773421 {
2978− bcmsdh_info_t *sdh = bus->sdh;
2979− sdpcmd_regs_t *regs = bus->regs;
3422+ struct brcmf_sdio_card *card = bus->card;
29803423 uint retries = 0;
29813424 u16 lastrbc;
29823425 u8 hi, lo;
29833426 int err;
29843427
2985− DHD_ERROR(("%s: %sterminate frame%s\n", __func__,
2986− (abort ? "abort command, " : ""),
2987− (rtx ? ", send NAK" : "")));
3428+ BRCMF_ERROR(("%s: %sterminate frame%s\n", __func__,
3429+ (abort ? "abort command, " : ""),
3430+ (rtx ? ", send NAK" : "")));
29883431
29893432 if (abort)
2990− bcmsdh_abort(sdh, SDIO_FUNC_2);
3433+ brcmf_sdcard_abort(card, SDIO_FUNC_2);
29913434
2992− bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL, SFC_RF_TERM,
2993− &err);
3435+ brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL,
3436+ SFC_RF_TERM, &err);
29943437 bus->f1regdata++;
29953438
29963439 /* Wait until the packet has been flushed (device/FIFO stable) */
29973440 for (lastrbc = retries = 0xffff; retries > 0; retries--) {
2998− hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCHI,
2999− NULL);
3000− lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCLO,
3001− NULL);
3441+ hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
3442+ SBSDIO_FUNC1_RFRAMEBCHI, NULL);
3443+ lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1,
3444+ SBSDIO_FUNC1_RFRAMEBCLO, NULL);
30023445 bus->f1regdata += 2;
30033446
30043447 if ((hi == 0) && (lo == 0))
30053448 break;
30063449
30073450 if ((hi > (lastrbc >> 8)) && (lo > (lastrbc & 0x00ff))) {
3008− DHD_ERROR(("%s: count growing: last 0x%04x now "
3009− "0x%04x\n",
3010− __func__, lastrbc, ((hi << 8) + lo)));
3451+ BRCMF_ERROR(("%s: count growing: last 0x%04x now "
3452+ "0x%04x\n",
3453+ __func__, lastrbc, ((hi << 8) + lo)));
30113454 }
30123455 lastrbc = (hi << 8) + lo;
30133456 }
30143457
30153458 if (!retries) {
3016− DHD_ERROR(("%s: count never zeroed: last 0x%04x\n",
3017− __func__, lastrbc));
3459+ BRCMF_ERROR(("%s: count never zeroed: last 0x%04x\n",
3460+ __func__, lastrbc));
30183461 } else {
3019− DHD_INFO(("%s: flush took %d iterations\n", __func__,
3020− (0xffff - retries)));
3462+ BRCMF_INFO(("%s: flush took %d iterations\n", __func__,
3463+ (0xffff - retries)));
30213464 }
30223465
30233466 if (rtx) {
30243467 bus->rxrtx++;
3025− W_SDREG(SMB_NAK, &regs->tosbmailbox, retries);
3468+ w_sdreg32(bus, SMB_NAK,
3469+ offsetof(struct sdpcmd_regs, tosbmailbox), &retries);
3470+
30263471 bus->f1regdata++;
30273472 if (retries <= retry_limit)
30283473 bus->rxskip = true;
@@ -3032,35 +3477,33 @@ static void dhdsdio_rxfail(dhd_bus_t *bus, bool abort, bool rtx) · 3 unmodified lines
30323477 bus->nextlen = 0;
30333478
30343479 /* If we can't reach the device, signal failure */
3035− if (err || bcmsdh_regfail(sdh))
3036− bus->dhd->busstate = DHD_BUS_DOWN;
3480+ if (err || brcmf_sdcard_regfail(card))
3481+ bus->drvr->busstate = BRCMF_BUS_DOWN;
30373482 }
30383483
30393484 static void
3040−dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff)
3485+brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)
30413486 {
3042− bcmsdh_info_t *sdh = bus->sdh;
3487+ struct brcmf_sdio_card *card = bus->card;
30433488 uint rdlen, pad;
30443489
30453490 int sdret;
30463491
3047− DHD_TRACE(("%s: Enter\n", __func__));
3492+ BRCMF_TRACE(("%s: Enter\n", __func__));
30483493
30493494 /* Control data already received in aligned rxctl */
30503495 if ((bus->bus == SPI_BUS) && (!bus->usebufpool))
30513496 goto gotpkt;
30523497
3053− ASSERT(bus->rxbuf);
30543498 /* Set rxctl for frame (w/optional alignment) */
30553499 bus->rxctl = bus->rxbuf;
3056− if (dhd_alignctl) {
3500+ if (brcmf_alignctl) {
30573501 bus->rxctl += firstread;
3058− pad = ((unsigned long)bus->rxctl % DHD_SDALIGN);
3502+ pad = ((unsigned long)bus->rxctl % BRCMF_SDALIGN);
30593503 if (pad)
3060− bus->rxctl += (DHD_SDALIGN - pad);
3504+ bus->rxctl += (BRCMF_SDALIGN - pad);
30613505 bus->rxctl -= firstread;
30623506 }
3063− ASSERT(bus->rxctl >= bus->rxbuf);
30643507
30653508 /* Copy the already-read portion over */
30663509 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
30783521 if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) {
30793522 pad = bus->blocksize - (rdlen % bus->blocksize);
30803523 if ((pad <= bus->roundup) && (pad < bus->blocksize) &&
3081− ((len + pad) < bus->dhd->maxctl))
3524+ ((len + pad) < bus->drvr->maxctl))
30823525 rdlen += pad;
3083− } else if (rdlen % DHD_SDALIGN) {
3084− rdlen += DHD_SDALIGN - (rdlen % DHD_SDALIGN);
3526+ } else if (rdlen % BRCMF_SDALIGN) {
3527+ rdlen += BRCMF_SDALIGN - (rdlen % BRCMF_SDALIGN);
30853528 }
30863529
30873530 /* Satisfy length-alignment requirements */
@@ -3089,44 +3532,44 @@ dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) · 1 unmodified line
30893532 rdlen = roundup(rdlen, ALIGNMENT);
30903533
30913534 /* Drop if the read is too big or it exceeds our maximum */
3092− if ((rdlen + firstread) > bus->dhd->maxctl) {
3093− DHD_ERROR(("%s: %d-byte control read exceeds %d-byte buffer\n",
3094− __func__, rdlen, bus->dhd->maxctl));
3095− bus->dhd->rx_errors++;
3096− dhdsdio_rxfail(bus, false, false);
3535+ if ((rdlen + firstread) > bus->drvr->maxctl) {
3536+ BRCMF_ERROR(("%s: %d-byte control read exceeds %d-byte"
3537+ " buffer\n", __func__, rdlen, bus->drvr->maxctl));
3538+ bus->drvr->rx_errors++;
3539+ brcmf_sdbrcm_rxfail(bus, false, false);
30973540 goto done;
30983541 }
30993542
3100− if ((len - doff) > bus->dhd->maxctl) {
3101− DHD_ERROR(("%s: %d-byte ctl frame (%d-byte ctl data) exceeds "
3102− "%d-byte limit\n",
3103− __func__, len, (len - doff), bus->dhd->maxctl));
3104− bus->dhd->rx_errors++;
3543+ if ((len - doff) > bus->drvr->maxctl) {
3544+ BRCMF_ERROR(("%s: %d-byte ctl frame (%d-byte ctl data) exceeds "
3545+ "%d-byte limit\n",
3546+ __func__, len, (len - doff), bus->drvr->maxctl));
3547+ bus->drvr->rx_errors++;
31053548 bus->rx_toolong++;
3106− dhdsdio_rxfail(bus, false, false);
3549+ brcmf_sdbrcm_rxfail(bus, false, false);
31073550 goto done;
31083551 }
31093552
31103553 /* 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,
31123556 F2SYNC, (bus->rxctl + firstread), rdlen,
31133557 NULL, NULL, NULL);
31143558 bus->f2rxdata++;
3115− ASSERT(sdret != -BCME_PENDING);
31163559
31173560 /* Control frame failures need retransmission */
31183561 if (sdret < 0) {
3119− DHD_ERROR(("%s: read %d control bytes failed: %d\n",
3120− __func__, rdlen, sdret));
3121− bus->rxc_errors++; /* dhd.rx_ctlerrs is higher level */
3122− dhdsdio_rxfail(bus, true, true);
3562+ BRCMF_ERROR(("%s: read %d control bytes failed: %d\n",
3563+ __func__, rdlen, sdret));
3564+ bus->rxc_errors++;
3565+ brcmf_sdbrcm_rxfail(bus, true, true);
31233566 goto done;
31243567 }
31253568
31263569 gotpkt:
31273570
3128−#ifdef DHD_DEBUG
3129− if (DHD_BYTES_ON() && DHD_CTL_ON()) {
3571+#ifdef BCMDBG
3572+ if (BRCMF_BYTES_ON() && BRCMF_CTL_ON()) {
31303573 printk(KERN_DEBUG "RxCtrl:\n");
31313574 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, bus->rxctl, len);
31323575 }
@@ -3138,10 +3581,10 @@ gotpkt: · 5 unmodified lines
31383581
31393582 done:
31403583 /* Awake any waiters */
3141− dhd_os_ioctl_resp_wake(bus->dhd);
3584+ brcmf_os_ioctl_resp_wake(bus->drvr);
31423585 }
31433586
3144−static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
3587+static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
31453588 {
31463589 u16 dlen, totlen;
31473590 u8 *dptr, num = 0;
@@ -3159,19 +3602,18 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 11 unmodified lines
31593602 /* If packets, issue read(s) and send up packet chain */
31603603 /* Return sequence numbers consumed? */
31613604
3162− DHD_TRACE(("dhdsdio_rxglom: start: glomd %p glom %p\n", bus->glomd,
3163− bus->glom));
3605+ BRCMF_TRACE(("brcmf_sdbrcm_rxglom: start: glomd %p glom %p\n",
3606+ bus->glomd, bus->glom));
31643607
31653608 /* If there's a descriptor, generate the packet chain */
31663609 if (bus->glomd) {
3167− dhd_os_sdlock_rxq(bus->dhd);
3168−
31693610 pfirst = plast = pnext = NULL;
31703611 dlen = (u16) (bus->glomd->len);
31713612 dptr = bus->glomd->data;
31723613 if (!dlen || (dlen & 1)) {
3173− DHD_ERROR(("%s: bad glomd len(%d), ignore descriptor\n",
3174− __func__, dlen));
3614+ BRCMF_ERROR(("%s: bad glomd len(%d),"
3615+ " ignore descriptor\n",
3616+ __func__, dlen));
31753617 dlen = 0;
31763618 }
31773619
@@ -3182,14 +3624,15 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines
31823624 dptr += sizeof(u16);
31833625 if ((sublen < SDPCM_HDRLEN) ||
31843626 ((num == 0) && (sublen < (2 * SDPCM_HDRLEN)))) {
3185− DHD_ERROR(("%s: descriptor len %d bad: %d\n",
3186− __func__, num, sublen));
3627+ BRCMF_ERROR(("%s: descriptor len %d bad: %d\n",
3628+ __func__, num, sublen));
31873629 pnext = NULL;
31883630 break;
31893631 }
3190− if (sublen % DHD_SDALIGN) {
3191− DHD_ERROR(("%s: sublen %d not multiple of %d\n",
3192− __func__, sublen, DHD_SDALIGN));
3632+ if (sublen % BRCMF_SDALIGN) {
3633+ BRCMF_ERROR(("%s: sublen %d not multiple of"
3634+ " %d\n", __func__, sublen,
3635+ BRCMF_SDALIGN));
31933636 usechain = false;
31943637 }
31953638 totlen += sublen;
@@ -3203,123 +3646,120 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 7 unmodified lines
32033646 }
32043647
32053648 /* 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);
32073650 if (pnext == NULL) {
3208− DHD_ERROR(("%s: bcm_pkt_buf_get_skb failed, "
3209− "num %d len %d\n", __func__,
3210− num, sublen));
3651+ BRCMF_ERROR(("%s: bcm_pkt_buf_get_skb failed, "
3652+ "num %d len %d\n", __func__,
3653+ num, sublen));
32113654 break;
32123655 }
3213− ASSERT(!(pnext->prev));
32143656 if (!pfirst) {
3215− ASSERT(!plast);
32163657 pfirst = plast = pnext;
32173658 } else {
3218− ASSERT(plast);
32193659 plast->next = pnext;
32203660 plast = pnext;
32213661 }
32223662
32233663 /* Adhere to start alignment requirements */
3224− PKTALIGN(pnext, sublen, DHD_SDALIGN);
3664+ PKTALIGN(pnext, sublen, BRCMF_SDALIGN);
32253665 }
32263666
32273667 /* If all allocations succeeded, save packet chain
32283668 in bus structure */
32293669 if (pnext) {
3230− DHD_GLOM(("%s: allocated %d-byte packet chain for %d "
3231− "subframes\n", __func__, totlen, num));
3232− if (DHD_GLOM_ON() && bus->nextlen) {
3670+ BRCMF_GLOM(("%s: allocated %d-byte packet chain for %d "
3671+ "subframes\n", __func__, totlen, num));
3672+ if (BRCMF_GLOM_ON() && bus->nextlen) {
32333673 if (totlen != bus->nextlen) {
3234− DHD_GLOM(("%s: glomdesc mismatch: nextlen %d glomdesc %d " "rxseq %d\n",
3235− __func__, bus->nextlen,
3236− totlen, rxseq));
3674+ BRCMF_GLOM(("%s: glomdesc mismatch: "
3675+ "nextlen %d glomdesc %d "
3676+ "rxseq %d\n", __func__,
3677+ bus->nextlen,
3678+ totlen, rxseq));
32373679 }
32383680 }
32393681 bus->glom = pfirst;
32403682 pfirst = pnext = NULL;
32413683 } else {
32423684 if (pfirst)
3243− bcm_pkt_buf_free_skb(pfirst);
3685+ brcmu_pkt_buf_free_skb(pfirst);
32443686 bus->glom = NULL;
32453687 num = 0;
32463688 }
32473689
32483690 /* Done with descriptor packet */
3249− bcm_pkt_buf_free_skb(bus->glomd);
3691+ brcmu_pkt_buf_free_skb(bus->glomd);
32503692 bus->glomd = NULL;
32513693 bus->nextlen = 0;
3252−
3253− dhd_os_sdunlock_rxq(bus->dhd);
32543694 }
32553695
32563696 /* Ok -- either we just generated a packet chain,
32573697 or had one from before */
32583698 if (bus->glom) {
3259− if (DHD_GLOM_ON()) {
3260− DHD_GLOM(("%s: try superframe read, packet chain:\n",
3261− __func__));
3699+ if (BRCMF_GLOM_ON()) {
3700+ BRCMF_GLOM(("%s: try superframe read, packet chain:\n",
3701+ __func__));
32623702 for (pnext = bus->glom; pnext; pnext = pnext->next) {
3263− DHD_GLOM((" %p: %p len 0x%04x (%d)\n",
3264− pnext, (u8 *) (pnext->data),
3265− pnext->len, pnext->len));
3703+ BRCMF_GLOM((" %p: %p len 0x%04x (%d)\n",
3704+ pnext, (u8 *) (pnext->data),
3705+ pnext->len, pnext->len));
32663706 }
32673707 }
32683708
32693709 pfirst = bus->glom;
3270− dlen = (u16) bcm_pkttotlen(pfirst);
3710+ dlen = (u16) brcmu_pkttotlen(pfirst);
32713711
32723712 /* Do an SDIO read for the superframe. Configurable iovar to
32733713 * read directly into the chained packet, or allocate a large
32743714 * packet and and copy into the chain.
32753715 */
32763716 if (usechain) {
3277− errcode = bcmsdh_recv_buf(bus,
3278− bcmsdh_cur_sbwad(bus->sdh), SDIO_FUNC_2,
3717+ errcode = brcmf_sdcard_recv_buf(bus->card,
3718+ brcmf_sdcard_cur_sbwad(bus->card),
3719+ SDIO_FUNC_2,
32793720 F2SYNC, (u8 *) pfirst->data, dlen,
32803721 pfirst, NULL, NULL);
32813722 } else if (bus->dataptr) {
3282− errcode = bcmsdh_recv_buf(bus,
3283− bcmsdh_cur_sbwad(bus->sdh), SDIO_FUNC_2,
3723+ errcode = brcmf_sdcard_recv_buf(bus->card,
3724+ brcmf_sdcard_cur_sbwad(bus->card),
3725+ SDIO_FUNC_2,
32843726 F2SYNC, bus->dataptr, dlen,
32853727 NULL, NULL, NULL);
3286− sublen = (u16) bcm_pktfrombuf(pfirst, 0, dlen,
3728+ sublen = (u16) brcmu_pktfrombuf(pfirst, 0, dlen,
32873729 bus->dataptr);
32883730 if (sublen != dlen) {
3289− DHD_ERROR(("%s: FAILED TO COPY, dlen %d sublen %d\n",
3290− __func__, dlen, sublen));
3731+ BRCMF_ERROR(("%s: FAILED TO COPY, dlen %d "
3732+ "sublen %d\n",
3733+ __func__, dlen, sublen));
32913734 errcode = -1;
32923735 }
32933736 pnext = NULL;
32943737 } else {
3295− DHD_ERROR(("COULDN'T ALLOC %d-BYTE GLOM, FORCE FAILURE\n",
3296− dlen));
3738+ BRCMF_ERROR(("COULDN'T ALLOC %d-BYTE GLOM, "
3739+ "FORCE FAILURE\n", dlen));
32973740 errcode = -1;
32983741 }
32993742 bus->f2rxdata++;
3300− ASSERT(errcode != -BCME_PENDING);
33013743
33023744 /* On failure, kill the superframe, allow a couple retries */
33033745 if (errcode < 0) {
3304− DHD_ERROR(("%s: glom read of %d bytes failed: %d\n",
3305− __func__, dlen, errcode));
3306− bus->dhd->rx_errors++;
3746+ BRCMF_ERROR(("%s: glom read of %d bytes failed: %d\n",
3747+ __func__, dlen, errcode));
3748+ bus->drvr->rx_errors++;
33073749
33083750 if (bus->glomerr++ < 3) {
3309− dhdsdio_rxfail(bus, true, true);
3751+ brcmf_sdbrcm_rxfail(bus, true, true);
33103752 } else {
33113753 bus->glomerr = 0;
3312− dhdsdio_rxfail(bus, true, false);
3313− dhd_os_sdlock_rxq(bus->dhd);
3314− bcm_pkt_buf_free_skb(bus->glom);
3315− dhd_os_sdunlock_rxq(bus->dhd);
3754+ brcmf_sdbrcm_rxfail(bus, true, false);
3755+ brcmu_pkt_buf_free_skb(bus->glom);
33163756 bus->rxglomfail++;
33173757 bus->glom = NULL;
33183758 }
33193759 return 0;
33203760 }
3321−#ifdef DHD_DEBUG
3322− if (DHD_GLOM_ON()) {
3761+#ifdef BCMDBG
3762+ if (BRCMF_GLOM_ON()) {
33233763 printk(KERN_DEBUG "SUPERFRAME:\n");
33243764 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
33253765 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
33353775 seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);
33363776 bus->nextlen = dptr[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET];
33373777 if ((bus->nextlen << 4) > MAX_RX_DATASZ) {
3338− DHD_INFO(("%s: nextlen too large (%d) seq %d\n",
3339− __func__, bus->nextlen, seq));
3778+ BRCMF_INFO(("%s: nextlen too large (%d) seq %d\n",
3779+ __func__, bus->nextlen, seq));
33403780 bus->nextlen = 0;
33413781 }
33423782 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
33443784
33453785 errcode = 0;
33463786 if ((u16)~(sublen ^ check)) {
3347− DHD_ERROR(("%s (superframe): HW hdr error: len/check "
3348− "0x%04x/0x%04x\n", __func__, sublen, check));
3787+ BRCMF_ERROR(("%s (superframe): HW hdr error: len/check "
3788+ "0x%04x/0x%04x\n", __func__, sublen,
3789+ check));
33493790 errcode = -1;
33503791 } else if (roundup(sublen, bus->blocksize) != dlen) {
3351− DHD_ERROR(("%s (superframe): len 0x%04x, rounded "
3352− "0x%04x, expect 0x%04x\n",
3353− __func__, sublen,
3354− roundup(sublen, bus->blocksize), dlen));
3792+ BRCMF_ERROR(("%s (superframe): len 0x%04x, rounded "
3793+ "0x%04x, expect 0x%04x\n",
3794+ __func__, sublen,
3795+ roundup(sublen, bus->blocksize), dlen));
33553796 errcode = -1;
33563797 } else if (SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]) !=
33573798 SDPCM_GLOM_CHANNEL) {
3358− DHD_ERROR(("%s (superframe): bad channel %d\n",
3799+ BRCMF_ERROR(("%s (superframe): bad channel %d\n",
33593800 __func__,
33603801 SDPCM_PACKET_CHANNEL(&dptr
33613802 [SDPCM_FRAMETAG_LEN])));
33623803 errcode = -1;
33633804 } else if (SDPCM_GLOMDESC(&dptr[SDPCM_FRAMETAG_LEN])) {
3364− DHD_ERROR(("%s (superframe): got second descriptor?\n",
3365− __func__));
3805+ BRCMF_ERROR(("%s (superframe): got 2nd descriptor?\n",
3806+ __func__));
33663807 errcode = -1;
33673808 } else if ((doff < SDPCM_HDRLEN) ||
33683809 (doff > (pfirst->len - SDPCM_HDRLEN))) {
3369− DHD_ERROR(("%s (superframe): Bad data offset %d: HW %d "
3370− "pkt %d min %d\n",
3371− __func__, doff, sublen,
3372− pfirst->len, SDPCM_HDRLEN));
3810+ BRCMF_ERROR(("%s (superframe): Bad data offset %d: "
3811+ "HW %d pkt %d min %d\n",
3812+ __func__, doff, sublen,
3813+ pfirst->len, SDPCM_HDRLEN));
33733814 errcode = -1;
33743815 }
33753816
33763817 /* Check sequence number of superframe SW header */
33773818 if (rxseq != seq) {
3378− DHD_INFO(("%s: (superframe) rx_seq %d, expected %d\n",
3379− __func__, seq, rxseq));
3819+ BRCMF_INFO(("%s: (superframe) rx_seq %d, expected %d\n",
3820+ __func__, seq, rxseq));
33803821 bus->rx_badseq++;
33813822 rxseq = seq;
33823823 }
33833824
33843825 /* Check window for sanity */
33853826 if ((u8) (txmax - bus->tx_seq) > 0x40) {
3386− DHD_ERROR(("%s: unlikely tx max %d with tx_seq %d\n",
3387− __func__, txmax, bus->tx_seq));
3827+ BRCMF_ERROR(("%s: unlikely tx max %d with tx_seq %d\n",
3828+ __func__, txmax, bus->tx_seq));
33883829 txmax = bus->tx_seq + 2;
33893830 }
33903831 bus->tx_max = txmax;
@@ -3402,8 +3843,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 11 unmodified lines
34023843 check = get_unaligned_le16(dptr + sizeof(u16));
34033844 chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
34043845 doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);
3405−#ifdef DHD_DEBUG
3406− if (DHD_GLOM_ON()) {
3846+#ifdef BCMDBG
3847+ if (BRCMF_GLOM_ON()) {
34073848 printk(KERN_DEBUG "subframe:\n");
34083849 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
34093850 dptr, 32);
@@ -3411,24 +3852,25 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 1 unmodified line
34113852 #endif
34123853
34133854 if ((u16)~(sublen ^ check)) {
3414− DHD_ERROR(("%s (subframe %d): HW hdr error: "
3415− "len/check 0x%04x/0x%04x\n",
3416− __func__, num, sublen, check));
3855+ BRCMF_ERROR(("%s (subframe %d): HW hdr error: "
3856+ "len/check 0x%04x/0x%04x\n",
3857+ __func__, num, sublen, check));
34173858 errcode = -1;
34183859 } else if ((sublen > dlen) || (sublen < SDPCM_HDRLEN)) {
3419− DHD_ERROR(("%s (subframe %d): length mismatch: "
3420− "len 0x%04x, expect 0x%04x\n",
3421− __func__, num, sublen, dlen));
3860+ BRCMF_ERROR(("%s (subframe %d): length mismatch"
3861+ ": len 0x%04x, expect 0x%04x\n",
3862+ __func__, num, sublen, dlen));
34223863 errcode = -1;
34233864 } else if ((chan != SDPCM_DATA_CHANNEL) &&
34243865 (chan != SDPCM_EVENT_CHANNEL)) {
3425− DHD_ERROR(("%s (subframe %d): bad channel %d\n",
3426− __func__, num, chan));
3866+ BRCMF_ERROR(("%s (subframe %d): bad channel"
3867+ " %d\n", __func__, num, chan));
34273868 errcode = -1;
34283869 } else if ((doff < SDPCM_HDRLEN) || (doff > sublen)) {
3429− DHD_ERROR(("%s (subframe %d): Bad data offset %d: HW %d min %d\n",
3430− __func__, num, doff, sublen,
3431− SDPCM_HDRLEN));
3870+ BRCMF_ERROR(("%s (subframe %d): Bad data offset"
3871+ " %d: HW %d min %d\n",
3872+ __func__, num, doff, sublen,
3873+ SDPCM_HDRLEN));
34323874 errcode = -1;
34333875 }
34343876 }
@@ -3439,13 +3881,11 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines
34393881 if (bus->glomerr++ < 3) {
34403882 /* Restore superframe header space */
34413883 skb_push(pfirst, sfdoff);
3442− dhdsdio_rxfail(bus, true, true);
3884+ brcmf_sdbrcm_rxfail(bus, true, true);
34433885 } else {
34443886 bus->glomerr = 0;
3445− dhdsdio_rxfail(bus, true, false);
3446− dhd_os_sdlock_rxq(bus->dhd);
3447− bcm_pkt_buf_free_skb(bus->glom);
3448− dhd_os_sdunlock_rxq(bus->dhd);
3887+ brcmf_sdbrcm_rxfail(bus, true, false);
3888+ brcmu_pkt_buf_free_skb(bus->glom);
34493889 bus->rxglomfail++;
34503890 bus->glom = NULL;
34513891 }
@@ -3458,7 +3898,6 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 6 unmodified lines
34583898 bus->glom = NULL;
34593899 plast = NULL;
34603900
3461− dhd_os_sdlock_rxq(bus->dhd);
34623901 for (num = 0; pfirst; rxseq++, pfirst = pnext) {
34633902 pnext = pfirst->next;
34643903 pfirst->next = NULL;
@@ -3469,22 +3908,22 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines
34693908 seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]);
34703909 doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);
34713910
3472− DHD_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d "
3473− "chan %d seq %d\n",
3474− __func__, num, pfirst, pfirst->data,
3475− pfirst->len, sublen, chan, seq));
3911+ BRCMF_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d "
3912+ "chan %d seq %d\n",
3913+ __func__, num, pfirst, pfirst->data,
3914+ pfirst->len, sublen, chan, seq));
34763915
3477− ASSERT((chan == SDPCM_DATA_CHANNEL)
3478− || (chan == SDPCM_EVENT_CHANNEL));
3916+ /* precondition: chan == SDPCM_DATA_CHANNEL ||
3917+ chan == SDPCM_EVENT_CHANNEL */
34793918
34803919 if (rxseq != seq) {
3481− DHD_GLOM(("%s: rx_seq %d, expected %d\n",
3482− __func__, seq, rxseq));
3920+ BRCMF_GLOM(("%s: rx_seq %d, expected %d\n",
3921+ __func__, seq, rxseq));
34833922 bus->rx_badseq++;
34843923 rxseq = seq;
34853924 }
3486−#ifdef DHD_DEBUG
3487− if (DHD_BYTES_ON() && DHD_DATA_ON()) {
3925+#ifdef BCMDBG
3926+ if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) {
34883927 printk(KERN_DEBUG "Rx Subframe Data:\n");
34893928 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
34903929 dptr, dlen);
@@ -3495,24 +3934,22 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines
34953934 skb_pull(pfirst, doff);
34963935
34973936 if (pfirst->len == 0) {
3498− bcm_pkt_buf_free_skb(pfirst);
3937+ brcmu_pkt_buf_free_skb(pfirst);
34993938 if (plast) {
35003939 plast->next = pnext;
35013940 } else {
3502− ASSERT(save_pfirst == pfirst);
35033941 save_pfirst = pnext;
35043942 }
35053943 continue;
3506− } else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pfirst) !=
3507− 0) {
3508− DHD_ERROR(("%s: rx protocol error\n",
3509− __func__));
3510− bus->dhd->rx_errors++;
3511− bcm_pkt_buf_free_skb(pfirst);
3944+ } else if (brcmf_proto_hdrpull(bus->drvr, &ifidx, pfirst)
3945+ != 0) {
3946+ BRCMF_ERROR(("%s: rx protocol error\n",
3947+ __func__));
3948+ bus->drvr->rx_errors++;
3949+ brcmu_pkt_buf_free_skb(pfirst);
35123950 if (plast) {
35133951 plast->next = pnext;
35143952 } else {
3515− ASSERT(save_pfirst == pfirst);
35163953 save_pfirst = pnext;
35173954 }
35183955 continue;
@@ -3524,24 +3961,23 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 5 unmodified lines
35243961 plast = pfirst;
35253962 num++;
35263963
3527−#ifdef DHD_DEBUG
3528− if (DHD_GLOM_ON()) {
3529− DHD_GLOM(("%s subframe %d to stack, %p(%p/%d) "
3530− "nxt/lnk %p/%p\n",
3531− __func__, num, pfirst, pfirst->data,
3532− pfirst->len, pfirst->next,
3533− pfirst->prev));
3964+#ifdef BCMDBG
3965+ if (BRCMF_GLOM_ON()) {
3966+ BRCMF_GLOM(("%s subframe %d to stack, %p"
3967+ "(%p/%d) nxt/lnk %p/%p\n",
3968+ __func__, num, pfirst, pfirst->data,
3969+ pfirst->len, pfirst->next,
3970+ pfirst->prev));
35343971 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
35353972 pfirst->data,
35363973 min_t(int, pfirst->len, 32));
35373974 }
3538−#endif /* DHD_DEBUG */
3975+#endif /* BCMDBG */
35393976 }
3540− dhd_os_sdunlock_rxq(bus->dhd);
35413977 if (num) {
3542− dhd_os_sdunlock(bus->dhd);
3543− dhd_rx_frame(bus->dhd, ifidx, save_pfirst, num);
3544− dhd_os_sdlock(bus->dhd);
3978+ brcmf_sdbrcm_sdunlock(bus);
3979+ brcmf_rx_frame(bus->drvr, ifidx, save_pfirst, num);
3980+ brcmf_sdbrcm_sdlock(bus);
35453981 }
35463982
35473983 bus->rxglomframes++;
@@ -3551,9 +3987,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 3 unmodified lines
35513987 }
35523988
35533989 /* Return true if there may be more frames to read */
3554−static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
3990+static uint
3991+brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
35553992 {
3556− bcmsdh_info_t *sdh = bus->sdh;
3993+ struct brcmf_sdio_card *card = bus->card;
35573994
35583995 u16 len, check; /* Extracted hardware header fields */
35593996 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
35644001 u16 rdlen; /* Total number of bytes to read */
35654002 u8 rxseq; /* Next sequence number to expect */
35664003 uint rxleft = 0; /* Remaining number of frames allowed */
3567− int sdret; /* Return code from bcmsdh calls */
4004+ int sdret; /* Return code from calls */
35684005 u8 txmax; /* Maximum tx sequence offered */
35694006 bool len_consistent; /* Result of comparing readahead len and
35704007 len from hw-hdr */
@@ -3572,17 +4009,15 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 1 unmodified line
35724009 int ifidx = 0;
35734010 uint rxcount = 0; /* Total frames read */
35744011
3575−#if defined(DHD_DEBUG) || defined(SDTEST)
4012+#if defined(BCMDBG) || defined(SDTEST)
35764013 bool sdtest = false; /* To limit message spew from test mode */
35774014 #endif
35784015
3579− DHD_TRACE(("%s: Enter\n", __func__));
3580−
3581− ASSERT(maxframes);
4016+ BRCMF_TRACE(("%s: Enter\n", __func__));
35824017
35834018 #ifdef SDTEST
35844019 /* 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)) {
35864021 maxframes = bus->pktgen_count;
35874022 sdtest = true;
35884023 }
@@ -3592,23 +4027,23 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 3 unmodified lines
35924027 *finished = false;
35934028
35944029 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;
35964031 rxseq++, rxleft--) {
35974032
35984033 /* Handle glomming separately */
35994034 if (bus->glom || bus->glomd) {
36004035 u8 cnt;
3601− DHD_GLOM(("%s: calling rxglom: glomd %p, glom %p\n",
3602− __func__, bus->glomd, bus->glom));
3603− cnt = dhdsdio_rxglom(bus, rxseq);
3604− DHD_GLOM(("%s: rxglom returned %d\n", __func__, cnt));
4036+ BRCMF_GLOM(("%s: calling rxglom: glomd %p, glom %p\n",
4037+ __func__, bus->glomd, bus->glom));
4038+ cnt = brcmf_sdbrcm_rxglom(bus, rxseq);
4039+ BRCMF_GLOM(("%s: rxglom returned %d\n", __func__, cnt));
36054040 rxseq += cnt - 1;
36064041 rxleft = (rxleft > cnt) ? (rxleft - cnt) : 1;
36074042 continue;
36084043 }
36094044
36104045 /* Try doing single read if we can */
3611− if (dhd_readahead && bus->nextlen) {
4046+ if (brcmf_readahead && bus->nextlen) {
36124047 u16 nextlen = bus->nextlen;
36134048 bus->nextlen = 0;
36144049
@@ -3628,9 +4063,9 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 13 unmodified lines
36284063 && ((rdlen + pad + firstread) <
36294064 MAX_RX_DATASZ))
36304065 rdlen += pad;
3631− } else if (rdlen % DHD_SDALIGN) {
4066+ } else if (rdlen % BRCMF_SDALIGN) {
36324067 rdlen +=
3633− DHD_SDALIGN - (rdlen % DHD_SDALIGN);
4068+ BRCMF_SDALIGN - (rdlen % BRCMF_SDALIGN);
36344069 }
36354070 }
36364071
@@ -3645,42 +4080,40 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 8 unmodified lines
36454080 * or non-data frame.
36464081 */
36474082 /* Allocate a packet buffer */
3648− dhd_os_sdlock_rxq(bus->dhd);
3649− pkt = bcm_pkt_buf_get_skb(rdlen + DHD_SDALIGN);
4083+ pkt = brcmu_pkt_buf_get_skb(rdlen + BRCMF_SDALIGN);
36504084 if (!pkt) {
36514085 if (bus->bus == SPI_BUS) {
36524086 bus->usebufpool = false;
36534087 bus->rxctl = bus->rxbuf;
3654− if (dhd_alignctl) {
4088+ if (brcmf_alignctl) {
36554089 bus->rxctl += firstread;
36564090 pad = ((unsigned long)bus->rxctl %
3657− DHD_SDALIGN);
4091+ BRCMF_SDALIGN);
36584092 if (pad)
36594093 bus->rxctl +=
3660− (DHD_SDALIGN - pad);
4094+ (BRCMF_SDALIGN - pad);
36614095 bus->rxctl -= firstread;
36624096 }
3663− ASSERT(bus->rxctl >= bus->rxbuf);
36644097 rxbuf = bus->rxctl;
36654098 /* Read the entire frame */
3666− sdret = bcmsdh_recv_buf(bus,
3667− bcmsdh_cur_sbwad(sdh),
3668− SDIO_FUNC_2, F2SYNC,
3669− rxbuf, rdlen,
3670− NULL, NULL, NULL);
4099+ sdret = brcmf_sdcard_recv_buf(card,
4100+ brcmf_sdcard_cur_sbwad(card),
4101+ SDIO_FUNC_2, F2SYNC,
4102+ rxbuf, rdlen,
4103+ NULL, NULL, NULL);
36714104 bus->f2rxdata++;
3672− ASSERT(sdret != -BCME_PENDING);
36734105
36744106 /* Control frame failures need
36754107 retransmission */
36764108 if (sdret < 0) {
3677− DHD_ERROR(("%s: read %d control bytes failed: %d\n",
3678− __func__,
3679− rdlen, sdret));
4109+ BRCMF_ERROR(("%s: read %d "
4110+ "control bytes "
4111+ "failed: %d\n",
4112+ __func__,
4113+ rdlen, sdret));
36804114 /* dhd.rx_ctlerrs is higher */
36814115 bus->rxc_errors++;
3682− dhd_os_sdunlock_rxq(bus->dhd);
3683− dhdsdio_rxfail(bus, true,
4116+ brcmf_sdbrcm_rxfail(bus, true,
36844117 (bus->bus ==
36854118 SPI_BUS) ? false
36864119 : true);
@@ -3689,50 +4122,45 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 2 unmodified lines
36894122 } else {
36904123 /* Give up on data,
36914124 request rtx of events */
3692− DHD_ERROR(("%s (nextlen): "
3693− "bcm_pkt_buf_get_skb failed:"
3694− " len %d rdlen %d expected"
3695− " rxseq %d\n", __func__,
3696− len, rdlen, rxseq));
3697− /* Just go try again w/normal
3698− header read */
3699− dhd_os_sdunlock_rxq(bus->dhd);
4125+ BRCMF_ERROR(("%s (nextlen): "
4126+ "brcmu_pkt_buf_get_skb "
4127+ "failed:"
4128+ " len %d rdlen %d expected"
4129+ " rxseq %d\n", __func__,
4130+ len, rdlen, rxseq));
37004131 continue;
37014132 }
37024133 } else {
37034134 if (bus->bus == SPI_BUS)
37044135 bus->usebufpool = true;
37054136
3706− ASSERT(!(pkt->prev));
3707− PKTALIGN(pkt, rdlen, DHD_SDALIGN);
4137+ PKTALIGN(pkt, rdlen, BRCMF_SDALIGN);
37084138 rxbuf = (u8 *) (pkt->data);
37094139 /* Read the entire frame */
3710− sdret = bcmsdh_recv_buf(bus,
3711− bcmsdh_cur_sbwad(sdh),
4140+ sdret = brcmf_sdcard_recv_buf(card,
4141+ brcmf_sdcard_cur_sbwad(card),
37124142 SDIO_FUNC_2, F2SYNC,
37134143 rxbuf, rdlen,
37144144 pkt, NULL, NULL);
37154145 bus->f2rxdata++;
3716− ASSERT(sdret != -BCME_PENDING);
37174146
37184147 if (sdret < 0) {
3719− DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n",
3720− __func__, rdlen, sdret));
3721− bcm_pkt_buf_free_skb(pkt);
3722− bus->dhd->rx_errors++;
3723− dhd_os_sdunlock_rxq(bus->dhd);
4148+ BRCMF_ERROR(("%s (nextlen): read %d"
4149+ " bytes failed: %d\n",
4150+ __func__, rdlen, sdret));
4151+ brcmu_pkt_buf_free_skb(pkt);
4152+ bus->drvr->rx_errors++;
37244153 /* Force retry w/normal header read.
37254154 * Don't attempt NAK for
37264155 * gSPI
37274156 */
3728− dhdsdio_rxfail(bus, true,
4157+ brcmf_sdbrcm_rxfail(bus, true,
37294158 (bus->bus ==
37304159 SPI_BUS) ? false :
37314160 true);
37324161 continue;
37334162 }
37344163 }
3735− dhd_os_sdunlock_rxq(bus->dhd);
37364164
37374165 /* Now check the header */
37384166 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
37434171
37444172 /* All zeros means readahead info was bad */
37454173 if (!(len | check)) {
3746− DHD_INFO(("%s (nextlen): read zeros in HW "
3747− "header???\n", __func__));
3748− dhdsdio_pktfree2(bus, pkt);
4174+ BRCMF_INFO(("%s (nextlen): read zeros in HW "
4175+ "header???\n", __func__));
4176+ brcmf_sdbrcm_pktfree2(bus, pkt);
37494177 continue;
37504178 }
37514179
37524180 /* Validate check bytes */
37534181 if ((u16)~(len ^ check)) {
3754− DHD_ERROR(("%s (nextlen): HW hdr error:"
3755− " nextlen/len/check"
3756− " 0x%04x/0x%04x/0x%04x\n",
3757− __func__, nextlen, len, check));
4182+ BRCMF_ERROR(("%s (nextlen): HW hdr error:"
4183+ " nextlen/len/check"
4184+ " 0x%04x/0x%04x/0x%04x\n",
4185+ __func__, nextlen, len, check));
37584186 bus->rx_badhdr++;
3759− dhdsdio_rxfail(bus, false, false);
3760− dhdsdio_pktfree2(bus, pkt);
4187+ brcmf_sdbrcm_rxfail(bus, false, false);
4188+ brcmf_sdbrcm_pktfree2(bus, pkt);
37614189 continue;
37624190 }
37634191
37644192 /* Validate frame length */
37654193 if (len < SDPCM_HDRLEN) {
3766− DHD_ERROR(("%s (nextlen): HW hdr length "
3767− "invalid: %d\n", __func__, len));
3768− dhdsdio_pktfree2(bus, pkt);
4194+ BRCMF_ERROR(("%s (nextlen): HW hdr length "
4195+ "invalid: %d\n", __func__, len));
4196+ brcmf_sdbrcm_pktfree2(bus, pkt);
37694197 continue;
37704198 }
37714199
@@ -3774,13 +4202,14 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 2 unmodified lines
37744202 if (len_consistent) {
37754203 /* Mismatch, force retry w/normal
37764204 header (may be >4K) */
3777− DHD_ERROR(("%s (nextlen): mismatch, "
3778− "nextlen %d len %d rnd %d; "
3779− "expected rxseq %d\n",
3780− __func__, nextlen,
3781− len, roundup(len, 16), rxseq));
3782− dhdsdio_rxfail(bus, true, (bus->bus != SPI_BUS));
3783− dhdsdio_pktfree2(bus, pkt);
4205+ BRCMF_ERROR(("%s (nextlen): mismatch, "
4206+ "nextlen %d len %d rnd %d; "
4207+ "expected rxseq %d\n",
4208+ __func__, nextlen,
4209+ len, roundup(len, 16), rxseq));
4210+ brcmf_sdbrcm_rxfail(bus, true,
4211+ bus->bus != SPI_BUS);
4212+ brcmf_sdbrcm_pktfree2(bus, pkt);
37844213 continue;
37854214 }
37864215
@@ -3798,12 +4227,13 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 11 unmodified lines
37984227 bus->rxhdr[SDPCM_FRAMETAG_LEN +
37994228 SDPCM_NEXTLEN_OFFSET];
38004229 if ((bus->nextlen << 4) > MAX_RX_DATASZ) {
3801− DHD_INFO(("%s (nextlen): got frame w/nextlen too large" " (%d), seq %d\n",
3802− __func__, bus->nextlen, seq));
4230+ BRCMF_INFO(("%s (nextlen): got frame w/nextlen"
4231+ " too large (%d), seq %d\n",
4232+ __func__, bus->nextlen, seq));
38034233 bus->nextlen = 0;
38044234 }
38054235
3806− bus->dhd->rx_readahead_cnt++;
4236+ bus->drvr->rx_readahead_cnt++;
38074237
38084238 /* Handle Flow Control */
38094239 fcbits = SDPCM_FCMASK_VALUE(
@@ -3822,27 +4252,27 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 12 unmodified lines
38224252
38234253 /* Check and update sequence number */
38244254 if (rxseq != seq) {
3825− DHD_INFO(("%s (nextlen): rx_seq %d, expected "
3826− "%d\n", __func__, seq, rxseq));
4255+ BRCMF_INFO(("%s (nextlen): rx_seq %d, expected "
4256+ "%d\n", __func__, seq, rxseq));
38274257 bus->rx_badseq++;
38284258 rxseq = seq;
38294259 }
38304260
38314261 /* Check window for sanity */
38324262 if ((u8) (txmax - bus->tx_seq) > 0x40) {
3833− DHD_ERROR(("%s: got unlikely tx max %d with "
3834− "tx_seq %d\n",
3835− __func__, txmax, bus->tx_seq));
4263+ BRCMF_ERROR(("%s: got unlikely tx max %d with "
4264+ "tx_seq %d\n",
4265+ __func__, txmax, bus->tx_seq));
38364266 txmax = bus->tx_seq + 2;
38374267 }
38384268 bus->tx_max = txmax;
38394269
3840−#ifdef DHD_DEBUG
3841− if (DHD_BYTES_ON() && DHD_DATA_ON()) {
4270+#ifdef BCMDBG
4271+ if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) {
38424272 printk(KERN_DEBUG "Rx Data:\n");
38434273 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
38444274 rxbuf, len);
3845− } else if (DHD_HDRS_ON()) {
4275+ } else if (BRCMF_HDRS_ON()) {
38464276 printk(KERN_DEBUG "RxHdr:\n");
38474277 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
38484278 bus->rxhdr, SDPCM_HDRLEN);
@@ -3851,31 +4281,35 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 2 unmodified lines
38514281
38524282 if (chan == SDPCM_CONTROL_CHANNEL) {
38534283 if (bus->bus == SPI_BUS) {
3854− dhdsdio_read_control(bus, rxbuf, len,
3855− doff);
4284+ brcmf_sdbrcm_read_control(bus, rxbuf,
4285+ len, doff);
38564286 } else {
3857− DHD_ERROR(("%s (nextlen): readahead on control" " packet %d?\n",
3858− __func__, seq));
4287+ BRCMF_ERROR(("%s (nextlen): readahead"
4288+ " on control packet %d?\n",
4289+ __func__, seq));
38594290 /* Force retry w/normal header read */
38604291 bus->nextlen = 0;
3861− dhdsdio_rxfail(bus, false, true);
4292+ brcmf_sdbrcm_rxfail(bus, false, true);
38624293 }
3863− dhdsdio_pktfree2(bus, pkt);
4294+ brcmf_sdbrcm_pktfree2(bus, pkt);
38644295 continue;
38654296 }
38664297
38674298 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",
3869− len, chan));
4299+ BRCMF_ERROR(("Received %d bytes on %d channel."
4300+ " Running out of " "rx pktbuf's or"
4301+ " not yet malloced.\n",
4302+ len, chan));
38704303 continue;
38714304 }
38724305
38734306 /* Validate data offset */
38744307 if ((doff < SDPCM_HDRLEN) || (doff > len)) {
3875− DHD_ERROR(("%s (nextlen): bad data offset %d: HW len %d min %d\n",
3876− __func__, doff, len, SDPCM_HDRLEN));
3877− dhdsdio_rxfail(bus, false, false);
3878− dhdsdio_pktfree2(bus, pkt);
4308+ BRCMF_ERROR(("%s (nextlen): bad data offset %d:"
4309+ " HW len %d min %d\n", __func__,
4310+ doff, len, SDPCM_HDRLEN));
4311+ brcmf_sdbrcm_rxfail(bus, false, false);
4312+ brcmf_sdbrcm_pktfree2(bus, pkt);
38794313 continue;
38804314 }
38814315
@@ -3887,21 +4321,21 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 5 unmodified lines
38874321 break;
38884322
38894323 /* 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),
38914326 SDIO_FUNC_2, F2SYNC, bus->rxhdr, firstread,
38924327 NULL, NULL, NULL);
38934328 bus->f2rxhdrs++;
3894− ASSERT(sdret != -BCME_PENDING);
38954329
38964330 if (sdret < 0) {
3897− DHD_ERROR(("%s: RXHEADER FAILED: %d\n", __func__,
3898− sdret));
4331+ BRCMF_ERROR(("%s: RXHEADER FAILED: %d\n", __func__,
4332+ sdret));
38994333 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 */
21−typedef 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 */
64−typedef 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−
20−typedef 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−
50−typedef 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−
23−typedef 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−
30−typedef 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 */
23−typedef 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− */
50−extern bool msgtrace_hbus_trace;
51−
52−typedef void (*msgtrace_func_send_t) (void *hdl1, void *hdl2, u8 *hdr,
53− u16 hdrlen, u8 *buf,
54− u16 buflen);
55−
56−extern void msgtrace_sent(void);
57−extern void msgtrace_put(char *buf, int count);
58−extern 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>
21+extern 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 */
96+struct brcmf_sdio_card;
97+
98+struct brcmf_sdreg {
99+ int func;
100+ int offset;
101+ int value;
102+};
103+
104+struct 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+
127+struct 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+ */
141+extern struct brcmf_sdio_card*
142+brcmf_sdcard_attach(void *cfghdl, u32 *regsva, uint irq);
143+
144+/* Detach - freeup resources allocated in attach */
145+extern int brcmf_sdcard_detach(struct brcmf_sdio_card *card);
146+
147+/* Enable/disable SD interrupt */
148+extern int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card);
149+extern int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card);
150+
151+/* Register/deregister device interrupt handler. */
152+extern int
153+brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card,
154+ void (*fn)(void *), void *argh);
155+
156+extern 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+ */
164+extern u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint func,
165+ u32 addr, int *err);
166+extern 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 */
170+extern u32
171+brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
172+ u32 addr, int *err);
173+
174+extern 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+ */
185+extern 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+ */
193+extern u32
194+brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size);
195+
196+extern u32
197+brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
198+ u32 data);
199+
200+/* Indicate if last reg read/write failed */
201+extern 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+ */
215+extern int
216+brcmf_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);
221+extern int
222+brcmf_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+ */
243+extern 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 */
247+extern int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn);
248+
249+/* Returns the "Device ID" of target device on the SDIO bus. */
250+extern int brcmf_sdcard_query_device(struct brcmf_sdio_card *card);
251+
252+/* Miscellaneous knob tweaker. */
253+extern 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 */
260+struct 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+
268+struct sdioh_info;
269+
270+/* platform specific/high level functions */
271+extern int brcmf_sdio_function_init(void);
272+extern int brcmf_sdio_register(struct brcmf_sdioh_driver *driver);
273+extern void brcmf_sdio_unregister(void);
274+extern void brcmf_sdio_function_cleanup(void);
275+extern int brcmf_sdio_probe(struct device *dev);
276+extern int brcmf_sdio_remove(struct device *dev);
277+
278+/* Function to return current window addr */
279+extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card);
280+
281+/* Allocate/init/free per-OS private data */
282+extern int brcmf_sdioh_osinit(struct sdioh_info *sd);
283+extern void brcmf_sdioh_osfree(struct sdioh_info *sd);
284+
285+/* Core interrupt enable/disable of device interrupts */
286+extern void brcmf_sdioh_dev_intr_on(struct sdioh_info *sd);
287+extern 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+ */
293+extern struct sdioh_info *brcmf_sdioh_attach(void *cfghdl, uint irq);
294+extern int brcmf_sdioh_detach(struct sdioh_info *si);
295+
296+extern int
297+brcmf_sdioh_interrupt_register(struct sdioh_info *si,
298+ void (*sdioh_cb_fn)(void *), void *argh);
299+
300+extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *si);
301+
302+/* enable or disable SD interrupt */
303+extern int
304+brcmf_sdioh_interrupt_set(struct sdioh_info *si, bool enable_disable);
305+
306+/* read or write one byte using cmd52 */
307+extern int
308+brcmf_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 */
312+extern int
313+brcmf_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 */
318+extern int
319+brcmf_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 */
325+extern int
326+brcmf_sdioh_cis_read(struct sdioh_info *si, uint fuc, u8 *cis, u32 length);
327+
328+extern int
329+brcmf_sdioh_cfg_read(struct sdioh_info *si, uint fuc, u32 addr, u8 *data);
330+extern int
331+brcmf_sdioh_cfg_write(struct sdioh_info *si, uint fuc, u32 addr, u8 *data);
332+
333+/* handle iovars */
334+extern 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 */
338+extern int brcmf_sdioh_abort(struct sdioh_info *si, uint fnc);
339+
340+/* Watchdog timer interface for pm ops */
341+extern void brcmf_sdio_wdtmr_enable(bool enable);
342+
343+extern uint sd_msglevel; /* Debug message level */
344+
345+extern 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−
20−typedef 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
1616
1717 #include <linux/kernel.h>
1818 #include <linux/if_arp.h>
19−
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−
19+#include <linux/sched.h>
2920 #include <linux/kthread.h>
3021 #include <linux/netdevice.h>
3122 #include <linux/sched.h>
3223 #include <linux/etherdevice.h>
3324 #include <linux/wireless.h>
3425 #include <linux/ieee80211.h>
26+#include <linux/mmc/sdio_func.h>
27+#include <linux/uaccess.h>
3528 #include <net/cfg80211.h>
36−
3729 #include <net/rtnetlink.h>
38−#include <linux/mmc/sdio_func.h>
39−#include <linux/firmware.h>
40−#include <wl_cfg80211.h>
4130
42−void 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"
4336
4437 static struct sdio_func *cfg80211_sdio_func;
45−static struct wl_dev *wl_cfg80211_dev;
38+static struct brcmf_cfg80211_dev *cfg80211_dev;
4639 static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255};
4740
48−u32 wl_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"
41+u32 brcmf_dbg_level = WL_DBG_ERR;
5242
5343 /*
5444 ** cfg80211_ops api/callback list
5545 */
56−static s32 wl_cfg80211_change_iface(struct wiphy *wiphy,
57− struct net_device *ndev,
58− enum nl80211_iftype type, u32 *flags,
59− struct vif_params *params);
60−static s32 __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
61− struct cfg80211_scan_request *request,
62− struct cfg80211_ssid *this_ssid);
63−static s32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
64− struct cfg80211_scan_request *request);
65−static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed);
66−static s32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
67− struct cfg80211_ibss_params *params);
68−static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy,
69− struct net_device *dev);
70−static s32 wl_cfg80211_get_station(struct wiphy *wiphy,
71− struct net_device *dev, u8 *mac,
72− struct station_info *sinfo);
73−static s32 wl_cfg80211_set_power_mgmt(struct wiphy *wiphy,
74− struct net_device *dev, bool enabled,
75− s32 timeout);
76−static s32 wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
77− struct net_device *dev,
78− const u8 *addr,
79− const struct cfg80211_bitrate_mask
80− *mask);
81−static int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
82− struct cfg80211_connect_params *sme);
83−static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
84− u16 reason_code);
85−static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
46+static s32 brcmf_cfg80211_change_iface(struct wiphy *wiphy,
47+ struct net_device *ndev,
48+ enum nl80211_iftype type, u32 *flags,
49+ struct vif_params *params);
50+static s32 __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
51+ struct cfg80211_scan_request *request,
52+ struct cfg80211_ssid *this_ssid);
53+static s32 brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
54+ struct cfg80211_scan_request *request);
55+static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed);
56+static s32 brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
57+ struct cfg80211_ibss_params *params);
58+static s32 brcmf_cfg80211_leave_ibss(struct wiphy *wiphy,
59+ struct net_device *dev);
60+static s32 brcmf_cfg80211_get_station(struct wiphy *wiphy,
61+ struct net_device *dev, u8 *mac,
62+ struct station_info *sinfo);
63+static s32 brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy,
64+ struct net_device *dev, bool enabled,
65+ s32 timeout);
66+static s32 brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
67+ struct net_device *dev,
68+ const u8 *addr,
69+ const struct cfg80211_bitrate_mask
70+ *mask);
71+static int brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
72+ struct cfg80211_connect_params *sme);
73+static s32 brcmf_cfg80211_disconnect(struct wiphy *wiphy,
74+ struct net_device *dev,
75+ u16 reason_code);
76+static s32 brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
8677 enum nl80211_tx_power_setting type,
8778 s32 dbm);
88−static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
89−static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
79+static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
80+static s32 brcmf_cfg80211_config_default_key(struct wiphy *wiphy,
9081 struct net_device *dev, u8 key_idx,
9182 bool unicast, bool multicast);
92−static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
83+static s32 brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
9384 u8 key_idx, bool pairwise, const u8 *mac_addr,
9485 struct key_params *params);
95−static s32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
86+static s32 brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
9687 u8 key_idx, bool pairwise, const u8 *mac_addr);
97−static s32 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
88+static s32 brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
9889 u8 key_idx, bool pairwise, const u8 *mac_addr,
9990 void *cookie, void (*callback) (void *cookie,
10091 struct
10192 key_params *
10293 params));
103−static s32 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
94+static s32 brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
10495 struct net_device *dev,
10596 u8 key_idx);
106−static s32 wl_cfg80211_resume(struct wiphy *wiphy);
107−static s32 wl_cfg80211_suspend(struct wiphy *wiphy);
108−static s32 wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
97+static s32 brcmf_cfg80211_resume(struct wiphy *wiphy);
98+static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
99+ struct cfg80211_wowlan *wow);
100+static s32 brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
109101 struct cfg80211_pmksa *pmksa);
110−static s32 wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
102+static s32 brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
111103 struct cfg80211_pmksa *pmksa);
112−static s32 wl_cfg80211_flush_pmksa(struct wiphy *wiphy,
104+static s32 brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy,
113105 struct net_device *dev);
114106 /*
115107 ** event & event Q handlers for cfg80211 interfaces
116108 */
117−static s32 wl_create_event_handler(struct wl_priv *wl);
118−static void wl_destroy_event_handler(struct wl_priv *wl);
119−static s32 wl_event_handler(void *data);
120−static void wl_init_eq(struct wl_priv *wl);
121−static void wl_flush_eq(struct wl_priv *wl);
122−static void wl_lock_eq(struct wl_priv *wl);
123−static void wl_unlock_eq(struct wl_priv *wl);
124−static void wl_init_eq_lock(struct wl_priv *wl);
125−static void wl_init_eloop_handler(struct wl_event_loop *el);
126−static struct wl_event_q *wl_deq_event(struct wl_priv *wl);
127−static s32 wl_enq_event(struct wl_priv *wl, u32 type,
128− const wl_event_msg_t *msg, void *data);
129−static void wl_put_event(struct wl_event_q *e);
130−static void wl_wakeup_event(struct wl_priv *wl);
131−static s32 wl_notify_connect_status(struct wl_priv *wl,
132− struct net_device *ndev,
133− const wl_event_msg_t *e, void *data);
134−static s32 wl_notify_roaming_status(struct wl_priv *wl,
135− struct net_device *ndev,
136− const wl_event_msg_t *e, void *data);
137−static s32 wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev,
138− const wl_event_msg_t *e, void *data);
139−static s32 wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev,
140− const wl_event_msg_t *e, void *data,
141− bool completed);
142−static s32 wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev,
143− const wl_event_msg_t *e, void *data);
144−static s32 wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev,
145− const wl_event_msg_t *e, void *data);
109+static s32 brcmf_create_event_handler(struct brcmf_cfg80211_priv *cfg_priv);
110+static void brcmf_destroy_event_handler(struct brcmf_cfg80211_priv *cfg_priv);
111+static s32 brcmf_event_handler(void *data);
112+static void brcmf_init_eq(struct brcmf_cfg80211_priv *cfg_priv);
113+static void brcmf_flush_eq(struct brcmf_cfg80211_priv *cfg_priv);
114+static void brcmf_lock_eq(struct brcmf_cfg80211_priv *cfg_priv);
115+static void brcmf_unlock_eq(struct brcmf_cfg80211_priv *cfg_priv);
116+static void brcmf_init_eq_lock(struct brcmf_cfg80211_priv *cfg_priv);
117+static void brcmf_init_eloop_handler(struct brcmf_cfg80211_event_loop *el);
118+static struct brcmf_cfg80211_event_q *
119+brcmf_deq_event(struct brcmf_cfg80211_priv *cfg_priv);
120+static s32 brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 type,
121+ const struct brcmf_event_msg *msg, void *data);
122+static void brcmf_put_event(struct brcmf_cfg80211_event_q *e);
123+static void brcmf_wakeup_event(struct brcmf_cfg80211_priv *cfg_priv);
124+static s32 brcmf_notify_connect_status(struct brcmf_cfg80211_priv *cfg_priv,
125+ struct net_device *ndev,
126+ const struct brcmf_event_msg *e,
127+ void *data);
128+static s32 brcmf_notify_roaming_status(struct brcmf_cfg80211_priv *cfg_priv,
129+ struct net_device *ndev,
130+ const struct brcmf_event_msg *e,
131+ void *data);
132+static s32 brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
133+ struct net_device *ndev,
134+ const struct brcmf_event_msg *e,
135+ void *data);
136+static s32 brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv,
137+ struct net_device *ndev,
138+ const struct brcmf_event_msg *e, void *data,
139+ bool completed);
140+static 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);
143+static 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);
146146
147147 /*
148148 ** register/deregister sdio function
149149 */
150−struct sdio_func *wl_cfg80211_get_sdio_func(void);
151−static void wl_clear_sdio_func(void);
150+static void brcmf_clear_sdio_func(void);
152151
153152 /*
154153 ** ioctl utilites
155154 */
156−static s32 wl_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf,
155+static s32 brcmf_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf,
157156 s32 buf_len);
158−static __used s32 wl_dev_bufvar_set(struct net_device *dev, s8 *name,
157+static __used s32 brcmf_dev_bufvar_set(struct net_device *dev, s8 *name,
159158 s8 *buf, s32 len);
160−static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val);
161−static s32 wl_dev_intvar_get(struct net_device *dev, s8 *name,
159+static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val);
160+static s32 brcmf_dev_intvar_get(struct net_device *dev, s8 *name,
162161 s32 *retval);
163−static s32 wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg,
162+static s32 brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg,
164163 u32 len);
165164
166165 /*
167166 ** cfg80211 set_wiphy_params utilities
168167 */
169−static s32 wl_set_frag(struct net_device *dev, u32 frag_threshold);
170−static s32 wl_set_rts(struct net_device *dev, u32 frag_threshold);
171−static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l);
168+static s32 brcmf_set_frag(struct net_device *dev, u32 frag_threshold);
169+static s32 brcmf_set_rts(struct net_device *dev, u32 frag_threshold);
170+static s32 brcmf_set_retry(struct net_device *dev, u32 retry, bool l);
172171
173172 /*
174173 ** wl profile utilities
175174 */
176−static s32 wl_update_prof(struct wl_priv *wl, const wl_event_msg_t *e,
177− void *data, s32 item);
178−static void *wl_read_prof(struct wl_priv *wl, s32 item);
179−static void wl_init_prof(struct wl_profile *prof);
175+static s32 brcmf_update_prof(struct brcmf_cfg80211_priv *cfg_priv,
176+ const struct brcmf_event_msg *e,
177+ void *data, s32 item);
178+static void *brcmf_read_prof(struct brcmf_cfg80211_priv *cfg_priv, s32 item);
179+static void brcmf_init_prof(struct brcmf_cfg80211_profile *prof);
180180
181181 /*
182182 ** cfg80211 connect utilites
183183 */
184−static s32 wl_set_wpa_version(struct net_device *dev,
184+static s32 brcmf_set_wpa_version(struct net_device *dev,
185185 struct cfg80211_connect_params *sme);
186−static s32 wl_set_auth_type(struct net_device *dev,
186+static s32 brcmf_set_auth_type(struct net_device *dev,
187187 struct cfg80211_connect_params *sme);
188−static s32 wl_set_set_cipher(struct net_device *dev,
188+static s32 brcmf_set_set_cipher(struct net_device *dev,
189189 struct cfg80211_connect_params *sme);
190−static s32 wl_set_key_mgmt(struct net_device *dev,
190+static s32 brcmf_set_key_mgmt(struct net_device *dev,
191191 struct cfg80211_connect_params *sme);
192−static s32 wl_set_set_sharedkey(struct net_device *dev,
192+static s32 brcmf_set_set_sharedkey(struct net_device *dev,
193193 struct cfg80211_connect_params *sme);
194−static s32 wl_get_assoc_ies(struct wl_priv *wl);
195−static void wl_clear_assoc_ies(struct wl_priv *wl);
196−static void wl_ch_to_chanspec(int ch,
197− struct wl_join_params *join_params, size_t *join_params_size);
194+static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv);
195+static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv);
196+static void brcmf_ch_to_chanspec(int ch,
197+ struct brcmf_join_params *join_params, size_t *join_params_size);
198198
199199 /*
200200 ** information element utilities
201201 */
202−static __used s32 wl_add_ie(struct wl_priv *wl, u8 t, u8 l, u8 *v);
203−static s32 wl_mode_to_nl80211_iftype(s32 mode);
204−static struct wireless_dev *wl_alloc_wdev(s32 sizeof_iface,
202+static __used s32 brcmf_add_ie(struct brcmf_cfg80211_priv *cfg_priv,
203+ u8 t, u8 l, u8 *v);
204+static s32 brcmf_mode_to_nl80211_iftype(s32 mode);
205+static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface,
205206 struct device *dev);
206−static void wl_free_wdev(struct wl_priv *wl);
207−static s32 wl_inform_bss(struct wl_priv *wl);
208−static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi);
209−static s32 wl_update_bss_info(struct wl_priv *wl);
210−static s32 wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,
207+static void brcmf_free_wdev(struct brcmf_cfg80211_priv *cfg_priv);
208+static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv);
209+static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_priv *cfg_priv,
210+ struct brcmf_bss_info *bi);
211+static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv);
212+static s32 brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
211213 u8 key_idx, const u8 *mac_addr,
212214 struct key_params *params);
213215
214216 /*
215217 ** key indianess swap utilities
216218 */
217−static void swap_key_from_BE(struct wl_wsec_key *key);
218−static void swap_key_to_BE(struct wl_wsec_key *key);
219+static void swap_key_from_BE(struct brcmf_wsec_key *key);
220+static void swap_key_to_BE(struct brcmf_wsec_key *key);
219221
220222 /*
221−** wl_priv memory init/deinit utilities
223+** brcmf_cfg80211_priv memory init/deinit utilities
222224 */
223−static s32 wl_init_priv_mem(struct wl_priv *wl);
224−static void wl_deinit_priv_mem(struct wl_priv *wl);
225+static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_priv *cfg_priv);
226+static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv);
225227
226−static void wl_delay(u32 ms);
228+static void brcmf_delay(u32 ms);
227229
228230 /*
229231 ** store/restore cfg80211 instance data
230232 */
231−static void wl_set_drvdata(struct wl_dev *dev, void *data);
232−static void *wl_get_drvdata(struct wl_dev *dev);
233+static void brcmf_set_drvdata(struct brcmf_cfg80211_dev *dev, void *data);
234+static void *brcmf_get_drvdata(struct brcmf_cfg80211_dev *dev);
233235
234236 /*
235237 ** ibss mode utilities
236238 */
237−static bool wl_is_ibssmode(struct wl_priv *wl);
239+static bool brcmf_is_ibssmode(struct brcmf_cfg80211_priv *cfg_priv);
238240
239241 /*
240242 ** dongle up/down , default configuration utilities
241243 */
242−static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e);
243−static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e);
244−static bool wl_is_nonetwork(struct wl_priv *wl, const wl_event_msg_t *e);
245−static void wl_link_down(struct wl_priv *wl);
246−static s32 wl_dongle_mode(struct net_device *ndev, s32 iftype);
247−static s32 __wl_cfg80211_up(struct wl_priv *wl);
248−static s32 __wl_cfg80211_down(struct wl_priv *wl);
249−static s32 wl_dongle_probecap(struct wl_priv *wl);
250−static void wl_init_conf(struct wl_conf *conf);
244+static bool brcmf_is_linkdown(struct brcmf_cfg80211_priv *cfg_priv,
245+ const struct brcmf_event_msg *e);
246+static bool brcmf_is_linkup(struct brcmf_cfg80211_priv *cfg_priv,
247+ const struct brcmf_event_msg *e);
248+static bool brcmf_is_nonetwork(struct brcmf_cfg80211_priv *cfg_priv,
249+ const struct brcmf_event_msg *e);
250+static void brcmf_link_down(struct brcmf_cfg80211_priv *cfg_priv);
251+static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype);
252+static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv);
253+static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv);
254+static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_priv *cfg_priv);
255+static void brcmf_init_conf(struct brcmf_cfg80211_conf *conf);
251256
252257 /*
253258 ** dongle configuration utilities
254259 */
255−#ifndef EMBEDDED_PLATFORM
256−static s32 wl_dongle_mode(struct net_device *ndev, s32 iftype);
257−static s32 wl_dongle_country(struct net_device *ndev, u8 ccode);
258−static s32 wl_dongle_up(struct net_device *ndev, u32 up);
259−static s32 wl_dongle_power(struct net_device *ndev, u32 power_mode);
260−static s32 wl_dongle_glom(struct net_device *ndev, u32 glom,
261− u32 dongle_align);
262−static s32 wl_dongle_offload(struct net_device *ndev, s32 arpoe,
263− s32 arp_ol);
264−static s32 wl_pattern_atoh(s8 *src, s8 *dst);
265−static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode);
266−static s32 wl_update_wiphybands(struct wl_priv *wl);
267−#endif /* !EMBEDDED_PLATFORM */
268−
269−static s32 wl_dongle_eventmsg(struct net_device *ndev);
270−static s32 wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time,
271− s32 scan_unassoc_time, s32 scan_passive_time);
272−static s32 wl_config_dongle(struct wl_priv *wl, bool need_lock);
273−static s32 wl_dongle_roam(struct net_device *ndev, u32 roamvar,
260+static s32 brcmf_dongle_eventmsg(struct net_device *ndev);
261+static s32 brcmf_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time,
262+ s32 scan_unassoc_time, s32 scan_passive_time);
263+static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
264+ bool need_lock);
265+static s32 brcmf_dongle_roam(struct net_device *ndev, u32 roamvar,
274266 u32 bcn_timeout);
275267
276268 /*
277269 ** iscan handler
278270 */
279−static void wl_iscan_timer(unsigned long data);
280−static void wl_term_iscan(struct wl_priv *wl);
281−static s32 wl_init_iscan(struct wl_priv *wl);
282−static s32 wl_iscan_thread(void *data);
283−static s32 wl_dev_iovar_setbuf(struct net_device *dev, s8 *iovar,
271+static void brcmf_iscan_timer(unsigned long data);
272+static void brcmf_term_iscan(struct brcmf_cfg80211_priv *cfg_priv);
273+static s32 brcmf_init_iscan(struct brcmf_cfg80211_priv *cfg_priv);
274+static s32 brcmf_iscan_thread(void *data);
275+static s32 brcmf_dev_iovar_setbuf(struct net_device *dev, s8 *iovar,
284276 void *param, s32 paramlen, void *bufptr,
285277 s32 buflen);
286−static s32 wl_dev_iovar_getbuf(struct net_device *dev, s8 *iovar,
278+static s32 brcmf_dev_iovar_getbuf(struct net_device *dev, s8 *iovar,
287279 void *param, s32 paramlen, void *bufptr,
288280 s32 buflen);
289−static s32 wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid,
290− u16 action);
291−static s32 wl_do_iscan(struct wl_priv *wl);
292−static s32 wl_wakeup_iscan(struct wl_iscan_ctrl *iscan);
293−static s32 wl_invoke_iscan(struct wl_priv *wl);
294−static s32 wl_get_iscan_results(struct wl_iscan_ctrl *iscan, u32 *status,
295− struct wl_scan_results **bss_list);
296−static void wl_notify_iscan_complete(struct wl_iscan_ctrl *iscan, bool aborted);
297−static void wl_init_iscan_eloop(struct wl_iscan_eloop *el);
298−static s32 wl_iscan_done(struct wl_priv *wl);
299−static s32 wl_iscan_pending(struct wl_priv *wl);
300−static s32 wl_iscan_inprogress(struct wl_priv *wl);
301−static s32 wl_iscan_aborted(struct wl_priv *wl);
302−
303−/*
304−** fw/nvram downloading handler
305−*/
306−static void wl_init_fw(struct wl_fw_ctrl *fw);
281+static s32 brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
282+ struct brcmf_ssid *ssid, u16 action);
283+static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv);
284+static s32 brcmf_wakeup_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan);
285+static s32 brcmf_invoke_iscan(struct brcmf_cfg80211_priv *cfg_priv);
286+static s32 brcmf_get_iscan_results(struct brcmf_cfg80211_iscan_ctrl *iscan,
287+ u32 *status,
288+ struct brcmf_scan_results **bss_list);
289+static void brcmf_notify_iscan_complete(struct brcmf_cfg80211_iscan_ctrl *iscan,
290+ bool aborted);
291+static void brcmf_init_iscan_eloop(struct brcmf_cfg80211_iscan_eloop *el);
292+static s32 brcmf_iscan_done(struct brcmf_cfg80211_priv *cfg_priv);
293+static s32 brcmf_iscan_pending(struct brcmf_cfg80211_priv *cfg_priv);
294+static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv);
295+static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv);
307296
308297 /*
309298 * find most significant bit set
310299 */
311−static __used u32 wl_find_msb(u16 bit16);
300+static __used u32 brcmf_find_msb(u16 bit16);
312301
313302 /*
314303 * update pmklist to dongle
315304 */
316−static __used s32 wl_update_pmklist(struct net_device *dev,
317− struct wl_pmk_list *pmk_list, s32 err);
305+static __used s32 brcmf_update_pmklist(struct net_device *dev,
306+ struct brcmf_cfg80211_pmk_list *pmk_list,
307+ s32 err);
318308
319−static void wl_set_mpc(struct net_device *ndev, int mpc);
309+static void brcmf_set_mpc(struct net_device *ndev, int mpc);
320310
321311 /*
322312 * debufs support
323313 */
324−static int wl_debugfs_add_netdev_params(struct wl_priv *wl);
325−static void wl_debugfs_remove_netdev(struct wl_priv *wl);
314+static int
315+brcmf_debugfs_add_netdev_params(struct brcmf_cfg80211_priv *cfg_priv);
316+static void brcmf_debugfs_remove_netdev(struct brcmf_cfg80211_priv *cfg_priv);
326317
327−#define WL_PRIV_GET() \
318+#define WL_PRIV_GET() \
328319 ({ \
329− struct wl_iface *ci; \
330− if (unlikely(!(wl_cfg80211_dev && \
331− (ci = wl_get_drvdata(wl_cfg80211_dev))))) { \
320+ struct brcmf_cfg80211_iface *ci = brcmf_get_drvdata(cfg80211_dev); \
321+ if (unlikely(!ci)) { \
332322 WL_ERR("wl_cfg80211_dev is unavailable\n"); \
333323 BUG(); \
334− } \
335− ci_to_wl(ci); \
324+ } \
325+ ci->cfg_priv; \
336326 })
337327
338328 #define CHECK_SYS_UP() \
339329 do { \
340− struct wl_priv *wl = wiphy_to_wl(wiphy); \
341− if (unlikely(!test_bit(WL_STATUS_READY, &wl->status))) { \
330+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); \
331+ if (unlikely(!test_bit(WL_STATUS_READY, &cfg_priv->status))) { \
342332 WL_INFO("device is not ready : status (%d)\n", \
343− (int)wl->status); \
333+ (int)cfg_priv->status); \
344334 return -EIO; \
345335 } \
346336 } while (0)
347337
348−extern int dhd_wait_pend8021x(struct net_device *dev);
349338 #define CHAN2G(_channel, _freq, _flags) { \
350339 .band = IEEE80211_BAND_2GHZ, \
351340 .center_freq = (_freq), \
@@ -373,18 +362,18 @@ extern int dhd_wait_pend8021x(struct net_device *dev); · 21 unmodified lines
373362 }
374363
375364 static struct ieee80211_rate __wl_rates[] = {
376− RATETAB_ENT(WLC_RATE_1M, 0),
377− RATETAB_ENT(WLC_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE),
378− RATETAB_ENT(WLC_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE),
379− RATETAB_ENT(WLC_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE),
380− RATETAB_ENT(WLC_RATE_6M, 0),
381− RATETAB_ENT(WLC_RATE_9M, 0),
382− RATETAB_ENT(WLC_RATE_12M, 0),
383− RATETAB_ENT(WLC_RATE_18M, 0),
384− RATETAB_ENT(WLC_RATE_24M, 0),
385− RATETAB_ENT(WLC_RATE_36M, 0),
386− RATETAB_ENT(WLC_RATE_48M, 0),
387− RATETAB_ENT(WLC_RATE_54M, 0),
365+ RATETAB_ENT(BRCM_RATE_1M, 0),
366+ RATETAB_ENT(BRCM_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE),
367+ RATETAB_ENT(BRCM_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE),
368+ RATETAB_ENT(BRCM_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE),
369+ RATETAB_ENT(BRCM_RATE_6M, 0),
370+ RATETAB_ENT(BRCM_RATE_9M, 0),
371+ RATETAB_ENT(BRCM_RATE_12M, 0),
372+ RATETAB_ENT(BRCM_RATE_18M, 0),
373+ RATETAB_ENT(BRCM_RATE_24M, 0),
374+ RATETAB_ENT(BRCM_RATE_36M, 0),
375+ RATETAB_ENT(BRCM_RATE_48M, 0),
376+ RATETAB_ENT(BRCM_RATE_54M, 0),
388377 };
389378
390379 #define wl_a_rates (__wl_rates + 4)
@@ -521,7 +510,7 @@ static const u32 __wl_cipher_suites[] = { · 130 unmodified lines
521510 WLAN_CIPHER_SUITE_AES_CMAC,
522511 };
523512
524−static void swap_key_from_BE(struct wl_wsec_key *key)
513+static void swap_key_from_BE(struct brcmf_wsec_key *key)
525514 {
526515 key->index = cpu_to_le32(key->index);
527516 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
532521 key->iv_initialized = cpu_to_le32(key->iv_initialized);
533522 }
534523
535−static void swap_key_to_BE(struct wl_wsec_key *key)
524+static void swap_key_to_BE(struct brcmf_wsec_key *key)
536525 {
537526 key->index = le32_to_cpu(key->index);
538527 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
544533 }
545534
546535 static s32
547−wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
536+brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
548537 {
549538 struct ifreq ifr;
550− struct wl_ioctl ioc;
539+ struct brcmf_ioctl ioc;
551540 mm_segment_t fs;
552541 s32 err = 0;
553542
@@ -567,11 +556,11 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len) · 13 unmodified lines
567556 }
568557
569558 static s32
570−wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
559+brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
571560 enum nl80211_iftype type, u32 *flags,
572561 struct vif_params *params)
573562 {
574− struct wl_priv *wl = wiphy_to_wl(wiphy);
563+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
575564 struct wireless_dev *wdev;
576565 s32 infra = 0;
577566 s32 err = 0;
@@ -586,11 +575,11 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, · 8 unmodified lines
586575 type);
587576 return -EOPNOTSUPP;
588577 case NL80211_IFTYPE_ADHOC:
589− wl->conf->mode = WL_MODE_IBSS;
578+ cfg_priv->conf->mode = WL_MODE_IBSS;
590579 infra = 0;
591580 break;
592581 case NL80211_IFTYPE_STATION:
593− wl->conf->mode = WL_MODE_BSS;
582+ cfg_priv->conf->mode = WL_MODE_BSS;
594583 infra = 1;
595584 break;
596585 default:
@@ -599,7 +588,7 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines
599588 }
600589
601590 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));
603592 if (unlikely(err)) {
604593 WL_ERR("WLC_SET_INFRA error (%d)\n", err);
605594 err = -EAGAIN;
@@ -609,7 +598,7 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, · 3 unmodified lines
609598 }
610599
611600 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");
613602
614603 done:
615604 WL_TRACE("Exit\n");
@@ -617,7 +606,8 @@ done: · 1 unmodified line
617606 return err;
618607 }
619608
620−static void wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid)
609+static void wl_iscan_prep(struct brcmf_scan_params *params,
610+ struct brcmf_ssid *ssid)
621611 {
622612 memcpy(params->bssid, ether_bcast, ETH_ALEN);
623613 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
633623 params->passive_time = cpu_to_le32(params->passive_time);
634624 params->home_time = cpu_to_le32(params->home_time);
635625 if (ssid && ssid->SSID_len)
636− memcpy(&params->ssid, ssid, sizeof(wlc_ssid_t));
626+ memcpy(&params->ssid, ssid, sizeof(struct brcmf_ssid));
637627
638628 }
639629
640630 static s32
641−wl_dev_iovar_setbuf(struct net_device *dev, s8 * iovar, void *param,
631+brcmf_dev_iovar_setbuf(struct net_device *dev, s8 * iovar, void *param,
642632 s32 paramlen, void *bufptr, s32 buflen)
643633 {
644634 s32 iolen;
645635
646− iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen);
636+ iolen = brcmu_mkiovar(iovar, param, paramlen, bufptr, buflen);
647637 BUG_ON(!iolen);
648638
649− return wl_dev_ioctl(dev, WLC_SET_VAR, bufptr, iolen);
639+ return brcmf_dev_ioctl(dev, BRCMF_C_SET_VAR, bufptr, iolen);
650640 }
651641
652642 static s32
653−wl_dev_iovar_getbuf(struct net_device *dev, s8 * iovar, void *param,
643+brcmf_dev_iovar_getbuf(struct net_device *dev, s8 * iovar, void *param,
654644 s32 paramlen, void *bufptr, s32 buflen)
655645 {
656646 s32 iolen;
657647
658− iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen);
648+ iolen = brcmu_mkiovar(iovar, param, paramlen, bufptr, buflen);
659649 BUG_ON(!iolen);
660650
661− return wl_dev_ioctl(dev, WLC_GET_VAR, bufptr, buflen);
651+ return brcmf_dev_ioctl(dev, BRCMF_C_GET_VAR, bufptr, buflen);
662652 }
663653
664654 static s32
665−wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, u16 action)
655+brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
656+ struct brcmf_ssid *ssid, u16 action)
666657 {
667− s32 params_size =
668− (WL_SCAN_PARAMS_FIXED_SIZE + offsetof(wl_iscan_params_t, params));
669− struct wl_iscan_params *params;
658+ s32 params_size = (BRCMF_SCAN_PARAMS_FIXED_SIZE +
659+ offsetof(struct brcmf_iscan_params, params));
660+ struct brcmf_iscan_params *params;
670661 s32 err = 0;
671662
672663 if (ssid && ssid->SSID_len)
673− params_size += sizeof(struct wlc_ssid);
664+ params_size += sizeof(struct brcmf_ssid);
674665 params = kzalloc(params_size, GFP_KERNEL);
675666 if (unlikely(!params))
676667 return -ENOMEM;
677− BUG_ON(params_size >= WLC_IOCTL_SMLEN);
668+ BUG_ON(params_size >= BRCMF_C_IOCTL_SMLEN);
678669
679670 wl_iscan_prep(&params->params, ssid);
680671
681− params->version = cpu_to_le32(ISCAN_REQ_VERSION);
672+ params->version = cpu_to_le32(BRCMF_ISCAN_REQ_VERSION);
682673 params->action = cpu_to_le16(action);
683674 params->scan_duration = cpu_to_le16(0);
684675
685− /* params_size += offsetof(wl_iscan_params_t, params); */
686− err = wl_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size,
687− iscan->ioctl_buf, WLC_IOCTL_SMLEN);
676+ /* params_size += offsetof(struct brcmf_iscan_params, params); */
677+ err = brcmf_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size,
678+ iscan->ioctl_buf, BRCMF_C_IOCTL_SMLEN);
688679 if (unlikely(err)) {
689680 if (err == -EBUSY) {
690681 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
696687 return err;
697688 }
698689
699−static s32 wl_do_iscan(struct wl_priv *wl)
690+static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv)
700691 {
701− struct wl_iscan_ctrl *iscan = wl_to_iscan(wl);
702− struct net_device *ndev = wl_to_ndev(wl);
703− struct wlc_ssid ssid;
692+ struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv);
693+ struct net_device *ndev = cfg_to_ndev(cfg_priv);
694+ struct brcmf_ssid ssid;
704695 s32 passive_scan;
705696 s32 err = 0;
706697
@@ -709,16 +700,16 @@ static s32 wl_do_iscan(struct wl_priv *wl) · 2 unmodified lines
709700
710701 iscan->state = WL_ISCAN_STATE_SCANING;
711702
712− passive_scan = wl->active_scan ? 0 : 1;
713− err = wl_dev_ioctl(wl_to_ndev(wl), WLC_SET_PASSIVE_SCAN,
703+ passive_scan = cfg_priv->active_scan ? 0 : 1;
704+ err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), BRCMF_C_SET_PASSIVE_SCAN,
714705 &passive_scan, sizeof(passive_scan));
715706 if (unlikely(err)) {
716707 WL_ERR("error (%d)\n", err);
717708 return err;
718709 }
719− wl_set_mpc(ndev, 0);
720− wl->iscan_kickstart = true;
721− wl_run_iscan(iscan, &ssid, WL_SCAN_ACTION_START);
710+ brcmf_set_mpc(ndev, 0);
711+ cfg_priv->iscan_kickstart = true;
712+ brcmf_run_iscan(iscan, &ssid, BRCMF_SCAN_ACTION_START);
722713 mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
723714 iscan->timer_on = 1;
724715
@@ -726,30 +717,30 @@ static s32 wl_do_iscan(struct wl_priv *wl) · 1 unmodified line
726717 }
727718
728719 static s32
729−__wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
720+__brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
730721 struct cfg80211_scan_request *request,
731722 struct cfg80211_ssid *this_ssid)
732723 {
733− struct wl_priv *wl = ndev_to_wl(ndev);
724+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
734725 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;
736727 s32 passive_scan;
737728 bool iscan_req;
738729 bool spec_scan;
739730 s32 err = 0;
740731
741− if (unlikely(test_bit(WL_STATUS_SCANNING, &wl->status))) {
742− WL_ERR("Scanning already : status (%d)\n", (int)wl->status);
732+ if (unlikely(test_bit(WL_STATUS_SCANNING, &cfg_priv->status))) {
733+ WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status);
743734 return -EAGAIN;
744735 }
745− if (unlikely(test_bit(WL_STATUS_SCAN_ABORTING, &wl->status))) {
746− WL_ERR("Scanning being aborted : status (%d)\n",
747− (int)wl->status);
736+ if (unlikely(test_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status))) {
737+ WL_ERR("Scanning being aborted : status (%lu)\n",
738+ cfg_priv->status);
748739 return -EAGAIN;
749740 }
750− if (test_bit(WL_STATUS_CONNECTING, &wl->status)) {
751− WL_ERR("Connecting : status (%d)\n",
752− (int)wl->status);
741+ if (test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) {
742+ WL_ERR("Connecting : status (%lu)\n",
743+ cfg_priv->status);
753744 return -EAGAIN;
754745 }
755746
@@ -758,7 +749,7 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines
758749 if (request) {
759750 /* scan bss */
760751 ssids = request->ssids;
761− if (wl->iscan_on && (!ssids || !ssids->ssid_len))
752+ if (cfg_priv->iscan_on && (!ssids || !ssids->ssid_len))
762753 iscan_req = true;
763754 } else {
764755 /* scan in ibss */
@@ -766,10 +757,10 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 1 unmodified line
766757 ssids = this_ssid;
767758 }
768759
769− wl->scan_request = request;
770− set_bit(WL_STATUS_SCANNING, &wl->status);
760+ cfg_priv->scan_request = request;
761+ set_bit(WL_STATUS_SCANNING, &cfg_priv->status);
771762 if (iscan_req) {
772− err = wl_do_iscan(wl);
763+ err = brcmf_do_iscan(cfg_priv);
773764 if (likely(!err))
774765 return err;
775766 else
@@ -788,15 +779,15 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 12 unmodified lines
788779 WL_SCAN("Broadcast scan\n");
789780 }
790781
791− passive_scan = wl->active_scan ? 0 : 1;
792− err = wl_dev_ioctl(ndev, WLC_SET_PASSIVE_SCAN,
782+ passive_scan = cfg_priv->active_scan ? 0 : 1;
783+ err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_PASSIVE_SCAN,
793784 &passive_scan, sizeof(passive_scan));
794785 if (unlikely(err)) {
795786 WL_ERR("WLC_SET_PASSIVE_SCAN error (%d)\n", err);
796787 goto scan_out;
797788 }
798− wl_set_mpc(ndev, 0);
799− err = wl_dev_ioctl(ndev, WLC_SCAN, &sr->ssid,
789+ brcmf_set_mpc(ndev, 0);
790+ err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN, &sr->ssid,
800791 sizeof(sr->ssid));
801792 if (err) {
802793 if (err == -EBUSY) {
@@ -805,7 +796,7 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines
805796 } else {
806797 WL_ERR("WLC_SCAN error (%d)\n", err);
807798 }
808− wl_set_mpc(ndev, 1);
799+ brcmf_set_mpc(ndev, 1);
809800 goto scan_out;
810801 }
811802 }
@@ -813,13 +804,13 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 1 unmodified line
813804 return 0;
814805
815806 scan_out:
816− clear_bit(WL_STATUS_SCANNING, &wl->status);
817− wl->scan_request = NULL;
807+ clear_bit(WL_STATUS_SCANNING, &cfg_priv->status);
808+ cfg_priv->scan_request = NULL;
818809 return err;
819810 }
820811
821812 static s32
822−wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
813+brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
823814 struct cfg80211_scan_request *request)
824815 {
825816 s32 err = 0;
@@ -828,7 +819,7 @@ wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines
828819
829820 CHECK_SYS_UP();
830821
831− err = __wl_cfg80211_scan(wiphy, ndev, request, NULL);
822+ err = __brcmf_cfg80211_scan(wiphy, ndev, request, NULL);
832823 if (unlikely(err))
833824 WL_ERR("scan error (%d)\n", err);
834825
@@ -836,17 +827,18 @@ wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 1 unmodified line
836827 return err;
837828 }
838829
839−static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val)
830+static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val)
840831 {
841− s8 buf[WLC_IOCTL_SMLEN];
832+ s8 buf[BRCMF_C_IOCTL_SMLEN];
842833 u32 len;
843834 s32 err = 0;
844835
845836 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));
847839 BUG_ON(!len);
848840
849− err = wl_dev_ioctl(dev, WLC_SET_VAR, buf, len);
841+ err = brcmf_dev_ioctl(dev, BRCMF_C_SET_VAR, buf, len);
850842 if (unlikely(err))
851843 WL_ERR("error (%d)\n", err);
852844
@@ -854,10 +846,10 @@ static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val) · 1 unmodified line
854846 }
855847
856848 static s32
857−wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval)
849+brcmf_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval)
858850 {
859851 union {
860− s8 buf[WLC_IOCTL_SMLEN];
852+ s8 buf[BRCMF_C_IOCTL_SMLEN];
861853 s32 val;
862854 } var;
863855 u32 len;
@@ -865,10 +857,10 @@ wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) · 1 unmodified line
865857 s32 err = 0;
866858
867859 len =
868− bcm_mkiovar(name, (char *)(&data_null), 0, (char *)(&var),
860+ brcmu_mkiovar(name, (char *)(&data_null), 0, (char *)(&var),
869861 sizeof(var.buf));
870862 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);
872864 if (unlikely(err))
873865 WL_ERR("error (%d)\n", err);
874866
@@ -877,35 +869,35 @@ wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) · 2 unmodified lines
877869 return err;
878870 }
879871
880−static s32 wl_set_rts(struct net_device *dev, u32 rts_threshold)
872+static s32 brcmf_set_rts(struct net_device *dev, u32 rts_threshold)
881873 {
882874 s32 err = 0;
883875
884− err = wl_dev_intvar_set(dev, "rtsthresh", rts_threshold);
876+ err = brcmf_dev_intvar_set(dev, "rtsthresh", rts_threshold);
885877 if (unlikely(err))
886878 WL_ERR("Error (%d)\n", err);
887879
888880 return err;
889881 }
890882
891−static s32 wl_set_frag(struct net_device *dev, u32 frag_threshold)
883+static s32 brcmf_set_frag(struct net_device *dev, u32 frag_threshold)
892884 {
893885 s32 err = 0;
894886
895− err = wl_dev_intvar_set(dev, "fragthresh", frag_threshold);
887+ err = brcmf_dev_intvar_set(dev, "fragthresh", frag_threshold);
896888 if (unlikely(err))
897889 WL_ERR("Error (%d)\n", err);
898890
899891 return err;
900892 }
901893
902−static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l)
894+static s32 brcmf_set_retry(struct net_device *dev, u32 retry, bool l)
903895 {
904896 s32 err = 0;
905− u32 cmd = (l ? WLC_SET_LRL : WLC_SET_SRL);
897+ u32 cmd = (l ? BRCM_SET_LRL : BRCM_SET_SRL);
906898
907899 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));
909901 if (unlikely(err)) {
910902 WL_ERR("cmd (%d) , error (%d)\n", cmd, err);
911903 return err;
@@ -913,40 +905,40 @@ static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l) · 1 unmodified line
913905 return err;
914906 }
915907
916−static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
908+static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
917909 {
918− struct wl_priv *wl = wiphy_to_wl(wiphy);
919− struct net_device *ndev = wl_to_ndev(wl);
910+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
911+ struct net_device *ndev = cfg_to_ndev(cfg_priv);
920912 s32 err = 0;
921913
922914 WL_TRACE("Enter\n");
923915 CHECK_SYS_UP();
924916
925917 if (changed & WIPHY_PARAM_RTS_THRESHOLD &&
926− (wl->conf->rts_threshold != wiphy->rts_threshold)) {
927− wl->conf->rts_threshold = wiphy->rts_threshold;
928− err = wl_set_rts(ndev, wl->conf->rts_threshold);
918+ (cfg_priv->conf->rts_threshold != wiphy->rts_threshold)) {
919+ cfg_priv->conf->rts_threshold = wiphy->rts_threshold;
920+ err = brcmf_set_rts(ndev, cfg_priv->conf->rts_threshold);
929921 if (!err)
930922 goto done;
931923 }
932924 if (changed & WIPHY_PARAM_FRAG_THRESHOLD &&
933− (wl->conf->frag_threshold != wiphy->frag_threshold)) {
934− wl->conf->frag_threshold = wiphy->frag_threshold;
935− err = wl_set_frag(ndev, wl->conf->frag_threshold);
925+ (cfg_priv->conf->frag_threshold != wiphy->frag_threshold)) {
926+ cfg_priv->conf->frag_threshold = wiphy->frag_threshold;
927+ err = brcmf_set_frag(ndev, cfg_priv->conf->frag_threshold);
936928 if (!err)
937929 goto done;
938930 }
939931 if (changed & WIPHY_PARAM_RETRY_LONG
940− && (wl->conf->retry_long != wiphy->retry_long)) {
941− wl->conf->retry_long = wiphy->retry_long;
942− err = wl_set_retry(ndev, wl->conf->retry_long, true);
932+ && (cfg_priv->conf->retry_long != wiphy->retry_long)) {
933+ cfg_priv->conf->retry_long = wiphy->retry_long;
934+ err = brcmf_set_retry(ndev, cfg_priv->conf->retry_long, true);
943935 if (!err)
944936 goto done;
945937 }
946938 if (changed & WIPHY_PARAM_RETRY_SHORT
947− && (wl->conf->retry_short != wiphy->retry_short)) {
948− wl->conf->retry_short = wiphy->retry_short;
949− err = wl_set_retry(ndev, wl->conf->retry_short, false);
939+ && (cfg_priv->conf->retry_short != wiphy->retry_short)) {
940+ cfg_priv->conf->retry_short = wiphy->retry_short;
941+ err = brcmf_set_retry(ndev, cfg_priv->conf->retry_short, false);
950942 if (!err)
951943 goto done;
952944 }
@@ -957,11 +949,11 @@ done: · 4 unmodified lines
957949 }
958950
959951 static s32
960−wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
952+brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
961953 struct cfg80211_ibss_params *params)
962954 {
963− struct wl_priv *wl = wiphy_to_wl(wiphy);
964− struct wl_join_params join_params;
955+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
956+ struct brcmf_join_params join_params;
965957 size_t join_params_size = 0;
966958 s32 err = 0;
967959 s32 wsec = 0;
@@ -977,6 +969,8 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 9 unmodified lines
977969 return -EOPNOTSUPP;
978970 }
979971
972+ set_bit(WL_STATUS_CONNECTING, &cfg_priv->status);
973+
980974 if (params->bssid)
981975 WL_CONN("BSSID: %02X %02X %02X %02X %02X %02X\n",
982976 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
10181012 if (params->privacy)
10191013 wsec |= WEP_ENABLED;
10201014
1021− err = wl_dev_intvar_set(dev, "wsec", wsec);
1015+ err = brcmf_dev_intvar_set(dev, "wsec", wsec);
10221016 if (unlikely(err)) {
10231017 WL_ERR("wsec failed (%d)\n", err);
10241018 goto done;
@@ -1030,14 +1024,14 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 5 unmodified lines
10301024 else
10311025 bcnprd = cpu_to_le32(100);
10321026
1033− err = wl_dev_ioctl(dev, WLC_SET_BCNPRD, &bcnprd, sizeof(bcnprd));
1027+ err = brcmf_dev_ioctl(dev, BRCM_SET_BCNPRD, &bcnprd, sizeof(bcnprd));
10341028 if (unlikely(err)) {
10351029 WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err);
10361030 goto done;
10371031 }
10381032
10391033 /* Configure required join parameter */
1040− memset(&join_params, 0, sizeof(wl_join_params_t));
1034+ memset(&join_params, 0, sizeof(struct brcmf_join_params));
10411035
10421036 /* SSID */
10431037 join_params.ssid.SSID_len =
@@ -1045,67 +1039,69 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 1 unmodified line
10451039 memcpy(join_params.ssid.SSID, params->ssid, join_params.ssid.SSID_len);
10461040 join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);
10471041 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);
10491043
10501044 /* BSSID */
10511045 if (params->bssid) {
10521046 memcpy(join_params.params.bssid, params->bssid, ETH_ALEN);
1053− join_params_size =
1054− sizeof(join_params.ssid) + WL_ASSOC_PARAMS_FIXED_SIZE;
1047+ join_params_size = sizeof(join_params.ssid) +
1048+ BRCMF_ASSOC_PARAMS_FIXED_SIZE;
10551049 } else {
10561050 memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);
10571051 }
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);
10591054
10601055 /* Channel */
10611056 if (params->channel) {
10621057 u32 target_channel;
10631058
1064− wl->channel =
1059+ cfg_priv->channel =
10651060 ieee80211_frequency_to_channel(
10661061 params->channel->center_freq);
10671062 if (params->channel_fixed) {
10681063 /* adding chanspec */
1069− wl_ch_to_chanspec(wl->channel,
1064+ brcmf_ch_to_chanspec(cfg_priv->channel,
10701065 &join_params, &join_params_size);
10711066 }
10721067
10731068 /* set channel for starter */
1074− target_channel = cpu_to_le32(wl->channel);
1075− err = wl_dev_ioctl(dev, WLC_SET_CHANNEL,
1069+ target_channel = cpu_to_le32(cfg_priv->channel);
1070+ err = brcmf_dev_ioctl(dev, BRCM_SET_CHANNEL,
10761071 &target_channel, sizeof(target_channel));
10771072 if (unlikely(err)) {
10781073 WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err);
10791074 goto done;
10801075 }
10811076 } else
1082− wl->channel = 0;
1077+ cfg_priv->channel = 0;
10831078
1084− wl->ibss_starter = false;
1079+ cfg_priv->ibss_starter = false;
10851080
10861081
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);
10881084 if (unlikely(err)) {
10891085 WL_ERR("WLC_SET_SSID failed (%d)\n", err);
10901086 goto done;
10911087 }
10921088
1093− set_bit(WL_STATUS_CONNECTING, &wl->status);
1094−
10951089 done:
1090+ if (err)
1091+ clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status);
10961092 WL_TRACE("Exit\n");
10971093 return err;
10981094 }
10991095
1100−static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
1096+static s32 brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
11011097 {
1102− struct wl_priv *wl = wiphy_to_wl(wiphy);
1098+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
11031099 s32 err = 0;
11041100
11051101 WL_TRACE("Enter\n");
11061102 CHECK_SYS_UP();
11071103
1108− wl_link_down(wl);
1104+ brcmf_link_down(cfg_priv);
11091105
11101106 WL_TRACE("Exit\n");
11111107
@@ -1113,10 +1109,10 @@ static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) · 1 unmodified line
11131109 }
11141110
11151111 static s32
1116−wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme)
1112+brcmf_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme)
11171113 {
1118− struct wl_priv *wl = ndev_to_wl(dev);
1119− struct wl_security *sec;
1114+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
1115+ struct brcmf_cfg80211_security *sec;
11201116 s32 val = 0;
11211117 s32 err = 0;
11221118
@@ -1127,21 +1123,21 @@ wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme) · 4 unmodified lines
11271123 else
11281124 val = WPA_AUTH_DISABLED;
11291125 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);
11311127 if (unlikely(err)) {
11321128 WL_ERR("set wpa_auth failed (%d)\n", err);
11331129 return err;
11341130 }
1135− sec = wl_read_prof(wl, WL_PROF_SEC);
1131+ sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
11361132 sec->wpa_versions = sme->crypto.wpa_versions;
11371133 return err;
11381134 }
11391135
11401136 static s32
1141−wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
1137+brcmf_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
11421138 {
1143− struct wl_priv *wl = ndev_to_wl(dev);
1144− struct wl_security *sec;
1139+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
1140+ struct brcmf_cfg80211_security *sec;
11451141 s32 val = 0;
11461142 s32 err = 0;
11471143
@@ -1166,21 +1162,21 @@ wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme) · 18 unmodified lines
11661162 break;
11671163 }
11681164
1169− err = wl_dev_intvar_set(dev, "auth", val);
1165+ err = brcmf_dev_intvar_set(dev, "auth", val);
11701166 if (unlikely(err)) {
11711167 WL_ERR("set auth failed (%d)\n", err);
11721168 return err;
11731169 }
1174− sec = wl_read_prof(wl, WL_PROF_SEC);
1170+ sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
11751171 sec->auth_type = sme->auth_type;
11761172 return err;
11771173 }
11781174
11791175 static s32
1180−wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme)
1176+brcmf_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme)
11811177 {
1182− struct wl_priv *wl = ndev_to_wl(dev);
1183− struct wl_security *sec;
1178+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
1179+ struct brcmf_cfg80211_security *sec;
11841180 s32 pval = 0;
11851181 s32 gval = 0;
11861182 s32 err = 0;
@@ -1229,13 +1225,13 @@ wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) · 42 unmodified lines
12291225 }
12301226
12311227 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);
12331229 if (unlikely(err)) {
12341230 WL_ERR("error (%d)\n", err);
12351231 return err;
12361232 }
12371233
1238− sec = wl_read_prof(wl, WL_PROF_SEC);
1234+ sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
12391235 sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0];
12401236 sec->cipher_group = sme->crypto.cipher_group;
12411237
@@ -1243,15 +1239,15 @@ wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) · 1 unmodified line
12431239 }
12441240
12451241 static s32
1246−wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme)
1242+brcmf_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme)
12471243 {
1248− struct wl_priv *wl = ndev_to_wl(dev);
1249− struct wl_security *sec;
1244+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
1245+ struct brcmf_cfg80211_security *sec;
12501246 s32 val = 0;
12511247 s32 err = 0;
12521248
12531249 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);
12551251 if (unlikely(err)) {
12561252 WL_ERR("could not get wpa_auth (%d)\n", err);
12571253 return err;
@@ -1285,31 +1281,31 @@ wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme) · 27 unmodified lines
12851281 }
12861282
12871283 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);
12891285 if (unlikely(err)) {
12901286 WL_ERR("could not set wpa_auth (%d)\n", err);
12911287 return err;
12921288 }
12931289 }
1294− sec = wl_read_prof(wl, WL_PROF_SEC);
1290+ sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
12951291 sec->wpa_auth = sme->crypto.akm_suites[0];
12961292
12971293 return err;
12981294 }
12991295
13001296 static s32
1301−wl_set_set_sharedkey(struct net_device *dev,
1297+brcmf_set_set_sharedkey(struct net_device *dev,
13021298 struct cfg80211_connect_params *sme)
13031299 {
1304− struct wl_priv *wl = ndev_to_wl(dev);
1305− struct wl_security *sec;
1306− struct wl_wsec_key key;
1300+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
1301+ struct brcmf_cfg80211_security *sec;
1302+ struct brcmf_wsec_key key;
13071303 s32 val;
13081304 s32 err = 0;
13091305
13101306 WL_CONN("key len (%d)\n", sme->key_len);
13111307 if (sme->key_len) {
1312− sec = wl_read_prof(wl, WL_PROF_SEC);
1308+ sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
13131309 WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n",
13141310 sec->wpa_versions, sec->cipher_pairwise);
13151311 if (!
@@ -1325,7 +1321,7 @@ wl_set_set_sharedkey(struct net_device *dev, · 9 unmodified lines
13251321 return -EINVAL;
13261322 }
13271323 memcpy(key.data, sme->key, key.len);
1328− key.flags = WL_PRIMARY_KEY;
1324+ key.flags = BRCMF_PRIMARY_KEY;
13291325 switch (sec->cipher_pairwise) {
13301326 case WLAN_CIPHER_SUITE_WEP40:
13311327 key.algo = CRYPTO_ALGO_WEP1;
@@ -1343,7 +1339,7 @@ wl_set_set_sharedkey(struct net_device *dev, · 11 unmodified lines
13431339 key.len, key.index, key.algo);
13441340 WL_CONN("key \"%s\"\n", key.data);
13451341 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,
13471343 sizeof(key));
13481344 if (unlikely(err)) {
13491345 WL_ERR("WLC_SET_KEY error (%d)\n", err);
@@ -1352,7 +1348,7 @@ wl_set_set_sharedkey(struct net_device *dev, · 2 unmodified lines
13521348 if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) {
13531349 WL_CONN("set auth_type to shared key\n");
13541350 val = 1; /* shared key */
1355− err = wl_dev_intvar_set(dev, "auth", val);
1351+ err = brcmf_dev_intvar_set(dev, "auth", val);
13561352 if (unlikely(err)) {
13571353 WL_ERR("set auth failed (%d)\n", err);
13581354 return err;
@@ -1364,12 +1360,12 @@ wl_set_set_sharedkey(struct net_device *dev, · 5 unmodified lines
13641360 }
13651361
13661362 static s32
1367−wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
1363+brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
13681364 struct cfg80211_connect_params *sme)
13691365 {
1370− struct wl_priv *wl = wiphy_to_wl(wiphy);
1366+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
13711367 struct ieee80211_channel *chan = sme->channel;
1372− struct wl_join_params join_params;
1368+ struct brcmf_join_params join_params;
13731369 size_t join_params_size;
13741370
13751371 s32 err = 0;
@@ -1382,37 +1378,49 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, · 6 unmodified lines
13821378 return -EOPNOTSUPP;
13831379 }
13841380
1381+ set_bit(WL_STATUS_CONNECTING, &cfg_priv->status);
1382+
13851383 if (chan) {
1386− wl->channel =
1384+ cfg_priv->channel =
13871385 ieee80211_frequency_to_channel(chan->center_freq);
13881386 WL_CONN("channel (%d), center_req (%d)\n",
1389− wl->channel, chan->center_freq);
1387+ cfg_priv->channel, chan->center_freq);
13901388 } else
1391− wl->channel = 0;
1389+ cfg_priv->channel = 0;
13921390
13931391 WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len);
13941392
1395− err = wl_set_wpa_version(dev, sme);
1396− if (unlikely(err))
1397− return err;
1393+ err = brcmf_set_wpa_version(dev, sme);
1394+ if (err) {
1395+ WL_ERR("wl_set_wpa_version failed (%d)\n", err);
1396+ goto done;
1397+ }
13981398
1399− err = wl_set_auth_type(dev, sme);
1400− if (unlikely(err))
1401− return err;
1399+ err = brcmf_set_auth_type(dev, sme);
1400+ if (err) {
1401+ WL_ERR("wl_set_auth_type failed (%d)\n", err);
1402+ goto done;
1403+ }
14021404
1403− err = wl_set_set_cipher(dev, sme);
1404− if (unlikely(err))
1405− return err;
1405+ err = brcmf_set_set_cipher(dev, sme);
1406+ if (err) {
1407+ WL_ERR("wl_set_set_cipher failed (%d)\n", err);
1408+ goto done;
1409+ }
14061410
1407− err = wl_set_key_mgmt(dev, sme);
1408− if (unlikely(err))
1409− return err;
1411+ err = brcmf_set_key_mgmt(dev, sme);
1412+ if (err) {
1413+ WL_ERR("wl_set_key_mgmt failed (%d)\n", err);
1414+ goto done;
1415+ }
14101416
1411− err = wl_set_set_sharedkey(dev, sme);
1412− if (unlikely(err))
1413− return err;
1417+ err = brcmf_set_set_sharedkey(dev, sme);
1418+ if (err) {
1419+ WL_ERR("wl_set_set_sharedkey failed (%d)\n", err);
1420+ goto done;
1421+ }
14141422
1415− wl_update_prof(wl, NULL, sme->bssid, WL_PROF_BSSID);
1423+ brcmf_update_prof(cfg_priv, NULL, sme->bssid, WL_PROF_BSSID);
14161424 /*
14171425 ** Join with specific BSSID and cached SSID
14181426 ** 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
14231431 join_params.ssid.SSID_len = min(sizeof(join_params.ssid.SSID), sme->ssid_len);
14241432 memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len);
14251433 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);
14271435
14281436 if (sme->bssid)
14291437 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
14351443 join_params.ssid.SSID, join_params.ssid.SSID_len);
14361444 }
14371445
1438− wl_ch_to_chanspec(wl->channel, &join_params, &join_params_size);
1439− err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);
1440− if (unlikely(err)) {
1441− WL_ERR("error (%d)\n", err);
1442− return err;
1443− }
1444− set_bit(WL_STATUS_CONNECTING, &wl->status);
1446+ brcmf_ch_to_chanspec(cfg_priv->channel,
1447+ &join_params, &join_params_size);
1448+ err = brcmf_dev_ioctl(dev, BRCMF_C_SET_SSID,
1449+ &join_params, join_params_size);
1450+ if (err)
1451+ WL_ERR("WLC_SET_SSID failed (%d)\n", err);
14451452
1453+done:
1454+ if (err)
1455+ clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status);
14461456 WL_TRACE("Exit\n");
14471457 return err;
14481458 }
14491459
14501460 static s32
1451−wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
1461+brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
14521462 u16 reason_code)
14531463 {
1454− struct wl_priv *wl = wiphy_to_wl(wiphy);
1455− scb_val_t scbval;
1464+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1465+ struct brcmf_scb_val scbval;
14561466 s32 err = 0;
14571467
14581468 WL_TRACE("Enter. Reason code = %d\n", reason_code);
14591469 CHECK_SYS_UP();
14601470
1461− clear_bit(WL_STATUS_CONNECTED, &wl->status);
1471+ clear_bit(WL_STATUS_CONNECTED, &cfg_priv->status);
14621472
14631473 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);
14651475 scbval.val = cpu_to_le32(scbval.val);
1466− err = wl_dev_ioctl(dev, WLC_DISASSOC, &scbval,
1467− sizeof(scb_val_t));
1476+ err = brcmf_dev_ioctl(dev, BRCMF_C_DISASSOC, &scbval,
1477+ sizeof(struct brcmf_scb_val));
14681478 if (unlikely(err))
14691479 WL_ERR("error (%d)\n", err);
14701480
1471− wl->link_up = false;
1481+ cfg_priv->link_up = false;
14721482
14731483 WL_TRACE("Exit\n");
14741484 return err;
14751485 }
14761486
14771487 static s32
1478−wl_cfg80211_set_tx_power(struct wiphy *wiphy,
1488+brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
14791489 enum nl80211_tx_power_setting type, s32 dbm)
14801490 {
14811491
1482− struct wl_priv *wl = wiphy_to_wl(wiphy);
1483− struct net_device *ndev = wl_to_ndev(wl);
1492+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1493+ struct net_device *ndev = cfg_to_ndev(cfg_priv);
14841494 u16 txpwrmw;
14851495 s32 err = 0;
14861496 s32 disable = 0;
@@ -1509,7 +1519,7 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, · 22 unmodified lines
15091519 /* Make sure radio is off or on as far as software is concerned */
15101520 disable = WL_RADIO_SW_DISABLE << 16;
15111521 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));
15131523 if (unlikely(err))
15141524 WL_ERR("WLC_SET_RADIO error (%d)\n", err);
15151525
@@ -1517,21 +1527,21 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, · 1 unmodified line
15171527 txpwrmw = 0xffff;
15181528 else
15191529 txpwrmw = (u16) dbm;
1520− err = wl_dev_intvar_set(ndev, "qtxpower",
1521− (s32) (bcm_mw_to_qdbm(txpwrmw)));
1530+ err = brcmf_dev_intvar_set(ndev, "qtxpower",
1531+ (s32) (brcmu_mw_to_qdbm(txpwrmw)));
15221532 if (unlikely(err))
15231533 WL_ERR("qtxpower error (%d)\n", err);
1524− wl->conf->tx_power = dbm;
1534+ cfg_priv->conf->tx_power = dbm;
15251535
15261536 done:
15271537 WL_TRACE("Exit\n");
15281538 return err;
15291539 }
15301540
1531−static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
1541+static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
15321542 {
1533− struct wl_priv *wl = wiphy_to_wl(wiphy);
1534− struct net_device *ndev = wl_to_ndev(wl);
1543+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1544+ struct net_device *ndev = cfg_to_ndev(cfg_priv);
15351545 s32 txpwrdbm;
15361546 u8 result;
15371547 s32 err = 0;
@@ -1539,14 +1549,14 @@ static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm) · 1 unmodified line
15391549 WL_TRACE("Enter\n");
15401550 CHECK_SYS_UP();
15411551
1542− err = wl_dev_intvar_get(ndev, "qtxpower", &txpwrdbm);
1552+ err = brcmf_dev_intvar_get(ndev, "qtxpower", &txpwrdbm);
15431553 if (unlikely(err)) {
15441554 WL_ERR("error (%d)\n", err);
15451555 goto done;
15461556 }
15471557
15481558 result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);
1549− *dbm = (s32) bcm_qdbm_to_mw(result);
1559+ *dbm = (s32) brcmu_qdbm_to_mw(result);
15501560
15511561 done:
15521562 WL_TRACE("Exit\n");
@@ -1554,7 +1564,7 @@ done: · 1 unmodified line
15541564 }
15551565
15561566 static s32
1557−wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
1567+brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
15581568 u8 key_idx, bool unicast, bool multicast)
15591569 {
15601570 u32 index;
@@ -1565,7 +1575,7 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, · 4 unmodified lines
15651575 WL_CONN("key index (%d)\n", key_idx);
15661576 CHECK_SYS_UP();
15671577
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));
15691579 if (unlikely(err)) {
15701580 WL_ERR("WLC_GET_WSEC error (%d)\n", err);
15711581 goto done;
@@ -1576,7 +1586,7 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, · 4 unmodified lines
15761586 /* Just select a new current key */
15771587 index = (u32) key_idx;
15781588 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,
15801590 sizeof(index));
15811591 if (unlikely(err))
15821592 WL_ERR("error (%d)\n", err);
@@ -1587,10 +1597,10 @@ done: · 4 unmodified lines
15871597 }
15881598
15891599 static s32
1590−wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,
1600+brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
15911601 u8 key_idx, const u8 *mac_addr, struct key_params *params)
15921602 {
1593− struct wl_wsec_key key;
1603+ struct brcmf_wsec_key key;
15941604 s32 err = 0;
15951605
15961606 memset(&key, 0, sizeof(key));
@@ -1604,7 +1614,7 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, · 7 unmodified lines
16041614 if (key.len == 0) {
16051615 /* key delete */
16061616 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));
16081618 if (unlikely(err)) {
16091619 WL_ERR("key delete error (%d)\n", err);
16101620 return err;
@@ -1663,8 +1673,8 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, · 52 unmodified lines
16631673 }
16641674 swap_key_from_BE(&key);
16651675
1666− dhd_wait_pend8021x(dev);
1667− err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));
1676+ brcmf_netdev_wait_pend8021x(dev);
1677+ err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key));
16681678 if (unlikely(err)) {
16691679 WL_ERR("WLC_SET_KEY error (%d)\n", err);
16701680 return err;
@@ -1674,11 +1684,11 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines
16741684 }
16751685
16761686 static s32
1677−wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
1687+brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
16781688 u8 key_idx, bool pairwise, const u8 *mac_addr,
16791689 struct key_params *params)
16801690 {
1681− struct wl_wsec_key key;
1691+ struct brcmf_wsec_key key;
16821692 s32 val;
16831693 s32 wsec;
16841694 s32 err = 0;
@@ -1690,7 +1700,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 5 unmodified lines
16901700
16911701 if (mac_addr) {
16921702 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);
16941704 }
16951705 memset(&key, 0, sizeof(key));
16961706
@@ -1704,7 +1714,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 7 unmodified lines
17041714 }
17051715 memcpy(key.data, params->key, key.len);
17061716
1707− key.flags = WL_PRIMARY_KEY;
1717+ key.flags = BRCMF_PRIMARY_KEY;
17081718 switch (params->cipher) {
17091719 case WLAN_CIPHER_SUITE_WEP40:
17101720 key.algo = CRYPTO_ALGO_WEP1;
@@ -1737,21 +1747,21 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 26 unmodified lines
17371747
17381748 /* Set the new key/index */
17391749 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));
17411751 if (unlikely(err)) {
17421752 WL_ERR("WLC_SET_KEY error (%d)\n", err);
17431753 goto done;
17441754 }
17451755
17461756 val = WEP_ENABLED;
1747− err = wl_dev_intvar_get(dev, "wsec", &wsec);
1757+ err = brcmf_dev_intvar_get(dev, "wsec", &wsec);
17481758 if (unlikely(err)) {
17491759 WL_ERR("get wsec error (%d)\n", err);
17501760 goto done;
17511761 }
17521762 wsec &= ~(WEP_ENABLED);
17531763 wsec |= val;
1754− err = wl_dev_intvar_set(dev, "wsec", wsec);
1764+ err = brcmf_dev_intvar_set(dev, "wsec", wsec);
17551765 if (unlikely(err)) {
17561766 WL_ERR("set wsec error (%d)\n", err);
17571767 goto done;
@@ -1759,7 +1769,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 1 unmodified line
17591769
17601770 val = 1; /* assume shared key. otherwise 0 */
17611771 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));
17631773 if (unlikely(err))
17641774 WL_ERR("WLC_SET_AUTH error (%d)\n", err);
17651775 done:
@@ -1768,10 +1778,10 @@ done: · 2 unmodified lines
17681778 }
17691779
17701780 static s32
1771−wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
1781+brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
17721782 u8 key_idx, bool pairwise, const u8 *mac_addr)
17731783 {
1774− struct wl_wsec_key key;
1784+ struct brcmf_wsec_key key;
17751785 s32 err = 0;
17761786 s32 val;
17771787 s32 wsec;
@@ -1781,13 +1791,13 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines
17811791 memset(&key, 0, sizeof(key));
17821792
17831793 key.index = (u32) key_idx;
1784− key.flags = WL_PRIMARY_KEY;
1794+ key.flags = BRCMF_PRIMARY_KEY;
17851795 key.algo = CRYPTO_ALGO_OFF;
17861796
17871797 WL_CONN("key index (%d)\n", key_idx);
17881798 /* Set the new key/index */
17891799 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));
17911801 if (unlikely(err)) {
17921802 if (err == -EINVAL) {
17931803 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
18021812 }
18031813
18041814 val = 0;
1805− err = wl_dev_intvar_get(dev, "wsec", &wsec);
1815+ err = brcmf_dev_intvar_get(dev, "wsec", &wsec);
18061816 if (unlikely(err)) {
18071817 WL_ERR("get wsec error (%d)\n", err);
18081818 /* 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
18111821 }
18121822 wsec &= ~(WEP_ENABLED);
18131823 wsec |= val;
1814− err = wl_dev_intvar_set(dev, "wsec", wsec);
1824+ err = brcmf_dev_intvar_set(dev, "wsec", wsec);
18151825 if (unlikely(err)) {
18161826 WL_ERR("set wsec error (%d)\n", err);
18171827 /* 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
18211831
18221832 val = 0; /* assume open key. otherwise 1 */
18231833 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));
18251835 if (unlikely(err)) {
18261836 WL_ERR("WLC_SET_AUTH error (%d)\n", err);
18271837 /* Ignore this error, may happen during DISASSOC */
@@ -1833,14 +1843,14 @@ done: · 5 unmodified lines
18331843 }
18341844
18351845 static s32
1836−wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
1846+brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
18371847 u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
18381848 void (*callback) (void *cookie, struct key_params * params))
18391849 {
18401850 struct key_params params;
1841− struct wl_wsec_key key;
1842− struct wl_priv *wl = wiphy_to_wl(wiphy);
1843− struct wl_security *sec;
1851+ struct brcmf_wsec_key key;
1852+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1853+ struct brcmf_cfg80211_security *sec;
18441854 s32 wsec;
18451855 s32 err = 0;
18461856
@@ -1855,7 +1865,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, · 8 unmodified lines
18551865 params.key_len = (u8) min_t(u8, WLAN_MAX_KEY_LEN, key.len);
18561866 memcpy(params.key, key.data, params.key_len);
18571867
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));
18591869 if (unlikely(err)) {
18601870 WL_ERR("WLC_GET_WSEC error (%d)\n", err);
18611871 /* 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
18651875 wsec = le32_to_cpu(wsec);
18661876 switch (wsec) {
18671877 case WEP_ENABLED:
1868− sec = wl_read_prof(wl, WL_PROF_SEC);
1878+ sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC);
18691879 if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) {
18701880 params.cipher = WLAN_CIPHER_SUITE_WEP40;
18711881 WL_CONN("WLAN_CIPHER_SUITE_WEP40\n");
@@ -1895,7 +1905,7 @@ done: · 23 unmodified lines
18951905 }
18961906
18971907 static s32
1898−wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
1908+brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
18991909 struct net_device *dev, u8 key_idx)
19001910 {
19011911 WL_INFO("Not supported\n");
@@ -1905,15 +1915,15 @@ wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, · 3 unmodified lines
19051915 }
19061916
19071917 static s32
1908−wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
1918+brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
19091919 u8 *mac, struct station_info *sinfo)
19101920 {
1911− struct wl_priv *wl = wiphy_to_wl(wiphy);
1912− scb_val_t scb_val;
1921+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
1922+ struct brcmf_scb_val scb_val;
19131923 int rssi;
19141924 s32 rate;
19151925 s32 err = 0;
1916− u8 *bssid = wl_read_prof(wl, WL_PROF_BSSID);
1926+ u8 *bssid = brcmf_read_prof(cfg_priv, WL_PROF_BSSID);
19171927
19181928 WL_TRACE("Enter\n");
19191929 CHECK_SYS_UP();
@@ -1930,7 +1940,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, · 10 unmodified lines
19301940 }
19311941
19321942 /* 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));
19341944 if (err) {
19351945 WL_ERR("Could not get rate (%d)\n", err);
19361946 } else {
@@ -1940,10 +1950,10 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines
19401950 WL_CONN("Rate %d Mbps\n", rate / 2);
19411951 }
19421952
1943− if (test_bit(WL_STATUS_CONNECTED, &wl->status)) {
1953+ if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) {
19441954 scb_val.val = 0;
1945− err = wl_dev_ioctl(dev, WLC_GET_RSSI, &scb_val,
1946− sizeof(scb_val_t));
1955+ err = brcmf_dev_ioctl(dev, BRCMF_C_GET_RSSI, &scb_val,
1956+ sizeof(struct brcmf_scb_val));
19471957 if (unlikely(err)) {
19481958 WL_ERR("Could not get rssi (%d)\n", err);
19491959 }
@@ -1959,7 +1969,7 @@ done: · 9 unmodified lines
19591969 }
19601970
19611971 static s32
1962−wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
1972+brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
19631973 bool enabled, s32 timeout)
19641974 {
19651975 s32 pm;
@@ -1972,7 +1982,7 @@ wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, · 6 unmodified lines
19721982 pm = cpu_to_le32(pm);
19731983 WL_INFO("power save %s\n", (pm ? "enabled" : "disabled"));
19741984
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));
19761986 if (unlikely(err)) {
19771987 if (err == -ENODEV)
19781988 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
19831993 return err;
19841994 }
19851995
1986−static __used u32 wl_find_msb(u16 bit16)
1996+static __used u32 brcmf_find_msb(u16 bit16)
19871997 {
19881998 u32 ret = 0;
19891999
@@ -2011,7 +2021,7 @@ static __used u32 wl_find_msb(u16 bit16) · 21 unmodified lines
20112021 }
20122022
20132023 static s32
2014−wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
2024+brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
20152025 const u8 *addr,
20162026 const struct cfg80211_bitrate_mask *mask)
20172027 {
@@ -2028,7 +2038,7 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, · 10 unmodified lines
20282038
20292039 /* addr param is always NULL. ignore it */
20302040 /* 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,
20322042 sizeof(rateset));
20332043 if (unlikely(err)) {
20342044 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
20372047
20382048 rateset.count = le32_to_cpu(rateset.count);
20392049
2040− legacy = wl_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy);
2050+ legacy = brcmf_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy);
20412051 if (!legacy)
2042− legacy = wl_find_msb(mask->control[IEEE80211_BAND_5GHZ].legacy);
2052+ legacy = brcmf_find_msb(mask->control[IEEE80211_BAND_5GHZ].legacy);
20432053
20442054 val = wl_g_rates[legacy - 1].bitrate * 100000;
20452055
@@ -2057,8 +2067,8 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, · 11 unmodified lines
20572067 * Set rate override,
20582068 * Since the is a/b/g-blind, both a/bg_rate are enforced.
20592069 */
2060− err_bg = wl_dev_intvar_set(dev, "bg_rate", rate);
2061− err_a = wl_dev_intvar_set(dev, "a_rate", rate);
2070+ err_bg = brcmf_dev_intvar_set(dev, "bg_rate", rate);
2071+ err_a = brcmf_dev_intvar_set(dev, "a_rate", rate);
20622072 if (unlikely(err_bg && err_a)) {
20632073 WL_ERR("could not set fixed rate (%d) (%d)\n", err_bg, err_a);
20642074 err = err_bg | err_a;
@@ -2069,10 +2079,9 @@ done: · 4 unmodified lines
20692079 return err;
20702080 }
20712081
2072−static s32 wl_cfg80211_resume(struct wiphy *wiphy)
2082+static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
20732083 {
2074− struct wl_priv *wl = wiphy_to_wl(wiphy);
2075− struct net_device *ndev = wl_to_ndev(wl);
2084+ struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
20762085
20772086 /*
20782087 * 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
20822091 WL_TRACE("Enter\n");
20832092
20842093 #if defined(CONFIG_PM_SLEEP)
2085− atomic_set(&dhd_mmc_suspend, false);
2094+ atomic_set(&brcmf_mmc_suspend, false);
20862095 #endif /* defined(CONFIG_PM_SLEEP) */
20872096
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