rt2800.h 90 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987
  1. /*
  2. Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
  3. Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
  4. Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com>
  5. Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
  6. Copyright (C) 2009 Luis Correia <luis.f.correia@gmail.com>
  7. Copyright (C) 2009 Mattias Nissler <mattias.nissler@gmx.de>
  8. Copyright (C) 2009 Mark Asselstine <asselsm@gmail.com>
  9. Copyright (C) 2009 Xose Vazquez Perez <xose.vazquez@gmail.com>
  10. Copyright (C) 2009 Bart Zolnierkiewicz <bzolnier@gmail.com>
  11. <http://rt2x00.serialmonkey.com>
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. GNU General Public License for more details.
  20. You should have received a copy of the GNU General Public License
  21. along with this program; if not, see <http://www.gnu.org/licenses/>.
  22. */
  23. /*
  24. Module: rt2800
  25. Abstract: Data structures and registers for the rt2800 modules.
  26. Supported chipsets: RT2800E, RT2800ED & RT2800U.
  27. */
  28. #ifndef RT2800_H
  29. #define RT2800_H
  30. /*
  31. * RF chip defines.
  32. *
  33. * RF2820 2.4G 2T3R
  34. * RF2850 2.4G/5G 2T3R
  35. * RF2720 2.4G 1T2R
  36. * RF2750 2.4G/5G 1T2R
  37. * RF3020 2.4G 1T1R
  38. * RF2020 2.4G B/G
  39. * RF3021 2.4G 1T2R
  40. * RF3022 2.4G 2T2R
  41. * RF3052 2.4G/5G 2T2R
  42. * RF2853 2.4G/5G 3T3R
  43. * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390)
  44. * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392)
  45. * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662)
  46. * RF5592 2.4G/5G 2T2R
  47. * RF3070 2.4G 1T1R
  48. * RF5360 2.4G 1T1R
  49. * RF5362 2.4G 1T1R
  50. * RF5370 2.4G 1T1R
  51. * RF5390 2.4G 1T1R
  52. */
  53. #define RF2820 0x0001
  54. #define RF2850 0x0002
  55. #define RF2720 0x0003
  56. #define RF2750 0x0004
  57. #define RF3020 0x0005
  58. #define RF2020 0x0006
  59. #define RF3021 0x0007
  60. #define RF3022 0x0008
  61. #define RF3052 0x0009
  62. #define RF2853 0x000a
  63. #define RF3320 0x000b
  64. #define RF3322 0x000c
  65. #define RF3053 0x000d
  66. #define RF5592 0x000f
  67. #define RF3070 0x3070
  68. #define RF3290 0x3290
  69. #define RF5360 0x5360
  70. #define RF5362 0x5362
  71. #define RF5370 0x5370
  72. #define RF5372 0x5372
  73. #define RF5390 0x5390
  74. #define RF5392 0x5392
  75. /*
  76. * Chipset revisions.
  77. */
  78. #define REV_RT2860C 0x0100
  79. #define REV_RT2860D 0x0101
  80. #define REV_RT2872E 0x0200
  81. #define REV_RT3070E 0x0200
  82. #define REV_RT3070F 0x0201
  83. #define REV_RT3071E 0x0211
  84. #define REV_RT3090E 0x0211
  85. #define REV_RT3390E 0x0211
  86. #define REV_RT3593E 0x0211
  87. #define REV_RT5390F 0x0502
  88. #define REV_RT5390R 0x1502
  89. #define REV_RT5592C 0x0221
  90. #define DEFAULT_RSSI_OFFSET 120
  91. /*
  92. * Register layout information.
  93. */
  94. #define CSR_REG_BASE 0x1000
  95. #define CSR_REG_SIZE 0x0800
  96. #define EEPROM_BASE 0x0000
  97. #define EEPROM_SIZE 0x0200
  98. #define BBP_BASE 0x0000
  99. #define BBP_SIZE 0x00ff
  100. #define RF_BASE 0x0004
  101. #define RF_SIZE 0x0010
  102. #define RFCSR_BASE 0x0000
  103. #define RFCSR_SIZE 0x0040
  104. /*
  105. * Number of TX queues.
  106. */
  107. #define NUM_TX_QUEUES 4
  108. /*
  109. * Registers.
  110. */
  111. /*
  112. * MAC_CSR0_3290: MAC_CSR0 for RT3290 to identity MAC version number.
  113. */
  114. #define MAC_CSR0_3290 0x0000
  115. /*
  116. * E2PROM_CSR: PCI EEPROM control register.
  117. * RELOAD: Write 1 to reload eeprom content.
  118. * TYPE: 0: 93c46, 1:93c66.
  119. * LOAD_STATUS: 1:loading, 0:done.
  120. */
  121. #define E2PROM_CSR 0x0004
  122. #define E2PROM_CSR_DATA_CLOCK FIELD32(0x00000001)
  123. #define E2PROM_CSR_CHIP_SELECT FIELD32(0x00000002)
  124. #define E2PROM_CSR_DATA_IN FIELD32(0x00000004)
  125. #define E2PROM_CSR_DATA_OUT FIELD32(0x00000008)
  126. #define E2PROM_CSR_TYPE FIELD32(0x00000030)
  127. #define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040)
  128. #define E2PROM_CSR_RELOAD FIELD32(0x00000080)
  129. /*
  130. * CMB_CTRL_CFG
  131. */
  132. #define CMB_CTRL 0x0020
  133. #define AUX_OPT_BIT0 FIELD32(0x00000001)
  134. #define AUX_OPT_BIT1 FIELD32(0x00000002)
  135. #define AUX_OPT_BIT2 FIELD32(0x00000004)
  136. #define AUX_OPT_BIT3 FIELD32(0x00000008)
  137. #define AUX_OPT_BIT4 FIELD32(0x00000010)
  138. #define AUX_OPT_BIT5 FIELD32(0x00000020)
  139. #define AUX_OPT_BIT6 FIELD32(0x00000040)
  140. #define AUX_OPT_BIT7 FIELD32(0x00000080)
  141. #define AUX_OPT_BIT8 FIELD32(0x00000100)
  142. #define AUX_OPT_BIT9 FIELD32(0x00000200)
  143. #define AUX_OPT_BIT10 FIELD32(0x00000400)
  144. #define AUX_OPT_BIT11 FIELD32(0x00000800)
  145. #define AUX_OPT_BIT12 FIELD32(0x00001000)
  146. #define AUX_OPT_BIT13 FIELD32(0x00002000)
  147. #define AUX_OPT_BIT14 FIELD32(0x00004000)
  148. #define AUX_OPT_BIT15 FIELD32(0x00008000)
  149. #define LDO25_LEVEL FIELD32(0x00030000)
  150. #define LDO25_LARGEA FIELD32(0x00040000)
  151. #define LDO25_FRC_ON FIELD32(0x00080000)
  152. #define CMB_RSV FIELD32(0x00300000)
  153. #define XTAL_RDY FIELD32(0x00400000)
  154. #define PLL_LD FIELD32(0x00800000)
  155. #define LDO_CORE_LEVEL FIELD32(0x0F000000)
  156. #define LDO_BGSEL FIELD32(0x30000000)
  157. #define LDO3_EN FIELD32(0x40000000)
  158. #define LDO0_EN FIELD32(0x80000000)
  159. /*
  160. * EFUSE_CSR_3290: RT3290 EEPROM
  161. */
  162. #define EFUSE_CTRL_3290 0x0024
  163. /*
  164. * EFUSE_DATA3 of 3290
  165. */
  166. #define EFUSE_DATA3_3290 0x0028
  167. /*
  168. * EFUSE_DATA2 of 3290
  169. */
  170. #define EFUSE_DATA2_3290 0x002c
  171. /*
  172. * EFUSE_DATA1 of 3290
  173. */
  174. #define EFUSE_DATA1_3290 0x0030
  175. /*
  176. * EFUSE_DATA0 of 3290
  177. */
  178. #define EFUSE_DATA0_3290 0x0034
  179. /*
  180. * OSC_CTRL_CFG
  181. * Ring oscillator configuration
  182. */
  183. #define OSC_CTRL 0x0038
  184. #define OSC_REF_CYCLE FIELD32(0x00001fff)
  185. #define OSC_RSV FIELD32(0x0000e000)
  186. #define OSC_CAL_CNT FIELD32(0x0fff0000)
  187. #define OSC_CAL_ACK FIELD32(0x10000000)
  188. #define OSC_CLK_32K_VLD FIELD32(0x20000000)
  189. #define OSC_CAL_REQ FIELD32(0x40000000)
  190. #define OSC_ROSC_EN FIELD32(0x80000000)
  191. /*
  192. * COEX_CFG_0
  193. */
  194. #define COEX_CFG0 0x0040
  195. #define COEX_CFG_ANT FIELD32(0xff000000)
  196. /*
  197. * COEX_CFG_1
  198. */
  199. #define COEX_CFG1 0x0044
  200. /*
  201. * COEX_CFG_2
  202. */
  203. #define COEX_CFG2 0x0048
  204. #define BT_COEX_CFG1 FIELD32(0xff000000)
  205. #define BT_COEX_CFG0 FIELD32(0x00ff0000)
  206. #define WL_COEX_CFG1 FIELD32(0x0000ff00)
  207. #define WL_COEX_CFG0 FIELD32(0x000000ff)
  208. /*
  209. * PLL_CTRL_CFG
  210. * PLL configuration register
  211. */
  212. #define PLL_CTRL 0x0050
  213. #define PLL_RESERVED_INPUT1 FIELD32(0x000000ff)
  214. #define PLL_RESERVED_INPUT2 FIELD32(0x0000ff00)
  215. #define PLL_CONTROL FIELD32(0x00070000)
  216. #define PLL_LPF_R1 FIELD32(0x00080000)
  217. #define PLL_LPF_C1_CTRL FIELD32(0x00300000)
  218. #define PLL_LPF_C2_CTRL FIELD32(0x00c00000)
  219. #define PLL_CP_CURRENT_CTRL FIELD32(0x03000000)
  220. #define PLL_PFD_DELAY_CTRL FIELD32(0x0c000000)
  221. #define PLL_LOCK_CTRL FIELD32(0x70000000)
  222. #define PLL_VBGBK_EN FIELD32(0x80000000)
  223. /*
  224. * WLAN_CTRL_CFG
  225. * RT3290 wlan configuration
  226. */
  227. #define WLAN_FUN_CTRL 0x0080
  228. #define WLAN_EN FIELD32(0x00000001)
  229. #define WLAN_CLK_EN FIELD32(0x00000002)
  230. #define WLAN_RSV1 FIELD32(0x00000004)
  231. #define WLAN_RESET FIELD32(0x00000008)
  232. #define PCIE_APP0_CLK_REQ FIELD32(0x00000010)
  233. #define FRC_WL_ANT_SET FIELD32(0x00000020)
  234. #define INV_TR_SW0 FIELD32(0x00000040)
  235. #define WLAN_GPIO_IN_BIT0 FIELD32(0x00000100)
  236. #define WLAN_GPIO_IN_BIT1 FIELD32(0x00000200)
  237. #define WLAN_GPIO_IN_BIT2 FIELD32(0x00000400)
  238. #define WLAN_GPIO_IN_BIT3 FIELD32(0x00000800)
  239. #define WLAN_GPIO_IN_BIT4 FIELD32(0x00001000)
  240. #define WLAN_GPIO_IN_BIT5 FIELD32(0x00002000)
  241. #define WLAN_GPIO_IN_BIT6 FIELD32(0x00004000)
  242. #define WLAN_GPIO_IN_BIT7 FIELD32(0x00008000)
  243. #define WLAN_GPIO_IN_BIT_ALL FIELD32(0x0000ff00)
  244. #define WLAN_GPIO_OUT_BIT0 FIELD32(0x00010000)
  245. #define WLAN_GPIO_OUT_BIT1 FIELD32(0x00020000)
  246. #define WLAN_GPIO_OUT_BIT2 FIELD32(0x00040000)
  247. #define WLAN_GPIO_OUT_BIT3 FIELD32(0x00050000)
  248. #define WLAN_GPIO_OUT_BIT4 FIELD32(0x00100000)
  249. #define WLAN_GPIO_OUT_BIT5 FIELD32(0x00200000)
  250. #define WLAN_GPIO_OUT_BIT6 FIELD32(0x00400000)
  251. #define WLAN_GPIO_OUT_BIT7 FIELD32(0x00800000)
  252. #define WLAN_GPIO_OUT_BIT_ALL FIELD32(0x00ff0000)
  253. #define WLAN_GPIO_OUT_OE_BIT0 FIELD32(0x01000000)
  254. #define WLAN_GPIO_OUT_OE_BIT1 FIELD32(0x02000000)
  255. #define WLAN_GPIO_OUT_OE_BIT2 FIELD32(0x04000000)
  256. #define WLAN_GPIO_OUT_OE_BIT3 FIELD32(0x08000000)
  257. #define WLAN_GPIO_OUT_OE_BIT4 FIELD32(0x10000000)
  258. #define WLAN_GPIO_OUT_OE_BIT5 FIELD32(0x20000000)
  259. #define WLAN_GPIO_OUT_OE_BIT6 FIELD32(0x40000000)
  260. #define WLAN_GPIO_OUT_OE_BIT7 FIELD32(0x80000000)
  261. #define WLAN_GPIO_OUT_OE_BIT_ALL FIELD32(0xff000000)
  262. /*
  263. * AUX_CTRL: Aux/PCI-E related configuration
  264. */
  265. #define AUX_CTRL 0x10c
  266. #define AUX_CTRL_WAKE_PCIE_EN FIELD32(0x00000002)
  267. #define AUX_CTRL_FORCE_PCIE_CLK FIELD32(0x00000400)
  268. /*
  269. * OPT_14: Unknown register used by rt3xxx devices.
  270. */
  271. #define OPT_14_CSR 0x0114
  272. #define OPT_14_CSR_BIT0 FIELD32(0x00000001)
  273. /*
  274. * INT_SOURCE_CSR: Interrupt source register.
  275. * Write one to clear corresponding bit.
  276. * TX_FIFO_STATUS: FIFO Statistics is full, sw should read TX_STA_FIFO
  277. */
  278. #define INT_SOURCE_CSR 0x0200
  279. #define INT_SOURCE_CSR_RXDELAYINT FIELD32(0x00000001)
  280. #define INT_SOURCE_CSR_TXDELAYINT FIELD32(0x00000002)
  281. #define INT_SOURCE_CSR_RX_DONE FIELD32(0x00000004)
  282. #define INT_SOURCE_CSR_AC0_DMA_DONE FIELD32(0x00000008)
  283. #define INT_SOURCE_CSR_AC1_DMA_DONE FIELD32(0x00000010)
  284. #define INT_SOURCE_CSR_AC2_DMA_DONE FIELD32(0x00000020)
  285. #define INT_SOURCE_CSR_AC3_DMA_DONE FIELD32(0x00000040)
  286. #define INT_SOURCE_CSR_HCCA_DMA_DONE FIELD32(0x00000080)
  287. #define INT_SOURCE_CSR_MGMT_DMA_DONE FIELD32(0x00000100)
  288. #define INT_SOURCE_CSR_MCU_COMMAND FIELD32(0x00000200)
  289. #define INT_SOURCE_CSR_RXTX_COHERENT FIELD32(0x00000400)
  290. #define INT_SOURCE_CSR_TBTT FIELD32(0x00000800)
  291. #define INT_SOURCE_CSR_PRE_TBTT FIELD32(0x00001000)
  292. #define INT_SOURCE_CSR_TX_FIFO_STATUS FIELD32(0x00002000)
  293. #define INT_SOURCE_CSR_AUTO_WAKEUP FIELD32(0x00004000)
  294. #define INT_SOURCE_CSR_GPTIMER FIELD32(0x00008000)
  295. #define INT_SOURCE_CSR_RX_COHERENT FIELD32(0x00010000)
  296. #define INT_SOURCE_CSR_TX_COHERENT FIELD32(0x00020000)
  297. /*
  298. * INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF.
  299. */
  300. #define INT_MASK_CSR 0x0204
  301. #define INT_MASK_CSR_RXDELAYINT FIELD32(0x00000001)
  302. #define INT_MASK_CSR_TXDELAYINT FIELD32(0x00000002)
  303. #define INT_MASK_CSR_RX_DONE FIELD32(0x00000004)
  304. #define INT_MASK_CSR_AC0_DMA_DONE FIELD32(0x00000008)
  305. #define INT_MASK_CSR_AC1_DMA_DONE FIELD32(0x00000010)
  306. #define INT_MASK_CSR_AC2_DMA_DONE FIELD32(0x00000020)
  307. #define INT_MASK_CSR_AC3_DMA_DONE FIELD32(0x00000040)
  308. #define INT_MASK_CSR_HCCA_DMA_DONE FIELD32(0x00000080)
  309. #define INT_MASK_CSR_MGMT_DMA_DONE FIELD32(0x00000100)
  310. #define INT_MASK_CSR_MCU_COMMAND FIELD32(0x00000200)
  311. #define INT_MASK_CSR_RXTX_COHERENT FIELD32(0x00000400)
  312. #define INT_MASK_CSR_TBTT FIELD32(0x00000800)
  313. #define INT_MASK_CSR_PRE_TBTT FIELD32(0x00001000)
  314. #define INT_MASK_CSR_TX_FIFO_STATUS FIELD32(0x00002000)
  315. #define INT_MASK_CSR_AUTO_WAKEUP FIELD32(0x00004000)
  316. #define INT_MASK_CSR_GPTIMER FIELD32(0x00008000)
  317. #define INT_MASK_CSR_RX_COHERENT FIELD32(0x00010000)
  318. #define INT_MASK_CSR_TX_COHERENT FIELD32(0x00020000)
  319. /*
  320. * WPDMA_GLO_CFG
  321. */
  322. #define WPDMA_GLO_CFG 0x0208
  323. #define WPDMA_GLO_CFG_ENABLE_TX_DMA FIELD32(0x00000001)
  324. #define WPDMA_GLO_CFG_TX_DMA_BUSY FIELD32(0x00000002)
  325. #define WPDMA_GLO_CFG_ENABLE_RX_DMA FIELD32(0x00000004)
  326. #define WPDMA_GLO_CFG_RX_DMA_BUSY FIELD32(0x00000008)
  327. #define WPDMA_GLO_CFG_WP_DMA_BURST_SIZE FIELD32(0x00000030)
  328. #define WPDMA_GLO_CFG_TX_WRITEBACK_DONE FIELD32(0x00000040)
  329. #define WPDMA_GLO_CFG_BIG_ENDIAN FIELD32(0x00000080)
  330. #define WPDMA_GLO_CFG_RX_HDR_SCATTER FIELD32(0x0000ff00)
  331. #define WPDMA_GLO_CFG_HDR_SEG_LEN FIELD32(0xffff0000)
  332. /*
  333. * WPDMA_RST_IDX
  334. */
  335. #define WPDMA_RST_IDX 0x020c
  336. #define WPDMA_RST_IDX_DTX_IDX0 FIELD32(0x00000001)
  337. #define WPDMA_RST_IDX_DTX_IDX1 FIELD32(0x00000002)
  338. #define WPDMA_RST_IDX_DTX_IDX2 FIELD32(0x00000004)
  339. #define WPDMA_RST_IDX_DTX_IDX3 FIELD32(0x00000008)
  340. #define WPDMA_RST_IDX_DTX_IDX4 FIELD32(0x00000010)
  341. #define WPDMA_RST_IDX_DTX_IDX5 FIELD32(0x00000020)
  342. #define WPDMA_RST_IDX_DRX_IDX0 FIELD32(0x00010000)
  343. /*
  344. * DELAY_INT_CFG
  345. */
  346. #define DELAY_INT_CFG 0x0210
  347. #define DELAY_INT_CFG_RXMAX_PTIME FIELD32(0x000000ff)
  348. #define DELAY_INT_CFG_RXMAX_PINT FIELD32(0x00007f00)
  349. #define DELAY_INT_CFG_RXDLY_INT_EN FIELD32(0x00008000)
  350. #define DELAY_INT_CFG_TXMAX_PTIME FIELD32(0x00ff0000)
  351. #define DELAY_INT_CFG_TXMAX_PINT FIELD32(0x7f000000)
  352. #define DELAY_INT_CFG_TXDLY_INT_EN FIELD32(0x80000000)
  353. /*
  354. * WMM_AIFSN_CFG: Aifsn for each EDCA AC
  355. * AIFSN0: AC_VO
  356. * AIFSN1: AC_VI
  357. * AIFSN2: AC_BE
  358. * AIFSN3: AC_BK
  359. */
  360. #define WMM_AIFSN_CFG 0x0214
  361. #define WMM_AIFSN_CFG_AIFSN0 FIELD32(0x0000000f)
  362. #define WMM_AIFSN_CFG_AIFSN1 FIELD32(0x000000f0)
  363. #define WMM_AIFSN_CFG_AIFSN2 FIELD32(0x00000f00)
  364. #define WMM_AIFSN_CFG_AIFSN3 FIELD32(0x0000f000)
  365. /*
  366. * WMM_CWMIN_CSR: CWmin for each EDCA AC
  367. * CWMIN0: AC_VO
  368. * CWMIN1: AC_VI
  369. * CWMIN2: AC_BE
  370. * CWMIN3: AC_BK
  371. */
  372. #define WMM_CWMIN_CFG 0x0218
  373. #define WMM_CWMIN_CFG_CWMIN0 FIELD32(0x0000000f)
  374. #define WMM_CWMIN_CFG_CWMIN1 FIELD32(0x000000f0)
  375. #define WMM_CWMIN_CFG_CWMIN2 FIELD32(0x00000f00)
  376. #define WMM_CWMIN_CFG_CWMIN3 FIELD32(0x0000f000)
  377. /*
  378. * WMM_CWMAX_CSR: CWmax for each EDCA AC
  379. * CWMAX0: AC_VO
  380. * CWMAX1: AC_VI
  381. * CWMAX2: AC_BE
  382. * CWMAX3: AC_BK
  383. */
  384. #define WMM_CWMAX_CFG 0x021c
  385. #define WMM_CWMAX_CFG_CWMAX0 FIELD32(0x0000000f)
  386. #define WMM_CWMAX_CFG_CWMAX1 FIELD32(0x000000f0)
  387. #define WMM_CWMAX_CFG_CWMAX2 FIELD32(0x00000f00)
  388. #define WMM_CWMAX_CFG_CWMAX3 FIELD32(0x0000f000)
  389. /*
  390. * AC_TXOP0: AC_VO/AC_VI TXOP register
  391. * AC0TXOP: AC_VO in unit of 32us
  392. * AC1TXOP: AC_VI in unit of 32us
  393. */
  394. #define WMM_TXOP0_CFG 0x0220
  395. #define WMM_TXOP0_CFG_AC0TXOP FIELD32(0x0000ffff)
  396. #define WMM_TXOP0_CFG_AC1TXOP FIELD32(0xffff0000)
  397. /*
  398. * AC_TXOP1: AC_BE/AC_BK TXOP register
  399. * AC2TXOP: AC_BE in unit of 32us
  400. * AC3TXOP: AC_BK in unit of 32us
  401. */
  402. #define WMM_TXOP1_CFG 0x0224
  403. #define WMM_TXOP1_CFG_AC2TXOP FIELD32(0x0000ffff)
  404. #define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000)
  405. /*
  406. * GPIO_CTRL:
  407. * GPIO_CTRL_VALx: GPIO value
  408. * GPIO_CTRL_DIRx: GPIO direction: 0 = output; 1 = input
  409. */
  410. #define GPIO_CTRL 0x0228
  411. #define GPIO_CTRL_VAL0 FIELD32(0x00000001)
  412. #define GPIO_CTRL_VAL1 FIELD32(0x00000002)
  413. #define GPIO_CTRL_VAL2 FIELD32(0x00000004)
  414. #define GPIO_CTRL_VAL3 FIELD32(0x00000008)
  415. #define GPIO_CTRL_VAL4 FIELD32(0x00000010)
  416. #define GPIO_CTRL_VAL5 FIELD32(0x00000020)
  417. #define GPIO_CTRL_VAL6 FIELD32(0x00000040)
  418. #define GPIO_CTRL_VAL7 FIELD32(0x00000080)
  419. #define GPIO_CTRL_DIR0 FIELD32(0x00000100)
  420. #define GPIO_CTRL_DIR1 FIELD32(0x00000200)
  421. #define GPIO_CTRL_DIR2 FIELD32(0x00000400)
  422. #define GPIO_CTRL_DIR3 FIELD32(0x00000800)
  423. #define GPIO_CTRL_DIR4 FIELD32(0x00001000)
  424. #define GPIO_CTRL_DIR5 FIELD32(0x00002000)
  425. #define GPIO_CTRL_DIR6 FIELD32(0x00004000)
  426. #define GPIO_CTRL_DIR7 FIELD32(0x00008000)
  427. #define GPIO_CTRL_VAL8 FIELD32(0x00010000)
  428. #define GPIO_CTRL_VAL9 FIELD32(0x00020000)
  429. #define GPIO_CTRL_VAL10 FIELD32(0x00040000)
  430. #define GPIO_CTRL_DIR8 FIELD32(0x01000000)
  431. #define GPIO_CTRL_DIR9 FIELD32(0x02000000)
  432. #define GPIO_CTRL_DIR10 FIELD32(0x04000000)
  433. /*
  434. * MCU_CMD_CFG
  435. */
  436. #define MCU_CMD_CFG 0x022c
  437. /*
  438. * AC_VO register offsets
  439. */
  440. #define TX_BASE_PTR0 0x0230
  441. #define TX_MAX_CNT0 0x0234
  442. #define TX_CTX_IDX0 0x0238
  443. #define TX_DTX_IDX0 0x023c
  444. /*
  445. * AC_VI register offsets
  446. */
  447. #define TX_BASE_PTR1 0x0240
  448. #define TX_MAX_CNT1 0x0244
  449. #define TX_CTX_IDX1 0x0248
  450. #define TX_DTX_IDX1 0x024c
  451. /*
  452. * AC_BE register offsets
  453. */
  454. #define TX_BASE_PTR2 0x0250
  455. #define TX_MAX_CNT2 0x0254
  456. #define TX_CTX_IDX2 0x0258
  457. #define TX_DTX_IDX2 0x025c
  458. /*
  459. * AC_BK register offsets
  460. */
  461. #define TX_BASE_PTR3 0x0260
  462. #define TX_MAX_CNT3 0x0264
  463. #define TX_CTX_IDX3 0x0268
  464. #define TX_DTX_IDX3 0x026c
  465. /*
  466. * HCCA register offsets
  467. */
  468. #define TX_BASE_PTR4 0x0270
  469. #define TX_MAX_CNT4 0x0274
  470. #define TX_CTX_IDX4 0x0278
  471. #define TX_DTX_IDX4 0x027c
  472. /*
  473. * MGMT register offsets
  474. */
  475. #define TX_BASE_PTR5 0x0280
  476. #define TX_MAX_CNT5 0x0284
  477. #define TX_CTX_IDX5 0x0288
  478. #define TX_DTX_IDX5 0x028c
  479. /*
  480. * RX register offsets
  481. */
  482. #define RX_BASE_PTR 0x0290
  483. #define RX_MAX_CNT 0x0294
  484. #define RX_CRX_IDX 0x0298
  485. #define RX_DRX_IDX 0x029c
  486. /*
  487. * USB_DMA_CFG
  488. * RX_BULK_AGG_TIMEOUT: Rx Bulk Aggregation TimeOut in unit of 33ns.
  489. * RX_BULK_AGG_LIMIT: Rx Bulk Aggregation Limit in unit of 256 bytes.
  490. * PHY_CLEAR: phy watch dog enable.
  491. * TX_CLEAR: Clear USB DMA TX path.
  492. * TXOP_HALT: Halt TXOP count down when TX buffer is full.
  493. * RX_BULK_AGG_EN: Enable Rx Bulk Aggregation.
  494. * RX_BULK_EN: Enable USB DMA Rx.
  495. * TX_BULK_EN: Enable USB DMA Tx.
  496. * EP_OUT_VALID: OUT endpoint data valid.
  497. * RX_BUSY: USB DMA RX FSM busy.
  498. * TX_BUSY: USB DMA TX FSM busy.
  499. */
  500. #define USB_DMA_CFG 0x02a0
  501. #define USB_DMA_CFG_RX_BULK_AGG_TIMEOUT FIELD32(0x000000ff)
  502. #define USB_DMA_CFG_RX_BULK_AGG_LIMIT FIELD32(0x0000ff00)
  503. #define USB_DMA_CFG_PHY_CLEAR FIELD32(0x00010000)
  504. #define USB_DMA_CFG_TX_CLEAR FIELD32(0x00080000)
  505. #define USB_DMA_CFG_TXOP_HALT FIELD32(0x00100000)
  506. #define USB_DMA_CFG_RX_BULK_AGG_EN FIELD32(0x00200000)
  507. #define USB_DMA_CFG_RX_BULK_EN FIELD32(0x00400000)
  508. #define USB_DMA_CFG_TX_BULK_EN FIELD32(0x00800000)
  509. #define USB_DMA_CFG_EP_OUT_VALID FIELD32(0x3f000000)
  510. #define USB_DMA_CFG_RX_BUSY FIELD32(0x40000000)
  511. #define USB_DMA_CFG_TX_BUSY FIELD32(0x80000000)
  512. /*
  513. * US_CYC_CNT
  514. * BT_MODE_EN: Bluetooth mode enable
  515. * CLOCK CYCLE: Clock cycle count in 1us.
  516. * PCI:0x21, PCIE:0x7d, USB:0x1e
  517. */
  518. #define US_CYC_CNT 0x02a4
  519. #define US_CYC_CNT_BT_MODE_EN FIELD32(0x00000100)
  520. #define US_CYC_CNT_CLOCK_CYCLE FIELD32(0x000000ff)
  521. /*
  522. * PBF_SYS_CTRL
  523. * HOST_RAM_WRITE: enable Host program ram write selection
  524. */
  525. #define PBF_SYS_CTRL 0x0400
  526. #define PBF_SYS_CTRL_READY FIELD32(0x00000080)
  527. #define PBF_SYS_CTRL_HOST_RAM_WRITE FIELD32(0x00010000)
  528. /*
  529. * HOST-MCU shared memory
  530. */
  531. #define HOST_CMD_CSR 0x0404
  532. #define HOST_CMD_CSR_HOST_COMMAND FIELD32(0x000000ff)
  533. /*
  534. * PBF registers
  535. * Most are for debug. Driver doesn't touch PBF register.
  536. */
  537. #define PBF_CFG 0x0408
  538. #define PBF_MAX_PCNT 0x040c
  539. #define PBF_CTRL 0x0410
  540. #define PBF_INT_STA 0x0414
  541. #define PBF_INT_ENA 0x0418
  542. /*
  543. * BCN_OFFSET0:
  544. */
  545. #define BCN_OFFSET0 0x042c
  546. #define BCN_OFFSET0_BCN0 FIELD32(0x000000ff)
  547. #define BCN_OFFSET0_BCN1 FIELD32(0x0000ff00)
  548. #define BCN_OFFSET0_BCN2 FIELD32(0x00ff0000)
  549. #define BCN_OFFSET0_BCN3 FIELD32(0xff000000)
  550. /*
  551. * BCN_OFFSET1:
  552. */
  553. #define BCN_OFFSET1 0x0430
  554. #define BCN_OFFSET1_BCN4 FIELD32(0x000000ff)
  555. #define BCN_OFFSET1_BCN5 FIELD32(0x0000ff00)
  556. #define BCN_OFFSET1_BCN6 FIELD32(0x00ff0000)
  557. #define BCN_OFFSET1_BCN7 FIELD32(0xff000000)
  558. /*
  559. * TXRXQ_PCNT: PBF register
  560. * PCNT_TX0Q: Page count for TX hardware queue 0
  561. * PCNT_TX1Q: Page count for TX hardware queue 1
  562. * PCNT_TX2Q: Page count for TX hardware queue 2
  563. * PCNT_RX0Q: Page count for RX hardware queue
  564. */
  565. #define TXRXQ_PCNT 0x0438
  566. #define TXRXQ_PCNT_TX0Q FIELD32(0x000000ff)
  567. #define TXRXQ_PCNT_TX1Q FIELD32(0x0000ff00)
  568. #define TXRXQ_PCNT_TX2Q FIELD32(0x00ff0000)
  569. #define TXRXQ_PCNT_RX0Q FIELD32(0xff000000)
  570. /*
  571. * PBF register
  572. * Debug. Driver doesn't touch PBF register.
  573. */
  574. #define PBF_DBG 0x043c
  575. /*
  576. * RF registers
  577. */
  578. #define RF_CSR_CFG 0x0500
  579. #define RF_CSR_CFG_DATA FIELD32(0x000000ff)
  580. #define RF_CSR_CFG_REGNUM FIELD32(0x00003f00)
  581. #define RF_CSR_CFG_WRITE FIELD32(0x00010000)
  582. #define RF_CSR_CFG_BUSY FIELD32(0x00020000)
  583. /*
  584. * EFUSE_CSR: RT30x0 EEPROM
  585. */
  586. #define EFUSE_CTRL 0x0580
  587. #define EFUSE_CTRL_ADDRESS_IN FIELD32(0x03fe0000)
  588. #define EFUSE_CTRL_MODE FIELD32(0x000000c0)
  589. #define EFUSE_CTRL_KICK FIELD32(0x40000000)
  590. #define EFUSE_CTRL_PRESENT FIELD32(0x80000000)
  591. /*
  592. * EFUSE_DATA0
  593. */
  594. #define EFUSE_DATA0 0x0590
  595. /*
  596. * EFUSE_DATA1
  597. */
  598. #define EFUSE_DATA1 0x0594
  599. /*
  600. * EFUSE_DATA2
  601. */
  602. #define EFUSE_DATA2 0x0598
  603. /*
  604. * EFUSE_DATA3
  605. */
  606. #define EFUSE_DATA3 0x059c
  607. /*
  608. * LDO_CFG0
  609. */
  610. #define LDO_CFG0 0x05d4
  611. #define LDO_CFG0_DELAY3 FIELD32(0x000000ff)
  612. #define LDO_CFG0_DELAY2 FIELD32(0x0000ff00)
  613. #define LDO_CFG0_DELAY1 FIELD32(0x00ff0000)
  614. #define LDO_CFG0_BGSEL FIELD32(0x03000000)
  615. #define LDO_CFG0_LDO_CORE_VLEVEL FIELD32(0x1c000000)
  616. #define LD0_CFG0_LDO25_LEVEL FIELD32(0x60000000)
  617. #define LDO_CFG0_LDO25_LARGEA FIELD32(0x80000000)
  618. /*
  619. * GPIO_SWITCH
  620. */
  621. #define GPIO_SWITCH 0x05dc
  622. #define GPIO_SWITCH_0 FIELD32(0x00000001)
  623. #define GPIO_SWITCH_1 FIELD32(0x00000002)
  624. #define GPIO_SWITCH_2 FIELD32(0x00000004)
  625. #define GPIO_SWITCH_3 FIELD32(0x00000008)
  626. #define GPIO_SWITCH_4 FIELD32(0x00000010)
  627. #define GPIO_SWITCH_5 FIELD32(0x00000020)
  628. #define GPIO_SWITCH_6 FIELD32(0x00000040)
  629. #define GPIO_SWITCH_7 FIELD32(0x00000080)
  630. /*
  631. * FIXME: where the DEBUG_INDEX name come from?
  632. */
  633. #define MAC_DEBUG_INDEX 0x05e8
  634. #define MAC_DEBUG_INDEX_XTAL FIELD32(0x80000000)
  635. /*
  636. * MAC Control/Status Registers(CSR).
  637. * Some values are set in TU, whereas 1 TU == 1024 us.
  638. */
  639. /*
  640. * MAC_CSR0: ASIC revision number.
  641. * ASIC_REV: 0
  642. * ASIC_VER: 2860 or 2870
  643. */
  644. #define MAC_CSR0 0x1000
  645. #define MAC_CSR0_REVISION FIELD32(0x0000ffff)
  646. #define MAC_CSR0_CHIPSET FIELD32(0xffff0000)
  647. /*
  648. * MAC_SYS_CTRL:
  649. */
  650. #define MAC_SYS_CTRL 0x1004
  651. #define MAC_SYS_CTRL_RESET_CSR FIELD32(0x00000001)
  652. #define MAC_SYS_CTRL_RESET_BBP FIELD32(0x00000002)
  653. #define MAC_SYS_CTRL_ENABLE_TX FIELD32(0x00000004)
  654. #define MAC_SYS_CTRL_ENABLE_RX FIELD32(0x00000008)
  655. #define MAC_SYS_CTRL_CONTINUOUS_TX FIELD32(0x00000010)
  656. #define MAC_SYS_CTRL_LOOPBACK FIELD32(0x00000020)
  657. #define MAC_SYS_CTRL_WLAN_HALT FIELD32(0x00000040)
  658. #define MAC_SYS_CTRL_RX_TIMESTAMP FIELD32(0x00000080)
  659. /*
  660. * MAC_ADDR_DW0: STA MAC register 0
  661. */
  662. #define MAC_ADDR_DW0 0x1008
  663. #define MAC_ADDR_DW0_BYTE0 FIELD32(0x000000ff)
  664. #define MAC_ADDR_DW0_BYTE1 FIELD32(0x0000ff00)
  665. #define MAC_ADDR_DW0_BYTE2 FIELD32(0x00ff0000)
  666. #define MAC_ADDR_DW0_BYTE3 FIELD32(0xff000000)
  667. /*
  668. * MAC_ADDR_DW1: STA MAC register 1
  669. * UNICAST_TO_ME_MASK:
  670. * Used to mask off bits from byte 5 of the MAC address
  671. * to determine the UNICAST_TO_ME bit for RX frames.
  672. * The full mask is complemented by BSS_ID_MASK:
  673. * MASK = BSS_ID_MASK & UNICAST_TO_ME_MASK
  674. */
  675. #define MAC_ADDR_DW1 0x100c
  676. #define MAC_ADDR_DW1_BYTE4 FIELD32(0x000000ff)
  677. #define MAC_ADDR_DW1_BYTE5 FIELD32(0x0000ff00)
  678. #define MAC_ADDR_DW1_UNICAST_TO_ME_MASK FIELD32(0x00ff0000)
  679. /*
  680. * MAC_BSSID_DW0: BSSID register 0
  681. */
  682. #define MAC_BSSID_DW0 0x1010
  683. #define MAC_BSSID_DW0_BYTE0 FIELD32(0x000000ff)
  684. #define MAC_BSSID_DW0_BYTE1 FIELD32(0x0000ff00)
  685. #define MAC_BSSID_DW0_BYTE2 FIELD32(0x00ff0000)
  686. #define MAC_BSSID_DW0_BYTE3 FIELD32(0xff000000)
  687. /*
  688. * MAC_BSSID_DW1: BSSID register 1
  689. * BSS_ID_MASK:
  690. * 0: 1-BSSID mode (BSS index = 0)
  691. * 1: 2-BSSID mode (BSS index: Byte5, bit 0)
  692. * 2: 4-BSSID mode (BSS index: byte5, bit 0 - 1)
  693. * 3: 8-BSSID mode (BSS index: byte5, bit 0 - 2)
  694. * This mask is used to mask off bits 0, 1 and 2 of byte 5 of the
  695. * BSSID. This will make sure that those bits will be ignored
  696. * when determining the MY_BSS of RX frames.
  697. */
  698. #define MAC_BSSID_DW1 0x1014
  699. #define MAC_BSSID_DW1_BYTE4 FIELD32(0x000000ff)
  700. #define MAC_BSSID_DW1_BYTE5 FIELD32(0x0000ff00)
  701. #define MAC_BSSID_DW1_BSS_ID_MASK FIELD32(0x00030000)
  702. #define MAC_BSSID_DW1_BSS_BCN_NUM FIELD32(0x001c0000)
  703. /*
  704. * MAX_LEN_CFG: Maximum frame length register.
  705. * MAX_MPDU: rt2860b max 16k bytes
  706. * MAX_PSDU: Maximum PSDU length
  707. * (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16
  708. */
  709. #define MAX_LEN_CFG 0x1018
  710. #define MAX_LEN_CFG_MAX_MPDU FIELD32(0x00000fff)
  711. #define MAX_LEN_CFG_MAX_PSDU FIELD32(0x00003000)
  712. #define MAX_LEN_CFG_MIN_PSDU FIELD32(0x0000c000)
  713. #define MAX_LEN_CFG_MIN_MPDU FIELD32(0x000f0000)
  714. /*
  715. * BBP_CSR_CFG: BBP serial control register
  716. * VALUE: Register value to program into BBP
  717. * REG_NUM: Selected BBP register
  718. * READ_CONTROL: 0 write BBP, 1 read BBP
  719. * BUSY: ASIC is busy executing BBP commands
  720. * BBP_PAR_DUR: 0 4 MAC clocks, 1 8 MAC clocks
  721. * BBP_RW_MODE: 0 serial, 1 parallel
  722. */
  723. #define BBP_CSR_CFG 0x101c
  724. #define BBP_CSR_CFG_VALUE FIELD32(0x000000ff)
  725. #define BBP_CSR_CFG_REGNUM FIELD32(0x0000ff00)
  726. #define BBP_CSR_CFG_READ_CONTROL FIELD32(0x00010000)
  727. #define BBP_CSR_CFG_BUSY FIELD32(0x00020000)
  728. #define BBP_CSR_CFG_BBP_PAR_DUR FIELD32(0x00040000)
  729. #define BBP_CSR_CFG_BBP_RW_MODE FIELD32(0x00080000)
  730. /*
  731. * RF_CSR_CFG0: RF control register
  732. * REGID_AND_VALUE: Register value to program into RF
  733. * BITWIDTH: Selected RF register
  734. * STANDBYMODE: 0 high when standby, 1 low when standby
  735. * SEL: 0 RF_LE0 activate, 1 RF_LE1 activate
  736. * BUSY: ASIC is busy executing RF commands
  737. */
  738. #define RF_CSR_CFG0 0x1020
  739. #define RF_CSR_CFG0_REGID_AND_VALUE FIELD32(0x00ffffff)
  740. #define RF_CSR_CFG0_BITWIDTH FIELD32(0x1f000000)
  741. #define RF_CSR_CFG0_REG_VALUE_BW FIELD32(0x1fffffff)
  742. #define RF_CSR_CFG0_STANDBYMODE FIELD32(0x20000000)
  743. #define RF_CSR_CFG0_SEL FIELD32(0x40000000)
  744. #define RF_CSR_CFG0_BUSY FIELD32(0x80000000)
  745. /*
  746. * RF_CSR_CFG1: RF control register
  747. * REGID_AND_VALUE: Register value to program into RF
  748. * RFGAP: Gap between BB_CONTROL_RF and RF_LE
  749. * 0: 3 system clock cycle (37.5usec)
  750. * 1: 5 system clock cycle (62.5usec)
  751. */
  752. #define RF_CSR_CFG1 0x1024
  753. #define RF_CSR_CFG1_REGID_AND_VALUE FIELD32(0x00ffffff)
  754. #define RF_CSR_CFG1_RFGAP FIELD32(0x1f000000)
  755. /*
  756. * RF_CSR_CFG2: RF control register
  757. * VALUE: Register value to program into RF
  758. */
  759. #define RF_CSR_CFG2 0x1028
  760. #define RF_CSR_CFG2_VALUE FIELD32(0x00ffffff)
  761. /*
  762. * LED_CFG: LED control
  763. * ON_PERIOD: LED active time (ms) during TX (only used for LED mode 1)
  764. * OFF_PERIOD: LED inactive time (ms) during TX (only used for LED mode 1)
  765. * SLOW_BLINK_PERIOD: LED blink interval in seconds (only used for LED mode 2)
  766. * color LED's:
  767. * 0: off
  768. * 1: blinking upon TX2
  769. * 2: periodic slow blinking
  770. * 3: always on
  771. * LED polarity:
  772. * 0: active low
  773. * 1: active high
  774. */
  775. #define LED_CFG 0x102c
  776. #define LED_CFG_ON_PERIOD FIELD32(0x000000ff)
  777. #define LED_CFG_OFF_PERIOD FIELD32(0x0000ff00)
  778. #define LED_CFG_SLOW_BLINK_PERIOD FIELD32(0x003f0000)
  779. #define LED_CFG_R_LED_MODE FIELD32(0x03000000)
  780. #define LED_CFG_G_LED_MODE FIELD32(0x0c000000)
  781. #define LED_CFG_Y_LED_MODE FIELD32(0x30000000)
  782. #define LED_CFG_LED_POLAR FIELD32(0x40000000)
  783. /*
  784. * AMPDU_BA_WINSIZE: Force BlockAck window size
  785. * FORCE_WINSIZE_ENABLE:
  786. * 0: Disable forcing of BlockAck window size
  787. * 1: Enable forcing of BlockAck window size, overwrites values BlockAck
  788. * window size values in the TXWI
  789. * FORCE_WINSIZE: BlockAck window size
  790. */
  791. #define AMPDU_BA_WINSIZE 0x1040
  792. #define AMPDU_BA_WINSIZE_FORCE_WINSIZE_ENABLE FIELD32(0x00000020)
  793. #define AMPDU_BA_WINSIZE_FORCE_WINSIZE FIELD32(0x0000001f)
  794. /*
  795. * XIFS_TIME_CFG: MAC timing
  796. * CCKM_SIFS_TIME: unit 1us. Applied after CCK RX/TX
  797. * OFDM_SIFS_TIME: unit 1us. Applied after OFDM RX/TX
  798. * OFDM_XIFS_TIME: unit 1us. Applied after OFDM RX
  799. * when MAC doesn't reference BBP signal BBRXEND
  800. * EIFS: unit 1us
  801. * BB_RXEND_ENABLE: reference RXEND signal to begin XIFS defer
  802. *
  803. */
  804. #define XIFS_TIME_CFG 0x1100
  805. #define XIFS_TIME_CFG_CCKM_SIFS_TIME FIELD32(0x000000ff)
  806. #define XIFS_TIME_CFG_OFDM_SIFS_TIME FIELD32(0x0000ff00)
  807. #define XIFS_TIME_CFG_OFDM_XIFS_TIME FIELD32(0x000f0000)
  808. #define XIFS_TIME_CFG_EIFS FIELD32(0x1ff00000)
  809. #define XIFS_TIME_CFG_BB_RXEND_ENABLE FIELD32(0x20000000)
  810. /*
  811. * BKOFF_SLOT_CFG:
  812. */
  813. #define BKOFF_SLOT_CFG 0x1104
  814. #define BKOFF_SLOT_CFG_SLOT_TIME FIELD32(0x000000ff)
  815. #define BKOFF_SLOT_CFG_CC_DELAY_TIME FIELD32(0x0000ff00)
  816. /*
  817. * NAV_TIME_CFG:
  818. */
  819. #define NAV_TIME_CFG 0x1108
  820. #define NAV_TIME_CFG_SIFS FIELD32(0x000000ff)
  821. #define NAV_TIME_CFG_SLOT_TIME FIELD32(0x0000ff00)
  822. #define NAV_TIME_CFG_EIFS FIELD32(0x01ff0000)
  823. #define NAV_TIME_ZERO_SIFS FIELD32(0x02000000)
  824. /*
  825. * CH_TIME_CFG: count as channel busy
  826. * EIFS_BUSY: Count EIFS as channel busy
  827. * NAV_BUSY: Count NAS as channel busy
  828. * RX_BUSY: Count RX as channel busy
  829. * TX_BUSY: Count TX as channel busy
  830. * TMR_EN: Enable channel statistics timer
  831. */
  832. #define CH_TIME_CFG 0x110c
  833. #define CH_TIME_CFG_EIFS_BUSY FIELD32(0x00000010)
  834. #define CH_TIME_CFG_NAV_BUSY FIELD32(0x00000008)
  835. #define CH_TIME_CFG_RX_BUSY FIELD32(0x00000004)
  836. #define CH_TIME_CFG_TX_BUSY FIELD32(0x00000002)
  837. #define CH_TIME_CFG_TMR_EN FIELD32(0x00000001)
  838. /*
  839. * PBF_LIFE_TIMER: TX/RX MPDU timestamp timer (free run) Unit: 1us
  840. */
  841. #define PBF_LIFE_TIMER 0x1110
  842. /*
  843. * BCN_TIME_CFG:
  844. * BEACON_INTERVAL: in unit of 1/16 TU
  845. * TSF_TICKING: Enable TSF auto counting
  846. * TSF_SYNC: Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode
  847. * BEACON_GEN: Enable beacon generator
  848. */
  849. #define BCN_TIME_CFG 0x1114
  850. #define BCN_TIME_CFG_BEACON_INTERVAL FIELD32(0x0000ffff)
  851. #define BCN_TIME_CFG_TSF_TICKING FIELD32(0x00010000)
  852. #define BCN_TIME_CFG_TSF_SYNC FIELD32(0x00060000)
  853. #define BCN_TIME_CFG_TBTT_ENABLE FIELD32(0x00080000)
  854. #define BCN_TIME_CFG_BEACON_GEN FIELD32(0x00100000)
  855. #define BCN_TIME_CFG_TX_TIME_COMPENSATE FIELD32(0xf0000000)
  856. /*
  857. * TBTT_SYNC_CFG:
  858. * BCN_AIFSN: Beacon AIFSN after TBTT interrupt in slots
  859. * BCN_CWMIN: Beacon CWMin after TBTT interrupt in slots
  860. */
  861. #define TBTT_SYNC_CFG 0x1118
  862. #define TBTT_SYNC_CFG_TBTT_ADJUST FIELD32(0x000000ff)
  863. #define TBTT_SYNC_CFG_BCN_EXP_WIN FIELD32(0x0000ff00)
  864. #define TBTT_SYNC_CFG_BCN_AIFSN FIELD32(0x000f0000)
  865. #define TBTT_SYNC_CFG_BCN_CWMIN FIELD32(0x00f00000)
  866. /*
  867. * TSF_TIMER_DW0: Local lsb TSF timer, read-only
  868. */
  869. #define TSF_TIMER_DW0 0x111c
  870. #define TSF_TIMER_DW0_LOW_WORD FIELD32(0xffffffff)
  871. /*
  872. * TSF_TIMER_DW1: Local msb TSF timer, read-only
  873. */
  874. #define TSF_TIMER_DW1 0x1120
  875. #define TSF_TIMER_DW1_HIGH_WORD FIELD32(0xffffffff)
  876. /*
  877. * TBTT_TIMER: TImer remains till next TBTT, read-only
  878. */
  879. #define TBTT_TIMER 0x1124
  880. /*
  881. * INT_TIMER_CFG: timer configuration
  882. * PRE_TBTT_TIMER: leadtime to tbtt for pretbtt interrupt in units of 1/16 TU
  883. * GP_TIMER: period of general purpose timer in units of 1/16 TU
  884. */
  885. #define INT_TIMER_CFG 0x1128
  886. #define INT_TIMER_CFG_PRE_TBTT_TIMER FIELD32(0x0000ffff)
  887. #define INT_TIMER_CFG_GP_TIMER FIELD32(0xffff0000)
  888. /*
  889. * INT_TIMER_EN: GP-timer and pre-tbtt Int enable
  890. */
  891. #define INT_TIMER_EN 0x112c
  892. #define INT_TIMER_EN_PRE_TBTT_TIMER FIELD32(0x00000001)
  893. #define INT_TIMER_EN_GP_TIMER FIELD32(0x00000002)
  894. /*
  895. * CH_IDLE_STA: channel idle time (in us)
  896. */
  897. #define CH_IDLE_STA 0x1130
  898. /*
  899. * CH_BUSY_STA: channel busy time on primary channel (in us)
  900. */
  901. #define CH_BUSY_STA 0x1134
  902. /*
  903. * CH_BUSY_STA_SEC: channel busy time on secondary channel in HT40 mode (in us)
  904. */
  905. #define CH_BUSY_STA_SEC 0x1138
  906. /*
  907. * MAC_STATUS_CFG:
  908. * BBP_RF_BUSY: When set to 0, BBP and RF are stable.
  909. * if 1 or higher one of the 2 registers is busy.
  910. */
  911. #define MAC_STATUS_CFG 0x1200
  912. #define MAC_STATUS_CFG_BBP_RF_BUSY FIELD32(0x00000003)
  913. /*
  914. * PWR_PIN_CFG:
  915. */
  916. #define PWR_PIN_CFG 0x1204
  917. /*
  918. * AUTOWAKEUP_CFG: Manual power control / status register
  919. * TBCN_BEFORE_WAKE: ForceWake has high privilege than PutToSleep when both set
  920. * AUTOWAKE: 0:sleep, 1:awake
  921. */
  922. #define AUTOWAKEUP_CFG 0x1208
  923. #define AUTOWAKEUP_CFG_AUTO_LEAD_TIME FIELD32(0x000000ff)
  924. #define AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE FIELD32(0x00007f00)
  925. #define AUTOWAKEUP_CFG_AUTOWAKE FIELD32(0x00008000)
  926. /*
  927. * EDCA_AC0_CFG:
  928. */
  929. #define EDCA_AC0_CFG 0x1300
  930. #define EDCA_AC0_CFG_TX_OP FIELD32(0x000000ff)
  931. #define EDCA_AC0_CFG_AIFSN FIELD32(0x00000f00)
  932. #define EDCA_AC0_CFG_CWMIN FIELD32(0x0000f000)
  933. #define EDCA_AC0_CFG_CWMAX FIELD32(0x000f0000)
  934. /*
  935. * EDCA_AC1_CFG:
  936. */
  937. #define EDCA_AC1_CFG 0x1304
  938. #define EDCA_AC1_CFG_TX_OP FIELD32(0x000000ff)
  939. #define EDCA_AC1_CFG_AIFSN FIELD32(0x00000f00)
  940. #define EDCA_AC1_CFG_CWMIN FIELD32(0x0000f000)
  941. #define EDCA_AC1_CFG_CWMAX FIELD32(0x000f0000)
  942. /*
  943. * EDCA_AC2_CFG:
  944. */
  945. #define EDCA_AC2_CFG 0x1308
  946. #define EDCA_AC2_CFG_TX_OP FIELD32(0x000000ff)
  947. #define EDCA_AC2_CFG_AIFSN FIELD32(0x00000f00)
  948. #define EDCA_AC2_CFG_CWMIN FIELD32(0x0000f000)
  949. #define EDCA_AC2_CFG_CWMAX FIELD32(0x000f0000)
  950. /*
  951. * EDCA_AC3_CFG:
  952. */
  953. #define EDCA_AC3_CFG 0x130c
  954. #define EDCA_AC3_CFG_TX_OP FIELD32(0x000000ff)
  955. #define EDCA_AC3_CFG_AIFSN FIELD32(0x00000f00)
  956. #define EDCA_AC3_CFG_CWMIN FIELD32(0x0000f000)
  957. #define EDCA_AC3_CFG_CWMAX FIELD32(0x000f0000)
  958. /*
  959. * EDCA_TID_AC_MAP:
  960. */
  961. #define EDCA_TID_AC_MAP 0x1310
  962. /*
  963. * TX_PWR_CFG:
  964. */
  965. #define TX_PWR_CFG_RATE0 FIELD32(0x0000000f)
  966. #define TX_PWR_CFG_RATE1 FIELD32(0x000000f0)
  967. #define TX_PWR_CFG_RATE2 FIELD32(0x00000f00)
  968. #define TX_PWR_CFG_RATE3 FIELD32(0x0000f000)
  969. #define TX_PWR_CFG_RATE4 FIELD32(0x000f0000)
  970. #define TX_PWR_CFG_RATE5 FIELD32(0x00f00000)
  971. #define TX_PWR_CFG_RATE6 FIELD32(0x0f000000)
  972. #define TX_PWR_CFG_RATE7 FIELD32(0xf0000000)
  973. /*
  974. * TX_PWR_CFG_0:
  975. */
  976. #define TX_PWR_CFG_0 0x1314
  977. #define TX_PWR_CFG_0_1MBS FIELD32(0x0000000f)
  978. #define TX_PWR_CFG_0_2MBS FIELD32(0x000000f0)
  979. #define TX_PWR_CFG_0_55MBS FIELD32(0x00000f00)
  980. #define TX_PWR_CFG_0_11MBS FIELD32(0x0000f000)
  981. #define TX_PWR_CFG_0_6MBS FIELD32(0x000f0000)
  982. #define TX_PWR_CFG_0_9MBS FIELD32(0x00f00000)
  983. #define TX_PWR_CFG_0_12MBS FIELD32(0x0f000000)
  984. #define TX_PWR_CFG_0_18MBS FIELD32(0xf0000000)
  985. /* bits for 3T devices */
  986. #define TX_PWR_CFG_0_CCK1_CH0 FIELD32(0x0000000f)
  987. #define TX_PWR_CFG_0_CCK1_CH1 FIELD32(0x000000f0)
  988. #define TX_PWR_CFG_0_CCK5_CH0 FIELD32(0x00000f00)
  989. #define TX_PWR_CFG_0_CCK5_CH1 FIELD32(0x0000f000)
  990. #define TX_PWR_CFG_0_OFDM6_CH0 FIELD32(0x000f0000)
  991. #define TX_PWR_CFG_0_OFDM6_CH1 FIELD32(0x00f00000)
  992. #define TX_PWR_CFG_0_OFDM12_CH0 FIELD32(0x0f000000)
  993. #define TX_PWR_CFG_0_OFDM12_CH1 FIELD32(0xf0000000)
  994. /*
  995. * TX_PWR_CFG_1:
  996. */
  997. #define TX_PWR_CFG_1 0x1318
  998. #define TX_PWR_CFG_1_24MBS FIELD32(0x0000000f)
  999. #define TX_PWR_CFG_1_36MBS FIELD32(0x000000f0)
  1000. #define TX_PWR_CFG_1_48MBS FIELD32(0x00000f00)
  1001. #define TX_PWR_CFG_1_54MBS FIELD32(0x0000f000)
  1002. #define TX_PWR_CFG_1_MCS0 FIELD32(0x000f0000)
  1003. #define TX_PWR_CFG_1_MCS1 FIELD32(0x00f00000)
  1004. #define TX_PWR_CFG_1_MCS2 FIELD32(0x0f000000)
  1005. #define TX_PWR_CFG_1_MCS3 FIELD32(0xf0000000)
  1006. /* bits for 3T devices */
  1007. #define TX_PWR_CFG_1_OFDM24_CH0 FIELD32(0x0000000f)
  1008. #define TX_PWR_CFG_1_OFDM24_CH1 FIELD32(0x000000f0)
  1009. #define TX_PWR_CFG_1_OFDM48_CH0 FIELD32(0x00000f00)
  1010. #define TX_PWR_CFG_1_OFDM48_CH1 FIELD32(0x0000f000)
  1011. #define TX_PWR_CFG_1_MCS0_CH0 FIELD32(0x000f0000)
  1012. #define TX_PWR_CFG_1_MCS0_CH1 FIELD32(0x00f00000)
  1013. #define TX_PWR_CFG_1_MCS2_CH0 FIELD32(0x0f000000)
  1014. #define TX_PWR_CFG_1_MCS2_CH1 FIELD32(0xf0000000)
  1015. /*
  1016. * TX_PWR_CFG_2:
  1017. */
  1018. #define TX_PWR_CFG_2 0x131c
  1019. #define TX_PWR_CFG_2_MCS4 FIELD32(0x0000000f)
  1020. #define TX_PWR_CFG_2_MCS5 FIELD32(0x000000f0)
  1021. #define TX_PWR_CFG_2_MCS6 FIELD32(0x00000f00)
  1022. #define TX_PWR_CFG_2_MCS7 FIELD32(0x0000f000)
  1023. #define TX_PWR_CFG_2_MCS8 FIELD32(0x000f0000)
  1024. #define TX_PWR_CFG_2_MCS9 FIELD32(0x00f00000)
  1025. #define TX_PWR_CFG_2_MCS10 FIELD32(0x0f000000)
  1026. #define TX_PWR_CFG_2_MCS11 FIELD32(0xf0000000)
  1027. /* bits for 3T devices */
  1028. #define TX_PWR_CFG_2_MCS4_CH0 FIELD32(0x0000000f)
  1029. #define TX_PWR_CFG_2_MCS4_CH1 FIELD32(0x000000f0)
  1030. #define TX_PWR_CFG_2_MCS6_CH0 FIELD32(0x00000f00)
  1031. #define TX_PWR_CFG_2_MCS6_CH1 FIELD32(0x0000f000)
  1032. #define TX_PWR_CFG_2_MCS8_CH0 FIELD32(0x000f0000)
  1033. #define TX_PWR_CFG_2_MCS8_CH1 FIELD32(0x00f00000)
  1034. #define TX_PWR_CFG_2_MCS10_CH0 FIELD32(0x0f000000)
  1035. #define TX_PWR_CFG_2_MCS10_CH1 FIELD32(0xf0000000)
  1036. /*
  1037. * TX_PWR_CFG_3:
  1038. */
  1039. #define TX_PWR_CFG_3 0x1320
  1040. #define TX_PWR_CFG_3_MCS12 FIELD32(0x0000000f)
  1041. #define TX_PWR_CFG_3_MCS13 FIELD32(0x000000f0)
  1042. #define TX_PWR_CFG_3_MCS14 FIELD32(0x00000f00)
  1043. #define TX_PWR_CFG_3_MCS15 FIELD32(0x0000f000)
  1044. #define TX_PWR_CFG_3_UKNOWN1 FIELD32(0x000f0000)
  1045. #define TX_PWR_CFG_3_UKNOWN2 FIELD32(0x00f00000)
  1046. #define TX_PWR_CFG_3_UKNOWN3 FIELD32(0x0f000000)
  1047. #define TX_PWR_CFG_3_UKNOWN4 FIELD32(0xf0000000)
  1048. /* bits for 3T devices */
  1049. #define TX_PWR_CFG_3_MCS12_CH0 FIELD32(0x0000000f)
  1050. #define TX_PWR_CFG_3_MCS12_CH1 FIELD32(0x000000f0)
  1051. #define TX_PWR_CFG_3_MCS14_CH0 FIELD32(0x00000f00)
  1052. #define TX_PWR_CFG_3_MCS14_CH1 FIELD32(0x0000f000)
  1053. #define TX_PWR_CFG_3_STBC0_CH0 FIELD32(0x000f0000)
  1054. #define TX_PWR_CFG_3_STBC0_CH1 FIELD32(0x00f00000)
  1055. #define TX_PWR_CFG_3_STBC2_CH0 FIELD32(0x0f000000)
  1056. #define TX_PWR_CFG_3_STBC2_CH1 FIELD32(0xf0000000)
  1057. /*
  1058. * TX_PWR_CFG_4:
  1059. */
  1060. #define TX_PWR_CFG_4 0x1324
  1061. #define TX_PWR_CFG_4_UKNOWN5 FIELD32(0x0000000f)
  1062. #define TX_PWR_CFG_4_UKNOWN6 FIELD32(0x000000f0)
  1063. #define TX_PWR_CFG_4_UKNOWN7 FIELD32(0x00000f00)
  1064. #define TX_PWR_CFG_4_UKNOWN8 FIELD32(0x0000f000)
  1065. /* bits for 3T devices */
  1066. #define TX_PWR_CFG_3_STBC4_CH0 FIELD32(0x0000000f)
  1067. #define TX_PWR_CFG_3_STBC4_CH1 FIELD32(0x000000f0)
  1068. #define TX_PWR_CFG_3_STBC6_CH0 FIELD32(0x00000f00)
  1069. #define TX_PWR_CFG_3_STBC6_CH1 FIELD32(0x0000f000)
  1070. /*
  1071. * TX_PIN_CFG:
  1072. */
  1073. #define TX_PIN_CFG 0x1328
  1074. #define TX_PIN_CFG_PA_PE_DISABLE 0xfcfffff0
  1075. #define TX_PIN_CFG_PA_PE_A0_EN FIELD32(0x00000001)
  1076. #define TX_PIN_CFG_PA_PE_G0_EN FIELD32(0x00000002)
  1077. #define TX_PIN_CFG_PA_PE_A1_EN FIELD32(0x00000004)
  1078. #define TX_PIN_CFG_PA_PE_G1_EN FIELD32(0x00000008)
  1079. #define TX_PIN_CFG_PA_PE_A0_POL FIELD32(0x00000010)
  1080. #define TX_PIN_CFG_PA_PE_G0_POL FIELD32(0x00000020)
  1081. #define TX_PIN_CFG_PA_PE_A1_POL FIELD32(0x00000040)
  1082. #define TX_PIN_CFG_PA_PE_G1_POL FIELD32(0x00000080)
  1083. #define TX_PIN_CFG_LNA_PE_A0_EN FIELD32(0x00000100)
  1084. #define TX_PIN_CFG_LNA_PE_G0_EN FIELD32(0x00000200)
  1085. #define TX_PIN_CFG_LNA_PE_A1_EN FIELD32(0x00000400)
  1086. #define TX_PIN_CFG_LNA_PE_G1_EN FIELD32(0x00000800)
  1087. #define TX_PIN_CFG_LNA_PE_A0_POL FIELD32(0x00001000)
  1088. #define TX_PIN_CFG_LNA_PE_G0_POL FIELD32(0x00002000)
  1089. #define TX_PIN_CFG_LNA_PE_A1_POL FIELD32(0x00004000)
  1090. #define TX_PIN_CFG_LNA_PE_G1_POL FIELD32(0x00008000)
  1091. #define TX_PIN_CFG_RFTR_EN FIELD32(0x00010000)
  1092. #define TX_PIN_CFG_RFTR_POL FIELD32(0x00020000)
  1093. #define TX_PIN_CFG_TRSW_EN FIELD32(0x00040000)
  1094. #define TX_PIN_CFG_TRSW_POL FIELD32(0x00080000)
  1095. #define TX_PIN_CFG_PA_PE_A2_EN FIELD32(0x01000000)
  1096. #define TX_PIN_CFG_PA_PE_G2_EN FIELD32(0x02000000)
  1097. #define TX_PIN_CFG_PA_PE_A2_POL FIELD32(0x04000000)
  1098. #define TX_PIN_CFG_PA_PE_G2_POL FIELD32(0x08000000)
  1099. #define TX_PIN_CFG_LNA_PE_A2_EN FIELD32(0x10000000)
  1100. #define TX_PIN_CFG_LNA_PE_G2_EN FIELD32(0x20000000)
  1101. #define TX_PIN_CFG_LNA_PE_A2_POL FIELD32(0x40000000)
  1102. #define TX_PIN_CFG_LNA_PE_G2_POL FIELD32(0x80000000)
  1103. /*
  1104. * TX_BAND_CFG: 0x1 use upper 20MHz, 0x0 use lower 20MHz
  1105. */
  1106. #define TX_BAND_CFG 0x132c
  1107. #define TX_BAND_CFG_HT40_MINUS FIELD32(0x00000001)
  1108. #define TX_BAND_CFG_A FIELD32(0x00000002)
  1109. #define TX_BAND_CFG_BG FIELD32(0x00000004)
  1110. /*
  1111. * TX_SW_CFG0:
  1112. */
  1113. #define TX_SW_CFG0 0x1330
  1114. /*
  1115. * TX_SW_CFG1:
  1116. */
  1117. #define TX_SW_CFG1 0x1334
  1118. /*
  1119. * TX_SW_CFG2:
  1120. */
  1121. #define TX_SW_CFG2 0x1338
  1122. /*
  1123. * TXOP_THRES_CFG:
  1124. */
  1125. #define TXOP_THRES_CFG 0x133c
  1126. /*
  1127. * TXOP_CTRL_CFG:
  1128. * TIMEOUT_TRUN_EN: Enable/Disable TXOP timeout truncation
  1129. * AC_TRUN_EN: Enable/Disable truncation for AC change
  1130. * TXRATEGRP_TRUN_EN: Enable/Disable truncation for TX rate group change
  1131. * USER_MODE_TRUN_EN: Enable/Disable truncation for user TXOP mode
  1132. * MIMO_PS_TRUN_EN: Enable/Disable truncation for MIMO PS RTS/CTS
  1133. * RESERVED_TRUN_EN: Reserved
  1134. * LSIG_TXOP_EN: Enable/Disable L-SIG TXOP protection
  1135. * EXT_CCA_EN: Enable/Disable extension channel CCA reference (Defer 40Mhz
  1136. * transmissions if extension CCA is clear).
  1137. * EXT_CCA_DLY: Extension CCA signal delay time (unit: us)
  1138. * EXT_CWMIN: CwMin for extension channel backoff
  1139. * 0: Disabled
  1140. *
  1141. */
  1142. #define TXOP_CTRL_CFG 0x1340
  1143. #define TXOP_CTRL_CFG_TIMEOUT_TRUN_EN FIELD32(0x00000001)
  1144. #define TXOP_CTRL_CFG_AC_TRUN_EN FIELD32(0x00000002)
  1145. #define TXOP_CTRL_CFG_TXRATEGRP_TRUN_EN FIELD32(0x00000004)
  1146. #define TXOP_CTRL_CFG_USER_MODE_TRUN_EN FIELD32(0x00000008)
  1147. #define TXOP_CTRL_CFG_MIMO_PS_TRUN_EN FIELD32(0x00000010)
  1148. #define TXOP_CTRL_CFG_RESERVED_TRUN_EN FIELD32(0x00000020)
  1149. #define TXOP_CTRL_CFG_LSIG_TXOP_EN FIELD32(0x00000040)
  1150. #define TXOP_CTRL_CFG_EXT_CCA_EN FIELD32(0x00000080)
  1151. #define TXOP_CTRL_CFG_EXT_CCA_DLY FIELD32(0x0000ff00)
  1152. #define TXOP_CTRL_CFG_EXT_CWMIN FIELD32(0x000f0000)
  1153. /*
  1154. * TX_RTS_CFG:
  1155. * RTS_THRES: unit:byte
  1156. * RTS_FBK_EN: enable rts rate fallback
  1157. */
  1158. #define TX_RTS_CFG 0x1344
  1159. #define TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT FIELD32(0x000000ff)
  1160. #define TX_RTS_CFG_RTS_THRES FIELD32(0x00ffff00)
  1161. #define TX_RTS_CFG_RTS_FBK_EN FIELD32(0x01000000)
  1162. /*
  1163. * TX_TIMEOUT_CFG:
  1164. * MPDU_LIFETIME: expiration time = 2^(9+MPDU LIFE TIME) us
  1165. * RX_ACK_TIMEOUT: unit:slot. Used for TX procedure
  1166. * TX_OP_TIMEOUT: TXOP timeout value for TXOP truncation.
  1167. * it is recommended that:
  1168. * (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT)
  1169. */
  1170. #define TX_TIMEOUT_CFG 0x1348
  1171. #define TX_TIMEOUT_CFG_MPDU_LIFETIME FIELD32(0x000000f0)
  1172. #define TX_TIMEOUT_CFG_RX_ACK_TIMEOUT FIELD32(0x0000ff00)
  1173. #define TX_TIMEOUT_CFG_TX_OP_TIMEOUT FIELD32(0x00ff0000)
  1174. /*
  1175. * TX_RTY_CFG:
  1176. * SHORT_RTY_LIMIT: short retry limit
  1177. * LONG_RTY_LIMIT: long retry limit
  1178. * LONG_RTY_THRE: Long retry threshoold
  1179. * NON_AGG_RTY_MODE: Non-Aggregate MPDU retry mode
  1180. * 0:expired by retry limit, 1: expired by mpdu life timer
  1181. * AGG_RTY_MODE: Aggregate MPDU retry mode
  1182. * 0:expired by retry limit, 1: expired by mpdu life timer
  1183. * TX_AUTO_FB_ENABLE: Tx retry PHY rate auto fallback enable
  1184. */
  1185. #define TX_RTY_CFG 0x134c
  1186. #define TX_RTY_CFG_SHORT_RTY_LIMIT FIELD32(0x000000ff)
  1187. #define TX_RTY_CFG_LONG_RTY_LIMIT FIELD32(0x0000ff00)
  1188. #define TX_RTY_CFG_LONG_RTY_THRE FIELD32(0x0fff0000)
  1189. #define TX_RTY_CFG_NON_AGG_RTY_MODE FIELD32(0x10000000)
  1190. #define TX_RTY_CFG_AGG_RTY_MODE FIELD32(0x20000000)
  1191. #define TX_RTY_CFG_TX_AUTO_FB_ENABLE FIELD32(0x40000000)
  1192. /*
  1193. * TX_LINK_CFG:
  1194. * REMOTE_MFB_LIFETIME: remote MFB life time. unit: 32us
  1195. * MFB_ENABLE: TX apply remote MFB 1:enable
  1196. * REMOTE_UMFS_ENABLE: remote unsolicit MFB enable
  1197. * 0: not apply remote remote unsolicit (MFS=7)
  1198. * TX_MRQ_EN: MCS request TX enable
  1199. * TX_RDG_EN: RDG TX enable
  1200. * TX_CF_ACK_EN: Piggyback CF-ACK enable
  1201. * REMOTE_MFB: remote MCS feedback
  1202. * REMOTE_MFS: remote MCS feedback sequence number
  1203. */
  1204. #define TX_LINK_CFG 0x1350
  1205. #define TX_LINK_CFG_REMOTE_MFB_LIFETIME FIELD32(0x000000ff)
  1206. #define TX_LINK_CFG_MFB_ENABLE FIELD32(0x00000100)
  1207. #define TX_LINK_CFG_REMOTE_UMFS_ENABLE FIELD32(0x00000200)
  1208. #define TX_LINK_CFG_TX_MRQ_EN FIELD32(0x00000400)
  1209. #define TX_LINK_CFG_TX_RDG_EN FIELD32(0x00000800)
  1210. #define TX_LINK_CFG_TX_CF_ACK_EN FIELD32(0x00001000)
  1211. #define TX_LINK_CFG_REMOTE_MFB FIELD32(0x00ff0000)
  1212. #define TX_LINK_CFG_REMOTE_MFS FIELD32(0xff000000)
  1213. /*
  1214. * HT_FBK_CFG0:
  1215. */
  1216. #define HT_FBK_CFG0 0x1354
  1217. #define HT_FBK_CFG0_HTMCS0FBK FIELD32(0x0000000f)
  1218. #define HT_FBK_CFG0_HTMCS1FBK FIELD32(0x000000f0)
  1219. #define HT_FBK_CFG0_HTMCS2FBK FIELD32(0x00000f00)
  1220. #define HT_FBK_CFG0_HTMCS3FBK FIELD32(0x0000f000)
  1221. #define HT_FBK_CFG0_HTMCS4FBK FIELD32(0x000f0000)
  1222. #define HT_FBK_CFG0_HTMCS5FBK FIELD32(0x00f00000)
  1223. #define HT_FBK_CFG0_HTMCS6FBK FIELD32(0x0f000000)
  1224. #define HT_FBK_CFG0_HTMCS7FBK FIELD32(0xf0000000)
  1225. /*
  1226. * HT_FBK_CFG1:
  1227. */
  1228. #define HT_FBK_CFG1 0x1358
  1229. #define HT_FBK_CFG1_HTMCS8FBK FIELD32(0x0000000f)
  1230. #define HT_FBK_CFG1_HTMCS9FBK FIELD32(0x000000f0)
  1231. #define HT_FBK_CFG1_HTMCS10FBK FIELD32(0x00000f00)
  1232. #define HT_FBK_CFG1_HTMCS11FBK FIELD32(0x0000f000)
  1233. #define HT_FBK_CFG1_HTMCS12FBK FIELD32(0x000f0000)
  1234. #define HT_FBK_CFG1_HTMCS13FBK FIELD32(0x00f00000)
  1235. #define HT_FBK_CFG1_HTMCS14FBK FIELD32(0x0f000000)
  1236. #define HT_FBK_CFG1_HTMCS15FBK FIELD32(0xf0000000)
  1237. /*
  1238. * LG_FBK_CFG0:
  1239. */
  1240. #define LG_FBK_CFG0 0x135c
  1241. #define LG_FBK_CFG0_OFDMMCS0FBK FIELD32(0x0000000f)
  1242. #define LG_FBK_CFG0_OFDMMCS1FBK FIELD32(0x000000f0)
  1243. #define LG_FBK_CFG0_OFDMMCS2FBK FIELD32(0x00000f00)
  1244. #define LG_FBK_CFG0_OFDMMCS3FBK FIELD32(0x0000f000)
  1245. #define LG_FBK_CFG0_OFDMMCS4FBK FIELD32(0x000f0000)
  1246. #define LG_FBK_CFG0_OFDMMCS5FBK FIELD32(0x00f00000)
  1247. #define LG_FBK_CFG0_OFDMMCS6FBK FIELD32(0x0f000000)
  1248. #define LG_FBK_CFG0_OFDMMCS7FBK FIELD32(0xf0000000)
  1249. /*
  1250. * LG_FBK_CFG1:
  1251. */
  1252. #define LG_FBK_CFG1 0x1360
  1253. #define LG_FBK_CFG0_CCKMCS0FBK FIELD32(0x0000000f)
  1254. #define LG_FBK_CFG0_CCKMCS1FBK FIELD32(0x000000f0)
  1255. #define LG_FBK_CFG0_CCKMCS2FBK FIELD32(0x00000f00)
  1256. #define LG_FBK_CFG0_CCKMCS3FBK FIELD32(0x0000f000)
  1257. /*
  1258. * CCK_PROT_CFG: CCK Protection
  1259. * PROTECT_RATE: Protection control frame rate for CCK TX(RTS/CTS/CFEnd)
  1260. * PROTECT_CTRL: Protection control frame type for CCK TX
  1261. * 0:none, 1:RTS/CTS, 2:CTS-to-self
  1262. * PROTECT_NAV_SHORT: TXOP protection type for CCK TX with short NAV
  1263. * PROTECT_NAV_LONG: TXOP protection type for CCK TX with long NAV
  1264. * TX_OP_ALLOW_CCK: CCK TXOP allowance, 0:disallow
  1265. * TX_OP_ALLOW_OFDM: CCK TXOP allowance, 0:disallow
  1266. * TX_OP_ALLOW_MM20: CCK TXOP allowance, 0:disallow
  1267. * TX_OP_ALLOW_MM40: CCK TXOP allowance, 0:disallow
  1268. * TX_OP_ALLOW_GF20: CCK TXOP allowance, 0:disallow
  1269. * TX_OP_ALLOW_GF40: CCK TXOP allowance, 0:disallow
  1270. * RTS_TH_EN: RTS threshold enable on CCK TX
  1271. */
  1272. #define CCK_PROT_CFG 0x1364
  1273. #define CCK_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
  1274. #define CCK_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
  1275. #define CCK_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
  1276. #define CCK_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
  1277. #define CCK_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
  1278. #define CCK_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
  1279. #define CCK_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
  1280. #define CCK_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
  1281. #define CCK_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
  1282. #define CCK_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
  1283. #define CCK_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
  1284. /*
  1285. * OFDM_PROT_CFG: OFDM Protection
  1286. */
  1287. #define OFDM_PROT_CFG 0x1368
  1288. #define OFDM_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
  1289. #define OFDM_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
  1290. #define OFDM_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
  1291. #define OFDM_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
  1292. #define OFDM_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
  1293. #define OFDM_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
  1294. #define OFDM_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
  1295. #define OFDM_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
  1296. #define OFDM_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
  1297. #define OFDM_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
  1298. #define OFDM_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
  1299. /*
  1300. * MM20_PROT_CFG: MM20 Protection
  1301. */
  1302. #define MM20_PROT_CFG 0x136c
  1303. #define MM20_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
  1304. #define MM20_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
  1305. #define MM20_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
  1306. #define MM20_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
  1307. #define MM20_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
  1308. #define MM20_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
  1309. #define MM20_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
  1310. #define MM20_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
  1311. #define MM20_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
  1312. #define MM20_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
  1313. #define MM20_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
  1314. /*
  1315. * MM40_PROT_CFG: MM40 Protection
  1316. */
  1317. #define MM40_PROT_CFG 0x1370
  1318. #define MM40_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
  1319. #define MM40_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
  1320. #define MM40_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
  1321. #define MM40_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
  1322. #define MM40_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
  1323. #define MM40_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
  1324. #define MM40_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
  1325. #define MM40_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
  1326. #define MM40_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
  1327. #define MM40_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
  1328. #define MM40_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
  1329. /*
  1330. * GF20_PROT_CFG: GF20 Protection
  1331. */
  1332. #define GF20_PROT_CFG 0x1374
  1333. #define GF20_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
  1334. #define GF20_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
  1335. #define GF20_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
  1336. #define GF20_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
  1337. #define GF20_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
  1338. #define GF20_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
  1339. #define GF20_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
  1340. #define GF20_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
  1341. #define GF20_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
  1342. #define GF20_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
  1343. #define GF20_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
  1344. /*
  1345. * GF40_PROT_CFG: GF40 Protection
  1346. */
  1347. #define GF40_PROT_CFG 0x1378
  1348. #define GF40_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
  1349. #define GF40_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
  1350. #define GF40_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
  1351. #define GF40_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
  1352. #define GF40_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
  1353. #define GF40_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
  1354. #define GF40_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
  1355. #define GF40_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
  1356. #define GF40_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
  1357. #define GF40_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
  1358. #define GF40_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
  1359. /*
  1360. * EXP_CTS_TIME:
  1361. */
  1362. #define EXP_CTS_TIME 0x137c
  1363. /*
  1364. * EXP_ACK_TIME:
  1365. */
  1366. #define EXP_ACK_TIME 0x1380
  1367. /* TX_PWR_CFG_5 */
  1368. #define TX_PWR_CFG_5 0x1384
  1369. #define TX_PWR_CFG_5_MCS16_CH0 FIELD32(0x0000000f)
  1370. #define TX_PWR_CFG_5_MCS16_CH1 FIELD32(0x000000f0)
  1371. #define TX_PWR_CFG_5_MCS16_CH2 FIELD32(0x00000f00)
  1372. #define TX_PWR_CFG_5_MCS18_CH0 FIELD32(0x000f0000)
  1373. #define TX_PWR_CFG_5_MCS18_CH1 FIELD32(0x00f00000)
  1374. #define TX_PWR_CFG_5_MCS18_CH2 FIELD32(0x0f000000)
  1375. /* TX_PWR_CFG_6 */
  1376. #define TX_PWR_CFG_6 0x1388
  1377. #define TX_PWR_CFG_6_MCS20_CH0 FIELD32(0x0000000f)
  1378. #define TX_PWR_CFG_6_MCS20_CH1 FIELD32(0x000000f0)
  1379. #define TX_PWR_CFG_6_MCS20_CH2 FIELD32(0x00000f00)
  1380. #define TX_PWR_CFG_6_MCS22_CH0 FIELD32(0x000f0000)
  1381. #define TX_PWR_CFG_6_MCS22_CH1 FIELD32(0x00f00000)
  1382. #define TX_PWR_CFG_6_MCS22_CH2 FIELD32(0x0f000000)
  1383. /* TX_PWR_CFG_0_EXT */
  1384. #define TX_PWR_CFG_0_EXT 0x1390
  1385. #define TX_PWR_CFG_0_EXT_CCK1_CH2 FIELD32(0x0000000f)
  1386. #define TX_PWR_CFG_0_EXT_CCK5_CH2 FIELD32(0x00000f00)
  1387. #define TX_PWR_CFG_0_EXT_OFDM6_CH2 FIELD32(0x000f0000)
  1388. #define TX_PWR_CFG_0_EXT_OFDM12_CH2 FIELD32(0x0f000000)
  1389. /* TX_PWR_CFG_1_EXT */
  1390. #define TX_PWR_CFG_1_EXT 0x1394
  1391. #define TX_PWR_CFG_1_EXT_OFDM24_CH2 FIELD32(0x0000000f)
  1392. #define TX_PWR_CFG_1_EXT_OFDM48_CH2 FIELD32(0x00000f00)
  1393. #define TX_PWR_CFG_1_EXT_MCS0_CH2 FIELD32(0x000f0000)
  1394. #define TX_PWR_CFG_1_EXT_MCS2_CH2 FIELD32(0x0f000000)
  1395. /* TX_PWR_CFG_2_EXT */
  1396. #define TX_PWR_CFG_2_EXT 0x1398
  1397. #define TX_PWR_CFG_2_EXT_MCS4_CH2 FIELD32(0x0000000f)
  1398. #define TX_PWR_CFG_2_EXT_MCS6_CH2 FIELD32(0x00000f00)
  1399. #define TX_PWR_CFG_2_EXT_MCS8_CH2 FIELD32(0x000f0000)
  1400. #define TX_PWR_CFG_2_EXT_MCS10_CH2 FIELD32(0x0f000000)
  1401. /* TX_PWR_CFG_3_EXT */
  1402. #define TX_PWR_CFG_3_EXT 0x139c
  1403. #define TX_PWR_CFG_3_EXT_MCS12_CH2 FIELD32(0x0000000f)
  1404. #define TX_PWR_CFG_3_EXT_MCS14_CH2 FIELD32(0x00000f00)
  1405. #define TX_PWR_CFG_3_EXT_STBC0_CH2 FIELD32(0x000f0000)
  1406. #define TX_PWR_CFG_3_EXT_STBC2_CH2 FIELD32(0x0f000000)
  1407. /* TX_PWR_CFG_4_EXT */
  1408. #define TX_PWR_CFG_4_EXT 0x13a0
  1409. #define TX_PWR_CFG_4_EXT_STBC4_CH2 FIELD32(0x0000000f)
  1410. #define TX_PWR_CFG_4_EXT_STBC6_CH2 FIELD32(0x00000f00)
  1411. /* TX_PWR_CFG_7 */
  1412. #define TX_PWR_CFG_7 0x13d4
  1413. #define TX_PWR_CFG_7_OFDM54_CH0 FIELD32(0x0000000f)
  1414. #define TX_PWR_CFG_7_OFDM54_CH1 FIELD32(0x000000f0)
  1415. #define TX_PWR_CFG_7_OFDM54_CH2 FIELD32(0x00000f00)
  1416. #define TX_PWR_CFG_7_MCS7_CH0 FIELD32(0x000f0000)
  1417. #define TX_PWR_CFG_7_MCS7_CH1 FIELD32(0x00f00000)
  1418. #define TX_PWR_CFG_7_MCS7_CH2 FIELD32(0x0f000000)
  1419. /* TX_PWR_CFG_8 */
  1420. #define TX_PWR_CFG_8 0x13d8
  1421. #define TX_PWR_CFG_8_MCS15_CH0 FIELD32(0x0000000f)
  1422. #define TX_PWR_CFG_8_MCS15_CH1 FIELD32(0x000000f0)
  1423. #define TX_PWR_CFG_8_MCS15_CH2 FIELD32(0x00000f00)
  1424. #define TX_PWR_CFG_8_MCS23_CH0 FIELD32(0x000f0000)
  1425. #define TX_PWR_CFG_8_MCS23_CH1 FIELD32(0x00f00000)
  1426. #define TX_PWR_CFG_8_MCS23_CH2 FIELD32(0x0f000000)
  1427. /* TX_PWR_CFG_9 */
  1428. #define TX_PWR_CFG_9 0x13dc
  1429. #define TX_PWR_CFG_9_STBC7_CH0 FIELD32(0x0000000f)
  1430. #define TX_PWR_CFG_9_STBC7_CH1 FIELD32(0x000000f0)
  1431. #define TX_PWR_CFG_9_STBC7_CH2 FIELD32(0x00000f00)
  1432. /*
  1433. * RX_FILTER_CFG: RX configuration register.
  1434. */
  1435. #define RX_FILTER_CFG 0x1400
  1436. #define RX_FILTER_CFG_DROP_CRC_ERROR FIELD32(0x00000001)
  1437. #define RX_FILTER_CFG_DROP_PHY_ERROR FIELD32(0x00000002)
  1438. #define RX_FILTER_CFG_DROP_NOT_TO_ME FIELD32(0x00000004)
  1439. #define RX_FILTER_CFG_DROP_NOT_MY_BSSD FIELD32(0x00000008)
  1440. #define RX_FILTER_CFG_DROP_VER_ERROR FIELD32(0x00000010)
  1441. #define RX_FILTER_CFG_DROP_MULTICAST FIELD32(0x00000020)
  1442. #define RX_FILTER_CFG_DROP_BROADCAST FIELD32(0x00000040)
  1443. #define RX_FILTER_CFG_DROP_DUPLICATE FIELD32(0x00000080)
  1444. #define RX_FILTER_CFG_DROP_CF_END_ACK FIELD32(0x00000100)
  1445. #define RX_FILTER_CFG_DROP_CF_END FIELD32(0x00000200)
  1446. #define RX_FILTER_CFG_DROP_ACK FIELD32(0x00000400)
  1447. #define RX_FILTER_CFG_DROP_CTS FIELD32(0x00000800)
  1448. #define RX_FILTER_CFG_DROP_RTS FIELD32(0x00001000)
  1449. #define RX_FILTER_CFG_DROP_PSPOLL FIELD32(0x00002000)
  1450. #define RX_FILTER_CFG_DROP_BA FIELD32(0x00004000)
  1451. #define RX_FILTER_CFG_DROP_BAR FIELD32(0x00008000)
  1452. #define RX_FILTER_CFG_DROP_CNTL FIELD32(0x00010000)
  1453. /*
  1454. * AUTO_RSP_CFG:
  1455. * AUTORESPONDER: 0: disable, 1: enable
  1456. * BAC_ACK_POLICY: 0:long, 1:short preamble
  1457. * CTS_40_MMODE: Response CTS 40MHz duplicate mode
  1458. * CTS_40_MREF: Response CTS 40MHz duplicate mode
  1459. * AR_PREAMBLE: Auto responder preamble 0:long, 1:short preamble
  1460. * DUAL_CTS_EN: Power bit value in control frame
  1461. * ACK_CTS_PSM_BIT:Power bit value in control frame
  1462. */
  1463. #define AUTO_RSP_CFG 0x1404
  1464. #define AUTO_RSP_CFG_AUTORESPONDER FIELD32(0x00000001)
  1465. #define AUTO_RSP_CFG_BAC_ACK_POLICY FIELD32(0x00000002)
  1466. #define AUTO_RSP_CFG_CTS_40_MMODE FIELD32(0x00000004)
  1467. #define AUTO_RSP_CFG_CTS_40_MREF FIELD32(0x00000008)
  1468. #define AUTO_RSP_CFG_AR_PREAMBLE FIELD32(0x00000010)
  1469. #define AUTO_RSP_CFG_DUAL_CTS_EN FIELD32(0x00000040)
  1470. #define AUTO_RSP_CFG_ACK_CTS_PSM_BIT FIELD32(0x00000080)
  1471. /*
  1472. * LEGACY_BASIC_RATE:
  1473. */
  1474. #define LEGACY_BASIC_RATE 0x1408
  1475. /*
  1476. * HT_BASIC_RATE:
  1477. */
  1478. #define HT_BASIC_RATE 0x140c
  1479. /*
  1480. * HT_CTRL_CFG:
  1481. */
  1482. #define HT_CTRL_CFG 0x1410
  1483. /*
  1484. * SIFS_COST_CFG:
  1485. */
  1486. #define SIFS_COST_CFG 0x1414
  1487. /*
  1488. * RX_PARSER_CFG:
  1489. * Set NAV for all received frames
  1490. */
  1491. #define RX_PARSER_CFG 0x1418
  1492. /*
  1493. * TX_SEC_CNT0:
  1494. */
  1495. #define TX_SEC_CNT0 0x1500
  1496. /*
  1497. * RX_SEC_CNT0:
  1498. */
  1499. #define RX_SEC_CNT0 0x1504
  1500. /*
  1501. * CCMP_FC_MUTE:
  1502. */
  1503. #define CCMP_FC_MUTE 0x1508
  1504. /*
  1505. * TXOP_HLDR_ADDR0:
  1506. */
  1507. #define TXOP_HLDR_ADDR0 0x1600
  1508. /*
  1509. * TXOP_HLDR_ADDR1:
  1510. */
  1511. #define TXOP_HLDR_ADDR1 0x1604
  1512. /*
  1513. * TXOP_HLDR_ET:
  1514. */
  1515. #define TXOP_HLDR_ET 0x1608
  1516. /*
  1517. * QOS_CFPOLL_RA_DW0:
  1518. */
  1519. #define QOS_CFPOLL_RA_DW0 0x160c
  1520. /*
  1521. * QOS_CFPOLL_RA_DW1:
  1522. */
  1523. #define QOS_CFPOLL_RA_DW1 0x1610
  1524. /*
  1525. * QOS_CFPOLL_QC:
  1526. */
  1527. #define QOS_CFPOLL_QC 0x1614
  1528. /*
  1529. * RX_STA_CNT0: RX PLCP error count & RX CRC error count
  1530. */
  1531. #define RX_STA_CNT0 0x1700
  1532. #define RX_STA_CNT0_CRC_ERR FIELD32(0x0000ffff)
  1533. #define RX_STA_CNT0_PHY_ERR FIELD32(0xffff0000)
  1534. /*
  1535. * RX_STA_CNT1: RX False CCA count & RX LONG frame count
  1536. */
  1537. #define RX_STA_CNT1 0x1704
  1538. #define RX_STA_CNT1_FALSE_CCA FIELD32(0x0000ffff)
  1539. #define RX_STA_CNT1_PLCP_ERR FIELD32(0xffff0000)
  1540. /*
  1541. * RX_STA_CNT2:
  1542. */
  1543. #define RX_STA_CNT2 0x1708
  1544. #define RX_STA_CNT2_RX_DUPLI_COUNT FIELD32(0x0000ffff)
  1545. #define RX_STA_CNT2_RX_FIFO_OVERFLOW FIELD32(0xffff0000)
  1546. /*
  1547. * TX_STA_CNT0: TX Beacon count
  1548. */
  1549. #define TX_STA_CNT0 0x170c
  1550. #define TX_STA_CNT0_TX_FAIL_COUNT FIELD32(0x0000ffff)
  1551. #define TX_STA_CNT0_TX_BEACON_COUNT FIELD32(0xffff0000)
  1552. /*
  1553. * TX_STA_CNT1: TX tx count
  1554. */
  1555. #define TX_STA_CNT1 0x1710
  1556. #define TX_STA_CNT1_TX_SUCCESS FIELD32(0x0000ffff)
  1557. #define TX_STA_CNT1_TX_RETRANSMIT FIELD32(0xffff0000)
  1558. /*
  1559. * TX_STA_CNT2: TX tx count
  1560. */
  1561. #define TX_STA_CNT2 0x1714
  1562. #define TX_STA_CNT2_TX_ZERO_LEN_COUNT FIELD32(0x0000ffff)
  1563. #define TX_STA_CNT2_TX_UNDER_FLOW_COUNT FIELD32(0xffff0000)
  1564. /*
  1565. * TX_STA_FIFO: TX Result for specific PID status fifo register.
  1566. *
  1567. * This register is implemented as FIFO with 16 entries in the HW. Each
  1568. * register read fetches the next tx result. If the FIFO is full because
  1569. * it wasn't read fast enough after the according interrupt (TX_FIFO_STATUS)
  1570. * triggered, the hw seems to simply drop further tx results.
  1571. *
  1572. * VALID: 1: this tx result is valid
  1573. * 0: no valid tx result -> driver should stop reading
  1574. * PID_TYPE: The PID latched from the PID field in the TXWI, can be used
  1575. * to match a frame with its tx result (even though the PID is
  1576. * only 4 bits wide).
  1577. * PID_QUEUE: Part of PID_TYPE, this is the queue index number (0-3)
  1578. * PID_ENTRY: Part of PID_TYPE, this is the queue entry index number (1-3)
  1579. * This identification number is calculated by ((idx % 3) + 1).
  1580. * TX_SUCCESS: Indicates tx success (1) or failure (0)
  1581. * TX_AGGRE: Indicates if the frame was part of an aggregate (1) or not (0)
  1582. * TX_ACK_REQUIRED: Indicates if the frame needed to get ack'ed (1) or not (0)
  1583. * WCID: The wireless client ID.
  1584. * MCS: The tx rate used during the last transmission of this frame, be it
  1585. * successful or not.
  1586. * PHYMODE: The phymode used for the transmission.
  1587. */
  1588. #define TX_STA_FIFO 0x1718
  1589. #define TX_STA_FIFO_VALID FIELD32(0x00000001)
  1590. #define TX_STA_FIFO_PID_TYPE FIELD32(0x0000001e)
  1591. #define TX_STA_FIFO_PID_QUEUE FIELD32(0x00000006)
  1592. #define TX_STA_FIFO_PID_ENTRY FIELD32(0x00000018)
  1593. #define TX_STA_FIFO_TX_SUCCESS FIELD32(0x00000020)
  1594. #define TX_STA_FIFO_TX_AGGRE FIELD32(0x00000040)
  1595. #define TX_STA_FIFO_TX_ACK_REQUIRED FIELD32(0x00000080)
  1596. #define TX_STA_FIFO_WCID FIELD32(0x0000ff00)
  1597. #define TX_STA_FIFO_SUCCESS_RATE FIELD32(0xffff0000)
  1598. #define TX_STA_FIFO_MCS FIELD32(0x007f0000)
  1599. #define TX_STA_FIFO_PHYMODE FIELD32(0xc0000000)
  1600. /*
  1601. * TX_AGG_CNT: Debug counter
  1602. */
  1603. #define TX_AGG_CNT 0x171c
  1604. #define TX_AGG_CNT_NON_AGG_TX_COUNT FIELD32(0x0000ffff)
  1605. #define TX_AGG_CNT_AGG_TX_COUNT FIELD32(0xffff0000)
  1606. /*
  1607. * TX_AGG_CNT0:
  1608. */
  1609. #define TX_AGG_CNT0 0x1720
  1610. #define TX_AGG_CNT0_AGG_SIZE_1_COUNT FIELD32(0x0000ffff)
  1611. #define TX_AGG_CNT0_AGG_SIZE_2_COUNT FIELD32(0xffff0000)
  1612. /*
  1613. * TX_AGG_CNT1:
  1614. */
  1615. #define TX_AGG_CNT1 0x1724
  1616. #define TX_AGG_CNT1_AGG_SIZE_3_COUNT FIELD32(0x0000ffff)
  1617. #define TX_AGG_CNT1_AGG_SIZE_4_COUNT FIELD32(0xffff0000)
  1618. /*
  1619. * TX_AGG_CNT2:
  1620. */
  1621. #define TX_AGG_CNT2 0x1728
  1622. #define TX_AGG_CNT2_AGG_SIZE_5_COUNT FIELD32(0x0000ffff)
  1623. #define TX_AGG_CNT2_AGG_SIZE_6_COUNT FIELD32(0xffff0000)
  1624. /*
  1625. * TX_AGG_CNT3:
  1626. */
  1627. #define TX_AGG_CNT3 0x172c
  1628. #define TX_AGG_CNT3_AGG_SIZE_7_COUNT FIELD32(0x0000ffff)
  1629. #define TX_AGG_CNT3_AGG_SIZE_8_COUNT FIELD32(0xffff0000)
  1630. /*
  1631. * TX_AGG_CNT4:
  1632. */
  1633. #define TX_AGG_CNT4 0x1730
  1634. #define TX_AGG_CNT4_AGG_SIZE_9_COUNT FIELD32(0x0000ffff)
  1635. #define TX_AGG_CNT4_AGG_SIZE_10_COUNT FIELD32(0xffff0000)
  1636. /*
  1637. * TX_AGG_CNT5:
  1638. */
  1639. #define TX_AGG_CNT5 0x1734
  1640. #define TX_AGG_CNT5_AGG_SIZE_11_COUNT FIELD32(0x0000ffff)
  1641. #define TX_AGG_CNT5_AGG_SIZE_12_COUNT FIELD32(0xffff0000)
  1642. /*
  1643. * TX_AGG_CNT6:
  1644. */
  1645. #define TX_AGG_CNT6 0x1738
  1646. #define TX_AGG_CNT6_AGG_SIZE_13_COUNT FIELD32(0x0000ffff)
  1647. #define TX_AGG_CNT6_AGG_SIZE_14_COUNT FIELD32(0xffff0000)
  1648. /*
  1649. * TX_AGG_CNT7:
  1650. */
  1651. #define TX_AGG_CNT7 0x173c
  1652. #define TX_AGG_CNT7_AGG_SIZE_15_COUNT FIELD32(0x0000ffff)
  1653. #define TX_AGG_CNT7_AGG_SIZE_16_COUNT FIELD32(0xffff0000)
  1654. /*
  1655. * MPDU_DENSITY_CNT:
  1656. * TX_ZERO_DEL: TX zero length delimiter count
  1657. * RX_ZERO_DEL: RX zero length delimiter count
  1658. */
  1659. #define MPDU_DENSITY_CNT 0x1740
  1660. #define MPDU_DENSITY_CNT_TX_ZERO_DEL FIELD32(0x0000ffff)
  1661. #define MPDU_DENSITY_CNT_RX_ZERO_DEL FIELD32(0xffff0000)
  1662. /*
  1663. * Security key table memory.
  1664. *
  1665. * The pairwise key table shares some memory with the beacon frame
  1666. * buffers 6 and 7. That basically means that when beacon 6 & 7
  1667. * are used we should only use the reduced pairwise key table which
  1668. * has a maximum of 222 entries.
  1669. *
  1670. * ---------------------------------------------
  1671. * |0x4000 | Pairwise Key | Reduced Pairwise |
  1672. * | | Table | Key Table |
  1673. * | | Size: 256 * 32 | Size: 222 * 32 |
  1674. * |0x5BC0 | |-------------------
  1675. * | | | Beacon 6 |
  1676. * |0x5DC0 | |-------------------
  1677. * | | | Beacon 7 |
  1678. * |0x5FC0 | |-------------------
  1679. * |0x5FFF | |
  1680. * --------------------------
  1681. *
  1682. * MAC_WCID_BASE: 8-bytes (use only 6 bytes) * 256 entry
  1683. * PAIRWISE_KEY_TABLE_BASE: 32-byte * 256 entry
  1684. * MAC_IVEIV_TABLE_BASE: 8-byte * 256-entry
  1685. * MAC_WCID_ATTRIBUTE_BASE: 4-byte * 256-entry
  1686. * SHARED_KEY_TABLE_BASE: 32-byte * 16-entry
  1687. * SHARED_KEY_MODE_BASE: 4-byte * 16-entry
  1688. */
  1689. #define MAC_WCID_BASE 0x1800
  1690. #define PAIRWISE_KEY_TABLE_BASE 0x4000
  1691. #define MAC_IVEIV_TABLE_BASE 0x6000
  1692. #define MAC_WCID_ATTRIBUTE_BASE 0x6800
  1693. #define SHARED_KEY_TABLE_BASE 0x6c00
  1694. #define SHARED_KEY_MODE_BASE 0x7000
  1695. #define MAC_WCID_ENTRY(__idx) \
  1696. (MAC_WCID_BASE + ((__idx) * sizeof(struct mac_wcid_entry)))
  1697. #define PAIRWISE_KEY_ENTRY(__idx) \
  1698. (PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)))
  1699. #define MAC_IVEIV_ENTRY(__idx) \
  1700. (MAC_IVEIV_TABLE_BASE + ((__idx) * sizeof(struct mac_iveiv_entry)))
  1701. #define MAC_WCID_ATTR_ENTRY(__idx) \
  1702. (MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)))
  1703. #define SHARED_KEY_ENTRY(__idx) \
  1704. (SHARED_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)))
  1705. #define SHARED_KEY_MODE_ENTRY(__idx) \
  1706. (SHARED_KEY_MODE_BASE + ((__idx) * sizeof(u32)))
  1707. struct mac_wcid_entry {
  1708. u8 mac[6];
  1709. u8 reserved[2];
  1710. } __packed;
  1711. struct hw_key_entry {
  1712. u8 key[16];
  1713. u8 tx_mic[8];
  1714. u8 rx_mic[8];
  1715. } __packed;
  1716. struct mac_iveiv_entry {
  1717. u8 iv[8];
  1718. } __packed;
  1719. /*
  1720. * MAC_WCID_ATTRIBUTE:
  1721. */
  1722. #define MAC_WCID_ATTRIBUTE_KEYTAB FIELD32(0x00000001)
  1723. #define MAC_WCID_ATTRIBUTE_CIPHER FIELD32(0x0000000e)
  1724. #define MAC_WCID_ATTRIBUTE_BSS_IDX FIELD32(0x00000070)
  1725. #define MAC_WCID_ATTRIBUTE_RX_WIUDF FIELD32(0x00000380)
  1726. #define MAC_WCID_ATTRIBUTE_CIPHER_EXT FIELD32(0x00000400)
  1727. #define MAC_WCID_ATTRIBUTE_BSS_IDX_EXT FIELD32(0x00000800)
  1728. #define MAC_WCID_ATTRIBUTE_WAPI_MCBC FIELD32(0x00008000)
  1729. #define MAC_WCID_ATTRIBUTE_WAPI_KEY_IDX FIELD32(0xff000000)
  1730. /*
  1731. * SHARED_KEY_MODE:
  1732. */
  1733. #define SHARED_KEY_MODE_BSS0_KEY0 FIELD32(0x00000007)
  1734. #define SHARED_KEY_MODE_BSS0_KEY1 FIELD32(0x00000070)
  1735. #define SHARED_KEY_MODE_BSS0_KEY2 FIELD32(0x00000700)
  1736. #define SHARED_KEY_MODE_BSS0_KEY3 FIELD32(0x00007000)
  1737. #define SHARED_KEY_MODE_BSS1_KEY0 FIELD32(0x00070000)
  1738. #define SHARED_KEY_MODE_BSS1_KEY1 FIELD32(0x00700000)
  1739. #define SHARED_KEY_MODE_BSS1_KEY2 FIELD32(0x07000000)
  1740. #define SHARED_KEY_MODE_BSS1_KEY3 FIELD32(0x70000000)
  1741. /*
  1742. * HOST-MCU communication
  1743. */
  1744. /*
  1745. * H2M_MAILBOX_CSR: Host-to-MCU Mailbox.
  1746. * CMD_TOKEN: Command id, 0xff disable status reporting.
  1747. */
  1748. #define H2M_MAILBOX_CSR 0x7010
  1749. #define H2M_MAILBOX_CSR_ARG0 FIELD32(0x000000ff)
  1750. #define H2M_MAILBOX_CSR_ARG1 FIELD32(0x0000ff00)
  1751. #define H2M_MAILBOX_CSR_CMD_TOKEN FIELD32(0x00ff0000)
  1752. #define H2M_MAILBOX_CSR_OWNER FIELD32(0xff000000)
  1753. /*
  1754. * H2M_MAILBOX_CID:
  1755. * Free slots contain 0xff. MCU will store command's token to lowest free slot.
  1756. * If all slots are occupied status will be dropped.
  1757. */
  1758. #define H2M_MAILBOX_CID 0x7014
  1759. #define H2M_MAILBOX_CID_CMD0 FIELD32(0x000000ff)
  1760. #define H2M_MAILBOX_CID_CMD1 FIELD32(0x0000ff00)
  1761. #define H2M_MAILBOX_CID_CMD2 FIELD32(0x00ff0000)
  1762. #define H2M_MAILBOX_CID_CMD3 FIELD32(0xff000000)
  1763. /*
  1764. * H2M_MAILBOX_STATUS:
  1765. * Command status will be saved to same slot as command id.
  1766. */
  1767. #define H2M_MAILBOX_STATUS 0x701c
  1768. /*
  1769. * H2M_INT_SRC:
  1770. */
  1771. #define H2M_INT_SRC 0x7024
  1772. /*
  1773. * H2M_BBP_AGENT:
  1774. */
  1775. #define H2M_BBP_AGENT 0x7028
  1776. /*
  1777. * MCU_LEDCS: LED control for MCU Mailbox.
  1778. */
  1779. #define MCU_LEDCS_LED_MODE FIELD8(0x1f)
  1780. #define MCU_LEDCS_POLARITY FIELD8(0x01)
  1781. /*
  1782. * HW_CS_CTS_BASE:
  1783. * Carrier-sense CTS frame base address.
  1784. * It's where mac stores carrier-sense frame for carrier-sense function.
  1785. */
  1786. #define HW_CS_CTS_BASE 0x7700
  1787. /*
  1788. * HW_DFS_CTS_BASE:
  1789. * DFS CTS frame base address. It's where mac stores CTS frame for DFS.
  1790. */
  1791. #define HW_DFS_CTS_BASE 0x7780
  1792. /*
  1793. * TXRX control registers - base address 0x3000
  1794. */
  1795. /*
  1796. * TXRX_CSR1:
  1797. * rt2860b UNKNOWN reg use R/O Reg Addr 0x77d0 first..
  1798. */
  1799. #define TXRX_CSR1 0x77d0
  1800. /*
  1801. * HW_DEBUG_SETTING_BASE:
  1802. * since NULL frame won't be that long (256 byte)
  1803. * We steal 16 tail bytes to save debugging settings
  1804. */
  1805. #define HW_DEBUG_SETTING_BASE 0x77f0
  1806. #define HW_DEBUG_SETTING_BASE2 0x7770
  1807. /*
  1808. * HW_BEACON_BASE
  1809. * In order to support maximum 8 MBSS and its maximum length
  1810. * is 512 bytes for each beacon
  1811. * Three section discontinue memory segments will be used.
  1812. * 1. The original region for BCN 0~3
  1813. * 2. Extract memory from FCE table for BCN 4~5
  1814. * 3. Extract memory from Pair-wise key table for BCN 6~7
  1815. * It occupied those memory of wcid 238~253 for BCN 6
  1816. * and wcid 222~237 for BCN 7 (see Security key table memory
  1817. * for more info).
  1818. *
  1819. * IMPORTANT NOTE: Not sure why legacy driver does this,
  1820. * but HW_BEACON_BASE7 is 0x0200 bytes below HW_BEACON_BASE6.
  1821. */
  1822. #define HW_BEACON_BASE0 0x7800
  1823. #define HW_BEACON_BASE1 0x7a00
  1824. #define HW_BEACON_BASE2 0x7c00
  1825. #define HW_BEACON_BASE3 0x7e00
  1826. #define HW_BEACON_BASE4 0x7200
  1827. #define HW_BEACON_BASE5 0x7400
  1828. #define HW_BEACON_BASE6 0x5dc0
  1829. #define HW_BEACON_BASE7 0x5bc0
  1830. #define HW_BEACON_BASE(__index) \
  1831. (((__index) < 4) ? (HW_BEACON_BASE0 + (__index * 0x0200)) : \
  1832. (((__index) < 6) ? (HW_BEACON_BASE4 + ((__index - 4) * 0x0200)) : \
  1833. (HW_BEACON_BASE6 - ((__index - 6) * 0x0200))))
  1834. #define BEACON_BASE_TO_OFFSET(_base) (((_base) - 0x4000) / 64)
  1835. /*
  1836. * BBP registers.
  1837. * The wordsize of the BBP is 8 bits.
  1838. */
  1839. /*
  1840. * BBP 1: TX Antenna & Power Control
  1841. * POWER_CTRL:
  1842. * 0 - normal,
  1843. * 1 - drop tx power by 6dBm,
  1844. * 2 - drop tx power by 12dBm,
  1845. * 3 - increase tx power by 6dBm
  1846. */
  1847. #define BBP1_TX_POWER_CTRL FIELD8(0x03)
  1848. #define BBP1_TX_ANTENNA FIELD8(0x18)
  1849. /*
  1850. * BBP 3: RX Antenna
  1851. */
  1852. #define BBP3_RX_ADC FIELD8(0x03)
  1853. #define BBP3_RX_ANTENNA FIELD8(0x18)
  1854. #define BBP3_HT40_MINUS FIELD8(0x20)
  1855. #define BBP3_ADC_MODE_SWITCH FIELD8(0x40)
  1856. #define BBP3_ADC_INIT_MODE FIELD8(0x80)
  1857. /*
  1858. * BBP 4: Bandwidth
  1859. */
  1860. #define BBP4_TX_BF FIELD8(0x01)
  1861. #define BBP4_BANDWIDTH FIELD8(0x18)
  1862. #define BBP4_MAC_IF_CTRL FIELD8(0x40)
  1863. /* BBP27 */
  1864. #define BBP27_RX_CHAIN_SEL FIELD8(0x60)
  1865. /*
  1866. * BBP 47: Bandwidth
  1867. */
  1868. #define BBP47_TSSI_REPORT_SEL FIELD8(0x03)
  1869. #define BBP47_TSSI_UPDATE_REQ FIELD8(0x04)
  1870. #define BBP47_TSSI_TSSI_MODE FIELD8(0x18)
  1871. #define BBP47_TSSI_ADC6 FIELD8(0x80)
  1872. /*
  1873. * BBP 49
  1874. */
  1875. #define BBP49_UPDATE_FLAG FIELD8(0x01)
  1876. /*
  1877. * BBP 105:
  1878. * - bit0: detect SIG on primary channel only (on 40MHz bandwidth)
  1879. * - bit1: FEQ (Feed Forward Compensation) for independend streams
  1880. * - bit2: MLD (Maximum Likehood Detection) for 2 streams (reserved on single
  1881. * stream)
  1882. * - bit4: channel estimation updates based on remodulation of
  1883. * L-SIG and HT-SIG symbols
  1884. */
  1885. #define BBP105_DETECT_SIG_ON_PRIMARY FIELD8(0x01)
  1886. #define BBP105_FEQ FIELD8(0x02)
  1887. #define BBP105_MLD FIELD8(0x04)
  1888. #define BBP105_SIG_REMODULATION FIELD8(0x08)
  1889. /*
  1890. * BBP 109
  1891. */
  1892. #define BBP109_TX0_POWER FIELD8(0x0f)
  1893. #define BBP109_TX1_POWER FIELD8(0xf0)
  1894. /* BBP 110 */
  1895. #define BBP110_TX2_POWER FIELD8(0x0f)
  1896. /*
  1897. * BBP 138: Unknown
  1898. */
  1899. #define BBP138_RX_ADC1 FIELD8(0x02)
  1900. #define BBP138_RX_ADC2 FIELD8(0x04)
  1901. #define BBP138_TX_DAC1 FIELD8(0x20)
  1902. #define BBP138_TX_DAC2 FIELD8(0x40)
  1903. /*
  1904. * BBP 152: Rx Ant
  1905. */
  1906. #define BBP152_RX_DEFAULT_ANT FIELD8(0x80)
  1907. /*
  1908. * BBP 254: unknown
  1909. */
  1910. #define BBP254_BIT7 FIELD8(0x80)
  1911. /*
  1912. * RFCSR registers
  1913. * The wordsize of the RFCSR is 8 bits.
  1914. */
  1915. /*
  1916. * RFCSR 1:
  1917. */
  1918. #define RFCSR1_RF_BLOCK_EN FIELD8(0x01)
  1919. #define RFCSR1_PLL_PD FIELD8(0x02)
  1920. #define RFCSR1_RX0_PD FIELD8(0x04)
  1921. #define RFCSR1_TX0_PD FIELD8(0x08)
  1922. #define RFCSR1_RX1_PD FIELD8(0x10)
  1923. #define RFCSR1_TX1_PD FIELD8(0x20)
  1924. #define RFCSR1_RX2_PD FIELD8(0x40)
  1925. #define RFCSR1_TX2_PD FIELD8(0x80)
  1926. /*
  1927. * RFCSR 2:
  1928. */
  1929. #define RFCSR2_RESCAL_EN FIELD8(0x80)
  1930. /*
  1931. * RFCSR 3:
  1932. */
  1933. #define RFCSR3_K FIELD8(0x0f)
  1934. /* Bits [7-4] for RF3320 (RT3370/RT3390), on other chipsets reserved */
  1935. #define RFCSR3_PA1_BIAS_CCK FIELD8(0x70)
  1936. #define RFCSR3_PA2_CASCODE_BIAS_CCKK FIELD8(0x80)
  1937. /* Bits for RF3290/RF5360/RF5362/RF5370/RF5372/RF5390/RF5392 */
  1938. #define RFCSR3_VCOCAL_EN FIELD8(0x80)
  1939. /* Bits for RF3050 */
  1940. #define RFCSR3_BIT1 FIELD8(0x02)
  1941. #define RFCSR3_BIT2 FIELD8(0x04)
  1942. #define RFCSR3_BIT3 FIELD8(0x08)
  1943. #define RFCSR3_BIT4 FIELD8(0x10)
  1944. #define RFCSR3_BIT5 FIELD8(0x20)
  1945. /*
  1946. * FRCSR 5:
  1947. */
  1948. #define RFCSR5_R1 FIELD8(0x0c)
  1949. /*
  1950. * RFCSR 6:
  1951. */
  1952. #define RFCSR6_R1 FIELD8(0x03)
  1953. #define RFCSR6_R2 FIELD8(0x40)
  1954. #define RFCSR6_TXDIV FIELD8(0x0c)
  1955. /* bits for RF3053 */
  1956. #define RFCSR6_VCO_IC FIELD8(0xc0)
  1957. /*
  1958. * RFCSR 7:
  1959. */
  1960. #define RFCSR7_RF_TUNING FIELD8(0x01)
  1961. #define RFCSR7_BIT1 FIELD8(0x02)
  1962. #define RFCSR7_BIT2 FIELD8(0x04)
  1963. #define RFCSR7_BIT3 FIELD8(0x08)
  1964. #define RFCSR7_BIT4 FIELD8(0x10)
  1965. #define RFCSR7_BIT5 FIELD8(0x20)
  1966. #define RFCSR7_BITS67 FIELD8(0xc0)
  1967. /*
  1968. * RFCSR 9:
  1969. */
  1970. #define RFCSR9_K FIELD8(0x0f)
  1971. #define RFCSR9_N FIELD8(0x10)
  1972. #define RFCSR9_UNKNOWN FIELD8(0x60)
  1973. #define RFCSR9_MOD FIELD8(0x80)
  1974. /*
  1975. * RFCSR 11:
  1976. */
  1977. #define RFCSR11_R FIELD8(0x03)
  1978. #define RFCSR11_PLL_MOD FIELD8(0x0c)
  1979. #define RFCSR11_MOD FIELD8(0xc0)
  1980. /* bits for RF3053 */
  1981. /* TODO: verify RFCSR11_MOD usage on other chips */
  1982. #define RFCSR11_PLL_IDOH FIELD8(0x40)
  1983. /*
  1984. * RFCSR 12:
  1985. */
  1986. #define RFCSR12_TX_POWER FIELD8(0x1f)
  1987. #define RFCSR12_DR0 FIELD8(0xe0)
  1988. /*
  1989. * RFCSR 13:
  1990. */
  1991. #define RFCSR13_TX_POWER FIELD8(0x1f)
  1992. #define RFCSR13_DR0 FIELD8(0xe0)
  1993. /*
  1994. * RFCSR 15:
  1995. */
  1996. #define RFCSR15_TX_LO2_EN FIELD8(0x08)
  1997. /*
  1998. * RFCSR 16:
  1999. */
  2000. #define RFCSR16_TXMIXER_GAIN FIELD8(0x07)
  2001. /*
  2002. * RFCSR 17:
  2003. */
  2004. #define RFCSR17_TXMIXER_GAIN FIELD8(0x07)
  2005. #define RFCSR17_TX_LO1_EN FIELD8(0x08)
  2006. #define RFCSR17_R FIELD8(0x20)
  2007. #define RFCSR17_CODE FIELD8(0x7f)
  2008. /* RFCSR 18 */
  2009. #define RFCSR18_XO_TUNE_BYPASS FIELD8(0x40)
  2010. /*
  2011. * RFCSR 20:
  2012. */
  2013. #define RFCSR20_RX_LO1_EN FIELD8(0x08)
  2014. /*
  2015. * RFCSR 21:
  2016. */
  2017. #define RFCSR21_RX_LO2_EN FIELD8(0x08)
  2018. /*
  2019. * RFCSR 22:
  2020. */
  2021. #define RFCSR22_BASEBAND_LOOPBACK FIELD8(0x01)
  2022. /*
  2023. * RFCSR 23:
  2024. */
  2025. #define RFCSR23_FREQ_OFFSET FIELD8(0x7f)
  2026. /*
  2027. * RFCSR 24:
  2028. */
  2029. #define RFCSR24_TX_AGC_FC FIELD8(0x1f)
  2030. #define RFCSR24_TX_H20M FIELD8(0x20)
  2031. #define RFCSR24_TX_CALIB FIELD8(0x7f)
  2032. /*
  2033. * RFCSR 27:
  2034. */
  2035. #define RFCSR27_R1 FIELD8(0x03)
  2036. #define RFCSR27_R2 FIELD8(0x04)
  2037. #define RFCSR27_R3 FIELD8(0x30)
  2038. #define RFCSR27_R4 FIELD8(0x40)
  2039. /*
  2040. * RFCSR 29:
  2041. */
  2042. #define RFCSR29_ADC6_TEST FIELD8(0x01)
  2043. #define RFCSR29_ADC6_INT_TEST FIELD8(0x02)
  2044. #define RFCSR29_RSSI_RESET FIELD8(0x04)
  2045. #define RFCSR29_RSSI_ON FIELD8(0x08)
  2046. #define RFCSR29_RSSI_RIP_CTRL FIELD8(0x30)
  2047. #define RFCSR29_RSSI_GAIN FIELD8(0xc0)
  2048. /*
  2049. * RFCSR 30:
  2050. */
  2051. #define RFCSR30_TX_H20M FIELD8(0x02)
  2052. #define RFCSR30_RX_H20M FIELD8(0x04)
  2053. #define RFCSR30_RX_VCM FIELD8(0x18)
  2054. #define RFCSR30_RF_CALIBRATION FIELD8(0x80)
  2055. /*
  2056. * RFCSR 31:
  2057. */
  2058. #define RFCSR31_RX_AGC_FC FIELD8(0x1f)
  2059. #define RFCSR31_RX_H20M FIELD8(0x20)
  2060. #define RFCSR31_RX_CALIB FIELD8(0x7f)
  2061. /* RFCSR 32 bits for RF3053 */
  2062. #define RFCSR32_TX_AGC_FC FIELD8(0xf8)
  2063. /* RFCSR 36 bits for RF3053 */
  2064. #define RFCSR36_RF_BS FIELD8(0x80)
  2065. /*
  2066. * RFCSR 38:
  2067. */
  2068. #define RFCSR38_RX_LO1_EN FIELD8(0x20)
  2069. /*
  2070. * RFCSR 39:
  2071. */
  2072. #define RFCSR39_RX_DIV FIELD8(0x40)
  2073. #define RFCSR39_RX_LO2_EN FIELD8(0x80)
  2074. /*
  2075. * RFCSR 49:
  2076. */
  2077. #define RFCSR49_TX FIELD8(0x3f)
  2078. #define RFCSR49_EP FIELD8(0xc0)
  2079. /* bits for RT3593 */
  2080. #define RFCSR49_TX_LO1_IC FIELD8(0x1c)
  2081. #define RFCSR49_TX_DIV FIELD8(0x20)
  2082. /*
  2083. * RFCSR 50:
  2084. */
  2085. #define RFCSR50_TX FIELD8(0x3f)
  2086. #define RFCSR50_EP FIELD8(0xc0)
  2087. /* bits for RT3593 */
  2088. #define RFCSR50_TX_LO1_EN FIELD8(0x20)
  2089. #define RFCSR50_TX_LO2_EN FIELD8(0x10)
  2090. /* RFCSR 51 */
  2091. /* bits for RT3593 */
  2092. #define RFCSR51_BITS01 FIELD8(0x03)
  2093. #define RFCSR51_BITS24 FIELD8(0x1c)
  2094. #define RFCSR51_BITS57 FIELD8(0xe0)
  2095. #define RFCSR53_TX_POWER FIELD8(0x3f)
  2096. #define RFCSR53_UNKNOWN FIELD8(0xc0)
  2097. #define RFCSR54_TX_POWER FIELD8(0x3f)
  2098. #define RFCSR54_UNKNOWN FIELD8(0xc0)
  2099. #define RFCSR55_TX_POWER FIELD8(0x3f)
  2100. #define RFCSR55_UNKNOWN FIELD8(0xc0)
  2101. #define RFCSR57_DRV_CC FIELD8(0xfc)
  2102. /*
  2103. * RF registers
  2104. */
  2105. /*
  2106. * RF 2
  2107. */
  2108. #define RF2_ANTENNA_RX2 FIELD32(0x00000040)
  2109. #define RF2_ANTENNA_TX1 FIELD32(0x00004000)
  2110. #define RF2_ANTENNA_RX1 FIELD32(0x00020000)
  2111. /*
  2112. * RF 3
  2113. */
  2114. #define RF3_TXPOWER_G FIELD32(0x00003e00)
  2115. #define RF3_TXPOWER_A_7DBM_BOOST FIELD32(0x00000200)
  2116. #define RF3_TXPOWER_A FIELD32(0x00003c00)
  2117. /*
  2118. * RF 4
  2119. */
  2120. #define RF4_TXPOWER_G FIELD32(0x000007c0)
  2121. #define RF4_TXPOWER_A_7DBM_BOOST FIELD32(0x00000040)
  2122. #define RF4_TXPOWER_A FIELD32(0x00000780)
  2123. #define RF4_FREQ_OFFSET FIELD32(0x001f8000)
  2124. #define RF4_HT40 FIELD32(0x00200000)
  2125. /*
  2126. * EEPROM content.
  2127. * The wordsize of the EEPROM is 16 bits.
  2128. */
  2129. enum rt2800_eeprom_word {
  2130. EEPROM_CHIP_ID = 0,
  2131. EEPROM_VERSION,
  2132. EEPROM_MAC_ADDR_0,
  2133. EEPROM_MAC_ADDR_1,
  2134. EEPROM_MAC_ADDR_2,
  2135. EEPROM_NIC_CONF0,
  2136. EEPROM_NIC_CONF1,
  2137. EEPROM_FREQ,
  2138. EEPROM_LED_AG_CONF,
  2139. EEPROM_LED_ACT_CONF,
  2140. EEPROM_LED_POLARITY,
  2141. EEPROM_NIC_CONF2,
  2142. EEPROM_LNA,
  2143. EEPROM_RSSI_BG,
  2144. EEPROM_RSSI_BG2,
  2145. EEPROM_TXMIXER_GAIN_BG,
  2146. EEPROM_RSSI_A,
  2147. EEPROM_RSSI_A2,
  2148. EEPROM_TXMIXER_GAIN_A,
  2149. EEPROM_EIRP_MAX_TX_POWER,
  2150. EEPROM_TXPOWER_DELTA,
  2151. EEPROM_TXPOWER_BG1,
  2152. EEPROM_TXPOWER_BG2,
  2153. EEPROM_TSSI_BOUND_BG1,
  2154. EEPROM_TSSI_BOUND_BG2,
  2155. EEPROM_TSSI_BOUND_BG3,
  2156. EEPROM_TSSI_BOUND_BG4,
  2157. EEPROM_TSSI_BOUND_BG5,
  2158. EEPROM_TXPOWER_A1,
  2159. EEPROM_TXPOWER_A2,
  2160. EEPROM_TSSI_BOUND_A1,
  2161. EEPROM_TSSI_BOUND_A2,
  2162. EEPROM_TSSI_BOUND_A3,
  2163. EEPROM_TSSI_BOUND_A4,
  2164. EEPROM_TSSI_BOUND_A5,
  2165. EEPROM_TXPOWER_BYRATE,
  2166. EEPROM_BBP_START,
  2167. /* IDs for extended EEPROM format used by three-chain devices */
  2168. EEPROM_EXT_LNA2,
  2169. EEPROM_EXT_TXPOWER_BG3,
  2170. EEPROM_EXT_TXPOWER_A3,
  2171. /* New values must be added before this */
  2172. EEPROM_WORD_COUNT
  2173. };
  2174. /*
  2175. * EEPROM Version
  2176. */
  2177. #define EEPROM_VERSION_FAE FIELD16(0x00ff)
  2178. #define EEPROM_VERSION_VERSION FIELD16(0xff00)
  2179. /*
  2180. * HW MAC address.
  2181. */
  2182. #define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff)
  2183. #define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00)
  2184. #define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff)
  2185. #define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00)
  2186. #define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff)
  2187. #define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00)
  2188. /*
  2189. * EEPROM NIC Configuration 0
  2190. * RXPATH: 1: 1R, 2: 2R, 3: 3R
  2191. * TXPATH: 1: 1T, 2: 2T, 3: 3T
  2192. * RF_TYPE: RFIC type
  2193. */
  2194. #define EEPROM_NIC_CONF0_RXPATH FIELD16(0x000f)
  2195. #define EEPROM_NIC_CONF0_TXPATH FIELD16(0x00f0)
  2196. #define EEPROM_NIC_CONF0_RF_TYPE FIELD16(0x0f00)
  2197. /*
  2198. * EEPROM NIC Configuration 1
  2199. * HW_RADIO: 0: disable, 1: enable
  2200. * EXTERNAL_TX_ALC: 0: disable, 1: enable
  2201. * EXTERNAL_LNA_2G: 0: disable, 1: enable
  2202. * EXTERNAL_LNA_5G: 0: disable, 1: enable
  2203. * CARDBUS_ACCEL: 0: enable, 1: disable
  2204. * BW40M_SB_2G: 0: disable, 1: enable
  2205. * BW40M_SB_5G: 0: disable, 1: enable
  2206. * WPS_PBC: 0: disable, 1: enable
  2207. * BW40M_2G: 0: enable, 1: disable
  2208. * BW40M_5G: 0: enable, 1: disable
  2209. * BROADBAND_EXT_LNA: 0: disable, 1: enable
  2210. * ANT_DIVERSITY: 00: Disable, 01: Diversity,
  2211. * 10: Main antenna, 11: Aux antenna
  2212. * INTERNAL_TX_ALC: 0: disable, 1: enable
  2213. * BT_COEXIST: 0: disable, 1: enable
  2214. * DAC_TEST: 0: disable, 1: enable
  2215. */
  2216. #define EEPROM_NIC_CONF1_HW_RADIO FIELD16(0x0001)
  2217. #define EEPROM_NIC_CONF1_EXTERNAL_TX_ALC FIELD16(0x0002)
  2218. #define EEPROM_NIC_CONF1_EXTERNAL_LNA_2G FIELD16(0x0004)
  2219. #define EEPROM_NIC_CONF1_EXTERNAL_LNA_5G FIELD16(0x0008)
  2220. #define EEPROM_NIC_CONF1_CARDBUS_ACCEL FIELD16(0x0010)
  2221. #define EEPROM_NIC_CONF1_BW40M_SB_2G FIELD16(0x0020)
  2222. #define EEPROM_NIC_CONF1_BW40M_SB_5G FIELD16(0x0040)
  2223. #define EEPROM_NIC_CONF1_WPS_PBC FIELD16(0x0080)
  2224. #define EEPROM_NIC_CONF1_BW40M_2G FIELD16(0x0100)
  2225. #define EEPROM_NIC_CONF1_BW40M_5G FIELD16(0x0200)
  2226. #define EEPROM_NIC_CONF1_BROADBAND_EXT_LNA FIELD16(0x400)
  2227. #define EEPROM_NIC_CONF1_ANT_DIVERSITY FIELD16(0x1800)
  2228. #define EEPROM_NIC_CONF1_INTERNAL_TX_ALC FIELD16(0x2000)
  2229. #define EEPROM_NIC_CONF1_BT_COEXIST FIELD16(0x4000)
  2230. #define EEPROM_NIC_CONF1_DAC_TEST FIELD16(0x8000)
  2231. /*
  2232. * EEPROM frequency
  2233. */
  2234. #define EEPROM_FREQ_OFFSET FIELD16(0x00ff)
  2235. #define EEPROM_FREQ_LED_MODE FIELD16(0x7f00)
  2236. #define EEPROM_FREQ_LED_POLARITY FIELD16(0x1000)
  2237. /*
  2238. * EEPROM LED
  2239. * POLARITY_RDY_G: Polarity RDY_G setting.
  2240. * POLARITY_RDY_A: Polarity RDY_A setting.
  2241. * POLARITY_ACT: Polarity ACT setting.
  2242. * POLARITY_GPIO_0: Polarity GPIO0 setting.
  2243. * POLARITY_GPIO_1: Polarity GPIO1 setting.
  2244. * POLARITY_GPIO_2: Polarity GPIO2 setting.
  2245. * POLARITY_GPIO_3: Polarity GPIO3 setting.
  2246. * POLARITY_GPIO_4: Polarity GPIO4 setting.
  2247. * LED_MODE: Led mode.
  2248. */
  2249. #define EEPROM_LED_POLARITY_RDY_BG FIELD16(0x0001)
  2250. #define EEPROM_LED_POLARITY_RDY_A FIELD16(0x0002)
  2251. #define EEPROM_LED_POLARITY_ACT FIELD16(0x0004)
  2252. #define EEPROM_LED_POLARITY_GPIO_0 FIELD16(0x0008)
  2253. #define EEPROM_LED_POLARITY_GPIO_1 FIELD16(0x0010)
  2254. #define EEPROM_LED_POLARITY_GPIO_2 FIELD16(0x0020)
  2255. #define EEPROM_LED_POLARITY_GPIO_3 FIELD16(0x0040)
  2256. #define EEPROM_LED_POLARITY_GPIO_4 FIELD16(0x0080)
  2257. #define EEPROM_LED_LED_MODE FIELD16(0x1f00)
  2258. /*
  2259. * EEPROM NIC Configuration 2
  2260. * RX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream
  2261. * TX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream
  2262. * CRYSTAL: 00: Reserved, 01: One crystal, 10: Two crystal, 11: Reserved
  2263. */
  2264. #define EEPROM_NIC_CONF2_RX_STREAM FIELD16(0x000f)
  2265. #define EEPROM_NIC_CONF2_TX_STREAM FIELD16(0x00f0)
  2266. #define EEPROM_NIC_CONF2_CRYSTAL FIELD16(0x0600)
  2267. /*
  2268. * EEPROM LNA
  2269. */
  2270. #define EEPROM_LNA_BG FIELD16(0x00ff)
  2271. #define EEPROM_LNA_A0 FIELD16(0xff00)
  2272. /*
  2273. * EEPROM RSSI BG offset
  2274. */
  2275. #define EEPROM_RSSI_BG_OFFSET0 FIELD16(0x00ff)
  2276. #define EEPROM_RSSI_BG_OFFSET1 FIELD16(0xff00)
  2277. /*
  2278. * EEPROM RSSI BG2 offset
  2279. */
  2280. #define EEPROM_RSSI_BG2_OFFSET2 FIELD16(0x00ff)
  2281. #define EEPROM_RSSI_BG2_LNA_A1 FIELD16(0xff00)
  2282. /*
  2283. * EEPROM TXMIXER GAIN BG offset (note overlaps with EEPROM RSSI BG2).
  2284. */
  2285. #define EEPROM_TXMIXER_GAIN_BG_VAL FIELD16(0x0007)
  2286. /*
  2287. * EEPROM RSSI A offset
  2288. */
  2289. #define EEPROM_RSSI_A_OFFSET0 FIELD16(0x00ff)
  2290. #define EEPROM_RSSI_A_OFFSET1 FIELD16(0xff00)
  2291. /*
  2292. * EEPROM RSSI A2 offset
  2293. */
  2294. #define EEPROM_RSSI_A2_OFFSET2 FIELD16(0x00ff)
  2295. #define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00)
  2296. /*
  2297. * EEPROM TXMIXER GAIN A offset (note overlaps with EEPROM RSSI A2).
  2298. */
  2299. #define EEPROM_TXMIXER_GAIN_A_VAL FIELD16(0x0007)
  2300. /*
  2301. * EEPROM EIRP Maximum TX power values(unit: dbm)
  2302. */
  2303. #define EEPROM_EIRP_MAX_TX_POWER_2GHZ FIELD16(0x00ff)
  2304. #define EEPROM_EIRP_MAX_TX_POWER_5GHZ FIELD16(0xff00)
  2305. /*
  2306. * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power.
  2307. * This is delta in 40MHZ.
  2308. * VALUE: Tx Power dalta value, MAX=4(unit: dbm)
  2309. * TYPE: 1: Plus the delta value, 0: minus the delta value
  2310. * ENABLE: enable tx power compensation for 40BW
  2311. */
  2312. #define EEPROM_TXPOWER_DELTA_VALUE_2G FIELD16(0x003f)
  2313. #define EEPROM_TXPOWER_DELTA_TYPE_2G FIELD16(0x0040)
  2314. #define EEPROM_TXPOWER_DELTA_ENABLE_2G FIELD16(0x0080)
  2315. #define EEPROM_TXPOWER_DELTA_VALUE_5G FIELD16(0x3f00)
  2316. #define EEPROM_TXPOWER_DELTA_TYPE_5G FIELD16(0x4000)
  2317. #define EEPROM_TXPOWER_DELTA_ENABLE_5G FIELD16(0x8000)
  2318. /*
  2319. * EEPROM TXPOWER 802.11BG
  2320. */
  2321. #define EEPROM_TXPOWER_BG_SIZE 7
  2322. #define EEPROM_TXPOWER_BG_1 FIELD16(0x00ff)
  2323. #define EEPROM_TXPOWER_BG_2 FIELD16(0xff00)
  2324. /*
  2325. * EEPROM temperature compensation boundaries 802.11BG
  2326. * MINUS4: If the actual TSSI is below this boundary, tx power needs to be
  2327. * reduced by (agc_step * -4)
  2328. * MINUS3: If the actual TSSI is below this boundary, tx power needs to be
  2329. * reduced by (agc_step * -3)
  2330. */
  2331. #define EEPROM_TSSI_BOUND_BG1_MINUS4 FIELD16(0x00ff)
  2332. #define EEPROM_TSSI_BOUND_BG1_MINUS3 FIELD16(0xff00)
  2333. /*
  2334. * EEPROM temperature compensation boundaries 802.11BG
  2335. * MINUS2: If the actual TSSI is below this boundary, tx power needs to be
  2336. * reduced by (agc_step * -2)
  2337. * MINUS1: If the actual TSSI is below this boundary, tx power needs to be
  2338. * reduced by (agc_step * -1)
  2339. */
  2340. #define EEPROM_TSSI_BOUND_BG2_MINUS2 FIELD16(0x00ff)
  2341. #define EEPROM_TSSI_BOUND_BG2_MINUS1 FIELD16(0xff00)
  2342. /*
  2343. * EEPROM temperature compensation boundaries 802.11BG
  2344. * REF: Reference TSSI value, no tx power changes needed
  2345. * PLUS1: If the actual TSSI is above this boundary, tx power needs to be
  2346. * increased by (agc_step * 1)
  2347. */
  2348. #define EEPROM_TSSI_BOUND_BG3_REF FIELD16(0x00ff)
  2349. #define EEPROM_TSSI_BOUND_BG3_PLUS1 FIELD16(0xff00)
  2350. /*
  2351. * EEPROM temperature compensation boundaries 802.11BG
  2352. * PLUS2: If the actual TSSI is above this boundary, tx power needs to be
  2353. * increased by (agc_step * 2)
  2354. * PLUS3: If the actual TSSI is above this boundary, tx power needs to be
  2355. * increased by (agc_step * 3)
  2356. */
  2357. #define EEPROM_TSSI_BOUND_BG4_PLUS2 FIELD16(0x00ff)
  2358. #define EEPROM_TSSI_BOUND_BG4_PLUS3 FIELD16(0xff00)
  2359. /*
  2360. * EEPROM temperature compensation boundaries 802.11BG
  2361. * PLUS4: If the actual TSSI is above this boundary, tx power needs to be
  2362. * increased by (agc_step * 4)
  2363. * AGC_STEP: Temperature compensation step.
  2364. */
  2365. #define EEPROM_TSSI_BOUND_BG5_PLUS4 FIELD16(0x00ff)
  2366. #define EEPROM_TSSI_BOUND_BG5_AGC_STEP FIELD16(0xff00)
  2367. /*
  2368. * EEPROM TXPOWER 802.11A
  2369. */
  2370. #define EEPROM_TXPOWER_A_SIZE 6
  2371. #define EEPROM_TXPOWER_A_1 FIELD16(0x00ff)
  2372. #define EEPROM_TXPOWER_A_2 FIELD16(0xff00)
  2373. /* EEPROM_TXPOWER_{A,G} fields for RT3593 */
  2374. #define EEPROM_TXPOWER_ALC FIELD8(0x1f)
  2375. #define EEPROM_TXPOWER_FINE_CTRL FIELD8(0xe0)
  2376. /*
  2377. * EEPROM temperature compensation boundaries 802.11A
  2378. * MINUS4: If the actual TSSI is below this boundary, tx power needs to be
  2379. * reduced by (agc_step * -4)
  2380. * MINUS3: If the actual TSSI is below this boundary, tx power needs to be
  2381. * reduced by (agc_step * -3)
  2382. */
  2383. #define EEPROM_TSSI_BOUND_A1_MINUS4 FIELD16(0x00ff)
  2384. #define EEPROM_TSSI_BOUND_A1_MINUS3 FIELD16(0xff00)
  2385. /*
  2386. * EEPROM temperature compensation boundaries 802.11A
  2387. * MINUS2: If the actual TSSI is below this boundary, tx power needs to be
  2388. * reduced by (agc_step * -2)
  2389. * MINUS1: If the actual TSSI is below this boundary, tx power needs to be
  2390. * reduced by (agc_step * -1)
  2391. */
  2392. #define EEPROM_TSSI_BOUND_A2_MINUS2 FIELD16(0x00ff)
  2393. #define EEPROM_TSSI_BOUND_A2_MINUS1 FIELD16(0xff00)
  2394. /*
  2395. * EEPROM temperature compensation boundaries 802.11A
  2396. * REF: Reference TSSI value, no tx power changes needed
  2397. * PLUS1: If the actual TSSI is above this boundary, tx power needs to be
  2398. * increased by (agc_step * 1)
  2399. */
  2400. #define EEPROM_TSSI_BOUND_A3_REF FIELD16(0x00ff)
  2401. #define EEPROM_TSSI_BOUND_A3_PLUS1 FIELD16(0xff00)
  2402. /*
  2403. * EEPROM temperature compensation boundaries 802.11A
  2404. * PLUS2: If the actual TSSI is above this boundary, tx power needs to be
  2405. * increased by (agc_step * 2)
  2406. * PLUS3: If the actual TSSI is above this boundary, tx power needs to be
  2407. * increased by (agc_step * 3)
  2408. */
  2409. #define EEPROM_TSSI_BOUND_A4_PLUS2 FIELD16(0x00ff)
  2410. #define EEPROM_TSSI_BOUND_A4_PLUS3 FIELD16(0xff00)
  2411. /*
  2412. * EEPROM temperature compensation boundaries 802.11A
  2413. * PLUS4: If the actual TSSI is above this boundary, tx power needs to be
  2414. * increased by (agc_step * 4)
  2415. * AGC_STEP: Temperature compensation step.
  2416. */
  2417. #define EEPROM_TSSI_BOUND_A5_PLUS4 FIELD16(0x00ff)
  2418. #define EEPROM_TSSI_BOUND_A5_AGC_STEP FIELD16(0xff00)
  2419. /*
  2420. * EEPROM TXPOWER by rate: tx power per tx rate for HT20 mode
  2421. */
  2422. #define EEPROM_TXPOWER_BYRATE_SIZE 9
  2423. #define EEPROM_TXPOWER_BYRATE_RATE0 FIELD16(0x000f)
  2424. #define EEPROM_TXPOWER_BYRATE_RATE1 FIELD16(0x00f0)
  2425. #define EEPROM_TXPOWER_BYRATE_RATE2 FIELD16(0x0f00)
  2426. #define EEPROM_TXPOWER_BYRATE_RATE3 FIELD16(0xf000)
  2427. /*
  2428. * EEPROM BBP.
  2429. */
  2430. #define EEPROM_BBP_SIZE 16
  2431. #define EEPROM_BBP_VALUE FIELD16(0x00ff)
  2432. #define EEPROM_BBP_REG_ID FIELD16(0xff00)
  2433. /* EEPROM_EXT_LNA2 */
  2434. #define EEPROM_EXT_LNA2_A1 FIELD16(0x00ff)
  2435. #define EEPROM_EXT_LNA2_A2 FIELD16(0xff00)
  2436. /*
  2437. * EEPROM IQ Calibration, unlike other entries those are byte addresses.
  2438. */
  2439. #define EEPROM_IQ_GAIN_CAL_TX0_2G 0x130
  2440. #define EEPROM_IQ_PHASE_CAL_TX0_2G 0x131
  2441. #define EEPROM_IQ_GROUPDELAY_CAL_TX0_2G 0x132
  2442. #define EEPROM_IQ_GAIN_CAL_TX1_2G 0x133
  2443. #define EEPROM_IQ_PHASE_CAL_TX1_2G 0x134
  2444. #define EEPROM_IQ_GROUPDELAY_CAL_TX1_2G 0x135
  2445. #define EEPROM_IQ_GAIN_CAL_RX0_2G 0x136
  2446. #define EEPROM_IQ_PHASE_CAL_RX0_2G 0x137
  2447. #define EEPROM_IQ_GROUPDELAY_CAL_RX0_2G 0x138
  2448. #define EEPROM_IQ_GAIN_CAL_RX1_2G 0x139
  2449. #define EEPROM_IQ_PHASE_CAL_RX1_2G 0x13A
  2450. #define EEPROM_IQ_GROUPDELAY_CAL_RX1_2G 0x13B
  2451. #define EEPROM_RF_IQ_COMPENSATION_CONTROL 0x13C
  2452. #define EEPROM_RF_IQ_IMBALANCE_COMPENSATION_CONTROL 0x13D
  2453. #define EEPROM_IQ_GAIN_CAL_TX0_CH36_TO_CH64_5G 0x144
  2454. #define EEPROM_IQ_PHASE_CAL_TX0_CH36_TO_CH64_5G 0x145
  2455. #define EEPROM_IQ_GAIN_CAL_TX0_CH100_TO_CH138_5G 0X146
  2456. #define EEPROM_IQ_PHASE_CAL_TX0_CH100_TO_CH138_5G 0x147
  2457. #define EEPROM_IQ_GAIN_CAL_TX0_CH140_TO_CH165_5G 0x148
  2458. #define EEPROM_IQ_PHASE_CAL_TX0_CH140_TO_CH165_5G 0x149
  2459. #define EEPROM_IQ_GAIN_CAL_TX1_CH36_TO_CH64_5G 0x14A
  2460. #define EEPROM_IQ_PHASE_CAL_TX1_CH36_TO_CH64_5G 0x14B
  2461. #define EEPROM_IQ_GAIN_CAL_TX1_CH100_TO_CH138_5G 0X14C
  2462. #define EEPROM_IQ_PHASE_CAL_TX1_CH100_TO_CH138_5G 0x14D
  2463. #define EEPROM_IQ_GAIN_CAL_TX1_CH140_TO_CH165_5G 0x14E
  2464. #define EEPROM_IQ_PHASE_CAL_TX1_CH140_TO_CH165_5G 0x14F
  2465. #define EEPROM_IQ_GROUPDELAY_CAL_TX0_CH36_TO_CH64_5G 0x150
  2466. #define EEPROM_IQ_GROUPDELAY_CAL_TX1_CH36_TO_CH64_5G 0x151
  2467. #define EEPROM_IQ_GROUPDELAY_CAL_TX0_CH100_TO_CH138_5G 0x152
  2468. #define EEPROM_IQ_GROUPDELAY_CAL_TX1_CH100_TO_CH138_5G 0x153
  2469. #define EEPROM_IQ_GROUPDELAY_CAL_TX0_CH140_TO_CH165_5G 0x154
  2470. #define EEPROM_IQ_GROUPDELAY_CAL_TX1_CH140_TO_CH165_5G 0x155
  2471. #define EEPROM_IQ_GAIN_CAL_RX0_CH36_TO_CH64_5G 0x156
  2472. #define EEPROM_IQ_PHASE_CAL_RX0_CH36_TO_CH64_5G 0x157
  2473. #define EEPROM_IQ_GAIN_CAL_RX0_CH100_TO_CH138_5G 0X158
  2474. #define EEPROM_IQ_PHASE_CAL_RX0_CH100_TO_CH138_5G 0x159
  2475. #define EEPROM_IQ_GAIN_CAL_RX0_CH140_TO_CH165_5G 0x15A
  2476. #define EEPROM_IQ_PHASE_CAL_RX0_CH140_TO_CH165_5G 0x15B
  2477. #define EEPROM_IQ_GAIN_CAL_RX1_CH36_TO_CH64_5G 0x15C
  2478. #define EEPROM_IQ_PHASE_CAL_RX1_CH36_TO_CH64_5G 0x15D
  2479. #define EEPROM_IQ_GAIN_CAL_RX1_CH100_TO_CH138_5G 0X15E
  2480. #define EEPROM_IQ_PHASE_CAL_RX1_CH100_TO_CH138_5G 0x15F
  2481. #define EEPROM_IQ_GAIN_CAL_RX1_CH140_TO_CH165_5G 0x160
  2482. #define EEPROM_IQ_PHASE_CAL_RX1_CH140_TO_CH165_5G 0x161
  2483. #define EEPROM_IQ_GROUPDELAY_CAL_RX0_CH36_TO_CH64_5G 0x162
  2484. #define EEPROM_IQ_GROUPDELAY_CAL_RX1_CH36_TO_CH64_5G 0x163
  2485. #define EEPROM_IQ_GROUPDELAY_CAL_RX0_CH100_TO_CH138_5G 0x164
  2486. #define EEPROM_IQ_GROUPDELAY_CAL_RX1_CH100_TO_CH138_5G 0x165
  2487. #define EEPROM_IQ_GROUPDELAY_CAL_RX0_CH140_TO_CH165_5G 0x166
  2488. #define EEPROM_IQ_GROUPDELAY_CAL_RX1_CH140_TO_CH165_5G 0x167
  2489. /*
  2490. * MCU mailbox commands.
  2491. * MCU_SLEEP - go to power-save mode.
  2492. * arg1: 1: save as much power as possible, 0: save less power.
  2493. * status: 1: success, 2: already asleep,
  2494. * 3: maybe MAC is busy so can't finish this task.
  2495. * MCU_RADIO_OFF
  2496. * arg0: 0: do power-saving, NOT turn off radio.
  2497. */
  2498. #define MCU_SLEEP 0x30
  2499. #define MCU_WAKEUP 0x31
  2500. #define MCU_RADIO_OFF 0x35
  2501. #define MCU_CURRENT 0x36
  2502. #define MCU_LED 0x50
  2503. #define MCU_LED_STRENGTH 0x51
  2504. #define MCU_LED_AG_CONF 0x52
  2505. #define MCU_LED_ACT_CONF 0x53
  2506. #define MCU_LED_LED_POLARITY 0x54
  2507. #define MCU_RADAR 0x60
  2508. #define MCU_BOOT_SIGNAL 0x72
  2509. #define MCU_ANT_SELECT 0X73
  2510. #define MCU_FREQ_OFFSET 0x74
  2511. #define MCU_BBP_SIGNAL 0x80
  2512. #define MCU_POWER_SAVE 0x83
  2513. #define MCU_BAND_SELECT 0x91
  2514. /*
  2515. * MCU mailbox tokens
  2516. */
  2517. #define TOKEN_SLEEP 1
  2518. #define TOKEN_RADIO_OFF 2
  2519. #define TOKEN_WAKEUP 3
  2520. /*
  2521. * DMA descriptor defines.
  2522. */
  2523. #define TXWI_DESC_SIZE_4WORDS (4 * sizeof(__le32))
  2524. #define TXWI_DESC_SIZE_5WORDS (5 * sizeof(__le32))
  2525. #define RXWI_DESC_SIZE_4WORDS (4 * sizeof(__le32))
  2526. #define RXWI_DESC_SIZE_5WORDS (5 * sizeof(__le32))
  2527. #define RXWI_DESC_SIZE_6WORDS (6 * sizeof(__le32))
  2528. /*
  2529. * TX WI structure
  2530. */
  2531. /*
  2532. * Word0
  2533. * FRAG: 1 To inform TKIP engine this is a fragment.
  2534. * MIMO_PS: The remote peer is in dynamic MIMO-PS mode
  2535. * TX_OP: 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs
  2536. * BW: Channel bandwidth 0:20MHz, 1:40 MHz (for legacy rates this will
  2537. * duplicate the frame to both channels).
  2538. * STBC: 1: STBC support MCS =0-7, 2,3 : RESERVED
  2539. * AMPDU: 1: this frame is eligible for AMPDU aggregation, the hw will
  2540. * aggregate consecutive frames with the same RA and QoS TID. If
  2541. * a frame A with the same RA and QoS TID but AMPDU=0 is queued
  2542. * directly after a frame B with AMPDU=1, frame A might still
  2543. * get aggregated into the AMPDU started by frame B. So, setting
  2544. * AMPDU to 0 does _not_ necessarily mean the frame is sent as
  2545. * MPDU, it can still end up in an AMPDU if the previous frame
  2546. * was tagged as AMPDU.
  2547. */
  2548. #define TXWI_W0_FRAG FIELD32(0x00000001)
  2549. #define TXWI_W0_MIMO_PS FIELD32(0x00000002)
  2550. #define TXWI_W0_CF_ACK FIELD32(0x00000004)
  2551. #define TXWI_W0_TS FIELD32(0x00000008)
  2552. #define TXWI_W0_AMPDU FIELD32(0x00000010)
  2553. #define TXWI_W0_MPDU_DENSITY FIELD32(0x000000e0)
  2554. #define TXWI_W0_TX_OP FIELD32(0x00000300)
  2555. #define TXWI_W0_MCS FIELD32(0x007f0000)
  2556. #define TXWI_W0_BW FIELD32(0x00800000)
  2557. #define TXWI_W0_SHORT_GI FIELD32(0x01000000)
  2558. #define TXWI_W0_STBC FIELD32(0x06000000)
  2559. #define TXWI_W0_IFS FIELD32(0x08000000)
  2560. #define TXWI_W0_PHYMODE FIELD32(0xc0000000)
  2561. /*
  2562. * Word1
  2563. * ACK: 0: No Ack needed, 1: Ack needed
  2564. * NSEQ: 0: Don't assign hw sequence number, 1: Assign hw sequence number
  2565. * BW_WIN_SIZE: BA windows size of the recipient
  2566. * WIRELESS_CLI_ID: Client ID for WCID table access
  2567. * MPDU_TOTAL_BYTE_COUNT: Length of 802.11 frame
  2568. * PACKETID: Will be latched into the TX_STA_FIFO register once the according
  2569. * frame was processed. If multiple frames are aggregated together
  2570. * (AMPDU==1) the reported tx status will always contain the packet
  2571. * id of the first frame. 0: Don't report tx status for this frame.
  2572. * PACKETID_QUEUE: Part of PACKETID, This is the queue index (0-3)
  2573. * PACKETID_ENTRY: Part of PACKETID, THis is the queue entry index (1-3)
  2574. * This identification number is calculated by ((idx % 3) + 1).
  2575. * The (+1) is required to prevent PACKETID to become 0.
  2576. */
  2577. #define TXWI_W1_ACK FIELD32(0x00000001)
  2578. #define TXWI_W1_NSEQ FIELD32(0x00000002)
  2579. #define TXWI_W1_BW_WIN_SIZE FIELD32(0x000000fc)
  2580. #define TXWI_W1_WIRELESS_CLI_ID FIELD32(0x0000ff00)
  2581. #define TXWI_W1_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000)
  2582. #define TXWI_W1_PACKETID FIELD32(0xf0000000)
  2583. #define TXWI_W1_PACKETID_QUEUE FIELD32(0x30000000)
  2584. #define TXWI_W1_PACKETID_ENTRY FIELD32(0xc0000000)
  2585. /*
  2586. * Word2
  2587. */
  2588. #define TXWI_W2_IV FIELD32(0xffffffff)
  2589. /*
  2590. * Word3
  2591. */
  2592. #define TXWI_W3_EIV FIELD32(0xffffffff)
  2593. /*
  2594. * RX WI structure
  2595. */
  2596. /*
  2597. * Word0
  2598. */
  2599. #define RXWI_W0_WIRELESS_CLI_ID FIELD32(0x000000ff)
  2600. #define RXWI_W0_KEY_INDEX FIELD32(0x00000300)
  2601. #define RXWI_W0_BSSID FIELD32(0x00001c00)
  2602. #define RXWI_W0_UDF FIELD32(0x0000e000)
  2603. #define RXWI_W0_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000)
  2604. #define RXWI_W0_TID FIELD32(0xf0000000)
  2605. /*
  2606. * Word1
  2607. */
  2608. #define RXWI_W1_FRAG FIELD32(0x0000000f)
  2609. #define RXWI_W1_SEQUENCE FIELD32(0x0000fff0)
  2610. #define RXWI_W1_MCS FIELD32(0x007f0000)
  2611. #define RXWI_W1_BW FIELD32(0x00800000)
  2612. #define RXWI_W1_SHORT_GI FIELD32(0x01000000)
  2613. #define RXWI_W1_STBC FIELD32(0x06000000)
  2614. #define RXWI_W1_PHYMODE FIELD32(0xc0000000)
  2615. /*
  2616. * Word2
  2617. */
  2618. #define RXWI_W2_RSSI0 FIELD32(0x000000ff)
  2619. #define RXWI_W2_RSSI1 FIELD32(0x0000ff00)
  2620. #define RXWI_W2_RSSI2 FIELD32(0x00ff0000)
  2621. /*
  2622. * Word3
  2623. */
  2624. #define RXWI_W3_SNR0 FIELD32(0x000000ff)
  2625. #define RXWI_W3_SNR1 FIELD32(0x0000ff00)
  2626. /*
  2627. * Macros for converting txpower from EEPROM to mac80211 value
  2628. * and from mac80211 value to register value.
  2629. */
  2630. #define MIN_G_TXPOWER 0
  2631. #define MIN_A_TXPOWER -7
  2632. #define MAX_G_TXPOWER 31
  2633. #define MAX_A_TXPOWER 15
  2634. #define DEFAULT_TXPOWER 5
  2635. #define MIN_A_TXPOWER_3593 0
  2636. #define MAX_A_TXPOWER_3593 31
  2637. #define TXPOWER_G_FROM_DEV(__txpower) \
  2638. ((__txpower) > MAX_G_TXPOWER) ? DEFAULT_TXPOWER : (__txpower)
  2639. #define TXPOWER_A_FROM_DEV(__txpower) \
  2640. ((__txpower) > MAX_A_TXPOWER) ? DEFAULT_TXPOWER : (__txpower)
  2641. /*
  2642. * Board's maximun TX power limitation
  2643. */
  2644. #define EIRP_MAX_TX_POWER_LIMIT 0x50
  2645. /*
  2646. * Number of TBTT intervals after which we have to adjust
  2647. * the hw beacon timer.
  2648. */
  2649. #define BCN_TBTT_OFFSET 64
  2650. /*
  2651. * Hardware has 255 WCID table entries. First 32 entries are reserved for
  2652. * shared keys. Since parts of the pairwise key table might be shared with
  2653. * the beacon frame buffers 6 & 7 we could only use the first 222 entries.
  2654. */
  2655. #define WCID_START 33
  2656. #define WCID_END 222
  2657. #define STA_IDS_SIZE (WCID_END - WCID_START + 2)
  2658. /*
  2659. * RT2800 driver data structure
  2660. */
  2661. struct rt2800_drv_data {
  2662. u8 calibration_bw20;
  2663. u8 calibration_bw40;
  2664. u8 bbp25;
  2665. u8 bbp26;
  2666. u8 txmixer_gain_24g;
  2667. u8 txmixer_gain_5g;
  2668. unsigned int tbtt_tick;
  2669. DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  2670. };
  2671. #endif /* RT2800_H */