You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reg.h 94KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589
  1. /*
  2. * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com>
  3. * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org>
  4. * Copyright (c) 2007-2008 Michael Taylor <mike.taylor@apprion.com>
  5. *
  6. * Permission to use, copy, modify, and distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. *
  18. */
  19. /*
  20. * Register values for Atheros 5210/5211/5212 cards from OpenBSD's ar5k
  21. * maintained by Reyk Floeter
  22. *
  23. * I tried to document those registers by looking at ar5k code, some
  24. * 802.11 (802.11e mostly) papers and by reading various public available
  25. * Atheros presentations and papers like these:
  26. *
  27. * 5210 - http://nova.stanford.edu/~bbaas/ps/isscc2002_slides.pdf
  28. * http://www.it.iitb.ac.in/~janak/wifire/01222734.pdf
  29. *
  30. * 5211 - http://www.hotchips.org/archives/hc14/3_Tue/16_mcfarland.pdf
  31. *
  32. * This file also contains register values found on a memory dump of
  33. * Atheros's ART program (Atheros Radio Test), on ath9k, on legacy-hal
  34. * released by Atheros and on various debug messages found on the net.
  35. */
  36. /*====MAC DMA REGISTERS====*/
  37. /*
  38. * AR5210-Specific TXDP registers
  39. * 5210 has only 2 transmit queues so no DCU/QCU, just
  40. * 2 transmit descriptor pointers...
  41. */
  42. #define AR5K_NOQCU_TXDP0 0x0000 /* Queue 0 - data */
  43. #define AR5K_NOQCU_TXDP1 0x0004 /* Queue 1 - beacons */
  44. /*
  45. * Mac Control Register
  46. */
  47. #define AR5K_CR 0x0008 /* Register Address */
  48. #define AR5K_CR_TXE0 0x00000001 /* TX Enable for queue 0 on 5210 */
  49. #define AR5K_CR_TXE1 0x00000002 /* TX Enable for queue 1 on 5210 */
  50. #define AR5K_CR_RXE 0x00000004 /* RX Enable */
  51. #define AR5K_CR_TXD0 0x00000008 /* TX Disable for queue 0 on 5210 */
  52. #define AR5K_CR_TXD1 0x00000010 /* TX Disable for queue 1 on 5210 */
  53. #define AR5K_CR_RXD 0x00000020 /* RX Disable */
  54. #define AR5K_CR_SWI 0x00000040 /* Software Interrupt */
  55. /*
  56. * RX Descriptor Pointer register
  57. */
  58. #define AR5K_RXDP 0x000c
  59. /*
  60. * Configuration and status register
  61. */
  62. #define AR5K_CFG 0x0014 /* Register Address */
  63. #define AR5K_CFG_SWTD 0x00000001 /* Byte-swap TX descriptor (for big endian archs) */
  64. #define AR5K_CFG_SWTB 0x00000002 /* Byte-swap TX buffer */
  65. #define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */
  66. #define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */
  67. #define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */
  68. #define AR5K_CFG_IBSS 0x00000020 /* 0-BSS, 1-IBSS [5211+] */
  69. #define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */
  70. #define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */
  71. #define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */
  72. #define AR5K_CFG_TXCNT 0x00007800 /* Tx frame count (?) [5210] */
  73. #define AR5K_CFG_TXCNT_S 11
  74. #define AR5K_CFG_TXFSTAT 0x00008000 /* Tx frame status (?) [5210] */
  75. #define AR5K_CFG_TXFSTRT 0x00010000 /* [5210] */
  76. #define AR5K_CFG_PCI_THRES 0x00060000 /* PCI Master req q threshold [5211+] */
  77. #define AR5K_CFG_PCI_THRES_S 17
  78. /*
  79. * Interrupt enable register
  80. */
  81. #define AR5K_IER 0x0024 /* Register Address */
  82. #define AR5K_IER_DISABLE 0x00000000 /* Disable card interrupts */
  83. #define AR5K_IER_ENABLE 0x00000001 /* Enable card interrupts */
  84. /*
  85. * 0x0028 is Beacon Control Register on 5210
  86. * and first RTS duration register on 5211
  87. */
  88. /*
  89. * Beacon control register [5210]
  90. */
  91. #define AR5K_BCR 0x0028 /* Register Address */
  92. #define AR5K_BCR_AP 0x00000000 /* AP mode */
  93. #define AR5K_BCR_ADHOC 0x00000001 /* Ad-Hoc mode */
  94. #define AR5K_BCR_BDMAE 0x00000002 /* DMA enable */
  95. #define AR5K_BCR_TQ1FV 0x00000004 /* Use Queue1 for CAB traffic */
  96. #define AR5K_BCR_TQ1V 0x00000008 /* Use Queue1 for Beacon traffic */
  97. #define AR5K_BCR_BCGET 0x00000010
  98. /*
  99. * First RTS duration register [5211]
  100. */
  101. #define AR5K_RTSD0 0x0028 /* Register Address */
  102. #define AR5K_RTSD0_6 0x000000ff /* 6Mb RTS duration mask (?) */
  103. #define AR5K_RTSD0_6_S 0 /* 6Mb RTS duration shift (?) */
  104. #define AR5K_RTSD0_9 0x0000ff00 /* 9Mb*/
  105. #define AR5K_RTSD0_9_S 8
  106. #define AR5K_RTSD0_12 0x00ff0000 /* 12Mb*/
  107. #define AR5K_RTSD0_12_S 16
  108. #define AR5K_RTSD0_18 0xff000000 /* 16Mb*/
  109. #define AR5K_RTSD0_18_S 24
  110. /*
  111. * 0x002c is Beacon Status Register on 5210
  112. * and second RTS duration register on 5211
  113. */
  114. /*
  115. * Beacon status register [5210]
  116. *
  117. * As i can see in ar5k_ar5210_tx_start Reyk uses some of the values of BCR
  118. * for this register, so i guess TQ1V,TQ1FV and BDMAE have the same meaning
  119. * here and SNP/SNAP means "snapshot" (so this register gets synced with BCR).
  120. * So SNAPPEDBCRVALID sould also stand for "snapped BCR -values- valid", so i
  121. * renamed it to SNAPSHOTSVALID to make more sense. I realy have no idea what
  122. * else can it be. I also renamed SNPBCMD to SNPADHOC to match BCR.
  123. */
  124. #define AR5K_BSR 0x002c /* Register Address */
  125. #define AR5K_BSR_BDLYSW 0x00000001 /* SW Beacon delay (?) */
  126. #define AR5K_BSR_BDLYDMA 0x00000002 /* DMA Beacon delay (?) */
  127. #define AR5K_BSR_TXQ1F 0x00000004 /* Beacon queue (1) finished */
  128. #define AR5K_BSR_ATIMDLY 0x00000008 /* ATIM delay (?) */
  129. #define AR5K_BSR_SNPADHOC 0x00000100 /* Ad-hoc mode set (?) */
  130. #define AR5K_BSR_SNPBDMAE 0x00000200 /* Beacon DMA enabled (?) */
  131. #define AR5K_BSR_SNPTQ1FV 0x00000400 /* Queue1 is used for CAB traffic (?) */
  132. #define AR5K_BSR_SNPTQ1V 0x00000800 /* Queue1 is used for Beacon traffic (?) */
  133. #define AR5K_BSR_SNAPSHOTSVALID 0x00001000 /* BCR snapshots are valid (?) */
  134. #define AR5K_BSR_SWBA_CNT 0x00ff0000
  135. /*
  136. * Second RTS duration register [5211]
  137. */
  138. #define AR5K_RTSD1 0x002c /* Register Address */
  139. #define AR5K_RTSD1_24 0x000000ff /* 24Mb */
  140. #define AR5K_RTSD1_24_S 0
  141. #define AR5K_RTSD1_36 0x0000ff00 /* 36Mb */
  142. #define AR5K_RTSD1_36_S 8
  143. #define AR5K_RTSD1_48 0x00ff0000 /* 48Mb */
  144. #define AR5K_RTSD1_48_S 16
  145. #define AR5K_RTSD1_54 0xff000000 /* 54Mb */
  146. #define AR5K_RTSD1_54_S 24
  147. /*
  148. * Transmit configuration register
  149. */
  150. #define AR5K_TXCFG 0x0030 /* Register Address */
  151. #define AR5K_TXCFG_SDMAMR 0x00000007 /* DMA size (read) */
  152. #define AR5K_TXCFG_SDMAMR_S 0
  153. #define AR5K_TXCFG_B_MODE 0x00000008 /* Set b mode for 5111 (enable 2111) */
  154. #define AR5K_TXCFG_TXFSTP 0x00000008 /* TX DMA full Stop [5210] */
  155. #define AR5K_TXCFG_TXFULL 0x000003f0 /* TX Triger level mask */
  156. #define AR5K_TXCFG_TXFULL_S 4
  157. #define AR5K_TXCFG_TXFULL_0B 0x00000000
  158. #define AR5K_TXCFG_TXFULL_64B 0x00000010
  159. #define AR5K_TXCFG_TXFULL_128B 0x00000020
  160. #define AR5K_TXCFG_TXFULL_192B 0x00000030
  161. #define AR5K_TXCFG_TXFULL_256B 0x00000040
  162. #define AR5K_TXCFG_TXCONT_EN 0x00000080
  163. #define AR5K_TXCFG_DMASIZE 0x00000100 /* Flag for passing DMA size [5210] */
  164. #define AR5K_TXCFG_JUMBO_DESC_EN 0x00000400 /* Enable jumbo tx descriptors [5211+] */
  165. #define AR5K_TXCFG_ADHOC_BCN_ATIM 0x00000800 /* Adhoc Beacon ATIM Policy */
  166. #define AR5K_TXCFG_ATIM_WINDOW_DEF_DIS 0x00001000 /* Disable ATIM window defer [5211+] */
  167. #define AR5K_TXCFG_RTSRND 0x00001000 /* [5211+] */
  168. #define AR5K_TXCFG_FRMPAD_DIS 0x00002000 /* [5211+] */
  169. #define AR5K_TXCFG_RDY_CBR_DIS 0x00004000 /* Ready time CBR disable [5211+] */
  170. #define AR5K_TXCFG_JUMBO_FRM_MODE 0x00008000 /* Jumbo frame mode [5211+] */
  171. #define AR5K_TXCFG_DCU_DBL_BUF_DIS 0x00008000 /* Disable double buffering on DCU */
  172. #define AR5K_TXCFG_DCU_CACHING_DIS 0x00010000 /* Disable DCU caching */
  173. /*
  174. * Receive configuration register
  175. */
  176. #define AR5K_RXCFG 0x0034 /* Register Address */
  177. #define AR5K_RXCFG_SDMAMW 0x00000007 /* DMA size (write) */
  178. #define AR5K_RXCFG_SDMAMW_S 0
  179. #define AR5K_RXCFG_ZLFDMA 0x00000008 /* Enable Zero-length frame DMA */
  180. #define AR5K_RXCFG_DEF_ANTENNA 0x00000010 /* Default antenna (?) */
  181. #define AR5K_RXCFG_JUMBO_RXE 0x00000020 /* Enable jumbo rx descriptors [5211+] */
  182. #define AR5K_RXCFG_JUMBO_WRAP 0x00000040 /* Wrap jumbo frames [5211+] */
  183. #define AR5K_RXCFG_SLE_ENTRY 0x00000080 /* Sleep entry policy */
  184. /*
  185. * Receive jumbo descriptor last address register
  186. * Only found in 5211 (?)
  187. */
  188. #define AR5K_RXJLA 0x0038
  189. /*
  190. * MIB control register
  191. */
  192. #define AR5K_MIBC 0x0040 /* Register Address */
  193. #define AR5K_MIBC_COW 0x00000001 /* Warn test indicator */
  194. #define AR5K_MIBC_FMC 0x00000002 /* Freeze MIB Counters */
  195. #define AR5K_MIBC_CMC 0x00000004 /* Clean MIB Counters */
  196. #define AR5K_MIBC_MCS 0x00000008 /* MIB counter strobe */
  197. /*
  198. * Timeout prescale register
  199. */
  200. #define AR5K_TOPS 0x0044
  201. #define AR5K_TOPS_M 0x0000ffff
  202. /*
  203. * Receive timeout register (no frame received)
  204. */
  205. #define AR5K_RXNOFRM 0x0048
  206. #define AR5K_RXNOFRM_M 0x000003ff
  207. /*
  208. * Transmit timeout register (no frame sent)
  209. */
  210. #define AR5K_TXNOFRM 0x004c
  211. #define AR5K_TXNOFRM_M 0x000003ff
  212. #define AR5K_TXNOFRM_QCU 0x000ffc00
  213. #define AR5K_TXNOFRM_QCU_S 10
  214. /*
  215. * Receive frame gap timeout register
  216. */
  217. #define AR5K_RPGTO 0x0050
  218. #define AR5K_RPGTO_M 0x000003ff
  219. /*
  220. * Receive frame count limit register
  221. */
  222. #define AR5K_RFCNT 0x0054
  223. #define AR5K_RFCNT_M 0x0000001f /* [5211+] (?) */
  224. #define AR5K_RFCNT_RFCL 0x0000000f /* [5210] */
  225. /*
  226. * Misc settings register
  227. * (reserved0-3)
  228. */
  229. #define AR5K_MISC 0x0058 /* Register Address */
  230. #define AR5K_MISC_DMA_OBS_M 0x000001e0
  231. #define AR5K_MISC_DMA_OBS_S 5
  232. #define AR5K_MISC_MISC_OBS_M 0x00000e00
  233. #define AR5K_MISC_MISC_OBS_S 9
  234. #define AR5K_MISC_MAC_OBS_LSB_M 0x00007000
  235. #define AR5K_MISC_MAC_OBS_LSB_S 12
  236. #define AR5K_MISC_MAC_OBS_MSB_M 0x00038000
  237. #define AR5K_MISC_MAC_OBS_MSB_S 15
  238. #define AR5K_MISC_LED_DECAY 0x001c0000 /* [5210] */
  239. #define AR5K_MISC_LED_BLINK 0x00e00000 /* [5210] */
  240. /*
  241. * QCU/DCU clock gating register (5311)
  242. * (reserved4-5)
  243. */
  244. #define AR5K_QCUDCU_CLKGT 0x005c /* Register Address (?) */
  245. #define AR5K_QCUDCU_CLKGT_QCU 0x0000ffff /* Mask for QCU clock */
  246. #define AR5K_QCUDCU_CLKGT_DCU 0x07ff0000 /* Mask for DCU clock */
  247. /*
  248. * Interrupt Status Registers
  249. *
  250. * For 5210 there is only one status register but for
  251. * 5211/5212 we have one primary and 4 secondary registers.
  252. * So we have AR5K_ISR for 5210 and AR5K_PISR /SISRx for 5211/5212.
  253. * Most of these bits are common for all chipsets.
  254. */
  255. #define AR5K_ISR 0x001c /* Register Address [5210] */
  256. #define AR5K_PISR 0x0080 /* Register Address [5211+] */
  257. #define AR5K_ISR_RXOK 0x00000001 /* Frame successfuly recieved */
  258. #define AR5K_ISR_RXDESC 0x00000002 /* RX descriptor request */
  259. #define AR5K_ISR_RXERR 0x00000004 /* Receive error */
  260. #define AR5K_ISR_RXNOFRM 0x00000008 /* No frame received (receive timeout) */
  261. #define AR5K_ISR_RXEOL 0x00000010 /* Empty RX descriptor */
  262. #define AR5K_ISR_RXORN 0x00000020 /* Receive FIFO overrun */
  263. #define AR5K_ISR_TXOK 0x00000040 /* Frame successfuly transmited */
  264. #define AR5K_ISR_TXDESC 0x00000080 /* TX descriptor request */
  265. #define AR5K_ISR_TXERR 0x00000100 /* Transmit error */
  266. #define AR5K_ISR_TXNOFRM 0x00000200 /* No frame transmited (transmit timeout) */
  267. #define AR5K_ISR_TXEOL 0x00000400 /* Empty TX descriptor */
  268. #define AR5K_ISR_TXURN 0x00000800 /* Transmit FIFO underrun */
  269. #define AR5K_ISR_MIB 0x00001000 /* Update MIB counters */
  270. #define AR5K_ISR_SWI 0x00002000 /* Software interrupt */
  271. #define AR5K_ISR_RXPHY 0x00004000 /* PHY error */
  272. #define AR5K_ISR_RXKCM 0x00008000 /* RX Key cache miss */
  273. #define AR5K_ISR_SWBA 0x00010000 /* Software beacon alert */
  274. #define AR5K_ISR_BRSSI 0x00020000 /* Beacon rssi below threshold (?) */
  275. #define AR5K_ISR_BMISS 0x00040000 /* Beacon missed */
  276. #define AR5K_ISR_HIUERR 0x00080000 /* Host Interface Unit error [5211+] */
  277. #define AR5K_ISR_BNR 0x00100000 /* Beacon not ready [5211+] */
  278. #define AR5K_ISR_MCABT 0x00100000 /* Master Cycle Abort [5210] */
  279. #define AR5K_ISR_RXCHIRP 0x00200000 /* CHIRP Received [5212+] */
  280. #define AR5K_ISR_SSERR 0x00200000 /* Signaled System Error [5210] */
  281. #define AR5K_ISR_DPERR 0x00400000 /* Det par Error (?) [5210] */
  282. #define AR5K_ISR_RXDOPPLER 0x00400000 /* Doppler chirp received [5212+] */
  283. #define AR5K_ISR_TIM 0x00800000 /* [5211+] */
  284. #define AR5K_ISR_BCNMISC 0x00800000 /* 'or' of TIM, CAB_END, DTIM_SYNC, BCN_TIMEOUT,
  285. CAB_TIMEOUT and DTIM bits from SISR2 [5212+] */
  286. #define AR5K_ISR_GPIO 0x01000000 /* GPIO (rf kill) */
  287. #define AR5K_ISR_QCBRORN 0x02000000 /* QCU CBR overrun [5211+] */
  288. #define AR5K_ISR_QCBRURN 0x04000000 /* QCU CBR underrun [5211+] */
  289. #define AR5K_ISR_QTRIG 0x08000000 /* QCU scheduling trigger [5211+] */
  290. /*
  291. * Secondary status registers [5211+] (0 - 4)
  292. *
  293. * These give the status for each QCU, only QCUs 0-9 are
  294. * represented.
  295. */
  296. #define AR5K_SISR0 0x0084 /* Register Address [5211+] */
  297. #define AR5K_SISR0_QCU_TXOK 0x000003ff /* Mask for QCU_TXOK */
  298. #define AR5K_SISR0_QCU_TXOK_S 0
  299. #define AR5K_SISR0_QCU_TXDESC 0x03ff0000 /* Mask for QCU_TXDESC */
  300. #define AR5K_SISR0_QCU_TXDESC_S 16
  301. #define AR5K_SISR1 0x0088 /* Register Address [5211+] */
  302. #define AR5K_SISR1_QCU_TXERR 0x000003ff /* Mask for QCU_TXERR */
  303. #define AR5K_SISR1_QCU_TXERR_S 0
  304. #define AR5K_SISR1_QCU_TXEOL 0x03ff0000 /* Mask for QCU_TXEOL */
  305. #define AR5K_SISR1_QCU_TXEOL_S 16
  306. #define AR5K_SISR2 0x008c /* Register Address [5211+] */
  307. #define AR5K_SISR2_QCU_TXURN 0x000003ff /* Mask for QCU_TXURN */
  308. #define AR5K_SISR2_QCU_TXURN_S 0
  309. #define AR5K_SISR2_MCABT 0x00100000 /* Master Cycle Abort */
  310. #define AR5K_SISR2_SSERR 0x00200000 /* Signaled System Error */
  311. #define AR5K_SISR2_DPERR 0x00400000 /* Bus parity error */
  312. #define AR5K_SISR2_TIM 0x01000000 /* [5212+] */
  313. #define AR5K_SISR2_CAB_END 0x02000000 /* [5212+] */
  314. #define AR5K_SISR2_DTIM_SYNC 0x04000000 /* DTIM sync lost [5212+] */
  315. #define AR5K_SISR2_BCN_TIMEOUT 0x08000000 /* Beacon Timeout [5212+] */
  316. #define AR5K_SISR2_CAB_TIMEOUT 0x10000000 /* CAB Timeout [5212+] */
  317. #define AR5K_SISR2_DTIM 0x20000000 /* [5212+] */
  318. #define AR5K_SISR2_TSFOOR 0x80000000 /* TSF OOR (?) */
  319. #define AR5K_SISR3 0x0090 /* Register Address [5211+] */
  320. #define AR5K_SISR3_QCBRORN 0x000003ff /* Mask for QCBRORN */
  321. #define AR5K_SISR3_QCBRORN_S 0
  322. #define AR5K_SISR3_QCBRURN 0x03ff0000 /* Mask for QCBRURN */
  323. #define AR5K_SISR3_QCBRURN_S 16
  324. #define AR5K_SISR4 0x0094 /* Register Address [5211+] */
  325. #define AR5K_SISR4_QTRIG 0x000003ff /* Mask for QTRIG */
  326. #define AR5K_SISR4_QTRIG_S 0
  327. /*
  328. * Shadow read-and-clear interrupt status registers [5211+]
  329. */
  330. #define AR5K_RAC_PISR 0x00c0 /* Read and clear PISR */
  331. #define AR5K_RAC_SISR0 0x00c4 /* Read and clear SISR0 */
  332. #define AR5K_RAC_SISR1 0x00c8 /* Read and clear SISR1 */
  333. #define AR5K_RAC_SISR2 0x00cc /* Read and clear SISR2 */
  334. #define AR5K_RAC_SISR3 0x00d0 /* Read and clear SISR3 */
  335. #define AR5K_RAC_SISR4 0x00d4 /* Read and clear SISR4 */
  336. /*
  337. * Interrupt Mask Registers
  338. *
  339. * As whith ISRs 5210 has one IMR (AR5K_IMR) and 5211/5212 has one primary
  340. * (AR5K_PIMR) and 4 secondary IMRs (AR5K_SIMRx). Note that ISR/IMR flags match.
  341. */
  342. #define AR5K_IMR 0x0020 /* Register Address [5210] */
  343. #define AR5K_PIMR 0x00a0 /* Register Address [5211+] */
  344. #define AR5K_IMR_RXOK 0x00000001 /* Frame successfuly recieved*/
  345. #define AR5K_IMR_RXDESC 0x00000002 /* RX descriptor request*/
  346. #define AR5K_IMR_RXERR 0x00000004 /* Receive error*/
  347. #define AR5K_IMR_RXNOFRM 0x00000008 /* No frame received (receive timeout)*/
  348. #define AR5K_IMR_RXEOL 0x00000010 /* Empty RX descriptor*/
  349. #define AR5K_IMR_RXORN 0x00000020 /* Receive FIFO overrun*/
  350. #define AR5K_IMR_TXOK 0x00000040 /* Frame successfuly transmited*/
  351. #define AR5K_IMR_TXDESC 0x00000080 /* TX descriptor request*/
  352. #define AR5K_IMR_TXERR 0x00000100 /* Transmit error*/
  353. #define AR5K_IMR_TXNOFRM 0x00000200 /* No frame transmited (transmit timeout)*/
  354. #define AR5K_IMR_TXEOL 0x00000400 /* Empty TX descriptor*/
  355. #define AR5K_IMR_TXURN 0x00000800 /* Transmit FIFO underrun*/
  356. #define AR5K_IMR_MIB 0x00001000 /* Update MIB counters*/
  357. #define AR5K_IMR_SWI 0x00002000 /* Software interrupt */
  358. #define AR5K_IMR_RXPHY 0x00004000 /* PHY error*/
  359. #define AR5K_IMR_RXKCM 0x00008000 /* RX Key cache miss */
  360. #define AR5K_IMR_SWBA 0x00010000 /* Software beacon alert*/
  361. #define AR5K_IMR_BRSSI 0x00020000 /* Beacon rssi below threshold (?) */
  362. #define AR5K_IMR_BMISS 0x00040000 /* Beacon missed*/
  363. #define AR5K_IMR_HIUERR 0x00080000 /* Host Interface Unit error [5211+] */
  364. #define AR5K_IMR_BNR 0x00100000 /* Beacon not ready [5211+] */
  365. #define AR5K_IMR_MCABT 0x00100000 /* Master Cycle Abort [5210] */
  366. #define AR5K_IMR_RXCHIRP 0x00200000 /* CHIRP Received [5212+]*/
  367. #define AR5K_IMR_SSERR 0x00200000 /* Signaled System Error [5210] */
  368. #define AR5K_IMR_DPERR 0x00400000 /* Det par Error (?) [5210] */
  369. #define AR5K_IMR_RXDOPPLER 0x00400000 /* Doppler chirp received [5212+] */
  370. #define AR5K_IMR_TIM 0x00800000 /* [5211+] */
  371. #define AR5K_IMR_BCNMISC 0x00800000 /* 'or' of TIM, CAB_END, DTIM_SYNC, BCN_TIMEOUT,
  372. CAB_TIMEOUT and DTIM bits from SISR2 [5212+] */
  373. #define AR5K_IMR_GPIO 0x01000000 /* GPIO (rf kill)*/
  374. #define AR5K_IMR_QCBRORN 0x02000000 /* QCU CBR overrun (?) [5211+] */
  375. #define AR5K_IMR_QCBRURN 0x04000000 /* QCU CBR underrun (?) [5211+] */
  376. #define AR5K_IMR_QTRIG 0x08000000 /* QCU scheduling trigger [5211+] */
  377. /*
  378. * Secondary interrupt mask registers [5211+] (0 - 4)
  379. */
  380. #define AR5K_SIMR0 0x00a4 /* Register Address [5211+] */
  381. #define AR5K_SIMR0_QCU_TXOK 0x000003ff /* Mask for QCU_TXOK */
  382. #define AR5K_SIMR0_QCU_TXOK_S 0
  383. #define AR5K_SIMR0_QCU_TXDESC 0x03ff0000 /* Mask for QCU_TXDESC */
  384. #define AR5K_SIMR0_QCU_TXDESC_S 16
  385. #define AR5K_SIMR1 0x00a8 /* Register Address [5211+] */
  386. #define AR5K_SIMR1_QCU_TXERR 0x000003ff /* Mask for QCU_TXERR */
  387. #define AR5K_SIMR1_QCU_TXERR_S 0
  388. #define AR5K_SIMR1_QCU_TXEOL 0x03ff0000 /* Mask for QCU_TXEOL */
  389. #define AR5K_SIMR1_QCU_TXEOL_S 16
  390. #define AR5K_SIMR2 0x00ac /* Register Address [5211+] */
  391. #define AR5K_SIMR2_QCU_TXURN 0x000003ff /* Mask for QCU_TXURN */
  392. #define AR5K_SIMR2_QCU_TXURN_S 0
  393. #define AR5K_SIMR2_MCABT 0x00100000 /* Master Cycle Abort */
  394. #define AR5K_SIMR2_SSERR 0x00200000 /* Signaled System Error */
  395. #define AR5K_SIMR2_DPERR 0x00400000 /* Bus parity error */
  396. #define AR5K_SIMR2_TIM 0x01000000 /* [5212+] */
  397. #define AR5K_SIMR2_CAB_END 0x02000000 /* [5212+] */
  398. #define AR5K_SIMR2_DTIM_SYNC 0x04000000 /* DTIM Sync lost [5212+] */
  399. #define AR5K_SIMR2_BCN_TIMEOUT 0x08000000 /* Beacon Timeout [5212+] */
  400. #define AR5K_SIMR2_CAB_TIMEOUT 0x10000000 /* CAB Timeout [5212+] */
  401. #define AR5K_SIMR2_DTIM 0x20000000 /* [5212+] */
  402. #define AR5K_SIMR2_TSFOOR 0x80000000 /* TSF OOR (?) */
  403. #define AR5K_SIMR3 0x00b0 /* Register Address [5211+] */
  404. #define AR5K_SIMR3_QCBRORN 0x000003ff /* Mask for QCBRORN */
  405. #define AR5K_SIMR3_QCBRORN_S 0
  406. #define AR5K_SIMR3_QCBRURN 0x03ff0000 /* Mask for QCBRURN */
  407. #define AR5K_SIMR3_QCBRURN_S 16
  408. #define AR5K_SIMR4 0x00b4 /* Register Address [5211+] */
  409. #define AR5K_SIMR4_QTRIG 0x000003ff /* Mask for QTRIG */
  410. #define AR5K_SIMR4_QTRIG_S 0
  411. /*
  412. * DMA Debug registers 0-7
  413. * 0xe0 - 0xfc
  414. */
  415. /*
  416. * Decompression mask registers [5212+]
  417. */
  418. #define AR5K_DCM_ADDR 0x0400 /*Decompression mask address (index) */
  419. #define AR5K_DCM_DATA 0x0404 /*Decompression mask data */
  420. /*
  421. * Wake On Wireless pattern control register [5212+]
  422. */
  423. #define AR5K_WOW_PCFG 0x0410 /* Register Address */
  424. #define AR5K_WOW_PCFG_PAT_MATCH_EN 0x00000001 /* Pattern match enable */
  425. #define AR5K_WOW_PCFG_LONG_FRAME_POL 0x00000002 /* Long frame policy */
  426. #define AR5K_WOW_PCFG_WOBMISS 0x00000004 /* Wake on bea(con) miss (?) */
  427. #define AR5K_WOW_PCFG_PAT_0_EN 0x00000100 /* Enable pattern 0 */
  428. #define AR5K_WOW_PCFG_PAT_1_EN 0x00000200 /* Enable pattern 1 */
  429. #define AR5K_WOW_PCFG_PAT_2_EN 0x00000400 /* Enable pattern 2 */
  430. #define AR5K_WOW_PCFG_PAT_3_EN 0x00000800 /* Enable pattern 3 */
  431. #define AR5K_WOW_PCFG_PAT_4_EN 0x00001000 /* Enable pattern 4 */
  432. #define AR5K_WOW_PCFG_PAT_5_EN 0x00002000 /* Enable pattern 5 */
  433. /*
  434. * Wake On Wireless pattern index register (?) [5212+]
  435. */
  436. #define AR5K_WOW_PAT_IDX 0x0414
  437. /*
  438. * Wake On Wireless pattern data register [5212+]
  439. */
  440. #define AR5K_WOW_PAT_DATA 0x0418 /* Register Address */
  441. #define AR5K_WOW_PAT_DATA_0_3_V 0x00000001 /* Pattern 0, 3 value */
  442. #define AR5K_WOW_PAT_DATA_1_4_V 0x00000100 /* Pattern 1, 4 value */
  443. #define AR5K_WOW_PAT_DATA_2_5_V 0x00010000 /* Pattern 2, 5 value */
  444. #define AR5K_WOW_PAT_DATA_0_3_M 0x01000000 /* Pattern 0, 3 mask */
  445. #define AR5K_WOW_PAT_DATA_1_4_M 0x04000000 /* Pattern 1, 4 mask */
  446. #define AR5K_WOW_PAT_DATA_2_5_M 0x10000000 /* Pattern 2, 5 mask */
  447. /*
  448. * Decompression configuration registers [5212+]
  449. */
  450. #define AR5K_DCCFG 0x0420 /* Register Address */
  451. #define AR5K_DCCFG_GLOBAL_EN 0x00000001 /* Enable decompression on all queues */
  452. #define AR5K_DCCFG_BYPASS_EN 0x00000002 /* Bypass decompression */
  453. #define AR5K_DCCFG_BCAST_EN 0x00000004 /* Enable decompression for bcast frames */
  454. #define AR5K_DCCFG_MCAST_EN 0x00000008 /* Enable decompression for mcast frames */
  455. /*
  456. * Compression configuration registers [5212+]
  457. */
  458. #define AR5K_CCFG 0x0600 /* Register Address */
  459. #define AR5K_CCFG_WINDOW_SIZE 0x00000007 /* Compression window size */
  460. #define AR5K_CCFG_CPC_EN 0x00000008 /* Enable performance counters */
  461. #define AR5K_CCFG_CCU 0x0604 /* Register Address */
  462. #define AR5K_CCFG_CCU_CUP_EN 0x00000001 /* CCU Catchup enable */
  463. #define AR5K_CCFG_CCU_CREDIT 0x00000002 /* CCU Credit (field) */
  464. #define AR5K_CCFG_CCU_CD_THRES 0x00000080 /* CCU Cyc(lic?) debt threshold (field) */
  465. #define AR5K_CCFG_CCU_CUP_LCNT 0x00010000 /* CCU Catchup lit(?) count */
  466. #define AR5K_CCFG_CCU_INIT 0x00100200 /* Initial value during reset */
  467. /*
  468. * Compression performance counter registers [5212+]
  469. */
  470. #define AR5K_CPC0 0x0610 /* Compression performance counter 0 */
  471. #define AR5K_CPC1 0x0614 /* Compression performance counter 1*/
  472. #define AR5K_CPC2 0x0618 /* Compression performance counter 2 */
  473. #define AR5K_CPC3 0x061c /* Compression performance counter 3 */
  474. #define AR5K_CPCOVF 0x0620 /* Compression performance overflow */
  475. /*
  476. * Queue control unit (QCU) registers [5211+]
  477. *
  478. * Card has 12 TX Queues but i see that only 0-9 are used (?)
  479. * both in binary HAL (see ah.h) and ar5k. Each queue has it's own
  480. * TXDP at addresses 0x0800 - 0x082c, a CBR (Constant Bit Rate)
  481. * configuration register (0x08c0 - 0x08ec), a ready time configuration
  482. * register (0x0900 - 0x092c), a misc configuration register (0x09c0 -
  483. * 0x09ec) and a status register (0x0a00 - 0x0a2c). We also have some
  484. * global registers, QCU transmit enable/disable and "one shot arm (?)"
  485. * set/clear, which contain status for all queues (we shift by 1 for each
  486. * queue). To access these registers easily we define some macros here
  487. * that are used inside HAL. For more infos check out *_tx_queue functs.
  488. */
  489. /*
  490. * Generic QCU Register access macros
  491. */
  492. #define AR5K_QUEUE_REG(_r, _q) (((_q) << 2) + _r)
  493. #define AR5K_QCU_GLOBAL_READ(_r, _q) (AR5K_REG_READ(_r) & (1 << _q))
  494. #define AR5K_QCU_GLOBAL_WRITE(_r, _q) AR5K_REG_WRITE(_r, (1 << _q))
  495. /*
  496. * QCU Transmit descriptor pointer registers
  497. */
  498. #define AR5K_QCU_TXDP_BASE 0x0800 /* Register Address - Queue0 TXDP */
  499. #define AR5K_QUEUE_TXDP(_q) AR5K_QUEUE_REG(AR5K_QCU_TXDP_BASE, _q)
  500. /*
  501. * QCU Transmit enable register
  502. */
  503. #define AR5K_QCU_TXE 0x0840
  504. #define AR5K_ENABLE_QUEUE(_q) AR5K_QCU_GLOBAL_WRITE(AR5K_QCU_TXE, _q)
  505. #define AR5K_QUEUE_ENABLED(_q) AR5K_QCU_GLOBAL_READ(AR5K_QCU_TXE, _q)
  506. /*
  507. * QCU Transmit disable register
  508. */
  509. #define AR5K_QCU_TXD 0x0880
  510. #define AR5K_DISABLE_QUEUE(_q) AR5K_QCU_GLOBAL_WRITE(AR5K_QCU_TXD, _q)
  511. #define AR5K_QUEUE_DISABLED(_q) AR5K_QCU_GLOBAL_READ(AR5K_QCU_TXD, _q)
  512. /*
  513. * QCU Constant Bit Rate configuration registers
  514. */
  515. #define AR5K_QCU_CBRCFG_BASE 0x08c0 /* Register Address - Queue0 CBRCFG */
  516. #define AR5K_QCU_CBRCFG_INTVAL 0x00ffffff /* CBR Interval mask */
  517. #define AR5K_QCU_CBRCFG_INTVAL_S 0
  518. #define AR5K_QCU_CBRCFG_ORN_THRES 0xff000000 /* CBR overrun threshold mask */
  519. #define AR5K_QCU_CBRCFG_ORN_THRES_S 24
  520. #define AR5K_QUEUE_CBRCFG(_q) AR5K_QUEUE_REG(AR5K_QCU_CBRCFG_BASE, _q)
  521. /*
  522. * QCU Ready time configuration registers
  523. */
  524. #define AR5K_QCU_RDYTIMECFG_BASE 0x0900 /* Register Address - Queue0 RDYTIMECFG */
  525. #define AR5K_QCU_RDYTIMECFG_INTVAL 0x00ffffff /* Ready time interval mask */
  526. #define AR5K_QCU_RDYTIMECFG_INTVAL_S 0
  527. #define AR5K_QCU_RDYTIMECFG_ENABLE 0x01000000 /* Ready time enable mask */
  528. #define AR5K_QUEUE_RDYTIMECFG(_q) AR5K_QUEUE_REG(AR5K_QCU_RDYTIMECFG_BASE, _q)
  529. /*
  530. * QCU one shot arm set registers
  531. */
  532. #define AR5K_QCU_ONESHOTARM_SET 0x0940 /* Register Address -QCU "one shot arm set (?)" */
  533. #define AR5K_QCU_ONESHOTARM_SET_M 0x0000ffff
  534. /*
  535. * QCU one shot arm clear registers
  536. */
  537. #define AR5K_QCU_ONESHOTARM_CLEAR 0x0980 /* Register Address -QCU "one shot arm clear (?)" */
  538. #define AR5K_QCU_ONESHOTARM_CLEAR_M 0x0000ffff
  539. /*
  540. * QCU misc registers
  541. */
  542. #define AR5K_QCU_MISC_BASE 0x09c0 /* Register Address -Queue0 MISC */
  543. #define AR5K_QCU_MISC_FRSHED_M 0x0000000f /* Frame sheduling mask */
  544. #define AR5K_QCU_MISC_FRSHED_ASAP 0 /* ASAP */
  545. #define AR5K_QCU_MISC_FRSHED_CBR 1 /* Constant Bit Rate */
  546. #define AR5K_QCU_MISC_FRSHED_DBA_GT 2 /* DMA Beacon alert gated */
  547. #define AR5K_QCU_MISC_FRSHED_TIM_GT 3 /* TIMT gated */
  548. #define AR5K_QCU_MISC_FRSHED_BCN_SENT_GT 4 /* Beacon sent gated */
  549. #define AR5K_QCU_MISC_ONESHOT_ENABLE 0x00000010 /* Oneshot enable */
  550. #define AR5K_QCU_MISC_CBREXP_DIS 0x00000020 /* Disable CBR expired counter (normal queue) */
  551. #define AR5K_QCU_MISC_CBREXP_BCN_DIS 0x00000040 /* Disable CBR expired counter (beacon queue) */
  552. #define AR5K_QCU_MISC_BCN_ENABLE 0x00000080 /* Enable Beacon use */
  553. #define AR5K_QCU_MISC_CBR_THRES_ENABLE 0x00000100 /* CBR expired threshold enabled */
  554. #define AR5K_QCU_MISC_RDY_VEOL_POLICY 0x00000200 /* TXE reset when RDYTIME expired or VEOL */
  555. #define AR5K_QCU_MISC_CBR_RESET_CNT 0x00000400 /* CBR threshold (counter) reset */
  556. #define AR5K_QCU_MISC_DCU_EARLY 0x00000800 /* DCU early termination */
  557. #define AR5K_QCU_MISC_DCU_CMP_EN 0x00001000 /* Enable frame compression */
  558. #define AR5K_QUEUE_MISC(_q) AR5K_QUEUE_REG(AR5K_QCU_MISC_BASE, _q)
  559. /*
  560. * QCU status registers
  561. */
  562. #define AR5K_QCU_STS_BASE 0x0a00 /* Register Address - Queue0 STS */
  563. #define AR5K_QCU_STS_FRMPENDCNT 0x00000003 /* Frames pending counter */
  564. #define AR5K_QCU_STS_CBREXPCNT 0x0000ff00 /* CBR expired counter */
  565. #define AR5K_QUEUE_STATUS(_q) AR5K_QUEUE_REG(AR5K_QCU_STS_BASE, _q)
  566. /*
  567. * QCU ready time shutdown register
  568. */
  569. #define AR5K_QCU_RDYTIMESHDN 0x0a40
  570. #define AR5K_QCU_RDYTIMESHDN_M 0x000003ff
  571. /*
  572. * QCU compression buffer base registers [5212+]
  573. */
  574. #define AR5K_QCU_CBB_SELECT 0x0b00
  575. #define AR5K_QCU_CBB_ADDR 0x0b04
  576. #define AR5K_QCU_CBB_ADDR_S 9
  577. /*
  578. * QCU compression buffer configuration register [5212+]
  579. * (buffer size)
  580. */
  581. #define AR5K_QCU_CBCFG 0x0b08
  582. /*
  583. * Distributed Coordination Function (DCF) control unit (DCU)
  584. * registers [5211+]
  585. *
  586. * These registers control the various characteristics of each queue
  587. * for 802.11e (WME) combatibility so they go together with
  588. * QCU registers in pairs. For each queue we have a QCU mask register,
  589. * (0x1000 - 0x102c), a local-IFS settings register (0x1040 - 0x106c),
  590. * a retry limit register (0x1080 - 0x10ac), a channel time register
  591. * (0x10c0 - 0x10ec), a misc-settings register (0x1100 - 0x112c) and
  592. * a sequence number register (0x1140 - 0x116c). It seems that "global"
  593. * registers here afect all queues (see use of DCU_GBL_IFS_SLOT in ar5k).
  594. * We use the same macros here for easier register access.
  595. *
  596. */
  597. /*
  598. * DCU QCU mask registers
  599. */
  600. #define AR5K_DCU_QCUMASK_BASE 0x1000 /* Register Address -Queue0 DCU_QCUMASK */
  601. #define AR5K_DCU_QCUMASK_M 0x000003ff
  602. #define AR5K_QUEUE_QCUMASK(_q) AR5K_QUEUE_REG(AR5K_DCU_QCUMASK_BASE, _q)
  603. /*
  604. * DCU local Inter Frame Space settings register
  605. */
  606. #define AR5K_DCU_LCL_IFS_BASE 0x1040 /* Register Address -Queue0 DCU_LCL_IFS */
  607. #define AR5K_DCU_LCL_IFS_CW_MIN 0x000003ff /* Minimum Contention Window */
  608. #define AR5K_DCU_LCL_IFS_CW_MIN_S 0
  609. #define AR5K_DCU_LCL_IFS_CW_MAX 0x000ffc00 /* Maximum Contention Window */
  610. #define AR5K_DCU_LCL_IFS_CW_MAX_S 10
  611. #define AR5K_DCU_LCL_IFS_AIFS 0x0ff00000 /* Arbitrated Interframe Space */
  612. #define AR5K_DCU_LCL_IFS_AIFS_S 20
  613. #define AR5K_DCU_LCL_IFS_AIFS_MAX 0xfc /* Anything above that can cause DCU to hang */
  614. #define AR5K_QUEUE_DFS_LOCAL_IFS(_q) AR5K_QUEUE_REG(AR5K_DCU_LCL_IFS_BASE, _q)
  615. /*
  616. * DCU retry limit registers
  617. */
  618. #define AR5K_DCU_RETRY_LMT_BASE 0x1080 /* Register Address -Queue0 DCU_RETRY_LMT */
  619. #define AR5K_DCU_RETRY_LMT_SH_RETRY 0x0000000f /* Short retry limit mask */
  620. #define AR5K_DCU_RETRY_LMT_SH_RETRY_S 0
  621. #define AR5K_DCU_RETRY_LMT_LG_RETRY 0x000000f0 /* Long retry limit mask */
  622. #define AR5K_DCU_RETRY_LMT_LG_RETRY_S 4
  623. #define AR5K_DCU_RETRY_LMT_SSH_RETRY 0x00003f00 /* Station short retry limit mask (?) */
  624. #define AR5K_DCU_RETRY_LMT_SSH_RETRY_S 8
  625. #define AR5K_DCU_RETRY_LMT_SLG_RETRY 0x000fc000 /* Station long retry limit mask (?) */
  626. #define AR5K_DCU_RETRY_LMT_SLG_RETRY_S 14
  627. #define AR5K_QUEUE_DFS_RETRY_LIMIT(_q) AR5K_QUEUE_REG(AR5K_DCU_RETRY_LMT_BASE, _q)
  628. /*
  629. * DCU channel time registers
  630. */
  631. #define AR5K_DCU_CHAN_TIME_BASE 0x10c0 /* Register Address -Queue0 DCU_CHAN_TIME */
  632. #define AR5K_DCU_CHAN_TIME_DUR 0x000fffff /* Channel time duration */
  633. #define AR5K_DCU_CHAN_TIME_DUR_S 0
  634. #define AR5K_DCU_CHAN_TIME_ENABLE 0x00100000 /* Enable channel time */
  635. #define AR5K_QUEUE_DFS_CHANNEL_TIME(_q) AR5K_QUEUE_REG(AR5K_DCU_CHAN_TIME_BASE, _q)
  636. /*
  637. * DCU misc registers [5211+]
  638. *
  639. * Note: Arbiter lockout control controls the
  640. * behaviour on low priority queues when we have multiple queues
  641. * with pending frames. Intra-frame lockout means we wait until
  642. * the queue's current frame transmits (with post frame backoff and bursting)
  643. * before we transmit anything else and global lockout means we
  644. * wait for the whole queue to finish before higher priority queues
  645. * can transmit (this is used on beacon and CAB queues).
  646. * No lockout means there is no special handling.
  647. */
  648. #define AR5K_DCU_MISC_BASE 0x1100 /* Register Address -Queue0 DCU_MISC */
  649. #define AR5K_DCU_MISC_BACKOFF 0x0000003f /* Mask for backoff threshold */
  650. #define AR5K_DCU_MISC_ETS_RTS_POL 0x00000040 /* End of transmission series
  651. station RTS/data failure count
  652. reset policy (?) */
  653. #define AR5K_DCU_MISC_ETS_CW_POL 0x00000080 /* End of transmission series
  654. CW reset policy */
  655. #define AR5K_DCU_MISC_FRAG_WAIT 0x00000100 /* Wait for next fragment */
  656. #define AR5K_DCU_MISC_BACKOFF_FRAG 0x00000200 /* Enable backoff while bursting */
  657. #define AR5K_DCU_MISC_HCFPOLL_ENABLE 0x00000800 /* CF - Poll enable */
  658. #define AR5K_DCU_MISC_BACKOFF_PERSIST 0x00001000 /* Persistent backoff */
  659. #define AR5K_DCU_MISC_FRMPRFTCH_ENABLE 0x00002000 /* Enable frame pre-fetch */
  660. #define AR5K_DCU_MISC_VIRTCOL 0x0000c000 /* Mask for Virtual Collision (?) */
  661. #define AR5K_DCU_MISC_VIRTCOL_NORMAL 0
  662. #define AR5K_DCU_MISC_VIRTCOL_IGNORE 1
  663. #define AR5K_DCU_MISC_BCN_ENABLE 0x00010000 /* Enable Beacon use */
  664. #define AR5K_DCU_MISC_ARBLOCK_CTL 0x00060000 /* Arbiter lockout control mask */
  665. #define AR5K_DCU_MISC_ARBLOCK_CTL_S 17
  666. #define AR5K_DCU_MISC_ARBLOCK_CTL_NONE 0 /* No arbiter lockout */
  667. #define AR5K_DCU_MISC_ARBLOCK_CTL_INTFRM 1 /* Intra-frame lockout */
  668. #define AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL 2 /* Global lockout */
  669. #define AR5K_DCU_MISC_ARBLOCK_IGNORE 0x00080000 /* Ignore Arbiter lockout */
  670. #define AR5K_DCU_MISC_SEQ_NUM_INCR_DIS 0x00100000 /* Disable sequence number increment */
  671. #define AR5K_DCU_MISC_POST_FR_BKOFF_DIS 0x00200000 /* Disable post-frame backoff */
  672. #define AR5K_DCU_MISC_VIRT_COLL_POLICY 0x00400000 /* Virtual Collision cw policy */
  673. #define AR5K_DCU_MISC_BLOWN_IFS_POLICY 0x00800000 /* Blown IFS policy (?) */
  674. #define AR5K_DCU_MISC_SEQNUM_CTL 0x01000000 /* Sequence number control (?) */
  675. #define AR5K_QUEUE_DFS_MISC(_q) AR5K_QUEUE_REG(AR5K_DCU_MISC_BASE, _q)
  676. /*
  677. * DCU frame sequence number registers
  678. */
  679. #define AR5K_DCU_SEQNUM_BASE 0x1140
  680. #define AR5K_DCU_SEQNUM_M 0x00000fff
  681. #define AR5K_QUEUE_DCU_SEQNUM(_q) AR5K_QUEUE_REG(AR5K_DCU_SEQNUM_BASE, _q)
  682. /*
  683. * DCU global IFS SIFS register
  684. */
  685. #define AR5K_DCU_GBL_IFS_SIFS 0x1030
  686. #define AR5K_DCU_GBL_IFS_SIFS_M 0x0000ffff
  687. /*
  688. * DCU global IFS slot interval register
  689. */
  690. #define AR5K_DCU_GBL_IFS_SLOT 0x1070
  691. #define AR5K_DCU_GBL_IFS_SLOT_M 0x0000ffff
  692. /*
  693. * DCU global IFS EIFS register
  694. */
  695. #define AR5K_DCU_GBL_IFS_EIFS 0x10b0
  696. #define AR5K_DCU_GBL_IFS_EIFS_M 0x0000ffff
  697. /*
  698. * DCU global IFS misc register
  699. *
  700. * LFSR stands for Linear Feedback Shift Register
  701. * and it's used for generating pseudo-random
  702. * number sequences.
  703. *
  704. * (If i understand corectly, random numbers are
  705. * used for idle sensing -multiplied with cwmin/max etc-)
  706. */
  707. #define AR5K_DCU_GBL_IFS_MISC 0x10f0 /* Register Address */
  708. #define AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE 0x00000007 /* LFSR Slice Select */
  709. #define AR5K_DCU_GBL_IFS_MISC_TURBO_MODE 0x00000008 /* Turbo mode */
  710. #define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC 0x000003f0 /* SIFS Duration mask */
  711. #define AR5K_DCU_GBL_IFS_MISC_USEC_DUR 0x000ffc00 /* USEC Duration mask */
  712. #define AR5K_DCU_GBL_IFS_MISC_USEC_DUR_S 10
  713. #define AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY 0x00300000 /* DCU Arbiter delay mask */
  714. #define AR5K_DCU_GBL_IFS_MISC_SIFS_CNT_RST 0x00400000 /* SIFS cnt reset policy (?) */
  715. #define AR5K_DCU_GBL_IFS_MISC_AIFS_CNT_RST 0x00800000 /* AIFS cnt reset policy (?) */
  716. #define AR5K_DCU_GBL_IFS_MISC_RND_LFSR_SL_DIS 0x01000000 /* Disable random LFSR slice */
  717. /*
  718. * DCU frame prefetch control register
  719. */
  720. #define AR5K_DCU_FP 0x1230 /* Register Address */
  721. #define AR5K_DCU_FP_NOBURST_DCU_EN 0x00000001 /* Enable non-burst prefetch on DCU (?) */
  722. #define AR5K_DCU_FP_NOBURST_EN 0x00000010 /* Enable non-burst prefetch (?) */
  723. #define AR5K_DCU_FP_BURST_DCU_EN 0x00000020 /* Enable burst prefetch on DCU (?) */
  724. /*
  725. * DCU transmit pause control/status register
  726. */
  727. #define AR5K_DCU_TXP 0x1270 /* Register Address */
  728. #define AR5K_DCU_TXP_M 0x000003ff /* Tx pause mask */
  729. #define AR5K_DCU_TXP_STATUS 0x00010000 /* Tx pause status */
  730. /*
  731. * DCU transmit filter table 0 (32 entries)
  732. * each entry contains a 32bit slice of the
  733. * 128bit tx filter for each DCU (4 slices per DCU)
  734. */
  735. #define AR5K_DCU_TX_FILTER_0_BASE 0x1038
  736. #define AR5K_DCU_TX_FILTER_0(_n) (AR5K_DCU_TX_FILTER_0_BASE + (_n * 64))
  737. /*
  738. * DCU transmit filter table 1 (16 entries)
  739. */
  740. #define AR5K_DCU_TX_FILTER_1_BASE 0x103c
  741. #define AR5K_DCU_TX_FILTER_1(_n) (AR5K_DCU_TX_FILTER_1_BASE + (_n * 64))
  742. /*
  743. * DCU clear transmit filter register
  744. */
  745. #define AR5K_DCU_TX_FILTER_CLR 0x143c
  746. /*
  747. * DCU set transmit filter register
  748. */
  749. #define AR5K_DCU_TX_FILTER_SET 0x147c
  750. /*
  751. * Reset control register
  752. */
  753. #define AR5K_RESET_CTL 0x4000 /* Register Address */
  754. #define AR5K_RESET_CTL_PCU 0x00000001 /* Protocol Control Unit reset */
  755. #define AR5K_RESET_CTL_DMA 0x00000002 /* DMA (Rx/Tx) reset [5210] */
  756. #define AR5K_RESET_CTL_BASEBAND 0x00000002 /* Baseband reset [5211+] */
  757. #define AR5K_RESET_CTL_MAC 0x00000004 /* MAC reset (PCU+Baseband ?) [5210] */
  758. #define AR5K_RESET_CTL_PHY 0x00000008 /* PHY reset [5210] */
  759. #define AR5K_RESET_CTL_PCI 0x00000010 /* PCI Core reset (interrupts etc) */
  760. /*
  761. * Sleep control register
  762. */
  763. #define AR5K_SLEEP_CTL 0x4004 /* Register Address */
  764. #define AR5K_SLEEP_CTL_SLDUR 0x0000ffff /* Sleep duration mask */
  765. #define AR5K_SLEEP_CTL_SLDUR_S 0
  766. #define AR5K_SLEEP_CTL_SLE 0x00030000 /* Sleep enable mask */
  767. #define AR5K_SLEEP_CTL_SLE_S 16
  768. #define AR5K_SLEEP_CTL_SLE_WAKE 0x00000000 /* Force chip awake */
  769. #define AR5K_SLEEP_CTL_SLE_SLP 0x00010000 /* Force chip sleep */
  770. #define AR5K_SLEEP_CTL_SLE_ALLOW 0x00020000 /* Normal sleep policy */
  771. #define AR5K_SLEEP_CTL_SLE_UNITS 0x00000008 /* [5211+] */
  772. #define AR5K_SLEEP_CTL_DUR_TIM_POL 0x00040000 /* Sleep duration timing policy */
  773. #define AR5K_SLEEP_CTL_DUR_WRITE_POL 0x00080000 /* Sleep duration write policy */
  774. #define AR5K_SLEEP_CTL_SLE_POL 0x00100000 /* Sleep policy mode */
  775. /*
  776. * Interrupt pending register
  777. */
  778. #define AR5K_INTPEND 0x4008
  779. #define AR5K_INTPEND_M 0x00000001
  780. /*
  781. * Sleep force register
  782. */
  783. #define AR5K_SFR 0x400c
  784. #define AR5K_SFR_EN 0x00000001
  785. /*
  786. * PCI configuration register
  787. * TODO: Fix LED stuff
  788. */
  789. #define AR5K_PCICFG 0x4010 /* Register Address */
  790. #define AR5K_PCICFG_EEAE 0x00000001 /* Eeprom access enable [5210] */
  791. #define AR5K_PCICFG_SLEEP_CLOCK_EN 0x00000002 /* Enable sleep clock */
  792. #define AR5K_PCICFG_CLKRUNEN 0x00000004 /* CLKRUN enable [5211+] */
  793. #define AR5K_PCICFG_EESIZE 0x00000018 /* Mask for EEPROM size [5211+] */
  794. #define AR5K_PCICFG_EESIZE_S 3
  795. #define AR5K_PCICFG_EESIZE_4K 0 /* 4K */
  796. #define AR5K_PCICFG_EESIZE_8K 1 /* 8K */
  797. #define AR5K_PCICFG_EESIZE_16K 2 /* 16K */
  798. #define AR5K_PCICFG_EESIZE_FAIL 3 /* Failed to get size [5211+] */
  799. #define AR5K_PCICFG_LED 0x00000060 /* Led status [5211+] */
  800. #define AR5K_PCICFG_LED_NONE 0x00000000 /* Default [5211+] */
  801. #define AR5K_PCICFG_LED_PEND 0x00000020 /* Scan / Auth pending */
  802. #define AR5K_PCICFG_LED_ASSOC 0x00000040 /* Associated */
  803. #define AR5K_PCICFG_BUS_SEL 0x00000380 /* Mask for "bus select" [5211+] (?) */
  804. #define AR5K_PCICFG_CBEFIX_DIS 0x00000400 /* Disable CBE fix */
  805. #define AR5K_PCICFG_SL_INTEN 0x00000800 /* Enable interrupts when asleep */
  806. #define AR5K_PCICFG_LED_BCTL 0x00001000 /* Led blink (?) [5210] */
  807. #define AR5K_PCICFG_RETRY_FIX 0x00001000 /* Enable pci core retry fix */
  808. #define AR5K_PCICFG_SL_INPEN 0x00002000 /* Sleep even whith pending interrupts*/
  809. #define AR5K_PCICFG_SPWR_DN 0x00010000 /* Mask for power status */
  810. #define AR5K_PCICFG_LEDMODE 0x000e0000 /* Ledmode [5211+] */
  811. #define AR5K_PCICFG_LEDMODE_PROP 0x00000000 /* Blink on standard traffic [5211+] */
  812. #define AR5K_PCICFG_LEDMODE_PROM 0x00020000 /* Default mode (blink on any traffic) [5211+] */
  813. #define AR5K_PCICFG_LEDMODE_PWR 0x00040000 /* Some other blinking mode (?) [5211+] */
  814. #define AR5K_PCICFG_LEDMODE_RAND 0x00060000 /* Random blinking (?) [5211+] */
  815. #define AR5K_PCICFG_LEDBLINK 0x00700000 /* Led blink rate */
  816. #define AR5K_PCICFG_LEDBLINK_S 20
  817. #define AR5K_PCICFG_LEDSLOW 0x00800000 /* Slowest led blink rate [5211+] */
  818. #define AR5K_PCICFG_LEDSTATE \
  819. (AR5K_PCICFG_LED | AR5K_PCICFG_LEDMODE | \
  820. AR5K_PCICFG_LEDBLINK | AR5K_PCICFG_LEDSLOW)
  821. #define AR5K_PCICFG_SLEEP_CLOCK_RATE 0x03000000 /* Sleep clock rate */
  822. #define AR5K_PCICFG_SLEEP_CLOCK_RATE_S 24
  823. /*
  824. * "General Purpose Input/Output" (GPIO) control register
  825. *
  826. * I'm not sure about this but after looking at the code
  827. * for all chipsets here is what i got.
  828. *
  829. * We have 6 GPIOs (pins), each GPIO has 4 modes (2 bits)
  830. * Mode 0 -> always input
  831. * Mode 1 -> output when GPIODO for this GPIO is set to 0
  832. * Mode 2 -> output when GPIODO for this GPIO is set to 1
  833. * Mode 3 -> always output
  834. *
  835. * For more infos check out get_gpio/set_gpio and
  836. * set_gpio_input/set_gpio_output functs.
  837. * For more infos on gpio interrupt check out set_gpio_intr.
  838. */
  839. #define AR5K_NUM_GPIO 6
  840. #define AR5K_GPIOCR 0x4014 /* Register Address */
  841. #define AR5K_GPIOCR_INT_ENA 0x00008000 /* Enable GPIO interrupt */
  842. #define AR5K_GPIOCR_INT_SELL 0x00000000 /* Generate interrupt when pin is low */
  843. #define AR5K_GPIOCR_INT_SELH 0x00010000 /* Generate interrupt when pin is high */
  844. #define AR5K_GPIOCR_IN(n) (0 << ((n) * 2)) /* Mode 0 for pin n */
  845. #define AR5K_GPIOCR_OUT0(n) (1 << ((n) * 2)) /* Mode 1 for pin n */
  846. #define AR5K_GPIOCR_OUT1(n) (2 << ((n) * 2)) /* Mode 2 for pin n */
  847. #define AR5K_GPIOCR_OUT(n) (3 << ((n) * 2)) /* Mode 3 for pin n */
  848. #define AR5K_GPIOCR_INT_SEL(n) ((n) << 12) /* Interrupt for GPIO pin n */
  849. /*
  850. * "General Purpose Input/Output" (GPIO) data output register
  851. */
  852. #define AR5K_GPIODO 0x4018
  853. /*
  854. * "General Purpose Input/Output" (GPIO) data input register
  855. */
  856. #define AR5K_GPIODI 0x401c
  857. #define AR5K_GPIODI_M 0x0000002f
  858. /*
  859. * Silicon revision register
  860. */
  861. #define AR5K_SREV 0x4020 /* Register Address */
  862. #define AR5K_SREV_REV 0x0000000f /* Mask for revision */
  863. #define AR5K_SREV_REV_S 0
  864. #define AR5K_SREV_VER 0x000000ff /* Mask for version */
  865. #define AR5K_SREV_VER_S 4
  866. /*
  867. * TXE write posting register
  868. */
  869. #define AR5K_TXEPOST 0x4028
  870. /*
  871. * QCU sleep mask
  872. */
  873. #define AR5K_QCU_SLEEP_MASK 0x402c
  874. /* 0x4068 is compression buffer configuration
  875. * register on 5414 and pm configuration register
  876. * on 5424 and newer pci-e chips. */
  877. /*
  878. * Compression buffer configuration
  879. * register (enable/disable) [5414]
  880. */
  881. #define AR5K_5414_CBCFG 0x4068
  882. #define AR5K_5414_CBCFG_BUF_DIS 0x10 /* Disable buffer */
  883. /*
  884. * PCI-E Power managment configuration
  885. * and status register [5424+]
  886. */
  887. #define AR5K_PCIE_PM_CTL 0x4068 /* Register address */
  888. /* Only 5424 */
  889. #define AR5K_PCIE_PM_CTL_L1_WHEN_D2 0x00000001 /* enable PCIe core enter L1
  890. when d2_sleep_en is asserted */
  891. #define AR5K_PCIE_PM_CTL_L0_L0S_CLEAR 0x00000002 /* Clear L0 and L0S counters */
  892. #define AR5K_PCIE_PM_CTL_L0_L0S_EN 0x00000004 /* Start L0 nd L0S counters */
  893. #define AR5K_PCIE_PM_CTL_LDRESET_EN 0x00000008 /* Enable reset when link goes
  894. down */
  895. /* Wake On Wireless */
  896. #define AR5K_PCIE_PM_CTL_PME_EN 0x00000010 /* PME Enable */
  897. #define AR5K_PCIE_PM_CTL_AUX_PWR_DET 0x00000020 /* Aux power detect */
  898. #define AR5K_PCIE_PM_CTL_PME_CLEAR 0x00000040 /* Clear PME */
  899. #define AR5K_PCIE_PM_CTL_PSM_D0 0x00000080
  900. #define AR5K_PCIE_PM_CTL_PSM_D1 0x00000100
  901. #define AR5K_PCIE_PM_CTL_PSM_D2 0x00000200
  902. #define AR5K_PCIE_PM_CTL_PSM_D3 0x00000400
  903. /*
  904. * PCI-E Workaround enable register
  905. */
  906. #define AR5K_PCIE_WAEN 0x407c
  907. /*
  908. * PCI-E Serializer/Desirializer
  909. * registers
  910. */
  911. #define AR5K_PCIE_SERDES 0x4080
  912. #define AR5K_PCIE_SERDES_RESET 0x4084
  913. /*====EEPROM REGISTERS====*/
  914. /*
  915. * EEPROM access registers
  916. *
  917. * Here we got a difference between 5210/5211-12
  918. * read data register for 5210 is at 0x6800 and
  919. * status register is at 0x6c00. There is also
  920. * no eeprom command register on 5210 and the
  921. * offsets are different.
  922. *
  923. * To read eeprom data for a specific offset:
  924. * 5210 - enable eeprom access (AR5K_PCICFG_EEAE)
  925. * read AR5K_EEPROM_BASE +(4 * offset)
  926. * check the eeprom status register
  927. * and read eeprom data register.
  928. *
  929. * 5211 - write offset to AR5K_EEPROM_BASE
  930. * 5212 write AR5K_EEPROM_CMD_READ on AR5K_EEPROM_CMD
  931. * check the eeprom status register
  932. * and read eeprom data register.
  933. *
  934. * To write eeprom data for a specific offset:
  935. * 5210 - enable eeprom access (AR5K_PCICFG_EEAE)
  936. * write data to AR5K_EEPROM_BASE +(4 * offset)
  937. * check the eeprom status register
  938. * 5211 - write AR5K_EEPROM_CMD_RESET on AR5K_EEPROM_CMD
  939. * 5212 write offset to AR5K_EEPROM_BASE
  940. * write data to data register
  941. * write AR5K_EEPROM_CMD_WRITE on AR5K_EEPROM_CMD
  942. * check the eeprom status register
  943. *
  944. * For more infos check eeprom_* functs and the ar5k.c
  945. * file posted in madwifi-devel mailing list.
  946. * http://sourceforge.net/mailarchive/message.php?msg_id=8966525
  947. *
  948. */
  949. #define AR5K_EEPROM_BASE 0x6000
  950. /*
  951. * EEPROM data register
  952. */
  953. #define AR5K_EEPROM_DATA_5211 0x6004
  954. #define AR5K_EEPROM_DATA_5210 0x6800
  955. #define AR5K_EEPROM_DATA (ah->ah_version == AR5K_AR5210 ? \
  956. AR5K_EEPROM_DATA_5210 : AR5K_EEPROM_DATA_5211)
  957. /*
  958. * EEPROM command register
  959. */
  960. #define AR5K_EEPROM_CMD 0x6008 /* Register Addres */
  961. #define AR5K_EEPROM_CMD_READ 0x00000001 /* EEPROM read */
  962. #define AR5K_EEPROM_CMD_WRITE 0x00000002 /* EEPROM write */
  963. #define AR5K_EEPROM_CMD_RESET 0x00000004 /* EEPROM reset */
  964. /*
  965. * EEPROM status register
  966. */
  967. #define AR5K_EEPROM_STAT_5210 0x6c00 /* Register Address [5210] */
  968. #define AR5K_EEPROM_STAT_5211 0x600c /* Register Address [5211+] */
  969. #define AR5K_EEPROM_STATUS (ah->ah_version == AR5K_AR5210 ? \
  970. AR5K_EEPROM_STAT_5210 : AR5K_EEPROM_STAT_5211)
  971. #define AR5K_EEPROM_STAT_RDERR 0x00000001 /* EEPROM read failed */
  972. #define AR5K_EEPROM_STAT_RDDONE 0x00000002 /* EEPROM read successful */
  973. #define AR5K_EEPROM_STAT_WRERR 0x00000004 /* EEPROM write failed */
  974. #define AR5K_EEPROM_STAT_WRDONE 0x00000008 /* EEPROM write successful */
  975. /*
  976. * EEPROM config register
  977. */
  978. #define AR5K_EEPROM_CFG 0x6010 /* Register Addres */
  979. #define AR5K_EEPROM_CFG_SIZE 0x00000003 /* Size determination override */
  980. #define AR5K_EEPROM_CFG_SIZE_AUTO 0
  981. #define AR5K_EEPROM_CFG_SIZE_4KBIT 1
  982. #define AR5K_EEPROM_CFG_SIZE_8KBIT 2
  983. #define AR5K_EEPROM_CFG_SIZE_16KBIT 3
  984. #define AR5K_EEPROM_CFG_WR_WAIT_DIS 0x00000004 /* Disable write wait */
  985. #define AR5K_EEPROM_CFG_CLK_RATE 0x00000018 /* Clock rate */
  986. #define AR5K_EEPROM_CFG_CLK_RATE_S 3
  987. #define AR5K_EEPROM_CFG_CLK_RATE_156KHZ 0
  988. #define AR5K_EEPROM_CFG_CLK_RATE_312KHZ 1
  989. #define AR5K_EEPROM_CFG_CLK_RATE_625KHZ 2
  990. #define AR5K_EEPROM_CFG_PROT_KEY 0x00ffff00 /* Protection key */
  991. #define AR5K_EEPROM_CFG_PROT_KEY_S 8
  992. #define AR5K_EEPROM_CFG_LIND_EN 0x01000000 /* Enable length indicator (?) */
  993. /*
  994. * TODO: Wake On Wireless registers
  995. * Range 0x7000 - 0x7ce0
  996. */
  997. /*
  998. * Protocol Control Unit (PCU) registers
  999. */
  1000. /*
  1001. * Used for checking initial register writes
  1002. * during channel reset (see reset func)
  1003. */
  1004. #define AR5K_PCU_MIN 0x8000
  1005. #define AR5K_PCU_MAX 0x8fff
  1006. /*
  1007. * First station id register (Lower 32 bits of MAC address)
  1008. */
  1009. #define AR5K_STA_ID0 0x8000
  1010. #define AR5K_STA_ID0_ARRD_L32 0xffffffff
  1011. /*
  1012. * Second station id register (Upper 16 bits of MAC address + PCU settings)
  1013. */
  1014. #define AR5K_STA_ID1 0x8004 /* Register Address */
  1015. #define AR5K_STA_ID1_ADDR_U16 0x0000ffff /* Upper 16 bits of MAC addres */
  1016. #define AR5K_STA_ID1_AP 0x00010000 /* Set AP mode */
  1017. #define AR5K_STA_ID1_ADHOC 0x00020000 /* Set Ad-Hoc mode */
  1018. #define AR5K_STA_ID1_PWR_SV 0x00040000 /* Power save reporting */
  1019. #define AR5K_STA_ID1_NO_KEYSRCH 0x00080000 /* No key search */
  1020. #define AR5K_STA_ID1_NO_PSPOLL 0x00100000 /* No power save polling [5210] */
  1021. #define AR5K_STA_ID1_PCF_5211 0x00100000 /* Enable PCF on [5211+] */
  1022. #define AR5K_STA_ID1_PCF_5210 0x00200000 /* Enable PCF on [5210]*/
  1023. #define AR5K_STA_ID1_PCF (ah->ah_version == AR5K_AR5210 ? \
  1024. AR5K_STA_ID1_PCF_5210 : AR5K_STA_ID1_PCF_5211)
  1025. #define AR5K_STA_ID1_DEFAULT_ANTENNA 0x00200000 /* Use default antenna */
  1026. #define AR5K_STA_ID1_DESC_ANTENNA 0x00400000 /* Update antenna from descriptor */
  1027. #define AR5K_STA_ID1_RTS_DEF_ANTENNA 0x00800000 /* Use default antenna for RTS */
  1028. #define AR5K_STA_ID1_ACKCTS_6MB 0x01000000 /* Use 6Mbit/s for ACK/CTS */
  1029. #define AR5K_STA_ID1_BASE_RATE_11B 0x02000000 /* Use 11b base rate for ACK/CTS [5211+] */
  1030. #define AR5K_STA_ID1_SELFGEN_DEF_ANT 0x04000000 /* Use def. antenna for self generated frames */
  1031. #define AR5K_STA_ID1_CRYPT_MIC_EN 0x08000000 /* Enable MIC */
  1032. #define AR5K_STA_ID1_KEYSRCH_MODE 0x10000000 /* Look up key when key id != 0 */
  1033. #define AR5K_STA_ID1_PRESERVE_SEQ_NUM 0x20000000 /* Preserve sequence number */
  1034. #define AR5K_STA_ID1_CBCIV_ENDIAN 0x40000000 /* ??? */
  1035. #define AR5K_STA_ID1_KEYSRCH_MCAST 0x80000000 /* Do key cache search for mcast frames */
  1036. /*
  1037. * First BSSID register (MAC address, lower 32bits)
  1038. */
  1039. #define AR5K_BSS_ID0 0x8008
  1040. /*
  1041. * Second BSSID register (MAC address in upper 16 bits)
  1042. *
  1043. * AID: Association ID
  1044. */
  1045. #define AR5K_BSS_ID1 0x800c
  1046. #define AR5K_BSS_ID1_AID 0xffff0000
  1047. #define AR5K_BSS_ID1_AID_S 16
  1048. /*
  1049. * Backoff slot time register
  1050. */
  1051. #define AR5K_SLOT_TIME 0x8010
  1052. /*
  1053. * ACK/CTS timeout register
  1054. */
  1055. #define AR5K_TIME_OUT 0x8014 /* Register Address */
  1056. #define AR5K_TIME_OUT_ACK 0x00001fff /* ACK timeout mask */
  1057. #define AR5K_TIME_OUT_ACK_S 0
  1058. #define AR5K_TIME_OUT_CTS 0x1fff0000 /* CTS timeout mask */
  1059. #define AR5K_TIME_OUT_CTS_S 16
  1060. /*
  1061. * RSSI threshold register
  1062. */
  1063. #define AR5K_RSSI_THR 0x8018 /* Register Address */
  1064. #define AR5K_RSSI_THR_M 0x000000ff /* Mask for RSSI threshold [5211+] */
  1065. #define AR5K_RSSI_THR_BMISS_5210 0x00000700 /* Mask for Beacon Missed threshold [5210] */
  1066. #define AR5K_RSSI_THR_BMISS_5210_S 8
  1067. #define AR5K_RSSI_THR_BMISS_5211 0x0000ff00 /* Mask for Beacon Missed threshold [5211+] */
  1068. #define AR5K_RSSI_THR_BMISS_5211_S 8
  1069. #define AR5K_RSSI_THR_BMISS (ah->ah_version == AR5K_AR5210 ? \
  1070. AR5K_RSSI_THR_BMISS_5210 : AR5K_RSSI_THR_BMISS_5211)
  1071. #define AR5K_RSSI_THR_BMISS_S 8
  1072. /*
  1073. * 5210 has more PCU registers because there is no QCU/DCU
  1074. * so queue parameters are set here, this way a lot common
  1075. * registers have different address for 5210. To make things
  1076. * easier we define a macro based on ah->ah_version for common
  1077. * registers with different addresses and common flags.
  1078. */
  1079. /*
  1080. * Retry limit register
  1081. *
  1082. * Retry limit register for 5210 (no QCU/DCU so it's done in PCU)
  1083. */
  1084. #define AR5K_NODCU_RETRY_LMT 0x801c /* Register Address */
  1085. #define AR5K_NODCU_RETRY_LMT_SH_RETRY 0x0000000f /* Short retry limit mask */
  1086. #define AR5K_NODCU_RETRY_LMT_SH_RETRY_S 0
  1087. #define AR5K_NODCU_RETRY_LMT_LG_RETRY 0x000000f0 /* Long retry mask */
  1088. #define AR5K_NODCU_RETRY_LMT_LG_RETRY_S 4
  1089. #define AR5K_NODCU_RETRY_LMT_SSH_RETRY 0x00003f00 /* Station short retry limit mask */
  1090. #define AR5K_NODCU_RETRY_LMT_SSH_RETRY_S 8
  1091. #define AR5K_NODCU_RETRY_LMT_SLG_RETRY 0x000fc000 /* Station long retry limit mask */
  1092. #define AR5K_NODCU_RETRY_LMT_SLG_RETRY_S 14
  1093. #define AR5K_NODCU_RETRY_LMT_CW_MIN 0x3ff00000 /* Minimum contention window mask */
  1094. #define AR5K_NODCU_RETRY_LMT_CW_MIN_S 20
  1095. /*
  1096. * Transmit latency register
  1097. */
  1098. #define AR5K_USEC_5210 0x8020 /* Register Address [5210] */
  1099. #define AR5K_USEC_5211 0x801c /* Register Address [5211+] */
  1100. #define AR5K_USEC (ah->ah_version == AR5K_AR5210 ? \
  1101. AR5K_USEC_5210 : AR5K_USEC_5211)
  1102. #define AR5K_USEC_1 0x0000007f /* clock cycles for 1us */
  1103. #define AR5K_USEC_1_S 0
  1104. #define AR5K_USEC_32 0x00003f80 /* clock cycles for 1us while on 32Mhz clock */
  1105. #define AR5K_USEC_32_S 7
  1106. #define AR5K_USEC_TX_LATENCY_5211 0x007fc000
  1107. #define AR5K_USEC_TX_LATENCY_5211_S 14
  1108. #define AR5K_USEC_RX_LATENCY_5211 0x1f800000
  1109. #define AR5K_USEC_RX_LATENCY_5211_S 23
  1110. #define AR5K_USEC_TX_LATENCY_5210 0x000fc000 /* also for 5311 */
  1111. #define AR5K_USEC_TX_LATENCY_5210_S 14
  1112. #define AR5K_USEC_RX_LATENCY_5210 0x03f00000 /* also for 5311 */
  1113. #define AR5K_USEC_RX_LATENCY_5210_S 20
  1114. /*
  1115. * PCU beacon control register
  1116. */
  1117. #define AR5K_BEACON_5210 0x8024 /*Register Address [5210] */
  1118. #define AR5K_BEACON_5211 0x8020 /*Register Address [5211+] */
  1119. #define AR5K_BEACON (ah->ah_version == AR5K_AR5210 ? \
  1120. AR5K_BEACON_5210 : AR5K_BEACON_5211)
  1121. #define AR5K_BEACON_PERIOD 0x0000ffff /* Mask for beacon period */
  1122. #define AR5K_BEACON_PERIOD_S 0
  1123. #define AR5K_BEACON_TIM 0x007f0000 /* Mask for TIM offset */
  1124. #define AR5K_BEACON_TIM_S 16
  1125. #define AR5K_BEACON_ENABLE 0x00800000 /* Enable beacons */
  1126. #define AR5K_BEACON_RESET_TSF 0x01000000 /* Force TSF reset */
  1127. /*
  1128. * CFP period register
  1129. */
  1130. #define AR5K_CFP_PERIOD_5210 0x8028
  1131. #define AR5K_CFP_PERIOD_5211 0x8024
  1132. #define AR5K_CFP_PERIOD (ah->ah_version == AR5K_AR5210 ? \
  1133. AR5K_CFP_PERIOD_5210 : AR5K_CFP_PERIOD_5211)
  1134. /*
  1135. * Next beacon time register
  1136. */
  1137. #define AR5K_TIMER0_5210 0x802c
  1138. #define AR5K_TIMER0_5211 0x8028
  1139. #define AR5K_TIMER0 (ah->ah_version == AR5K_AR5210 ? \
  1140. AR5K_TIMER0_5210 : AR5K_TIMER0_5211)
  1141. /*
  1142. * Next DMA beacon alert register
  1143. */
  1144. #define AR5K_TIMER1_5210 0x8030
  1145. #define AR5K_TIMER1_5211 0x802c
  1146. #define AR5K_TIMER1 (ah->ah_version == AR5K_AR5210 ? \
  1147. AR5K_TIMER1_5210 : AR5K_TIMER1_5211)
  1148. /*
  1149. * Next software beacon alert register
  1150. */
  1151. #define AR5K_TIMER2_5210 0x8034
  1152. #define AR5K_TIMER2_5211 0x8030
  1153. #define AR5K_TIMER2 (ah->ah_version == AR5K_AR5210 ? \
  1154. AR5K_TIMER2_5210 : AR5K_TIMER2_5211)
  1155. /*
  1156. * Next ATIM window time register
  1157. */
  1158. #define AR5K_TIMER3_5210 0x8038
  1159. #define AR5K_TIMER3_5211 0x8034
  1160. #define AR5K_TIMER3 (ah->ah_version == AR5K_AR5210 ? \
  1161. AR5K_TIMER3_5210 : AR5K_TIMER3_5211)
  1162. /*
  1163. * 5210 First inter frame spacing register (IFS)
  1164. */
  1165. #define AR5K_IFS0 0x8040
  1166. #define AR5K_IFS0_SIFS 0x000007ff
  1167. #define AR5K_IFS0_SIFS_S 0
  1168. #define AR5K_IFS0_DIFS 0x007ff800
  1169. #define AR5K_IFS0_DIFS_S 11
  1170. /*
  1171. * 5210 Second inter frame spacing register (IFS)
  1172. */
  1173. #define AR5K_IFS1 0x8044
  1174. #define AR5K_IFS1_PIFS 0x00000fff
  1175. #define AR5K_IFS1_PIFS_S 0
  1176. #define AR5K_IFS1_EIFS 0x03fff000
  1177. #define AR5K_IFS1_EIFS_S 12
  1178. #define AR5K_IFS1_CS_EN 0x04000000
  1179. /*
  1180. * CFP duration register
  1181. */
  1182. #define AR5K_CFP_DUR_5210 0x8048
  1183. #define AR5K_CFP_DUR_5211 0x8038
  1184. #define AR5K_CFP_DUR (ah->ah_version == AR5K_AR5210 ? \
  1185. AR5K_CFP_DUR_5210 : AR5K_CFP_DUR_5211)
  1186. /*
  1187. * Receive filter register
  1188. */
  1189. #define AR5K_RX_FILTER_5210 0x804c /* Register Address [5210] */
  1190. #define AR5K_RX_FILTER_5211 0x803c /* Register Address [5211+] */
  1191. #define AR5K_RX_FILTER (ah->ah_version == AR5K_AR5210 ? \
  1192. AR5K_RX_FILTER_5210 : AR5K_RX_FILTER_5211)
  1193. #define AR5K_RX_FILTER_UCAST 0x00000001 /* Don't filter unicast frames */
  1194. #define AR5K_RX_FILTER_MCAST 0x00000002 /* Don't filter multicast frames */
  1195. #define AR5K_RX_FILTER_BCAST 0x00000004 /* Don't filter broadcast frames */
  1196. #define AR5K_RX_FILTER_CONTROL 0x00000008 /* Don't filter control frames */
  1197. #define AR5K_RX_FILTER_BEACON 0x00000010 /* Don't filter beacon frames */
  1198. #define AR5K_RX_FILTER_PROM 0x00000020 /* Set promiscuous mode */
  1199. #define AR5K_RX_FILTER_XRPOLL 0x00000040 /* Don't filter XR poll frame [5212+] */
  1200. #define AR5K_RX_FILTER_PROBEREQ 0x00000080 /* Don't filter probe requests [5212+] */
  1201. #define AR5K_RX_FILTER_PHYERR_5212 0x00000100 /* Don't filter phy errors [5212+] */
  1202. #define AR5K_RX_FILTER_RADARERR_5212 0x00000200 /* Don't filter phy radar errors [5212+] */
  1203. #define AR5K_RX_FILTER_PHYERR_5211 0x00000040 /* [5211] */
  1204. #define AR5K_RX_FILTER_RADARERR_5211 0x00000080 /* [5211] */
  1205. #define AR5K_RX_FILTER_PHYERR \
  1206. ((ah->ah_version == AR5K_AR5211 ? \
  1207. AR5K_RX_FILTER_PHYERR_5211 : AR5K_RX_FILTER_PHYERR_5212))
  1208. #define AR5K_RX_FILTER_RADARERR \
  1209. ((ah->ah_version == AR5K_AR5211 ? \
  1210. AR5K_RX_FILTER_RADARERR_5211 : AR5K_RX_FILTER_RADARERR_5212))
  1211. /*
  1212. * Multicast filter register (lower 32 bits)
  1213. */
  1214. #define AR5K_MCAST_FILTER0_5210 0x8050
  1215. #define AR5K_MCAST_FILTER0_5211 0x8040
  1216. #define AR5K_MCAST_FILTER0 (ah->ah_version == AR5K_AR5210 ? \
  1217. AR5K_MCAST_FILTER0_5210 : AR5K_MCAST_FILTER0_5211)
  1218. /*
  1219. * Multicast filter register (higher 16 bits)
  1220. */
  1221. #define AR5K_MCAST_FILTER1_5210 0x8054
  1222. #define AR5K_MCAST_FILTER1_5211 0x8044
  1223. #define AR5K_MCAST_FILTER1 (ah->ah_version == AR5K_AR5210 ? \
  1224. AR5K_MCAST_FILTER1_5210 : AR5K_MCAST_FILTER1_5211)
  1225. /*
  1226. * Transmit mask register (lower 32 bits) [5210]
  1227. */
  1228. #define AR5K_TX_MASK0 0x8058
  1229. /*
  1230. * Transmit mask register (higher 16 bits) [5210]
  1231. */
  1232. #define AR5K_TX_MASK1 0x805c
  1233. /*
  1234. * Clear transmit mask [5210]
  1235. */
  1236. #define AR5K_CLR_TMASK 0x8060
  1237. /*
  1238. * Trigger level register (before transmission) [5210]
  1239. */
  1240. #define AR5K_TRIG_LVL 0x8064
  1241. /*
  1242. * PCU control register
  1243. *
  1244. * Only DIS_RX is used in the code, the rest i guess are
  1245. * for tweaking/diagnostics.
  1246. */
  1247. #define AR5K_DIAG_SW_5210 0x8068 /* Register Address [5210] */
  1248. #define AR5K_DIAG_SW_5211 0x8048 /* Register Address [5211+] */
  1249. #define AR5K_DIAG_SW (ah->ah_version == AR5K_AR5210 ? \
  1250. AR5K_DIAG_SW_5210 : AR5K_DIAG_SW_5211)
  1251. #define AR5K_DIAG_SW_DIS_WEP_ACK 0x00000001 /* Disable ACKs if WEP key is invalid */
  1252. #define AR5K_DIAG_SW_DIS_ACK 0x00000002 /* Disable ACKs */
  1253. #define AR5K_DIAG_SW_DIS_CTS 0x00000004 /* Disable CTSs */
  1254. #define AR5K_DIAG_SW_DIS_ENC 0x00000008 /* Disable encryption */
  1255. #define AR5K_DIAG_SW_DIS_DEC 0x00000010 /* Disable decryption */
  1256. #define AR5K_DIAG_SW_DIS_TX 0x00000020 /* Disable transmit [5210] */
  1257. #define AR5K_DIAG_SW_DIS_RX_5210 0x00000040 /* Disable recieve */
  1258. #define AR5K_DIAG_SW_DIS_RX_5211 0x00000020
  1259. #define AR5K_DIAG_SW_DIS_RX (ah->ah_version == AR5K_AR5210 ? \
  1260. AR5K_DIAG_SW_DIS_RX_5210 : AR5K_DIAG_SW_DIS_RX_5211)
  1261. #define AR5K_DIAG_SW_LOOP_BACK_5210 0x00000080 /* Loopback (i guess it goes with DIS_TX) [5210] */
  1262. #define AR5K_DIAG_SW_LOOP_BACK_5211 0x00000040
  1263. #define AR5K_DIAG_SW_LOOP_BACK (ah->ah_version == AR5K_AR5210 ? \
  1264. AR5K_DIAG_SW_LOOP_BACK_5210 : AR5K_DIAG_SW_LOOP_BACK_5211)
  1265. #define AR5K_DIAG_SW_CORR_FCS_5210 0x00000100 /* Corrupted FCS */
  1266. #define AR5K_DIAG_SW_CORR_FCS_5211 0x00000080
  1267. #define AR5K_DIAG_SW_CORR_FCS (ah->ah_version == AR5K_AR5210 ? \
  1268. AR5K_DIAG_SW_CORR_FCS_5210 : AR5K_DIAG_SW_CORR_FCS_5211)
  1269. #define AR5K_DIAG_SW_CHAN_INFO_5210 0x00000200 /* Dump channel info */
  1270. #define AR5K_DIAG_SW_CHAN_INFO_5211 0x00000100
  1271. #define AR5K_DIAG_SW_CHAN_INFO (ah->ah_version == AR5K_AR5210 ? \
  1272. AR5K_DIAG_SW_CHAN_INFO_5210 : AR5K_DIAG_SW_CHAN_INFO_5211)
  1273. #define AR5K_DIAG_SW_EN_SCRAM_SEED_5210 0x00000400 /* Enable fixed scrambler seed */
  1274. #define AR5K_DIAG_SW_EN_SCRAM_SEED_5211 0x00000200
  1275. #define AR5K_DIAG_SW_EN_SCRAM_SEED (ah->ah_version == AR5K_AR5210 ? \
  1276. AR5K_DIAG_SW_EN_SCRAM_SEED_5210 : AR5K_DIAG_SW_EN_SCRAM_SEED_5211)
  1277. #define AR5K_DIAG_SW_ECO_ENABLE 0x00000400 /* [5211+] */
  1278. #define AR5K_DIAG_SW_SCVRAM_SEED 0x0003f800 /* [5210] */
  1279. #define AR5K_DIAG_SW_SCRAM_SEED_M 0x0001fc00 /* Scrambler seed mask */
  1280. #define AR5K_DIAG_SW_SCRAM_SEED_S 10
  1281. #define AR5K_DIAG_SW_DIS_SEQ_INC 0x00040000 /* Disable seqnum increment (?)[5210] */
  1282. #define AR5K_DIAG_SW_FRAME_NV0_5210 0x00080000
  1283. #define AR5K_DIAG_SW_FRAME_NV0_5211 0x00020000 /* Accept frames of non-zero protocol number */
  1284. #define AR5K_DIAG_SW_FRAME_NV0 (ah->ah_version == AR5K_AR5210 ? \
  1285. AR5K_DIAG_SW_FRAME_NV0_5210 : AR5K_DIAG_SW_FRAME_NV0_5211)
  1286. #define AR5K_DIAG_SW_OBSPT_M 0x000c0000 /* Observation point select (?) */
  1287. #define AR5K_DIAG_SW_OBSPT_S 18
  1288. #define AR5K_DIAG_SW_RX_CLEAR_HIGH 0x0010000 /* Force RX Clear high */
  1289. #define AR5K_DIAG_SW_IGNORE_CARR_SENSE 0x0020000 /* Ignore virtual carrier sense */
  1290. #define AR5K_DIAG_SW_CHANEL_IDLE_HIGH 0x0040000 /* Force channel idle high */
  1291. #define AR5K_DIAG_SW_PHEAR_ME 0x0080000 /* ??? */
  1292. /*
  1293. * TSF (clock) register (lower 32 bits)
  1294. */
  1295. #define AR5K_TSF_L32_5210 0x806c
  1296. #define AR5K_TSF_L32_5211 0x804c
  1297. #define AR5K_TSF_L32 (ah->ah_version == AR5K_AR5210 ? \
  1298. AR5K_TSF_L32_5210 : AR5K_TSF_L32_5211)
  1299. /*
  1300. * TSF (clock) register (higher 32 bits)
  1301. */
  1302. #define AR5K_TSF_U32_5210 0x8070
  1303. #define AR5K_TSF_U32_5211 0x8050
  1304. #define AR5K_TSF_U32 (ah->ah_version == AR5K_AR5210 ? \
  1305. AR5K_TSF_U32_5210 : AR5K_TSF_U32_5211)
  1306. /*
  1307. * Last beacon timestamp register (Read Only)
  1308. */
  1309. #define AR5K_LAST_TSTP 0x8080
  1310. /*
  1311. * ADDAC test register [5211+]
  1312. */
  1313. #define AR5K_ADDAC_TEST 0x8054 /* Register Address */
  1314. #define AR5K_ADDAC_TEST_TXCONT 0x00000001 /* Test continuous tx */
  1315. #define AR5K_ADDAC_TEST_TST_MODE 0x00000002 /* Test mode */
  1316. #define AR5K_ADDAC_TEST_LOOP_EN 0x00000004 /* Enable loop */
  1317. #define AR5K_ADDAC_TEST_LOOP_LEN 0x00000008 /* Loop length (field) */
  1318. #define AR5K_ADDAC_TEST_USE_U8 0x00004000 /* Use upper 8 bits */
  1319. #define AR5K_ADDAC_TEST_MSB 0x00008000 /* State of MSB */
  1320. #define AR5K_ADDAC_TEST_TRIG_SEL 0x00010000 /* Trigger select */
  1321. #define AR5K_ADDAC_TEST_TRIG_PTY 0x00020000 /* Trigger polarity */
  1322. #define AR5K_ADDAC_TEST_RXCONT 0x00040000 /* Continuous capture */
  1323. #define AR5K_ADDAC_TEST_CAPTURE 0x00080000 /* Begin capture */
  1324. #define AR5K_ADDAC_TEST_TST_ARM 0x00100000 /* ARM rx buffer for capture */
  1325. /*
  1326. * Default antenna register [5211+]
  1327. */
  1328. #define AR5K_DEFAULT_ANTENNA 0x8058
  1329. /*
  1330. * Frame control QoS mask register (?) [5211+]
  1331. * (FC_QOS_MASK)
  1332. */
  1333. #define AR5K_FRAME_CTL_QOSM 0x805c
  1334. /*
  1335. * Seq mask register (?) [5211+]
  1336. */
  1337. #define AR5K_SEQ_MASK 0x8060
  1338. /*
  1339. * Retry count register [5210]
  1340. */
  1341. #define AR5K_RETRY_CNT 0x8084 /* Register Address [5210] */
  1342. #define AR5K_RETRY_CNT_SSH 0x0000003f /* Station short retry count (?) */
  1343. #define AR5K_RETRY_CNT_SLG 0x00000fc0 /* Station long retry count (?) */
  1344. /*
  1345. * Back-off status register [5210]
  1346. */
  1347. #define AR5K_BACKOFF 0x8088 /* Register Address [5210] */
  1348. #define AR5K_BACKOFF_CW 0x000003ff /* Backoff Contention Window (?) */
  1349. #define AR5K_BACKOFF_CNT 0x03ff0000 /* Backoff count (?) */
  1350. /*
  1351. * NAV register (current)
  1352. */
  1353. #define AR5K_NAV_5210 0x808c
  1354. #define AR5K_NAV_5211 0x8084
  1355. #define AR5K_NAV (ah->ah_version == AR5K_AR5210 ? \
  1356. AR5K_NAV_5210 : AR5K_NAV_5211)
  1357. /*
  1358. * RTS success register
  1359. */
  1360. #define AR5K_RTS_OK_5210 0x8090
  1361. #define AR5K_RTS_OK_5211 0x8088
  1362. #define AR5K_RTS_OK (ah->ah_version == AR5K_AR5210 ? \
  1363. AR5K_RTS_OK_5210 : AR5K_RTS_OK_5211)
  1364. /*
  1365. * RTS failure register
  1366. */
  1367. #define AR5K_RTS_FAIL_5210 0x8094
  1368. #define AR5K_RTS_FAIL_5211 0x808c
  1369. #define AR5K_RTS_FAIL (ah->ah_version == AR5K_AR5210 ? \
  1370. AR5K_RTS_FAIL_5210 : AR5K_RTS_FAIL_5211)
  1371. /*
  1372. * ACK failure register
  1373. */
  1374. #define AR5K_ACK_FAIL_5210 0x8098
  1375. #define AR5K_ACK_FAIL_5211 0x8090
  1376. #define AR5K_ACK_FAIL (ah->ah_version == AR5K_AR5210 ? \
  1377. AR5K_ACK_FAIL_5210 : AR5K_ACK_FAIL_5211)
  1378. /*
  1379. * FCS failure register
  1380. */
  1381. #define AR5K_FCS_FAIL_5210 0x809c
  1382. #define AR5K_FCS_FAIL_5211 0x8094
  1383. #define AR5K_FCS_FAIL (ah->ah_version == AR5K_AR5210 ? \
  1384. AR5K_FCS_FAIL_5210 : AR5K_FCS_FAIL_5211)
  1385. /*
  1386. * Beacon count register
  1387. */
  1388. #define AR5K_BEACON_CNT_5210 0x80a0
  1389. #define AR5K_BEACON_CNT_5211 0x8098
  1390. #define AR5K_BEACON_CNT (ah->ah_version == AR5K_AR5210 ? \
  1391. AR5K_BEACON_CNT_5210 : AR5K_BEACON_CNT_5211)
  1392. /*===5212 Specific PCU registers===*/
  1393. /*
  1394. * Transmit power control register
  1395. */
  1396. #define AR5K_TPC 0x80e8
  1397. #define AR5K_TPC_ACK 0x0000003f /* ack frames */
  1398. #define AR5K_TPC_ACK_S 0
  1399. #define AR5K_TPC_CTS 0x00003f00 /* cts frames */
  1400. #define AR5K_TPC_CTS_S 8
  1401. #define AR5K_TPC_CHIRP 0x003f0000 /* chirp frames */
  1402. #define AR5K_TPC_CHIRP_S 16
  1403. #define AR5K_TPC_DOPPLER 0x0f000000 /* doppler chirp span */
  1404. #define AR5K_TPC_DOPPLER_S 24
  1405. /*
  1406. * XR (eXtended Range) mode register
  1407. */
  1408. #define AR5K_XRMODE 0x80c0 /* Register Address */
  1409. #define AR5K_XRMODE_POLL_TYPE_M 0x0000003f /* Mask for Poll type (?) */
  1410. #define AR5K_XRMODE_POLL_TYPE_S 0
  1411. #define AR5K_XRMODE_POLL_SUBTYPE_M 0x0000003c /* Mask for Poll subtype (?) */
  1412. #define AR5K_XRMODE_POLL_SUBTYPE_S 2
  1413. #define AR5K_XRMODE_POLL_WAIT_ALL 0x00000080 /* Wait for poll */
  1414. #define AR5K_XRMODE_SIFS_DELAY 0x000fff00 /* Mask for SIFS delay */
  1415. #define AR5K_XRMODE_FRAME_HOLD_M 0xfff00000 /* Mask for frame hold (?) */
  1416. #define AR5K_XRMODE_FRAME_HOLD_S 20
  1417. /*
  1418. * XR delay register
  1419. */
  1420. #define AR5K_XRDELAY 0x80c4 /* Register Address */
  1421. #define AR5K_XRDELAY_SLOT_DELAY_M 0x0000ffff /* Mask for slot delay */
  1422. #define AR5K_XRDELAY_SLOT_DELAY_S 0
  1423. #define AR5K_XRDELAY_CHIRP_DELAY_M 0xffff0000 /* Mask for CHIRP data delay */
  1424. #define AR5K_XRDELAY_CHIRP_DELAY_S 16
  1425. /*
  1426. * XR timeout register
  1427. */
  1428. #define AR5K_XRTIMEOUT 0x80c8 /* Register Address */
  1429. #define AR5K_XRTIMEOUT_CHIRP_M 0x0000ffff /* Mask for CHIRP timeout */
  1430. #define AR5K_XRTIMEOUT_CHIRP_S 0
  1431. #define AR5K_XRTIMEOUT_POLL_M 0xffff0000 /* Mask for Poll timeout */
  1432. #define AR5K_XRTIMEOUT_POLL_S 16
  1433. /*
  1434. * XR chirp register
  1435. */
  1436. #define AR5K_XRCHIRP 0x80cc /* Register Address */
  1437. #define AR5K_XRCHIRP_SEND 0x00000001 /* Send CHIRP */
  1438. #define AR5K_XRCHIRP_GAP 0xffff0000 /* Mask for CHIRP gap (?) */
  1439. /*
  1440. * XR stomp register
  1441. */
  1442. #define AR5K_XRSTOMP 0x80d0 /* Register Address */
  1443. #define AR5K_XRSTOMP_TX 0x00000001 /* Stomp Tx (?) */
  1444. #define AR5K_XRSTOMP_RX 0x00000002 /* Stomp Rx (?) */
  1445. #define AR5K_XRSTOMP_TX_RSSI 0x00000004 /* Stomp Tx RSSI (?) */
  1446. #define AR5K_XRSTOMP_TX_BSSID 0x00000008 /* Stomp Tx BSSID (?) */
  1447. #define AR5K_XRSTOMP_DATA 0x00000010 /* Stomp data (?)*/
  1448. #define AR5K_XRSTOMP_RSSI_THRES 0x0000ff00 /* Mask for XR RSSI threshold */
  1449. /*
  1450. * First enhanced sleep register
  1451. */
  1452. #define AR5K_SLEEP0 0x80d4 /* Register Address */
  1453. #define AR5K_SLEEP0_NEXT_DTIM 0x0007ffff /* Mask for next DTIM (?) */
  1454. #define AR5K_SLEEP0_NEXT_DTIM_S 0
  1455. #define AR5K_SLEEP0_ASSUME_DTIM 0x00080000 /* Assume DTIM */
  1456. #define AR5K_SLEEP0_ENH_SLEEP_EN 0x00100000 /* Enable enchanced sleep control */
  1457. #define AR5K_SLEEP0_CABTO 0xff000000 /* Mask for CAB Time Out */
  1458. #define AR5K_SLEEP0_CABTO_S 24
  1459. /*
  1460. * Second enhanced sleep register
  1461. */
  1462. #define AR5K_SLEEP1 0x80d8 /* Register Address */
  1463. #define AR5K_SLEEP1_NEXT_TIM 0x0007ffff /* Mask for next TIM (?) */
  1464. #define AR5K_SLEEP1_NEXT_TIM_S 0
  1465. #define AR5K_SLEEP1_BEACON_TO 0xff000000 /* Mask for Beacon Time Out */
  1466. #define AR5K_SLEEP1_BEACON_TO_S 24
  1467. /*
  1468. * Third enhanced sleep register
  1469. */
  1470. #define AR5K_SLEEP2 0x80dc /* Register Address */
  1471. #define AR5K_SLEEP2_TIM_PER 0x0000ffff /* Mask for TIM period (?) */
  1472. #define AR5K_SLEEP2_TIM_PER_S 0
  1473. #define AR5K_SLEEP2_DTIM_PER 0xffff0000 /* Mask for DTIM period (?) */
  1474. #define AR5K_SLEEP2_DTIM_PER_S 16
  1475. /*
  1476. * BSSID mask registers
  1477. */
  1478. #define AR5K_BSS_IDM0 0x80e0 /* Upper bits */
  1479. #define AR5K_BSS_IDM1 0x80e4 /* Lower bits */
  1480. /*
  1481. * TX power control (TPC) register
  1482. *
  1483. * XXX: PCDAC steps (0.5dbm) or DBM ?
  1484. *
  1485. */
  1486. #define AR5K_TXPC 0x80e8 /* Register Address */
  1487. #define AR5K_TXPC_ACK_M 0x0000003f /* ACK tx power */
  1488. #define AR5K_TXPC_ACK_S 0
  1489. #define AR5K_TXPC_CTS_M 0x00003f00 /* CTS tx power */
  1490. #define AR5K_TXPC_CTS_S 8
  1491. #define AR5K_TXPC_CHIRP_M 0x003f0000 /* CHIRP tx power */
  1492. #define AR5K_TXPC_CHIRP_S 16
  1493. #define AR5K_TXPC_DOPPLER 0x0f000000 /* Doppler chirp span (?) */
  1494. #define AR5K_TXPC_DOPPLER_S 24
  1495. /*
  1496. * Profile count registers
  1497. */
  1498. #define AR5K_PROFCNT_TX 0x80ec /* Tx count */
  1499. #define AR5K_PROFCNT_RX 0x80f0 /* Rx count */
  1500. #define AR5K_PROFCNT_RXCLR 0x80f4 /* Clear Rx count */
  1501. #define AR5K_PROFCNT_CYCLE 0x80f8 /* Cycle count (?) */
  1502. /*
  1503. * Quiet period control registers
  1504. */
  1505. #define AR5K_QUIET_CTL1 0x80fc /* Register Address */
  1506. #define AR5K_QUIET_CTL1_NEXT_QT_TSF 0x0000ffff /* Next quiet period TSF (TU) */
  1507. #define AR5K_QUIET_CTL1_NEXT_QT_TSF_S 0
  1508. #define AR5K_QUIET_CTL1_QT_EN 0x00010000 /* Enable quiet period */
  1509. #define AR5K_QUIET_CTL1_ACK_CTS_EN 0x00020000 /* Send ACK/CTS during quiet period */
  1510. #define AR5K_QUIET_CTL2 0x8100 /* Register Address */
  1511. #define AR5K_QUIET_CTL2_QT_PER 0x0000ffff /* Mask for quiet period periodicity */
  1512. #define AR5K_QUIET_CTL2_QT_PER_S 0
  1513. #define AR5K_QUIET_CTL2_QT_DUR 0xffff0000 /* Mask for quiet period duration */
  1514. #define AR5K_QUIET_CTL2_QT_DUR_S 16
  1515. /*
  1516. * TSF parameter register
  1517. */
  1518. #define AR5K_TSF_PARM 0x8104 /* Register Address */
  1519. #define AR5K_TSF_PARM_INC 0x000000ff /* Mask for TSF increment */
  1520. #define AR5K_TSF_PARM_INC_S 0
  1521. /*
  1522. * QoS NOACK policy
  1523. */
  1524. #define AR5K_QOS_NOACK 0x8108 /* Register Address */
  1525. #define AR5K_QOS_NOACK_2BIT_VALUES 0x0000000f /* ??? */
  1526. #define AR5K_QOS_NOACK_2BIT_VALUES_S 0
  1527. #define AR5K_QOS_NOACK_BIT_OFFSET 0x00000070 /* ??? */
  1528. #define AR5K_QOS_NOACK_BIT_OFFSET_S 4
  1529. #define AR5K_QOS_NOACK_BYTE_OFFSET 0x00000180 /* ??? */
  1530. #define AR5K_QOS_NOACK_BYTE_OFFSET_S 7
  1531. /*
  1532. * PHY error filter register
  1533. */
  1534. #define AR5K_PHY_ERR_FIL 0x810c
  1535. #define AR5K_PHY_ERR_FIL_RADAR 0x00000020 /* Radar signal */
  1536. #define AR5K_PHY_ERR_FIL_OFDM 0x00020000 /* OFDM false detect (ANI) */
  1537. #define AR5K_PHY_ERR_FIL_CCK 0x02000000 /* CCK false detect (ANI) */
  1538. /*
  1539. * XR latency register
  1540. */
  1541. #define AR5K_XRLAT_TX 0x8110
  1542. /*
  1543. * ACK SIFS register
  1544. */
  1545. #define AR5K_ACKSIFS 0x8114 /* Register Address */
  1546. #define AR5K_ACKSIFS_INC 0x00000000 /* ACK SIFS Increment (field) */
  1547. /*
  1548. * MIC QoS control register (?)
  1549. */
  1550. #define AR5K_MIC_QOS_CTL 0x8118 /* Register Address */
  1551. #define AR5K_MIC_QOS_CTL_OFF(_n) (1 << (_n * 2))
  1552. #define AR5K_MIC_QOS_CTL_MQ_EN 0x00010000 /* Enable MIC QoS */
  1553. /*
  1554. * MIC QoS select register (?)
  1555. */
  1556. #define AR5K_MIC_QOS_SEL 0x811c
  1557. #define AR5K_MIC_QOS_SEL_OFF(_n) (1 << (_n * 4))
  1558. /*
  1559. * Misc mode control register (?)
  1560. */
  1561. #define AR5K_MISC_MODE 0x8120 /* Register Address */
  1562. #define AR5K_MISC_MODE_FBSSID_MATCH 0x00000001 /* Force BSSID match */
  1563. #define AR5K_MISC_MODE_ACKSIFS_MEM 0x00000002 /* ACK SIFS memory (?) */
  1564. #define AR5K_MISC_MODE_COMBINED_MIC 0x00000004 /* use rx/tx MIC key */
  1565. /* more bits */
  1566. /*
  1567. * OFDM Filter counter
  1568. */
  1569. #define AR5K_OFDM_FIL_CNT 0x8124
  1570. /*
  1571. * CCK Filter counter
  1572. */
  1573. #define AR5K_CCK_FIL_CNT 0x8128
  1574. /*
  1575. * PHY Error Counters (?)
  1576. */
  1577. #define AR5K_PHYERR_CNT1 0x812c
  1578. #define AR5K_PHYERR_CNT1_MASK 0x8130
  1579. #define AR5K_PHYERR_CNT2 0x8134
  1580. #define AR5K_PHYERR_CNT2_MASK 0x8138
  1581. /*
  1582. * TSF Threshold register (?)
  1583. */
  1584. #define AR5K_TSF_THRES 0x813c
  1585. /*
  1586. * TODO: Wake On Wireless registers
  1587. * Range: 0x8147 - 0x818c
  1588. */
  1589. /*
  1590. * Rate -> ACK SIFS mapping table (32 entries)
  1591. */
  1592. #define AR5K_RATE_ACKSIFS_BASE 0x8680 /* Register Address */
  1593. #define AR5K_RATE_ACKSIFS(_n) (AR5K_RATE_ACKSIFS_BSE + ((_n) << 2))
  1594. #define AR5K_RATE_ACKSIFS_NORMAL 0x00000001 /* Normal SIFS (field) */
  1595. #define AR5K_RATE_ACKSIFS_TURBO 0x00000400 /* Turbo SIFS (field) */
  1596. /*
  1597. * Rate -> duration mapping table (32 entries)
  1598. */
  1599. #define AR5K_RATE_DUR_BASE 0x8700
  1600. #define AR5K_RATE_DUR(_n) (AR5K_RATE_DUR_BASE + ((_n) << 2))
  1601. /*
  1602. * Rate -> db mapping table
  1603. * (8 entries, each one has 4 8bit fields)
  1604. */
  1605. #define AR5K_RATE2DB_BASE 0x87c0
  1606. #define AR5K_RATE2DB(_n) (AR5K_RATE2DB_BASE + ((_n) << 2))
  1607. /*
  1608. * db -> Rate mapping table
  1609. * (8 entries, each one has 4 8bit fields)
  1610. */
  1611. #define AR5K_DB2RATE_BASE 0x87e0
  1612. #define AR5K_DB2RATE(_n) (AR5K_DB2RATE_BASE + ((_n) << 2))
  1613. /*===5212 end===*/
  1614. /*
  1615. * Key table (WEP) register
  1616. */
  1617. #define AR5K_KEYTABLE_0_5210 0x9000
  1618. #define AR5K_KEYTABLE_0_5211 0x8800
  1619. #define AR5K_KEYTABLE_5210(_n) (AR5K_KEYTABLE_0_5210 + ((_n) << 5))
  1620. #define AR5K_KEYTABLE_5211(_n) (AR5K_KEYTABLE_0_5211 + ((_n) << 5))
  1621. #define AR5K_KEYTABLE(_n) (ah->ah_version == AR5K_AR5210 ? \
  1622. AR5K_KEYTABLE_5210(_n) : AR5K_KEYTABLE_5211(_n))
  1623. #define AR5K_KEYTABLE_OFF(_n, x) (AR5K_KEYTABLE(_n) + (x << 2))
  1624. #define AR5K_KEYTABLE_TYPE(_n) AR5K_KEYTABLE_OFF(_n, 5)
  1625. #define AR5K_KEYTABLE_TYPE_40 0x00000000
  1626. #define AR5K_KEYTABLE_TYPE_104 0x00000001
  1627. #define AR5K_KEYTABLE_TYPE_128 0x00000003
  1628. #define AR5K_KEYTABLE_TYPE_TKIP 0x00000004 /* [5212+] */
  1629. #define AR5K_KEYTABLE_TYPE_AES 0x00000005 /* [5211+] */
  1630. #define AR5K_KEYTABLE_TYPE_CCM 0x00000006 /* [5212+] */
  1631. #define AR5K_KEYTABLE_TYPE_NULL 0x00000007 /* [5211+] */
  1632. #define AR5K_KEYTABLE_ANTENNA 0x00000008 /* [5212+] */
  1633. #define AR5K_KEYTABLE_MAC0(_n) AR5K_KEYTABLE_OFF(_n, 6)
  1634. #define AR5K_KEYTABLE_MAC1(_n) AR5K_KEYTABLE_OFF(_n, 7)
  1635. #define AR5K_KEYTABLE_VALID 0x00008000
  1636. /* If key type is TKIP and MIC is enabled
  1637. * MIC key goes in offset entry + 64 */
  1638. #define AR5K_KEYTABLE_MIC_OFFSET 64
  1639. /* WEP 40-bit = 40-bit entered key + 24 bit IV = 64-bit
  1640. * WEP 104-bit = 104-bit entered key + 24-bit IV = 128-bit
  1641. * WEP 128-bit = 128-bit entered key + 24 bit IV = 152-bit
  1642. *
  1643. * Some vendors have introduced bigger WEP keys to address
  1644. * security vulnerabilities in WEP. This includes:
  1645. *
  1646. * WEP 232-bit = 232-bit entered key + 24 bit IV = 256-bit
  1647. *
  1648. * We can expand this if we find ar5k Atheros cards with a larger
  1649. * key table size.
  1650. */
  1651. #define AR5K_KEYTABLE_SIZE_5210 64
  1652. #define AR5K_KEYTABLE_SIZE_5211 128
  1653. #define AR5K_KEYTABLE_SIZE (ah->ah_version == AR5K_AR5210 ? \
  1654. AR5K_KEYTABLE_SIZE_5210 : AR5K_KEYTABLE_SIZE_5211)
  1655. /*===PHY REGISTERS===*/
  1656. /*
  1657. * PHY registers start
  1658. */
  1659. #define AR5K_PHY_BASE 0x9800
  1660. #define AR5K_PHY(_n) (AR5K_PHY_BASE + ((_n) << 2))
  1661. /*
  1662. * TST_2 (Misc config parameters)
  1663. */
  1664. #define AR5K_PHY_TST2 0x9800 /* Register Address */
  1665. #define AR5K_PHY_TST2_TRIG_SEL 0x00000007 /* Trigger select (?)*/
  1666. #define AR5K_PHY_TST2_TRIG 0x00000010 /* Trigger (?) */
  1667. #define AR5K_PHY_TST2_CBUS_MODE 0x00000060 /* Cardbus mode (?) */
  1668. #define AR5K_PHY_TST2_CLK32 0x00000400 /* CLK_OUT is CLK32 (32Khz external) */
  1669. #define AR5K_PHY_TST2_CHANCOR_DUMP_EN 0x00000800 /* Enable Chancor dump (?) */
  1670. #define AR5K_PHY_TST2_EVEN_CHANCOR_DUMP 0x00001000 /* Even Chancor dump (?) */
  1671. #define AR5K_PHY_TST2_RFSILENT_EN 0x00002000 /* Enable RFSILENT */
  1672. #define AR5K_PHY_TST2_ALT_RFDATA 0x00004000 /* Alternate RFDATA (5-2GHz switch ?) */
  1673. #define AR5K_PHY_TST2_MINI_OBS_EN 0x00008000 /* Enable mini OBS (?) */
  1674. #define AR5K_PHY_TST2_RX2_IS_RX5_INV 0x00010000 /* 2GHz rx path is the 5GHz path inverted (?) */
  1675. #define AR5K_PHY_TST2_SLOW_CLK160 0x00020000 /* Slow CLK160 (?) */
  1676. #define AR5K_PHY_TST2_AGC_OBS_SEL_3 0x00040000 /* AGC OBS Select 3 (?) */
  1677. #define AR5K_PHY_TST2_BBB_OBS_SEL 0x00080000 /* BB OBS Select (field ?) */
  1678. #define AR5K_PHY_TST2_ADC_OBS_SEL 0x00800000 /* ADC OBS Select (field ?) */
  1679. #define AR5K_PHY_TST2_RX_CLR_SEL 0x08000000 /* RX Clear Select (?) */
  1680. #define AR5K_PHY_TST2_FORCE_AGC_CLR 0x10000000 /* Force AGC clear (?) */
  1681. #define AR5K_PHY_SHIFT_2GHZ 0x00004007 /* Used to access 2GHz radios */
  1682. #define AR5K_PHY_SHIFT_5GHZ 0x00000007 /* Used to access 5GHz radios (default) */
  1683. /*
  1684. * PHY frame control register [5110] /turbo mode register [5111+]
  1685. *
  1686. * There is another frame control register for [5111+]
  1687. * at address 0x9944 (see below) but the 2 first flags
  1688. * are common here between 5110 frame control register
  1689. * and [5111+] turbo mode register, so this also works as
  1690. * a "turbo mode register" for 5110. We treat this one as
  1691. * a frame control register for 5110 below.
  1692. */
  1693. #define AR5K_PHY_TURBO 0x9804 /* Register Address */
  1694. #define AR5K_PHY_TURBO_MODE 0x00000001 /* Enable turbo mode */
  1695. #define AR5K_PHY_TURBO_SHORT 0x00000002 /* Set short symbols to turbo mode */
  1696. #define AR5K_PHY_TURBO_MIMO 0x00000004 /* Set turbo for mimo mimo */
  1697. /*
  1698. * PHY agility command register
  1699. * (aka TST_1)
  1700. */
  1701. #define AR5K_PHY_AGC 0x9808 /* Register Address */
  1702. #define AR5K_PHY_TST1 0x9808
  1703. #define AR5K_PHY_AGC_DISABLE 0x08000000 /* Disable AGC to A2 (?)*/
  1704. #define AR5K_PHY_TST1_TXHOLD 0x00003800 /* Set tx hold (?) */
  1705. #define AR5K_PHY_TST1_TXSRC_SRC 0x00000002 /* Used with bit 7 (?) */
  1706. #define AR5K_PHY_TST1_TXSRC_SRC_S 1
  1707. #define AR5K_PHY_TST1_TXSRC_ALT 0x00000080 /* Set input to tsdac (?) */
  1708. #define AR5K_PHY_TST1_TXSRC_ALT_S 7
  1709. /*
  1710. * PHY timing register 3 [5112+]
  1711. */
  1712. #define AR5K_PHY_TIMING_3 0x9814
  1713. #define AR5K_PHY_TIMING_3_DSC_MAN 0xfffe0000
  1714. #define AR5K_PHY_TIMING_3_DSC_MAN_S 17
  1715. #define AR5K_PHY_TIMING_3_DSC_EXP 0x0001e000
  1716. #define AR5K_PHY_TIMING_3_DSC_EXP_S 13
  1717. /*
  1718. * PHY chip revision register
  1719. */
  1720. #define AR5K_PHY_CHIP_ID 0x9818
  1721. /*
  1722. * PHY activation register
  1723. */
  1724. #define AR5K_PHY_ACT 0x981c /* Register Address */
  1725. #define AR5K_PHY_ACT_ENABLE 0x00000001 /* Activate PHY */
  1726. #define AR5K_PHY_ACT_DISABLE 0x00000002 /* Deactivate PHY */
  1727. /*
  1728. * PHY RF control registers
  1729. */
  1730. #define AR5K_PHY_RF_CTL2 0x9824 /* Register Address */
  1731. #define AR5K_PHY_RF_CTL2_TXF2TXD_START 0x0000000f /* TX frame to TX data start */
  1732. #define AR5K_PHY_RF_CTL2_TXF2TXD_START_S 0
  1733. #define AR5K_PHY_RF_CTL3 0x9828 /* Register Address */
  1734. #define AR5K_PHY_RF_CTL3_TXE2XLNA_ON 0x0000ff00 /* TX end to XLNA on */
  1735. #define AR5K_PHY_RF_CTL3_TXE2XLNA_ON_S 8
  1736. #define AR5K_PHY_ADC_CTL 0x982c
  1737. #define AR5K_PHY_ADC_CTL_INBUFGAIN_OFF 0x00000003
  1738. #define AR5K_PHY_ADC_CTL_INBUFGAIN_OFF_S 0
  1739. #define AR5K_PHY_ADC_CTL_PWD_DAC_OFF 0x00002000
  1740. #define AR5K_PHY_ADC_CTL_PWD_BAND_GAP_OFF 0x00004000
  1741. #define AR5K_PHY_ADC_CTL_PWD_ADC_OFF 0x00008000
  1742. #define AR5K_PHY_ADC_CTL_INBUFGAIN_ON 0x00030000
  1743. #define AR5K_PHY_ADC_CTL_INBUFGAIN_ON_S 16
  1744. #define AR5K_PHY_RF_CTL4 0x9834 /* Register Address */
  1745. #define AR5K_PHY_RF_CTL4_TXF2XPA_A_ON 0x00000001 /* TX frame to XPA A on (field) */
  1746. #define AR5K_PHY_RF_CTL4_TXF2XPA_B_ON 0x00000100 /* TX frame to XPA B on (field) */
  1747. #define AR5K_PHY_RF_CTL4_TXE2XPA_A_OFF 0x00010000 /* TX end to XPA A off (field) */
  1748. #define AR5K_PHY_RF_CTL4_TXE2XPA_B_OFF 0x01000000 /* TX end to XPA B off (field) */
  1749. /*
  1750. * Pre-Amplifier control register
  1751. * (XPA -> external pre-amplifier)
  1752. */
  1753. #define AR5K_PHY_PA_CTL 0x9838 /* Register Address */
  1754. #define AR5K_PHY_PA_CTL_XPA_A_HI 0x00000001 /* XPA A high (?) */
  1755. #define AR5K_PHY_PA_CTL_XPA_B_HI 0x00000002 /* XPA B high (?) */
  1756. #define AR5K_PHY_PA_CTL_XPA_A_EN 0x00000004 /* Enable XPA A */
  1757. #define AR5K_PHY_PA_CTL_XPA_B_EN 0x00000008 /* Enable XPA B */
  1758. /*
  1759. * PHY settling register
  1760. */
  1761. #define AR5K_PHY_SETTLING 0x9844 /* Register Address */
  1762. #define AR5K_PHY_SETTLING_AGC 0x0000007f /* AGC settling time */
  1763. #define AR5K_PHY_SETTLING_AGC_S 0
  1764. #define AR5K_PHY_SETTLING_SWITCH 0x00003f80 /* Switch settlig time */
  1765. #define AR5K_PHY_SETTLING_SWITCH_S 7
  1766. /*
  1767. * PHY Gain registers
  1768. */
  1769. #define AR5K_PHY_GAIN 0x9848 /* Register Address */
  1770. #define AR5K_PHY_GAIN_TXRX_ATTEN 0x0003f000 /* TX-RX Attenuation */
  1771. #define AR5K_PHY_GAIN_TXRX_ATTEN_S 12
  1772. #define AR5K_PHY_GAIN_TXRX_RF_MAX 0x007c0000
  1773. #define AR5K_PHY_GAIN_TXRX_RF_MAX_S 18
  1774. #define AR5K_PHY_GAIN_OFFSET 0x984c /* Register Address */
  1775. #define AR5K_PHY_GAIN_OFFSET_RXTX_FLAG 0x00020000 /* RX-TX flag (?) */
  1776. /*
  1777. * Desired ADC/PGA size register
  1778. * (for more infos read ANI patent)
  1779. */
  1780. #define AR5K_PHY_DESIRED_SIZE 0x9850 /* Register Address */
  1781. #define AR5K_PHY_DESIRED_SIZE_ADC 0x000000ff /* ADC desired size */
  1782. #define AR5K_PHY_DESIRED_SIZE_ADC_S 0
  1783. #define AR5K_PHY_DESIRED_SIZE_PGA 0x0000ff00 /* PGA desired size */
  1784. #define AR5K_PHY_DESIRED_SIZE_PGA_S 8
  1785. #define AR5K_PHY_DESIRED_SIZE_TOT 0x0ff00000 /* Total desired size */
  1786. #define AR5K_PHY_DESIRED_SIZE_TOT_S 20
  1787. /*
  1788. * PHY signal register
  1789. * (for more infos read ANI patent)
  1790. */
  1791. #define AR5K_PHY_SIG 0x9858 /* Register Address */
  1792. #define AR5K_PHY_SIG_FIRSTEP 0x0003f000 /* FIRSTEP */
  1793. #define AR5K_PHY_SIG_FIRSTEP_S 12
  1794. #define AR5K_PHY_SIG_FIRPWR 0x03fc0000 /* FIPWR */
  1795. #define AR5K_PHY_SIG_FIRPWR_S 18
  1796. /*
  1797. * PHY coarse agility control register
  1798. * (for more infos read ANI patent)
  1799. */
  1800. #define AR5K_PHY_AGCCOARSE 0x985c /* Register Address */
  1801. #define AR5K_PHY_AGCCOARSE_LO 0x00007f80 /* AGC Coarse low */
  1802. #define AR5K_PHY_AGCCOARSE_LO_S 7
  1803. #define AR5K_PHY_AGCCOARSE_HI 0x003f8000 /* AGC Coarse high */
  1804. #define AR5K_PHY_AGCCOARSE_HI_S 15
  1805. /*
  1806. * PHY agility control register
  1807. */
  1808. #define AR5K_PHY_AGCCTL 0x9860 /* Register address */
  1809. #define AR5K_PHY_AGCCTL_CAL 0x00000001 /* Enable PHY calibration */
  1810. #define AR5K_PHY_AGCCTL_NF 0x00000002 /* Enable Noise Floor calibration */
  1811. #define AR5K_PHY_AGCCTL_NF_EN 0x00008000 /* Enable nf calibration to happen (?) */
  1812. #define AR5K_PHY_AGCCTL_NF_NOUPDATE 0x00020000 /* Don't update nf automaticaly */
  1813. /*
  1814. * PHY noise floor status register
  1815. */
  1816. #define AR5K_PHY_NF 0x9864 /* Register address */
  1817. #define AR5K_PHY_NF_M 0x000001ff /* Noise floor mask */
  1818. #define AR5K_PHY_NF_ACTIVE 0x00000100 /* Noise floor calibration still active */
  1819. #define AR5K_PHY_NF_RVAL(_n) (((_n) >> 19) & AR5K_PHY_NF_M)
  1820. #define AR5K_PHY_NF_AVAL(_n) (-((_n) ^ AR5K_PHY_NF_M) + 1)
  1821. #define AR5K_PHY_NF_SVAL(_n) (((_n) & AR5K_PHY_NF_M) | (1 << 9))
  1822. #define AR5K_PHY_NF_THRESH62 0x0007f000 /* Thresh62 -check ANI patent- (field) */
  1823. #define AR5K_PHY_NF_THRESH62_S 12
  1824. #define AR5K_PHY_NF_MINCCA_PWR 0x0ff80000 /* ??? */
  1825. #define AR5K_PHY_NF_MINCCA_PWR_S 19
  1826. /*
  1827. * PHY ADC saturation register [5110]
  1828. */
  1829. #define AR5K_PHY_ADCSAT 0x9868
  1830. #define AR5K_PHY_ADCSAT_ICNT 0x0001f800
  1831. #define AR5K_PHY_ADCSAT_ICNT_S 11
  1832. #define AR5K_PHY_ADCSAT_THR 0x000007e0
  1833. #define AR5K_PHY_ADCSAT_THR_S 5
  1834. /*
  1835. * PHY Weak ofdm signal detection threshold registers (ANI) [5212+]
  1836. */
  1837. /* High thresholds */
  1838. #define AR5K_PHY_WEAK_OFDM_HIGH_THR 0x9868
  1839. #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT 0x0000001f
  1840. #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT_S 0
  1841. #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1 0x00fe0000
  1842. #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1_S 17
  1843. #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2 0x7f000000
  1844. #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_S 24
  1845. /* Low thresholds */
  1846. #define AR5K_PHY_WEAK_OFDM_LOW_THR 0x986c
  1847. #define AR5K_PHY_WEAK_OFDM_LOW_THR_SELFCOR_EN 0x00000001
  1848. #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT 0x00003f00
  1849. #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT_S 8
  1850. #define AR5K_PHY_WEAK_OFDM_LOW_THR_M1 0x001fc000
  1851. #define AR5K_PHY_WEAK_OFDM_LOW_THR_M1_S 14
  1852. #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2 0x0fe00000
  1853. #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_S 21
  1854. /*
  1855. * PHY sleep registers [5112+]
  1856. */
  1857. #define AR5K_PHY_SCR 0x9870
  1858. #define AR5K_PHY_SLMT 0x9874
  1859. #define AR5K_PHY_SLMT_32MHZ 0x0000007f
  1860. #define AR5K_PHY_SCAL 0x9878
  1861. #define AR5K_PHY_SCAL_32MHZ 0x0000000e
  1862. #define AR5K_PHY_SCAL_32MHZ_2417 0x0000000a
  1863. #define AR5K_PHY_SCAL_32MHZ_HB63 0x00000032
  1864. /*
  1865. * PHY PLL (Phase Locked Loop) control register
  1866. */
  1867. #define AR5K_PHY_PLL 0x987c
  1868. #define AR5K_PHY_PLL_20MHZ 0x00000013 /* For half rate (?) */
  1869. /* 40MHz -> 5GHz band */
  1870. #define AR5K_PHY_PLL_40MHZ_5211 0x00000018
  1871. #define AR5K_PHY_PLL_40MHZ_5212 0x000000aa
  1872. #define AR5K_PHY_PLL_40MHZ_5413 0x00000004
  1873. #define AR5K_PHY_PLL_40MHZ (ah->ah_version == AR5K_AR5211 ? \
  1874. AR5K_PHY_PLL_40MHZ_5211 : AR5K_PHY_PLL_40MHZ_5212)
  1875. /* 44MHz -> 2.4GHz band */
  1876. #define AR5K_PHY_PLL_44MHZ_5211 0x00000019
  1877. #define AR5K_PHY_PLL_44MHZ_5212 0x000000ab
  1878. #define AR5K_PHY_PLL_44MHZ (ah->ah_version == AR5K_AR5211 ? \
  1879. AR5K_PHY_PLL_44MHZ_5211 : AR5K_PHY_PLL_44MHZ_5212)
  1880. #define AR5K_PHY_PLL_RF5111 0x00000000
  1881. #define AR5K_PHY_PLL_RF5112 0x00000040
  1882. #define AR5K_PHY_PLL_HALF_RATE 0x00000100
  1883. #define AR5K_PHY_PLL_QUARTER_RATE 0x00000200
  1884. /*
  1885. * RF Buffer register
  1886. *
  1887. * It's obvious from the code that 0x989c is the buffer register but
  1888. * for the other special registers that we write to after sending each
  1889. * packet, i have no idea. So i'll name them BUFFER_CONTROL_X registers
  1890. * for now. It's interesting that they are also used for some other operations.
  1891. */
  1892. #define AR5K_RF_BUFFER 0x989c
  1893. #define AR5K_RF_BUFFER_CONTROL_0 0x98c0 /* Channel on 5110 */
  1894. #define AR5K_RF_BUFFER_CONTROL_1 0x98c4 /* Bank 7 on 5112 */
  1895. #define AR5K_RF_BUFFER_CONTROL_2 0x98cc /* Bank 7 on 5111 */
  1896. #define AR5K_RF_BUFFER_CONTROL_3 0x98d0 /* Bank 2 on 5112 */
  1897. /* Channel set on 5111 */
  1898. /* Used to read radio revision*/
  1899. #define AR5K_RF_BUFFER_CONTROL_4 0x98d4 /* RF Stage register on 5110 */
  1900. /* Bank 0,1,2,6 on 5111 */
  1901. /* Bank 1 on 5112 */
  1902. /* Used during activation on 5111 */
  1903. #define AR5K_RF_BUFFER_CONTROL_5 0x98d8 /* Bank 3 on 5111 */
  1904. /* Used during activation on 5111 */
  1905. /* Channel on 5112 */
  1906. /* Bank 6 on 5112 */
  1907. #define AR5K_RF_BUFFER_CONTROL_6 0x98dc /* Bank 3 on 5112 */
  1908. /*
  1909. * PHY RF stage register [5210]
  1910. */
  1911. #define AR5K_PHY_RFSTG 0x98d4
  1912. #define AR5K_PHY_RFSTG_DISABLE 0x00000021
  1913. /*
  1914. * BIN masks (?)
  1915. */
  1916. #define AR5K_PHY_BIN_MASK_1 0x9900
  1917. #define AR5K_PHY_BIN_MASK_2 0x9904
  1918. #define AR5K_PHY_BIN_MASK_3 0x9908
  1919. #define AR5K_PHY_BIN_MASK_CTL 0x990c
  1920. #define AR5K_PHY_BIN_MASK_CTL_MASK_4 0x00003fff
  1921. #define AR5K_PHY_BIN_MASK_CTL_MASK_4_S 0
  1922. #define AR5K_PHY_BIN_MASK_CTL_RATE 0xff000000
  1923. #define AR5K_PHY_BIN_MASK_CTL_RATE_S 24
  1924. /*
  1925. * PHY Antenna control register
  1926. */
  1927. #define AR5K_PHY_ANT_CTL 0x9910 /* Register Address */
  1928. #define AR5K_PHY_ANT_CTL_TXRX_EN 0x00000001 /* Enable TX/RX (?) */
  1929. #define AR5K_PHY_ANT_CTL_SECTORED_ANT 0x00000004 /* Sectored Antenna */
  1930. #define AR5K_PHY_ANT_CTL_HITUNE5 0x00000008 /* Hitune5 (?) */
  1931. #define AR5K_PHY_ANT_CTL_SWTABLE_IDLE 0x000003f0 /* Switch table idle (?) */
  1932. #define AR5K_PHY_ANT_CTL_SWTABLE_IDLE_S 4
  1933. /*
  1934. * PHY receiver delay register [5111+]
  1935. */
  1936. #define AR5K_PHY_RX_DELAY 0x9914 /* Register Address */
  1937. #define AR5K_PHY_RX_DELAY_M 0x00003fff /* Mask for RX activate to receive delay (/100ns) */
  1938. /*
  1939. * PHY max rx length register (?) [5111]
  1940. */
  1941. #define AR5K_PHY_MAX_RX_LEN 0x991c
  1942. /*
  1943. * PHY timing register 4
  1944. * I(nphase)/Q(adrature) calibration register [5111+]
  1945. */
  1946. #define AR5K_PHY_IQ 0x9920 /* Register Address */
  1947. #define AR5K_PHY_IQ_CORR_Q_Q_COFF 0x0000001f /* Mask for q correction info */
  1948. #define AR5K_PHY_IQ_CORR_Q_I_COFF 0x000007e0 /* Mask for i correction info */
  1949. #define AR5K_PHY_IQ_CORR_Q_I_COFF_S 5
  1950. #define AR5K_PHY_IQ_CORR_ENABLE 0x00000800 /* Enable i/q correction */
  1951. #define AR5K_PHY_IQ_CAL_NUM_LOG_MAX 0x0000f000 /* Mask for max number of samples in log scale */
  1952. #define AR5K_PHY_IQ_CAL_NUM_LOG_MAX_S 12
  1953. #define AR5K_PHY_IQ_RUN 0x00010000 /* Run i/q calibration */
  1954. #define AR5K_PHY_IQ_USE_PT_DF 0x00020000 /* Use pilot track df (?) */
  1955. #define AR5K_PHY_IQ_EARLY_TRIG_THR 0x00200000 /* Early trigger threshold (?) (field) */
  1956. #define AR5K_PHY_IQ_PILOT_MASK_EN 0x10000000 /* Enable pilot mask (?) */
  1957. #define AR5K_PHY_IQ_CHAN_MASK_EN 0x20000000 /* Enable channel mask (?) */
  1958. #define AR5K_PHY_IQ_SPUR_FILT_EN 0x40000000 /* Enable spur filter */
  1959. #define AR5K_PHY_IQ_SPUR_RSSI_EN 0x80000000 /* Enable spur rssi */
  1960. /*
  1961. * PHY timing register 5
  1962. * OFDM Self-correlator Cyclic RSSI threshold params
  1963. * (Check out bb_cycpwr_thr1 on ANI patent)
  1964. */
  1965. #define AR5K_PHY_OFDM_SELFCORR 0x9924 /* Register Address */
  1966. #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_EN 0x00000001 /* Enable cyclic RSSI thr 1 */
  1967. #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1 0x000000fe /* Mask for Cyclic RSSI threshold 1 */
  1968. #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_S 1
  1969. #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR3 0x00000100 /* Cyclic RSSI threshold 3 (field) (?) */
  1970. #define AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR_EN 0x00008000 /* Enable 1A RSSI threshold (?) */
  1971. #define AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR 0x00010000 /* 1A RSSI threshold (field) (?) */
  1972. #define AR5K_PHY_OFDM_SELFCORR_LSCTHR_HIRSSI 0x00800000 /* Long sc threshold hi rssi (?) */
  1973. /*
  1974. * PHY-only warm reset register
  1975. */
  1976. #define AR5K_PHY_WARM_RESET 0x9928
  1977. /*
  1978. * PHY-only control register
  1979. */
  1980. #define AR5K_PHY_CTL 0x992c /* Register Address */
  1981. #define AR5K_PHY_CTL_RX_DRAIN_RATE 0x00000001 /* RX drain rate (?) */
  1982. #define AR5K_PHY_CTL_LATE_TX_SIG_SYM 0x00000002 /* Late tx signal symbol (?) */
  1983. #define AR5K_PHY_CTL_GEN_SCRAMBLER 0x00000004 /* Generate scrambler */
  1984. #define AR5K_PHY_CTL_TX_ANT_SEL 0x00000008 /* TX antenna select */
  1985. #define AR5K_PHY_CTL_TX_ANT_STATIC 0x00000010 /* Static TX antenna */
  1986. #define AR5K_PHY_CTL_RX_ANT_SEL 0x00000020 /* RX antenna select */
  1987. #define AR5K_PHY_CTL_RX_ANT_STATIC 0x00000040 /* Static RX antenna */
  1988. #define AR5K_PHY_CTL_LOW_FREQ_SLE_EN 0x00000080 /* Enable low freq sleep */
  1989. /*
  1990. * PHY PAPD probe register [5111+]
  1991. */
  1992. #define AR5K_PHY_PAPD_PROBE 0x9930
  1993. #define AR5K_PHY_PAPD_PROBE_SH_HI_PAR 0x00000001
  1994. #define AR5K_PHY_PAPD_PROBE_PCDAC_BIAS 0x00000002
  1995. #define AR5K_PHY_PAPD_PROBE_COMP_GAIN 0x00000040
  1996. #define AR5K_PHY_PAPD_PROBE_TXPOWER 0x00007e00
  1997. #define AR5K_PHY_PAPD_PROBE_TXPOWER_S 9
  1998. #define AR5K_PHY_PAPD_PROBE_TX_NEXT 0x00008000
  1999. #define AR5K_PHY_PAPD_PROBE_PREDIST_EN 0x00010000
  2000. #define AR5K_PHY_PAPD_PROBE_TYPE 0x01800000 /* [5112+] */
  2001. #define AR5K_PHY_PAPD_PROBE_TYPE_S 23
  2002. #define AR5K_PHY_PAPD_PROBE_TYPE_OFDM 0
  2003. #define AR5K_PHY_PAPD_PROBE_TYPE_XR 1
  2004. #define AR5K_PHY_PAPD_PROBE_TYPE_CCK 2
  2005. #define AR5K_PHY_PAPD_PROBE_GAINF 0xfe000000
  2006. #define AR5K_PHY_PAPD_PROBE_GAINF_S 25
  2007. #define AR5K_PHY_PAPD_PROBE_INI_5111 0x00004883 /* [5212+] */
  2008. #define AR5K_PHY_PAPD_PROBE_INI_5112 0x00004882 /* [5212+] */
  2009. /*
  2010. * PHY TX rate power registers [5112+]
  2011. */
  2012. #define AR5K_PHY_TXPOWER_RATE1 0x9934
  2013. #define AR5K_PHY_TXPOWER_RATE2 0x9938
  2014. #define AR5K_PHY_TXPOWER_RATE_MAX 0x993c
  2015. #define AR5K_PHY_TXPOWER_RATE_MAX_TPC_ENABLE 0x00000040
  2016. #define AR5K_PHY_TXPOWER_RATE3 0xa234
  2017. #define AR5K_PHY_TXPOWER_RATE4 0xa238
  2018. /*
  2019. * PHY frame control register [5111+]
  2020. */
  2021. #define AR5K_PHY_FRAME_CTL_5210 0x9804
  2022. #define AR5K_PHY_FRAME_CTL_5211 0x9944
  2023. #define AR5K_PHY_FRAME_CTL (ah->ah_version == AR5K_AR5210 ? \
  2024. AR5K_PHY_FRAME_CTL_5210 : AR5K_PHY_FRAME_CTL_5211)
  2025. /*---[5111+]---*/
  2026. #define AR5K_PHY_FRAME_CTL_TX_CLIP 0x00000038 /* Mask for tx clip (?) */
  2027. #define AR5K_PHY_FRAME_CTL_TX_CLIP_S 3
  2028. #define AR5K_PHY_FRAME_CTL_PREP_CHINFO 0x00010000 /* Prepend chan info */
  2029. #define AR5K_PHY_FRAME_CTL_EMU 0x80000000
  2030. #define AR5K_PHY_FRAME_CTL_EMU_S 31
  2031. /*---[5110/5111]---*/
  2032. #define AR5K_PHY_FRAME_CTL_TIMING_ERR 0x01000000 /* PHY timing error */
  2033. #define AR5K_PHY_FRAME_CTL_PARITY_ERR 0x02000000 /* Parity error */
  2034. #define AR5K_PHY_FRAME_CTL_ILLRATE_ERR 0x04000000 /* Illegal rate */
  2035. #define AR5K_PHY_FRAME_CTL_ILLLEN_ERR 0x08000000 /* Illegal length */
  2036. #define AR5K_PHY_FRAME_CTL_SERVICE_ERR 0x20000000
  2037. #define AR5K_PHY_FRAME_CTL_TXURN_ERR 0x40000000 /* TX underrun */
  2038. #define AR5K_PHY_FRAME_CTL_INI AR5K_PHY_FRAME_CTL_SERVICE_ERR | \
  2039. AR5K_PHY_FRAME_CTL_TXURN_ERR | \
  2040. AR5K_PHY_FRAME_CTL_ILLLEN_ERR | \
  2041. AR5K_PHY_FRAME_CTL_ILLRATE_ERR | \
  2042. AR5K_PHY_FRAME_CTL_PARITY_ERR | \
  2043. AR5K_PHY_FRAME_CTL_TIMING_ERR
  2044. /*
  2045. * PHY Tx Power adjustment register [5212A+]
  2046. */
  2047. #define AR5K_PHY_TX_PWR_ADJ 0x994c
  2048. #define AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA 0x00000fc0
  2049. #define AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA_S 6
  2050. #define AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX 0x00fc0000
  2051. #define AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX_S 18
  2052. /*
  2053. * PHY radar detection register [5111+]
  2054. */
  2055. #define AR5K_PHY_RADAR 0x9954
  2056. #define AR5K_PHY_RADAR_ENABLE 0x00000001
  2057. #define AR5K_PHY_RADAR_DISABLE 0x00000000
  2058. #define AR5K_PHY_RADAR_INBANDTHR 0x0000003e /* Inband threshold
  2059. 5-bits, units unknown {0..31}
  2060. (? MHz ?) */
  2061. #define AR5K_PHY_RADAR_INBANDTHR_S 1
  2062. #define AR5K_PHY_RADAR_PRSSI_THR 0x00000fc0 /* Pulse RSSI/SNR threshold
  2063. 6-bits, dBm range {0..63}
  2064. in dBm units. */
  2065. #define AR5K_PHY_RADAR_PRSSI_THR_S 6
  2066. #define AR5K_PHY_RADAR_PHEIGHT_THR 0x0003f000 /* Pulse height threshold
  2067. 6-bits, dBm range {0..63}
  2068. in dBm units. */
  2069. #define AR5K_PHY_RADAR_PHEIGHT_THR_S 12
  2070. #define AR5K_PHY_RADAR_RSSI_THR 0x00fc0000 /* Radar RSSI/SNR threshold.
  2071. 6-bits, dBm range {0..63}
  2072. in dBm units. */
  2073. #define AR5K_PHY_RADAR_RSSI_THR_S 18
  2074. #define AR5K_PHY_RADAR_FIRPWR_THR 0x7f000000 /* Finite Impulse Response
  2075. filter power out threshold.
  2076. 7-bits, standard power range
  2077. {0..127} in 1/2 dBm units. */
  2078. #define AR5K_PHY_RADAR_FIRPWR_THRS 24
  2079. /*
  2080. * PHY antenna switch table registers
  2081. */
  2082. #define AR5K_PHY_ANT_SWITCH_TABLE_0 0x9960
  2083. #define AR5K_PHY_ANT_SWITCH_TABLE_1 0x9964
  2084. /*
  2085. * PHY Noise floor threshold
  2086. */
  2087. #define AR5K_PHY_NFTHRES 0x9968
  2088. /*
  2089. * Sigma Delta register (?) [5213]
  2090. */
  2091. #define AR5K_PHY_SIGMA_DELTA 0x996C
  2092. #define AR5K_PHY_SIGMA_DELTA_ADC_SEL 0x00000003
  2093. #define AR5K_PHY_SIGMA_DELTA_ADC_SEL_S 0
  2094. #define AR5K_PHY_SIGMA_DELTA_FILT2 0x000000f8
  2095. #define AR5K_PHY_SIGMA_DELTA_FILT2_S 3
  2096. #define AR5K_PHY_SIGMA_DELTA_FILT1 0x00001f00
  2097. #define AR5K_PHY_SIGMA_DELTA_FILT1_S 8
  2098. #define AR5K_PHY_SIGMA_DELTA_ADC_CLIP 0x01ffe000
  2099. #define AR5K_PHY_SIGMA_DELTA_ADC_CLIP_S 13
  2100. /*
  2101. * RF restart register [5112+] (?)
  2102. */
  2103. #define AR5K_PHY_RESTART 0x9970 /* restart */
  2104. #define AR5K_PHY_RESTART_DIV_GC 0x001c0000 /* Fast diversity gc_limit (?) */
  2105. #define AR5K_PHY_RESTART_DIV_GC_S 18
  2106. /*
  2107. * RF Bus access request register (for synth-oly channel switching)
  2108. */
  2109. #define AR5K_PHY_RFBUS_REQ 0x997C
  2110. #define AR5K_PHY_RFBUS_REQ_REQUEST 0x00000001
  2111. /*
  2112. * Spur mitigation masks (?)
  2113. */
  2114. #define AR5K_PHY_TIMING_7 0x9980
  2115. #define AR5K_PHY_TIMING_8 0x9984
  2116. #define AR5K_PHY_TIMING_8_PILOT_MASK_2 0x000fffff
  2117. #define AR5K_PHY_TIMING_8_PILOT_MASK_2_S 0
  2118. #define AR5K_PHY_BIN_MASK2_1 0x9988
  2119. #define AR5K_PHY_BIN_MASK2_2 0x998c
  2120. #define AR5K_PHY_BIN_MASK2_3 0x9990
  2121. #define AR5K_PHY_BIN_MASK2_4 0x9994
  2122. #define AR5K_PHY_BIN_MASK2_4_MASK_4 0x00003fff
  2123. #define AR5K_PHY_BIN_MASK2_4_MASK_4_S 0
  2124. #define AR5K_PHY_TIMING_9 0x9998
  2125. #define AR5K_PHY_TIMING_10 0x999c
  2126. #define AR5K_PHY_TIMING_10_PILOT_MASK_2 0x000fffff
  2127. #define AR5K_PHY_TIMING_10_PILOT_MASK_2_S 0
  2128. /*
  2129. * Spur mitigation control
  2130. */
  2131. #define AR5K_PHY_TIMING_11 0x99a0 /* Register address */
  2132. #define AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE 0x000fffff /* Spur delta phase */
  2133. #define AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE_S 0
  2134. #define AR5K_PHY_TIMING_11_SPUR_FREQ_SD 0x3ff00000 /* Freq sigma delta */
  2135. #define AR5K_PHY_TIMING_11_SPUR_FREQ_SD_S 20
  2136. #define AR5K_PHY_TIMING_11_USE_SPUR_IN_AGC 0x40000000 /* Spur filter in AGC detector */
  2137. #define AR5K_PHY_TIMING_11_USE_SPUR_IN_SELFCOR 0x80000000 /* Spur filter in OFDM self correlator */
  2138. /*
  2139. * Gain tables
  2140. */
  2141. #define AR5K_BB_GAIN_BASE 0x9b00 /* BaseBand Amplifier Gain table base address */
  2142. #define AR5K_BB_GAIN(_n) (AR5K_BB_GAIN_BASE + ((_n) << 2))
  2143. #define AR5K_RF_GAIN_BASE 0x9a00 /* RF Amplrifier Gain table base address */
  2144. #define AR5K_RF_GAIN(_n) (AR5K_RF_GAIN_BASE + ((_n) << 2))
  2145. /*
  2146. * PHY timing IQ calibration result register [5111+]
  2147. */
  2148. #define AR5K_PHY_IQRES_CAL_PWR_I 0x9c10 /* I (Inphase) power value */
  2149. #define AR5K_PHY_IQRES_CAL_PWR_Q 0x9c14 /* Q (Quadrature) power value */
  2150. #define AR5K_PHY_IQRES_CAL_CORR 0x9c18 /* I/Q Correlation */
  2151. /*
  2152. * PHY current RSSI register [5111+]
  2153. */
  2154. #define AR5K_PHY_CURRENT_RSSI 0x9c1c
  2155. /*
  2156. * PHY RF Bus grant register
  2157. */
  2158. #define AR5K_PHY_RFBUS_GRANT 0x9c20
  2159. #define AR5K_PHY_RFBUS_GRANT_OK 0x00000001
  2160. /*
  2161. * PHY ADC test register
  2162. */
  2163. #define AR5K_PHY_ADC_TEST 0x9c24
  2164. #define AR5K_PHY_ADC_TEST_I 0x00000001
  2165. #define AR5K_PHY_ADC_TEST_Q 0x00000200
  2166. /*
  2167. * PHY DAC test register
  2168. */
  2169. #define AR5K_PHY_DAC_TEST 0x9c28
  2170. #define AR5K_PHY_DAC_TEST_I 0x00000001
  2171. #define AR5K_PHY_DAC_TEST_Q 0x00000200
  2172. /*
  2173. * PHY PTAT register (?)
  2174. */
  2175. #define AR5K_PHY_PTAT 0x9c2c
  2176. /*
  2177. * PHY Illegal TX rate register [5112+]
  2178. */
  2179. #define AR5K_PHY_BAD_TX_RATE 0x9c30
  2180. /*
  2181. * PHY SPUR Power register [5112+]
  2182. */
  2183. #define AR5K_PHY_SPUR_PWR 0x9c34 /* Register Address */
  2184. #define AR5K_PHY_SPUR_PWR_I 0x00000001 /* SPUR Power estimate for I (field) */
  2185. #define AR5K_PHY_SPUR_PWR_Q 0x00000100 /* SPUR Power estimate for Q (field) */
  2186. #define AR5K_PHY_SPUR_PWR_FILT 0x00010000 /* Power with SPUR removed (field) */
  2187. /*
  2188. * PHY Channel status register [5112+] (?)
  2189. */
  2190. #define AR5K_PHY_CHAN_STATUS 0x9c38
  2191. #define AR5K_PHY_CHAN_STATUS_BT_ACT 0x00000001
  2192. #define AR5K_PHY_CHAN_STATUS_RX_CLR_RAW 0x00000002
  2193. #define AR5K_PHY_CHAN_STATUS_RX_CLR_MAC 0x00000004
  2194. #define AR5K_PHY_CHAN_STATUS_RX_CLR_PAP 0x00000008
  2195. /*
  2196. * Heavy clip enable register
  2197. */
  2198. #define AR5K_PHY_HEAVY_CLIP_ENABLE 0x99e0
  2199. /*
  2200. * PHY clock sleep registers [5112+]
  2201. */
  2202. #define AR5K_PHY_SCLOCK 0x99f0
  2203. #define AR5K_PHY_SCLOCK_32MHZ 0x0000000c
  2204. #define AR5K_PHY_SDELAY 0x99f4
  2205. #define AR5K_PHY_SDELAY_32MHZ 0x000000ff
  2206. #define AR5K_PHY_SPENDING 0x99f8
  2207. /*
  2208. * PHY PAPD I (power?) table (?)
  2209. * (92! entries)
  2210. */
  2211. #define AR5K_PHY_PAPD_I_BASE 0xa000
  2212. #define AR5K_PHY_PAPD_I(_n) (AR5K_PHY_PAPD_I_BASE + ((_n) << 2))
  2213. /*
  2214. * PHY PCDAC TX power table
  2215. */
  2216. #define AR5K_PHY_PCDAC_TXPOWER_BASE 0xa180
  2217. #define AR5K_PHY_PCDAC_TXPOWER(_n) (AR5K_PHY_PCDAC_TXPOWER_BASE + ((_n) << 2))
  2218. /*
  2219. * PHY mode register [5111+]
  2220. */
  2221. #define AR5K_PHY_MODE 0x0a200 /* Register Address */
  2222. #define AR5K_PHY_MODE_MOD 0x00000001 /* PHY Modulation bit */
  2223. #define AR5K_PHY_MODE_MOD_OFDM 0
  2224. #define AR5K_PHY_MODE_MOD_CCK 1
  2225. #define AR5K_PHY_MODE_FREQ 0x00000002 /* Freq mode bit */
  2226. #define AR5K_PHY_MODE_FREQ_5GHZ 0
  2227. #define AR5K_PHY_MODE_FREQ_2GHZ 2
  2228. #define AR5K_PHY_MODE_MOD_DYN 0x00000004 /* Enable Dynamic OFDM/CCK mode [5112+] */
  2229. #define AR5K_PHY_MODE_RAD 0x00000008 /* [5212+] */
  2230. #define AR5K_PHY_MODE_RAD_RF5111 0
  2231. #define AR5K_PHY_MODE_RAD_RF5112 8
  2232. #define AR5K_PHY_MODE_XR 0x00000010 /* Enable XR mode [5112+] */
  2233. #define AR5K_PHY_MODE_HALF_RATE 0x00000020 /* Enable Half rate (test) */
  2234. #define AR5K_PHY_MODE_QUARTER_RATE 0x00000040 /* Enable Quarter rat (test) */
  2235. /*
  2236. * PHY CCK transmit control register [5111+ (?)]
  2237. */
  2238. #define AR5K_PHY_CCKTXCTL 0xa204
  2239. #define AR5K_PHY_CCKTXCTL_WORLD 0x00000000
  2240. #define AR5K_PHY_CCKTXCTL_JAPAN 0x00000010
  2241. #define AR5K_PHY_CCKTXCTL_SCRAMBLER_DIS 0x00000001
  2242. #define AR5K_PHY_CCKTXCTK_DAC_SCALE 0x00000004
  2243. /*
  2244. * PHY CCK Cross-correlator Barker RSSI threshold register [5212+]
  2245. */
  2246. #define AR5K_PHY_CCK_CROSSCORR 0xa208
  2247. #define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR 0x0000000f
  2248. #define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR_S 0
  2249. /* Same address is used for antenna diversity activation */
  2250. #define AR5K_PHY_FAST_ANT_DIV 0xa208
  2251. #define AR5K_PHY_FAST_ANT_DIV_EN 0x00002000
  2252. /*
  2253. * PHY 2GHz gain register [5111+]
  2254. */
  2255. #define AR5K_PHY_GAIN_2GHZ 0xa20c
  2256. #define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX 0x00fc0000
  2257. #define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX_S 18
  2258. #define AR5K_PHY_GAIN_2GHZ_INI_5111 0x6480416c
  2259. #define AR5K_PHY_CCK_RX_CTL_4 0xa21c
  2260. #define AR5K_PHY_CCK_RX_CTL_4_FREQ_EST_SHORT 0x01f80000
  2261. #define AR5K_PHY_CCK_RX_CTL_4_FREQ_EST_SHORT_S 19
  2262. #define AR5K_PHY_DAG_CCK_CTL 0xa228
  2263. #define AR5K_PHY_DAG_CCK_CTL_EN_RSSI_THR 0x00000200
  2264. #define AR5K_PHY_DAG_CCK_CTL_RSSI_THR 0x0001fc00
  2265. #define AR5K_PHY_DAG_CCK_CTL_RSSI_THR_S 10
  2266. #define AR5K_PHY_FAST_ADC 0xa24c
  2267. #define AR5K_PHY_BLUETOOTH 0xa254
  2268. /*
  2269. * Transmit Power Control register
  2270. * [2413+]
  2271. */
  2272. #define AR5K_PHY_TPC_RG1 0xa258
  2273. #define AR5K_PHY_TPC_RG1_NUM_PD_GAIN 0x0000c000
  2274. #define AR5K_PHY_TPC_RG1_NUM_PD_GAIN_S 14
  2275. #define AR5K_PHY_TPC_RG1_PDGAIN_1 0x00030000
  2276. #define AR5K_PHY_TPC_RG1_PDGAIN_1_S 16
  2277. #define AR5K_PHY_TPC_RG1_PDGAIN_2 0x000c0000
  2278. #define AR5K_PHY_TPC_RG1_PDGAIN_2_S 18
  2279. #define AR5K_PHY_TPC_RG1_PDGAIN_3 0x00300000
  2280. #define AR5K_PHY_TPC_RG1_PDGAIN_3_S 20
  2281. #define AR5K_PHY_TPC_RG5 0xa26C
  2282. #define AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP 0x0000000F
  2283. #define AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP_S 0
  2284. #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1 0x000003F0
  2285. #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1_S 4
  2286. #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2 0x0000FC00
  2287. #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2_S 10
  2288. #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3 0x003F0000
  2289. #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3_S 16
  2290. #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4 0x0FC00000
  2291. #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4_S 22
  2292. /*
  2293. * PHY PDADC Tx power table
  2294. */
  2295. #define AR5K_PHY_PDADC_TXPOWER_BASE 0xa280
  2296. #define AR5K_PHY_PDADC_TXPOWER(_n) (AR5K_PHY_PDADC_TXPOWER_BASE + ((_n) << 2))