eeprom_def.c 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389
  1. /*
  2. * Copyright (c) 2008-2011 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. #include <asm/unaligned.h>
  17. #include "hw.h"
  18. #include "ar9002_phy.h"
  19. static void ath9k_get_txgain_index(struct ath_hw *ah,
  20. struct ath9k_channel *chan,
  21. struct calDataPerFreqOpLoop *rawDatasetOpLoop,
  22. u8 *calChans, u16 availPiers, u8 *pwr, u8 *pcdacIdx)
  23. {
  24. u8 pcdac, i = 0;
  25. u16 idxL = 0, idxR = 0, numPiers;
  26. bool match;
  27. struct chan_centers centers;
  28. ath9k_hw_get_channel_centers(ah, chan, &centers);
  29. for (numPiers = 0; numPiers < availPiers; numPiers++)
  30. if (calChans[numPiers] == AR5416_BCHAN_UNUSED)
  31. break;
  32. match = ath9k_hw_get_lower_upper_index(
  33. (u8)FREQ2FBIN(centers.synth_center, IS_CHAN_2GHZ(chan)),
  34. calChans, numPiers, &idxL, &idxR);
  35. if (match) {
  36. pcdac = rawDatasetOpLoop[idxL].pcdac[0][0];
  37. *pwr = rawDatasetOpLoop[idxL].pwrPdg[0][0];
  38. } else {
  39. pcdac = rawDatasetOpLoop[idxR].pcdac[0][0];
  40. *pwr = (rawDatasetOpLoop[idxL].pwrPdg[0][0] +
  41. rawDatasetOpLoop[idxR].pwrPdg[0][0])/2;
  42. }
  43. while (pcdac > ah->originalGain[i] &&
  44. i < (AR9280_TX_GAIN_TABLE_SIZE - 1))
  45. i++;
  46. *pcdacIdx = i;
  47. }
  48. static void ath9k_olc_get_pdadcs(struct ath_hw *ah,
  49. u32 initTxGain,
  50. int txPower,
  51. u8 *pPDADCValues)
  52. {
  53. u32 i;
  54. u32 offset;
  55. REG_RMW_FIELD(ah, AR_PHY_TX_PWRCTRL6_0,
  56. AR_PHY_TX_PWRCTRL_ERR_EST_MODE, 3);
  57. REG_RMW_FIELD(ah, AR_PHY_TX_PWRCTRL6_1,
  58. AR_PHY_TX_PWRCTRL_ERR_EST_MODE, 3);
  59. REG_RMW_FIELD(ah, AR_PHY_TX_PWRCTRL7,
  60. AR_PHY_TX_PWRCTRL_INIT_TX_GAIN, initTxGain);
  61. offset = txPower;
  62. for (i = 0; i < AR5416_NUM_PDADC_VALUES; i++)
  63. if (i < offset)
  64. pPDADCValues[i] = 0x0;
  65. else
  66. pPDADCValues[i] = 0xFF;
  67. }
  68. static int ath9k_hw_def_get_eeprom_ver(struct ath_hw *ah)
  69. {
  70. return ((ah->eeprom.def.baseEepHeader.version >> 12) & 0xF);
  71. }
  72. static int ath9k_hw_def_get_eeprom_rev(struct ath_hw *ah)
  73. {
  74. return ((ah->eeprom.def.baseEepHeader.version) & 0xFFF);
  75. }
  76. #define SIZE_EEPROM_DEF (sizeof(struct ar5416_eeprom_def) / sizeof(u16))
  77. static bool __ath9k_hw_def_fill_eeprom(struct ath_hw *ah)
  78. {
  79. u16 *eep_data = (u16 *)&ah->eeprom.def;
  80. int addr, ar5416_eep_start_loc = 0x100;
  81. for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) {
  82. if (!ath9k_hw_nvram_read(ah, addr + ar5416_eep_start_loc,
  83. eep_data))
  84. return false;
  85. eep_data++;
  86. }
  87. return true;
  88. }
  89. static bool __ath9k_hw_usb_def_fill_eeprom(struct ath_hw *ah)
  90. {
  91. u16 *eep_data = (u16 *)&ah->eeprom.def;
  92. ath9k_hw_usb_gen_fill_eeprom(ah, eep_data,
  93. 0x100, SIZE_EEPROM_DEF);
  94. return true;
  95. }
  96. static bool ath9k_hw_def_fill_eeprom(struct ath_hw *ah)
  97. {
  98. struct ath_common *common = ath9k_hw_common(ah);
  99. if (!ath9k_hw_use_flash(ah)) {
  100. ath_dbg(common, EEPROM, "Reading from EEPROM, not flash\n");
  101. }
  102. if (common->bus_ops->ath_bus_type == ATH_USB)
  103. return __ath9k_hw_usb_def_fill_eeprom(ah);
  104. else
  105. return __ath9k_hw_def_fill_eeprom(ah);
  106. }
  107. #undef SIZE_EEPROM_DEF
  108. #if defined(CONFIG_ATH9K_DEBUGFS) || defined(CONFIG_ATH9K_HTC_DEBUGFS)
  109. static u32 ath9k_def_dump_modal_eeprom(char *buf, u32 len, u32 size,
  110. struct modal_eep_header *modal_hdr)
  111. {
  112. PR_EEP("Chain0 Ant. Control", modal_hdr->antCtrlChain[0]);
  113. PR_EEP("Chain1 Ant. Control", modal_hdr->antCtrlChain[1]);
  114. PR_EEP("Chain2 Ant. Control", modal_hdr->antCtrlChain[2]);
  115. PR_EEP("Ant. Common Control", modal_hdr->antCtrlCommon);
  116. PR_EEP("Chain0 Ant. Gain", modal_hdr->antennaGainCh[0]);
  117. PR_EEP("Chain1 Ant. Gain", modal_hdr->antennaGainCh[1]);
  118. PR_EEP("Chain2 Ant. Gain", modal_hdr->antennaGainCh[2]);
  119. PR_EEP("Switch Settle", modal_hdr->switchSettling);
  120. PR_EEP("Chain0 TxRxAtten", modal_hdr->txRxAttenCh[0]);
  121. PR_EEP("Chain1 TxRxAtten", modal_hdr->txRxAttenCh[1]);
  122. PR_EEP("Chain2 TxRxAtten", modal_hdr->txRxAttenCh[2]);
  123. PR_EEP("Chain0 RxTxMargin", modal_hdr->rxTxMarginCh[0]);
  124. PR_EEP("Chain1 RxTxMargin", modal_hdr->rxTxMarginCh[1]);
  125. PR_EEP("Chain2 RxTxMargin", modal_hdr->rxTxMarginCh[2]);
  126. PR_EEP("ADC Desired size", modal_hdr->adcDesiredSize);
  127. PR_EEP("PGA Desired size", modal_hdr->pgaDesiredSize);
  128. PR_EEP("Chain0 xlna Gain", modal_hdr->xlnaGainCh[0]);
  129. PR_EEP("Chain1 xlna Gain", modal_hdr->xlnaGainCh[1]);
  130. PR_EEP("Chain2 xlna Gain", modal_hdr->xlnaGainCh[2]);
  131. PR_EEP("txEndToXpaOff", modal_hdr->txEndToXpaOff);
  132. PR_EEP("txEndToRxOn", modal_hdr->txEndToRxOn);
  133. PR_EEP("txFrameToXpaOn", modal_hdr->txFrameToXpaOn);
  134. PR_EEP("CCA Threshold)", modal_hdr->thresh62);
  135. PR_EEP("Chain0 NF Threshold", modal_hdr->noiseFloorThreshCh[0]);
  136. PR_EEP("Chain1 NF Threshold", modal_hdr->noiseFloorThreshCh[1]);
  137. PR_EEP("Chain2 NF Threshold", modal_hdr->noiseFloorThreshCh[2]);
  138. PR_EEP("xpdGain", modal_hdr->xpdGain);
  139. PR_EEP("External PD", modal_hdr->xpd);
  140. PR_EEP("Chain0 I Coefficient", modal_hdr->iqCalICh[0]);
  141. PR_EEP("Chain1 I Coefficient", modal_hdr->iqCalICh[1]);
  142. PR_EEP("Chain2 I Coefficient", modal_hdr->iqCalICh[2]);
  143. PR_EEP("Chain0 Q Coefficient", modal_hdr->iqCalQCh[0]);
  144. PR_EEP("Chain1 Q Coefficient", modal_hdr->iqCalQCh[1]);
  145. PR_EEP("Chain2 Q Coefficient", modal_hdr->iqCalQCh[2]);
  146. PR_EEP("pdGainOverlap", modal_hdr->pdGainOverlap);
  147. PR_EEP("Chain0 OutputBias", modal_hdr->ob);
  148. PR_EEP("Chain0 DriverBias", modal_hdr->db);
  149. PR_EEP("xPA Bias Level", modal_hdr->xpaBiasLvl);
  150. PR_EEP("2chain pwr decrease", modal_hdr->pwrDecreaseFor2Chain);
  151. PR_EEP("3chain pwr decrease", modal_hdr->pwrDecreaseFor3Chain);
  152. PR_EEP("txFrameToDataStart", modal_hdr->txFrameToDataStart);
  153. PR_EEP("txFrameToPaOn", modal_hdr->txFrameToPaOn);
  154. PR_EEP("HT40 Power Inc.", modal_hdr->ht40PowerIncForPdadc);
  155. PR_EEP("Chain0 bswAtten", modal_hdr->bswAtten[0]);
  156. PR_EEP("Chain1 bswAtten", modal_hdr->bswAtten[1]);
  157. PR_EEP("Chain2 bswAtten", modal_hdr->bswAtten[2]);
  158. PR_EEP("Chain0 bswMargin", modal_hdr->bswMargin[0]);
  159. PR_EEP("Chain1 bswMargin", modal_hdr->bswMargin[1]);
  160. PR_EEP("Chain2 bswMargin", modal_hdr->bswMargin[2]);
  161. PR_EEP("HT40 Switch Settle", modal_hdr->swSettleHt40);
  162. PR_EEP("Chain0 xatten2Db", modal_hdr->xatten2Db[0]);
  163. PR_EEP("Chain1 xatten2Db", modal_hdr->xatten2Db[1]);
  164. PR_EEP("Chain2 xatten2Db", modal_hdr->xatten2Db[2]);
  165. PR_EEP("Chain0 xatten2Margin", modal_hdr->xatten2Margin[0]);
  166. PR_EEP("Chain1 xatten2Margin", modal_hdr->xatten2Margin[1]);
  167. PR_EEP("Chain2 xatten2Margin", modal_hdr->xatten2Margin[2]);
  168. PR_EEP("Chain1 OutputBias", modal_hdr->ob_ch1);
  169. PR_EEP("Chain1 DriverBias", modal_hdr->db_ch1);
  170. PR_EEP("LNA Control", modal_hdr->lna_ctl);
  171. PR_EEP("XPA Bias Freq0", modal_hdr->xpaBiasLvlFreq[0]);
  172. PR_EEP("XPA Bias Freq1", modal_hdr->xpaBiasLvlFreq[1]);
  173. PR_EEP("XPA Bias Freq2", modal_hdr->xpaBiasLvlFreq[2]);
  174. return len;
  175. }
  176. static u32 ath9k_hw_def_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
  177. u8 *buf, u32 len, u32 size)
  178. {
  179. struct ar5416_eeprom_def *eep = &ah->eeprom.def;
  180. struct base_eep_header *pBase = &eep->baseEepHeader;
  181. if (!dump_base_hdr) {
  182. len += snprintf(buf + len, size - len,
  183. "%20s :\n", "2GHz modal Header");
  184. len = ath9k_def_dump_modal_eeprom(buf, len, size,
  185. &eep->modalHeader[0]);
  186. len += snprintf(buf + len, size - len,
  187. "%20s :\n", "5GHz modal Header");
  188. len = ath9k_def_dump_modal_eeprom(buf, len, size,
  189. &eep->modalHeader[1]);
  190. goto out;
  191. }
  192. PR_EEP("Major Version", pBase->version >> 12);
  193. PR_EEP("Minor Version", pBase->version & 0xFFF);
  194. PR_EEP("Checksum", pBase->checksum);
  195. PR_EEP("Length", pBase->length);
  196. PR_EEP("RegDomain1", pBase->regDmn[0]);
  197. PR_EEP("RegDomain2", pBase->regDmn[1]);
  198. PR_EEP("TX Mask", pBase->txMask);
  199. PR_EEP("RX Mask", pBase->rxMask);
  200. PR_EEP("Allow 5GHz", !!(pBase->opCapFlags & AR5416_OPFLAGS_11A));
  201. PR_EEP("Allow 2GHz", !!(pBase->opCapFlags & AR5416_OPFLAGS_11G));
  202. PR_EEP("Disable 2GHz HT20", !!(pBase->opCapFlags &
  203. AR5416_OPFLAGS_N_2G_HT20));
  204. PR_EEP("Disable 2GHz HT40", !!(pBase->opCapFlags &
  205. AR5416_OPFLAGS_N_2G_HT40));
  206. PR_EEP("Disable 5Ghz HT20", !!(pBase->opCapFlags &
  207. AR5416_OPFLAGS_N_5G_HT20));
  208. PR_EEP("Disable 5Ghz HT40", !!(pBase->opCapFlags &
  209. AR5416_OPFLAGS_N_5G_HT40));
  210. PR_EEP("Big Endian", !!(pBase->eepMisc & 0x01));
  211. PR_EEP("Cal Bin Major Ver", (pBase->binBuildNumber >> 24) & 0xFF);
  212. PR_EEP("Cal Bin Minor Ver", (pBase->binBuildNumber >> 16) & 0xFF);
  213. PR_EEP("Cal Bin Build", (pBase->binBuildNumber >> 8) & 0xFF);
  214. PR_EEP("OpenLoop Power Ctrl", pBase->openLoopPwrCntl);
  215. len += snprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress",
  216. pBase->macAddr);
  217. out:
  218. if (len > size)
  219. len = size;
  220. return len;
  221. }
  222. #else
  223. static u32 ath9k_hw_def_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
  224. u8 *buf, u32 len, u32 size)
  225. {
  226. return 0;
  227. }
  228. #endif
  229. static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
  230. {
  231. struct ar5416_eeprom_def *eep = &ah->eeprom.def;
  232. struct ath_common *common = ath9k_hw_common(ah);
  233. u16 *eepdata, temp, magic, magic2;
  234. u32 sum = 0, el;
  235. bool need_swap = false;
  236. int i, addr, size;
  237. if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
  238. ath_err(common, "Reading Magic # failed\n");
  239. return false;
  240. }
  241. if (!ath9k_hw_use_flash(ah)) {
  242. ath_dbg(common, EEPROM, "Read Magic = 0x%04X\n", magic);
  243. if (magic != AR5416_EEPROM_MAGIC) {
  244. magic2 = swab16(magic);
  245. if (magic2 == AR5416_EEPROM_MAGIC) {
  246. size = sizeof(struct ar5416_eeprom_def);
  247. need_swap = true;
  248. eepdata = (u16 *) (&ah->eeprom);
  249. for (addr = 0; addr < size / sizeof(u16); addr++) {
  250. temp = swab16(*eepdata);
  251. *eepdata = temp;
  252. eepdata++;
  253. }
  254. } else {
  255. ath_err(common,
  256. "Invalid EEPROM Magic. Endianness mismatch.\n");
  257. return -EINVAL;
  258. }
  259. }
  260. }
  261. ath_dbg(common, EEPROM, "need_swap = %s\n",
  262. need_swap ? "True" : "False");
  263. if (need_swap)
  264. el = swab16(ah->eeprom.def.baseEepHeader.length);
  265. else
  266. el = ah->eeprom.def.baseEepHeader.length;
  267. if (el > sizeof(struct ar5416_eeprom_def))
  268. el = sizeof(struct ar5416_eeprom_def) / sizeof(u16);
  269. else
  270. el = el / sizeof(u16);
  271. eepdata = (u16 *)(&ah->eeprom);
  272. for (i = 0; i < el; i++)
  273. sum ^= *eepdata++;
  274. if (need_swap) {
  275. u32 integer, j;
  276. u16 word;
  277. ath_dbg(common, EEPROM,
  278. "EEPROM Endianness is not native.. Changing.\n");
  279. word = swab16(eep->baseEepHeader.length);
  280. eep->baseEepHeader.length = word;
  281. word = swab16(eep->baseEepHeader.checksum);
  282. eep->baseEepHeader.checksum = word;
  283. word = swab16(eep->baseEepHeader.version);
  284. eep->baseEepHeader.version = word;
  285. word = swab16(eep->baseEepHeader.regDmn[0]);
  286. eep->baseEepHeader.regDmn[0] = word;
  287. word = swab16(eep->baseEepHeader.regDmn[1]);
  288. eep->baseEepHeader.regDmn[1] = word;
  289. word = swab16(eep->baseEepHeader.rfSilent);
  290. eep->baseEepHeader.rfSilent = word;
  291. word = swab16(eep->baseEepHeader.blueToothOptions);
  292. eep->baseEepHeader.blueToothOptions = word;
  293. word = swab16(eep->baseEepHeader.deviceCap);
  294. eep->baseEepHeader.deviceCap = word;
  295. for (j = 0; j < ARRAY_SIZE(eep->modalHeader); j++) {
  296. struct modal_eep_header *pModal =
  297. &eep->modalHeader[j];
  298. integer = swab32(pModal->antCtrlCommon);
  299. pModal->antCtrlCommon = integer;
  300. for (i = 0; i < AR5416_MAX_CHAINS; i++) {
  301. integer = swab32(pModal->antCtrlChain[i]);
  302. pModal->antCtrlChain[i] = integer;
  303. }
  304. for (i = 0; i < 3; i++) {
  305. word = swab16(pModal->xpaBiasLvlFreq[i]);
  306. pModal->xpaBiasLvlFreq[i] = word;
  307. }
  308. for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
  309. word = swab16(pModal->spurChans[i].spurChan);
  310. pModal->spurChans[i].spurChan = word;
  311. }
  312. }
  313. }
  314. if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER ||
  315. ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) {
  316. ath_err(common, "Bad EEPROM checksum 0x%x or revision 0x%04x\n",
  317. sum, ah->eep_ops->get_eeprom_ver(ah));
  318. return -EINVAL;
  319. }
  320. /* Enable fixup for AR_AN_TOP2 if necessary */
  321. if ((ah->hw_version.devid == AR9280_DEVID_PCI) &&
  322. ((eep->baseEepHeader.version & 0xff) > 0x0a) &&
  323. (eep->baseEepHeader.pwdclkind == 0))
  324. ah->need_an_top2_fixup = true;
  325. if ((common->bus_ops->ath_bus_type == ATH_USB) &&
  326. (AR_SREV_9280(ah)))
  327. eep->modalHeader[0].xpaBiasLvl = 0;
  328. return 0;
  329. }
  330. static u32 ath9k_hw_def_get_eeprom(struct ath_hw *ah,
  331. enum eeprom_param param)
  332. {
  333. struct ar5416_eeprom_def *eep = &ah->eeprom.def;
  334. struct modal_eep_header *pModal = eep->modalHeader;
  335. struct base_eep_header *pBase = &eep->baseEepHeader;
  336. int band = 0;
  337. switch (param) {
  338. case EEP_NFTHRESH_5:
  339. return pModal[0].noiseFloorThreshCh[0];
  340. case EEP_NFTHRESH_2:
  341. return pModal[1].noiseFloorThreshCh[0];
  342. case EEP_MAC_LSW:
  343. return get_unaligned_be16(pBase->macAddr);
  344. case EEP_MAC_MID:
  345. return get_unaligned_be16(pBase->macAddr + 2);
  346. case EEP_MAC_MSW:
  347. return get_unaligned_be16(pBase->macAddr + 4);
  348. case EEP_REG_0:
  349. return pBase->regDmn[0];
  350. case EEP_OP_CAP:
  351. return pBase->deviceCap;
  352. case EEP_OP_MODE:
  353. return pBase->opCapFlags;
  354. case EEP_RF_SILENT:
  355. return pBase->rfSilent;
  356. case EEP_OB_5:
  357. return pModal[0].ob;
  358. case EEP_DB_5:
  359. return pModal[0].db;
  360. case EEP_OB_2:
  361. return pModal[1].ob;
  362. case EEP_DB_2:
  363. return pModal[1].db;
  364. case EEP_MINOR_REV:
  365. return AR5416_VER_MASK;
  366. case EEP_TX_MASK:
  367. return pBase->txMask;
  368. case EEP_RX_MASK:
  369. return pBase->rxMask;
  370. case EEP_FSTCLK_5G:
  371. return pBase->fastClk5g;
  372. case EEP_RXGAIN_TYPE:
  373. return pBase->rxGainType;
  374. case EEP_TXGAIN_TYPE:
  375. return pBase->txGainType;
  376. case EEP_OL_PWRCTRL:
  377. if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_19)
  378. return pBase->openLoopPwrCntl ? true : false;
  379. else
  380. return false;
  381. case EEP_RC_CHAIN_MASK:
  382. if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_19)
  383. return pBase->rcChainMask;
  384. else
  385. return 0;
  386. case EEP_DAC_HPWR_5G:
  387. if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_20)
  388. return pBase->dacHiPwrMode_5G;
  389. else
  390. return 0;
  391. case EEP_FRAC_N_5G:
  392. if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_22)
  393. return pBase->frac_n_5g;
  394. else
  395. return 0;
  396. case EEP_PWR_TABLE_OFFSET:
  397. if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_21)
  398. return pBase->pwr_table_offset;
  399. else
  400. return AR5416_PWR_TABLE_OFFSET_DB;
  401. case EEP_ANTENNA_GAIN_2G:
  402. band = 1;
  403. /* fall through */
  404. case EEP_ANTENNA_GAIN_5G:
  405. return max_t(u8, max_t(u8,
  406. pModal[band].antennaGainCh[0],
  407. pModal[band].antennaGainCh[1]),
  408. pModal[band].antennaGainCh[2]);
  409. default:
  410. return 0;
  411. }
  412. }
  413. static void ath9k_hw_def_set_gain(struct ath_hw *ah,
  414. struct modal_eep_header *pModal,
  415. struct ar5416_eeprom_def *eep,
  416. u8 txRxAttenLocal, int regChainOffset, int i)
  417. {
  418. if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
  419. txRxAttenLocal = pModal->txRxAttenCh[i];
  420. if (AR_SREV_9280_20_OR_LATER(ah)) {
  421. REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  422. AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN,
  423. pModal->bswMargin[i]);
  424. REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  425. AR_PHY_GAIN_2GHZ_XATTEN1_DB,
  426. pModal->bswAtten[i]);
  427. REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  428. AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN,
  429. pModal->xatten2Margin[i]);
  430. REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  431. AR_PHY_GAIN_2GHZ_XATTEN2_DB,
  432. pModal->xatten2Db[i]);
  433. } else {
  434. REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  435. (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  436. ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
  437. | SM(pModal-> bswMargin[i],
  438. AR_PHY_GAIN_2GHZ_BSW_MARGIN));
  439. REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  440. (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  441. ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
  442. | SM(pModal->bswAtten[i],
  443. AR_PHY_GAIN_2GHZ_BSW_ATTEN));
  444. }
  445. }
  446. if (AR_SREV_9280_20_OR_LATER(ah)) {
  447. REG_RMW_FIELD(ah,
  448. AR_PHY_RXGAIN + regChainOffset,
  449. AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
  450. REG_RMW_FIELD(ah,
  451. AR_PHY_RXGAIN + regChainOffset,
  452. AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]);
  453. } else {
  454. REG_WRITE(ah,
  455. AR_PHY_RXGAIN + regChainOffset,
  456. (REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) &
  457. ~AR_PHY_RXGAIN_TXRX_ATTEN)
  458. | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN));
  459. REG_WRITE(ah,
  460. AR_PHY_GAIN_2GHZ + regChainOffset,
  461. (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  462. ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
  463. SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
  464. }
  465. }
  466. static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
  467. struct ath9k_channel *chan)
  468. {
  469. struct modal_eep_header *pModal;
  470. struct ar5416_eeprom_def *eep = &ah->eeprom.def;
  471. int i, regChainOffset;
  472. u8 txRxAttenLocal;
  473. pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
  474. txRxAttenLocal = IS_CHAN_2GHZ(chan) ? 23 : 44;
  475. REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon & 0xffff);
  476. for (i = 0; i < AR5416_MAX_CHAINS; i++) {
  477. if (AR_SREV_9280(ah)) {
  478. if (i >= 2)
  479. break;
  480. }
  481. if ((ah->rxchainmask == 5 || ah->txchainmask == 5) && (i != 0))
  482. regChainOffset = (i == 1) ? 0x2000 : 0x1000;
  483. else
  484. regChainOffset = i * 0x1000;
  485. REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset,
  486. pModal->antCtrlChain[i]);
  487. REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset,
  488. (REG_READ(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset) &
  489. ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
  490. AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
  491. SM(pModal->iqCalICh[i],
  492. AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  493. SM(pModal->iqCalQCh[i],
  494. AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
  495. ath9k_hw_def_set_gain(ah, pModal, eep, txRxAttenLocal,
  496. regChainOffset, i);
  497. }
  498. if (AR_SREV_9280_20_OR_LATER(ah)) {
  499. if (IS_CHAN_2GHZ(chan)) {
  500. ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH0,
  501. AR_AN_RF2G1_CH0_OB,
  502. AR_AN_RF2G1_CH0_OB_S,
  503. pModal->ob);
  504. ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH0,
  505. AR_AN_RF2G1_CH0_DB,
  506. AR_AN_RF2G1_CH0_DB_S,
  507. pModal->db);
  508. ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH1,
  509. AR_AN_RF2G1_CH1_OB,
  510. AR_AN_RF2G1_CH1_OB_S,
  511. pModal->ob_ch1);
  512. ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH1,
  513. AR_AN_RF2G1_CH1_DB,
  514. AR_AN_RF2G1_CH1_DB_S,
  515. pModal->db_ch1);
  516. } else {
  517. ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH0,
  518. AR_AN_RF5G1_CH0_OB5,
  519. AR_AN_RF5G1_CH0_OB5_S,
  520. pModal->ob);
  521. ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH0,
  522. AR_AN_RF5G1_CH0_DB5,
  523. AR_AN_RF5G1_CH0_DB5_S,
  524. pModal->db);
  525. ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH1,
  526. AR_AN_RF5G1_CH1_OB5,
  527. AR_AN_RF5G1_CH1_OB5_S,
  528. pModal->ob_ch1);
  529. ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH1,
  530. AR_AN_RF5G1_CH1_DB5,
  531. AR_AN_RF5G1_CH1_DB5_S,
  532. pModal->db_ch1);
  533. }
  534. ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
  535. AR_AN_TOP2_XPABIAS_LVL,
  536. AR_AN_TOP2_XPABIAS_LVL_S,
  537. pModal->xpaBiasLvl);
  538. ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
  539. AR_AN_TOP2_LOCALBIAS,
  540. AR_AN_TOP2_LOCALBIAS_S,
  541. !!(pModal->lna_ctl &
  542. LNA_CTL_LOCAL_BIAS));
  543. REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG,
  544. !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA));
  545. }
  546. REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
  547. pModal->switchSettling);
  548. REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC,
  549. pModal->adcDesiredSize);
  550. if (!AR_SREV_9280_20_OR_LATER(ah))
  551. REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ,
  552. AR_PHY_DESIRED_SZ_PGA,
  553. pModal->pgaDesiredSize);
  554. REG_WRITE(ah, AR_PHY_RF_CTL4,
  555. SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF)
  556. | SM(pModal->txEndToXpaOff,
  557. AR_PHY_RF_CTL4_TX_END_XPAB_OFF)
  558. | SM(pModal->txFrameToXpaOn,
  559. AR_PHY_RF_CTL4_FRAME_XPAA_ON)
  560. | SM(pModal->txFrameToXpaOn,
  561. AR_PHY_RF_CTL4_FRAME_XPAB_ON));
  562. REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON,
  563. pModal->txEndToRxOn);
  564. if (AR_SREV_9280_20_OR_LATER(ah)) {
  565. REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62,
  566. pModal->thresh62);
  567. REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0,
  568. AR_PHY_EXT_CCA0_THRESH62,
  569. pModal->thresh62);
  570. } else {
  571. REG_RMW_FIELD(ah, AR_PHY_CCA, AR_PHY_CCA_THRESH62,
  572. pModal->thresh62);
  573. REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
  574. AR_PHY_EXT_CCA_THRESH62,
  575. pModal->thresh62);
  576. }
  577. if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_2) {
  578. REG_RMW_FIELD(ah, AR_PHY_RF_CTL2,
  579. AR_PHY_TX_END_DATA_START,
  580. pModal->txFrameToDataStart);
  581. REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_END_PA_ON,
  582. pModal->txFrameToPaOn);
  583. }
  584. if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
  585. if (IS_CHAN_HT40(chan))
  586. REG_RMW_FIELD(ah, AR_PHY_SETTLING,
  587. AR_PHY_SETTLING_SWITCH,
  588. pModal->swSettleHt40);
  589. }
  590. if (AR_SREV_9280_20_OR_LATER(ah) &&
  591. AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_19)
  592. REG_RMW_FIELD(ah, AR_PHY_CCK_TX_CTRL,
  593. AR_PHY_CCK_TX_CTRL_TX_DAC_SCALE_CCK,
  594. pModal->miscBits);
  595. if (AR_SREV_9280_20(ah) && AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_20) {
  596. if (IS_CHAN_2GHZ(chan))
  597. REG_RMW_FIELD(ah, AR_AN_TOP1, AR_AN_TOP1_DACIPMODE,
  598. eep->baseEepHeader.dacLpMode);
  599. else if (eep->baseEepHeader.dacHiPwrMode_5G)
  600. REG_RMW_FIELD(ah, AR_AN_TOP1, AR_AN_TOP1_DACIPMODE, 0);
  601. else
  602. REG_RMW_FIELD(ah, AR_AN_TOP1, AR_AN_TOP1_DACIPMODE,
  603. eep->baseEepHeader.dacLpMode);
  604. udelay(100);
  605. REG_RMW_FIELD(ah, AR_PHY_FRAME_CTL, AR_PHY_FRAME_CTL_TX_CLIP,
  606. pModal->miscBits >> 2);
  607. REG_RMW_FIELD(ah, AR_PHY_TX_PWRCTRL9,
  608. AR_PHY_TX_DESIRED_SCALE_CCK,
  609. eep->baseEepHeader.desiredScaleCCK);
  610. }
  611. }
  612. static void ath9k_hw_def_set_addac(struct ath_hw *ah,
  613. struct ath9k_channel *chan)
  614. {
  615. #define XPA_LVL_FREQ(cnt) (pModal->xpaBiasLvlFreq[cnt])
  616. struct modal_eep_header *pModal;
  617. struct ar5416_eeprom_def *eep = &ah->eeprom.def;
  618. u8 biaslevel;
  619. if (ah->hw_version.macVersion != AR_SREV_VERSION_9160)
  620. return;
  621. if (ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_MINOR_VER_7)
  622. return;
  623. pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
  624. if (pModal->xpaBiasLvl != 0xff) {
  625. biaslevel = pModal->xpaBiasLvl;
  626. } else {
  627. u16 resetFreqBin, freqBin, freqCount = 0;
  628. struct chan_centers centers;
  629. ath9k_hw_get_channel_centers(ah, chan, &centers);
  630. resetFreqBin = FREQ2FBIN(centers.synth_center,
  631. IS_CHAN_2GHZ(chan));
  632. freqBin = XPA_LVL_FREQ(0) & 0xff;
  633. biaslevel = (u8) (XPA_LVL_FREQ(0) >> 14);
  634. freqCount++;
  635. while (freqCount < 3) {
  636. if (XPA_LVL_FREQ(freqCount) == 0x0)
  637. break;
  638. freqBin = XPA_LVL_FREQ(freqCount) & 0xff;
  639. if (resetFreqBin >= freqBin)
  640. biaslevel = (u8)(XPA_LVL_FREQ(freqCount) >> 14);
  641. else
  642. break;
  643. freqCount++;
  644. }
  645. }
  646. if (IS_CHAN_2GHZ(chan)) {
  647. INI_RA(&ah->iniAddac, 7, 1) = (INI_RA(&ah->iniAddac,
  648. 7, 1) & (~0x18)) | biaslevel << 3;
  649. } else {
  650. INI_RA(&ah->iniAddac, 6, 1) = (INI_RA(&ah->iniAddac,
  651. 6, 1) & (~0xc0)) | biaslevel << 6;
  652. }
  653. #undef XPA_LVL_FREQ
  654. }
  655. static int16_t ath9k_change_gain_boundary_setting(struct ath_hw *ah,
  656. u16 *gb,
  657. u16 numXpdGain,
  658. u16 pdGainOverlap_t2,
  659. int8_t pwr_table_offset,
  660. int16_t *diff)
  661. {
  662. u16 k;
  663. /* Prior to writing the boundaries or the pdadc vs. power table
  664. * into the chip registers the default starting point on the pdadc
  665. * vs. power table needs to be checked and the curve boundaries
  666. * adjusted accordingly
  667. */
  668. if (AR_SREV_9280_20_OR_LATER(ah)) {
  669. u16 gb_limit;
  670. if (AR5416_PWR_TABLE_OFFSET_DB != pwr_table_offset) {
  671. /* get the difference in dB */
  672. *diff = (u16)(pwr_table_offset - AR5416_PWR_TABLE_OFFSET_DB);
  673. /* get the number of half dB steps */
  674. *diff *= 2;
  675. /* change the original gain boundary settings
  676. * by the number of half dB steps
  677. */
  678. for (k = 0; k < numXpdGain; k++)
  679. gb[k] = (u16)(gb[k] - *diff);
  680. }
  681. /* Because of a hardware limitation, ensure the gain boundary
  682. * is not larger than (63 - overlap)
  683. */
  684. gb_limit = (u16)(MAX_RATE_POWER - pdGainOverlap_t2);
  685. for (k = 0; k < numXpdGain; k++)
  686. gb[k] = (u16)min(gb_limit, gb[k]);
  687. }
  688. return *diff;
  689. }
  690. static void ath9k_adjust_pdadc_values(struct ath_hw *ah,
  691. int8_t pwr_table_offset,
  692. int16_t diff,
  693. u8 *pdadcValues)
  694. {
  695. #define NUM_PDADC(diff) (AR5416_NUM_PDADC_VALUES - diff)
  696. u16 k;
  697. /* If this is a board that has a pwrTableOffset that differs from
  698. * the default AR5416_PWR_TABLE_OFFSET_DB then the start of the
  699. * pdadc vs pwr table needs to be adjusted prior to writing to the
  700. * chip.
  701. */
  702. if (AR_SREV_9280_20_OR_LATER(ah)) {
  703. if (AR5416_PWR_TABLE_OFFSET_DB != pwr_table_offset) {
  704. /* shift the table to start at the new offset */
  705. for (k = 0; k < (u16)NUM_PDADC(diff); k++ ) {
  706. pdadcValues[k] = pdadcValues[k + diff];
  707. }
  708. /* fill the back of the table */
  709. for (k = (u16)NUM_PDADC(diff); k < NUM_PDADC(0); k++) {
  710. pdadcValues[k] = pdadcValues[NUM_PDADC(diff)];
  711. }
  712. }
  713. }
  714. #undef NUM_PDADC
  715. }
  716. static void ath9k_hw_set_def_power_cal_table(struct ath_hw *ah,
  717. struct ath9k_channel *chan)
  718. {
  719. #define SM_PD_GAIN(x) SM(0x38, AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_##x)
  720. #define SM_PDGAIN_B(x, y) \
  721. SM((gainBoundaries[x]), AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_##y)
  722. struct ath_common *common = ath9k_hw_common(ah);
  723. struct ar5416_eeprom_def *pEepData = &ah->eeprom.def;
  724. struct cal_data_per_freq *pRawDataset;
  725. u8 *pCalBChans = NULL;
  726. u16 pdGainOverlap_t2;
  727. static u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
  728. u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
  729. u16 numPiers, i, j;
  730. int16_t diff = 0;
  731. u16 numXpdGain, xpdMask;
  732. u16 xpdGainValues[AR5416_NUM_PD_GAINS] = { 0, 0, 0, 0 };
  733. u32 reg32, regOffset, regChainOffset;
  734. int16_t modalIdx;
  735. int8_t pwr_table_offset;
  736. modalIdx = IS_CHAN_2GHZ(chan) ? 1 : 0;
  737. xpdMask = pEepData->modalHeader[modalIdx].xpdGain;
  738. pwr_table_offset = ah->eep_ops->get_eeprom(ah, EEP_PWR_TABLE_OFFSET);
  739. if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
  740. AR5416_EEP_MINOR_VER_2) {
  741. pdGainOverlap_t2 =
  742. pEepData->modalHeader[modalIdx].pdGainOverlap;
  743. } else {
  744. pdGainOverlap_t2 = (u16)(MS(REG_READ(ah, AR_PHY_TPCRG5),
  745. AR_PHY_TPCRG5_PD_GAIN_OVERLAP));
  746. }
  747. if (IS_CHAN_2GHZ(chan)) {
  748. pCalBChans = pEepData->calFreqPier2G;
  749. numPiers = AR5416_NUM_2G_CAL_PIERS;
  750. } else {
  751. pCalBChans = pEepData->calFreqPier5G;
  752. numPiers = AR5416_NUM_5G_CAL_PIERS;
  753. }
  754. if (OLC_FOR_AR9280_20_LATER && IS_CHAN_2GHZ(chan)) {
  755. pRawDataset = pEepData->calPierData2G[0];
  756. ah->initPDADC = ((struct calDataPerFreqOpLoop *)
  757. pRawDataset)->vpdPdg[0][0];
  758. }
  759. numXpdGain = 0;
  760. for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) {
  761. if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) {
  762. if (numXpdGain >= AR5416_NUM_PD_GAINS)
  763. break;
  764. xpdGainValues[numXpdGain] =
  765. (u16)(AR5416_PD_GAINS_IN_MASK - i);
  766. numXpdGain++;
  767. }
  768. }
  769. REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
  770. (numXpdGain - 1) & 0x3);
  771. REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
  772. xpdGainValues[0]);
  773. REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
  774. xpdGainValues[1]);
  775. REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3,
  776. xpdGainValues[2]);
  777. for (i = 0; i < AR5416_MAX_CHAINS; i++) {
  778. if ((ah->rxchainmask == 5 || ah->txchainmask == 5) &&
  779. (i != 0)) {
  780. regChainOffset = (i == 1) ? 0x2000 : 0x1000;
  781. } else
  782. regChainOffset = i * 0x1000;
  783. if (pEepData->baseEepHeader.txMask & (1 << i)) {
  784. if (IS_CHAN_2GHZ(chan))
  785. pRawDataset = pEepData->calPierData2G[i];
  786. else
  787. pRawDataset = pEepData->calPierData5G[i];
  788. if (OLC_FOR_AR9280_20_LATER) {
  789. u8 pcdacIdx;
  790. u8 txPower;
  791. ath9k_get_txgain_index(ah, chan,
  792. (struct calDataPerFreqOpLoop *)pRawDataset,
  793. pCalBChans, numPiers, &txPower, &pcdacIdx);
  794. ath9k_olc_get_pdadcs(ah, pcdacIdx,
  795. txPower/2, pdadcValues);
  796. } else {
  797. ath9k_hw_get_gain_boundaries_pdadcs(ah,
  798. chan, pRawDataset,
  799. pCalBChans, numPiers,
  800. pdGainOverlap_t2,
  801. gainBoundaries,
  802. pdadcValues,
  803. numXpdGain);
  804. }
  805. diff = ath9k_change_gain_boundary_setting(ah,
  806. gainBoundaries,
  807. numXpdGain,
  808. pdGainOverlap_t2,
  809. pwr_table_offset,
  810. &diff);
  811. ENABLE_REGWRITE_BUFFER(ah);
  812. if (OLC_FOR_AR9280_20_LATER) {
  813. REG_WRITE(ah,
  814. AR_PHY_TPCRG5 + regChainOffset,
  815. SM(0x6,
  816. AR_PHY_TPCRG5_PD_GAIN_OVERLAP) |
  817. SM_PD_GAIN(1) | SM_PD_GAIN(2) |
  818. SM_PD_GAIN(3) | SM_PD_GAIN(4));
  819. } else {
  820. REG_WRITE(ah,
  821. AR_PHY_TPCRG5 + regChainOffset,
  822. SM(pdGainOverlap_t2,
  823. AR_PHY_TPCRG5_PD_GAIN_OVERLAP)|
  824. SM_PDGAIN_B(0, 1) |
  825. SM_PDGAIN_B(1, 2) |
  826. SM_PDGAIN_B(2, 3) |
  827. SM_PDGAIN_B(3, 4));
  828. }
  829. ath9k_adjust_pdadc_values(ah, pwr_table_offset,
  830. diff, pdadcValues);
  831. regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset;
  832. for (j = 0; j < 32; j++) {
  833. reg32 = get_unaligned_le32(&pdadcValues[4 * j]);
  834. REG_WRITE(ah, regOffset, reg32);
  835. ath_dbg(common, EEPROM,
  836. "PDADC (%d,%4x): %4.4x %8.8x\n",
  837. i, regChainOffset, regOffset,
  838. reg32);
  839. ath_dbg(common, EEPROM,
  840. "PDADC: Chain %d | PDADC %3d Value %3d | PDADC %3d Value %3d | PDADC %3d Value %3d | PDADC %3d Value %3d |\n",
  841. i, 4 * j, pdadcValues[4 * j],
  842. 4 * j + 1, pdadcValues[4 * j + 1],
  843. 4 * j + 2, pdadcValues[4 * j + 2],
  844. 4 * j + 3, pdadcValues[4 * j + 3]);
  845. regOffset += 4;
  846. }
  847. REGWRITE_BUFFER_FLUSH(ah);
  848. }
  849. }
  850. #undef SM_PD_GAIN
  851. #undef SM_PDGAIN_B
  852. }
  853. static void ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah,
  854. struct ath9k_channel *chan,
  855. int16_t *ratesArray,
  856. u16 cfgCtl,
  857. u16 antenna_reduction,
  858. u16 powerLimit)
  859. {
  860. struct ar5416_eeprom_def *pEepData = &ah->eeprom.def;
  861. u16 twiceMaxEdgePower;
  862. int i;
  863. struct cal_ctl_data *rep;
  864. struct cal_target_power_leg targetPowerOfdm, targetPowerCck = {
  865. 0, { 0, 0, 0, 0}
  866. };
  867. struct cal_target_power_leg targetPowerOfdmExt = {
  868. 0, { 0, 0, 0, 0} }, targetPowerCckExt = {
  869. 0, { 0, 0, 0, 0 }
  870. };
  871. struct cal_target_power_ht targetPowerHt20, targetPowerHt40 = {
  872. 0, {0, 0, 0, 0}
  873. };
  874. u16 scaledPower = 0, minCtlPower;
  875. static const u16 ctlModesFor11a[] = {
  876. CTL_11A, CTL_5GHT20, CTL_11A_EXT, CTL_5GHT40
  877. };
  878. static const u16 ctlModesFor11g[] = {
  879. CTL_11B, CTL_11G, CTL_2GHT20,
  880. CTL_11B_EXT, CTL_11G_EXT, CTL_2GHT40
  881. };
  882. u16 numCtlModes;
  883. const u16 *pCtlMode;
  884. u16 ctlMode, freq;
  885. struct chan_centers centers;
  886. int tx_chainmask;
  887. u16 twiceMinEdgePower;
  888. tx_chainmask = ah->txchainmask;
  889. ath9k_hw_get_channel_centers(ah, chan, &centers);
  890. scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit,
  891. antenna_reduction);
  892. if (IS_CHAN_2GHZ(chan)) {
  893. numCtlModes = ARRAY_SIZE(ctlModesFor11g) -
  894. SUB_NUM_CTL_MODES_AT_2G_40;
  895. pCtlMode = ctlModesFor11g;
  896. ath9k_hw_get_legacy_target_powers(ah, chan,
  897. pEepData->calTargetPowerCck,
  898. AR5416_NUM_2G_CCK_TARGET_POWERS,
  899. &targetPowerCck, 4, false);
  900. ath9k_hw_get_legacy_target_powers(ah, chan,
  901. pEepData->calTargetPower2G,
  902. AR5416_NUM_2G_20_TARGET_POWERS,
  903. &targetPowerOfdm, 4, false);
  904. ath9k_hw_get_target_powers(ah, chan,
  905. pEepData->calTargetPower2GHT20,
  906. AR5416_NUM_2G_20_TARGET_POWERS,
  907. &targetPowerHt20, 8, false);
  908. if (IS_CHAN_HT40(chan)) {
  909. numCtlModes = ARRAY_SIZE(ctlModesFor11g);
  910. ath9k_hw_get_target_powers(ah, chan,
  911. pEepData->calTargetPower2GHT40,
  912. AR5416_NUM_2G_40_TARGET_POWERS,
  913. &targetPowerHt40, 8, true);
  914. ath9k_hw_get_legacy_target_powers(ah, chan,
  915. pEepData->calTargetPowerCck,
  916. AR5416_NUM_2G_CCK_TARGET_POWERS,
  917. &targetPowerCckExt, 4, true);
  918. ath9k_hw_get_legacy_target_powers(ah, chan,
  919. pEepData->calTargetPower2G,
  920. AR5416_NUM_2G_20_TARGET_POWERS,
  921. &targetPowerOfdmExt, 4, true);
  922. }
  923. } else {
  924. numCtlModes = ARRAY_SIZE(ctlModesFor11a) -
  925. SUB_NUM_CTL_MODES_AT_5G_40;
  926. pCtlMode = ctlModesFor11a;
  927. ath9k_hw_get_legacy_target_powers(ah, chan,
  928. pEepData->calTargetPower5G,
  929. AR5416_NUM_5G_20_TARGET_POWERS,
  930. &targetPowerOfdm, 4, false);
  931. ath9k_hw_get_target_powers(ah, chan,
  932. pEepData->calTargetPower5GHT20,
  933. AR5416_NUM_5G_20_TARGET_POWERS,
  934. &targetPowerHt20, 8, false);
  935. if (IS_CHAN_HT40(chan)) {
  936. numCtlModes = ARRAY_SIZE(ctlModesFor11a);
  937. ath9k_hw_get_target_powers(ah, chan,
  938. pEepData->calTargetPower5GHT40,
  939. AR5416_NUM_5G_40_TARGET_POWERS,
  940. &targetPowerHt40, 8, true);
  941. ath9k_hw_get_legacy_target_powers(ah, chan,
  942. pEepData->calTargetPower5G,
  943. AR5416_NUM_5G_20_TARGET_POWERS,
  944. &targetPowerOfdmExt, 4, true);
  945. }
  946. }
  947. for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
  948. bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) ||
  949. (pCtlMode[ctlMode] == CTL_2GHT40);
  950. if (isHt40CtlMode)
  951. freq = centers.synth_center;
  952. else if (pCtlMode[ctlMode] & EXT_ADDITIVE)
  953. freq = centers.ext_center;
  954. else
  955. freq = centers.ctl_center;
  956. twiceMaxEdgePower = MAX_RATE_POWER;
  957. for (i = 0; (i < AR5416_NUM_CTLS) && pEepData->ctlIndex[i]; i++) {
  958. if ((((cfgCtl & ~CTL_MODE_M) |
  959. (pCtlMode[ctlMode] & CTL_MODE_M)) ==
  960. pEepData->ctlIndex[i]) ||
  961. (((cfgCtl & ~CTL_MODE_M) |
  962. (pCtlMode[ctlMode] & CTL_MODE_M)) ==
  963. ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL))) {
  964. rep = &(pEepData->ctlData[i]);
  965. twiceMinEdgePower = ath9k_hw_get_max_edge_power(freq,
  966. rep->ctlEdges[ar5416_get_ntxchains(tx_chainmask) - 1],
  967. IS_CHAN_2GHZ(chan), AR5416_NUM_BAND_EDGES);
  968. if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) {
  969. twiceMaxEdgePower = min(twiceMaxEdgePower,
  970. twiceMinEdgePower);
  971. } else {
  972. twiceMaxEdgePower = twiceMinEdgePower;
  973. break;
  974. }
  975. }
  976. }
  977. minCtlPower = min(twiceMaxEdgePower, scaledPower);
  978. switch (pCtlMode[ctlMode]) {
  979. case CTL_11B:
  980. for (i = 0; i < ARRAY_SIZE(targetPowerCck.tPow2x); i++) {
  981. targetPowerCck.tPow2x[i] =
  982. min((u16)targetPowerCck.tPow2x[i],
  983. minCtlPower);
  984. }
  985. break;
  986. case CTL_11A:
  987. case CTL_11G:
  988. for (i = 0; i < ARRAY_SIZE(targetPowerOfdm.tPow2x); i++) {
  989. targetPowerOfdm.tPow2x[i] =
  990. min((u16)targetPowerOfdm.tPow2x[i],
  991. minCtlPower);
  992. }
  993. break;
  994. case CTL_5GHT20:
  995. case CTL_2GHT20:
  996. for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) {
  997. targetPowerHt20.tPow2x[i] =
  998. min((u16)targetPowerHt20.tPow2x[i],
  999. minCtlPower);
  1000. }
  1001. break;
  1002. case CTL_11B_EXT:
  1003. targetPowerCckExt.tPow2x[0] = min((u16)
  1004. targetPowerCckExt.tPow2x[0],
  1005. minCtlPower);
  1006. break;
  1007. case CTL_11A_EXT:
  1008. case CTL_11G_EXT:
  1009. targetPowerOfdmExt.tPow2x[0] = min((u16)
  1010. targetPowerOfdmExt.tPow2x[0],
  1011. minCtlPower);
  1012. break;
  1013. case CTL_5GHT40:
  1014. case CTL_2GHT40:
  1015. for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
  1016. targetPowerHt40.tPow2x[i] =
  1017. min((u16)targetPowerHt40.tPow2x[i],
  1018. minCtlPower);
  1019. }
  1020. break;
  1021. default:
  1022. break;
  1023. }
  1024. }
  1025. ratesArray[rate6mb] = ratesArray[rate9mb] = ratesArray[rate12mb] =
  1026. ratesArray[rate18mb] = ratesArray[rate24mb] =
  1027. targetPowerOfdm.tPow2x[0];
  1028. ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1];
  1029. ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2];
  1030. ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3];
  1031. ratesArray[rateXr] = targetPowerOfdm.tPow2x[0];
  1032. for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++)
  1033. ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i];
  1034. if (IS_CHAN_2GHZ(chan)) {
  1035. ratesArray[rate1l] = targetPowerCck.tPow2x[0];
  1036. ratesArray[rate2s] = ratesArray[rate2l] =
  1037. targetPowerCck.tPow2x[1];
  1038. ratesArray[rate5_5s] = ratesArray[rate5_5l] =
  1039. targetPowerCck.tPow2x[2];
  1040. ratesArray[rate11s] = ratesArray[rate11l] =
  1041. targetPowerCck.tPow2x[3];
  1042. }
  1043. if (IS_CHAN_HT40(chan)) {
  1044. for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
  1045. ratesArray[rateHt40_0 + i] =
  1046. targetPowerHt40.tPow2x[i];
  1047. }
  1048. ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0];
  1049. ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0];
  1050. ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0];
  1051. if (IS_CHAN_2GHZ(chan)) {
  1052. ratesArray[rateExtCck] =
  1053. targetPowerCckExt.tPow2x[0];
  1054. }
  1055. }
  1056. }
  1057. static void ath9k_hw_def_set_txpower(struct ath_hw *ah,
  1058. struct ath9k_channel *chan,
  1059. u16 cfgCtl,
  1060. u8 twiceAntennaReduction,
  1061. u8 powerLimit, bool test)
  1062. {
  1063. #define RT_AR_DELTA(x) (ratesArray[x] - cck_ofdm_delta)
  1064. struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
  1065. struct ar5416_eeprom_def *pEepData = &ah->eeprom.def;
  1066. struct modal_eep_header *pModal =
  1067. &(pEepData->modalHeader[IS_CHAN_2GHZ(chan)]);
  1068. int16_t ratesArray[Ar5416RateSize];
  1069. u8 ht40PowerIncForPdadc = 2;
  1070. int i, cck_ofdm_delta = 0;
  1071. memset(ratesArray, 0, sizeof(ratesArray));
  1072. if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
  1073. AR5416_EEP_MINOR_VER_2) {
  1074. ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc;
  1075. }
  1076. ath9k_hw_set_def_power_per_rate_table(ah, chan,
  1077. &ratesArray[0], cfgCtl,
  1078. twiceAntennaReduction,
  1079. powerLimit);
  1080. ath9k_hw_set_def_power_cal_table(ah, chan);
  1081. regulatory->max_power_level = 0;
  1082. for (i = 0; i < ARRAY_SIZE(ratesArray); i++) {
  1083. if (ratesArray[i] > MAX_RATE_POWER)
  1084. ratesArray[i] = MAX_RATE_POWER;
  1085. if (ratesArray[i] > regulatory->max_power_level)
  1086. regulatory->max_power_level = ratesArray[i];
  1087. }
  1088. ath9k_hw_update_regulatory_maxpower(ah);
  1089. if (test)
  1090. return;
  1091. if (AR_SREV_9280_20_OR_LATER(ah)) {
  1092. for (i = 0; i < Ar5416RateSize; i++) {
  1093. int8_t pwr_table_offset;
  1094. pwr_table_offset = ah->eep_ops->get_eeprom(ah,
  1095. EEP_PWR_TABLE_OFFSET);
  1096. ratesArray[i] -= pwr_table_offset * 2;
  1097. }
  1098. }
  1099. ENABLE_REGWRITE_BUFFER(ah);
  1100. REG_WRITE(ah, AR_PHY_POWER_TX_RATE1,
  1101. ATH9K_POW_SM(ratesArray[rate18mb], 24)
  1102. | ATH9K_POW_SM(ratesArray[rate12mb], 16)
  1103. | ATH9K_POW_SM(ratesArray[rate9mb], 8)
  1104. | ATH9K_POW_SM(ratesArray[rate6mb], 0));
  1105. REG_WRITE(ah, AR_PHY_POWER_TX_RATE2,
  1106. ATH9K_POW_SM(ratesArray[rate54mb], 24)
  1107. | ATH9K_POW_SM(ratesArray[rate48mb], 16)
  1108. | ATH9K_POW_SM(ratesArray[rate36mb], 8)
  1109. | ATH9K_POW_SM(ratesArray[rate24mb], 0));
  1110. if (IS_CHAN_2GHZ(chan)) {
  1111. if (OLC_FOR_AR9280_20_LATER) {
  1112. cck_ofdm_delta = 2;
  1113. REG_WRITE(ah, AR_PHY_POWER_TX_RATE3,
  1114. ATH9K_POW_SM(RT_AR_DELTA(rate2s), 24)
  1115. | ATH9K_POW_SM(RT_AR_DELTA(rate2l), 16)
  1116. | ATH9K_POW_SM(ratesArray[rateXr], 8)
  1117. | ATH9K_POW_SM(RT_AR_DELTA(rate1l), 0));
  1118. REG_WRITE(ah, AR_PHY_POWER_TX_RATE4,
  1119. ATH9K_POW_SM(RT_AR_DELTA(rate11s), 24)
  1120. | ATH9K_POW_SM(RT_AR_DELTA(rate11l), 16)
  1121. | ATH9K_POW_SM(RT_AR_DELTA(rate5_5s), 8)
  1122. | ATH9K_POW_SM(RT_AR_DELTA(rate5_5l), 0));
  1123. } else {
  1124. REG_WRITE(ah, AR_PHY_POWER_TX_RATE3,
  1125. ATH9K_POW_SM(ratesArray[rate2s], 24)
  1126. | ATH9K_POW_SM(ratesArray[rate2l], 16)
  1127. | ATH9K_POW_SM(ratesArray[rateXr], 8)
  1128. | ATH9K_POW_SM(ratesArray[rate1l], 0));
  1129. REG_WRITE(ah, AR_PHY_POWER_TX_RATE4,
  1130. ATH9K_POW_SM(ratesArray[rate11s], 24)
  1131. | ATH9K_POW_SM(ratesArray[rate11l], 16)
  1132. | ATH9K_POW_SM(ratesArray[rate5_5s], 8)
  1133. | ATH9K_POW_SM(ratesArray[rate5_5l], 0));
  1134. }
  1135. }
  1136. REG_WRITE(ah, AR_PHY_POWER_TX_RATE5,
  1137. ATH9K_POW_SM(ratesArray[rateHt20_3], 24)
  1138. | ATH9K_POW_SM(ratesArray[rateHt20_2], 16)
  1139. | ATH9K_POW_SM(ratesArray[rateHt20_1], 8)
  1140. | ATH9K_POW_SM(ratesArray[rateHt20_0], 0));
  1141. REG_WRITE(ah, AR_PHY_POWER_TX_RATE6,
  1142. ATH9K_POW_SM(ratesArray[rateHt20_7], 24)
  1143. | ATH9K_POW_SM(ratesArray[rateHt20_6], 16)
  1144. | ATH9K_POW_SM(ratesArray[rateHt20_5], 8)
  1145. | ATH9K_POW_SM(ratesArray[rateHt20_4], 0));
  1146. if (IS_CHAN_HT40(chan)) {
  1147. REG_WRITE(ah, AR_PHY_POWER_TX_RATE7,
  1148. ATH9K_POW_SM(ratesArray[rateHt40_3] +
  1149. ht40PowerIncForPdadc, 24)
  1150. | ATH9K_POW_SM(ratesArray[rateHt40_2] +
  1151. ht40PowerIncForPdadc, 16)
  1152. | ATH9K_POW_SM(ratesArray[rateHt40_1] +
  1153. ht40PowerIncForPdadc, 8)
  1154. | ATH9K_POW_SM(ratesArray[rateHt40_0] +
  1155. ht40PowerIncForPdadc, 0));
  1156. REG_WRITE(ah, AR_PHY_POWER_TX_RATE8,
  1157. ATH9K_POW_SM(ratesArray[rateHt40_7] +
  1158. ht40PowerIncForPdadc, 24)
  1159. | ATH9K_POW_SM(ratesArray[rateHt40_6] +
  1160. ht40PowerIncForPdadc, 16)
  1161. | ATH9K_POW_SM(ratesArray[rateHt40_5] +
  1162. ht40PowerIncForPdadc, 8)
  1163. | ATH9K_POW_SM(ratesArray[rateHt40_4] +
  1164. ht40PowerIncForPdadc, 0));
  1165. if (OLC_FOR_AR9280_20_LATER) {
  1166. REG_WRITE(ah, AR_PHY_POWER_TX_RATE9,
  1167. ATH9K_POW_SM(ratesArray[rateExtOfdm], 24)
  1168. | ATH9K_POW_SM(RT_AR_DELTA(rateExtCck), 16)
  1169. | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8)
  1170. | ATH9K_POW_SM(RT_AR_DELTA(rateDupCck), 0));
  1171. } else {
  1172. REG_WRITE(ah, AR_PHY_POWER_TX_RATE9,
  1173. ATH9K_POW_SM(ratesArray[rateExtOfdm], 24)
  1174. | ATH9K_POW_SM(ratesArray[rateExtCck], 16)
  1175. | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8)
  1176. | ATH9K_POW_SM(ratesArray[rateDupCck], 0));
  1177. }
  1178. }
  1179. REG_WRITE(ah, AR_PHY_POWER_TX_SUB,
  1180. ATH9K_POW_SM(pModal->pwrDecreaseFor3Chain, 6)
  1181. | ATH9K_POW_SM(pModal->pwrDecreaseFor2Chain, 0));
  1182. REGWRITE_BUFFER_FLUSH(ah);
  1183. }
  1184. static u16 ath9k_hw_def_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)
  1185. {
  1186. #define EEP_DEF_SPURCHAN \
  1187. (ah->eeprom.def.modalHeader[is2GHz].spurChans[i].spurChan)
  1188. struct ath_common *common = ath9k_hw_common(ah);
  1189. u16 spur_val = AR_NO_SPUR;
  1190. ath_dbg(common, ANI, "Getting spur idx:%d is2Ghz:%d val:%x\n",
  1191. i, is2GHz, ah->config.spurchans[i][is2GHz]);
  1192. switch (ah->config.spurmode) {
  1193. case SPUR_DISABLE:
  1194. break;
  1195. case SPUR_ENABLE_IOCTL:
  1196. spur_val = ah->config.spurchans[i][is2GHz];
  1197. ath_dbg(common, ANI, "Getting spur val from new loc. %d\n",
  1198. spur_val);
  1199. break;
  1200. case SPUR_ENABLE_EEPROM:
  1201. spur_val = EEP_DEF_SPURCHAN;
  1202. break;
  1203. }
  1204. return spur_val;
  1205. #undef EEP_DEF_SPURCHAN
  1206. }
  1207. const struct eeprom_ops eep_def_ops = {
  1208. .check_eeprom = ath9k_hw_def_check_eeprom,
  1209. .get_eeprom = ath9k_hw_def_get_eeprom,
  1210. .fill_eeprom = ath9k_hw_def_fill_eeprom,
  1211. .dump_eeprom = ath9k_hw_def_dump_eeprom,
  1212. .get_eeprom_ver = ath9k_hw_def_get_eeprom_ver,
  1213. .get_eeprom_rev = ath9k_hw_def_get_eeprom_rev,
  1214. .set_board_values = ath9k_hw_def_set_board_values,
  1215. .set_addac = ath9k_hw_def_set_addac,
  1216. .set_txpower = ath9k_hw_def_set_txpower,
  1217. .get_spur_channel = ath9k_hw_def_get_spur_channel
  1218. };