rt2500pci.h 35 KB

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