eeprom_def.c 41 KB

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