rt2500pci.h 35 KB

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