rt2500pci.h 35 KB

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