PageRenderTime 51ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/net/wireless/bcm4329/include/sbsdpcmdev.h

https://bitbucket.org/slukk/jb-tsm-kernel-4.2
C Header | 288 lines | 190 code | 39 blank | 59 comment | 0 complexity | c11c7d919e8fd48358d66c09ed0f4173 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. /*
  2. * Broadcom SiliconBackplane SDIO/PCMCIA hardware-specific device core support
  3. *
  4. * Copyright (C) 1999-2010, Broadcom Corporation
  5. *
  6. * Unless you and Broadcom execute a separate written software license
  7. * agreement governing use of this software, this software is licensed to you
  8. * under the terms of the GNU General Public License version 2 (the "GPL"),
  9. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  10. * following added to such license:
  11. *
  12. * As a special exception, the copyright holders of this software give you
  13. * permission to link this software with independent modules, and to copy and
  14. * distribute the resulting executable under terms of your choice, provided that
  15. * you also meet, for each linked independent module, the terms and conditions of
  16. * the license of that module. An independent module is a module which is not
  17. * derived from this software. The special exception does not apply to any
  18. * modifications of the software.
  19. *
  20. * Notwithstanding the above, under no circumstances may you combine this
  21. * software in any way with any other Broadcom software provided under a license
  22. * other than the GPL, without Broadcom's express prior written consent.
  23. *
  24. * $Id: sbsdpcmdev.h,v 13.29.4.1.4.6.6.2 2008/12/31 21:16:51 Exp $
  25. */
  26. #ifndef _sbsdpcmdev_h_
  27. #define _sbsdpcmdev_h_
  28. /* cpp contortions to concatenate w/arg prescan */
  29. #ifndef PAD
  30. #define _PADLINE(line) pad ## line
  31. #define _XSTR(line) _PADLINE(line)
  32. #define PAD _XSTR(__LINE__)
  33. #endif /* PAD */
  34. typedef volatile struct {
  35. dma64regs_t xmt; /* dma tx */
  36. uint32 PAD[2];
  37. dma64regs_t rcv; /* dma rx */
  38. uint32 PAD[2];
  39. } dma64p_t;
  40. /* dma64 sdiod corerev >= 1 */
  41. typedef volatile struct {
  42. dma64p_t dma64regs[2];
  43. dma64diag_t dmafifo; /* DMA Diagnostic Regs, 0x280-0x28c */
  44. uint32 PAD[92];
  45. } sdiodma64_t;
  46. /* dma32 sdiod corerev == 0 */
  47. typedef volatile struct {
  48. dma32regp_t dma32regs[2]; /* dma tx & rx, 0x200-0x23c */
  49. dma32diag_t dmafifo; /* DMA Diagnostic Regs, 0x240-0x24c */
  50. uint32 PAD[108];
  51. } sdiodma32_t;
  52. /* dma32 regs for pcmcia core */
  53. typedef volatile struct {
  54. dma32regp_t dmaregs; /* DMA Regs, 0x200-0x21c, rev8 */
  55. dma32diag_t dmafifo; /* DMA Diagnostic Regs, 0x220-0x22c */
  56. uint32 PAD[116];
  57. } pcmdma32_t;
  58. /* core registers */
  59. typedef volatile struct {
  60. uint32 corecontrol; /* CoreControl, 0x000, rev8 */
  61. uint32 corestatus; /* CoreStatus, 0x004, rev8 */
  62. uint32 PAD[1];
  63. uint32 biststatus; /* BistStatus, 0x00c, rev8 */
  64. /* PCMCIA access */
  65. uint16 pcmciamesportaladdr; /* PcmciaMesPortalAddr, 0x010, rev8 */
  66. uint16 PAD[1];
  67. uint16 pcmciamesportalmask; /* PcmciaMesPortalMask, 0x014, rev8 */
  68. uint16 PAD[1];
  69. uint16 pcmciawrframebc; /* PcmciaWrFrameBC, 0x018, rev8 */
  70. uint16 PAD[1];
  71. uint16 pcmciaunderflowtimer; /* PcmciaUnderflowTimer, 0x01c, rev8 */
  72. uint16 PAD[1];
  73. /* interrupt */
  74. uint32 intstatus; /* IntStatus, 0x020, rev8 */
  75. uint32 hostintmask; /* IntHostMask, 0x024, rev8 */
  76. uint32 intmask; /* IntSbMask, 0x028, rev8 */
  77. uint32 sbintstatus; /* SBIntStatus, 0x02c, rev8 */
  78. uint32 sbintmask; /* SBIntMask, 0x030, rev8 */
  79. uint32 PAD[3];
  80. uint32 tosbmailbox; /* ToSBMailbox, 0x040, rev8 */
  81. uint32 tohostmailbox; /* ToHostMailbox, 0x044, rev8 */
  82. uint32 tosbmailboxdata; /* ToSbMailboxData, 0x048, rev8 */
  83. uint32 tohostmailboxdata; /* ToHostMailboxData, 0x04c, rev8 */
  84. /* synchronized access to registers in SDIO clock domain */
  85. uint32 sdioaccess; /* SdioAccess, 0x050, rev8 */
  86. uint32 PAD[3];
  87. /* PCMCIA frame control */
  88. uint8 pcmciaframectrl; /* pcmciaFrameCtrl, 0x060, rev8 */
  89. uint8 PAD[3];
  90. uint8 pcmciawatermark; /* pcmciaWaterMark, 0x064, rev8 */
  91. uint8 PAD[155];
  92. /* interrupt batching control */
  93. uint32 intrcvlazy; /* IntRcvLazy, 0x100, rev8 */
  94. uint32 PAD[3];
  95. /* counters */
  96. uint32 cmd52rd; /* Cmd52RdCount, 0x110, rev8, SDIO: cmd52 reads */
  97. uint32 cmd52wr; /* Cmd52WrCount, 0x114, rev8, SDIO: cmd52 writes */
  98. uint32 cmd53rd; /* Cmd53RdCount, 0x118, rev8, SDIO: cmd53 reads */
  99. uint32 cmd53wr; /* Cmd53WrCount, 0x11c, rev8, SDIO: cmd53 writes */
  100. uint32 abort; /* AbortCount, 0x120, rev8, SDIO: aborts */
  101. uint32 datacrcerror; /* DataCrcErrorCount, 0x124, rev8, SDIO: frames w/bad CRC */
  102. uint32 rdoutofsync; /* RdOutOfSyncCount, 0x128, rev8, SDIO/PCMCIA: Rd Frm OOS */
  103. uint32 wroutofsync; /* RdOutOfSyncCount, 0x12c, rev8, SDIO/PCMCIA: Wr Frm OOS */
  104. uint32 writebusy; /* WriteBusyCount, 0x130, rev8, SDIO: dev asserted "busy" */
  105. uint32 readwait; /* ReadWaitCount, 0x134, rev8, SDIO: read: no data avail */
  106. uint32 readterm; /* ReadTermCount, 0x138, rev8, SDIO: rd frm terminates */
  107. uint32 writeterm; /* WriteTermCount, 0x13c, rev8, SDIO: wr frm terminates */
  108. uint32 PAD[40];
  109. uint32 clockctlstatus; /* ClockCtlStatus, 0x1e0, rev8 */
  110. uint32 PAD[7];
  111. /* DMA engines */
  112. volatile union {
  113. pcmdma32_t pcm32;
  114. sdiodma32_t sdiod32;
  115. sdiodma64_t sdiod64;
  116. } dma;
  117. /* SDIO/PCMCIA CIS region */
  118. char cis[512]; /* 512 byte CIS, 0x400-0x5ff, rev6 */
  119. /* PCMCIA function control registers */
  120. char pcmciafcr[256]; /* PCMCIA FCR, 0x600-6ff, rev6 */
  121. uint16 PAD[55];
  122. /* PCMCIA backplane access */
  123. uint16 backplanecsr; /* BackplaneCSR, 0x76E, rev6 */
  124. uint16 backplaneaddr0; /* BackplaneAddr0, 0x770, rev6 */
  125. uint16 backplaneaddr1; /* BackplaneAddr1, 0x772, rev6 */
  126. uint16 backplaneaddr2; /* BackplaneAddr2, 0x774, rev6 */
  127. uint16 backplaneaddr3; /* BackplaneAddr3, 0x776, rev6 */
  128. uint16 backplanedata0; /* BackplaneData0, 0x778, rev6 */
  129. uint16 backplanedata1; /* BackplaneData1, 0x77a, rev6 */
  130. uint16 backplanedata2; /* BackplaneData2, 0x77c, rev6 */
  131. uint16 backplanedata3; /* BackplaneData3, 0x77e, rev6 */
  132. uint16 PAD[31];
  133. /* sprom "size" & "blank" info */
  134. uint16 spromstatus; /* SPROMStatus, 0x7BE, rev2 */
  135. uint32 PAD[464];
  136. /* Sonics SiliconBackplane registers */
  137. sbconfig_t sbconfig; /* SbConfig Regs, 0xf00-0xfff, rev8 */
  138. } sdpcmd_regs_t;
  139. /* corecontrol */
  140. #define CC_CISRDY (1 << 0) /* CIS Ready */
  141. #define CC_BPRESEN (1 << 1) /* CCCR RES signal causes backplane reset */
  142. #define CC_F2RDY (1 << 2) /* set CCCR IOR2 bit */
  143. #define CC_CLRPADSISO (1 << 3) /* clear SDIO pads isolation bit (rev 11) */
  144. /* corestatus */
  145. #define CS_PCMCIAMODE (1 << 0) /* Device Mode; 0=SDIO, 1=PCMCIA */
  146. #define CS_SMARTDEV (1 << 1) /* 1=smartDev enabled */
  147. #define CS_F2ENABLED (1 << 2) /* 1=host has enabled the device */
  148. #define PCMCIA_MES_PA_MASK 0x7fff /* PCMCIA Message Portal Address Mask */
  149. #define PCMCIA_MES_PM_MASK 0x7fff /* PCMCIA Message Portal Mask Mask */
  150. #define PCMCIA_WFBC_MASK 0xffff /* PCMCIA Write Frame Byte Count Mask */
  151. #define PCMCIA_UT_MASK 0x07ff /* PCMCIA Underflow Timer Mask */
  152. /* intstatus */
  153. #define I_SMB_SW0 (1 << 0) /* To SB Mail S/W interrupt 0 */
  154. #define I_SMB_SW1 (1 << 1) /* To SB Mail S/W interrupt 1 */
  155. #define I_SMB_SW2 (1 << 2) /* To SB Mail S/W interrupt 2 */
  156. #define I_SMB_SW3 (1 << 3) /* To SB Mail S/W interrupt 3 */
  157. #define I_SMB_SW_MASK 0x0000000f /* To SB Mail S/W interrupts mask */
  158. #define I_SMB_SW_SHIFT 0 /* To SB Mail S/W interrupts shift */
  159. #define I_HMB_SW0 (1 << 4) /* To Host Mail S/W interrupt 0 */
  160. #define I_HMB_SW1 (1 << 5) /* To Host Mail S/W interrupt 1 */
  161. #define I_HMB_SW2 (1 << 6) /* To Host Mail S/W interrupt 2 */
  162. #define I_HMB_SW3 (1 << 7) /* To Host Mail S/W interrupt 3 */
  163. #define I_HMB_SW_MASK 0x000000f0 /* To Host Mail S/W interrupts mask */
  164. #define I_HMB_SW_SHIFT 4 /* To Host Mail S/W interrupts shift */
  165. #define I_WR_OOSYNC (1 << 8) /* Write Frame Out Of Sync */
  166. #define I_RD_OOSYNC (1 << 9) /* Read Frame Out Of Sync */
  167. #define I_PC (1 << 10) /* descriptor error */
  168. #define I_PD (1 << 11) /* data error */
  169. #define I_DE (1 << 12) /* Descriptor protocol Error */
  170. #define I_RU (1 << 13) /* Receive descriptor Underflow */
  171. #define I_RO (1 << 14) /* Receive fifo Overflow */
  172. #define I_XU (1 << 15) /* Transmit fifo Underflow */
  173. #define I_RI (1 << 16) /* Receive Interrupt */
  174. #define I_BUSPWR (1 << 17) /* SDIO Bus Power Change (rev 9) */
  175. #define I_XI (1 << 24) /* Transmit Interrupt */
  176. #define I_RF_TERM (1 << 25) /* Read Frame Terminate */
  177. #define I_WF_TERM (1 << 26) /* Write Frame Terminate */
  178. #define I_PCMCIA_XU (1 << 27) /* PCMCIA Transmit FIFO Underflow */
  179. #define I_SBINT (1 << 28) /* sbintstatus Interrupt */
  180. #define I_CHIPACTIVE (1 << 29) /* chip transitioned from doze to active state */
  181. #define I_SRESET (1 << 30) /* CCCR RES interrupt */
  182. #define I_IOE2 (1U << 31) /* CCCR IOE2 Bit Changed */
  183. #define I_ERRORS (I_PC | I_PD | I_DE | I_RU | I_RO | I_XU) /* DMA Errors */
  184. #define I_DMA (I_RI | I_XI | I_ERRORS)
  185. /* sbintstatus */
  186. #define I_SB_SERR (1 << 8) /* Backplane SError (write) */
  187. #define I_SB_RESPERR (1 << 9) /* Backplane Response Error (read) */
  188. #define I_SB_SPROMERR (1 << 10) /* Error accessing the sprom */
  189. /* sdioaccess */
  190. #define SDA_DATA_MASK 0x000000ff /* Read/Write Data Mask */
  191. #define SDA_ADDR_MASK 0x000fff00 /* Read/Write Address Mask */
  192. #define SDA_ADDR_SHIFT 8 /* Read/Write Address Shift */
  193. #define SDA_WRITE 0x01000000 /* Write bit */
  194. #define SDA_READ 0x00000000 /* Write bit cleared for Read */
  195. #define SDA_BUSY 0x80000000 /* Busy bit */
  196. /* sdioaccess-accessible register address spaces */
  197. #define SDA_CCCR_SPACE 0x000 /* sdioAccess CCCR register space */
  198. #define SDA_F1_FBR_SPACE 0x100 /* sdioAccess F1 FBR register space */
  199. #define SDA_F2_FBR_SPACE 0x200 /* sdioAccess F2 FBR register space */
  200. #define SDA_F1_REG_SPACE 0x300 /* sdioAccess F1 core-specific register space */
  201. /* SDA_F1_REG_SPACE sdioaccess-accessible F1 reg space register offsets */
  202. #define SDA_CHIPCONTROLDATA 0x006 /* ChipControlData */
  203. #define SDA_CHIPCONTROLENAB 0x007 /* ChipControlEnable */
  204. #define SDA_F2WATERMARK 0x008 /* Function 2 Watermark */
  205. #define SDA_DEVICECONTROL 0x009 /* DeviceControl */
  206. #define SDA_SBADDRLOW 0x00a /* SbAddrLow */
  207. #define SDA_SBADDRMID 0x00b /* SbAddrMid */
  208. #define SDA_SBADDRHIGH 0x00c /* SbAddrHigh */
  209. #define SDA_FRAMECTRL 0x00d /* FrameCtrl */
  210. #define SDA_CHIPCLOCKCSR 0x00e /* ChipClockCSR */
  211. #define SDA_SDIOPULLUP 0x00f /* SdioPullUp */
  212. #define SDA_SDIOWRFRAMEBCLOW 0x019 /* SdioWrFrameBCLow */
  213. #define SDA_SDIOWRFRAMEBCHIGH 0x01a /* SdioWrFrameBCHigh */
  214. #define SDA_SDIORDFRAMEBCLOW 0x01b /* SdioRdFrameBCLow */
  215. #define SDA_SDIORDFRAMEBCHIGH 0x01c /* SdioRdFrameBCHigh */
  216. /* SDA_F2WATERMARK */
  217. #define SDA_F2WATERMARK_MASK 0x7f /* F2Watermark Mask */
  218. /* SDA_SBADDRLOW */
  219. #define SDA_SBADDRLOW_MASK 0x80 /* SbAddrLow Mask */
  220. /* SDA_SBADDRMID */
  221. #define SDA_SBADDRMID_MASK 0xff /* SbAddrMid Mask */
  222. /* SDA_SBADDRHIGH */
  223. #define SDA_SBADDRHIGH_MASK 0xff /* SbAddrHigh Mask */
  224. /* SDA_FRAMECTRL */
  225. #define SFC_RF_TERM (1 << 0) /* Read Frame Terminate */
  226. #define SFC_WF_TERM (1 << 1) /* Write Frame Terminate */
  227. #define SFC_CRC4WOOS (1 << 2) /* HW reports CRC error for write out of sync */
  228. #define SFC_ABORTALL (1 << 3) /* Abort cancels all in-progress frames */
  229. /* pcmciaframectrl */
  230. #define PFC_RF_TERM (1 << 0) /* Read Frame Terminate */
  231. #define PFC_WF_TERM (1 << 1) /* Write Frame Terminate */
  232. /* intrcvlazy */
  233. #define IRL_TO_MASK 0x00ffffff /* timeout */
  234. #define IRL_FC_MASK 0xff000000 /* frame count */
  235. #define IRL_FC_SHIFT 24 /* frame count */
  236. /* rx header */
  237. typedef volatile struct {
  238. uint16 len;
  239. uint16 flags;
  240. } sdpcmd_rxh_t;
  241. /* rx header flags */
  242. #define RXF_CRC 0x0001 /* CRC error detected */
  243. #define RXF_WOOS 0x0002 /* write frame out of sync */
  244. #define RXF_WF_TERM 0x0004 /* write frame terminated */
  245. #define RXF_ABORT 0x0008 /* write frame aborted */
  246. #define RXF_DISCARD (RXF_CRC | RXF_WOOS | RXF_WF_TERM | RXF_ABORT) /* bad frame */
  247. /* HW frame tag */
  248. #define SDPCM_FRAMETAG_LEN 4 /* HW frametag: 2 bytes len, 2 bytes check val */
  249. #endif /* _sbsdpcmdev_h_ */