d11.h 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898
  1. /*
  2. * Copyright (c) 2010 Broadcom Corporation
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _BRCM_D11_H_
  17. #define _BRCM_D11_H_
  18. #include <linux/ieee80211.h>
  19. #include <defs.h>
  20. #include "pub.h"
  21. #include "dma.h"
  22. /* RX FIFO numbers */
  23. #define RX_FIFO 0 /* data and ctl frames */
  24. #define RX_TXSTATUS_FIFO 3 /* RX fifo for tx status packages */
  25. /* TX FIFO numbers using WME Access Category */
  26. #define TX_AC_BK_FIFO 0 /* Background TX FIFO */
  27. #define TX_AC_BE_FIFO 1 /* Best-Effort TX FIFO */
  28. #define TX_AC_VI_FIFO 2 /* Video TX FIFO */
  29. #define TX_AC_VO_FIFO 3 /* Voice TX FIFO */
  30. #define TX_BCMC_FIFO 4 /* Broadcast/Multicast TX FIFO */
  31. #define TX_ATIM_FIFO 5 /* TX fifo for ATIM window info */
  32. /* Addr is byte address used by SW; offset is word offset used by uCode */
  33. /* Per AC TX limit settings */
  34. #define M_AC_TXLMT_BASE_ADDR (0x180 * 2)
  35. #define M_AC_TXLMT_ADDR(_ac) (M_AC_TXLMT_BASE_ADDR + (2 * (_ac)))
  36. /* Legacy TX FIFO numbers */
  37. #define TX_DATA_FIFO TX_AC_BE_FIFO
  38. #define TX_CTL_FIFO TX_AC_VO_FIFO
  39. #define WL_RSSI_ANT_MAX 4 /* max possible rx antennas */
  40. struct intctrlregs {
  41. u32 intstatus;
  42. u32 intmask;
  43. };
  44. /* PIO structure,
  45. * support two PIO format: 2 bytes access and 4 bytes access
  46. * basic FIFO register set is per channel(transmit or receive)
  47. * a pair of channels is defined for convenience
  48. */
  49. /* 2byte-wide pio register set per channel(xmt or rcv) */
  50. struct pio2regs {
  51. u16 fifocontrol;
  52. u16 fifodata;
  53. u16 fifofree; /* only valid in xmt channel, not in rcv channel */
  54. u16 PAD;
  55. };
  56. /* a pair of pio channels(tx and rx) */
  57. struct pio2regp {
  58. struct pio2regs tx;
  59. struct pio2regs rx;
  60. };
  61. /* 4byte-wide pio register set per channel(xmt or rcv) */
  62. struct pio4regs {
  63. u32 fifocontrol;
  64. u32 fifodata;
  65. };
  66. /* a pair of pio channels(tx and rx) */
  67. struct pio4regp {
  68. struct pio4regs tx;
  69. struct pio4regs rx;
  70. };
  71. /* read: 32-bit register that can be read as 32-bit or as 2 16-bit
  72. * write: only low 16b-it half can be written
  73. */
  74. union pmqreg {
  75. u32 pmqhostdata; /* read only! */
  76. struct {
  77. u16 pmqctrlstatus; /* read/write */
  78. u16 PAD;
  79. } w;
  80. };
  81. struct fifo64 {
  82. struct dma64regs dmaxmt; /* dma tx */
  83. struct pio4regs piotx; /* pio tx */
  84. struct dma64regs dmarcv; /* dma rx */
  85. struct pio4regs piorx; /* pio rx */
  86. };
  87. /*
  88. * Host Interface Registers
  89. */
  90. struct d11regs {
  91. /* Device Control ("semi-standard host registers") */
  92. u32 PAD[3]; /* 0x0 - 0x8 */
  93. u32 biststatus; /* 0xC */
  94. u32 biststatus2; /* 0x10 */
  95. u32 PAD; /* 0x14 */
  96. u32 gptimer; /* 0x18 */
  97. u32 usectimer; /* 0x1c *//* for corerev >= 26 */
  98. /* Interrupt Control *//* 0x20 */
  99. struct intctrlregs intctrlregs[8];
  100. u32 PAD[40]; /* 0x60 - 0xFC */
  101. u32 intrcvlazy[4]; /* 0x100 - 0x10C */
  102. u32 PAD[4]; /* 0x110 - 0x11c */
  103. u32 maccontrol; /* 0x120 */
  104. u32 maccommand; /* 0x124 */
  105. u32 macintstatus; /* 0x128 */
  106. u32 macintmask; /* 0x12C */
  107. /* Transmit Template Access */
  108. u32 tplatewrptr; /* 0x130 */
  109. u32 tplatewrdata; /* 0x134 */
  110. u32 PAD[2]; /* 0x138 - 0x13C */
  111. /* PMQ registers */
  112. union pmqreg pmqreg; /* 0x140 */
  113. u32 pmqpatl; /* 0x144 */
  114. u32 pmqpath; /* 0x148 */
  115. u32 PAD; /* 0x14C */
  116. u32 chnstatus; /* 0x150 */
  117. u32 psmdebug; /* 0x154 */
  118. u32 phydebug; /* 0x158 */
  119. u32 machwcap; /* 0x15C */
  120. /* Extended Internal Objects */
  121. u32 objaddr; /* 0x160 */
  122. u32 objdata; /* 0x164 */
  123. u32 PAD[2]; /* 0x168 - 0x16c */
  124. u32 frmtxstatus; /* 0x170 */
  125. u32 frmtxstatus2; /* 0x174 */
  126. u32 PAD[2]; /* 0x178 - 0x17c */
  127. /* TSF host access */
  128. u32 tsf_timerlow; /* 0x180 */
  129. u32 tsf_timerhigh; /* 0x184 */
  130. u32 tsf_cfprep; /* 0x188 */
  131. u32 tsf_cfpstart; /* 0x18c */
  132. u32 tsf_cfpmaxdur32; /* 0x190 */
  133. u32 PAD[3]; /* 0x194 - 0x19c */
  134. u32 maccontrol1; /* 0x1a0 */
  135. u32 machwcap1; /* 0x1a4 */
  136. u32 PAD[14]; /* 0x1a8 - 0x1dc */
  137. /* Clock control and hardware workarounds*/
  138. u32 clk_ctl_st; /* 0x1e0 */
  139. u32 hw_war;
  140. u32 d11_phypllctl; /* the phypll request/avail bits are
  141. * moved to clk_ctl_st
  142. */
  143. u32 PAD[5]; /* 0x1ec - 0x1fc */
  144. /* 0x200-0x37F dma/pio registers */
  145. struct fifo64 fifo64regs[6];
  146. /* FIFO diagnostic port access */
  147. struct dma32diag dmafifo; /* 0x380 - 0x38C */
  148. u32 aggfifocnt; /* 0x390 */
  149. u32 aggfifodata; /* 0x394 */
  150. u32 PAD[16]; /* 0x398 - 0x3d4 */
  151. u16 radioregaddr; /* 0x3d8 */
  152. u16 radioregdata; /* 0x3da */
  153. /*
  154. * time delay between the change on rf disable input and
  155. * radio shutdown
  156. */
  157. u32 rfdisabledly; /* 0x3DC */
  158. /* PHY register access */
  159. u16 phyversion; /* 0x3e0 - 0x0 */
  160. u16 phybbconfig; /* 0x3e2 - 0x1 */
  161. u16 phyadcbias; /* 0x3e4 - 0x2 Bphy only */
  162. u16 phyanacore; /* 0x3e6 - 0x3 pwwrdwn on aphy */
  163. u16 phyrxstatus0; /* 0x3e8 - 0x4 */
  164. u16 phyrxstatus1; /* 0x3ea - 0x5 */
  165. u16 phycrsth; /* 0x3ec - 0x6 */
  166. u16 phytxerror; /* 0x3ee - 0x7 */
  167. u16 phychannel; /* 0x3f0 - 0x8 */
  168. u16 PAD[1]; /* 0x3f2 - 0x9 */
  169. u16 phytest; /* 0x3f4 - 0xa */
  170. u16 phy4waddr; /* 0x3f6 - 0xb */
  171. u16 phy4wdatahi; /* 0x3f8 - 0xc */
  172. u16 phy4wdatalo; /* 0x3fa - 0xd */
  173. u16 phyregaddr; /* 0x3fc - 0xe */
  174. u16 phyregdata; /* 0x3fe - 0xf */
  175. /* IHR *//* 0x400 - 0x7FE */
  176. /* RXE Block */
  177. u16 PAD[3]; /* 0x400 - 0x406 */
  178. u16 rcv_fifo_ctl; /* 0x406 */
  179. u16 PAD; /* 0x408 - 0x40a */
  180. u16 rcv_frm_cnt; /* 0x40a */
  181. u16 PAD[4]; /* 0x40a - 0x414 */
  182. u16 rssi; /* 0x414 */
  183. u16 PAD[5]; /* 0x414 - 0x420 */
  184. u16 rcm_ctl; /* 0x420 */
  185. u16 rcm_mat_data; /* 0x422 */
  186. u16 rcm_mat_mask; /* 0x424 */
  187. u16 rcm_mat_dly; /* 0x426 */
  188. u16 rcm_cond_mask_l; /* 0x428 */
  189. u16 rcm_cond_mask_h; /* 0x42A */
  190. u16 rcm_cond_dly; /* 0x42C */
  191. u16 PAD[1]; /* 0x42E */
  192. u16 ext_ihr_addr; /* 0x430 */
  193. u16 ext_ihr_data; /* 0x432 */
  194. u16 rxe_phyrs_2; /* 0x434 */
  195. u16 rxe_phyrs_3; /* 0x436 */
  196. u16 phy_mode; /* 0x438 */
  197. u16 rcmta_ctl; /* 0x43a */
  198. u16 rcmta_size; /* 0x43c */
  199. u16 rcmta_addr0; /* 0x43e */
  200. u16 rcmta_addr1; /* 0x440 */
  201. u16 rcmta_addr2; /* 0x442 */
  202. u16 PAD[30]; /* 0x444 - 0x480 */
  203. /* PSM Block *//* 0x480 - 0x500 */
  204. u16 PAD; /* 0x480 */
  205. u16 psm_maccontrol_h; /* 0x482 */
  206. u16 psm_macintstatus_l; /* 0x484 */
  207. u16 psm_macintstatus_h; /* 0x486 */
  208. u16 psm_macintmask_l; /* 0x488 */
  209. u16 psm_macintmask_h; /* 0x48A */
  210. u16 PAD; /* 0x48C */
  211. u16 psm_maccommand; /* 0x48E */
  212. u16 psm_brc; /* 0x490 */
  213. u16 psm_phy_hdr_param; /* 0x492 */
  214. u16 psm_postcard; /* 0x494 */
  215. u16 psm_pcard_loc_l; /* 0x496 */
  216. u16 psm_pcard_loc_h; /* 0x498 */
  217. u16 psm_gpio_in; /* 0x49A */
  218. u16 psm_gpio_out; /* 0x49C */
  219. u16 psm_gpio_oe; /* 0x49E */
  220. u16 psm_bred_0; /* 0x4A0 */
  221. u16 psm_bred_1; /* 0x4A2 */
  222. u16 psm_bred_2; /* 0x4A4 */
  223. u16 psm_bred_3; /* 0x4A6 */
  224. u16 psm_brcl_0; /* 0x4A8 */
  225. u16 psm_brcl_1; /* 0x4AA */
  226. u16 psm_brcl_2; /* 0x4AC */
  227. u16 psm_brcl_3; /* 0x4AE */
  228. u16 psm_brpo_0; /* 0x4B0 */
  229. u16 psm_brpo_1; /* 0x4B2 */
  230. u16 psm_brpo_2; /* 0x4B4 */
  231. u16 psm_brpo_3; /* 0x4B6 */
  232. u16 psm_brwk_0; /* 0x4B8 */
  233. u16 psm_brwk_1; /* 0x4BA */
  234. u16 psm_brwk_2; /* 0x4BC */
  235. u16 psm_brwk_3; /* 0x4BE */
  236. u16 psm_base_0; /* 0x4C0 */
  237. u16 psm_base_1; /* 0x4C2 */
  238. u16 psm_base_2; /* 0x4C4 */
  239. u16 psm_base_3; /* 0x4C6 */
  240. u16 psm_base_4; /* 0x4C8 */
  241. u16 psm_base_5; /* 0x4CA */
  242. u16 psm_base_6; /* 0x4CC */
  243. u16 psm_pc_reg_0; /* 0x4CE */
  244. u16 psm_pc_reg_1; /* 0x4D0 */
  245. u16 psm_pc_reg_2; /* 0x4D2 */
  246. u16 psm_pc_reg_3; /* 0x4D4 */
  247. u16 PAD[0xD]; /* 0x4D6 - 0x4DE */
  248. u16 psm_corectlsts; /* 0x4f0 *//* Corerev >= 13 */
  249. u16 PAD[0x7]; /* 0x4f2 - 0x4fE */
  250. /* TXE0 Block *//* 0x500 - 0x580 */
  251. u16 txe_ctl; /* 0x500 */
  252. u16 txe_aux; /* 0x502 */
  253. u16 txe_ts_loc; /* 0x504 */
  254. u16 txe_time_out; /* 0x506 */
  255. u16 txe_wm_0; /* 0x508 */
  256. u16 txe_wm_1; /* 0x50A */
  257. u16 txe_phyctl; /* 0x50C */
  258. u16 txe_status; /* 0x50E */
  259. u16 txe_mmplcp0; /* 0x510 */
  260. u16 txe_mmplcp1; /* 0x512 */
  261. u16 txe_phyctl1; /* 0x514 */
  262. u16 PAD[0x05]; /* 0x510 - 0x51E */
  263. /* Transmit control */
  264. u16 xmtfifodef; /* 0x520 */
  265. u16 xmtfifo_frame_cnt; /* 0x522 *//* Corerev >= 16 */
  266. u16 xmtfifo_byte_cnt; /* 0x524 *//* Corerev >= 16 */
  267. u16 xmtfifo_head; /* 0x526 *//* Corerev >= 16 */
  268. u16 xmtfifo_rd_ptr; /* 0x528 *//* Corerev >= 16 */
  269. u16 xmtfifo_wr_ptr; /* 0x52A *//* Corerev >= 16 */
  270. u16 xmtfifodef1; /* 0x52C *//* Corerev >= 16 */
  271. u16 PAD[0x09]; /* 0x52E - 0x53E */
  272. u16 xmtfifocmd; /* 0x540 */
  273. u16 xmtfifoflush; /* 0x542 */
  274. u16 xmtfifothresh; /* 0x544 */
  275. u16 xmtfifordy; /* 0x546 */
  276. u16 xmtfifoprirdy; /* 0x548 */
  277. u16 xmtfiforqpri; /* 0x54A */
  278. u16 xmttplatetxptr; /* 0x54C */
  279. u16 PAD; /* 0x54E */
  280. u16 xmttplateptr; /* 0x550 */
  281. u16 smpl_clct_strptr; /* 0x552 *//* Corerev >= 22 */
  282. u16 smpl_clct_stpptr; /* 0x554 *//* Corerev >= 22 */
  283. u16 smpl_clct_curptr; /* 0x556 *//* Corerev >= 22 */
  284. u16 PAD[0x04]; /* 0x558 - 0x55E */
  285. u16 xmttplatedatalo; /* 0x560 */
  286. u16 xmttplatedatahi; /* 0x562 */
  287. u16 PAD[2]; /* 0x564 - 0x566 */
  288. u16 xmtsel; /* 0x568 */
  289. u16 xmttxcnt; /* 0x56A */
  290. u16 xmttxshmaddr; /* 0x56C */
  291. u16 PAD[0x09]; /* 0x56E - 0x57E */
  292. /* TXE1 Block */
  293. u16 PAD[0x40]; /* 0x580 - 0x5FE */
  294. /* TSF Block */
  295. u16 PAD[0X02]; /* 0x600 - 0x602 */
  296. u16 tsf_cfpstrt_l; /* 0x604 */
  297. u16 tsf_cfpstrt_h; /* 0x606 */
  298. u16 PAD[0X05]; /* 0x608 - 0x610 */
  299. u16 tsf_cfppretbtt; /* 0x612 */
  300. u16 PAD[0XD]; /* 0x614 - 0x62C */
  301. u16 tsf_clk_frac_l; /* 0x62E */
  302. u16 tsf_clk_frac_h; /* 0x630 */
  303. u16 PAD[0X14]; /* 0x632 - 0x658 */
  304. u16 tsf_random; /* 0x65A */
  305. u16 PAD[0x05]; /* 0x65C - 0x664 */
  306. /* GPTimer 2 registers */
  307. u16 tsf_gpt2_stat; /* 0x666 */
  308. u16 tsf_gpt2_ctr_l; /* 0x668 */
  309. u16 tsf_gpt2_ctr_h; /* 0x66A */
  310. u16 tsf_gpt2_val_l; /* 0x66C */
  311. u16 tsf_gpt2_val_h; /* 0x66E */
  312. u16 tsf_gptall_stat; /* 0x670 */
  313. u16 PAD[0x07]; /* 0x672 - 0x67E */
  314. /* IFS Block */
  315. u16 ifs_sifs_rx_tx_tx; /* 0x680 */
  316. u16 ifs_sifs_nav_tx; /* 0x682 */
  317. u16 ifs_slot; /* 0x684 */
  318. u16 PAD; /* 0x686 */
  319. u16 ifs_ctl; /* 0x688 */
  320. u16 PAD[0x3]; /* 0x68a - 0x68F */
  321. u16 ifsstat; /* 0x690 */
  322. u16 ifsmedbusyctl; /* 0x692 */
  323. u16 iftxdur; /* 0x694 */
  324. u16 PAD[0x3]; /* 0x696 - 0x69b */
  325. /* EDCF support in dot11macs */
  326. u16 ifs_aifsn; /* 0x69c */
  327. u16 ifs_ctl1; /* 0x69e */
  328. /* slow clock registers */
  329. u16 scc_ctl; /* 0x6a0 */
  330. u16 scc_timer_l; /* 0x6a2 */
  331. u16 scc_timer_h; /* 0x6a4 */
  332. u16 scc_frac; /* 0x6a6 */
  333. u16 scc_fastpwrup_dly; /* 0x6a8 */
  334. u16 scc_per; /* 0x6aa */
  335. u16 scc_per_frac; /* 0x6ac */
  336. u16 scc_cal_timer_l; /* 0x6ae */
  337. u16 scc_cal_timer_h; /* 0x6b0 */
  338. u16 PAD; /* 0x6b2 */
  339. u16 PAD[0x26];
  340. /* NAV Block */
  341. u16 nav_ctl; /* 0x700 */
  342. u16 navstat; /* 0x702 */
  343. u16 PAD[0x3e]; /* 0x702 - 0x77E */
  344. /* WEP/PMQ Block *//* 0x780 - 0x7FE */
  345. u16 PAD[0x20]; /* 0x780 - 0x7BE */
  346. u16 wepctl; /* 0x7C0 */
  347. u16 wepivloc; /* 0x7C2 */
  348. u16 wepivkey; /* 0x7C4 */
  349. u16 wepwkey; /* 0x7C6 */
  350. u16 PAD[4]; /* 0x7C8 - 0x7CE */
  351. u16 pcmctl; /* 0X7D0 */
  352. u16 pcmstat; /* 0X7D2 */
  353. u16 PAD[6]; /* 0x7D4 - 0x7DE */
  354. u16 pmqctl; /* 0x7E0 */
  355. u16 pmqstatus; /* 0x7E2 */
  356. u16 pmqpat0; /* 0x7E4 */
  357. u16 pmqpat1; /* 0x7E6 */
  358. u16 pmqpat2; /* 0x7E8 */
  359. u16 pmqdat; /* 0x7EA */
  360. u16 pmqdator; /* 0x7EC */
  361. u16 pmqhst; /* 0x7EE */
  362. u16 pmqpath0; /* 0x7F0 */
  363. u16 pmqpath1; /* 0x7F2 */
  364. u16 pmqpath2; /* 0x7F4 */
  365. u16 pmqdath; /* 0x7F6 */
  366. u16 PAD[0x04]; /* 0x7F8 - 0x7FE */
  367. /* SHM *//* 0x800 - 0xEFE */
  368. u16 PAD[0x380]; /* 0x800 - 0xEFE */
  369. };
  370. #define PIHR_BASE 0x0400 /* byte address of packed IHR region */
  371. /* biststatus */
  372. #define BT_DONE (1U << 31) /* bist done */
  373. #define BT_B2S (1 << 30) /* bist2 ram summary bit */
  374. /* intstatus and intmask */
  375. #define I_PC (1 << 10) /* pci descriptor error */
  376. #define I_PD (1 << 11) /* pci data error */
  377. #define I_DE (1 << 12) /* descriptor protocol error */
  378. #define I_RU (1 << 13) /* receive descriptor underflow */
  379. #define I_RO (1 << 14) /* receive fifo overflow */
  380. #define I_XU (1 << 15) /* transmit fifo underflow */
  381. #define I_RI (1 << 16) /* receive interrupt */
  382. #define I_XI (1 << 24) /* transmit interrupt */
  383. /* interrupt receive lazy */
  384. #define IRL_TO_MASK 0x00ffffff /* timeout */
  385. #define IRL_FC_MASK 0xff000000 /* frame count */
  386. #define IRL_FC_SHIFT 24 /* frame count */
  387. /*== maccontrol register ==*/
  388. #define MCTL_GMODE (1U << 31)
  389. #define MCTL_DISCARD_PMQ (1 << 30)
  390. #define MCTL_WAKE (1 << 26)
  391. #define MCTL_HPS (1 << 25)
  392. #define MCTL_PROMISC (1 << 24)
  393. #define MCTL_KEEPBADFCS (1 << 23)
  394. #define MCTL_KEEPCONTROL (1 << 22)
  395. #define MCTL_PHYLOCK (1 << 21)
  396. #define MCTL_BCNS_PROMISC (1 << 20)
  397. #define MCTL_LOCK_RADIO (1 << 19)
  398. #define MCTL_AP (1 << 18)
  399. #define MCTL_INFRA (1 << 17)
  400. #define MCTL_BIGEND (1 << 16)
  401. #define MCTL_GPOUT_SEL_MASK (3 << 14)
  402. #define MCTL_GPOUT_SEL_SHIFT 14
  403. #define MCTL_EN_PSMDBG (1 << 13)
  404. #define MCTL_IHR_EN (1 << 10)
  405. #define MCTL_SHM_UPPER (1 << 9)
  406. #define MCTL_SHM_EN (1 << 8)
  407. #define MCTL_PSM_JMP_0 (1 << 2)
  408. #define MCTL_PSM_RUN (1 << 1)
  409. #define MCTL_EN_MAC (1 << 0)
  410. /*== maccommand register ==*/
  411. #define MCMD_BCN0VLD (1 << 0)
  412. #define MCMD_BCN1VLD (1 << 1)
  413. #define MCMD_DIRFRMQVAL (1 << 2)
  414. #define MCMD_CCA (1 << 3)
  415. #define MCMD_BG_NOISE (1 << 4)
  416. #define MCMD_SKIP_SHMINIT (1 << 5) /* only used for simulation */
  417. #define MCMD_SAMPLECOLL MCMD_SKIP_SHMINIT /* reuse for sample collect */
  418. /*== macintstatus/macintmask ==*/
  419. /* gracefully suspended */
  420. #define MI_MACSSPNDD (1 << 0)
  421. /* beacon template available */
  422. #define MI_BCNTPL (1 << 1)
  423. /* TBTT indication */
  424. #define MI_TBTT (1 << 2)
  425. /* beacon successfully tx'd */
  426. #define MI_BCNSUCCESS (1 << 3)
  427. /* beacon canceled (IBSS) */
  428. #define MI_BCNCANCLD (1 << 4)
  429. /* end of ATIM-window (IBSS) */
  430. #define MI_ATIMWINEND (1 << 5)
  431. /* PMQ entries available */
  432. #define MI_PMQ (1 << 6)
  433. /* non-specific gen-stat bits that are set by PSM */
  434. #define MI_NSPECGEN_0 (1 << 7)
  435. /* non-specific gen-stat bits that are set by PSM */
  436. #define MI_NSPECGEN_1 (1 << 8)
  437. /* MAC level Tx error */
  438. #define MI_MACTXERR (1 << 9)
  439. /* non-specific gen-stat bits that are set by PSM */
  440. #define MI_NSPECGEN_3 (1 << 10)
  441. /* PHY Tx error */
  442. #define MI_PHYTXERR (1 << 11)
  443. /* Power Management Event */
  444. #define MI_PME (1 << 12)
  445. /* General-purpose timer0 */
  446. #define MI_GP0 (1 << 13)
  447. /* General-purpose timer1 */
  448. #define MI_GP1 (1 << 14)
  449. /* (ORed) DMA-interrupts */
  450. #define MI_DMAINT (1 << 15)
  451. /* MAC has completed a TX FIFO Suspend/Flush */
  452. #define MI_TXSTOP (1 << 16)
  453. /* MAC has completed a CCA measurement */
  454. #define MI_CCA (1 << 17)
  455. /* MAC has collected background noise samples */
  456. #define MI_BG_NOISE (1 << 18)
  457. /* MBSS DTIM TBTT indication */
  458. #define MI_DTIM_TBTT (1 << 19)
  459. /* Probe response queue needs attention */
  460. #define MI_PRQ (1 << 20)
  461. /* Radio/PHY has been powered back up. */
  462. #define MI_PWRUP (1 << 21)
  463. #define MI_RESERVED3 (1 << 22)
  464. #define MI_RESERVED2 (1 << 23)
  465. #define MI_RESERVED1 (1 << 25)
  466. /* MAC detected change on RF Disable input*/
  467. #define MI_RFDISABLE (1 << 28)
  468. /* MAC has completed a TX */
  469. #define MI_TFS (1 << 29)
  470. /* A phy status change wrt G mode */
  471. #define MI_PHYCHANGED (1 << 30)
  472. /* general purpose timeout */
  473. #define MI_TO (1U << 31)
  474. /* Mac capabilities registers */
  475. /*== machwcap ==*/
  476. #define MCAP_TKIPMIC 0x80000000 /* TKIP MIC hardware present */
  477. /*== pmqhost data ==*/
  478. /* data entry of head pmq entry */
  479. #define PMQH_DATA_MASK 0xffff0000
  480. /* PM entry for BSS config */
  481. #define PMQH_BSSCFG 0x00100000
  482. /* PM Mode OFF: power save off */
  483. #define PMQH_PMOFF 0x00010000
  484. /* PM Mode ON: power save on */
  485. #define PMQH_PMON 0x00020000
  486. /* Dis-associated or De-authenticated */
  487. #define PMQH_DASAT 0x00040000
  488. /* ATIM not acknowledged */
  489. #define PMQH_ATIMFAIL 0x00080000
  490. /* delete head entry */
  491. #define PMQH_DEL_ENTRY 0x00000001
  492. /* delete head entry to cur read pointer -1 */
  493. #define PMQH_DEL_MULT 0x00000002
  494. /* pmq overflow indication */
  495. #define PMQH_OFLO 0x00000004
  496. /* entries are present in pmq */
  497. #define PMQH_NOT_EMPTY 0x00000008
  498. /*== phydebug ==*/
  499. /* phy is asserting carrier sense */
  500. #define PDBG_CRS (1 << 0)
  501. /* phy is taking xmit byte from mac this cycle */
  502. #define PDBG_TXA (1 << 1)
  503. /* mac is instructing the phy to transmit a frame */
  504. #define PDBG_TXF (1 << 2)
  505. /* phy is signalling a transmit Error to the mac */
  506. #define PDBG_TXE (1 << 3)
  507. /* phy detected the end of a valid frame preamble */
  508. #define PDBG_RXF (1 << 4)
  509. /* phy detected the end of a valid PLCP header */
  510. #define PDBG_RXS (1 << 5)
  511. /* rx start not asserted */
  512. #define PDBG_RXFRG (1 << 6)
  513. /* mac is taking receive byte from phy this cycle */
  514. #define PDBG_RXV (1 << 7)
  515. /* RF portion of the radio is disabled */
  516. #define PDBG_RFD (1 << 16)
  517. /*== objaddr register ==*/
  518. #define OBJADDR_SEL_MASK 0x000F0000
  519. #define OBJADDR_UCM_SEL 0x00000000
  520. #define OBJADDR_SHM_SEL 0x00010000
  521. #define OBJADDR_SCR_SEL 0x00020000
  522. #define OBJADDR_IHR_SEL 0x00030000
  523. #define OBJADDR_RCMTA_SEL 0x00040000
  524. #define OBJADDR_SRCHM_SEL 0x00060000
  525. #define OBJADDR_WINC 0x01000000
  526. #define OBJADDR_RINC 0x02000000
  527. #define OBJADDR_AUTO_INC 0x03000000
  528. #define WEP_PCMADDR 0x07d4
  529. #define WEP_PCMDATA 0x07d6
  530. /*== frmtxstatus ==*/
  531. #define TXS_V (1 << 0) /* valid bit */
  532. #define TXS_STATUS_MASK 0xffff
  533. #define TXS_FID_MASK 0xffff0000
  534. #define TXS_FID_SHIFT 16
  535. /*== frmtxstatus2 ==*/
  536. #define TXS_SEQ_MASK 0xffff
  537. #define TXS_PTX_MASK 0xff0000
  538. #define TXS_PTX_SHIFT 16
  539. #define TXS_MU_MASK 0x01000000
  540. #define TXS_MU_SHIFT 24
  541. /*== clk_ctl_st ==*/
  542. #define CCS_ERSRC_REQ_D11PLL 0x00000100 /* d11 core pll request */
  543. #define CCS_ERSRC_REQ_PHYPLL 0x00000200 /* PHY pll request */
  544. #define CCS_ERSRC_AVAIL_D11PLL 0x01000000 /* d11 core pll available */
  545. #define CCS_ERSRC_AVAIL_PHYPLL 0x02000000 /* PHY pll available */
  546. /* HT Cloclk Ctrl and Clock Avail for 4313 */
  547. #define CCS_ERSRC_REQ_HT 0x00000010 /* HT avail request */
  548. #define CCS_ERSRC_AVAIL_HT 0x00020000 /* HT clock available */
  549. /* tsf_cfprep register */
  550. #define CFPREP_CBI_MASK 0xffffffc0
  551. #define CFPREP_CBI_SHIFT 6
  552. #define CFPREP_CFPP 0x00000001
  553. /* tx fifo sizes values are in terms of 256 byte blocks */
  554. #define TXFIFOCMD_RESET_MASK (1 << 15) /* reset */
  555. #define TXFIFOCMD_FIFOSEL_SHIFT 8 /* fifo */
  556. #define TXFIFO_FIFOTOP_SHIFT 8 /* fifo start */
  557. #define TXFIFO_START_BLK16 65 /* Base address + 32 * 512 B/P */
  558. #define TXFIFO_START_BLK 6 /* Base address + 6 * 256 B */
  559. #define TXFIFO_SIZE_UNIT 256 /* one unit corresponds to 256 bytes */
  560. #define MBSS16_TEMPLMEM_MINBLKS 65 /* one unit corresponds to 256 bytes */
  561. /*== phy versions (PhyVersion:Revision field) ==*/
  562. /* analog block version */
  563. #define PV_AV_MASK 0xf000
  564. /* analog block version bitfield offset */
  565. #define PV_AV_SHIFT 12
  566. /* phy type */
  567. #define PV_PT_MASK 0x0f00
  568. /* phy type bitfield offset */
  569. #define PV_PT_SHIFT 8
  570. /* phy version */
  571. #define PV_PV_MASK 0x000f
  572. #define PHY_TYPE(v) ((v & PV_PT_MASK) >> PV_PT_SHIFT)
  573. /*== phy types (PhyVersion:PhyType field) ==*/
  574. #define PHY_TYPE_N 4 /* N-Phy value */
  575. #define PHY_TYPE_SSN 6 /* SSLPN-Phy value */
  576. #define PHY_TYPE_LCN 8 /* LCN-Phy value */
  577. #define PHY_TYPE_LCNXN 9 /* LCNXN-Phy value */
  578. #define PHY_TYPE_NULL 0xf /* Invalid Phy value */
  579. /*== analog types (PhyVersion:AnalogType field) ==*/
  580. #define ANA_11N_013 5
  581. /* 802.11a PLCP header def */
  582. struct ofdm_phy_hdr {
  583. u8 rlpt[3]; /* rate, length, parity, tail */
  584. u16 service;
  585. u8 pad;
  586. } __packed;
  587. #define D11A_PHY_HDR_GRATE(phdr) ((phdr)->rlpt[0] & 0x0f)
  588. #define D11A_PHY_HDR_GRES(phdr) (((phdr)->rlpt[0] >> 4) & 0x01)
  589. #define D11A_PHY_HDR_GLENGTH(phdr) (((u32 *)((phdr)->rlpt) >> 5) & 0x0fff)
  590. #define D11A_PHY_HDR_GPARITY(phdr) (((phdr)->rlpt[3] >> 1) & 0x01)
  591. #define D11A_PHY_HDR_GTAIL(phdr) (((phdr)->rlpt[3] >> 2) & 0x3f)
  592. /* rate encoded per 802.11a-1999 sec 17.3.4.1 */
  593. #define D11A_PHY_HDR_SRATE(phdr, rate) \
  594. ((phdr)->rlpt[0] = ((phdr)->rlpt[0] & 0xf0) | ((rate) & 0xf))
  595. /* set reserved field to zero */
  596. #define D11A_PHY_HDR_SRES(phdr) ((phdr)->rlpt[0] &= 0xef)
  597. /* length is number of octets in PSDU */
  598. #define D11A_PHY_HDR_SLENGTH(phdr, length) \
  599. (*(u32 *)((phdr)->rlpt) = *(u32 *)((phdr)->rlpt) | \
  600. (((length) & 0x0fff) << 5))
  601. /* set the tail to all zeros */
  602. #define D11A_PHY_HDR_STAIL(phdr) ((phdr)->rlpt[3] &= 0x03)
  603. #define D11A_PHY_HDR_LEN_L 3 /* low-rate part of PLCP header */
  604. #define D11A_PHY_HDR_LEN_R 2 /* high-rate part of PLCP header */
  605. #define D11A_PHY_TX_DELAY (2) /* 2.1 usec */
  606. #define D11A_PHY_HDR_TIME (4) /* low-rate part of PLCP header */
  607. #define D11A_PHY_PRE_TIME (16)
  608. #define D11A_PHY_PREHDR_TIME (D11A_PHY_PRE_TIME + D11A_PHY_HDR_TIME)
  609. /* 802.11b PLCP header def */
  610. struct cck_phy_hdr {
  611. u8 signal;
  612. u8 service;
  613. u16 length;
  614. u16 crc;
  615. } __packed;
  616. #define D11B_PHY_HDR_LEN 6
  617. #define D11B_PHY_TX_DELAY (3) /* 3.4 usec */
  618. #define D11B_PHY_LHDR_TIME (D11B_PHY_HDR_LEN << 3)
  619. #define D11B_PHY_LPRE_TIME (144)
  620. #define D11B_PHY_LPREHDR_TIME (D11B_PHY_LPRE_TIME + D11B_PHY_LHDR_TIME)
  621. #define D11B_PHY_SHDR_TIME (D11B_PHY_LHDR_TIME >> 1)
  622. #define D11B_PHY_SPRE_TIME (D11B_PHY_LPRE_TIME >> 1)
  623. #define D11B_PHY_SPREHDR_TIME (D11B_PHY_SPRE_TIME + D11B_PHY_SHDR_TIME)
  624. #define D11B_PLCP_SIGNAL_LOCKED (1 << 2)
  625. #define D11B_PLCP_SIGNAL_LE (1 << 7)
  626. #define MIMO_PLCP_MCS_MASK 0x7f /* mcs index */
  627. #define MIMO_PLCP_40MHZ 0x80 /* 40 Hz frame */
  628. #define MIMO_PLCP_AMPDU 0x08 /* ampdu */
  629. #define BRCMS_GET_CCK_PLCP_LEN(plcp) (plcp[4] + (plcp[5] << 8))
  630. #define BRCMS_GET_MIMO_PLCP_LEN(plcp) (plcp[1] + (plcp[2] << 8))
  631. #define BRCMS_SET_MIMO_PLCP_LEN(plcp, len) \
  632. do { \
  633. plcp[1] = len & 0xff; \
  634. plcp[2] = ((len >> 8) & 0xff); \
  635. } while (0);
  636. #define BRCMS_SET_MIMO_PLCP_AMPDU(plcp) (plcp[3] |= MIMO_PLCP_AMPDU)
  637. #define BRCMS_CLR_MIMO_PLCP_AMPDU(plcp) (plcp[3] &= ~MIMO_PLCP_AMPDU)
  638. #define BRCMS_IS_MIMO_PLCP_AMPDU(plcp) (plcp[3] & MIMO_PLCP_AMPDU)
  639. /*
  640. * The dot11a PLCP header is 5 bytes. To simplify the software (so that we
  641. * don't need e.g. different tx DMA headers for 11a and 11b), the PLCP header
  642. * has padding added in the ucode.
  643. */
  644. #define D11_PHY_HDR_LEN 6
  645. /* TX DMA buffer header */
  646. struct d11txh {
  647. __le16 MacTxControlLow; /* 0x0 */
  648. __le16 MacTxControlHigh; /* 0x1 */
  649. __le16 MacFrameControl; /* 0x2 */
  650. __le16 TxFesTimeNormal; /* 0x3 */
  651. __le16 PhyTxControlWord; /* 0x4 */
  652. __le16 PhyTxControlWord_1; /* 0x5 */
  653. __le16 PhyTxControlWord_1_Fbr; /* 0x6 */
  654. __le16 PhyTxControlWord_1_Rts; /* 0x7 */
  655. __le16 PhyTxControlWord_1_FbrRts; /* 0x8 */
  656. __le16 MainRates; /* 0x9 */
  657. __le16 XtraFrameTypes; /* 0xa */
  658. u8 IV[16]; /* 0x0b - 0x12 */
  659. u8 TxFrameRA[6]; /* 0x13 - 0x15 */
  660. __le16 TxFesTimeFallback; /* 0x16 */
  661. u8 RTSPLCPFallback[6]; /* 0x17 - 0x19 */
  662. __le16 RTSDurFallback; /* 0x1a */
  663. u8 FragPLCPFallback[6]; /* 0x1b - 1d */
  664. __le16 FragDurFallback; /* 0x1e */
  665. __le16 MModeLen; /* 0x1f */
  666. __le16 MModeFbrLen; /* 0x20 */
  667. __le16 TstampLow; /* 0x21 */
  668. __le16 TstampHigh; /* 0x22 */
  669. __le16 ABI_MimoAntSel; /* 0x23 */
  670. __le16 PreloadSize; /* 0x24 */
  671. __le16 AmpduSeqCtl; /* 0x25 */
  672. __le16 TxFrameID; /* 0x26 */
  673. __le16 TxStatus; /* 0x27 */
  674. __le16 MaxNMpdus; /* 0x28 */
  675. __le16 MaxABytes_MRT; /* 0x29 */
  676. __le16 MaxABytes_FBR; /* 0x2a */
  677. __le16 MinMBytes; /* 0x2b */
  678. u8 RTSPhyHeader[D11_PHY_HDR_LEN]; /* 0x2c - 0x2e */
  679. struct ieee80211_rts rts_frame; /* 0x2f - 0x36 */
  680. u16 PAD; /* 0x37 */
  681. } __packed;
  682. #define D11_TXH_LEN 112 /* bytes */
  683. /* Frame Types */
  684. #define FT_CCK 0
  685. #define FT_OFDM 1
  686. #define FT_HT 2
  687. #define FT_N 3
  688. /*
  689. * Position of MPDU inside A-MPDU; indicated with bits 10:9
  690. * of MacTxControlLow
  691. */
  692. #define TXC_AMPDU_SHIFT 9 /* shift for ampdu settings */
  693. #define TXC_AMPDU_NONE 0 /* Regular MPDU, not an A-MPDU */
  694. #define TXC_AMPDU_FIRST 1 /* first MPDU of an A-MPDU */
  695. #define TXC_AMPDU_MIDDLE 2 /* intermediate MPDU of an A-MPDU */
  696. #define TXC_AMPDU_LAST 3 /* last (or single) MPDU of an A-MPDU */
  697. /*== MacTxControlLow ==*/
  698. #define TXC_AMIC 0x8000
  699. #define TXC_SENDCTS 0x0800
  700. #define TXC_AMPDU_MASK 0x0600
  701. #define TXC_BW_40 0x0100
  702. #define TXC_FREQBAND_5G 0x0080
  703. #define TXC_DFCS 0x0040
  704. #define TXC_IGNOREPMQ 0x0020
  705. #define TXC_HWSEQ 0x0010
  706. #define TXC_STARTMSDU 0x0008
  707. #define TXC_SENDRTS 0x0004
  708. #define TXC_LONGFRAME 0x0002
  709. #define TXC_IMMEDACK 0x0001
  710. /*== MacTxControlHigh ==*/
  711. /* RTS fallback preamble type 1 = SHORT 0 = LONG */
  712. #define TXC_PREAMBLE_RTS_FB_SHORT 0x8000
  713. /* RTS main rate preamble type 1 = SHORT 0 = LONG */
  714. #define TXC_PREAMBLE_RTS_MAIN_SHORT 0x4000
  715. /*
  716. * Main fallback rate preamble type
  717. * 1 = SHORT for OFDM/GF for MIMO
  718. * 0 = LONG for CCK/MM for MIMO
  719. */
  720. #define TXC_PREAMBLE_DATA_FB_SHORT 0x2000
  721. /* TXC_PREAMBLE_DATA_MAIN is in PhyTxControl bit 5 */
  722. /* use fallback rate for this AMPDU */
  723. #define TXC_AMPDU_FBR 0x1000
  724. #define TXC_SECKEY_MASK 0x0FF0
  725. #define TXC_SECKEY_SHIFT 4
  726. /* Use alternate txpwr defined at loc. M_ALT_TXPWR_IDX */
  727. #define TXC_ALT_TXPWR 0x0008
  728. #define TXC_SECTYPE_MASK 0x0007
  729. #define TXC_SECTYPE_SHIFT 0
  730. /* Null delimiter for Fallback rate */
  731. #define AMPDU_FBR_NULL_DELIM 5 /* Location of Null delimiter count for AMPDU */
  732. /* PhyTxControl for Mimophy */
  733. #define PHY_TXC_PWR_MASK 0xFC00
  734. #define PHY_TXC_PWR_SHIFT 10
  735. #define PHY_TXC_ANT_MASK 0x03C0 /* bit 6, 7, 8, 9 */
  736. #define PHY_TXC_ANT_SHIFT 6
  737. #define PHY_TXC_ANT_0_1 0x00C0 /* auto, last rx */
  738. #define PHY_TXC_LCNPHY_ANT_LAST 0x0000
  739. #define PHY_TXC_ANT_3 0x0200 /* virtual antenna 3 */
  740. #define PHY_TXC_ANT_2 0x0100 /* virtual antenna 2 */
  741. #define PHY_TXC_ANT_1 0x0080 /* virtual antenna 1 */
  742. #define PHY_TXC_ANT_0 0x0040 /* virtual antenna 0 */
  743. #define PHY_TXC_SHORT_HDR 0x0010
  744. #define PHY_TXC_OLD_ANT_0 0x0000
  745. #define PHY_TXC_OLD_ANT_1 0x0100
  746. #define PHY_TXC_OLD_ANT_LAST 0x0300
  747. /* PhyTxControl_1 for Mimophy */
  748. #define PHY_TXC1_BW_MASK 0x0007
  749. #define PHY_TXC1_BW_10MHZ 0
  750. #define PHY_TXC1_BW_10MHZ_UP 1
  751. #define PHY_TXC1_BW_20MHZ 2
  752. #define PHY_TXC1_BW_20MHZ_UP 3
  753. #define PHY_TXC1_BW_40MHZ 4
  754. #define PHY_TXC1_BW_40MHZ_DUP 5
  755. #define PHY_TXC1_MODE_SHIFT 3
  756. #define PHY_TXC1_MODE_MASK 0x0038
  757. #define PHY_TXC1_MODE_SISO 0
  758. #define PHY_TXC1_MODE_CDD 1
  759. #define PHY_TXC1_MODE_STBC 2
  760. #define PHY_TXC1_MODE_SDM 3
  761. /* PhyTxControl for HTphy that are different from Mimophy */
  762. #define PHY_TXC_HTANT_MASK 0x3fC0 /* bits 6-13 */
  763. /* XtraFrameTypes */
  764. #define XFTS_RTS_FT_SHIFT 2
  765. #define XFTS_FBRRTS_FT_SHIFT 4
  766. #define XFTS_CHANNEL_SHIFT 8
  767. /* Antenna diversity bit in ant_wr_settle */
  768. #define PHY_AWS_ANTDIV 0x2000
  769. /* IFS ctl */
  770. #define IFS_USEEDCF (1 << 2)
  771. /* IFS ctl1 */
  772. #define IFS_CTL1_EDCRS (1 << 3)
  773. #define IFS_CTL1_EDCRS_20L (1 << 4)
  774. #define IFS_CTL1_EDCRS_40 (1 << 5)
  775. /* ABI_MimoAntSel */
  776. #define ABI_MAS_ADDR_BMP_IDX_MASK 0x0f00
  777. #define ABI_MAS_ADDR_BMP_IDX_SHIFT 8
  778. #define ABI_MAS_FBR_ANT_PTN_MASK 0x00f0
  779. #define ABI_MAS_FBR_ANT_PTN_SHIFT 4
  780. #define ABI_MAS_MRT_ANT_PTN_MASK 0x000f
  781. /* tx status packet */
  782. struct tx_status {
  783. u16 framelen;
  784. u16 PAD;
  785. u16 frameid;
  786. u16 status;
  787. u16 lasttxtime;
  788. u16 sequence;
  789. u16 phyerr;
  790. u16 ackphyrxsh;
  791. } __packed;
  792. #define TXSTATUS_LEN 16
  793. /* status field bit definitions */
  794. #define TX_STATUS_FRM_RTX_MASK 0xF000
  795. #define TX_STATUS_FRM_RTX_SHIFT 12
  796. #define TX_STATUS_RTS_RTX_MASK 0x0F00
  797. #define TX_STATUS_RTS_RTX_SHIFT 8
  798. #define TX_STATUS_MASK 0x00FE
  799. #define TX_STATUS_PMINDCTD (1 << 7) /* PM mode indicated to AP */
  800. #define TX_STATUS_INTERMEDIATE (1 << 6) /* intermediate or 1st ampdu pkg */
  801. #define TX_STATUS_AMPDU (1 << 5) /* AMPDU status */
  802. #define TX_STATUS_SUPR_MASK 0x1C /* suppress status bits (4:2) */
  803. #define TX_STATUS_SUPR_SHIFT 2
  804. #define TX_STATUS_ACK_RCV (1 << 1) /* ACK received */
  805. #define TX_STATUS_VALID (1 << 0) /* Tx status valid */
  806. #define TX_STATUS_NO_ACK 0
  807. /* suppress status reason codes */
  808. #define TX_STATUS_SUPR_PMQ (1 << 2) /* PMQ entry */
  809. #define TX_STATUS_SUPR_FLUSH (2 << 2) /* flush request */
  810. #define TX_STATUS_SUPR_FRAG (3 << 2) /* previous frag failure */
  811. #define TX_STATUS_SUPR_TBTT (3 << 2) /* SHARED: Probe resp supr for TBTT */
  812. #define TX_STATUS_SUPR_BADCH (4 << 2) /* channel mismatch */
  813. #define TX_STATUS_SUPR_EXPTIME (5 << 2) /* lifetime expiry */
  814. #define TX_STATUS_SUPR_UF (6 << 2) /* underflow */
  815. /* Unexpected tx status for rate update */
  816. #define TX_STATUS_UNEXP(status) \
  817. ((((status) & TX_STATUS_INTERMEDIATE) != 0) && \
  818. TX_STATUS_UNEXP_AMPDU(status))
  819. /* Unexpected tx status for A-MPDU rate update */
  820. #define TX_STATUS_UNEXP_AMPDU(status) \
  821. ((((status) & TX_STATUS_SUPR_MASK) != 0) && \
  822. (((status) & TX_STATUS_SUPR_MASK) != TX_STATUS_SUPR_EXPTIME))
  823. #define TX_STATUS_BA_BMAP03_MASK 0xF000 /* ba bitmap 0:3 in 1st pkg */
  824. #define TX_STATUS_BA_BMAP03_SHIFT 12 /* ba bitmap 0:3 in 1st pkg */
  825. #define TX_STATUS_BA_BMAP47_MASK 0x001E /* ba bitmap 4:7 in 2nd pkg */
  826. #define TX_STATUS_BA_BMAP47_SHIFT 3 /* ba bitmap 4:7 in 2nd pkg */
  827. /* RXE (Receive Engine) */
  828. /* RCM_CTL */
  829. #define RCM_INC_MASK_H 0x0080
  830. #define RCM_INC_MASK_L 0x0040
  831. #define RCM_INC_DATA 0x0020
  832. #define RCM_INDEX_MASK 0x001F
  833. #define RCM_SIZE 15
  834. #define RCM_MAC_OFFSET 0 /* current MAC address */
  835. #define RCM_BSSID_OFFSET 3 /* current BSSID address */
  836. #define RCM_F_BSSID_0_OFFSET 6 /* foreign BSS CFP tracking */
  837. #define RCM_F_BSSID_1_OFFSET 9 /* foreign BSS CFP tracking */
  838. #define RCM_F_BSSID_2_OFFSET 12 /* foreign BSS CFP tracking */
  839. #define RCM_WEP_TA0_OFFSET 16
  840. #define RCM_WEP_TA1_OFFSET 19
  841. #define RCM_WEP_TA2_OFFSET 22
  842. #define RCM_WEP_TA3_OFFSET 25
  843. /* PSM Block */
  844. /* psm_phy_hdr_param bits */
  845. #define MAC_PHY_RESET 1
  846. #define MAC_PHY_CLOCK_EN 2
  847. #define MAC_PHY_FORCE_CLK 4
  848. /* WEP Block */
  849. /* WEP_WKEY */
  850. #define WKEY_START (1 << 8)
  851. #define WKEY_SEL_MASK 0x1F
  852. /* WEP data formats */
  853. /* the number of RCMTA entries */
  854. #define RCMTA_SIZE 50
  855. #define M_ADDR_BMP_BLK (0x37e * 2)
  856. #define M_ADDR_BMP_BLK_SZ 12
  857. #define ADDR_BMP_RA (1 << 0) /* Receiver Address (RA) */
  858. #define ADDR_BMP_TA (1 << 1) /* Transmitter Address (TA) */
  859. #define ADDR_BMP_BSSID (1 << 2) /* BSSID */
  860. #define ADDR_BMP_AP (1 << 3) /* Infra-BSS Access Point */
  861. #define ADDR_BMP_STA (1 << 4) /* Infra-BSS Station */
  862. #define ADDR_BMP_RESERVED1 (1 << 5)
  863. #define ADDR_BMP_RESERVED2 (1 << 6)
  864. #define ADDR_BMP_RESERVED3 (1 << 7)
  865. #define ADDR_BMP_BSS_IDX_MASK (3 << 8) /* BSS control block index */
  866. #define ADDR_BMP_BSS_IDX_SHIFT 8
  867. #define WSEC_MAX_RCMTA_KEYS 54
  868. /* max keys in M_TKMICKEYS_BLK */
  869. #define WSEC_MAX_TKMIC_ENGINE_KEYS 12 /* 8 + 4 default */
  870. /* max RXE match registers */
  871. #define WSEC_MAX_RXE_KEYS 4
  872. /* SECKINDXALGO (Security Key Index & Algorithm Block) word format */
  873. /* SKL (Security Key Lookup) */
  874. #define SKL_ALGO_MASK 0x0007
  875. #define SKL_ALGO_SHIFT 0
  876. #define SKL_KEYID_MASK 0x0008
  877. #define SKL_KEYID_SHIFT 3
  878. #define SKL_INDEX_MASK 0x03F0
  879. #define SKL_INDEX_SHIFT 4
  880. #define SKL_GRP_ALGO_MASK 0x1c00
  881. #define SKL_GRP_ALGO_SHIFT 10
  882. /* additional bits defined for IBSS group key support */
  883. #define SKL_IBSS_INDEX_MASK 0x01F0
  884. #define SKL_IBSS_INDEX_SHIFT 4
  885. #define SKL_IBSS_KEYID1_MASK 0x0600
  886. #define SKL_IBSS_KEYID1_SHIFT 9
  887. #define SKL_IBSS_KEYID2_MASK 0x1800
  888. #define SKL_IBSS_KEYID2_SHIFT 11
  889. #define SKL_IBSS_KEYALGO_MASK 0xE000
  890. #define SKL_IBSS_KEYALGO_SHIFT 13
  891. #define WSEC_MODE_OFF 0
  892. #define WSEC_MODE_HW 1
  893. #define WSEC_MODE_SW 2
  894. #define WSEC_ALGO_OFF 0
  895. #define WSEC_ALGO_WEP1 1
  896. #define WSEC_ALGO_TKIP 2
  897. #define WSEC_ALGO_AES 3
  898. #define WSEC_ALGO_WEP128 4
  899. #define WSEC_ALGO_AES_LEGACY 5
  900. #define WSEC_ALGO_NALG 6
  901. #define AES_MODE_NONE 0
  902. #define AES_MODE_CCM 1
  903. /* WEP_CTL (Rev 0) */
  904. #define WECR0_KEYREG_SHIFT 0
  905. #define WECR0_KEYREG_MASK 0x7
  906. #define WECR0_DECRYPT (1 << 3)
  907. #define WECR0_IVINLINE (1 << 4)
  908. #define WECR0_WEPALG_SHIFT 5
  909. #define WECR0_WEPALG_MASK (0x7 << 5)
  910. #define WECR0_WKEYSEL_SHIFT 8
  911. #define WECR0_WKEYSEL_MASK (0x7 << 8)
  912. #define WECR0_WKEYSTART (1 << 11)
  913. #define WECR0_WEPINIT (1 << 14)
  914. #define WECR0_ICVERR (1 << 15)
  915. /* Frame template map byte offsets */
  916. #define T_ACTS_TPL_BASE (0)
  917. #define T_NULL_TPL_BASE (0xc * 2)
  918. #define T_QNULL_TPL_BASE (0x1c * 2)
  919. #define T_RR_TPL_BASE (0x2c * 2)
  920. #define T_BCN0_TPL_BASE (0x34 * 2)
  921. #define T_PRS_TPL_BASE (0x134 * 2)
  922. #define T_BCN1_TPL_BASE (0x234 * 2)
  923. #define T_TX_FIFO_TXRAM_BASE (T_ACTS_TPL_BASE + \
  924. (TXFIFO_START_BLK * TXFIFO_SIZE_UNIT))
  925. #define T_BA_TPL_BASE T_QNULL_TPL_BASE /* template area for BA */
  926. #define T_RAM_ACCESS_SZ 4 /* template ram is 4 byte access only */
  927. /* Shared Mem byte offsets */
  928. /* Location where the ucode expects the corerev */
  929. #define M_MACHW_VER (0x00b * 2)
  930. /* Location where the ucode expects the MAC capabilities */
  931. #define M_MACHW_CAP_L (0x060 * 2)
  932. #define M_MACHW_CAP_H (0x061 * 2)
  933. /* WME shared memory */
  934. #define M_EDCF_STATUS_OFF (0x007 * 2)
  935. #define M_TXF_CUR_INDEX (0x018 * 2)
  936. #define M_EDCF_QINFO (0x120 * 2)
  937. /* PS-mode related parameters */
  938. #define M_DOT11_SLOT (0x008 * 2)
  939. #define M_DOT11_DTIMPERIOD (0x009 * 2)
  940. #define M_NOSLPZNATDTIM (0x026 * 2)
  941. /* Beacon-related parameters */
  942. #define M_BCN0_FRM_BYTESZ (0x00c * 2) /* Bcn 0 template length */
  943. #define M_BCN1_FRM_BYTESZ (0x00d * 2) /* Bcn 1 template length */
  944. #define M_BCN_TXTSF_OFFSET (0x00e * 2)
  945. #define M_TIMBPOS_INBEACON (0x00f * 2)
  946. #define M_SFRMTXCNTFBRTHSD (0x022 * 2)
  947. #define M_LFRMTXCNTFBRTHSD (0x023 * 2)
  948. #define M_BCN_PCTLWD (0x02a * 2)
  949. #define M_BCN_LI (0x05b * 2) /* beacon listen interval */
  950. /* MAX Rx Frame len */
  951. #define M_MAXRXFRM_LEN (0x010 * 2)
  952. /* ACK/CTS related params */
  953. #define M_RSP_PCTLWD (0x011 * 2)
  954. /* Hardware Power Control */
  955. #define M_TXPWR_N (0x012 * 2)
  956. #define M_TXPWR_TARGET (0x013 * 2)
  957. #define M_TXPWR_MAX (0x014 * 2)
  958. #define M_TXPWR_CUR (0x019 * 2)
  959. /* Rx-related parameters */
  960. #define M_RX_PAD_DATA_OFFSET (0x01a * 2)
  961. /* WEP Shared mem data */
  962. #define M_SEC_DEFIVLOC (0x01e * 2)
  963. #define M_SEC_VALNUMSOFTMCHTA (0x01f * 2)
  964. #define M_PHYVER (0x028 * 2)
  965. #define M_PHYTYPE (0x029 * 2)
  966. #define M_SECRXKEYS_PTR (0x02b * 2)
  967. #define M_TKMICKEYS_PTR (0x059 * 2)
  968. #define M_SECKINDXALGO_BLK (0x2ea * 2)
  969. #define M_SECKINDXALGO_BLK_SZ 54
  970. #define M_SECPSMRXTAMCH_BLK (0x2fa * 2)
  971. #define M_TKIP_TSC_TTAK (0x18c * 2)
  972. #define D11_MAX_KEY_SIZE 16
  973. #define M_MAX_ANTCNT (0x02e * 2) /* antenna swap threshold */
  974. /* Probe response related parameters */
  975. #define M_SSIDLEN (0x024 * 2)
  976. #define M_PRB_RESP_FRM_LEN (0x025 * 2)
  977. #define M_PRS_MAXTIME (0x03a * 2)
  978. #define M_SSID (0xb0 * 2)
  979. #define M_CTXPRS_BLK (0xc0 * 2)
  980. #define C_CTX_PCTLWD_POS (0x4 * 2)
  981. /* Delta between OFDM and CCK power in CCK power boost mode */
  982. #define M_OFDM_OFFSET (0x027 * 2)
  983. /* TSSI for last 4 11b/g CCK packets transmitted */
  984. #define M_B_TSSI_0 (0x02c * 2)
  985. #define M_B_TSSI_1 (0x02d * 2)
  986. /* Host flags to turn on ucode options */
  987. #define M_HOST_FLAGS1 (0x02f * 2)
  988. #define M_HOST_FLAGS2 (0x030 * 2)
  989. #define M_HOST_FLAGS3 (0x031 * 2)
  990. #define M_HOST_FLAGS4 (0x03c * 2)
  991. #define M_HOST_FLAGS5 (0x06a * 2)
  992. #define M_HOST_FLAGS_SZ 16
  993. #define M_RADAR_REG (0x033 * 2)
  994. /* TSSI for last 4 11a OFDM packets transmitted */
  995. #define M_A_TSSI_0 (0x034 * 2)
  996. #define M_A_TSSI_1 (0x035 * 2)
  997. /* noise interference measurement */
  998. #define M_NOISE_IF_COUNT (0x034 * 2)
  999. #define M_NOISE_IF_TIMEOUT (0x035 * 2)
  1000. #define M_RF_RX_SP_REG1 (0x036 * 2)
  1001. /* TSSI for last 4 11g OFDM packets transmitted */
  1002. #define M_G_TSSI_0 (0x038 * 2)
  1003. #define M_G_TSSI_1 (0x039 * 2)
  1004. /* Background noise measure */
  1005. #define M_JSSI_0 (0x44 * 2)
  1006. #define M_JSSI_1 (0x45 * 2)
  1007. #define M_JSSI_AUX (0x46 * 2)
  1008. #define M_CUR_2050_RADIOCODE (0x47 * 2)
  1009. /* TX fifo sizes */
  1010. #define M_FIFOSIZE0 (0x4c * 2)
  1011. #define M_FIFOSIZE1 (0x4d * 2)
  1012. #define M_FIFOSIZE2 (0x4e * 2)
  1013. #define M_FIFOSIZE3 (0x4f * 2)
  1014. #define D11_MAX_TX_FRMS 32 /* max frames allowed in tx fifo */
  1015. /* Current channel number plus upper bits */
  1016. #define M_CURCHANNEL (0x50 * 2)
  1017. #define D11_CURCHANNEL_5G 0x0100;
  1018. #define D11_CURCHANNEL_40 0x0200;
  1019. #define D11_CURCHANNEL_MAX 0x00FF;
  1020. /* last posted frameid on the bcmc fifo */
  1021. #define M_BCMC_FID (0x54 * 2)
  1022. #define INVALIDFID 0xffff
  1023. /* extended beacon phyctl bytes for 11N */
  1024. #define M_BCN_PCTL1WD (0x058 * 2)
  1025. /* idle busy ratio to duty_cycle requirement */
  1026. #define M_TX_IDLE_BUSY_RATIO_X_16_CCK (0x52 * 2)
  1027. #define M_TX_IDLE_BUSY_RATIO_X_16_OFDM (0x5A * 2)
  1028. /* CW RSSI for LCNPHY */
  1029. #define M_LCN_RSSI_0 0x1332
  1030. #define M_LCN_RSSI_1 0x1338
  1031. #define M_LCN_RSSI_2 0x133e
  1032. #define M_LCN_RSSI_3 0x1344
  1033. /* SNR for LCNPHY */
  1034. #define M_LCN_SNR_A_0 0x1334
  1035. #define M_LCN_SNR_B_0 0x1336
  1036. #define M_LCN_SNR_A_1 0x133a
  1037. #define M_LCN_SNR_B_1 0x133c
  1038. #define M_LCN_SNR_A_2 0x1340
  1039. #define M_LCN_SNR_B_2 0x1342
  1040. #define M_LCN_SNR_A_3 0x1346
  1041. #define M_LCN_SNR_B_3 0x1348
  1042. #define M_LCN_LAST_RESET (81*2)
  1043. #define M_LCN_LAST_LOC (63*2)
  1044. #define M_LCNPHY_RESET_STATUS (4902)
  1045. #define M_LCNPHY_DSC_TIME (0x98d*2)
  1046. #define M_LCNPHY_RESET_CNT_DSC (0x98b*2)
  1047. #define M_LCNPHY_RESET_CNT (0x98c*2)
  1048. /* Rate table offsets */
  1049. #define M_RT_DIRMAP_A (0xe0 * 2)
  1050. #define M_RT_BBRSMAP_A (0xf0 * 2)
  1051. #define M_RT_DIRMAP_B (0x100 * 2)
  1052. #define M_RT_BBRSMAP_B (0x110 * 2)
  1053. /* Rate table entry offsets */
  1054. #define M_RT_PRS_PLCP_POS 10
  1055. #define M_RT_PRS_DUR_POS 16
  1056. #define M_RT_OFDM_PCTL1_POS 18
  1057. #define M_20IN40_IQ (0x380 * 2)
  1058. /* SHM locations where ucode stores the current power index */
  1059. #define M_CURR_IDX1 (0x384 * 2)
  1060. #define M_CURR_IDX2 (0x387 * 2)
  1061. #define M_BSCALE_ANT0 (0x5e * 2)
  1062. #define M_BSCALE_ANT1 (0x5f * 2)
  1063. /* Antenna Diversity Testing */
  1064. #define M_MIMO_ANTSEL_RXDFLT (0x63 * 2)
  1065. #define M_ANTSEL_CLKDIV (0x61 * 2)
  1066. #define M_MIMO_ANTSEL_TXDFLT (0x64 * 2)
  1067. #define M_MIMO_MAXSYM (0x5d * 2)
  1068. #define MIMO_MAXSYM_DEF 0x8000 /* 32k */
  1069. #define MIMO_MAXSYM_MAX 0xffff /* 64k */
  1070. #define M_WATCHDOG_8TU (0x1e * 2)
  1071. #define WATCHDOG_8TU_DEF 5
  1072. #define WATCHDOG_8TU_MAX 10
  1073. /* Manufacturing Test Variables */
  1074. /* PER test mode */
  1075. #define M_PKTENG_CTRL (0x6c * 2)
  1076. /* IFS for TX mode */
  1077. #define M_PKTENG_IFS (0x6d * 2)
  1078. /* Lower word of tx frmcnt/rx lostcnt */
  1079. #define M_PKTENG_FRMCNT_LO (0x6e * 2)
  1080. /* Upper word of tx frmcnt/rx lostcnt */
  1081. #define M_PKTENG_FRMCNT_HI (0x6f * 2)
  1082. /* Index variation in vbat ripple */
  1083. #define M_LCN_PWR_IDX_MAX (0x67 * 2) /* highest index read by ucode */
  1084. #define M_LCN_PWR_IDX_MIN (0x66 * 2) /* lowest index read by ucode */
  1085. /* M_PKTENG_CTRL bit definitions */
  1086. #define M_PKTENG_MODE_TX 0x0001
  1087. #define M_PKTENG_MODE_TX_RIFS 0x0004
  1088. #define M_PKTENG_MODE_TX_CTS 0x0008
  1089. #define M_PKTENG_MODE_RX 0x0002
  1090. #define M_PKTENG_MODE_RX_WITH_ACK 0x0402
  1091. #define M_PKTENG_MODE_MASK 0x0003
  1092. /* TX frames indicated in the frmcnt reg */
  1093. #define M_PKTENG_FRMCNT_VLD 0x0100
  1094. /* Sample Collect parameters (bitmap and type) */
  1095. /* Trigger bitmap for sample collect */
  1096. #define M_SMPL_COL_BMP (0x37d * 2)
  1097. /* Sample collect type */
  1098. #define M_SMPL_COL_CTL (0x3b2 * 2)
  1099. #define ANTSEL_CLKDIV_4MHZ 6
  1100. #define MIMO_ANTSEL_BUSY 0x4000 /* bit 14 (busy) */
  1101. #define MIMO_ANTSEL_SEL 0x8000 /* bit 15 write the value */
  1102. #define MIMO_ANTSEL_WAIT 50 /* 50us wait */
  1103. #define MIMO_ANTSEL_OVERRIDE 0x8000 /* flag */
  1104. struct shm_acparams {
  1105. u16 txop;
  1106. u16 cwmin;
  1107. u16 cwmax;
  1108. u16 cwcur;
  1109. u16 aifs;
  1110. u16 bslots;
  1111. u16 reggap;
  1112. u16 status;
  1113. u16 rsvd[8];
  1114. } __packed;
  1115. #define M_EDCF_QLEN (16 * 2)
  1116. #define WME_STATUS_NEWAC (1 << 8)
  1117. /* M_HOST_FLAGS */
  1118. #define MHFMAX 5 /* Number of valid hostflag half-word (u16) */
  1119. #define MHF1 0 /* Hostflag 1 index */
  1120. #define MHF2 1 /* Hostflag 2 index */
  1121. #define MHF3 2 /* Hostflag 3 index */
  1122. #define MHF4 3 /* Hostflag 4 index */
  1123. #define MHF5 4 /* Hostflag 5 index */
  1124. /* Flags in M_HOST_FLAGS */
  1125. /* Enable ucode antenna diversity help */
  1126. #define MHF1_ANTDIV 0x0001
  1127. /* Enable EDCF access control */
  1128. #define MHF1_EDCF 0x0100
  1129. #define MHF1_IQSWAP_WAR 0x0200
  1130. /* Disable Slow clock request, for corerev < 11 */
  1131. #define MHF1_FORCEFASTCLK 0x0400
  1132. /* Flags in M_HOST_FLAGS2 */
  1133. /* Flush BCMC FIFO immediately */
  1134. #define MHF2_TXBCMC_NOW 0x0040
  1135. /* Enable ucode/hw power control */
  1136. #define MHF2_HWPWRCTL 0x0080
  1137. #define MHF2_NPHY40MHZ_WAR 0x0800
  1138. /* Flags in M_HOST_FLAGS3 */
  1139. /* enabled mimo antenna selection */
  1140. #define MHF3_ANTSEL_EN 0x0001
  1141. /* antenna selection mode: 0: 2x3, 1: 2x4 */
  1142. #define MHF3_ANTSEL_MODE 0x0002
  1143. #define MHF3_RESERVED1 0x0004
  1144. #define MHF3_RESERVED2 0x0008
  1145. #define MHF3_NPHY_MLADV_WAR 0x0010
  1146. /* Flags in M_HOST_FLAGS4 */
  1147. /* force bphy Tx on core 0 (board level WAR) */
  1148. #define MHF4_BPHY_TXCORE0 0x0080
  1149. /* for 4313A0 FEM boards */
  1150. #define MHF4_EXTPA_ENABLE 0x4000
  1151. /* Flags in M_HOST_FLAGS5 */
  1152. #define MHF5_4313_GPIOCTRL 0x0001
  1153. #define MHF5_RESERVED1 0x0002
  1154. #define MHF5_RESERVED2 0x0004
  1155. /* Radio power setting for ucode */
  1156. #define M_RADIO_PWR (0x32 * 2)
  1157. /* phy noise recorded by ucode right after tx */
  1158. #define M_PHY_NOISE (0x037 * 2)
  1159. #define PHY_NOISE_MASK 0x00ff
  1160. /*
  1161. * Receive Frame Data Header for 802.11b DCF-only frames
  1162. *
  1163. * RxFrameSize: Actual byte length of the frame data received
  1164. * PAD: padding (not used)
  1165. * PhyRxStatus_0: PhyRxStatus 15:0
  1166. * PhyRxStatus_1: PhyRxStatus 31:16
  1167. * PhyRxStatus_2: PhyRxStatus 47:32
  1168. * PhyRxStatus_3: PhyRxStatus 63:48
  1169. * PhyRxStatus_4: PhyRxStatus 79:64
  1170. * PhyRxStatus_5: PhyRxStatus 95:80
  1171. * RxStatus1: MAC Rx Status
  1172. * RxStatus2: extended MAC Rx status
  1173. * RxTSFTime: RxTSFTime time of first MAC symbol + M_PHY_PLCPRX_DLY
  1174. * RxChan: gain code, channel radio code, and phy type
  1175. */
  1176. struct d11rxhdr_le {
  1177. __le16 RxFrameSize;
  1178. u16 PAD;
  1179. __le16 PhyRxStatus_0;
  1180. __le16 PhyRxStatus_1;
  1181. __le16 PhyRxStatus_2;
  1182. __le16 PhyRxStatus_3;
  1183. __le16 PhyRxStatus_4;
  1184. __le16 PhyRxStatus_5;
  1185. __le16 RxStatus1;
  1186. __le16 RxStatus2;
  1187. __le16 RxTSFTime;
  1188. __le16 RxChan;
  1189. } __packed;
  1190. struct d11rxhdr {
  1191. u16 RxFrameSize;
  1192. u16 PAD;
  1193. u16 PhyRxStatus_0;
  1194. u16 PhyRxStatus_1;
  1195. u16 PhyRxStatus_2;
  1196. u16 PhyRxStatus_3;
  1197. u16 PhyRxStatus_4;
  1198. u16 PhyRxStatus_5;
  1199. u16 RxStatus1;
  1200. u16 RxStatus2;
  1201. u16 RxTSFTime;
  1202. u16 RxChan;
  1203. } __packed;
  1204. /* PhyRxStatus_0: */
  1205. /* NPHY only: CCK, OFDM, preN, N */
  1206. #define PRXS0_FT_MASK 0x0003
  1207. /* NPHY only: clip count adjustment steps by AGC */
  1208. #define PRXS0_CLIP_MASK 0x000C
  1209. #define PRXS0_CLIP_SHIFT 2
  1210. /* PHY received a frame with unsupported rate */
  1211. #define PRXS0_UNSRATE 0x0010
  1212. /* GPHY: rx ant, NPHY: upper sideband */
  1213. #define PRXS0_RXANT_UPSUBBAND 0x0020
  1214. /* CCK frame only: lost crs during cck frame reception */
  1215. #define PRXS0_LCRS 0x0040
  1216. /* Short Preamble */
  1217. #define PRXS0_SHORTH 0x0080
  1218. /* PLCP violation */
  1219. #define PRXS0_PLCPFV 0x0100
  1220. /* PLCP header integrity check failed */
  1221. #define PRXS0_PLCPHCF 0x0200
  1222. /* legacy PHY gain control */
  1223. #define PRXS0_GAIN_CTL 0x4000
  1224. /* NPHY: Antennas used for received frame, bitmask */
  1225. #define PRXS0_ANTSEL_MASK 0xF000
  1226. #define PRXS0_ANTSEL_SHIFT 0x12
  1227. /* subfield PRXS0_FT_MASK */
  1228. #define PRXS0_CCK 0x0000
  1229. /* valid only for G phy, use rxh->RxChan for A phy */
  1230. #define PRXS0_OFDM 0x0001
  1231. #define PRXS0_PREN 0x0002
  1232. #define PRXS0_STDN 0x0003
  1233. /* subfield PRXS0_ANTSEL_MASK */
  1234. #define PRXS0_ANTSEL_0 0x0 /* antenna 0 is used */
  1235. #define PRXS0_ANTSEL_1 0x2 /* antenna 1 is used */
  1236. #define PRXS0_ANTSEL_2 0x4 /* antenna 2 is used */
  1237. #define PRXS0_ANTSEL_3 0x8 /* antenna 3 is used */
  1238. /* PhyRxStatus_1: */
  1239. #define PRXS1_JSSI_MASK 0x00FF
  1240. #define PRXS1_JSSI_SHIFT 0
  1241. #define PRXS1_SQ_MASK 0xFF00
  1242. #define PRXS1_SQ_SHIFT 8
  1243. /* nphy PhyRxStatus_1: */
  1244. #define PRXS1_nphy_PWR0_MASK 0x00FF
  1245. #define PRXS1_nphy_PWR1_MASK 0xFF00
  1246. /* HTPHY Rx Status defines */
  1247. /* htphy PhyRxStatus_0: those bit are overlapped with PhyRxStatus_0 */
  1248. #define PRXS0_BAND 0x0400 /* 0 = 2.4G, 1 = 5G */
  1249. #define PRXS0_RSVD 0x0800 /* reserved; set to 0 */
  1250. #define PRXS0_UNUSED 0xF000 /* unused and not defined; set to 0 */
  1251. /* htphy PhyRxStatus_1: */
  1252. /* core enables for {3..0}, 0=disabled, 1=enabled */
  1253. #define PRXS1_HTPHY_CORE_MASK 0x000F
  1254. /* antenna configation */
  1255. #define PRXS1_HTPHY_ANTCFG_MASK 0x00F0
  1256. /* Mixmode PLCP Length low byte mask */
  1257. #define PRXS1_HTPHY_MMPLCPLenL_MASK 0xFF00
  1258. /* htphy PhyRxStatus_2: */
  1259. /* Mixmode PLCP Length high byte maskw */
  1260. #define PRXS2_HTPHY_MMPLCPLenH_MASK 0x000F
  1261. /* Mixmode PLCP rate mask */
  1262. #define PRXS2_HTPHY_MMPLCH_RATE_MASK 0x00F0
  1263. /* Rx power on core 0 */
  1264. #define PRXS2_HTPHY_RXPWR_ANT0 0xFF00
  1265. /* htphy PhyRxStatus_3: */
  1266. /* Rx power on core 1 */
  1267. #define PRXS3_HTPHY_RXPWR_ANT1 0x00FF
  1268. /* Rx power on core 2 */
  1269. #define PRXS3_HTPHY_RXPWR_ANT2 0xFF00
  1270. /* htphy PhyRxStatus_4: */
  1271. /* Rx power on core 3 */
  1272. #define PRXS4_HTPHY_RXPWR_ANT3 0x00FF
  1273. /* Coarse frequency offset */
  1274. #define PRXS4_HTPHY_CFO 0xFF00
  1275. /* htphy PhyRxStatus_5: */
  1276. /* Fine frequency offset */
  1277. #define PRXS5_HTPHY_FFO 0x00FF
  1278. /* Advance Retard */
  1279. #define PRXS5_HTPHY_AR 0xFF00
  1280. #define HTPHY_MMPLCPLen(rxs) \
  1281. ((((rxs)->PhyRxStatus_1 & PRXS1_HTPHY_MMPLCPLenL_MASK) >> 8) | \
  1282. (((rxs)->PhyRxStatus_2 & PRXS2_HTPHY_MMPLCPLenH_MASK) << 8))
  1283. /* Get Rx power on core 0 */
  1284. #define HTPHY_RXPWR_ANT0(rxs) \
  1285. ((((rxs)->PhyRxStatus_2) & PRXS2_HTPHY_RXPWR_ANT0) >> 8)
  1286. /* Get Rx power on core 1 */
  1287. #define HTPHY_RXPWR_ANT1(rxs) \
  1288. (((rxs)->PhyRxStatus_3) & PRXS3_HTPHY_RXPWR_ANT1)
  1289. /* Get Rx power on core 2 */
  1290. #define HTPHY_RXPWR_ANT2(rxs) \
  1291. ((((rxs)->PhyRxStatus_3) & PRXS3_HTPHY_RXPWR_ANT2) >> 8)
  1292. /* ucode RxStatus1: */
  1293. #define RXS_BCNSENT 0x8000
  1294. #define RXS_SECKINDX_MASK 0x07e0
  1295. #define RXS_SECKINDX_SHIFT 5
  1296. #define RXS_DECERR (1 << 4)
  1297. #define RXS_DECATMPT (1 << 3)
  1298. /* PAD bytes to make IP data 4 bytes aligned */
  1299. #define RXS_PBPRES (1 << 2)
  1300. #define RXS_RESPFRAMETX (1 << 1)
  1301. #define RXS_FCSERR (1 << 0)
  1302. /* ucode RxStatus2: */
  1303. #define RXS_AMSDU_MASK 1
  1304. #define RXS_AGGTYPE_MASK 0x6
  1305. #define RXS_AGGTYPE_SHIFT 1
  1306. #define RXS_PHYRXST_VALID (1 << 8)
  1307. #define RXS_RXANT_MASK 0x3
  1308. #define RXS_RXANT_SHIFT 12
  1309. /* RxChan */
  1310. #define RXS_CHAN_40 0x1000
  1311. #define RXS_CHAN_5G 0x0800
  1312. #define RXS_CHAN_ID_MASK 0x07f8
  1313. #define RXS_CHAN_ID_SHIFT 3
  1314. #define RXS_CHAN_PHYTYPE_MASK 0x0007
  1315. #define RXS_CHAN_PHYTYPE_SHIFT 0
  1316. /* Index of attenuations used during ucode power control. */
  1317. #define M_PWRIND_BLKS (0x184 * 2)
  1318. #define M_PWRIND_MAP0 (M_PWRIND_BLKS + 0x0)
  1319. #define M_PWRIND_MAP1 (M_PWRIND_BLKS + 0x2)
  1320. #define M_PWRIND_MAP2 (M_PWRIND_BLKS + 0x4)
  1321. #define M_PWRIND_MAP3 (M_PWRIND_BLKS + 0x6)
  1322. /* M_PWRIND_MAP(core) macro */
  1323. #define M_PWRIND_MAP(core) (M_PWRIND_BLKS + ((core)<<1))
  1324. /* PSM SHM variable offsets */
  1325. #define M_PSM_SOFT_REGS 0x0
  1326. #define M_BOM_REV_MAJOR (M_PSM_SOFT_REGS + 0x0)
  1327. #define M_BOM_REV_MINOR (M_PSM_SOFT_REGS + 0x2)
  1328. #define M_UCODE_DBGST (M_PSM_SOFT_REGS + 0x40) /* ucode debug status code */
  1329. #define M_UCODE_MACSTAT (M_PSM_SOFT_REGS + 0xE0) /* macstat counters */
  1330. #define M_AGING_THRSH (0x3e * 2) /* max time waiting for medium before tx */
  1331. #define M_MBURST_SIZE (0x40 * 2) /* max frames in a frameburst */
  1332. #define M_MBURST_TXOP (0x41 * 2) /* max frameburst TXOP in unit of us */
  1333. #define M_SYNTHPU_DLY (0x4a * 2) /* pre-wakeup for synthpu, default: 500 */
  1334. #define M_PRETBTT (0x4b * 2)
  1335. /* offset to the target txpwr */
  1336. #define M_ALT_TXPWR_IDX (M_PSM_SOFT_REGS + (0x3b * 2))
  1337. #define M_PHY_TX_FLT_PTR (M_PSM_SOFT_REGS + (0x3d * 2))
  1338. #define M_CTS_DURATION (M_PSM_SOFT_REGS + (0x5c * 2))
  1339. #define M_LP_RCCAL_OVR (M_PSM_SOFT_REGS + (0x6b * 2))
  1340. /* PKTENG Rx Stats Block */
  1341. #define M_RXSTATS_BLK_PTR (M_PSM_SOFT_REGS + (0x65 * 2))
  1342. /* ucode debug status codes */
  1343. /* not valid really */
  1344. #define DBGST_INACTIVE 0
  1345. /* after zeroing SHM, before suspending at init */
  1346. #define DBGST_INIT 1
  1347. /* "normal" state */
  1348. #define DBGST_ACTIVE 2
  1349. /* suspended */
  1350. #define DBGST_SUSPENDED 3
  1351. /* asleep (PS mode) */
  1352. #define DBGST_ASLEEP 4
  1353. /* Scratch Reg defs */
  1354. enum _ePsmScratchPadRegDefinitions {
  1355. S_RSV0 = 0,
  1356. S_RSV1,
  1357. S_RSV2,
  1358. /* offset 0x03: scratch registers for Dot11-contants */
  1359. S_DOT11_CWMIN, /* CW-minimum */
  1360. S_DOT11_CWMAX, /* CW-maximum */
  1361. S_DOT11_CWCUR, /* CW-current */
  1362. S_DOT11_SRC_LMT, /* short retry count limit */
  1363. S_DOT11_LRC_LMT, /* long retry count limit */
  1364. S_DOT11_DTIMCOUNT, /* DTIM-count */
  1365. /* offset 0x09: Tx-side scratch registers */
  1366. S_SEQ_NUM, /* hardware sequence number reg */
  1367. S_SEQ_NUM_FRAG, /* seq num for frags (at the start of MSDU) */
  1368. S_FRMRETX_CNT, /* frame retx count */
  1369. S_SSRC, /* Station short retry count */
  1370. S_SLRC, /* Station long retry count */
  1371. S_EXP_RSP, /* Expected response frame */
  1372. S_OLD_BREM, /* Remaining backoff ctr */
  1373. S_OLD_CWWIN, /* saved-off CW-cur */
  1374. S_TXECTL, /* TXE-Ctl word constructed in scr-pad */
  1375. S_CTXTST, /* frm type-subtype as read from Tx-descr */
  1376. /* offset 0x13: Rx-side scratch registers */
  1377. S_RXTST, /* Type and subtype in Rxframe */
  1378. /* Global state register */
  1379. S_STREG, /* state storage actual bit maps below */
  1380. S_TXPWR_SUM, /* Tx power control: accumulator */
  1381. S_TXPWR_ITER, /* Tx power control: iteration */
  1382. S_RX_FRMTYPE, /* Rate and PHY type for frames */
  1383. S_THIS_AGG, /* Size of this AGG (A-MSDU) */
  1384. S_KEYINDX,
  1385. S_RXFRMLEN, /* Receive MPDU length in bytes */
  1386. /* offset 0x1B: Receive TSF time stored in SCR */
  1387. S_RXTSFTMRVAL_WD3, /* TSF value at the start of rx */
  1388. S_RXTSFTMRVAL_WD2, /* TSF value at the start of rx */
  1389. S_RXTSFTMRVAL_WD1, /* TSF value at the start of rx */
  1390. S_RXTSFTMRVAL_WD0, /* TSF value at the start of rx */
  1391. S_RXSSN, /* Received start seq number for A-MPDU BA */
  1392. S_RXQOSFLD, /* Rx-QoS field (if present) */
  1393. /* offset 0x21: Scratch pad regs used in microcode as temp storage */
  1394. S_TMP0, /* stmp0 */
  1395. S_TMP1, /* stmp1 */
  1396. S_TMP2, /* stmp2 */
  1397. S_TMP3, /* stmp3 */
  1398. S_TMP4, /* stmp4 */
  1399. S_TMP5, /* stmp5 */
  1400. S_PRQPENALTY_CTR, /* Probe response queue penalty counter */
  1401. S_ANTCNT, /* unsuccessful attempts on current ant. */
  1402. S_SYMBOL, /* flag for possible symbol ctl frames */
  1403. S_RXTP, /* rx frame type */
  1404. S_STREG2, /* extra state storage */
  1405. S_STREG3, /* even more extra state storage */
  1406. S_STREG4, /* ... */
  1407. S_STREG5, /* remember to initialize it to zero */
  1408. S_ADJPWR_IDX,
  1409. S_CUR_PTR, /* Temp pointer for A-MPDU re-Tx SHM table */
  1410. S_REVID4, /* 0x33 */
  1411. S_INDX, /* 0x34 */
  1412. S_ADDR0, /* 0x35 */
  1413. S_ADDR1, /* 0x36 */
  1414. S_ADDR2, /* 0x37 */
  1415. S_ADDR3, /* 0x38 */
  1416. S_ADDR4, /* 0x39 */
  1417. S_ADDR5, /* 0x3A */
  1418. S_TMP6, /* 0x3B */
  1419. S_KEYINDX_BU, /* Backup for Key index */
  1420. S_MFGTEST_TMP0, /* Temp regs used for RX test calculations */
  1421. S_RXESN, /* Received end sequence number for A-MPDU BA */
  1422. S_STREG6, /* 0x3F */
  1423. };
  1424. #define S_BEACON_INDX S_OLD_BREM
  1425. #define S_PRS_INDX S_OLD_CWWIN
  1426. #define S_PHYTYPE S_SSRC
  1427. #define S_PHYVER S_SLRC
  1428. /* IHR SLOW_CTRL values */
  1429. #define SLOW_CTRL_PDE (1 << 0)
  1430. #define SLOW_CTRL_FD (1 << 8)
  1431. /* ucode mac statistic counters in shared memory */
  1432. struct macstat {
  1433. u16 txallfrm; /* 0x80 */
  1434. u16 txrtsfrm; /* 0x82 */
  1435. u16 txctsfrm; /* 0x84 */
  1436. u16 txackfrm; /* 0x86 */
  1437. u16 txdnlfrm; /* 0x88 */
  1438. u16 txbcnfrm; /* 0x8a */
  1439. u16 txfunfl[8]; /* 0x8c - 0x9b */
  1440. u16 txtplunfl; /* 0x9c */
  1441. u16 txphyerr; /* 0x9e */
  1442. u16 pktengrxducast; /* 0xa0 */
  1443. u16 pktengrxdmcast; /* 0xa2 */
  1444. u16 rxfrmtoolong; /* 0xa4 */
  1445. u16 rxfrmtooshrt; /* 0xa6 */
  1446. u16 rxinvmachdr; /* 0xa8 */
  1447. u16 rxbadfcs; /* 0xaa */
  1448. u16 rxbadplcp; /* 0xac */
  1449. u16 rxcrsglitch; /* 0xae */
  1450. u16 rxstrt; /* 0xb0 */
  1451. u16 rxdfrmucastmbss; /* 0xb2 */
  1452. u16 rxmfrmucastmbss; /* 0xb4 */
  1453. u16 rxcfrmucast; /* 0xb6 */
  1454. u16 rxrtsucast; /* 0xb8 */
  1455. u16 rxctsucast; /* 0xba */
  1456. u16 rxackucast; /* 0xbc */
  1457. u16 rxdfrmocast; /* 0xbe */
  1458. u16 rxmfrmocast; /* 0xc0 */
  1459. u16 rxcfrmocast; /* 0xc2 */
  1460. u16 rxrtsocast; /* 0xc4 */
  1461. u16 rxctsocast; /* 0xc6 */
  1462. u16 rxdfrmmcast; /* 0xc8 */
  1463. u16 rxmfrmmcast; /* 0xca */
  1464. u16 rxcfrmmcast; /* 0xcc */
  1465. u16 rxbeaconmbss; /* 0xce */
  1466. u16 rxdfrmucastobss; /* 0xd0 */
  1467. u16 rxbeaconobss; /* 0xd2 */
  1468. u16 rxrsptmout; /* 0xd4 */
  1469. u16 bcntxcancl; /* 0xd6 */
  1470. u16 PAD;
  1471. u16 rxf0ovfl; /* 0xda */
  1472. u16 rxf1ovfl; /* 0xdc */
  1473. u16 rxf2ovfl; /* 0xde */
  1474. u16 txsfovfl; /* 0xe0 */
  1475. u16 pmqovfl; /* 0xe2 */
  1476. u16 rxcgprqfrm; /* 0xe4 */
  1477. u16 rxcgprsqovfl; /* 0xe6 */
  1478. u16 txcgprsfail; /* 0xe8 */
  1479. u16 txcgprssuc; /* 0xea */
  1480. u16 prs_timeout; /* 0xec */
  1481. u16 rxnack;
  1482. u16 frmscons;
  1483. u16 txnack;
  1484. u16 txglitch_nack;
  1485. u16 txburst; /* 0xf6 # tx bursts */
  1486. u16 bphy_rxcrsglitch; /* bphy rx crs glitch */
  1487. u16 phywatchdog; /* 0xfa # of phy watchdog events */
  1488. u16 PAD;
  1489. u16 bphy_badplcp; /* bphy bad plcp */
  1490. };
  1491. /* dot11 core-specific control flags */
  1492. #define SICF_PCLKE 0x0004 /* PHY clock enable */
  1493. #define SICF_PRST 0x0008 /* PHY reset */
  1494. #define SICF_MPCLKE 0x0010 /* MAC PHY clockcontrol enable */
  1495. #define SICF_FREF 0x0020 /* PLL FreqRefSelect */
  1496. /* NOTE: the following bw bits only apply when the core is attached
  1497. * to a NPHY
  1498. */
  1499. #define SICF_BWMASK 0x00c0 /* phy clock mask (b6 & b7) */
  1500. #define SICF_BW40 0x0080 /* 40MHz BW (160MHz phyclk) */
  1501. #define SICF_BW20 0x0040 /* 20MHz BW (80MHz phyclk) */
  1502. #define SICF_BW10 0x0000 /* 10MHz BW (40MHz phyclk) */
  1503. #define SICF_GMODE 0x2000 /* gmode enable */
  1504. /* dot11 core-specific status flags */
  1505. #define SISF_2G_PHY 0x0001 /* 2.4G capable phy */
  1506. #define SISF_5G_PHY 0x0002 /* 5G capable phy */
  1507. #define SISF_FCLKA 0x0004 /* FastClkAvailable */
  1508. #define SISF_DB_PHY 0x0008 /* Dualband phy */
  1509. /* === End of MAC reg, Beginning of PHY(b/a/g/n) reg === */
  1510. /* radio and LPPHY regs are separated */
  1511. #define BPHY_REG_OFT_BASE 0x0
  1512. /* offsets for indirect access to bphy registers */
  1513. #define BPHY_BB_CONFIG 0x01
  1514. #define BPHY_ADCBIAS 0x02
  1515. #define BPHY_ANACORE 0x03
  1516. #define BPHY_PHYCRSTH 0x06
  1517. #define BPHY_TEST 0x0a
  1518. #define BPHY_PA_TX_TO 0x10
  1519. #define BPHY_SYNTH_DC_TO 0x11
  1520. #define BPHY_PA_TX_TIME_UP 0x12
  1521. #define BPHY_RX_FLTR_TIME_UP 0x13
  1522. #define BPHY_TX_POWER_OVERRIDE 0x14
  1523. #define BPHY_RF_OVERRIDE 0x15
  1524. #define BPHY_RF_TR_LOOKUP1 0x16
  1525. #define BPHY_RF_TR_LOOKUP2 0x17
  1526. #define BPHY_COEFFS 0x18
  1527. #define BPHY_PLL_OUT 0x19
  1528. #define BPHY_REFRESH_MAIN 0x1a
  1529. #define BPHY_REFRESH_TO0 0x1b
  1530. #define BPHY_REFRESH_TO1 0x1c
  1531. #define BPHY_RSSI_TRESH 0x20
  1532. #define BPHY_IQ_TRESH_HH 0x21
  1533. #define BPHY_IQ_TRESH_H 0x22
  1534. #define BPHY_IQ_TRESH_L 0x23
  1535. #define BPHY_IQ_TRESH_LL 0x24
  1536. #define BPHY_GAIN 0x25
  1537. #define BPHY_LNA_GAIN_RANGE 0x26
  1538. #define BPHY_JSSI 0x27
  1539. #define BPHY_TSSI_CTL 0x28
  1540. #define BPHY_TSSI 0x29
  1541. #define BPHY_TR_LOSS_CTL 0x2a
  1542. #define BPHY_LO_LEAKAGE 0x2b
  1543. #define BPHY_LO_RSSI_ACC 0x2c
  1544. #define BPHY_LO_IQMAG_ACC 0x2d
  1545. #define BPHY_TX_DC_OFF1 0x2e
  1546. #define BPHY_TX_DC_OFF2 0x2f
  1547. #define BPHY_PEAK_CNT_THRESH 0x30
  1548. #define BPHY_FREQ_OFFSET 0x31
  1549. #define BPHY_DIVERSITY_CTL 0x32
  1550. #define BPHY_PEAK_ENERGY_LO 0x33
  1551. #define BPHY_PEAK_ENERGY_HI 0x34
  1552. #define BPHY_SYNC_CTL 0x35
  1553. #define BPHY_TX_PWR_CTRL 0x36
  1554. #define BPHY_TX_EST_PWR 0x37
  1555. #define BPHY_STEP 0x38
  1556. #define BPHY_WARMUP 0x39
  1557. #define BPHY_LMS_CFF_READ 0x3a
  1558. #define BPHY_LMS_COEFF_I 0x3b
  1559. #define BPHY_LMS_COEFF_Q 0x3c
  1560. #define BPHY_SIG_POW 0x3d
  1561. #define BPHY_RFDC_CANCEL_CTL 0x3e
  1562. #define BPHY_HDR_TYPE 0x40
  1563. #define BPHY_SFD_TO 0x41
  1564. #define BPHY_SFD_CTL 0x42
  1565. #define BPHY_DEBUG 0x43
  1566. #define BPHY_RX_DELAY_COMP 0x44
  1567. #define BPHY_CRS_DROP_TO 0x45
  1568. #define BPHY_SHORT_SFD_NZEROS 0x46
  1569. #define BPHY_DSSS_COEFF1 0x48
  1570. #define BPHY_DSSS_COEFF2 0x49
  1571. #define BPHY_CCK_COEFF1 0x4a
  1572. #define BPHY_CCK_COEFF2 0x4b
  1573. #define BPHY_TR_CORR 0x4c
  1574. #define BPHY_ANGLE_SCALE 0x4d
  1575. #define BPHY_TX_PWR_BASE_IDX 0x4e
  1576. #define BPHY_OPTIONAL_MODES2 0x4f
  1577. #define BPHY_CCK_LMS_STEP 0x50
  1578. #define BPHY_BYPASS 0x51
  1579. #define BPHY_CCK_DELAY_LONG 0x52
  1580. #define BPHY_CCK_DELAY_SHORT 0x53
  1581. #define BPHY_PPROC_CHAN_DELAY 0x54
  1582. #define BPHY_DDFS_ENABLE 0x58
  1583. #define BPHY_PHASE_SCALE 0x59
  1584. #define BPHY_FREQ_CONTROL 0x5a
  1585. #define BPHY_LNA_GAIN_RANGE_10 0x5b
  1586. #define BPHY_LNA_GAIN_RANGE_32 0x5c
  1587. #define BPHY_OPTIONAL_MODES 0x5d
  1588. #define BPHY_RX_STATUS2 0x5e
  1589. #define BPHY_RX_STATUS3 0x5f
  1590. #define BPHY_DAC_CONTROL 0x60
  1591. #define BPHY_ANA11G_FILT_CTRL 0x62
  1592. #define BPHY_REFRESH_CTRL 0x64
  1593. #define BPHY_RF_OVERRIDE2 0x65
  1594. #define BPHY_SPUR_CANCEL_CTRL 0x66
  1595. #define BPHY_FINE_DIGIGAIN_CTRL 0x67
  1596. #define BPHY_RSSI_LUT 0x88
  1597. #define BPHY_RSSI_LUT_END 0xa7
  1598. #define BPHY_TSSI_LUT 0xa8
  1599. #define BPHY_TSSI_LUT_END 0xc7
  1600. #define BPHY_TSSI2PWR_LUT 0x380
  1601. #define BPHY_TSSI2PWR_LUT_END 0x39f
  1602. #define BPHY_LOCOMP_LUT 0x3a0
  1603. #define BPHY_LOCOMP_LUT_END 0x3bf
  1604. #define BPHY_TXGAIN_LUT 0x3c0
  1605. #define BPHY_TXGAIN_LUT_END 0x3ff
  1606. /* Bits in BB_CONFIG: */
  1607. #define PHY_BBC_ANT_MASK 0x0180
  1608. #define PHY_BBC_ANT_SHIFT 7
  1609. #define BB_DARWIN 0x1000
  1610. #define BBCFG_RESETCCA 0x4000
  1611. #define BBCFG_RESETRX 0x8000
  1612. /* Bits in phytest(0x0a): */
  1613. #define TST_DDFS 0x2000
  1614. #define TST_TXFILT1 0x0800
  1615. #define TST_UNSCRAM 0x0400
  1616. #define TST_CARR_SUPP 0x0200
  1617. #define TST_DC_COMP_LOOP 0x0100
  1618. #define TST_LOOPBACK 0x0080
  1619. #define TST_TXFILT0 0x0040
  1620. #define TST_TXTEST_ENABLE 0x0020
  1621. #define TST_TXTEST_RATE 0x0018
  1622. #define TST_TXTEST_PHASE 0x0007
  1623. /* phytest txTestRate values */
  1624. #define TST_TXTEST_RATE_1MBPS 0
  1625. #define TST_TXTEST_RATE_2MBPS 1
  1626. #define TST_TXTEST_RATE_5_5MBPS 2
  1627. #define TST_TXTEST_RATE_11MBPS 3
  1628. #define TST_TXTEST_RATE_SHIFT 3
  1629. #define SHM_BYT_CNT 0x2 /* IHR location */
  1630. #define MAX_BYT_CNT 0x600 /* Maximum frame len */
  1631. struct d11cnt {
  1632. u32 txfrag;
  1633. u32 txmulti;
  1634. u32 txfail;
  1635. u32 txretry;
  1636. u32 txretrie;
  1637. u32 rxdup;
  1638. u32 txrts;
  1639. u32 txnocts;
  1640. u32 txnoack;
  1641. u32 rxfrag;
  1642. u32 rxmulti;
  1643. u32 rxcrc;
  1644. u32 txfrmsnt;
  1645. u32 rxundec;
  1646. };
  1647. #endif /* _BRCM_D11_H_ */