adm8211.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef ADM8211_H
  3. #define ADM8211_H
  4. /* ADM8211 Registers */
  5. /* CR32 (SIG) signature */
  6. #define ADM8211_SIG1 0x82011317 /* ADM8211A */
  7. #define ADM8211_SIG2 0x82111317 /* ADM8211B/ADM8211C */
  8. #define ADM8211_CSR_READ(r) ioread32(&priv->map->r)
  9. #define ADM8211_CSR_WRITE(r, val) iowrite32((val), &priv->map->r)
  10. /* CSR (Host Control and Status Registers) */
  11. struct adm8211_csr {
  12. __le32 PAR; /* 0x00 CSR0 */
  13. __le32 FRCTL; /* 0x04 CSR0A */
  14. __le32 TDR; /* 0x08 CSR1 */
  15. __le32 WTDP; /* 0x0C CSR1A */
  16. __le32 RDR; /* 0x10 CSR2 */
  17. __le32 WRDP; /* 0x14 CSR2A */
  18. __le32 RDB; /* 0x18 CSR3 */
  19. __le32 TDBH; /* 0x1C CSR3A */
  20. __le32 TDBD; /* 0x20 CSR4 */
  21. __le32 TDBP; /* 0x24 CSR4A */
  22. __le32 STSR; /* 0x28 CSR5 */
  23. __le32 TDBB; /* 0x2C CSR5A */
  24. __le32 NAR; /* 0x30 CSR6 */
  25. __le32 CSR6A; /* reserved */
  26. __le32 IER; /* 0x38 CSR7 */
  27. __le32 TKIPSCEP; /* 0x3C CSR7A */
  28. __le32 LPC; /* 0x40 CSR8 */
  29. __le32 CSR_TEST1; /* 0x44 CSR8A */
  30. __le32 SPR; /* 0x48 CSR9 */
  31. __le32 CSR_TEST0; /* 0x4C CSR9A */
  32. __le32 WCSR; /* 0x50 CSR10 */
  33. __le32 WPDR; /* 0x54 CSR10A */
  34. __le32 GPTMR; /* 0x58 CSR11 */
  35. __le32 GPIO; /* 0x5C CSR11A */
  36. __le32 BBPCTL; /* 0x60 CSR12 */
  37. __le32 SYNCTL; /* 0x64 CSR12A */
  38. __le32 PLCPHD; /* 0x68 CSR13 */
  39. __le32 MMIWA; /* 0x6C CSR13A */
  40. __le32 MMIRD0; /* 0x70 CSR14 */
  41. __le32 MMIRD1; /* 0x74 CSR14A */
  42. __le32 TXBR; /* 0x78 CSR15 */
  43. __le32 SYNDATA; /* 0x7C CSR15A */
  44. __le32 ALCS; /* 0x80 CSR16 */
  45. __le32 TOFS2; /* 0x84 CSR17 */
  46. __le32 CMDR; /* 0x88 CSR18 */
  47. __le32 PCIC; /* 0x8C CSR19 */
  48. __le32 PMCSR; /* 0x90 CSR20 */
  49. __le32 PAR0; /* 0x94 CSR21 */
  50. __le32 PAR1; /* 0x98 CSR22 */
  51. __le32 MAR0; /* 0x9C CSR23 */
  52. __le32 MAR1; /* 0xA0 CSR24 */
  53. __le32 ATIMDA0; /* 0xA4 CSR25 */
  54. __le32 ABDA1; /* 0xA8 CSR26 */
  55. __le32 BSSID0; /* 0xAC CSR27 */
  56. __le32 TXLMT; /* 0xB0 CSR28 */
  57. __le32 MIBCNT; /* 0xB4 CSR29 */
  58. __le32 BCNT; /* 0xB8 CSR30 */
  59. __le32 TSFTH; /* 0xBC CSR31 */
  60. __le32 TSC; /* 0xC0 CSR32 */
  61. __le32 SYNRF; /* 0xC4 CSR33 */
  62. __le32 BPLI; /* 0xC8 CSR34 */
  63. __le32 CAP0; /* 0xCC CSR35 */
  64. __le32 CAP1; /* 0xD0 CSR36 */
  65. __le32 RMD; /* 0xD4 CSR37 */
  66. __le32 CFPP; /* 0xD8 CSR38 */
  67. __le32 TOFS0; /* 0xDC CSR39 */
  68. __le32 TOFS1; /* 0xE0 CSR40 */
  69. __le32 IFST; /* 0xE4 CSR41 */
  70. __le32 RSPT; /* 0xE8 CSR42 */
  71. __le32 TSFTL; /* 0xEC CSR43 */
  72. __le32 WEPCTL; /* 0xF0 CSR44 */
  73. __le32 WESK; /* 0xF4 CSR45 */
  74. __le32 WEPCNT; /* 0xF8 CSR46 */
  75. __le32 MACTEST; /* 0xFC CSR47 */
  76. __le32 FER; /* 0x100 */
  77. __le32 FEMR; /* 0x104 */
  78. __le32 FPSR; /* 0x108 */
  79. __le32 FFER; /* 0x10C */
  80. } __packed;
  81. /* CSR0 - PAR (PCI Address Register) */
  82. #define ADM8211_PAR_MWIE (1 << 24)
  83. #define ADM8211_PAR_MRLE (1 << 23)
  84. #define ADM8211_PAR_MRME (1 << 21)
  85. #define ADM8211_PAR_RAP ((1 << 18) | (1 << 17))
  86. #define ADM8211_PAR_CAL ((1 << 15) | (1 << 14))
  87. #define ADM8211_PAR_PBL 0x00003f00
  88. #define ADM8211_PAR_BLE (1 << 7)
  89. #define ADM8211_PAR_DSL 0x0000007c
  90. #define ADM8211_PAR_BAR (1 << 1)
  91. #define ADM8211_PAR_SWR (1 << 0)
  92. /* CSR1 - FRCTL (Frame Control Register) */
  93. #define ADM8211_FRCTL_PWRMGT (1 << 31)
  94. #define ADM8211_FRCTL_MAXPSP (1 << 27)
  95. #define ADM8211_FRCTL_DRVPRSP (1 << 26)
  96. #define ADM8211_FRCTL_DRVBCON (1 << 25)
  97. #define ADM8211_FRCTL_AID 0x0000ffff
  98. #define ADM8211_FRCTL_AID_ON 0x0000c000
  99. /* CSR5 - STSR (Status Register) */
  100. #define ADM8211_STSR_PCF (1 << 31)
  101. #define ADM8211_STSR_BCNTC (1 << 30)
  102. #define ADM8211_STSR_GPINT (1 << 29)
  103. #define ADM8211_STSR_LinkOff (1 << 28)
  104. #define ADM8211_STSR_ATIMTC (1 << 27)
  105. #define ADM8211_STSR_TSFTF (1 << 26)
  106. #define ADM8211_STSR_TSCZ (1 << 25)
  107. #define ADM8211_STSR_LinkOn (1 << 24)
  108. #define ADM8211_STSR_SQL (1 << 23)
  109. #define ADM8211_STSR_WEPTD (1 << 22)
  110. #define ADM8211_STSR_ATIME (1 << 21)
  111. #define ADM8211_STSR_TBTT (1 << 20)
  112. #define ADM8211_STSR_NISS (1 << 16)
  113. #define ADM8211_STSR_AISS (1 << 15)
  114. #define ADM8211_STSR_TEIS (1 << 14)
  115. #define ADM8211_STSR_FBE (1 << 13)
  116. #define ADM8211_STSR_REIS (1 << 12)
  117. #define ADM8211_STSR_GPTT (1 << 11)
  118. #define ADM8211_STSR_RPS (1 << 8)
  119. #define ADM8211_STSR_RDU (1 << 7)
  120. #define ADM8211_STSR_RCI (1 << 6)
  121. #define ADM8211_STSR_TUF (1 << 5)
  122. #define ADM8211_STSR_TRT (1 << 4)
  123. #define ADM8211_STSR_TLT (1 << 3)
  124. #define ADM8211_STSR_TDU (1 << 2)
  125. #define ADM8211_STSR_TPS (1 << 1)
  126. #define ADM8211_STSR_TCI (1 << 0)
  127. /* CSR6 - NAR (Network Access Register) */
  128. #define ADM8211_NAR_TXCF (1 << 31)
  129. #define ADM8211_NAR_HF (1 << 30)
  130. #define ADM8211_NAR_UTR (1 << 29)
  131. #define ADM8211_NAR_SQ (1 << 28)
  132. #define ADM8211_NAR_CFP (1 << 27)
  133. #define ADM8211_NAR_SF (1 << 21)
  134. #define ADM8211_NAR_TR ((1 << 15) | (1 << 14))
  135. #define ADM8211_NAR_ST (1 << 13)
  136. #define ADM8211_NAR_OM ((1 << 11) | (1 << 10))
  137. #define ADM8211_NAR_MM (1 << 7)
  138. #define ADM8211_NAR_PR (1 << 6)
  139. #define ADM8211_NAR_EA (1 << 5)
  140. #define ADM8211_NAR_PB (1 << 3)
  141. #define ADM8211_NAR_STPDMA (1 << 2)
  142. #define ADM8211_NAR_SR (1 << 1)
  143. #define ADM8211_NAR_CTX (1 << 0)
  144. #define ADM8211_IDLE() \
  145. do { \
  146. if (priv->nar & (ADM8211_NAR_SR | ADM8211_NAR_ST)) { \
  147. ADM8211_CSR_WRITE(NAR, priv->nar & \
  148. ~(ADM8211_NAR_SR | ADM8211_NAR_ST));\
  149. ADM8211_CSR_READ(NAR); \
  150. msleep(20); \
  151. } \
  152. } while (0)
  153. #define ADM8211_IDLE_RX() \
  154. do { \
  155. if (priv->nar & ADM8211_NAR_SR) { \
  156. ADM8211_CSR_WRITE(NAR, priv->nar & ~ADM8211_NAR_SR); \
  157. ADM8211_CSR_READ(NAR); \
  158. mdelay(20); \
  159. } \
  160. } while (0)
  161. #define ADM8211_RESTORE() \
  162. do { \
  163. if (priv->nar & (ADM8211_NAR_SR | ADM8211_NAR_ST)) \
  164. ADM8211_CSR_WRITE(NAR, priv->nar); \
  165. } while (0)
  166. /* CSR7 - IER (Interrupt Enable Register) */
  167. #define ADM8211_IER_PCFIE (1 << 31)
  168. #define ADM8211_IER_BCNTCIE (1 << 30)
  169. #define ADM8211_IER_GPIE (1 << 29)
  170. #define ADM8211_IER_LinkOffIE (1 << 28)
  171. #define ADM8211_IER_ATIMTCIE (1 << 27)
  172. #define ADM8211_IER_TSFTFIE (1 << 26)
  173. #define ADM8211_IER_TSCZE (1 << 25)
  174. #define ADM8211_IER_LinkOnIE (1 << 24)
  175. #define ADM8211_IER_SQLIE (1 << 23)
  176. #define ADM8211_IER_WEPIE (1 << 22)
  177. #define ADM8211_IER_ATIMEIE (1 << 21)
  178. #define ADM8211_IER_TBTTIE (1 << 20)
  179. #define ADM8211_IER_NIE (1 << 16)
  180. #define ADM8211_IER_AIE (1 << 15)
  181. #define ADM8211_IER_TEIE (1 << 14)
  182. #define ADM8211_IER_FBEIE (1 << 13)
  183. #define ADM8211_IER_REIE (1 << 12)
  184. #define ADM8211_IER_GPTIE (1 << 11)
  185. #define ADM8211_IER_RSIE (1 << 8)
  186. #define ADM8211_IER_RUIE (1 << 7)
  187. #define ADM8211_IER_RCIE (1 << 6)
  188. #define ADM8211_IER_TUIE (1 << 5)
  189. #define ADM8211_IER_TRTIE (1 << 4)
  190. #define ADM8211_IER_TLTTIE (1 << 3)
  191. #define ADM8211_IER_TDUIE (1 << 2)
  192. #define ADM8211_IER_TPSIE (1 << 1)
  193. #define ADM8211_IER_TCIE (1 << 0)
  194. /* CSR9 - SPR (Serial Port Register) */
  195. #define ADM8211_SPR_SRS (1 << 11)
  196. #define ADM8211_SPR_SDO (1 << 3)
  197. #define ADM8211_SPR_SDI (1 << 2)
  198. #define ADM8211_SPR_SCLK (1 << 1)
  199. #define ADM8211_SPR_SCS (1 << 0)
  200. /* CSR9A - CSR_TEST0 */
  201. #define ADM8211_CSR_TEST0_EPNE (1 << 18)
  202. #define ADM8211_CSR_TEST0_EPSNM (1 << 17)
  203. #define ADM8211_CSR_TEST0_EPTYP (1 << 16)
  204. #define ADM8211_CSR_TEST0_EPRLD (1 << 15)
  205. /* CSR10 - WCSR (Wake-up Control/Status Register) */
  206. #define ADM8211_WCSR_CRCT (1 << 30)
  207. #define ADM8211_WCSR_TSFTWE (1 << 20)
  208. #define ADM8211_WCSR_TIMWE (1 << 19)
  209. #define ADM8211_WCSR_ATIMWE (1 << 18)
  210. #define ADM8211_WCSR_KEYWE (1 << 17)
  211. #define ADM8211_WCSR_MPRE (1 << 9)
  212. #define ADM8211_WCSR_LSOE (1 << 8)
  213. #define ADM8211_WCSR_KEYUP (1 << 6)
  214. #define ADM8211_WCSR_TSFTW (1 << 5)
  215. #define ADM8211_WCSR_TIMW (1 << 4)
  216. #define ADM8211_WCSR_ATIMW (1 << 3)
  217. #define ADM8211_WCSR_MPR (1 << 1)
  218. #define ADM8211_WCSR_LSO (1 << 0)
  219. /* CSR11A - GPIO */
  220. #define ADM8211_CSR_GPIO_EN5 (1 << 17)
  221. #define ADM8211_CSR_GPIO_EN4 (1 << 16)
  222. #define ADM8211_CSR_GPIO_EN3 (1 << 15)
  223. #define ADM8211_CSR_GPIO_EN2 (1 << 14)
  224. #define ADM8211_CSR_GPIO_EN1 (1 << 13)
  225. #define ADM8211_CSR_GPIO_EN0 (1 << 12)
  226. #define ADM8211_CSR_GPIO_O5 (1 << 11)
  227. #define ADM8211_CSR_GPIO_O4 (1 << 10)
  228. #define ADM8211_CSR_GPIO_O3 (1 << 9)
  229. #define ADM8211_CSR_GPIO_O2 (1 << 8)
  230. #define ADM8211_CSR_GPIO_O1 (1 << 7)
  231. #define ADM8211_CSR_GPIO_O0 (1 << 6)
  232. #define ADM8211_CSR_GPIO_IN 0x0000003f
  233. /* CSR12 - BBPCTL (BBP Control port) */
  234. #define ADM8211_BBPCTL_MMISEL (1 << 31)
  235. #define ADM8211_BBPCTL_SPICADD (0x7F << 24)
  236. #define ADM8211_BBPCTL_RF3000 (0x20 << 24)
  237. #define ADM8211_BBPCTL_TXCE (1 << 23)
  238. #define ADM8211_BBPCTL_RXCE (1 << 22)
  239. #define ADM8211_BBPCTL_CCAP (1 << 21)
  240. #define ADM8211_BBPCTL_TYPE 0x001c0000
  241. #define ADM8211_BBPCTL_WR (1 << 17)
  242. #define ADM8211_BBPCTL_RD (1 << 16)
  243. #define ADM8211_BBPCTL_ADDR 0x0000ff00
  244. #define ADM8211_BBPCTL_DATA 0x000000ff
  245. /* CSR12A - SYNCTL (Synthesizer Control port) */
  246. #define ADM8211_SYNCTL_WR (1 << 31)
  247. #define ADM8211_SYNCTL_RD (1 << 30)
  248. #define ADM8211_SYNCTL_CS0 (1 << 29)
  249. #define ADM8211_SYNCTL_CS1 (1 << 28)
  250. #define ADM8211_SYNCTL_CAL (1 << 27)
  251. #define ADM8211_SYNCTL_SELCAL (1 << 26)
  252. #define ADM8211_SYNCTL_RFtype ((1 << 24) | (1 << 23) | (1 << 22))
  253. #define ADM8211_SYNCTL_RFMD (1 << 22)
  254. #define ADM8211_SYNCTL_GENERAL (0x7 << 22)
  255. /* SYNCTL 21:0 Data (Si4126: 18-bit data, 4-bit address) */
  256. /* CSR18 - CMDR (Command Register) */
  257. #define ADM8211_CMDR_PM (1 << 19)
  258. #define ADM8211_CMDR_APM (1 << 18)
  259. #define ADM8211_CMDR_RTE (1 << 4)
  260. #define ADM8211_CMDR_DRT ((1 << 3) | (1 << 2))
  261. #define ADM8211_CMDR_DRT_8DW (0x0 << 2)
  262. #define ADM8211_CMDR_DRT_16DW (0x1 << 2)
  263. #define ADM8211_CMDR_DRT_SF (0x2 << 2)
  264. /* CSR33 - SYNRF (SYNRF direct control) */
  265. #define ADM8211_SYNRF_SELSYN (1 << 31)
  266. #define ADM8211_SYNRF_SELRF (1 << 30)
  267. #define ADM8211_SYNRF_LERF (1 << 29)
  268. #define ADM8211_SYNRF_LEIF (1 << 28)
  269. #define ADM8211_SYNRF_SYNCLK (1 << 27)
  270. #define ADM8211_SYNRF_SYNDATA (1 << 26)
  271. #define ADM8211_SYNRF_PE1 (1 << 25)
  272. #define ADM8211_SYNRF_PE2 (1 << 24)
  273. #define ADM8211_SYNRF_PA_PE (1 << 23)
  274. #define ADM8211_SYNRF_TR_SW (1 << 22)
  275. #define ADM8211_SYNRF_TR_SWN (1 << 21)
  276. #define ADM8211_SYNRF_RADIO (1 << 20)
  277. #define ADM8211_SYNRF_CAL_EN (1 << 19)
  278. #define ADM8211_SYNRF_PHYRST (1 << 18)
  279. #define ADM8211_SYNRF_IF_SELECT_0 (1 << 31)
  280. #define ADM8211_SYNRF_IF_SELECT_1 ((1 << 31) | (1 << 28))
  281. #define ADM8211_SYNRF_WRITE_SYNDATA_0 (1 << 31)
  282. #define ADM8211_SYNRF_WRITE_SYNDATA_1 ((1 << 31) | (1 << 26))
  283. #define ADM8211_SYNRF_WRITE_CLOCK_0 (1 << 31)
  284. #define ADM8211_SYNRF_WRITE_CLOCK_1 ((1 << 31) | (1 << 27))
  285. /* CSR44 - WEPCTL (WEP Control) */
  286. #define ADM8211_WEPCTL_WEPENABLE (1 << 31)
  287. #define ADM8211_WEPCTL_WPAENABLE (1 << 30)
  288. #define ADM8211_WEPCTL_CURRENT_TABLE (1 << 29)
  289. #define ADM8211_WEPCTL_TABLE_WR (1 << 28)
  290. #define ADM8211_WEPCTL_TABLE_RD (1 << 27)
  291. #define ADM8211_WEPCTL_WEPRXBYP (1 << 25)
  292. #define ADM8211_WEPCTL_SEL_WEPTABLE (1 << 23)
  293. #define ADM8211_WEPCTL_ADDR (0x000001ff)
  294. /* CSR45 - WESK (Data Entry for Share/Individual Key) */
  295. #define ADM8211_WESK_DATA (0x0000ffff)
  296. /* FER (Function Event Register) */
  297. #define ADM8211_FER_INTR_EV_ENT (1 << 15)
  298. /* Si4126 RF Synthesizer - Control Registers */
  299. #define SI4126_MAIN_CONF 0
  300. #define SI4126_PHASE_DET_GAIN 1
  301. #define SI4126_POWERDOWN 2
  302. #define SI4126_RF1_N_DIV 3 /* only Si4136 */
  303. #define SI4126_RF2_N_DIV 4
  304. #define SI4126_IF_N_DIV 5
  305. #define SI4126_RF1_R_DIV 6 /* only Si4136 */
  306. #define SI4126_RF2_R_DIV 7
  307. #define SI4126_IF_R_DIV 8
  308. /* Main Configuration */
  309. #define SI4126_MAIN_XINDIV2 (1 << 6)
  310. #define SI4126_MAIN_IFDIV ((1 << 11) | (1 << 10))
  311. /* Powerdown */
  312. #define SI4126_POWERDOWN_PDIB (1 << 1)
  313. #define SI4126_POWERDOWN_PDRB (1 << 0)
  314. /* RF3000 BBP - Control Port Registers */
  315. /* 0x00 - reserved */
  316. #define RF3000_MODEM_CTRL__RX_STATUS 0x01
  317. #define RF3000_CCA_CTRL 0x02
  318. #define RF3000_DIVERSITY__RSSI 0x03
  319. #define RF3000_RX_SIGNAL_FIELD 0x04
  320. #define RF3000_RX_LEN_MSB 0x05
  321. #define RF3000_RX_LEN_LSB 0x06
  322. #define RF3000_RX_SERVICE_FIELD 0x07
  323. #define RF3000_TX_VAR_GAIN__TX_LEN_EXT 0x11
  324. #define RF3000_TX_LEN_MSB 0x12
  325. #define RF3000_TX_LEN_LSB 0x13
  326. #define RF3000_LOW_GAIN_CALIB 0x14
  327. #define RF3000_HIGH_GAIN_CALIB 0x15
  328. /* ADM8211 revisions */
  329. #define ADM8211_REV_AB 0x11
  330. #define ADM8211_REV_AF 0x15
  331. #define ADM8211_REV_BA 0x20
  332. #define ADM8211_REV_CA 0x30
  333. struct adm8211_desc {
  334. __le32 status;
  335. __le32 length;
  336. __le32 buffer1;
  337. __le32 buffer2;
  338. };
  339. #define RDES0_STATUS_OWN (1 << 31)
  340. #define RDES0_STATUS_ES (1 << 30)
  341. #define RDES0_STATUS_SQL (1 << 29)
  342. #define RDES0_STATUS_DE (1 << 28)
  343. #define RDES0_STATUS_FS (1 << 27)
  344. #define RDES0_STATUS_LS (1 << 26)
  345. #define RDES0_STATUS_PCF (1 << 25)
  346. #define RDES0_STATUS_SFDE (1 << 24)
  347. #define RDES0_STATUS_SIGE (1 << 23)
  348. #define RDES0_STATUS_CRC16E (1 << 22)
  349. #define RDES0_STATUS_RXTOE (1 << 21)
  350. #define RDES0_STATUS_CRC32E (1 << 20)
  351. #define RDES0_STATUS_ICVE (1 << 19)
  352. #define RDES0_STATUS_DA1 (1 << 17)
  353. #define RDES0_STATUS_DA0 (1 << 16)
  354. #define RDES0_STATUS_RXDR ((1 << 15) | (1 << 14) | (1 << 13) | (1 << 12))
  355. #define RDES0_STATUS_FL (0x00000fff)
  356. #define RDES1_CONTROL_RER (1 << 25)
  357. #define RDES1_CONTROL_RCH (1 << 24)
  358. #define RDES1_CONTROL_RBS2 (0x00fff000)
  359. #define RDES1_CONTROL_RBS1 (0x00000fff)
  360. #define RDES1_STATUS_RSSI (0x0000007f)
  361. #define TDES0_CONTROL_OWN (1 << 31)
  362. #define TDES0_CONTROL_DONE (1 << 30)
  363. #define TDES0_CONTROL_TXDR (0x0ff00000)
  364. #define TDES0_STATUS_OWN (1 << 31)
  365. #define TDES0_STATUS_DONE (1 << 30)
  366. #define TDES0_STATUS_ES (1 << 29)
  367. #define TDES0_STATUS_TLT (1 << 28)
  368. #define TDES0_STATUS_TRT (1 << 27)
  369. #define TDES0_STATUS_TUF (1 << 26)
  370. #define TDES0_STATUS_TRO (1 << 25)
  371. #define TDES0_STATUS_SOFBR (1 << 24)
  372. #define TDES0_STATUS_ACR (0x00000fff)
  373. #define TDES1_CONTROL_IC (1 << 31)
  374. #define TDES1_CONTROL_LS (1 << 30)
  375. #define TDES1_CONTROL_FS (1 << 29)
  376. #define TDES1_CONTROL_TER (1 << 25)
  377. #define TDES1_CONTROL_TCH (1 << 24)
  378. #define TDES1_CONTROL_RBS2 (0x00fff000)
  379. #define TDES1_CONTROL_RBS1 (0x00000fff)
  380. /* SRAM offsets */
  381. #define ADM8211_SRAM(x) (priv->pdev->revision < ADM8211_REV_BA ? \
  382. ADM8211_SRAM_A_ ## x : ADM8211_SRAM_B_ ## x)
  383. #define ADM8211_SRAM_INDIV_KEY 0x0000
  384. #define ADM8211_SRAM_A_SHARE_KEY 0x0160
  385. #define ADM8211_SRAM_B_SHARE_KEY 0x00c0
  386. #define ADM8211_SRAM_A_SSID 0x0180
  387. #define ADM8211_SRAM_B_SSID 0x00d4
  388. #define ADM8211_SRAM_SSID ADM8211_SRAM(SSID)
  389. #define ADM8211_SRAM_A_SUPP_RATE 0x0191
  390. #define ADM8211_SRAM_B_SUPP_RATE 0x00dd
  391. #define ADM8211_SRAM_SUPP_RATE ADM8211_SRAM(SUPP_RATE)
  392. #define ADM8211_SRAM_A_SIZE 0x0200
  393. #define ADM8211_SRAM_B_SIZE 0x01c0
  394. #define ADM8211_SRAM_SIZE ADM8211_SRAM(SIZE)
  395. struct adm8211_rx_ring_info {
  396. struct sk_buff *skb;
  397. dma_addr_t mapping;
  398. };
  399. struct adm8211_tx_ring_info {
  400. struct sk_buff *skb;
  401. dma_addr_t mapping;
  402. size_t hdrlen;
  403. };
  404. #define PLCP_SIGNAL_1M 0x0a
  405. #define PLCP_SIGNAL_2M 0x14
  406. #define PLCP_SIGNAL_5M5 0x37
  407. #define PLCP_SIGNAL_11M 0x6e
  408. struct adm8211_tx_hdr {
  409. u8 da[6];
  410. u8 signal; /* PLCP signal / TX rate in 100 Kbps */
  411. u8 service;
  412. __le16 frame_body_size;
  413. __le16 frame_control;
  414. __le16 plcp_frag_tail_len;
  415. __le16 plcp_frag_head_len;
  416. __le16 dur_frag_tail;
  417. __le16 dur_frag_head;
  418. u8 addr4[6];
  419. #define ADM8211_TXHDRCTL_SHORT_PREAMBLE (1 << 0)
  420. #define ADM8211_TXHDRCTL_MORE_FRAG (1 << 1)
  421. #define ADM8211_TXHDRCTL_MORE_DATA (1 << 2)
  422. #define ADM8211_TXHDRCTL_FRAG_NO (1 << 3) /* ? */
  423. #define ADM8211_TXHDRCTL_ENABLE_RTS (1 << 4)
  424. #define ADM8211_TXHDRCTL_ENABLE_WEP_ENGINE (1 << 5)
  425. #define ADM8211_TXHDRCTL_ENABLE_EXTEND_HEADER (1 << 15) /* ? */
  426. __le16 header_control;
  427. __le16 frag;
  428. u8 reserved_0;
  429. u8 retry_limit;
  430. u32 wep2key0;
  431. u32 wep2key1;
  432. u32 wep2key2;
  433. u32 wep2key3;
  434. u8 keyid;
  435. u8 entry_control; // huh??
  436. u16 reserved_1;
  437. u32 reserved_2;
  438. } __packed;
  439. #define RX_COPY_BREAK 128
  440. #define RX_PKT_SIZE 2500
  441. struct adm8211_eeprom {
  442. __le16 signature; /* 0x00 */
  443. u8 major_version; /* 0x02 */
  444. u8 minor_version; /* 0x03 */
  445. u8 reserved_1[4]; /* 0x04 */
  446. u8 hwaddr[6]; /* 0x08 */
  447. u8 reserved_2[8]; /* 0x1E */
  448. __le16 cr49; /* 0x16 */
  449. u8 cr03; /* 0x18 */
  450. u8 cr28; /* 0x19 */
  451. u8 cr29; /* 0x1A */
  452. u8 country_code; /* 0x1B */
  453. /* specific bbp types */
  454. #define ADM8211_BBP_RFMD3000 0x00
  455. #define ADM8211_BBP_RFMD3002 0x01
  456. #define ADM8211_BBP_ADM8011 0x04
  457. u8 specific_bbptype; /* 0x1C */
  458. u8 specific_rftype; /* 0x1D */
  459. u8 reserved_3[2]; /* 0x1E */
  460. __le16 device_id; /* 0x20 */
  461. __le16 vendor_id; /* 0x22 */
  462. __le16 subsystem_id; /* 0x24 */
  463. __le16 subsystem_vendor_id; /* 0x26 */
  464. u8 maxlat; /* 0x28 */
  465. u8 mingnt; /* 0x29 */
  466. __le16 cis_pointer_low; /* 0x2A */
  467. __le16 cis_pointer_high; /* 0x2C */
  468. __le16 csr18; /* 0x2E */
  469. u8 reserved_4[16]; /* 0x30 */
  470. u8 d1_pwrdara; /* 0x40 */
  471. u8 d0_pwrdara; /* 0x41 */
  472. u8 d3_pwrdara; /* 0x42 */
  473. u8 d2_pwrdara; /* 0x43 */
  474. u8 antenna_power[14]; /* 0x44 */
  475. __le16 cis_wordcnt; /* 0x52 */
  476. u8 tx_power[14]; /* 0x54 */
  477. u8 lpf_cutoff[14]; /* 0x62 */
  478. u8 lnags_threshold[14]; /* 0x70 */
  479. __le16 checksum; /* 0x7E */
  480. u8 cis_data[0]; /* 0x80, 384 bytes */
  481. } __packed;
  482. struct adm8211_priv {
  483. struct pci_dev *pdev;
  484. spinlock_t lock;
  485. struct adm8211_csr __iomem *map;
  486. struct adm8211_desc *rx_ring;
  487. struct adm8211_desc *tx_ring;
  488. dma_addr_t rx_ring_dma;
  489. dma_addr_t tx_ring_dma;
  490. struct adm8211_rx_ring_info *rx_buffers;
  491. struct adm8211_tx_ring_info *tx_buffers;
  492. unsigned int rx_ring_size, tx_ring_size;
  493. unsigned int cur_tx, dirty_tx, cur_rx;
  494. struct ieee80211_low_level_stats stats;
  495. struct ieee80211_supported_band band;
  496. struct ieee80211_channel channels[14];
  497. int mode;
  498. int channel;
  499. u8 bssid[ETH_ALEN];
  500. u8 soft_rx_crc;
  501. u8 retry_limit;
  502. u8 ant_power;
  503. u8 tx_power;
  504. u8 lpf_cutoff;
  505. u8 lnags_threshold;
  506. struct adm8211_eeprom *eeprom;
  507. size_t eeprom_len;
  508. u32 nar;
  509. #define ADM8211_TYPE_INTERSIL 0x00
  510. #define ADM8211_TYPE_RFMD 0x01
  511. #define ADM8211_TYPE_MARVEL 0x02
  512. #define ADM8211_TYPE_AIROHA 0x03
  513. #define ADM8211_TYPE_ADMTEK 0x05
  514. unsigned int rf_type:3;
  515. unsigned int bbp_type:3;
  516. u8 specific_bbptype;
  517. enum {
  518. ADM8211_RFMD2948 = 0x0,
  519. ADM8211_RFMD2958 = 0x1,
  520. ADM8211_RFMD2958_RF3000_CONTROL_POWER = 0x2,
  521. ADM8211_MAX2820 = 0x8,
  522. ADM8211_AL2210L = 0xC, /* Airoha */
  523. } transceiver_type;
  524. };
  525. struct ieee80211_chan_range {
  526. u8 min;
  527. u8 max;
  528. };
  529. static const struct ieee80211_chan_range cranges[] = {
  530. {1, 11}, /* FCC */
  531. {1, 11}, /* IC */
  532. {1, 13}, /* ETSI */
  533. {10, 11}, /* SPAIN */
  534. {10, 13}, /* FRANCE */
  535. {14, 14}, /* MMK */
  536. {1, 14}, /* MMK2 */
  537. };
  538. #endif /* ADM8211_H */