rt2500pci.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234
  1. /*
  2. Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
  3. <http://rt2x00.serialmonkey.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the
  14. Free Software Foundation, Inc.,
  15. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  16. */
  17. /*
  18. Module: rt2500pci
  19. Abstract: Data structures and registers for the rt2500pci module.
  20. Supported chipsets: RT2560.
  21. */
  22. #ifndef RT2500PCI_H
  23. #define RT2500PCI_H
  24. /*
  25. * RF chip defines.
  26. */
  27. #define RF2522 0x0000
  28. #define RF2523 0x0001
  29. #define RF2524 0x0002
  30. #define RF2525 0x0003
  31. #define RF2525E 0x0004
  32. #define RF5222 0x0010
  33. /*
  34. * RT2560 version
  35. */
  36. #define RT2560_VERSION_B 2
  37. #define RT2560_VERSION_C 3
  38. #define RT2560_VERSION_D 4
  39. /*
  40. * Signal information.
  41. * Defaul offset is required for RSSI <-> dBm conversion.
  42. */
  43. #define DEFAULT_RSSI_OFFSET 121
  44. /*
  45. * Register layout information.
  46. */
  47. #define CSR_REG_BASE 0x0000
  48. #define CSR_REG_SIZE 0x0174
  49. #define EEPROM_BASE 0x0000
  50. #define EEPROM_SIZE 0x0200
  51. #define BBP_BASE 0x0000
  52. #define BBP_SIZE 0x0040
  53. #define RF_BASE 0x0004
  54. #define RF_SIZE 0x0010
  55. /*
  56. * Number of TX queues.
  57. */
  58. #define NUM_TX_QUEUES 2
  59. /*
  60. * Control/Status Registers(CSR).
  61. * Some values are set in TU, whereas 1 TU == 1024 us.
  62. */
  63. /*
  64. * CSR0: ASIC revision number.
  65. */
  66. #define CSR0 0x0000
  67. /*
  68. * CSR1: System control register.
  69. * SOFT_RESET: Software reset, 1: reset, 0: normal.
  70. * BBP_RESET: Hardware reset, 1: reset, 0, release.
  71. * HOST_READY: Host ready after initialization.
  72. */
  73. #define CSR1 0x0004
  74. #define CSR1_SOFT_RESET FIELD32(0x00000001)
  75. #define CSR1_BBP_RESET FIELD32(0x00000002)
  76. #define CSR1_HOST_READY FIELD32(0x00000004)
  77. /*
  78. * CSR2: System admin status register (invalid).
  79. */
  80. #define CSR2 0x0008
  81. /*
  82. * CSR3: STA MAC address register 0.
  83. */
  84. #define CSR3 0x000c
  85. #define CSR3_BYTE0 FIELD32(0x000000ff)
  86. #define CSR3_BYTE1 FIELD32(0x0000ff00)
  87. #define CSR3_BYTE2 FIELD32(0x00ff0000)
  88. #define CSR3_BYTE3 FIELD32(0xff000000)
  89. /*
  90. * CSR4: STA MAC address register 1.
  91. */
  92. #define CSR4 0x0010
  93. #define CSR4_BYTE4 FIELD32(0x000000ff)
  94. #define CSR4_BYTE5 FIELD32(0x0000ff00)
  95. /*
  96. * CSR5: BSSID register 0.
  97. */
  98. #define CSR5 0x0014
  99. #define CSR5_BYTE0 FIELD32(0x000000ff)
  100. #define CSR5_BYTE1 FIELD32(0x0000ff00)
  101. #define CSR5_BYTE2 FIELD32(0x00ff0000)
  102. #define CSR5_BYTE3 FIELD32(0xff000000)
  103. /*
  104. * CSR6: BSSID register 1.
  105. */
  106. #define CSR6 0x0018
  107. #define CSR6_BYTE4 FIELD32(0x000000ff)
  108. #define CSR6_BYTE5 FIELD32(0x0000ff00)
  109. /*
  110. * CSR7: Interrupt source register.
  111. * Write 1 to clear.
  112. * TBCN_EXPIRE: Beacon timer expired interrupt.
  113. * TWAKE_EXPIRE: Wakeup timer expired interrupt.
  114. * TATIMW_EXPIRE: Timer of atim window expired interrupt.
  115. * TXDONE_TXRING: Tx ring transmit done interrupt.
  116. * TXDONE_ATIMRING: Atim ring transmit done interrupt.
  117. * TXDONE_PRIORING: Priority ring transmit done interrupt.
  118. * RXDONE: Receive done interrupt.
  119. * DECRYPTION_DONE: Decryption done interrupt.
  120. * ENCRYPTION_DONE: Encryption done interrupt.
  121. * UART1_TX_TRESHOLD: UART1 TX reaches threshold.
  122. * UART1_RX_TRESHOLD: UART1 RX reaches threshold.
  123. * UART1_IDLE_TRESHOLD: UART1 IDLE over threshold.
  124. * UART1_TX_BUFF_ERROR: UART1 TX buffer error.
  125. * UART1_RX_BUFF_ERROR: UART1 RX buffer error.
  126. * UART2_TX_TRESHOLD: UART2 TX reaches threshold.
  127. * UART2_RX_TRESHOLD: UART2 RX reaches threshold.
  128. * UART2_IDLE_TRESHOLD: UART2 IDLE over threshold.
  129. * UART2_TX_BUFF_ERROR: UART2 TX buffer error.
  130. * UART2_RX_BUFF_ERROR: UART2 RX buffer error.
  131. * TIMER_CSR3_EXPIRE: TIMECSR3 timer expired (802.1H quiet period).
  132. */
  133. #define CSR7 0x001c
  134. #define CSR7_TBCN_EXPIRE FIELD32(0x00000001)
  135. #define CSR7_TWAKE_EXPIRE FIELD32(0x00000002)
  136. #define CSR7_TATIMW_EXPIRE FIELD32(0x00000004)
  137. #define CSR7_TXDONE_TXRING FIELD32(0x00000008)
  138. #define CSR7_TXDONE_ATIMRING FIELD32(0x00000010)
  139. #define CSR7_TXDONE_PRIORING FIELD32(0x00000020)
  140. #define CSR7_RXDONE FIELD32(0x00000040)
  141. #define CSR7_DECRYPTION_DONE FIELD32(0x00000080)
  142. #define CSR7_ENCRYPTION_DONE FIELD32(0x00000100)
  143. #define CSR7_UART1_TX_TRESHOLD FIELD32(0x00000200)
  144. #define CSR7_UART1_RX_TRESHOLD FIELD32(0x00000400)
  145. #define CSR7_UART1_IDLE_TRESHOLD FIELD32(0x00000800)
  146. #define CSR7_UART1_TX_BUFF_ERROR FIELD32(0x00001000)
  147. #define CSR7_UART1_RX_BUFF_ERROR FIELD32(0x00002000)
  148. #define CSR7_UART2_TX_TRESHOLD FIELD32(0x00004000)
  149. #define CSR7_UART2_RX_TRESHOLD FIELD32(0x00008000)
  150. #define CSR7_UART2_IDLE_TRESHOLD FIELD32(0x00010000)
  151. #define CSR7_UART2_TX_BUFF_ERROR FIELD32(0x00020000)
  152. #define CSR7_UART2_RX_BUFF_ERROR FIELD32(0x00040000)
  153. #define CSR7_TIMER_CSR3_EXPIRE FIELD32(0x00080000)
  154. /*
  155. * CSR8: Interrupt mask register.
  156. * Write 1 to mask interrupt.
  157. * TBCN_EXPIRE: Beacon timer expired interrupt.
  158. * TWAKE_EXPIRE: Wakeup timer expired interrupt.
  159. * TATIMW_EXPIRE: Timer of atim window expired interrupt.
  160. * TXDONE_TXRING: Tx ring transmit done interrupt.
  161. * TXDONE_ATIMRING: Atim ring transmit done interrupt.
  162. * TXDONE_PRIORING: Priority ring transmit done interrupt.
  163. * RXDONE: Receive done interrupt.
  164. * DECRYPTION_DONE: Decryption done interrupt.
  165. * ENCRYPTION_DONE: Encryption done interrupt.
  166. * UART1_TX_TRESHOLD: UART1 TX reaches threshold.
  167. * UART1_RX_TRESHOLD: UART1 RX reaches threshold.
  168. * UART1_IDLE_TRESHOLD: UART1 IDLE over threshold.
  169. * UART1_TX_BUFF_ERROR: UART1 TX buffer error.
  170. * UART1_RX_BUFF_ERROR: UART1 RX buffer error.
  171. * UART2_TX_TRESHOLD: UART2 TX reaches threshold.
  172. * UART2_RX_TRESHOLD: UART2 RX reaches threshold.
  173. * UART2_IDLE_TRESHOLD: UART2 IDLE over threshold.
  174. * UART2_TX_BUFF_ERROR: UART2 TX buffer error.
  175. * UART2_RX_BUFF_ERROR: UART2 RX buffer error.
  176. * TIMER_CSR3_EXPIRE: TIMECSR3 timer expired (802.1H quiet period).
  177. */
  178. #define CSR8 0x0020
  179. #define CSR8_TBCN_EXPIRE FIELD32(0x00000001)
  180. #define CSR8_TWAKE_EXPIRE FIELD32(0x00000002)
  181. #define CSR8_TATIMW_EXPIRE FIELD32(0x00000004)
  182. #define CSR8_TXDONE_TXRING FIELD32(0x00000008)
  183. #define CSR8_TXDONE_ATIMRING FIELD32(0x00000010)
  184. #define CSR8_TXDONE_PRIORING FIELD32(0x00000020)
  185. #define CSR8_RXDONE FIELD32(0x00000040)
  186. #define CSR8_DECRYPTION_DONE FIELD32(0x00000080)
  187. #define CSR8_ENCRYPTION_DONE FIELD32(0x00000100)
  188. #define CSR8_UART1_TX_TRESHOLD FIELD32(0x00000200)
  189. #define CSR8_UART1_RX_TRESHOLD FIELD32(0x00000400)
  190. #define CSR8_UART1_IDLE_TRESHOLD FIELD32(0x00000800)
  191. #define CSR8_UART1_TX_BUFF_ERROR FIELD32(0x00001000)
  192. #define CSR8_UART1_RX_BUFF_ERROR FIELD32(0x00002000)
  193. #define CSR8_UART2_TX_TRESHOLD FIELD32(0x00004000)
  194. #define CSR8_UART2_RX_TRESHOLD FIELD32(0x00008000)
  195. #define CSR8_UART2_IDLE_TRESHOLD FIELD32(0x00010000)
  196. #define CSR8_UART2_TX_BUFF_ERROR FIELD32(0x00020000)
  197. #define CSR8_UART2_RX_BUFF_ERROR FIELD32(0x00040000)
  198. #define CSR8_TIMER_CSR3_EXPIRE FIELD32(0x00080000)
  199. /*
  200. * CSR9: Maximum frame length register.
  201. * MAX_FRAME_UNIT: Maximum frame length in 128b unit, default: 12.
  202. */
  203. #define CSR9 0x0024
  204. #define CSR9_MAX_FRAME_UNIT FIELD32(0x00000f80)
  205. /*
  206. * SECCSR0: WEP control register.
  207. * KICK_DECRYPT: Kick decryption engine, self-clear.
  208. * ONE_SHOT: 0: ring mode, 1: One shot only mode.
  209. * DESC_ADDRESS: Descriptor physical address of frame.
  210. */
  211. #define SECCSR0 0x0028
  212. #define SECCSR0_KICK_DECRYPT FIELD32(0x00000001)
  213. #define SECCSR0_ONE_SHOT FIELD32(0x00000002)
  214. #define SECCSR0_DESC_ADDRESS FIELD32(0xfffffffc)
  215. /*
  216. * CSR11: Back-off control register.
  217. * CWMIN: CWmin. Default cwmin is 31 (2^5 - 1).
  218. * CWMAX: CWmax. Default cwmax is 1023 (2^10 - 1).
  219. * SLOT_TIME: Slot time, default is 20us for 802.11b
  220. * CW_SELECT: CWmin/CWmax selection, 1: Register, 0: TXD.
  221. * LONG_RETRY: Long retry count.
  222. * SHORT_RETRY: Short retry count.
  223. */
  224. #define CSR11 0x002c
  225. #define CSR11_CWMIN FIELD32(0x0000000f)
  226. #define CSR11_CWMAX FIELD32(0x000000f0)
  227. #define CSR11_SLOT_TIME FIELD32(0x00001f00)
  228. #define CSR11_CW_SELECT FIELD32(0x00002000)
  229. #define CSR11_LONG_RETRY FIELD32(0x00ff0000)
  230. #define CSR11_SHORT_RETRY FIELD32(0xff000000)
  231. /*
  232. * CSR12: Synchronization configuration register 0.
  233. * All units in 1/16 TU.
  234. * BEACON_INTERVAL: Beacon interval, default is 100 TU.
  235. * CFP_MAX_DURATION: Cfp maximum duration, default is 100 TU.
  236. */
  237. #define CSR12 0x0030
  238. #define CSR12_BEACON_INTERVAL FIELD32(0x0000ffff)
  239. #define CSR12_CFP_MAX_DURATION FIELD32(0xffff0000)
  240. /*
  241. * CSR13: Synchronization configuration register 1.
  242. * All units in 1/16 TU.
  243. * ATIMW_DURATION: Atim window duration.
  244. * CFP_PERIOD: Cfp period, default is 0 TU.
  245. */
  246. #define CSR13 0x0034
  247. #define CSR13_ATIMW_DURATION FIELD32(0x0000ffff)
  248. #define CSR13_CFP_PERIOD FIELD32(0x00ff0000)
  249. /*
  250. * CSR14: Synchronization control register.
  251. * TSF_COUNT: Enable tsf auto counting.
  252. * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode.
  253. * TBCN: Enable tbcn with reload value.
  254. * TCFP: Enable tcfp & cfp / cp switching.
  255. * TATIMW: Enable tatimw & atim window switching.
  256. * BEACON_GEN: Enable beacon generator.
  257. * CFP_COUNT_PRELOAD: Cfp count preload value.
  258. * TBCM_PRELOAD: Tbcn preload value in units of 64us.
  259. */
  260. #define CSR14 0x0038
  261. #define CSR14_TSF_COUNT FIELD32(0x00000001)
  262. #define CSR14_TSF_SYNC FIELD32(0x00000006)
  263. #define CSR14_TBCN FIELD32(0x00000008)
  264. #define CSR14_TCFP FIELD32(0x00000010)
  265. #define CSR14_TATIMW FIELD32(0x00000020)
  266. #define CSR14_BEACON_GEN FIELD32(0x00000040)
  267. #define CSR14_CFP_COUNT_PRELOAD FIELD32(0x0000ff00)
  268. #define CSR14_TBCM_PRELOAD FIELD32(0xffff0000)
  269. /*
  270. * CSR15: Synchronization status register.
  271. * CFP: ASIC is in contention-free period.
  272. * ATIMW: ASIC is in ATIM window.
  273. * BEACON_SENT: Beacon is send.
  274. */
  275. #define CSR15 0x003c
  276. #define CSR15_CFP FIELD32(0x00000001)
  277. #define CSR15_ATIMW FIELD32(0x00000002)
  278. #define CSR15_BEACON_SENT FIELD32(0x00000004)
  279. /*
  280. * CSR16: TSF timer register 0.
  281. */
  282. #define CSR16 0x0040
  283. #define CSR16_LOW_TSFTIMER FIELD32(0xffffffff)
  284. /*
  285. * CSR17: TSF timer register 1.
  286. */
  287. #define CSR17 0x0044
  288. #define CSR17_HIGH_TSFTIMER FIELD32(0xffffffff)
  289. /*
  290. * CSR18: IFS timer register 0.
  291. * SIFS: Sifs, default is 10 us.
  292. * PIFS: Pifs, default is 30 us.
  293. */
  294. #define CSR18 0x0048
  295. #define CSR18_SIFS FIELD32(0x000001ff)
  296. #define CSR18_PIFS FIELD32(0x001f0000)
  297. /*
  298. * CSR19: IFS timer register 1.
  299. * DIFS: Difs, default is 50 us.
  300. * EIFS: Eifs, default is 364 us.
  301. */
  302. #define CSR19 0x004c
  303. #define CSR19_DIFS FIELD32(0x0000ffff)
  304. #define CSR19_EIFS FIELD32(0xffff0000)
  305. /*
  306. * CSR20: Wakeup timer register.
  307. * DELAY_AFTER_TBCN: Delay after tbcn expired in units of 1/16 TU.
  308. * TBCN_BEFORE_WAKEUP: Number of beacon before wakeup.
  309. * AUTOWAKE: Enable auto wakeup / sleep mechanism.
  310. */
  311. #define CSR20 0x0050
  312. #define CSR20_DELAY_AFTER_TBCN FIELD32(0x0000ffff)
  313. #define CSR20_TBCN_BEFORE_WAKEUP FIELD32(0x00ff0000)
  314. #define CSR20_AUTOWAKE FIELD32(0x01000000)
  315. /*
  316. * CSR21: EEPROM control register.
  317. * RELOAD: Write 1 to reload eeprom content.
  318. * TYPE_93C46: 1: 93c46, 0:93c66.
  319. */
  320. #define CSR21 0x0054
  321. #define CSR21_RELOAD FIELD32(0x00000001)
  322. #define CSR21_EEPROM_DATA_CLOCK FIELD32(0x00000002)
  323. #define CSR21_EEPROM_CHIP_SELECT FIELD32(0x00000004)
  324. #define CSR21_EEPROM_DATA_IN FIELD32(0x00000008)
  325. #define CSR21_EEPROM_DATA_OUT FIELD32(0x00000010)
  326. #define CSR21_TYPE_93C46 FIELD32(0x00000020)
  327. /*
  328. * CSR22: CFP control register.
  329. * CFP_DURATION_REMAIN: Cfp duration remain, in units of TU.
  330. * RELOAD_CFP_DURATION: Write 1 to reload cfp duration remain.
  331. */
  332. #define CSR22 0x0058
  333. #define CSR22_CFP_DURATION_REMAIN FIELD32(0x0000ffff)
  334. #define CSR22_RELOAD_CFP_DURATION FIELD32(0x00010000)
  335. /*
  336. * Transmit related CSRs.
  337. * Some values are set in TU, whereas 1 TU == 1024 us.
  338. */
  339. /*
  340. * TXCSR0: TX Control Register.
  341. * KICK_TX: Kick tx ring.
  342. * KICK_ATIM: Kick atim ring.
  343. * KICK_PRIO: Kick priority ring.
  344. * ABORT: Abort all transmit related ring operation.
  345. */
  346. #define TXCSR0 0x0060
  347. #define TXCSR0_KICK_TX FIELD32(0x00000001)
  348. #define TXCSR0_KICK_ATIM FIELD32(0x00000002)
  349. #define TXCSR0_KICK_PRIO FIELD32(0x00000004)
  350. #define TXCSR0_ABORT FIELD32(0x00000008)
  351. /*
  352. * TXCSR1: TX Configuration Register.
  353. * ACK_TIMEOUT: Ack timeout, default = sifs + 2*slottime + acktime @ 1mbps.
  354. * ACK_CONSUME_TIME: Ack consume time, default = sifs + acktime @ 1mbps.
  355. * TSF_OFFSET: Insert tsf offset.
  356. * AUTORESPONDER: Enable auto responder which include ack & cts.
  357. */
  358. #define TXCSR1 0x0064
  359. #define TXCSR1_ACK_TIMEOUT FIELD32(0x000001ff)
  360. #define TXCSR1_ACK_CONSUME_TIME FIELD32(0x0003fe00)
  361. #define TXCSR1_TSF_OFFSET FIELD32(0x00fc0000)
  362. #define TXCSR1_AUTORESPONDER FIELD32(0x01000000)
  363. /*
  364. * TXCSR2: Tx descriptor configuration register.
  365. * TXD_SIZE: Tx descriptor size, default is 48.
  366. * NUM_TXD: Number of tx entries in ring.
  367. * NUM_ATIM: Number of atim entries in ring.
  368. * NUM_PRIO: Number of priority entries in ring.
  369. */
  370. #define TXCSR2 0x0068
  371. #define TXCSR2_TXD_SIZE FIELD32(0x000000ff)
  372. #define TXCSR2_NUM_TXD FIELD32(0x0000ff00)
  373. #define TXCSR2_NUM_ATIM FIELD32(0x00ff0000)
  374. #define TXCSR2_NUM_PRIO FIELD32(0xff000000)
  375. /*
  376. * TXCSR3: TX Ring Base address register.
  377. */
  378. #define TXCSR3 0x006c
  379. #define TXCSR3_TX_RING_REGISTER FIELD32(0xffffffff)
  380. /*
  381. * TXCSR4: TX Atim Ring Base address register.
  382. */
  383. #define TXCSR4 0x0070
  384. #define TXCSR4_ATIM_RING_REGISTER FIELD32(0xffffffff)
  385. /*
  386. * TXCSR5: TX Prio Ring Base address register.
  387. */
  388. #define TXCSR5 0x0074
  389. #define TXCSR5_PRIO_RING_REGISTER FIELD32(0xffffffff)
  390. /*
  391. * TXCSR6: Beacon Base address register.
  392. */
  393. #define TXCSR6 0x0078
  394. #define TXCSR6_BEACON_RING_REGISTER FIELD32(0xffffffff)
  395. /*
  396. * TXCSR7: Auto responder control register.
  397. * AR_POWERMANAGEMENT: Auto responder power management bit.
  398. */
  399. #define TXCSR7 0x007c
  400. #define TXCSR7_AR_POWERMANAGEMENT FIELD32(0x00000001)
  401. /*
  402. * TXCSR8: CCK Tx BBP register.
  403. */
  404. #define TXCSR8 0x0098
  405. #define TXCSR8_BBP_ID0 FIELD32(0x0000007f)
  406. #define TXCSR8_BBP_ID0_VALID FIELD32(0x00000080)
  407. #define TXCSR8_BBP_ID1 FIELD32(0x00007f00)
  408. #define TXCSR8_BBP_ID1_VALID FIELD32(0x00008000)
  409. #define TXCSR8_BBP_ID2 FIELD32(0x007f0000)
  410. #define TXCSR8_BBP_ID2_VALID FIELD32(0x00800000)
  411. #define TXCSR8_BBP_ID3 FIELD32(0x7f000000)
  412. #define TXCSR8_BBP_ID3_VALID FIELD32(0x80000000)
  413. /*
  414. * TXCSR9: OFDM TX BBP registers
  415. * OFDM_SIGNAL: BBP rate field address for OFDM.
  416. * OFDM_SERVICE: BBP service field address for OFDM.
  417. * OFDM_LENGTH_LOW: BBP length low byte address for OFDM.
  418. * OFDM_LENGTH_HIGH: BBP length high byte address for OFDM.
  419. */
  420. #define TXCSR9 0x0094
  421. #define TXCSR9_OFDM_RATE FIELD32(0x000000ff)
  422. #define TXCSR9_OFDM_SERVICE FIELD32(0x0000ff00)
  423. #define TXCSR9_OFDM_LENGTH_LOW FIELD32(0x00ff0000)
  424. #define TXCSR9_OFDM_LENGTH_HIGH FIELD32(0xff000000)
  425. /*
  426. * Receive related CSRs.
  427. * Some values are set in TU, whereas 1 TU == 1024 us.
  428. */
  429. /*
  430. * RXCSR0: RX Control Register.
  431. * DISABLE_RX: Disable rx engine.
  432. * DROP_CRC: Drop crc error.
  433. * DROP_PHYSICAL: Drop physical error.
  434. * DROP_CONTROL: Drop control frame.
  435. * DROP_NOT_TO_ME: Drop not to me unicast frame.
  436. * DROP_TODS: Drop frame tods bit is true.
  437. * DROP_VERSION_ERROR: Drop version error frame.
  438. * PASS_CRC: Pass all packets with crc attached.
  439. * PASS_CRC: Pass all packets with crc attached.
  440. * PASS_PLCP: Pass all packets with 4 bytes PLCP attached.
  441. * DROP_MCAST: Drop multicast frames.
  442. * DROP_BCAST: Drop broadcast frames.
  443. * ENABLE_QOS: Accept QOS data frame and parse QOS field.
  444. */
  445. #define RXCSR0 0x0080
  446. #define RXCSR0_DISABLE_RX FIELD32(0x00000001)
  447. #define RXCSR0_DROP_CRC FIELD32(0x00000002)
  448. #define RXCSR0_DROP_PHYSICAL FIELD32(0x00000004)
  449. #define RXCSR0_DROP_CONTROL FIELD32(0x00000008)
  450. #define RXCSR0_DROP_NOT_TO_ME FIELD32(0x00000010)
  451. #define RXCSR0_DROP_TODS FIELD32(0x00000020)
  452. #define RXCSR0_DROP_VERSION_ERROR FIELD32(0x00000040)
  453. #define RXCSR0_PASS_CRC FIELD32(0x00000080)
  454. #define RXCSR0_PASS_PLCP FIELD32(0x00000100)
  455. #define RXCSR0_DROP_MCAST FIELD32(0x00000200)
  456. #define RXCSR0_DROP_BCAST FIELD32(0x00000400)
  457. #define RXCSR0_ENABLE_QOS FIELD32(0x00000800)
  458. /*
  459. * RXCSR1: RX descriptor configuration register.
  460. * RXD_SIZE: Rx descriptor size, default is 32b.
  461. * NUM_RXD: Number of rx entries in ring.
  462. */
  463. #define RXCSR1 0x0084
  464. #define RXCSR1_RXD_SIZE FIELD32(0x000000ff)
  465. #define RXCSR1_NUM_RXD FIELD32(0x0000ff00)
  466. /*
  467. * RXCSR2: RX Ring base address register.
  468. */
  469. #define RXCSR2 0x0088
  470. #define RXCSR2_RX_RING_REGISTER FIELD32(0xffffffff)
  471. /*
  472. * RXCSR3: BBP ID register for Rx operation.
  473. * BBP_ID#: BBP register # id.
  474. * BBP_ID#_VALID: BBP register # id is valid or not.
  475. */
  476. #define RXCSR3 0x0090
  477. #define RXCSR3_BBP_ID0 FIELD32(0x0000007f)
  478. #define RXCSR3_BBP_ID0_VALID FIELD32(0x00000080)
  479. #define RXCSR3_BBP_ID1 FIELD32(0x00007f00)
  480. #define RXCSR3_BBP_ID1_VALID FIELD32(0x00008000)
  481. #define RXCSR3_BBP_ID2 FIELD32(0x007f0000)
  482. #define RXCSR3_BBP_ID2_VALID FIELD32(0x00800000)
  483. #define RXCSR3_BBP_ID3 FIELD32(0x7f000000)
  484. #define RXCSR3_BBP_ID3_VALID FIELD32(0x80000000)
  485. /*
  486. * ARCSR1: Auto Responder PLCP config register 1.
  487. * AR_BBP_DATA#: Auto responder BBP register # data.
  488. * AR_BBP_ID#: Auto responder BBP register # Id.
  489. */
  490. #define ARCSR1 0x009c
  491. #define ARCSR1_AR_BBP_DATA2 FIELD32(0x000000ff)
  492. #define ARCSR1_AR_BBP_ID2 FIELD32(0x0000ff00)
  493. #define ARCSR1_AR_BBP_DATA3 FIELD32(0x00ff0000)
  494. #define ARCSR1_AR_BBP_ID3 FIELD32(0xff000000)
  495. /*
  496. * Miscellaneous Registers.
  497. * Some values are set in TU, whereas 1 TU == 1024 us.
  498. */
  499. /*
  500. * PCICSR: PCI control register.
  501. * BIG_ENDIAN: 1: big endian, 0: little endian.
  502. * RX_TRESHOLD: Rx threshold in dw to start pci access
  503. * 0: 16dw (default), 1: 8dw, 2: 4dw, 3: 32dw.
  504. * TX_TRESHOLD: Tx threshold in dw to start pci access
  505. * 0: 0dw (default), 1: 1dw, 2: 4dw, 3: forward.
  506. * BURST_LENTH: Pci burst length 0: 4dw (default, 1: 8dw, 2: 16dw, 3:32dw.
  507. * ENABLE_CLK: Enable clk_run, pci clock can't going down to non-operational.
  508. * READ_MULTIPLE: Enable memory read multiple.
  509. * WRITE_INVALID: Enable memory write & invalid.
  510. */
  511. #define PCICSR 0x008c
  512. #define PCICSR_BIG_ENDIAN FIELD32(0x00000001)
  513. #define PCICSR_RX_TRESHOLD FIELD32(0x00000006)
  514. #define PCICSR_TX_TRESHOLD FIELD32(0x00000018)
  515. #define PCICSR_BURST_LENTH FIELD32(0x00000060)
  516. #define PCICSR_ENABLE_CLK FIELD32(0x00000080)
  517. #define PCICSR_READ_MULTIPLE FIELD32(0x00000100)
  518. #define PCICSR_WRITE_INVALID FIELD32(0x00000200)
  519. /*
  520. * CNT0: FCS error count.
  521. * FCS_ERROR: FCS error count, cleared when read.
  522. */
  523. #define CNT0 0x00a0
  524. #define CNT0_FCS_ERROR FIELD32(0x0000ffff)
  525. /*
  526. * Statistic Register.
  527. * CNT1: PLCP error count.
  528. * CNT2: Long error count.
  529. */
  530. #define TIMECSR2 0x00a8
  531. #define CNT1 0x00ac
  532. #define CNT2 0x00b0
  533. #define TIMECSR3 0x00b4
  534. /*
  535. * CNT3: CCA false alarm count.
  536. */
  537. #define CNT3 0x00b8
  538. #define CNT3_FALSE_CCA FIELD32(0x0000ffff)
  539. /*
  540. * Statistic Register.
  541. * CNT4: Rx FIFO overflow count.
  542. * CNT5: Tx FIFO underrun count.
  543. */
  544. #define CNT4 0x00bc
  545. #define CNT5 0x00c0
  546. /*
  547. * Baseband Control Register.
  548. */
  549. /*
  550. * PWRCSR0: Power mode configuration register.
  551. */
  552. #define PWRCSR0 0x00c4
  553. /*
  554. * Power state transition time registers.
  555. */
  556. #define PSCSR0 0x00c8
  557. #define PSCSR1 0x00cc
  558. #define PSCSR2 0x00d0
  559. #define PSCSR3 0x00d4
  560. /*
  561. * PWRCSR1: Manual power control / status register.
  562. * Allowed state: 0 deep_sleep, 1: sleep, 2: standby, 3: awake.
  563. * SET_STATE: Set state. Write 1 to trigger, self cleared.
  564. * BBP_DESIRE_STATE: BBP desired state.
  565. * RF_DESIRE_STATE: RF desired state.
  566. * BBP_CURR_STATE: BBP current state.
  567. * RF_CURR_STATE: RF current state.
  568. * PUT_TO_SLEEP: Put to sleep. Write 1 to trigger, self cleared.
  569. */
  570. #define PWRCSR1 0x00d8
  571. #define PWRCSR1_SET_STATE FIELD32(0x00000001)
  572. #define PWRCSR1_BBP_DESIRE_STATE FIELD32(0x00000006)
  573. #define PWRCSR1_RF_DESIRE_STATE FIELD32(0x00000018)
  574. #define PWRCSR1_BBP_CURR_STATE FIELD32(0x00000060)
  575. #define PWRCSR1_RF_CURR_STATE FIELD32(0x00000180)
  576. #define PWRCSR1_PUT_TO_SLEEP FIELD32(0x00000200)
  577. /*
  578. * TIMECSR: Timer control register.
  579. * US_COUNT: 1 us timer count in units of clock cycles.
  580. * US_64_COUNT: 64 us timer count in units of 1 us timer.
  581. * BEACON_EXPECT: Beacon expect window.
  582. */
  583. #define TIMECSR 0x00dc
  584. #define TIMECSR_US_COUNT FIELD32(0x000000ff)
  585. #define TIMECSR_US_64_COUNT FIELD32(0x0000ff00)
  586. #define TIMECSR_BEACON_EXPECT FIELD32(0x00070000)
  587. /*
  588. * MACCSR0: MAC configuration register 0.
  589. */
  590. #define MACCSR0 0x00e0
  591. /*
  592. * MACCSR1: MAC configuration register 1.
  593. * KICK_RX: Kick one-shot rx in one-shot rx mode.
  594. * ONESHOT_RXMODE: Enable one-shot rx mode for debugging.
  595. * BBPRX_RESET_MODE: Ralink bbp rx reset mode.
  596. * AUTO_TXBBP: Auto tx logic access bbp control register.
  597. * AUTO_RXBBP: Auto rx logic access bbp control register.
  598. * LOOPBACK: Loopback mode. 0: normal, 1: internal, 2: external, 3:rsvd.
  599. * INTERSIL_IF: Intersil if calibration pin.
  600. */
  601. #define MACCSR1 0x00e4
  602. #define MACCSR1_KICK_RX FIELD32(0x00000001)
  603. #define MACCSR1_ONESHOT_RXMODE FIELD32(0x00000002)
  604. #define MACCSR1_BBPRX_RESET_MODE FIELD32(0x00000004)
  605. #define MACCSR1_AUTO_TXBBP FIELD32(0x00000008)
  606. #define MACCSR1_AUTO_RXBBP FIELD32(0x00000010)
  607. #define MACCSR1_LOOPBACK FIELD32(0x00000060)
  608. #define MACCSR1_INTERSIL_IF FIELD32(0x00000080)
  609. /*
  610. * RALINKCSR: Ralink Rx auto-reset BBCR.
  611. * AR_BBP_DATA#: Auto reset BBP register # data.
  612. * AR_BBP_ID#: Auto reset BBP register # id.
  613. */
  614. #define RALINKCSR 0x00e8
  615. #define RALINKCSR_AR_BBP_DATA0 FIELD32(0x000000ff)
  616. #define RALINKCSR_AR_BBP_ID0 FIELD32(0x00007f00)
  617. #define RALINKCSR_AR_BBP_VALID0 FIELD32(0x00008000)
  618. #define RALINKCSR_AR_BBP_DATA1 FIELD32(0x00ff0000)
  619. #define RALINKCSR_AR_BBP_ID1 FIELD32(0x7f000000)
  620. #define RALINKCSR_AR_BBP_VALID1 FIELD32(0x80000000)
  621. /*
  622. * BCNCSR: Beacon interval control register.
  623. * CHANGE: Write one to change beacon interval.
  624. * DELTATIME: The delta time value.
  625. * NUM_BEACON: Number of beacon according to mode.
  626. * MODE: Please refer to asic specs.
  627. * PLUS: Plus or minus delta time value.
  628. */
  629. #define BCNCSR 0x00ec
  630. #define BCNCSR_CHANGE FIELD32(0x00000001)
  631. #define BCNCSR_DELTATIME FIELD32(0x0000001e)
  632. #define BCNCSR_NUM_BEACON FIELD32(0x00001fe0)
  633. #define BCNCSR_MODE FIELD32(0x00006000)
  634. #define BCNCSR_PLUS FIELD32(0x00008000)
  635. /*
  636. * BBP / RF / IF Control Register.
  637. */
  638. /*
  639. * BBPCSR: BBP serial control register.
  640. * VALUE: Register value to program into BBP.
  641. * REGNUM: Selected BBP register.
  642. * BUSY: 1: asic is busy execute BBP programming.
  643. * WRITE_CONTROL: 1: write BBP, 0: read BBP.
  644. */
  645. #define BBPCSR 0x00f0
  646. #define BBPCSR_VALUE FIELD32(0x000000ff)
  647. #define BBPCSR_REGNUM FIELD32(0x00007f00)
  648. #define BBPCSR_BUSY FIELD32(0x00008000)
  649. #define BBPCSR_WRITE_CONTROL FIELD32(0x00010000)
  650. /*
  651. * RFCSR: RF serial control register.
  652. * VALUE: Register value + id to program into rf/if.
  653. * NUMBER_OF_BITS: Number of bits used in value (i:20, rfmd:22).
  654. * IF_SELECT: Chip to program: 0: rf, 1: if.
  655. * PLL_LD: Rf pll_ld status.
  656. * BUSY: 1: asic is busy execute rf programming.
  657. */
  658. #define RFCSR 0x00f4
  659. #define RFCSR_VALUE FIELD32(0x00ffffff)
  660. #define RFCSR_NUMBER_OF_BITS FIELD32(0x1f000000)
  661. #define RFCSR_IF_SELECT FIELD32(0x20000000)
  662. #define RFCSR_PLL_LD FIELD32(0x40000000)
  663. #define RFCSR_BUSY FIELD32(0x80000000)
  664. /*
  665. * LEDCSR: LED control register.
  666. * ON_PERIOD: On period, default 70ms.
  667. * OFF_PERIOD: Off period, default 30ms.
  668. * LINK: 0: linkoff, 1: linkup.
  669. * ACTIVITY: 0: idle, 1: active.
  670. * LINK_POLARITY: 0: active low, 1: active high.
  671. * ACTIVITY_POLARITY: 0: active low, 1: active high.
  672. * LED_DEFAULT: LED state for "enable" 0: ON, 1: OFF.
  673. */
  674. #define LEDCSR 0x00f8
  675. #define LEDCSR_ON_PERIOD FIELD32(0x000000ff)
  676. #define LEDCSR_OFF_PERIOD FIELD32(0x0000ff00)
  677. #define LEDCSR_LINK FIELD32(0x00010000)
  678. #define LEDCSR_ACTIVITY FIELD32(0x00020000)
  679. #define LEDCSR_LINK_POLARITY FIELD32(0x00040000)
  680. #define LEDCSR_ACTIVITY_POLARITY FIELD32(0x00080000)
  681. #define LEDCSR_LED_DEFAULT FIELD32(0x00100000)
  682. /*
  683. * SECCSR3: AES control register.
  684. */
  685. #define SECCSR3 0x00fc
  686. /*
  687. * ASIC pointer information.
  688. * RXPTR: Current RX ring address.
  689. * TXPTR: Current Tx ring address.
  690. * PRIPTR: Current Priority ring address.
  691. * ATIMPTR: Current ATIM ring address.
  692. */
  693. #define RXPTR 0x0100
  694. #define TXPTR 0x0104
  695. #define PRIPTR 0x0108
  696. #define ATIMPTR 0x010c
  697. /*
  698. * TXACKCSR0: TX ACK timeout.
  699. */
  700. #define TXACKCSR0 0x0110
  701. /*
  702. * ACK timeout count registers.
  703. * ACKCNT0: TX ACK timeout count.
  704. * ACKCNT1: RX ACK timeout count.
  705. */
  706. #define ACKCNT0 0x0114
  707. #define ACKCNT1 0x0118
  708. /*
  709. * GPIO and others.
  710. */
  711. /*
  712. * GPIOCSR: GPIO control register.
  713. */
  714. #define GPIOCSR 0x0120
  715. #define GPIOCSR_BIT0 FIELD32(0x00000001)
  716. #define GPIOCSR_BIT1 FIELD32(0x00000002)
  717. #define GPIOCSR_BIT2 FIELD32(0x00000004)
  718. #define GPIOCSR_BIT3 FIELD32(0x00000008)
  719. #define GPIOCSR_BIT4 FIELD32(0x00000010)
  720. #define GPIOCSR_BIT5 FIELD32(0x00000020)
  721. #define GPIOCSR_BIT6 FIELD32(0x00000040)
  722. #define GPIOCSR_BIT7 FIELD32(0x00000080)
  723. #define GPIOCSR_DIR0 FIELD32(0x00000100)
  724. #define GPIOCSR_DIR1 FIELD32(0x00000200)
  725. #define GPIOCSR_DIR2 FIELD32(0x00000400)
  726. #define GPIOCSR_DIR3 FIELD32(0x00000800)
  727. #define GPIOCSR_DIR4 FIELD32(0x00001000)
  728. #define GPIOCSR_DIR5 FIELD32(0x00002000)
  729. #define GPIOCSR_DIR6 FIELD32(0x00004000)
  730. #define GPIOCSR_DIR7 FIELD32(0x00008000)
  731. /*
  732. * FIFO pointer registers.
  733. * FIFOCSR0: TX FIFO pointer.
  734. * FIFOCSR1: RX FIFO pointer.
  735. */
  736. #define FIFOCSR0 0x0128
  737. #define FIFOCSR1 0x012c
  738. /*
  739. * BCNCSR1: Tx BEACON offset time control register.
  740. * PRELOAD: Beacon timer offset in units of usec.
  741. * BEACON_CWMIN: 2^CwMin.
  742. */
  743. #define BCNCSR1 0x0130
  744. #define BCNCSR1_PRELOAD FIELD32(0x0000ffff)
  745. #define BCNCSR1_BEACON_CWMIN FIELD32(0x000f0000)
  746. /*
  747. * MACCSR2: TX_PE to RX_PE turn-around time control register
  748. * DELAY: RX_PE low width, in units of pci clock cycle.
  749. */
  750. #define MACCSR2 0x0134
  751. #define MACCSR2_DELAY FIELD32(0x000000ff)
  752. /*
  753. * TESTCSR: TEST mode selection register.
  754. */
  755. #define TESTCSR 0x0138
  756. /*
  757. * ARCSR2: 1 Mbps ACK/CTS PLCP.
  758. */
  759. #define ARCSR2 0x013c
  760. #define ARCSR2_SIGNAL FIELD32(0x000000ff)
  761. #define ARCSR2_SERVICE FIELD32(0x0000ff00)
  762. #define ARCSR2_LENGTH FIELD32(0xffff0000)
  763. /*
  764. * ARCSR3: 2 Mbps ACK/CTS PLCP.
  765. */
  766. #define ARCSR3 0x0140
  767. #define ARCSR3_SIGNAL FIELD32(0x000000ff)
  768. #define ARCSR3_SERVICE FIELD32(0x0000ff00)
  769. #define ARCSR3_LENGTH FIELD32(0xffff0000)
  770. /*
  771. * ARCSR4: 5.5 Mbps ACK/CTS PLCP.
  772. */
  773. #define ARCSR4 0x0144
  774. #define ARCSR4_SIGNAL FIELD32(0x000000ff)
  775. #define ARCSR4_SERVICE FIELD32(0x0000ff00)
  776. #define ARCSR4_LENGTH FIELD32(0xffff0000)
  777. /*
  778. * ARCSR5: 11 Mbps ACK/CTS PLCP.
  779. */
  780. #define ARCSR5 0x0148
  781. #define ARCSR5_SIGNAL FIELD32(0x000000ff)
  782. #define ARCSR5_SERVICE FIELD32(0x0000ff00)
  783. #define ARCSR5_LENGTH FIELD32(0xffff0000)
  784. /*
  785. * ARTCSR0: CCK ACK/CTS payload consumed time for 1/2/5.5/11 mbps.
  786. */
  787. #define ARTCSR0 0x014c
  788. #define ARTCSR0_ACK_CTS_11MBS FIELD32(0x000000ff)
  789. #define ARTCSR0_ACK_CTS_5_5MBS FIELD32(0x0000ff00)
  790. #define ARTCSR0_ACK_CTS_2MBS FIELD32(0x00ff0000)
  791. #define ARTCSR0_ACK_CTS_1MBS FIELD32(0xff000000)
  792. /*
  793. * ARTCSR1: OFDM ACK/CTS payload consumed time for 6/9/12/18 mbps.
  794. */
  795. #define ARTCSR1 0x0150
  796. #define ARTCSR1_ACK_CTS_6MBS FIELD32(0x000000ff)
  797. #define ARTCSR1_ACK_CTS_9MBS FIELD32(0x0000ff00)
  798. #define ARTCSR1_ACK_CTS_12MBS FIELD32(0x00ff0000)
  799. #define ARTCSR1_ACK_CTS_18MBS FIELD32(0xff000000)
  800. /*
  801. * ARTCSR2: OFDM ACK/CTS payload consumed time for 24/36/48/54 mbps.
  802. */
  803. #define ARTCSR2 0x0154
  804. #define ARTCSR2_ACK_CTS_24MBS FIELD32(0x000000ff)
  805. #define ARTCSR2_ACK_CTS_36MBS FIELD32(0x0000ff00)
  806. #define ARTCSR2_ACK_CTS_48MBS FIELD32(0x00ff0000)
  807. #define ARTCSR2_ACK_CTS_54MBS FIELD32(0xff000000)
  808. /*
  809. * SECCSR1: WEP control register.
  810. * KICK_ENCRYPT: Kick encryption engine, self-clear.
  811. * ONE_SHOT: 0: ring mode, 1: One shot only mode.
  812. * DESC_ADDRESS: Descriptor physical address of frame.
  813. */
  814. #define SECCSR1 0x0158
  815. #define SECCSR1_KICK_ENCRYPT FIELD32(0x00000001)
  816. #define SECCSR1_ONE_SHOT FIELD32(0x00000002)
  817. #define SECCSR1_DESC_ADDRESS FIELD32(0xfffffffc)
  818. /*
  819. * BBPCSR1: BBP TX configuration.
  820. */
  821. #define BBPCSR1 0x015c
  822. #define BBPCSR1_CCK FIELD32(0x00000003)
  823. #define BBPCSR1_CCK_FLIP FIELD32(0x00000004)
  824. #define BBPCSR1_OFDM FIELD32(0x00030000)
  825. #define BBPCSR1_OFDM_FLIP FIELD32(0x00040000)
  826. /*
  827. * Dual band configuration registers.
  828. * DBANDCSR0: Dual band configuration register 0.
  829. * DBANDCSR1: Dual band configuration register 1.
  830. */
  831. #define DBANDCSR0 0x0160
  832. #define DBANDCSR1 0x0164
  833. /*
  834. * BBPPCSR: BBP Pin control register.
  835. */
  836. #define BBPPCSR 0x0168
  837. /*
  838. * MAC special debug mode selection registers.
  839. * DBGSEL0: MAC special debug mode selection register 0.
  840. * DBGSEL1: MAC special debug mode selection register 1.
  841. */
  842. #define DBGSEL0 0x016c
  843. #define DBGSEL1 0x0170
  844. /*
  845. * BISTCSR: BBP BIST register.
  846. */
  847. #define BISTCSR 0x0174
  848. /*
  849. * Multicast filter registers.
  850. * MCAST0: Multicast filter register 0.
  851. * MCAST1: Multicast filter register 1.
  852. */
  853. #define MCAST0 0x0178
  854. #define MCAST1 0x017c
  855. /*
  856. * UART registers.
  857. * UARTCSR0: UART1 TX register.
  858. * UARTCSR1: UART1 RX register.
  859. * UARTCSR3: UART1 frame control register.
  860. * UARTCSR4: UART1 buffer control register.
  861. * UART2CSR0: UART2 TX register.
  862. * UART2CSR1: UART2 RX register.
  863. * UART2CSR3: UART2 frame control register.
  864. * UART2CSR4: UART2 buffer control register.
  865. */
  866. #define UARTCSR0 0x0180
  867. #define UARTCSR1 0x0184
  868. #define UARTCSR3 0x0188
  869. #define UARTCSR4 0x018c
  870. #define UART2CSR0 0x0190
  871. #define UART2CSR1 0x0194
  872. #define UART2CSR3 0x0198
  873. #define UART2CSR4 0x019c
  874. /*
  875. * BBP registers.
  876. * The wordsize of the BBP is 8 bits.
  877. */
  878. /*
  879. * R2: TX antenna control
  880. */
  881. #define BBP_R2_TX_ANTENNA FIELD8(0x03)
  882. #define BBP_R2_TX_IQ_FLIP FIELD8(0x04)
  883. /*
  884. * R14: RX antenna control
  885. */
  886. #define BBP_R14_RX_ANTENNA FIELD8(0x03)
  887. #define BBP_R14_RX_IQ_FLIP FIELD8(0x04)
  888. /*
  889. * BBP_R70
  890. */
  891. #define BBP_R70_JAPAN_FILTER FIELD8(0x08)
  892. /*
  893. * RF registers
  894. */
  895. /*
  896. * RF 1
  897. */
  898. #define RF1_TUNER FIELD32(0x00020000)
  899. /*
  900. * RF 3
  901. */
  902. #define RF3_TUNER FIELD32(0x00000100)
  903. #define RF3_TXPOWER FIELD32(0x00003e00)
  904. /*
  905. * EEPROM content.
  906. * The wordsize of the EEPROM is 16 bits.
  907. */
  908. /*
  909. * HW MAC address.
  910. */
  911. #define EEPROM_MAC_ADDR_0 0x0002
  912. #define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff)
  913. #define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00)
  914. #define EEPROM_MAC_ADDR1 0x0003
  915. #define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff)
  916. #define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00)
  917. #define EEPROM_MAC_ADDR_2 0x0004
  918. #define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff)
  919. #define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00)
  920. /*
  921. * EEPROM antenna.
  922. * ANTENNA_NUM: Number of antenna's.
  923. * TX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B.
  924. * RX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B.
  925. * LED_MODE: 0: default, 1: TX/RX activity,2: Single (ignore link), 3: rsvd.
  926. * DYN_TXAGC: Dynamic TX AGC control.
  927. * HARDWARE_RADIO: 1: Hardware controlled radio. Read GPIO0.
  928. * RF_TYPE: Rf_type of this adapter.
  929. */
  930. #define EEPROM_ANTENNA 0x10
  931. #define EEPROM_ANTENNA_NUM FIELD16(0x0003)
  932. #define EEPROM_ANTENNA_TX_DEFAULT FIELD16(0x000c)
  933. #define EEPROM_ANTENNA_RX_DEFAULT FIELD16(0x0030)
  934. #define EEPROM_ANTENNA_LED_MODE FIELD16(0x01c0)
  935. #define EEPROM_ANTENNA_DYN_TXAGC FIELD16(0x0200)
  936. #define EEPROM_ANTENNA_HARDWARE_RADIO FIELD16(0x0400)
  937. #define EEPROM_ANTENNA_RF_TYPE FIELD16(0xf800)
  938. /*
  939. * EEPROM NIC config.
  940. * CARDBUS_ACCEL: 0: enable, 1: disable.
  941. * DYN_BBP_TUNE: 0: enable, 1: disable.
  942. * CCK_TX_POWER: CCK TX power compensation.
  943. */
  944. #define EEPROM_NIC 0x11
  945. #define EEPROM_NIC_CARDBUS_ACCEL FIELD16(0x0001)
  946. #define EEPROM_NIC_DYN_BBP_TUNE FIELD16(0x0002)
  947. #define EEPROM_NIC_CCK_TX_POWER FIELD16(0x000c)
  948. /*
  949. * EEPROM geography.
  950. * GEO: Default geography setting for device.
  951. */
  952. #define EEPROM_GEOGRAPHY 0x12
  953. #define EEPROM_GEOGRAPHY_GEO FIELD16(0x0f00)
  954. /*
  955. * EEPROM BBP.
  956. */
  957. #define EEPROM_BBP_START 0x13
  958. #define EEPROM_BBP_SIZE 16
  959. #define EEPROM_BBP_VALUE FIELD16(0x00ff)
  960. #define EEPROM_BBP_REG_ID FIELD16(0xff00)
  961. /*
  962. * EEPROM TXPOWER
  963. */
  964. #define EEPROM_TXPOWER_START 0x23
  965. #define EEPROM_TXPOWER_SIZE 7
  966. #define EEPROM_TXPOWER_1 FIELD16(0x00ff)
  967. #define EEPROM_TXPOWER_2 FIELD16(0xff00)
  968. /*
  969. * RSSI <-> dBm offset calibration
  970. */
  971. #define EEPROM_CALIBRATE_OFFSET 0x3e
  972. #define EEPROM_CALIBRATE_OFFSET_RSSI FIELD16(0x00ff)
  973. /*
  974. * DMA descriptor defines.
  975. */
  976. #define TXD_DESC_SIZE ( 11 * sizeof(__le32) )
  977. #define RXD_DESC_SIZE ( 11 * sizeof(__le32) )
  978. /*
  979. * TX descriptor format for TX, PRIO, ATIM and Beacon Ring.
  980. */
  981. /*
  982. * Word0
  983. */
  984. #define TXD_W0_OWNER_NIC FIELD32(0x00000001)
  985. #define TXD_W0_VALID FIELD32(0x00000002)
  986. #define TXD_W0_RESULT FIELD32(0x0000001c)
  987. #define TXD_W0_RETRY_COUNT FIELD32(0x000000e0)
  988. #define TXD_W0_MORE_FRAG FIELD32(0x00000100)
  989. #define TXD_W0_ACK FIELD32(0x00000200)
  990. #define TXD_W0_TIMESTAMP FIELD32(0x00000400)
  991. #define TXD_W0_OFDM FIELD32(0x00000800)
  992. #define TXD_W0_CIPHER_OWNER FIELD32(0x00001000)
  993. #define TXD_W0_IFS FIELD32(0x00006000)
  994. #define TXD_W0_RETRY_MODE FIELD32(0x00008000)
  995. #define TXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000)
  996. #define TXD_W0_CIPHER_ALG FIELD32(0xe0000000)
  997. /*
  998. * Word1
  999. */
  1000. #define TXD_W1_BUFFER_ADDRESS FIELD32(0xffffffff)
  1001. /*
  1002. * Word2
  1003. */
  1004. #define TXD_W2_IV_OFFSET FIELD32(0x0000003f)
  1005. #define TXD_W2_AIFS FIELD32(0x000000c0)
  1006. #define TXD_W2_CWMIN FIELD32(0x00000f00)
  1007. #define TXD_W2_CWMAX FIELD32(0x0000f000)
  1008. /*
  1009. * Word3: PLCP information
  1010. */
  1011. #define TXD_W3_PLCP_SIGNAL FIELD32(0x000000ff)
  1012. #define TXD_W3_PLCP_SERVICE FIELD32(0x0000ff00)
  1013. #define TXD_W3_PLCP_LENGTH_LOW FIELD32(0x00ff0000)
  1014. #define TXD_W3_PLCP_LENGTH_HIGH FIELD32(0xff000000)
  1015. /*
  1016. * Word4
  1017. */
  1018. #define TXD_W4_IV FIELD32(0xffffffff)
  1019. /*
  1020. * Word5
  1021. */
  1022. #define TXD_W5_EIV FIELD32(0xffffffff)
  1023. /*
  1024. * Word6-9: Key
  1025. */
  1026. #define TXD_W6_KEY FIELD32(0xffffffff)
  1027. #define TXD_W7_KEY FIELD32(0xffffffff)
  1028. #define TXD_W8_KEY FIELD32(0xffffffff)
  1029. #define TXD_W9_KEY FIELD32(0xffffffff)
  1030. /*
  1031. * Word10
  1032. */
  1033. #define TXD_W10_RTS FIELD32(0x00000001)
  1034. #define TXD_W10_TX_RATE FIELD32(0x000000fe)
  1035. /*
  1036. * RX descriptor format for RX Ring.
  1037. */
  1038. /*
  1039. * Word0
  1040. */
  1041. #define RXD_W0_OWNER_NIC FIELD32(0x00000001)
  1042. #define RXD_W0_UNICAST_TO_ME FIELD32(0x00000002)
  1043. #define RXD_W0_MULTICAST FIELD32(0x00000004)
  1044. #define RXD_W0_BROADCAST FIELD32(0x00000008)
  1045. #define RXD_W0_MY_BSS FIELD32(0x00000010)
  1046. #define RXD_W0_CRC_ERROR FIELD32(0x00000020)
  1047. #define RXD_W0_OFDM FIELD32(0x00000040)
  1048. #define RXD_W0_PHYSICAL_ERROR FIELD32(0x00000080)
  1049. #define RXD_W0_CIPHER_OWNER FIELD32(0x00000100)
  1050. #define RXD_W0_ICV_ERROR FIELD32(0x00000200)
  1051. #define RXD_W0_IV_OFFSET FIELD32(0x0000fc00)
  1052. #define RXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000)
  1053. #define RXD_W0_CIPHER_ALG FIELD32(0xe0000000)
  1054. /*
  1055. * Word1
  1056. */
  1057. #define RXD_W1_BUFFER_ADDRESS FIELD32(0xffffffff)
  1058. /*
  1059. * Word2
  1060. */
  1061. #define RXD_W2_SIGNAL FIELD32(0x000000ff)
  1062. #define RXD_W2_RSSI FIELD32(0x0000ff00)
  1063. #define RXD_W2_TA FIELD32(0xffff0000)
  1064. /*
  1065. * Word3
  1066. */
  1067. #define RXD_W3_TA FIELD32(0xffffffff)
  1068. /*
  1069. * Word4
  1070. */
  1071. #define RXD_W4_IV FIELD32(0xffffffff)
  1072. /*
  1073. * Word5
  1074. */
  1075. #define RXD_W5_EIV FIELD32(0xffffffff)
  1076. /*
  1077. * Word6-9: Key
  1078. */
  1079. #define RXD_W6_KEY FIELD32(0xffffffff)
  1080. #define RXD_W7_KEY FIELD32(0xffffffff)
  1081. #define RXD_W8_KEY FIELD32(0xffffffff)
  1082. #define RXD_W9_KEY FIELD32(0xffffffff)
  1083. /*
  1084. * Word10
  1085. */
  1086. #define RXD_W10_DROP FIELD32(0x00000001)
  1087. /*
  1088. * Macro's for converting txpower from EEPROM to mac80211 value
  1089. * and from mac80211 value to register value.
  1090. */
  1091. #define MIN_TXPOWER 0
  1092. #define MAX_TXPOWER 31
  1093. #define DEFAULT_TXPOWER 24
  1094. #define TXPOWER_FROM_DEV(__txpower) \
  1095. (((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower)
  1096. #define TXPOWER_TO_DEV(__txpower) \
  1097. clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER)
  1098. #endif /* RT2500PCI_H */