eeprom_def.c 41 KB

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