bcmf_sdio_regs.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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 __DRIVERS_WIRELESS_IEEE80211_BCMF_SDIO_REGS_H
  18. #define __DRIVERS_WIRELESS_IEEE80211_BCMF_SDIO_REGS_H
  19. #define SDIO_FUNC_0 0
  20. #define SDIO_FUNC_1 1
  21. #define SDIO_FUNC_2 2
  22. #define SDIOD_FBR_SIZE 0x100
  23. /* io_en */
  24. #define SDIO_FUNC_ENABLE_1 0x02
  25. #define SDIO_FUNC_ENABLE_2 0x04
  26. /* io_rdys */
  27. #define SDIO_FUNC_READY_1 0x02
  28. #define SDIO_FUNC_READY_2 0x04
  29. /* intr_status */
  30. #define INTR_STATUS_FUNC1 0x2
  31. #define INTR_STATUS_FUNC2 0x4
  32. /* Maximum number of I/O funcs */
  33. #define SDIOD_MAX_IOFUNCS 7
  34. /* mask of register map */
  35. #define REG_F0_REG_MASK 0x7FF
  36. #define REG_F1_MISC_MASK 0x1FFFF
  37. /* as of sdiod rev 0, supports 3 functions */
  38. #define SBSDIO_NUM_FUNCTION 3
  39. /* function 0 vendor specific CCCR registers */
  40. #define SDIO_CCCR_BRCM_CARDCAP 0xf0
  41. #define SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT 0x02
  42. #define SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT 0x04
  43. #define SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC 0x08
  44. #define SDIO_CCCR_BRCM_CARDCTRL 0xf1
  45. #define SDIO_CCCR_BRCM_CARDCTRL_WLANRESET 0x02
  46. #define SDIO_CCCR_BRCM_SEPINT 0xf2
  47. #define SDIO_SEPINT_MASK 0x01
  48. #define SDIO_SEPINT_OE 0x02
  49. #define SDIO_SEPINT_ACT_HI 0x04
  50. /* function 1 miscellaneous registers */
  51. /* sprom command and status */
  52. #define SBSDIO_SPROM_CS 0x10000
  53. /* sprom info register */
  54. #define SBSDIO_SPROM_INFO 0x10001
  55. /* sprom indirect access data byte 0 */
  56. #define SBSDIO_SPROM_DATA_LOW 0x10002
  57. /* sprom indirect access data byte 1 */
  58. #define SBSDIO_SPROM_DATA_HIGH 0x10003
  59. /* sprom indirect access addr byte 0 */
  60. #define SBSDIO_SPROM_ADDR_LOW 0x10004
  61. /* sprom indirect access addr byte 0 */
  62. #define SBSDIO_SPROM_ADDR_HIGH 0x10005
  63. /* xtal_pu (gpio) output */
  64. #define SBSDIO_CHIP_CTRL_DATA 0x10006
  65. /* xtal_pu (gpio) enable */
  66. #define SBSDIO_CHIP_CTRL_EN 0x10007
  67. /* rev < 7, watermark for sdio device */
  68. #define SBSDIO_WATERMARK 0x10008
  69. /* control busy signal generation */
  70. #define SBSDIO_DEVICE_CTL 0x10009
  71. /* SB Address Window Low (b15) */
  72. #define SBSDIO_FUNC1_SBADDRLOW 0x1000A
  73. /* SB Address Window Mid (b23:b16) */
  74. #define SBSDIO_FUNC1_SBADDRMID 0x1000B
  75. /* SB Address Window High (b31:b24) */
  76. #define SBSDIO_FUNC1_SBADDRHIGH 0x1000C
  77. /* Frame Control (frame term/abort) */
  78. #define SBSDIO_FUNC1_FRAMECTRL 0x1000D
  79. /* Read Frame Terminate */
  80. #define SFC_RF_TERM (1 << 0)
  81. /* Write Frame Terminate */
  82. #define SFC_WF_TERM (1 << 1)
  83. /* CRC error for write out of sync */
  84. #define SFC_CRC4WOOS (1 << 2)
  85. /* Abort all in-progress frames */
  86. #define SFC_ABORTALL (1 << 3)
  87. /* ChipClockCSR (ALP/HT ctl/status) */
  88. #define SBSDIO_FUNC1_CHIPCLKCSR 0x1000E
  89. /* Force ALP request to backplane */
  90. #define SBSDIO_FORCE_ALP 0x01
  91. /* Force HT request to backplane */
  92. #define SBSDIO_FORCE_HT 0x02
  93. /* Force ILP request to backplane */
  94. #define SBSDIO_FORCE_ILP 0x04
  95. /* Make ALP ready (power up xtal) */
  96. #define SBSDIO_ALP_AVAIL_REQ 0x08
  97. /* Make HT ready (power up PLL) */
  98. #define SBSDIO_HT_AVAIL_REQ 0x10
  99. /* Squelch clock requests from HW */
  100. #define SBSDIO_FORCE_HW_CLKREQ_OFF 0x20
  101. /* Status: ALP is ready */
  102. #define SBSDIO_ALP_AVAIL 0x40
  103. /* Status: HT is ready */
  104. #define SBSDIO_HT_AVAIL 0x80
  105. /* SdioPullUp (on cmd, d0-d2) */
  106. #define SBSDIO_FUNC1_SDIOPULLUP 0x1000F
  107. /* Write Frame Byte Count Low */
  108. #define SBSDIO_FUNC1_WFRAMEBCLO 0x10019
  109. /* Write Frame Byte Count High */
  110. #define SBSDIO_FUNC1_WFRAMEBCHI 0x1001A
  111. /* Read Frame Byte Count Low */
  112. #define SBSDIO_FUNC1_RFRAMEBCLO 0x1001B
  113. /* Read Frame Byte Count High */
  114. #define SBSDIO_FUNC1_RFRAMEBCHI 0x1001C
  115. /* MesBusyCtl (rev 11) */
  116. #define SBSDIO_FUNC1_MESBUSYCTRL 0x1001D
  117. /* Sdio Core Rev 12 */
  118. #define SBSDIO_FUNC1_WAKEUPCTRL 0x1001E
  119. #define SBSDIO_FUNC1_WCTRL_ALPWAIT_MASK 0x1
  120. #define SBSDIO_FUNC1_WCTRL_ALPWAIT_SHIFT 0
  121. #define SBSDIO_FUNC1_WCTRL_HTWAIT_MASK 0x2
  122. #define SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT 1
  123. #define SBSDIO_FUNC1_SLEEPCSR 0x1001F
  124. #define SBSDIO_FUNC1_SLEEPCSR_KSO_MASK 0x1
  125. #define SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT 0
  126. #define SBSDIO_FUNC1_SLEEPCSR_KSO_EN 1
  127. #define SBSDIO_FUNC1_SLEEPCSR_DEVON_MASK 0x2
  128. #define SBSDIO_FUNC1_SLEEPCSR_DEVON_SHIFT 1
  129. #define SBSDIO_AVBITS (SBSDIO_HT_AVAIL | SBSDIO_ALP_AVAIL)
  130. #define SBSDIO_ALPAV(regval) ((regval) & SBSDIO_AVBITS)
  131. #define SBSDIO_HTAV(regval) (((regval) & SBSDIO_AVBITS) == SBSDIO_AVBITS)
  132. #define SBSDIO_ALPONLY(regval) (SBSDIO_ALPAV(regval) && !SBSDIO_HTAV(regval))
  133. #define SBSDIO_CLKAV(regval, alponly) \
  134. (SBSDIO_ALPAV(regval) && (alponly ? 1 : SBSDIO_HTAV(regval)))
  135. #define SBSDIO_FUNC1_MISC_REG_START 0x10000 /* f1 misc register start */
  136. #define SBSDIO_FUNC1_MISC_REG_LIMIT 0x1001F /* f1 misc register end */
  137. /* function 1 OCP space */
  138. /* sb offset addr is <= 15 bits, 32k */
  139. #define SBSDIO_SB_OFT_ADDR_MASK 0x07FFF
  140. #define SBSDIO_SB_OFT_ADDR_LIMIT 0x08000
  141. /* with b15, maps to 32-bit SB access */
  142. #define SBSDIO_SB_ACCESS_2_4B_FLAG 0x08000
  143. /* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */
  144. #define SBSDIO_SBADDRLOW_MASK 0x80 /* Valid bits in SBADDRLOW */
  145. #define SBSDIO_SBADDRMID_MASK 0xff /* Valid bits in SBADDRMID */
  146. #define SBSDIO_SBADDRHIGH_MASK 0xffU /* Valid bits in SBADDRHIGH */
  147. /* Address bits from SBADDR regs */
  148. #define SBSDIO_SBWINDOW_MASK 0xffff8000
  149. #endif /* __DRIVERS_WIRELESS_IEEE80211_BCMF_SDIO_REGS_H */