reg.h 87 KB

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