rt2500pci.h 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235
  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, see <http://www.gnu.org/licenses/>.
  14. */
  15. /*
  16. Module: rt2500pci
  17. Abstract: Data structures and registers for the rt2500pci module.
  18. Supported chipsets: RT2560.
  19. */
  20. #ifndef RT2500PCI_H
  21. #define RT2500PCI_H
  22. /*
  23. * RF chip defines.
  24. */
  25. #define RF2522 0x0000
  26. #define RF2523 0x0001
  27. #define RF2524 0x0002
  28. #define RF2525 0x0003
  29. #define RF2525E 0x0004
  30. #define RF5222 0x0010
  31. /*
  32. * RT2560 version
  33. */
  34. #define RT2560_VERSION_B 2
  35. #define RT2560_VERSION_C 3
  36. #define RT2560_VERSION_D 4
  37. /*
  38. * Signal information.
  39. * Default offset is required for RSSI <-> dBm conversion.
  40. */
  41. #define DEFAULT_RSSI_OFFSET 121
  42. /*
  43. * Register layout information.
  44. */
  45. #define CSR_REG_BASE 0x0000
  46. #define CSR_REG_SIZE 0x0174
  47. #define EEPROM_BASE 0x0000
  48. #define EEPROM_SIZE 0x0200
  49. #define BBP_BASE 0x0000
  50. #define BBP_SIZE 0x0040
  51. #define RF_BASE 0x0004
  52. #define RF_SIZE 0x0010
  53. /*
  54. * Number of TX queues.
  55. */
  56. #define NUM_TX_QUEUES 2
  57. /*
  58. * Control/Status Registers(CSR).
  59. * Some values are set in TU, whereas 1 TU == 1024 us.
  60. */
  61. /*
  62. * CSR0: ASIC revision number.
  63. */
  64. #define CSR0 0x0000
  65. #define CSR0_REVISION FIELD32(0x0000ffff)
  66. /*
  67. * CSR1: System control register.
  68. * SOFT_RESET: Software reset, 1: reset, 0: normal.
  69. * BBP_RESET: Hardware reset, 1: reset, 0, release.
  70. * HOST_READY: Host ready after initialization.
  71. */
  72. #define CSR1 0x0004
  73. #define CSR1_SOFT_RESET FIELD32(0x00000001)
  74. #define CSR1_BBP_RESET FIELD32(0x00000002)
  75. #define CSR1_HOST_READY FIELD32(0x00000004)
  76. /*
  77. * CSR2: System admin status register (invalid).
  78. */
  79. #define CSR2 0x0008
  80. /*
  81. * CSR3: STA MAC address register 0.
  82. */
  83. #define CSR3 0x000c
  84. #define CSR3_BYTE0 FIELD32(0x000000ff)
  85. #define CSR3_BYTE1 FIELD32(0x0000ff00)
  86. #define CSR3_BYTE2 FIELD32(0x00ff0000)
  87. #define CSR3_BYTE3 FIELD32(0xff000000)
  88. /*
  89. * CSR4: STA MAC address register 1.
  90. */
  91. #define CSR4 0x0010
  92. #define CSR4_BYTE4 FIELD32(0x000000ff)
  93. #define CSR4_BYTE5 FIELD32(0x0000ff00)
  94. /*
  95. * CSR5: BSSID register 0.
  96. */
  97. #define CSR5 0x0014
  98. #define CSR5_BYTE0 FIELD32(0x000000ff)
  99. #define CSR5_BYTE1 FIELD32(0x0000ff00)
  100. #define CSR5_BYTE2 FIELD32(0x00ff0000)
  101. #define CSR5_BYTE3 FIELD32(0xff000000)
  102. /*
  103. * CSR6: BSSID register 1.
  104. */
  105. #define CSR6 0x0018
  106. #define CSR6_BYTE4 FIELD32(0x000000ff)
  107. #define CSR6_BYTE5 FIELD32(0x0000ff00)
  108. /*
  109. * CSR7: Interrupt source register.
  110. * Write 1 to clear.
  111. * TBCN_EXPIRE: Beacon timer expired interrupt.
  112. * TWAKE_EXPIRE: Wakeup timer expired interrupt.
  113. * TATIMW_EXPIRE: Timer of atim window expired interrupt.
  114. * TXDONE_TXRING: Tx ring transmit done interrupt.
  115. * TXDONE_ATIMRING: Atim ring transmit done interrupt.
  116. * TXDONE_PRIORING: Priority ring transmit done interrupt.
  117. * RXDONE: Receive done interrupt.
  118. * DECRYPTION_DONE: Decryption done interrupt.
  119. * ENCRYPTION_DONE: Encryption done interrupt.
  120. * UART1_TX_TRESHOLD: UART1 TX reaches threshold.
  121. * UART1_RX_TRESHOLD: UART1 RX reaches threshold.
  122. * UART1_IDLE_TRESHOLD: UART1 IDLE over threshold.
  123. * UART1_TX_BUFF_ERROR: UART1 TX buffer error.
  124. * UART1_RX_BUFF_ERROR: UART1 RX buffer error.
  125. * UART2_TX_TRESHOLD: UART2 TX reaches threshold.
  126. * UART2_RX_TRESHOLD: UART2 RX reaches threshold.
  127. * UART2_IDLE_TRESHOLD: UART2 IDLE over threshold.
  128. * UART2_TX_BUFF_ERROR: UART2 TX buffer error.
  129. * UART2_RX_BUFF_ERROR: UART2 RX buffer error.
  130. * TIMER_CSR3_EXPIRE: TIMECSR3 timer expired (802.1H quiet period).
  131. */
  132. #define CSR7 0x001c
  133. #define CSR7_TBCN_EXPIRE FIELD32(0x00000001)
  134. #define CSR7_TWAKE_EXPIRE FIELD32(0x00000002)
  135. #define CSR7_TATIMW_EXPIRE FIELD32(0x00000004)
  136. #define CSR7_TXDONE_TXRING FIELD32(0x00000008)
  137. #define CSR7_TXDONE_ATIMRING FIELD32(0x00000010)
  138. #define CSR7_TXDONE_PRIORING FIELD32(0x00000020)
  139. #define CSR7_RXDONE FIELD32(0x00000040)
  140. #define CSR7_DECRYPTION_DONE FIELD32(0x00000080)
  141. #define CSR7_ENCRYPTION_DONE FIELD32(0x00000100)
  142. #define CSR7_UART1_TX_TRESHOLD FIELD32(0x00000200)
  143. #define CSR7_UART1_RX_TRESHOLD FIELD32(0x00000400)
  144. #define CSR7_UART1_IDLE_TRESHOLD FIELD32(0x00000800)
  145. #define CSR7_UART1_TX_BUFF_ERROR FIELD32(0x00001000)
  146. #define CSR7_UART1_RX_BUFF_ERROR FIELD32(0x00002000)
  147. #define CSR7_UART2_TX_TRESHOLD FIELD32(0x00004000)
  148. #define CSR7_UART2_RX_TRESHOLD FIELD32(0x00008000)
  149. #define CSR7_UART2_IDLE_TRESHOLD FIELD32(0x00010000)
  150. #define CSR7_UART2_TX_BUFF_ERROR FIELD32(0x00020000)
  151. #define CSR7_UART2_RX_BUFF_ERROR FIELD32(0x00040000)
  152. #define CSR7_TIMER_CSR3_EXPIRE FIELD32(0x00080000)
  153. /*
  154. * CSR8: Interrupt mask register.
  155. * Write 1 to mask interrupt.
  156. * TBCN_EXPIRE: Beacon timer expired interrupt.
  157. * TWAKE_EXPIRE: Wakeup timer expired interrupt.
  158. * TATIMW_EXPIRE: Timer of atim window expired interrupt.
  159. * TXDONE_TXRING: Tx ring transmit done interrupt.
  160. * TXDONE_ATIMRING: Atim ring transmit done interrupt.
  161. * TXDONE_PRIORING: Priority ring transmit done interrupt.
  162. * RXDONE: Receive done interrupt.
  163. * DECRYPTION_DONE: Decryption done interrupt.
  164. * ENCRYPTION_DONE: Encryption done interrupt.
  165. * UART1_TX_TRESHOLD: UART1 TX reaches threshold.
  166. * UART1_RX_TRESHOLD: UART1 RX reaches threshold.
  167. * UART1_IDLE_TRESHOLD: UART1 IDLE over threshold.
  168. * UART1_TX_BUFF_ERROR: UART1 TX buffer error.
  169. * UART1_RX_BUFF_ERROR: UART1 RX buffer error.
  170. * UART2_TX_TRESHOLD: UART2 TX reaches threshold.
  171. * UART2_RX_TRESHOLD: UART2 RX reaches threshold.
  172. * UART2_IDLE_TRESHOLD: UART2 IDLE over threshold.
  173. * UART2_TX_BUFF_ERROR: UART2 TX buffer error.
  174. * UART2_RX_BUFF_ERROR: UART2 RX buffer error.
  175. * TIMER_CSR3_EXPIRE: TIMECSR3 timer expired (802.1H quiet period).
  176. */
  177. #define CSR8 0x0020
  178. #define CSR8_TBCN_EXPIRE FIELD32(0x00000001)
  179. #define CSR8_TWAKE_EXPIRE FIELD32(0x00000002)
  180. #define CSR8_TATIMW_EXPIRE FIELD32(0x00000004)
  181. #define CSR8_TXDONE_TXRING FIELD32(0x00000008)
  182. #define CSR8_TXDONE_ATIMRING FIELD32(0x00000010)
  183. #define CSR8_TXDONE_PRIORING FIELD32(0x00000020)
  184. #define CSR8_RXDONE FIELD32(0x00000040)
  185. #define CSR8_DECRYPTION_DONE FIELD32(0x00000080)
  186. #define CSR8_ENCRYPTION_DONE FIELD32(0x00000100)
  187. #define CSR8_UART1_TX_TRESHOLD FIELD32(0x00000200)
  188. #define CSR8_UART1_RX_TRESHOLD FIELD32(0x00000400)
  189. #define CSR8_UART1_IDLE_TRESHOLD FIELD32(0x00000800)
  190. #define CSR8_UART1_TX_BUFF_ERROR FIELD32(0x00001000)
  191. #define CSR8_UART1_RX_BUFF_ERROR FIELD32(0x00002000)
  192. #define CSR8_UART2_TX_TRESHOLD FIELD32(0x00004000)
  193. #define CSR8_UART2_RX_TRESHOLD FIELD32(0x00008000)
  194. #define CSR8_UART2_IDLE_TRESHOLD FIELD32(0x00010000)
  195. #define CSR8_UART2_TX_BUFF_ERROR FIELD32(0x00020000)
  196. #define CSR8_UART2_RX_BUFF_ERROR FIELD32(0x00040000)
  197. #define CSR8_TIMER_CSR3_EXPIRE FIELD32(0x00080000)
  198. /*
  199. * CSR9: Maximum frame length register.
  200. * MAX_FRAME_UNIT: Maximum frame length in 128b unit, default: 12.
  201. */
  202. #define CSR9 0x0024
  203. #define CSR9_MAX_FRAME_UNIT FIELD32(0x00000f80)
  204. /*
  205. * SECCSR0: WEP control register.
  206. * KICK_DECRYPT: Kick decryption engine, self-clear.
  207. * ONE_SHOT: 0: ring mode, 1: One shot only mode.
  208. * DESC_ADDRESS: Descriptor physical address of frame.
  209. */
  210. #define SECCSR0 0x0028
  211. #define SECCSR0_KICK_DECRYPT FIELD32(0x00000001)
  212. #define SECCSR0_ONE_SHOT FIELD32(0x00000002)
  213. #define SECCSR0_DESC_ADDRESS FIELD32(0xfffffffc)
  214. /*
  215. * CSR11: Back-off control register.
  216. * CWMIN: CWmin. Default cwmin is 31 (2^5 - 1).
  217. * CWMAX: CWmax. Default cwmax is 1023 (2^10 - 1).
  218. * SLOT_TIME: Slot time, default is 20us for 802.11b
  219. * CW_SELECT: CWmin/CWmax selection, 1: Register, 0: TXD.
  220. * LONG_RETRY: Long retry count.
  221. * SHORT_RETRY: Short retry count.
  222. */
  223. #define CSR11 0x002c
  224. #define CSR11_CWMIN FIELD32(0x0000000f)
  225. #define CSR11_CWMAX FIELD32(0x000000f0)
  226. #define CSR11_SLOT_TIME FIELD32(0x00001f00)
  227. #define CSR11_CW_SELECT FIELD32(0x00002000)
  228. #define CSR11_LONG_RETRY FIELD32(0x00ff0000)
  229. #define CSR11_SHORT_RETRY FIELD32(0xff000000)
  230. /*
  231. * CSR12: Synchronization configuration register 0.
  232. * All units in 1/16 TU.
  233. * BEACON_INTERVAL: Beacon interval, default is 100 TU.
  234. * CFP_MAX_DURATION: Cfp maximum duration, default is 100 TU.
  235. */
  236. #define CSR12 0x0030
  237. #define CSR12_BEACON_INTERVAL FIELD32(0x0000ffff)
  238. #define CSR12_CFP_MAX_DURATION FIELD32(0xffff0000)
  239. /*
  240. * CSR13: Synchronization configuration register 1.
  241. * All units in 1/16 TU.
  242. * ATIMW_DURATION: Atim window duration.
  243. * CFP_PERIOD: Cfp period, default is 0 TU.
  244. */
  245. #define CSR13 0x0034
  246. #define CSR13_ATIMW_DURATION FIELD32(0x0000ffff)
  247. #define CSR13_CFP_PERIOD FIELD32(0x00ff0000)
  248. /*
  249. * CSR14: Synchronization control register.
  250. * TSF_COUNT: Enable tsf auto counting.
  251. * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode.
  252. * TBCN: Enable tbcn with reload value.
  253. * TCFP: Enable tcfp & cfp / cp switching.
  254. * TATIMW: Enable tatimw & atim window switching.
  255. * BEACON_GEN: Enable beacon generator.
  256. * CFP_COUNT_PRELOAD: Cfp count preload value.
  257. * TBCM_PRELOAD: Tbcn preload value in units of 64us.
  258. */
  259. #define CSR14 0x0038
  260. #define CSR14_TSF_COUNT FIELD32(0x00000001)
  261. #define CSR14_TSF_SYNC FIELD32(0x00000006)
  262. #define CSR14_TBCN FIELD32(0x00000008)
  263. #define CSR14_TCFP FIELD32(0x00000010)
  264. #define CSR14_TATIMW FIELD32(0x00000020)
  265. #define CSR14_BEACON_GEN FIELD32(0x00000040)
  266. #define CSR14_CFP_COUNT_PRELOAD FIELD32(0x0000ff00)
  267. #define CSR14_TBCM_PRELOAD FIELD32(0xffff0000)
  268. /*
  269. * CSR15: Synchronization status register.
  270. * CFP: ASIC is in contention-free period.
  271. * ATIMW: ASIC is in ATIM window.
  272. * BEACON_SENT: Beacon is send.
  273. */
  274. #define CSR15 0x003c
  275. #define CSR15_CFP FIELD32(0x00000001)
  276. #define CSR15_ATIMW FIELD32(0x00000002)
  277. #define CSR15_BEACON_SENT FIELD32(0x00000004)
  278. /*
  279. * CSR16: TSF timer register 0.
  280. */
  281. #define CSR16 0x0040
  282. #define CSR16_LOW_TSFTIMER FIELD32(0xffffffff)
  283. /*
  284. * CSR17: TSF timer register 1.
  285. */
  286. #define CSR17 0x0044
  287. #define CSR17_HIGH_TSFTIMER FIELD32(0xffffffff)
  288. /*
  289. * CSR18: IFS timer register 0.
  290. * SIFS: Sifs, default is 10 us.
  291. * PIFS: Pifs, default is 30 us.
  292. */
  293. #define CSR18 0x0048
  294. #define CSR18_SIFS FIELD32(0x000001ff)
  295. #define CSR18_PIFS FIELD32(0x001f0000)
  296. /*
  297. * CSR19: IFS timer register 1.
  298. * DIFS: Difs, default is 50 us.
  299. * EIFS: Eifs, default is 364 us.
  300. */
  301. #define CSR19 0x004c
  302. #define CSR19_DIFS FIELD32(0x0000ffff)
  303. #define CSR19_EIFS FIELD32(0xffff0000)
  304. /*
  305. * CSR20: Wakeup timer register.
  306. * DELAY_AFTER_TBCN: Delay after tbcn expired in units of 1/16 TU.
  307. * TBCN_BEFORE_WAKEUP: Number of beacon before wakeup.
  308. * AUTOWAKE: Enable auto wakeup / sleep mechanism.
  309. */
  310. #define CSR20 0x0050
  311. #define CSR20_DELAY_AFTER_TBCN FIELD32(0x0000ffff)
  312. #define CSR20_TBCN_BEFORE_WAKEUP FIELD32(0x00ff0000)
  313. #define CSR20_AUTOWAKE FIELD32(0x01000000)
  314. /*
  315. * CSR21: EEPROM control register.
  316. * RELOAD: Write 1 to reload eeprom content.
  317. * TYPE_93C46: 1: 93c46, 0:93c66.
  318. */
  319. #define CSR21 0x0054
  320. #define CSR21_RELOAD FIELD32(0x00000001)
  321. #define CSR21_EEPROM_DATA_CLOCK FIELD32(0x00000002)
  322. #define CSR21_EEPROM_CHIP_SELECT FIELD32(0x00000004)
  323. #define CSR21_EEPROM_DATA_IN FIELD32(0x00000008)
  324. #define CSR21_EEPROM_DATA_OUT FIELD32(0x00000010)
  325. #define CSR21_TYPE_93C46 FIELD32(0x00000020)
  326. /*
  327. * CSR22: CFP control register.
  328. * CFP_DURATION_REMAIN: Cfp duration remain, in units of TU.
  329. * RELOAD_CFP_DURATION: Write 1 to reload cfp duration remain.
  330. */
  331. #define CSR22 0x0058
  332. #define CSR22_CFP_DURATION_REMAIN FIELD32(0x0000ffff)
  333. #define CSR22_RELOAD_CFP_DURATION FIELD32(0x00010000)
  334. /*
  335. * Transmit related CSRs.
  336. * Some values are set in TU, whereas 1 TU == 1024 us.
  337. */
  338. /*
  339. * TXCSR0: TX Control Register.
  340. * KICK_TX: Kick tx ring.
  341. * KICK_ATIM: Kick atim ring.
  342. * KICK_PRIO: Kick priority ring.
  343. * ABORT: Abort all transmit related ring operation.
  344. */
  345. #define TXCSR0 0x0060
  346. #define TXCSR0_KICK_TX FIELD32(0x00000001)
  347. #define TXCSR0_KICK_ATIM FIELD32(0x00000002)
  348. #define TXCSR0_KICK_PRIO FIELD32(0x00000004)
  349. #define TXCSR0_ABORT FIELD32(0x00000008)
  350. /*
  351. * TXCSR1: TX Configuration Register.
  352. * ACK_TIMEOUT: Ack timeout, default = sifs + 2*slottime + acktime @ 1mbps.
  353. * ACK_CONSUME_TIME: Ack consume time, default = sifs + acktime @ 1mbps.
  354. * TSF_OFFSET: Insert tsf offset.
  355. * AUTORESPONDER: Enable auto responder which include ack & cts.
  356. */
  357. #define TXCSR1 0x0064
  358. #define TXCSR1_ACK_TIMEOUT FIELD32(0x000001ff)
  359. #define TXCSR1_ACK_CONSUME_TIME FIELD32(0x0003fe00)
  360. #define TXCSR1_TSF_OFFSET FIELD32(0x00fc0000)
  361. #define TXCSR1_AUTORESPONDER FIELD32(0x01000000)
  362. /*
  363. * TXCSR2: Tx descriptor configuration register.
  364. * TXD_SIZE: Tx descriptor size, default is 48.
  365. * NUM_TXD: Number of tx entries in ring.
  366. * NUM_ATIM: Number of atim entries in ring.
  367. * NUM_PRIO: Number of priority entries in ring.
  368. */
  369. #define TXCSR2 0x0068
  370. #define TXCSR2_TXD_SIZE FIELD32(0x000000ff)
  371. #define TXCSR2_NUM_TXD FIELD32(0x0000ff00)
  372. #define TXCSR2_NUM_ATIM FIELD32(0x00ff0000)
  373. #define TXCSR2_NUM_PRIO FIELD32(0xff000000)
  374. /*
  375. * TXCSR3: TX Ring Base address register.
  376. */
  377. #define TXCSR3 0x006c
  378. #define TXCSR3_TX_RING_REGISTER FIELD32(0xffffffff)
  379. /*
  380. * TXCSR4: TX Atim Ring Base address register.
  381. */
  382. #define TXCSR4 0x0070
  383. #define TXCSR4_ATIM_RING_REGISTER FIELD32(0xffffffff)
  384. /*
  385. * TXCSR5: TX Prio Ring Base address register.
  386. */
  387. #define TXCSR5 0x0074
  388. #define TXCSR5_PRIO_RING_REGISTER FIELD32(0xffffffff)
  389. /*
  390. * TXCSR6: Beacon Base address register.
  391. */
  392. #define TXCSR6 0x0078
  393. #define TXCSR6_BEACON_RING_REGISTER FIELD32(0xffffffff)
  394. /*
  395. * TXCSR7: Auto responder control register.
  396. * AR_POWERMANAGEMENT: Auto responder power management bit.
  397. */
  398. #define TXCSR7 0x007c
  399. #define TXCSR7_AR_POWERMANAGEMENT FIELD32(0x00000001)
  400. /*
  401. * TXCSR8: CCK Tx BBP register.
  402. */
  403. #define TXCSR8 0x0098
  404. #define TXCSR8_BBP_ID0 FIELD32(0x0000007f)
  405. #define TXCSR8_BBP_ID0_VALID FIELD32(0x00000080)
  406. #define TXCSR8_BBP_ID1 FIELD32(0x00007f00)
  407. #define TXCSR8_BBP_ID1_VALID FIELD32(0x00008000)
  408. #define TXCSR8_BBP_ID2 FIELD32(0x007f0000)
  409. #define TXCSR8_BBP_ID2_VALID FIELD32(0x00800000)
  410. #define TXCSR8_BBP_ID3 FIELD32(0x7f000000)
  411. #define TXCSR8_BBP_ID3_VALID FIELD32(0x80000000)
  412. /*
  413. * TXCSR9: OFDM TX BBP registers
  414. * OFDM_SIGNAL: BBP rate field address for OFDM.
  415. * OFDM_SERVICE: BBP service field address for OFDM.
  416. * OFDM_LENGTH_LOW: BBP length low byte address for OFDM.
  417. * OFDM_LENGTH_HIGH: BBP length high byte address for OFDM.
  418. */
  419. #define TXCSR9 0x0094
  420. #define TXCSR9_OFDM_RATE FIELD32(0x000000ff)
  421. #define TXCSR9_OFDM_SERVICE FIELD32(0x0000ff00)
  422. #define TXCSR9_OFDM_LENGTH_LOW FIELD32(0x00ff0000)
  423. #define TXCSR9_OFDM_LENGTH_HIGH FIELD32(0xff000000)
  424. /*
  425. * Receive related CSRs.
  426. * Some values are set in TU, whereas 1 TU == 1024 us.
  427. */
  428. /*
  429. * RXCSR0: RX Control Register.
  430. * DISABLE_RX: Disable rx engine.
  431. * DROP_CRC: Drop crc error.
  432. * DROP_PHYSICAL: Drop physical error.
  433. * DROP_CONTROL: Drop control frame.
  434. * DROP_NOT_TO_ME: Drop not to me unicast frame.
  435. * DROP_TODS: Drop frame tods bit is true.
  436. * DROP_VERSION_ERROR: Drop version error frame.
  437. * PASS_CRC: Pass all packets with crc attached.
  438. * PASS_CRC: Pass all packets with crc attached.
  439. * PASS_PLCP: Pass all packets with 4 bytes PLCP attached.
  440. * DROP_MCAST: Drop multicast frames.
  441. * DROP_BCAST: Drop broadcast frames.
  442. * ENABLE_QOS: Accept QOS data frame and parse QOS field.
  443. */
  444. #define RXCSR0 0x0080
  445. #define RXCSR0_DISABLE_RX FIELD32(0x00000001)
  446. #define RXCSR0_DROP_CRC FIELD32(0x00000002)
  447. #define RXCSR0_DROP_PHYSICAL FIELD32(0x00000004)
  448. #define RXCSR0_DROP_CONTROL FIELD32(0x00000008)
  449. #define RXCSR0_DROP_NOT_TO_ME FIELD32(0x00000010)
  450. #define RXCSR0_DROP_TODS FIELD32(0x00000020)
  451. #define RXCSR0_DROP_VERSION_ERROR FIELD32(0x00000040)
  452. #define RXCSR0_PASS_CRC FIELD32(0x00000080)
  453. #define RXCSR0_PASS_PLCP FIELD32(0x00000100)
  454. #define RXCSR0_DROP_MCAST FIELD32(0x00000200)
  455. #define RXCSR0_DROP_BCAST FIELD32(0x00000400)
  456. #define RXCSR0_ENABLE_QOS FIELD32(0x00000800)
  457. /*
  458. * RXCSR1: RX descriptor configuration register.
  459. * RXD_SIZE: Rx descriptor size, default is 32b.
  460. * NUM_RXD: Number of rx entries in ring.
  461. */
  462. #define RXCSR1 0x0084
  463. #define RXCSR1_RXD_SIZE FIELD32(0x000000ff)
  464. #define RXCSR1_NUM_RXD FIELD32(0x0000ff00)
  465. /*
  466. * RXCSR2: RX Ring base address register.
  467. */
  468. #define RXCSR2 0x0088
  469. #define RXCSR2_RX_RING_REGISTER FIELD32(0xffffffff)
  470. /*
  471. * RXCSR3: BBP ID register for Rx operation.
  472. * BBP_ID#: BBP register # id.
  473. * BBP_ID#_VALID: BBP register # id is valid or not.
  474. */
  475. #define RXCSR3 0x0090
  476. #define RXCSR3_BBP_ID0 FIELD32(0x0000007f)
  477. #define RXCSR3_BBP_ID0_VALID FIELD32(0x00000080)
  478. #define RXCSR3_BBP_ID1 FIELD32(0x00007f00)
  479. #define RXCSR3_BBP_ID1_VALID FIELD32(0x00008000)
  480. #define RXCSR3_BBP_ID2 FIELD32(0x007f0000)
  481. #define RXCSR3_BBP_ID2_VALID FIELD32(0x00800000)
  482. #define RXCSR3_BBP_ID3 FIELD32(0x7f000000)
  483. #define RXCSR3_BBP_ID3_VALID FIELD32(0x80000000)
  484. /*
  485. * ARCSR1: Auto Responder PLCP config register 1.
  486. * AR_BBP_DATA#: Auto responder BBP register # data.
  487. * AR_BBP_ID#: Auto responder BBP register # Id.
  488. */
  489. #define ARCSR1 0x009c
  490. #define ARCSR1_AR_BBP_DATA2 FIELD32(0x000000ff)
  491. #define ARCSR1_AR_BBP_ID2 FIELD32(0x0000ff00)
  492. #define ARCSR1_AR_BBP_DATA3 FIELD32(0x00ff0000)
  493. #define ARCSR1_AR_BBP_ID3 FIELD32(0xff000000)
  494. /*
  495. * Miscellaneous Registers.
  496. * Some values are set in TU, whereas 1 TU == 1024 us.
  497. */
  498. /*
  499. * PCICSR: PCI control register.
  500. * BIG_ENDIAN: 1: big endian, 0: little endian.
  501. * RX_TRESHOLD: Rx threshold in dw to start pci access
  502. * 0: 16dw (default), 1: 8dw, 2: 4dw, 3: 32dw.
  503. * TX_TRESHOLD: Tx threshold in dw to start pci access
  504. * 0: 0dw (default), 1: 1dw, 2: 4dw, 3: forward.
  505. * BURST_LENTH: Pci burst length 0: 4dw (default, 1: 8dw, 2: 16dw, 3:32dw.
  506. * ENABLE_CLK: Enable clk_run, pci clock can't going down to non-operational.
  507. * READ_MULTIPLE: Enable memory read multiple.
  508. * WRITE_INVALID: Enable memory write & invalid.
  509. */
  510. #define PCICSR 0x008c
  511. #define PCICSR_BIG_ENDIAN FIELD32(0x00000001)
  512. #define PCICSR_RX_TRESHOLD FIELD32(0x00000006)
  513. #define PCICSR_TX_TRESHOLD FIELD32(0x00000018)
  514. #define PCICSR_BURST_LENTH FIELD32(0x00000060)
  515. #define PCICSR_ENABLE_CLK FIELD32(0x00000080)
  516. #define PCICSR_READ_MULTIPLE FIELD32(0x00000100)
  517. #define PCICSR_WRITE_INVALID FIELD32(0x00000200)
  518. /*
  519. * CNT0: FCS error count.
  520. * FCS_ERROR: FCS error count, cleared when read.
  521. */
  522. #define CNT0 0x00a0
  523. #define CNT0_FCS_ERROR FIELD32(0x0000ffff)
  524. /*
  525. * Statistic Register.
  526. * CNT1: PLCP error count.
  527. * CNT2: Long error count.
  528. */
  529. #define TIMECSR2 0x00a8
  530. #define CNT1 0x00ac
  531. #define CNT2 0x00b0
  532. #define TIMECSR3 0x00b4
  533. /*
  534. * CNT3: CCA false alarm count.
  535. */
  536. #define CNT3 0x00b8
  537. #define CNT3_FALSE_CCA FIELD32(0x0000ffff)
  538. /*
  539. * Statistic Register.
  540. * CNT4: Rx FIFO overflow count.
  541. * CNT5: Tx FIFO underrun count.
  542. */
  543. #define CNT4 0x00bc
  544. #define CNT5 0x00c0
  545. /*
  546. * Baseband Control Register.
  547. */
  548. /*
  549. * PWRCSR0: Power mode configuration register.
  550. */
  551. #define PWRCSR0 0x00c4
  552. /*
  553. * Power state transition time registers.
  554. */
  555. #define PSCSR0 0x00c8
  556. #define PSCSR1 0x00cc
  557. #define PSCSR2 0x00d0
  558. #define PSCSR3 0x00d4
  559. /*
  560. * PWRCSR1: Manual power control / status register.
  561. * Allowed state: 0 deep_sleep, 1: sleep, 2: standby, 3: awake.
  562. * SET_STATE: Set state. Write 1 to trigger, self cleared.
  563. * BBP_DESIRE_STATE: BBP desired state.
  564. * RF_DESIRE_STATE: RF desired state.
  565. * BBP_CURR_STATE: BBP current state.
  566. * RF_CURR_STATE: RF current state.
  567. * PUT_TO_SLEEP: Put to sleep. Write 1 to trigger, self cleared.
  568. */
  569. #define PWRCSR1 0x00d8
  570. #define PWRCSR1_SET_STATE FIELD32(0x00000001)
  571. #define PWRCSR1_BBP_DESIRE_STATE FIELD32(0x00000006)
  572. #define PWRCSR1_RF_DESIRE_STATE FIELD32(0x00000018)
  573. #define PWRCSR1_BBP_CURR_STATE FIELD32(0x00000060)
  574. #define PWRCSR1_RF_CURR_STATE FIELD32(0x00000180)
  575. #define PWRCSR1_PUT_TO_SLEEP FIELD32(0x00000200)
  576. /*
  577. * TIMECSR: Timer control register.
  578. * US_COUNT: 1 us timer count in units of clock cycles.
  579. * US_64_COUNT: 64 us timer count in units of 1 us timer.
  580. * BEACON_EXPECT: Beacon expect window.
  581. */
  582. #define TIMECSR 0x00dc
  583. #define TIMECSR_US_COUNT FIELD32(0x000000ff)
  584. #define TIMECSR_US_64_COUNT FIELD32(0x0000ff00)
  585. #define TIMECSR_BEACON_EXPECT FIELD32(0x00070000)
  586. /*
  587. * MACCSR0: MAC configuration register 0.
  588. */
  589. #define MACCSR0 0x00e0
  590. /*
  591. * MACCSR1: MAC configuration register 1.
  592. * KICK_RX: Kick one-shot rx in one-shot rx mode.
  593. * ONESHOT_RXMODE: Enable one-shot rx mode for debugging.
  594. * BBPRX_RESET_MODE: Ralink bbp rx reset mode.
  595. * AUTO_TXBBP: Auto tx logic access bbp control register.
  596. * AUTO_RXBBP: Auto rx logic access bbp control register.
  597. * LOOPBACK: Loopback mode. 0: normal, 1: internal, 2: external, 3:rsvd.
  598. * INTERSIL_IF: Intersil if calibration pin.
  599. */
  600. #define MACCSR1 0x00e4
  601. #define MACCSR1_KICK_RX FIELD32(0x00000001)
  602. #define MACCSR1_ONESHOT_RXMODE FIELD32(0x00000002)
  603. #define MACCSR1_BBPRX_RESET_MODE FIELD32(0x00000004)
  604. #define MACCSR1_AUTO_TXBBP FIELD32(0x00000008)
  605. #define MACCSR1_AUTO_RXBBP FIELD32(0x00000010)
  606. #define MACCSR1_LOOPBACK FIELD32(0x00000060)
  607. #define MACCSR1_INTERSIL_IF FIELD32(0x00000080)
  608. /*
  609. * RALINKCSR: Ralink Rx auto-reset BBCR.
  610. * AR_BBP_DATA#: Auto reset BBP register # data.
  611. * AR_BBP_ID#: Auto reset BBP register # id.
  612. */
  613. #define RALINKCSR 0x00e8
  614. #define RALINKCSR_AR_BBP_DATA0 FIELD32(0x000000ff)
  615. #define RALINKCSR_AR_BBP_ID0 FIELD32(0x00007f00)
  616. #define RALINKCSR_AR_BBP_VALID0 FIELD32(0x00008000)
  617. #define RALINKCSR_AR_BBP_DATA1 FIELD32(0x00ff0000)
  618. #define RALINKCSR_AR_BBP_ID1 FIELD32(0x7f000000)
  619. #define RALINKCSR_AR_BBP_VALID1 FIELD32(0x80000000)
  620. /*
  621. * BCNCSR: Beacon interval control register.
  622. * CHANGE: Write one to change beacon interval.
  623. * DELTATIME: The delta time value.
  624. * NUM_BEACON: Number of beacon according to mode.
  625. * MODE: Please refer to asic specs.
  626. * PLUS: Plus or minus delta time value.
  627. */
  628. #define BCNCSR 0x00ec
  629. #define BCNCSR_CHANGE FIELD32(0x00000001)
  630. #define BCNCSR_DELTATIME FIELD32(0x0000001e)
  631. #define BCNCSR_NUM_BEACON FIELD32(0x00001fe0)
  632. #define BCNCSR_MODE FIELD32(0x00006000)
  633. #define BCNCSR_PLUS FIELD32(0x00008000)
  634. /*
  635. * BBP / RF / IF Control Register.
  636. */
  637. /*
  638. * BBPCSR: BBP serial control register.
  639. * VALUE: Register value to program into BBP.
  640. * REGNUM: Selected BBP register.
  641. * BUSY: 1: asic is busy execute BBP programming.
  642. * WRITE_CONTROL: 1: write BBP, 0: read BBP.
  643. */
  644. #define BBPCSR 0x00f0
  645. #define BBPCSR_VALUE FIELD32(0x000000ff)
  646. #define BBPCSR_REGNUM FIELD32(0x00007f00)
  647. #define BBPCSR_BUSY FIELD32(0x00008000)
  648. #define BBPCSR_WRITE_CONTROL FIELD32(0x00010000)
  649. /*
  650. * RFCSR: RF serial control register.
  651. * VALUE: Register value + id to program into rf/if.
  652. * NUMBER_OF_BITS: Number of bits used in value (i:20, rfmd:22).
  653. * IF_SELECT: Chip to program: 0: rf, 1: if.
  654. * PLL_LD: Rf pll_ld status.
  655. * BUSY: 1: asic is busy execute rf programming.
  656. */
  657. #define RFCSR 0x00f4
  658. #define RFCSR_VALUE FIELD32(0x00ffffff)
  659. #define RFCSR_NUMBER_OF_BITS FIELD32(0x1f000000)
  660. #define RFCSR_IF_SELECT FIELD32(0x20000000)
  661. #define RFCSR_PLL_LD FIELD32(0x40000000)
  662. #define RFCSR_BUSY FIELD32(0x80000000)
  663. /*
  664. * LEDCSR: LED control register.
  665. * ON_PERIOD: On period, default 70ms.
  666. * OFF_PERIOD: Off period, default 30ms.
  667. * LINK: 0: linkoff, 1: linkup.
  668. * ACTIVITY: 0: idle, 1: active.
  669. * LINK_POLARITY: 0: active low, 1: active high.
  670. * ACTIVITY_POLARITY: 0: active low, 1: active high.
  671. * LED_DEFAULT: LED state for "enable" 0: ON, 1: OFF.
  672. */
  673. #define LEDCSR 0x00f8
  674. #define LEDCSR_ON_PERIOD FIELD32(0x000000ff)
  675. #define LEDCSR_OFF_PERIOD FIELD32(0x0000ff00)
  676. #define LEDCSR_LINK FIELD32(0x00010000)
  677. #define LEDCSR_ACTIVITY FIELD32(0x00020000)
  678. #define LEDCSR_LINK_POLARITY FIELD32(0x00040000)
  679. #define LEDCSR_ACTIVITY_POLARITY FIELD32(0x00080000)
  680. #define LEDCSR_LED_DEFAULT FIELD32(0x00100000)
  681. /*
  682. * SECCSR3: AES control register.
  683. */
  684. #define SECCSR3 0x00fc
  685. /*
  686. * ASIC pointer information.
  687. * RXPTR: Current RX ring address.
  688. * TXPTR: Current Tx ring address.
  689. * PRIPTR: Current Priority ring address.
  690. * ATIMPTR: Current ATIM ring address.
  691. */
  692. #define RXPTR 0x0100
  693. #define TXPTR 0x0104
  694. #define PRIPTR 0x0108
  695. #define ATIMPTR 0x010c
  696. /*
  697. * TXACKCSR0: TX ACK timeout.
  698. */
  699. #define TXACKCSR0 0x0110
  700. /*
  701. * ACK timeout count registers.
  702. * ACKCNT0: TX ACK timeout count.
  703. * ACKCNT1: RX ACK timeout count.
  704. */
  705. #define ACKCNT0 0x0114
  706. #define ACKCNT1 0x0118
  707. /*
  708. * GPIO and others.
  709. */
  710. /*
  711. * GPIOCSR: GPIO control register.
  712. * GPIOCSR_VALx: GPIO value
  713. * GPIOCSR_DIRx: GPIO direction: 0 = output; 1 = input
  714. */
  715. #define GPIOCSR 0x0120
  716. #define GPIOCSR_VAL0 FIELD32(0x00000001)
  717. #define GPIOCSR_VAL1 FIELD32(0x00000002)
  718. #define GPIOCSR_VAL2 FIELD32(0x00000004)
  719. #define GPIOCSR_VAL3 FIELD32(0x00000008)
  720. #define GPIOCSR_VAL4 FIELD32(0x00000010)
  721. #define GPIOCSR_VAL5 FIELD32(0x00000020)
  722. #define GPIOCSR_VAL6 FIELD32(0x00000040)
  723. #define GPIOCSR_VAL7 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 */