hw.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080
  1. /*
  2. * Copyright (c) 2008 Atheros Communications Inc.
  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
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef HW_H
  17. #define HW_H
  18. #include <linux/if_ether.h>
  19. #include <linux/delay.h>
  20. struct ar5416_desc {
  21. u32 ds_link;
  22. u32 ds_data;
  23. u32 ds_ctl0;
  24. u32 ds_ctl1;
  25. union {
  26. struct {
  27. u32 ctl2;
  28. u32 ctl3;
  29. u32 ctl4;
  30. u32 ctl5;
  31. u32 ctl6;
  32. u32 ctl7;
  33. u32 ctl8;
  34. u32 ctl9;
  35. u32 ctl10;
  36. u32 ctl11;
  37. u32 status0;
  38. u32 status1;
  39. u32 status2;
  40. u32 status3;
  41. u32 status4;
  42. u32 status5;
  43. u32 status6;
  44. u32 status7;
  45. u32 status8;
  46. u32 status9;
  47. } tx;
  48. struct {
  49. u32 status0;
  50. u32 status1;
  51. u32 status2;
  52. u32 status3;
  53. u32 status4;
  54. u32 status5;
  55. u32 status6;
  56. u32 status7;
  57. u32 status8;
  58. } rx;
  59. } u;
  60. } __packed;
  61. #define AR5416DESC(_ds) ((struct ar5416_desc *)(_ds))
  62. #define AR5416DESC_CONST(_ds) ((const struct ar5416_desc *)(_ds))
  63. #define ds_ctl2 u.tx.ctl2
  64. #define ds_ctl3 u.tx.ctl3
  65. #define ds_ctl4 u.tx.ctl4
  66. #define ds_ctl5 u.tx.ctl5
  67. #define ds_ctl6 u.tx.ctl6
  68. #define ds_ctl7 u.tx.ctl7
  69. #define ds_ctl8 u.tx.ctl8
  70. #define ds_ctl9 u.tx.ctl9
  71. #define ds_ctl10 u.tx.ctl10
  72. #define ds_ctl11 u.tx.ctl11
  73. #define ds_txstatus0 u.tx.status0
  74. #define ds_txstatus1 u.tx.status1
  75. #define ds_txstatus2 u.tx.status2
  76. #define ds_txstatus3 u.tx.status3
  77. #define ds_txstatus4 u.tx.status4
  78. #define ds_txstatus5 u.tx.status5
  79. #define ds_txstatus6 u.tx.status6
  80. #define ds_txstatus7 u.tx.status7
  81. #define ds_txstatus8 u.tx.status8
  82. #define ds_txstatus9 u.tx.status9
  83. #define ds_rxstatus0 u.rx.status0
  84. #define ds_rxstatus1 u.rx.status1
  85. #define ds_rxstatus2 u.rx.status2
  86. #define ds_rxstatus3 u.rx.status3
  87. #define ds_rxstatus4 u.rx.status4
  88. #define ds_rxstatus5 u.rx.status5
  89. #define ds_rxstatus6 u.rx.status6
  90. #define ds_rxstatus7 u.rx.status7
  91. #define ds_rxstatus8 u.rx.status8
  92. #define AR_FrameLen 0x00000fff
  93. #define AR_VirtMoreFrag 0x00001000
  94. #define AR_TxCtlRsvd00 0x0000e000
  95. #define AR_XmitPower 0x003f0000
  96. #define AR_XmitPower_S 16
  97. #define AR_RTSEnable 0x00400000
  98. #define AR_VEOL 0x00800000
  99. #define AR_ClrDestMask 0x01000000
  100. #define AR_TxCtlRsvd01 0x1e000000
  101. #define AR_TxIntrReq 0x20000000
  102. #define AR_DestIdxValid 0x40000000
  103. #define AR_CTSEnable 0x80000000
  104. #define AR_BufLen 0x00000fff
  105. #define AR_TxMore 0x00001000
  106. #define AR_DestIdx 0x000fe000
  107. #define AR_DestIdx_S 13
  108. #define AR_FrameType 0x00f00000
  109. #define AR_FrameType_S 20
  110. #define AR_NoAck 0x01000000
  111. #define AR_InsertTS 0x02000000
  112. #define AR_CorruptFCS 0x04000000
  113. #define AR_ExtOnly 0x08000000
  114. #define AR_ExtAndCtl 0x10000000
  115. #define AR_MoreAggr 0x20000000
  116. #define AR_IsAggr 0x40000000
  117. #define AR_BurstDur 0x00007fff
  118. #define AR_BurstDur_S 0
  119. #define AR_DurUpdateEna 0x00008000
  120. #define AR_XmitDataTries0 0x000f0000
  121. #define AR_XmitDataTries0_S 16
  122. #define AR_XmitDataTries1 0x00f00000
  123. #define AR_XmitDataTries1_S 20
  124. #define AR_XmitDataTries2 0x0f000000
  125. #define AR_XmitDataTries2_S 24
  126. #define AR_XmitDataTries3 0xf0000000
  127. #define AR_XmitDataTries3_S 28
  128. #define AR_XmitRate0 0x000000ff
  129. #define AR_XmitRate0_S 0
  130. #define AR_XmitRate1 0x0000ff00
  131. #define AR_XmitRate1_S 8
  132. #define AR_XmitRate2 0x00ff0000
  133. #define AR_XmitRate2_S 16
  134. #define AR_XmitRate3 0xff000000
  135. #define AR_XmitRate3_S 24
  136. #define AR_PacketDur0 0x00007fff
  137. #define AR_PacketDur0_S 0
  138. #define AR_RTSCTSQual0 0x00008000
  139. #define AR_PacketDur1 0x7fff0000
  140. #define AR_PacketDur1_S 16
  141. #define AR_RTSCTSQual1 0x80000000
  142. #define AR_PacketDur2 0x00007fff
  143. #define AR_PacketDur2_S 0
  144. #define AR_RTSCTSQual2 0x00008000
  145. #define AR_PacketDur3 0x7fff0000
  146. #define AR_PacketDur3_S 16
  147. #define AR_RTSCTSQual3 0x80000000
  148. #define AR_AggrLen 0x0000ffff
  149. #define AR_AggrLen_S 0
  150. #define AR_TxCtlRsvd60 0x00030000
  151. #define AR_PadDelim 0x03fc0000
  152. #define AR_PadDelim_S 18
  153. #define AR_EncrType 0x0c000000
  154. #define AR_EncrType_S 26
  155. #define AR_TxCtlRsvd61 0xf0000000
  156. #define AR_2040_0 0x00000001
  157. #define AR_GI0 0x00000002
  158. #define AR_ChainSel0 0x0000001c
  159. #define AR_ChainSel0_S 2
  160. #define AR_2040_1 0x00000020
  161. #define AR_GI1 0x00000040
  162. #define AR_ChainSel1 0x00000380
  163. #define AR_ChainSel1_S 7
  164. #define AR_2040_2 0x00000400
  165. #define AR_GI2 0x00000800
  166. #define AR_ChainSel2 0x00007000
  167. #define AR_ChainSel2_S 12
  168. #define AR_2040_3 0x00008000
  169. #define AR_GI3 0x00010000
  170. #define AR_ChainSel3 0x000e0000
  171. #define AR_ChainSel3_S 17
  172. #define AR_RTSCTSRate 0x0ff00000
  173. #define AR_RTSCTSRate_S 20
  174. #define AR_TxCtlRsvd70 0xf0000000
  175. #define AR_TxRSSIAnt00 0x000000ff
  176. #define AR_TxRSSIAnt00_S 0
  177. #define AR_TxRSSIAnt01 0x0000ff00
  178. #define AR_TxRSSIAnt01_S 8
  179. #define AR_TxRSSIAnt02 0x00ff0000
  180. #define AR_TxRSSIAnt02_S 16
  181. #define AR_TxStatusRsvd00 0x3f000000
  182. #define AR_TxBaStatus 0x40000000
  183. #define AR_TxStatusRsvd01 0x80000000
  184. #define AR_FrmXmitOK 0x00000001
  185. #define AR_ExcessiveRetries 0x00000002
  186. #define AR_FIFOUnderrun 0x00000004
  187. #define AR_Filtered 0x00000008
  188. #define AR_RTSFailCnt 0x000000f0
  189. #define AR_RTSFailCnt_S 4
  190. #define AR_DataFailCnt 0x00000f00
  191. #define AR_DataFailCnt_S 8
  192. #define AR_VirtRetryCnt 0x0000f000
  193. #define AR_VirtRetryCnt_S 12
  194. #define AR_TxDelimUnderrun 0x00010000
  195. #define AR_TxDataUnderrun 0x00020000
  196. #define AR_DescCfgErr 0x00040000
  197. #define AR_TxTimerExpired 0x00080000
  198. #define AR_TxStatusRsvd10 0xfff00000
  199. #define AR_SendTimestamp ds_txstatus2
  200. #define AR_BaBitmapLow ds_txstatus3
  201. #define AR_BaBitmapHigh ds_txstatus4
  202. #define AR_TxRSSIAnt10 0x000000ff
  203. #define AR_TxRSSIAnt10_S 0
  204. #define AR_TxRSSIAnt11 0x0000ff00
  205. #define AR_TxRSSIAnt11_S 8
  206. #define AR_TxRSSIAnt12 0x00ff0000
  207. #define AR_TxRSSIAnt12_S 16
  208. #define AR_TxRSSICombined 0xff000000
  209. #define AR_TxRSSICombined_S 24
  210. #define AR_TxEVM0 ds_txstatus5
  211. #define AR_TxEVM1 ds_txstatus6
  212. #define AR_TxEVM2 ds_txstatus7
  213. #define AR_TxDone 0x00000001
  214. #define AR_SeqNum 0x00001ffe
  215. #define AR_SeqNum_S 1
  216. #define AR_TxStatusRsvd80 0x0001e000
  217. #define AR_TxOpExceeded 0x00020000
  218. #define AR_TxStatusRsvd81 0x001c0000
  219. #define AR_FinalTxIdx 0x00600000
  220. #define AR_FinalTxIdx_S 21
  221. #define AR_TxStatusRsvd82 0x01800000
  222. #define AR_PowerMgmt 0x02000000
  223. #define AR_TxStatusRsvd83 0xfc000000
  224. #define AR_RxCTLRsvd00 0xffffffff
  225. #define AR_BufLen 0x00000fff
  226. #define AR_RxCtlRsvd00 0x00001000
  227. #define AR_RxIntrReq 0x00002000
  228. #define AR_RxCtlRsvd01 0xffffc000
  229. #define AR_RxRSSIAnt00 0x000000ff
  230. #define AR_RxRSSIAnt00_S 0
  231. #define AR_RxRSSIAnt01 0x0000ff00
  232. #define AR_RxRSSIAnt01_S 8
  233. #define AR_RxRSSIAnt02 0x00ff0000
  234. #define AR_RxRSSIAnt02_S 16
  235. #define AR_RxRate 0xff000000
  236. #define AR_RxRate_S 24
  237. #define AR_RxStatusRsvd00 0xff000000
  238. #define AR_DataLen 0x00000fff
  239. #define AR_RxMore 0x00001000
  240. #define AR_NumDelim 0x003fc000
  241. #define AR_NumDelim_S 14
  242. #define AR_RxStatusRsvd10 0xff800000
  243. #define AR_RcvTimestamp ds_rxstatus2
  244. #define AR_GI 0x00000001
  245. #define AR_2040 0x00000002
  246. #define AR_Parallel40 0x00000004
  247. #define AR_Parallel40_S 2
  248. #define AR_RxStatusRsvd30 0x000000f8
  249. #define AR_RxAntenna 0xffffff00
  250. #define AR_RxAntenna_S 8
  251. #define AR_RxRSSIAnt10 0x000000ff
  252. #define AR_RxRSSIAnt10_S 0
  253. #define AR_RxRSSIAnt11 0x0000ff00
  254. #define AR_RxRSSIAnt11_S 8
  255. #define AR_RxRSSIAnt12 0x00ff0000
  256. #define AR_RxRSSIAnt12_S 16
  257. #define AR_RxRSSICombined 0xff000000
  258. #define AR_RxRSSICombined_S 24
  259. #define AR_RxEVM0 ds_rxstatus4
  260. #define AR_RxEVM1 ds_rxstatus5
  261. #define AR_RxEVM2 ds_rxstatus6
  262. #define AR_RxDone 0x00000001
  263. #define AR_RxFrameOK 0x00000002
  264. #define AR_CRCErr 0x00000004
  265. #define AR_DecryptCRCErr 0x00000008
  266. #define AR_PHYErr 0x00000010
  267. #define AR_MichaelErr 0x00000020
  268. #define AR_PreDelimCRCErr 0x00000040
  269. #define AR_RxStatusRsvd70 0x00000080
  270. #define AR_RxKeyIdxValid 0x00000100
  271. #define AR_KeyIdx 0x0000fe00
  272. #define AR_KeyIdx_S 9
  273. #define AR_PHYErrCode 0x0000ff00
  274. #define AR_PHYErrCode_S 8
  275. #define AR_RxMoreAggr 0x00010000
  276. #define AR_RxAggr 0x00020000
  277. #define AR_PostDelimCRCErr 0x00040000
  278. #define AR_RxStatusRsvd71 0x3ff80000
  279. #define AR_DecryptBusyErr 0x40000000
  280. #define AR_KeyMiss 0x80000000
  281. #define AR5416_MAGIC 0x19641014
  282. #define RXSTATUS_RATE(ah, ads) (AR_SREV_5416_V20_OR_LATER(ah) ? \
  283. MS(ads->ds_rxstatus0, AR_RxRate) : \
  284. (ads->ds_rxstatus3 >> 2) & 0xFF)
  285. #define set11nTries(_series, _index) \
  286. (SM((_series)[_index].Tries, AR_XmitDataTries##_index))
  287. #define set11nRate(_series, _index) \
  288. (SM((_series)[_index].Rate, AR_XmitRate##_index))
  289. #define set11nPktDurRTSCTS(_series, _index) \
  290. (SM((_series)[_index].PktDuration, AR_PacketDur##_index) | \
  291. ((_series)[_index].RateFlags & ATH9K_RATESERIES_RTS_CTS ? \
  292. AR_RTSCTSQual##_index : 0))
  293. #define set11nRateFlags(_series, _index) \
  294. (((_series)[_index].RateFlags & ATH9K_RATESERIES_2040 ? \
  295. AR_2040_##_index : 0) \
  296. |((_series)[_index].RateFlags & ATH9K_RATESERIES_HALFGI ? \
  297. AR_GI##_index : 0) \
  298. |SM((_series)[_index].ChSel, AR_ChainSel##_index))
  299. #define AR_SREV_9100(ah) ((ah->ah_macVersion) == AR_SREV_VERSION_9100)
  300. #define INIT_CONFIG_STATUS 0x00000000
  301. #define INIT_RSSI_THR 0x00000700
  302. #define INIT_BCON_CNTRL_REG 0x00000000
  303. #define MIN_TX_FIFO_THRESHOLD 0x1
  304. #define MAX_TX_FIFO_THRESHOLD ((4096 / 64) - 1)
  305. #define INIT_TX_FIFO_THRESHOLD MIN_TX_FIFO_THRESHOLD
  306. struct ar5416AniState {
  307. struct ath9k_channel c;
  308. u8 noiseImmunityLevel;
  309. u8 spurImmunityLevel;
  310. u8 firstepLevel;
  311. u8 ofdmWeakSigDetectOff;
  312. u8 cckWeakSigThreshold;
  313. u32 listenTime;
  314. u32 ofdmTrigHigh;
  315. u32 ofdmTrigLow;
  316. int32_t cckTrigHigh;
  317. int32_t cckTrigLow;
  318. int32_t rssiThrLow;
  319. int32_t rssiThrHigh;
  320. u32 noiseFloor;
  321. u32 txFrameCount;
  322. u32 rxFrameCount;
  323. u32 cycleCount;
  324. u32 ofdmPhyErrCount;
  325. u32 cckPhyErrCount;
  326. u32 ofdmPhyErrBase;
  327. u32 cckPhyErrBase;
  328. int16_t pktRssi[2];
  329. int16_t ofdmErrRssi[2];
  330. int16_t cckErrRssi[2];
  331. };
  332. #define HAL_PROCESS_ANI 0x00000001
  333. #define DO_ANI(ah) \
  334. ((AH5416(ah)->ah_procPhyErr & HAL_PROCESS_ANI))
  335. struct ar5416Stats {
  336. u32 ast_ani_niup;
  337. u32 ast_ani_nidown;
  338. u32 ast_ani_spurup;
  339. u32 ast_ani_spurdown;
  340. u32 ast_ani_ofdmon;
  341. u32 ast_ani_ofdmoff;
  342. u32 ast_ani_cckhigh;
  343. u32 ast_ani_ccklow;
  344. u32 ast_ani_stepup;
  345. u32 ast_ani_stepdown;
  346. u32 ast_ani_ofdmerrs;
  347. u32 ast_ani_cckerrs;
  348. u32 ast_ani_reset;
  349. u32 ast_ani_lzero;
  350. u32 ast_ani_lneg;
  351. struct ath9k_mib_stats ast_mibstats;
  352. struct ath9k_node_stats ast_nodestats;
  353. };
  354. #define AR5416_OPFLAGS_11A 0x01
  355. #define AR5416_OPFLAGS_11G 0x02
  356. #define AR5416_OPFLAGS_N_5G_HT40 0x04
  357. #define AR5416_OPFLAGS_N_2G_HT40 0x08
  358. #define AR5416_OPFLAGS_N_5G_HT20 0x10
  359. #define AR5416_OPFLAGS_N_2G_HT20 0x20
  360. #define EEP_RFSILENT_ENABLED 0x0001
  361. #define EEP_RFSILENT_ENABLED_S 0
  362. #define EEP_RFSILENT_POLARITY 0x0002
  363. #define EEP_RFSILENT_POLARITY_S 1
  364. #define EEP_RFSILENT_GPIO_SEL 0x001c
  365. #define EEP_RFSILENT_GPIO_SEL_S 2
  366. #define AR5416_EEP_NO_BACK_VER 0x1
  367. #define AR5416_EEP_VER 0xE
  368. #define AR5416_EEP_VER_MINOR_MASK 0x0FFF
  369. #define AR5416_EEP_MINOR_VER_2 0x2
  370. #define AR5416_EEP_MINOR_VER_3 0x3
  371. #define AR5416_EEP_MINOR_VER_7 0x7
  372. #define AR5416_EEP_MINOR_VER_9 0x9
  373. #define AR5416_EEP_MINOR_VER_16 0x10
  374. #define AR5416_EEP_MINOR_VER_17 0x11
  375. #define AR5416_EEP_MINOR_VER_19 0x13
  376. #define AR5416_NUM_5G_CAL_PIERS 8
  377. #define AR5416_NUM_2G_CAL_PIERS 4
  378. #define AR5416_NUM_5G_20_TARGET_POWERS 8
  379. #define AR5416_NUM_5G_40_TARGET_POWERS 8
  380. #define AR5416_NUM_2G_CCK_TARGET_POWERS 3
  381. #define AR5416_NUM_2G_20_TARGET_POWERS 4
  382. #define AR5416_NUM_2G_40_TARGET_POWERS 4
  383. #define AR5416_NUM_CTLS 24
  384. #define AR5416_NUM_BAND_EDGES 8
  385. #define AR5416_NUM_PD_GAINS 4
  386. #define AR5416_PD_GAINS_IN_MASK 4
  387. #define AR5416_PD_GAIN_ICEPTS 5
  388. #define AR5416_EEPROM_MODAL_SPURS 5
  389. #define AR5416_MAX_RATE_POWER 63
  390. #define AR5416_NUM_PDADC_VALUES 128
  391. #define AR5416_BCHAN_UNUSED 0xFF
  392. #define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64
  393. #define AR5416_MAX_CHAINS 3
  394. #define AR5416_PWR_TABLE_OFFSET -5
  395. /* Rx gain type values */
  396. #define AR5416_EEP_RXGAIN_23DB_BACKOFF 0
  397. #define AR5416_EEP_RXGAIN_13DB_BACKOFF 1
  398. #define AR5416_EEP_RXGAIN_ORIG 2
  399. /* Tx gain type values */
  400. #define AR5416_EEP_TXGAIN_ORIGINAL 0
  401. #define AR5416_EEP_TXGAIN_HIGH_POWER 1
  402. #define AR5416_EEP4K_START_LOC 64
  403. #define AR5416_EEP4K_NUM_2G_CAL_PIERS 3
  404. #define AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS 3
  405. #define AR5416_EEP4K_NUM_2G_20_TARGET_POWERS 3
  406. #define AR5416_EEP4K_NUM_2G_40_TARGET_POWERS 3
  407. #define AR5416_EEP4K_NUM_CTLS 12
  408. #define AR5416_EEP4K_NUM_BAND_EDGES 4
  409. #define AR5416_EEP4K_NUM_PD_GAINS 2
  410. #define AR5416_EEP4K_PD_GAINS_IN_MASK 4
  411. #define AR5416_EEP4K_PD_GAIN_ICEPTS 5
  412. #define AR5416_EEP4K_MAX_CHAINS 1
  413. enum eeprom_param {
  414. EEP_NFTHRESH_5,
  415. EEP_NFTHRESH_2,
  416. EEP_MAC_MSW,
  417. EEP_MAC_MID,
  418. EEP_MAC_LSW,
  419. EEP_REG_0,
  420. EEP_REG_1,
  421. EEP_OP_CAP,
  422. EEP_OP_MODE,
  423. EEP_RF_SILENT,
  424. EEP_OB_5,
  425. EEP_DB_5,
  426. EEP_OB_2,
  427. EEP_DB_2,
  428. EEP_MINOR_REV,
  429. EEP_TX_MASK,
  430. EEP_RX_MASK,
  431. EEP_RXGAIN_TYPE,
  432. EEP_TXGAIN_TYPE,
  433. };
  434. enum ar5416_rates {
  435. rate6mb, rate9mb, rate12mb, rate18mb,
  436. rate24mb, rate36mb, rate48mb, rate54mb,
  437. rate1l, rate2l, rate2s, rate5_5l,
  438. rate5_5s, rate11l, rate11s, rateXr,
  439. rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3,
  440. rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7,
  441. rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3,
  442. rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7,
  443. rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm,
  444. Ar5416RateSize
  445. };
  446. enum ath9k_hal_freq_band {
  447. ATH9K_HAL_FREQ_BAND_5GHZ = 0,
  448. ATH9K_HAL_FREQ_BAND_2GHZ = 1
  449. };
  450. struct base_eep_header {
  451. u16 length;
  452. u16 checksum;
  453. u16 version;
  454. u8 opCapFlags;
  455. u8 eepMisc;
  456. u16 regDmn[2];
  457. u8 macAddr[6];
  458. u8 rxMask;
  459. u8 txMask;
  460. u16 rfSilent;
  461. u16 blueToothOptions;
  462. u16 deviceCap;
  463. u32 binBuildNumber;
  464. u8 deviceType;
  465. u8 pwdclkind;
  466. u8 futureBase_1[2];
  467. u8 rxGainType;
  468. u8 futureBase_2[3];
  469. u8 txGainType;
  470. u8 futureBase_3[25];
  471. } __packed;
  472. struct base_eep_header_4k {
  473. u16 length;
  474. u16 checksum;
  475. u16 version;
  476. u8 opCapFlags;
  477. u8 eepMisc;
  478. u16 regDmn[2];
  479. u8 macAddr[6];
  480. u8 rxMask;
  481. u8 txMask;
  482. u16 rfSilent;
  483. u16 blueToothOptions;
  484. u16 deviceCap;
  485. u32 binBuildNumber;
  486. u8 deviceType;
  487. u8 futureBase[1];
  488. } __packed;
  489. struct spur_chan {
  490. u16 spurChan;
  491. u8 spurRangeLow;
  492. u8 spurRangeHigh;
  493. } __packed;
  494. struct modal_eep_header {
  495. u32 antCtrlChain[AR5416_MAX_CHAINS];
  496. u32 antCtrlCommon;
  497. u8 antennaGainCh[AR5416_MAX_CHAINS];
  498. u8 switchSettling;
  499. u8 txRxAttenCh[AR5416_MAX_CHAINS];
  500. u8 rxTxMarginCh[AR5416_MAX_CHAINS];
  501. u8 adcDesiredSize;
  502. u8 pgaDesiredSize;
  503. u8 xlnaGainCh[AR5416_MAX_CHAINS];
  504. u8 txEndToXpaOff;
  505. u8 txEndToRxOn;
  506. u8 txFrameToXpaOn;
  507. u8 thresh62;
  508. u8 noiseFloorThreshCh[AR5416_MAX_CHAINS];
  509. u8 xpdGain;
  510. u8 xpd;
  511. u8 iqCalICh[AR5416_MAX_CHAINS];
  512. u8 iqCalQCh[AR5416_MAX_CHAINS];
  513. u8 pdGainOverlap;
  514. u8 ob;
  515. u8 db;
  516. u8 xpaBiasLvl;
  517. u8 pwrDecreaseFor2Chain;
  518. u8 pwrDecreaseFor3Chain;
  519. u8 txFrameToDataStart;
  520. u8 txFrameToPaOn;
  521. u8 ht40PowerIncForPdadc;
  522. u8 bswAtten[AR5416_MAX_CHAINS];
  523. u8 bswMargin[AR5416_MAX_CHAINS];
  524. u8 swSettleHt40;
  525. u8 xatten2Db[AR5416_MAX_CHAINS];
  526. u8 xatten2Margin[AR5416_MAX_CHAINS];
  527. u8 ob_ch1;
  528. u8 db_ch1;
  529. u8 useAnt1:1,
  530. force_xpaon:1,
  531. local_bias:1,
  532. femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1;
  533. u8 futureModalar9280;
  534. u16 xpaBiasLvlFreq[3];
  535. u8 futureModal[6];
  536. struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS];
  537. } __packed;
  538. struct modal_eep_4k_header {
  539. u32 antCtrlChain[AR5416_EEP4K_MAX_CHAINS];
  540. u32 antCtrlCommon;
  541. u8 antennaGainCh[AR5416_EEP4K_MAX_CHAINS];
  542. u8 switchSettling;
  543. u8 txRxAttenCh[AR5416_EEP4K_MAX_CHAINS];
  544. u8 rxTxMarginCh[AR5416_EEP4K_MAX_CHAINS];
  545. u8 adcDesiredSize;
  546. u8 pgaDesiredSize;
  547. u8 xlnaGainCh[AR5416_EEP4K_MAX_CHAINS];
  548. u8 txEndToXpaOff;
  549. u8 txEndToRxOn;
  550. u8 txFrameToXpaOn;
  551. u8 thresh62;
  552. u8 noiseFloorThreshCh[AR5416_EEP4K_MAX_CHAINS];
  553. u8 xpdGain;
  554. u8 xpd;
  555. u8 iqCalICh[AR5416_EEP4K_MAX_CHAINS];
  556. u8 iqCalQCh[AR5416_EEP4K_MAX_CHAINS];
  557. u8 pdGainOverlap;
  558. u8 ob_01;
  559. u8 db1_01;
  560. u8 xpaBiasLvl;
  561. u8 txFrameToDataStart;
  562. u8 txFrameToPaOn;
  563. u8 ht40PowerIncForPdadc;
  564. u8 bswAtten[AR5416_EEP4K_MAX_CHAINS];
  565. u8 bswMargin[AR5416_EEP4K_MAX_CHAINS];
  566. u8 swSettleHt40;
  567. u8 xatten2Db[AR5416_EEP4K_MAX_CHAINS];
  568. u8 xatten2Margin[AR5416_EEP4K_MAX_CHAINS];
  569. u8 db2_01;
  570. u8 version;
  571. u16 ob_234;
  572. u16 db1_234;
  573. u16 db2_234;
  574. u8 futureModal[4];
  575. struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS];
  576. } __packed;
  577. struct cal_data_per_freq {
  578. u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
  579. u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
  580. } __packed;
  581. struct cal_data_per_freq_4k {
  582. u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS];
  583. u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS];
  584. } __packed;
  585. struct cal_target_power_leg {
  586. u8 bChannel;
  587. u8 tPow2x[4];
  588. } __packed;
  589. struct cal_target_power_ht {
  590. u8 bChannel;
  591. u8 tPow2x[8];
  592. } __packed;
  593. #ifdef __BIG_ENDIAN_BITFIELD
  594. struct cal_ctl_edges {
  595. u8 bChannel;
  596. u8 flag:2, tPower:6;
  597. } __packed;
  598. #else
  599. struct cal_ctl_edges {
  600. u8 bChannel;
  601. u8 tPower:6, flag:2;
  602. } __packed;
  603. #endif
  604. struct cal_ctl_data {
  605. struct cal_ctl_edges
  606. ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES];
  607. } __packed;
  608. struct cal_ctl_data_4k {
  609. struct cal_ctl_edges
  610. ctlEdges[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_BAND_EDGES];
  611. } __packed;
  612. struct ar5416_eeprom_def {
  613. struct base_eep_header baseEepHeader;
  614. u8 custData[64];
  615. struct modal_eep_header modalHeader[2];
  616. u8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS];
  617. u8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS];
  618. struct cal_data_per_freq
  619. calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS];
  620. struct cal_data_per_freq
  621. calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS];
  622. struct cal_target_power_leg
  623. calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS];
  624. struct cal_target_power_ht
  625. calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS];
  626. struct cal_target_power_ht
  627. calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS];
  628. struct cal_target_power_leg
  629. calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS];
  630. struct cal_target_power_leg
  631. calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS];
  632. struct cal_target_power_ht
  633. calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS];
  634. struct cal_target_power_ht
  635. calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS];
  636. u8 ctlIndex[AR5416_NUM_CTLS];
  637. struct cal_ctl_data ctlData[AR5416_NUM_CTLS];
  638. u8 padding;
  639. } __packed;
  640. struct ar5416_eeprom_4k {
  641. struct base_eep_header_4k baseEepHeader;
  642. u8 custData[20];
  643. struct modal_eep_4k_header modalHeader;
  644. u8 calFreqPier2G[AR5416_EEP4K_NUM_2G_CAL_PIERS];
  645. struct cal_data_per_freq_4k
  646. calPierData2G[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_2G_CAL_PIERS];
  647. struct cal_target_power_leg
  648. calTargetPowerCck[AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS];
  649. struct cal_target_power_leg
  650. calTargetPower2G[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS];
  651. struct cal_target_power_ht
  652. calTargetPower2GHT20[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS];
  653. struct cal_target_power_ht
  654. calTargetPower2GHT40[AR5416_EEP4K_NUM_2G_40_TARGET_POWERS];
  655. u8 ctlIndex[AR5416_EEP4K_NUM_CTLS];
  656. struct cal_ctl_data_4k ctlData[AR5416_EEP4K_NUM_CTLS];
  657. u8 padding;
  658. } __packed;
  659. struct ar5416IniArray {
  660. u32 *ia_array;
  661. u32 ia_rows;
  662. u32 ia_columns;
  663. };
  664. #define INIT_INI_ARRAY(iniarray, array, rows, columns) do { \
  665. (iniarray)->ia_array = (u32 *)(array); \
  666. (iniarray)->ia_rows = (rows); \
  667. (iniarray)->ia_columns = (columns); \
  668. } while (0)
  669. #define INI_RA(iniarray, row, column) \
  670. (((iniarray)->ia_array)[(row) * ((iniarray)->ia_columns) + (column)])
  671. #define INIT_CAL(_perCal) do { \
  672. (_perCal)->calState = CAL_WAITING; \
  673. (_perCal)->calNext = NULL; \
  674. } while (0)
  675. #define INSERT_CAL(_ahp, _perCal) \
  676. do { \
  677. if ((_ahp)->ah_cal_list_last == NULL) { \
  678. (_ahp)->ah_cal_list = \
  679. (_ahp)->ah_cal_list_last = (_perCal); \
  680. ((_ahp)->ah_cal_list_last)->calNext = (_perCal); \
  681. } else { \
  682. ((_ahp)->ah_cal_list_last)->calNext = (_perCal); \
  683. (_ahp)->ah_cal_list_last = (_perCal); \
  684. (_perCal)->calNext = (_ahp)->ah_cal_list; \
  685. } \
  686. } while (0)
  687. enum hal_cal_types {
  688. ADC_DC_INIT_CAL = 0x1,
  689. ADC_GAIN_CAL = 0x2,
  690. ADC_DC_CAL = 0x4,
  691. IQ_MISMATCH_CAL = 0x8
  692. };
  693. enum hal_cal_state {
  694. CAL_INACTIVE,
  695. CAL_WAITING,
  696. CAL_RUNNING,
  697. CAL_DONE
  698. };
  699. #define MIN_CAL_SAMPLES 1
  700. #define MAX_CAL_SAMPLES 64
  701. #define INIT_LOG_COUNT 5
  702. #define PER_MIN_LOG_COUNT 2
  703. #define PER_MAX_LOG_COUNT 10
  704. struct hal_percal_data {
  705. enum hal_cal_types calType;
  706. u32 calNumSamples;
  707. u32 calCountMax;
  708. void (*calCollect) (struct ath_hal *);
  709. void (*calPostProc) (struct ath_hal *, u8);
  710. };
  711. struct hal_cal_list {
  712. const struct hal_percal_data *calData;
  713. enum hal_cal_state calState;
  714. struct hal_cal_list *calNext;
  715. };
  716. /*
  717. * Enum to indentify the eeprom mappings
  718. */
  719. enum hal_eep_map {
  720. EEP_MAP_DEFAULT = 0x0,
  721. EEP_MAP_4KBITS,
  722. EEP_MAP_MAX
  723. };
  724. struct ath_hal_5416 {
  725. struct ath_hal ah;
  726. union {
  727. struct ar5416_eeprom_def def;
  728. struct ar5416_eeprom_4k map4k;
  729. } ah_eeprom;
  730. struct ar5416Stats ah_stats;
  731. struct ath9k_tx_queue_info ah_txq[ATH9K_NUM_TX_QUEUES];
  732. void __iomem *ah_cal_mem;
  733. u8 ah_macaddr[ETH_ALEN];
  734. u8 ah_bssid[ETH_ALEN];
  735. u8 ah_bssidmask[ETH_ALEN];
  736. u16 ah_assocId;
  737. int16_t ah_curchanRadIndex;
  738. u32 ah_maskReg;
  739. u32 ah_txOkInterruptMask;
  740. u32 ah_txErrInterruptMask;
  741. u32 ah_txDescInterruptMask;
  742. u32 ah_txEolInterruptMask;
  743. u32 ah_txUrnInterruptMask;
  744. bool ah_chipFullSleep;
  745. u32 ah_atimWindow;
  746. u16 ah_antennaSwitchSwap;
  747. enum ath9k_power_mode ah_powerMode;
  748. enum ath9k_ant_setting ah_diversityControl;
  749. /* Calibration */
  750. enum hal_cal_types ah_suppCals;
  751. struct hal_cal_list ah_iqCalData;
  752. struct hal_cal_list ah_adcGainCalData;
  753. struct hal_cal_list ah_adcDcCalInitData;
  754. struct hal_cal_list ah_adcDcCalData;
  755. struct hal_cal_list *ah_cal_list;
  756. struct hal_cal_list *ah_cal_list_last;
  757. struct hal_cal_list *ah_cal_list_curr;
  758. #define ah_totalPowerMeasI ah_Meas0.unsign
  759. #define ah_totalPowerMeasQ ah_Meas1.unsign
  760. #define ah_totalIqCorrMeas ah_Meas2.sign
  761. #define ah_totalAdcIOddPhase ah_Meas0.unsign
  762. #define ah_totalAdcIEvenPhase ah_Meas1.unsign
  763. #define ah_totalAdcQOddPhase ah_Meas2.unsign
  764. #define ah_totalAdcQEvenPhase ah_Meas3.unsign
  765. #define ah_totalAdcDcOffsetIOddPhase ah_Meas0.sign
  766. #define ah_totalAdcDcOffsetIEvenPhase ah_Meas1.sign
  767. #define ah_totalAdcDcOffsetQOddPhase ah_Meas2.sign
  768. #define ah_totalAdcDcOffsetQEvenPhase ah_Meas3.sign
  769. union {
  770. u32 unsign[AR5416_MAX_CHAINS];
  771. int32_t sign[AR5416_MAX_CHAINS];
  772. } ah_Meas0;
  773. union {
  774. u32 unsign[AR5416_MAX_CHAINS];
  775. int32_t sign[AR5416_MAX_CHAINS];
  776. } ah_Meas1;
  777. union {
  778. u32 unsign[AR5416_MAX_CHAINS];
  779. int32_t sign[AR5416_MAX_CHAINS];
  780. } ah_Meas2;
  781. union {
  782. u32 unsign[AR5416_MAX_CHAINS];
  783. int32_t sign[AR5416_MAX_CHAINS];
  784. } ah_Meas3;
  785. u16 ah_CalSamples;
  786. u32 ah_staId1Defaults;
  787. u32 ah_miscMode;
  788. enum {
  789. AUTO_32KHZ,
  790. USE_32KHZ,
  791. DONT_USE_32KHZ,
  792. } ah_enable32kHzClock;
  793. /* RF */
  794. u32 *ah_analogBank0Data;
  795. u32 *ah_analogBank1Data;
  796. u32 *ah_analogBank2Data;
  797. u32 *ah_analogBank3Data;
  798. u32 *ah_analogBank6Data;
  799. u32 *ah_analogBank6TPCData;
  800. u32 *ah_analogBank7Data;
  801. u32 *ah_addac5416_21;
  802. u32 *ah_bank6Temp;
  803. int16_t ah_txPowerIndexOffset;
  804. u32 ah_beaconInterval;
  805. u32 ah_slottime;
  806. u32 ah_acktimeout;
  807. u32 ah_ctstimeout;
  808. u32 ah_globaltxtimeout;
  809. u8 ah_gBeaconRate;
  810. u32 ah_gpioSelect;
  811. u32 ah_polarity;
  812. u32 ah_gpioBit;
  813. /* ANI */
  814. u32 ah_procPhyErr;
  815. bool ah_hasHwPhyCounters;
  816. u32 ah_aniPeriod;
  817. struct ar5416AniState *ah_curani;
  818. struct ar5416AniState ah_ani[255];
  819. int ah_totalSizeDesired[5];
  820. int ah_coarseHigh[5];
  821. int ah_coarseLow[5];
  822. int ah_firpwr[5];
  823. enum ath9k_ani_cmd ah_ani_function;
  824. u32 ah_intrTxqs;
  825. bool ah_intrMitigation;
  826. enum ath9k_ht_extprotspacing ah_extprotspacing;
  827. u8 ah_txchainmask;
  828. u8 ah_rxchainmask;
  829. struct ar5416IniArray ah_iniModes;
  830. struct ar5416IniArray ah_iniCommon;
  831. struct ar5416IniArray ah_iniBank0;
  832. struct ar5416IniArray ah_iniBB_RfGain;
  833. struct ar5416IniArray ah_iniBank1;
  834. struct ar5416IniArray ah_iniBank2;
  835. struct ar5416IniArray ah_iniBank3;
  836. struct ar5416IniArray ah_iniBank6;
  837. struct ar5416IniArray ah_iniBank6TPC;
  838. struct ar5416IniArray ah_iniBank7;
  839. struct ar5416IniArray ah_iniAddac;
  840. struct ar5416IniArray ah_iniPcieSerdes;
  841. struct ar5416IniArray ah_iniModesAdditional;
  842. struct ar5416IniArray ah_iniModesRxGain;
  843. struct ar5416IniArray ah_iniModesTxGain;
  844. /* To indicate EEPROM mapping used */
  845. enum hal_eep_map ah_eep_map;
  846. };
  847. #define AH5416(_ah) ((struct ath_hal_5416 *)(_ah))
  848. #define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5))
  849. #define ar5416RfDetach(ah) do { \
  850. if (AH5416(ah)->ah_rfHal.rfDetach != NULL) \
  851. AH5416(ah)->ah_rfHal.rfDetach(ah); \
  852. } while (0)
  853. #define ath9k_hw_use_flash(_ah) \
  854. (!(_ah->ah_flags & AH_USE_EEPROM))
  855. #define DO_DELAY(x) do { \
  856. if ((++(x) % 64) == 0) \
  857. udelay(1); \
  858. } while (0)
  859. #define REG_WRITE_ARRAY(iniarray, column, regWr) do { \
  860. int r; \
  861. for (r = 0; r < ((iniarray)->ia_rows); r++) { \
  862. REG_WRITE(ah, INI_RA((iniarray), (r), 0), \
  863. INI_RA((iniarray), r, (column))); \
  864. DO_DELAY(regWr); \
  865. } \
  866. } while (0)
  867. #define BASE_ACTIVATE_DELAY 100
  868. #define RTC_PLL_SETTLE_DELAY 1000
  869. #define COEF_SCALE_S 24
  870. #define HT40_CHANNEL_CENTER_SHIFT 10
  871. #define AR5416_EEPROM_MAGIC_OFFSET 0x0
  872. #define AR5416_EEPROM_S 2
  873. #define AR5416_EEPROM_OFFSET 0x2000
  874. #define AR5416_EEPROM_START_ADDR \
  875. (AR_SREV_9100(ah)) ? 0x1fff1000 : 0x503f1200
  876. #define AR5416_EEPROM_MAX 0xae0
  877. #define ar5416_get_eep_ver(_ahp) \
  878. (((_ahp)->ah_eeprom.def.baseEepHeader.version >> 12) & 0xF)
  879. #define ar5416_get_eep_rev(_ahp) \
  880. (((_ahp)->ah_eeprom.def.baseEepHeader.version) & 0xFFF)
  881. #define ar5416_get_ntxchains(_txchainmask) \
  882. (((_txchainmask >> 2) & 1) + \
  883. ((_txchainmask >> 1) & 1) + (_txchainmask & 1))
  884. /* EEPROM 4K bit map definations */
  885. #define ar5416_get_eep4k_ver(_ahp) \
  886. (((_ahp)->ah_eeprom.map4k.baseEepHeader.version >> 12) & 0xF)
  887. #define ar5416_get_eep4k_rev(_ahp) \
  888. (((_ahp)->ah_eeprom.map4k.baseEepHeader.version) & 0xFFF)
  889. #ifdef __BIG_ENDIAN
  890. #define AR5416_EEPROM_MAGIC 0x5aa5
  891. #else
  892. #define AR5416_EEPROM_MAGIC 0xa55a
  893. #endif
  894. #define ATH9K_POW_SM(_r, _s) (((_r) & 0x3f) << (_s))
  895. #define ATH9K_ANTENNA0_CHAINMASK 0x1
  896. #define ATH9K_ANTENNA1_CHAINMASK 0x2
  897. #define ATH9K_NUM_DMA_DEBUG_REGS 8
  898. #define ATH9K_NUM_QUEUES 10
  899. #define HAL_NOISE_IMMUNE_MAX 4
  900. #define HAL_SPUR_IMMUNE_MAX 7
  901. #define HAL_FIRST_STEP_MAX 2
  902. #define ATH9K_ANI_OFDM_TRIG_HIGH 500
  903. #define ATH9K_ANI_OFDM_TRIG_LOW 200
  904. #define ATH9K_ANI_CCK_TRIG_HIGH 200
  905. #define ATH9K_ANI_CCK_TRIG_LOW 100
  906. #define ATH9K_ANI_NOISE_IMMUNE_LVL 4
  907. #define ATH9K_ANI_USE_OFDM_WEAK_SIG true
  908. #define ATH9K_ANI_CCK_WEAK_SIG_THR false
  909. #define ATH9K_ANI_SPUR_IMMUNE_LVL 7
  910. #define ATH9K_ANI_FIRSTEP_LVL 0
  911. #define ATH9K_ANI_RSSI_THR_HIGH 40
  912. #define ATH9K_ANI_RSSI_THR_LOW 7
  913. #define ATH9K_ANI_PERIOD 100
  914. #define AR_GPIOD_MASK 0x00001FFF
  915. #define AR_GPIO_BIT(_gpio) (1 << (_gpio))
  916. #define HAL_EP_RND(x, mul) \
  917. ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
  918. #define BEACON_RSSI(ahp) \
  919. HAL_EP_RND(ahp->ah_stats.ast_nodestats.ns_avgbrssi, \
  920. ATH9K_RSSI_EP_MULTIPLIER)
  921. #define ah_mibStats ah_stats.ast_mibstats
  922. #define AH_TIMEOUT 100000
  923. #define AH_TIME_QUANTUM 10
  924. #define AR_KEYTABLE_SIZE 128
  925. #define POWER_UP_TIME 200000
  926. #define EXT_ADDITIVE (0x8000)
  927. #define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE)
  928. #define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE)
  929. #define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE)
  930. #define SUB_NUM_CTL_MODES_AT_5G_40 2
  931. #define SUB_NUM_CTL_MODES_AT_2G_40 3
  932. #define SPUR_RSSI_THRESH 40
  933. #define TU_TO_USEC(_tu) ((_tu) << 10)
  934. #define CAB_TIMEOUT_VAL 10
  935. #define BEACON_TIMEOUT_VAL 10
  936. #define MIN_BEACON_TIMEOUT_VAL 1
  937. #define SLEEP_SLOP 3
  938. #define CCK_SIFS_TIME 10
  939. #define CCK_PREAMBLE_BITS 144
  940. #define CCK_PLCP_BITS 48
  941. #define OFDM_SIFS_TIME 16
  942. #define OFDM_PREAMBLE_TIME 20
  943. #define OFDM_PLCP_BITS 22
  944. #define OFDM_SYMBOL_TIME 4
  945. #define OFDM_SIFS_TIME_HALF 32
  946. #define OFDM_PREAMBLE_TIME_HALF 40
  947. #define OFDM_PLCP_BITS_HALF 22
  948. #define OFDM_SYMBOL_TIME_HALF 8
  949. #define OFDM_SIFS_TIME_QUARTER 64
  950. #define OFDM_PREAMBLE_TIME_QUARTER 80
  951. #define OFDM_PLCP_BITS_QUARTER 22
  952. #define OFDM_SYMBOL_TIME_QUARTER 16
  953. u32 ath9k_hw_get_eeprom(struct ath_hal *ah,
  954. enum eeprom_param param);
  955. #endif