iPXE
ath9k_eeprom_4k.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2011 Atheros Communications Inc.
3  *
4  * Modified for iPXE by Scott K Logan <logans@cottsay.net> July 2011
5  * Original from Linux kernel 3.0.1
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 FILE_SECBOOT ( FORBIDDEN );
21 
22 #include <ipxe/io.h>
23 
24 #include "hw.h"
25 #include "ar9002_phy.h"
26 
28 {
29  return ((ah->eeprom.map4k.baseEepHeader.version >> 12) & 0xF);
30 }
31 
33 {
34  return ((ah->eeprom.map4k.baseEepHeader.version) & 0xFFF);
35 }
36 
37 #define SIZE_EEPROM_4K (sizeof(struct ar5416_eeprom_4k) / sizeof(u16))
38 
39 static int __ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
40 {
42  u16 *eep_data = (u16 *)&ah->eeprom.map4k;
43  unsigned int addr;
44  int eep_start_loc = 64;
45 
46  for (addr = 0; addr < SIZE_EEPROM_4K; addr++) {
47  if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, eep_data)) {
48  DBG("ath9k: "
49  "Unable to read eeprom region\n");
50  return 0;
51  }
52  eep_data++;
53  }
54 
55  return 1;
56 }
57 
59 {
60  u16 *eep_data = (u16 *)&ah->eeprom.map4k;
61 
63 
64  return 1;
65 }
66 
67 static int ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
68 {
70 
71  if (!ath9k_hw_use_flash(ah)) {
72  DBG2("ath9k: "
73  "Reading from EEPROM, not flash\n");
74  }
75 
76  if (common->bus_ops->ath_bus_type == ATH_USB)
78  else
80 }
81 
82 #undef SIZE_EEPROM_4K
83 
84 static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
85 {
86 #define EEPROM_4K_SIZE (sizeof(struct ar5416_eeprom_4k) / sizeof(u16))
88  struct ar5416_eeprom_4k *eep =
89  (struct ar5416_eeprom_4k *) &ah->eeprom.map4k;
90  u16 *eepdata, temp, magic, magic2;
91  u32 sum = 0, el;
92  int need_swap = 0;
93  unsigned int i, addr;
94 
95 
98  &magic)) {
99  DBG("ath9k: Reading Magic # failed\n");
100  return 0;
101  }
102 
103  DBG2("ath9k: "
104  "Read Magic = 0x%04X\n", magic);
105 
106  if (magic != AR5416_EEPROM_MAGIC) {
107  magic2 = swab16(magic);
108 
109  if (magic2 == AR5416_EEPROM_MAGIC) {
110  need_swap = 1;
111  eepdata = (u16 *) (&ah->eeprom);
112 
113  for (addr = 0; addr < EEPROM_4K_SIZE; addr++) {
114  temp = swab16(*eepdata);
115  *eepdata = temp;
116  eepdata++;
117  }
118  } else {
119  DBG("ath9k: "
120  "Invalid EEPROM Magic. Endianness mismatch.\n");
121  return -EINVAL;
122  }
123  }
124  }
125 
126  DBG2("ath9k: need_swap = %s.\n",
127  need_swap ? "True" : "False");
128 
129  if (need_swap)
130  el = swab16(ah->eeprom.map4k.baseEepHeader.length);
131  else
132  el = ah->eeprom.map4k.baseEepHeader.length;
133 
134  if (el > sizeof(struct ar5416_eeprom_4k))
135  el = sizeof(struct ar5416_eeprom_4k) / sizeof(u16);
136  else
137  el = el / sizeof(u16);
138 
139  eepdata = (u16 *)(&ah->eeprom);
140 
141  for (i = 0; i < el; i++)
142  sum ^= *eepdata++;
143 
144  if (need_swap) {
145  u32 integer;
146  u16 word;
147 
148  DBG("ath9k: "
149  "EEPROM Endianness is not native.. Changing\n");
150 
152  eep->baseEepHeader.length = word;
153 
155  eep->baseEepHeader.checksum = word;
156 
158  eep->baseEepHeader.version = word;
159 
160  word = swab16(eep->baseEepHeader.regDmn[0]);
161  eep->baseEepHeader.regDmn[0] = word;
162 
163  word = swab16(eep->baseEepHeader.regDmn[1]);
164  eep->baseEepHeader.regDmn[1] = word;
165 
167  eep->baseEepHeader.rfSilent = word;
168 
171 
174 
175  integer = swab32(eep->modalHeader.antCtrlCommon);
176  eep->modalHeader.antCtrlCommon = integer;
177 
178  for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
179  integer = swab32(eep->modalHeader.antCtrlChain[i]);
180  eep->modalHeader.antCtrlChain[i] = integer;
181  }
182 
183  for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
186  }
187  }
188 
189  if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER ||
190  ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) {
191  DBG("ath9k: Bad EEPROM checksum 0x%x or revision 0x%04x\n",
192  sum, ah->eep_ops->get_eeprom_ver(ah));
193  return -EINVAL;
194  }
195 
196  return 0;
197 #undef EEPROM_4K_SIZE
198 }
199 
201  enum eeprom_param param)
202 {
203  struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
204  struct modal_eep_4k_header *pModal = &eep->modalHeader;
205  struct base_eep_header_4k *pBase = &eep->baseEepHeader;
206  u16 ver_minor;
207 
208  ver_minor = pBase->version & AR5416_EEP_VER_MINOR_MASK;
209 
210  switch (param) {
211  case EEP_NFTHRESH_2:
212  return pModal->noiseFloorThreshCh[0];
213  case EEP_MAC_LSW:
214  return pBase->macAddr[0] << 8 | pBase->macAddr[1];
215  case EEP_MAC_MID:
216  return pBase->macAddr[2] << 8 | pBase->macAddr[3];
217  case EEP_MAC_MSW:
218  return pBase->macAddr[4] << 8 | pBase->macAddr[5];
219  case EEP_REG_0:
220  return pBase->regDmn[0];
221  case EEP_REG_1:
222  return pBase->regDmn[1];
223  case EEP_OP_CAP:
224  return pBase->deviceCap;
225  case EEP_OP_MODE:
226  return pBase->opCapFlags;
227  case EEP_RF_SILENT:
228  return pBase->rfSilent;
229  case EEP_OB_2:
230  return pModal->ob_0;
231  case EEP_DB_2:
232  return pModal->db1_1;
233  case EEP_MINOR_REV:
234  return ver_minor;
235  case EEP_TX_MASK:
236  return pBase->txMask;
237  case EEP_RX_MASK:
238  return pBase->rxMask;
239  case EEP_FRAC_N_5G:
240  return 0;
243  case EEP_MODAL_VER:
244  return pModal->version;
245  case EEP_ANT_DIV_CTL1:
246  return pModal->antdiv_ctl1;
247  case EEP_TXGAIN_TYPE:
248  if (ver_minor >= AR5416_EEP_MINOR_VER_19)
249  return pBase->txGainType;
250  else
252  default:
253  return 0;
254  }
255 }
256 
258  struct ath9k_channel *chan,
259  int16_t *pTxPowerIndexOffset)
260 {
261  struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
262  struct cal_data_per_freq_4k *pRawDataset;
263  u8 *pCalBChans = NULL;
264  u16 pdGainOverlap_t2;
265  static u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
266  u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
267  u16 numPiers, i, j;
268  u16 numXpdGain, xpdMask;
269  u16 xpdGainValues[AR5416_EEP4K_NUM_PD_GAINS] = { 0, 0 };
270  u32 reg32, regOffset, regChainOffset;
271 
272  xpdMask = pEepData->modalHeader.xpdGain;
273 
274  if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
276  pdGainOverlap_t2 =
277  pEepData->modalHeader.pdGainOverlap;
278  } else {
279  pdGainOverlap_t2 = (u16)(MS(REG_READ(ah, AR_PHY_TPCRG5),
281  }
282 
283  pCalBChans = pEepData->calFreqPier2G;
285 
286  numXpdGain = 0;
287 
288  for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) {
289  if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) {
290  if (numXpdGain >= AR5416_EEP4K_NUM_PD_GAINS)
291  break;
292  xpdGainValues[numXpdGain] =
294  numXpdGain++;
295  }
296  }
297 
299  (numXpdGain - 1) & 0x3);
301  xpdGainValues[0]);
303  xpdGainValues[1]);
305 
306  for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
308  (ah->rxchainmask == 5 || ah->txchainmask == 5) &&
309  (i != 0)) {
310  regChainOffset = (i == 1) ? 0x2000 : 0x1000;
311  } else
312  regChainOffset = i * 0x1000;
313 
314  if (pEepData->baseEepHeader.txMask & (1 << i)) {
315  pRawDataset = pEepData->calPierData2G[i];
316 
318  pRawDataset, pCalBChans,
319  numPiers, pdGainOverlap_t2,
320  gainBoundaries,
321  pdadcValues, numXpdGain);
322 
324 
325  if ((i == 0) || AR_SREV_5416_20_OR_LATER(ah)) {
326  REG_WRITE(ah, AR_PHY_TPCRG5 + regChainOffset,
327  SM(pdGainOverlap_t2,
329  | SM(gainBoundaries[0],
331  | SM(gainBoundaries[1],
333  | SM(gainBoundaries[2],
335  | SM(gainBoundaries[3],
337  }
338 
339  regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset;
340  for (j = 0; j < 32; j++) {
341  reg32 = ((pdadcValues[4 * j + 0] & 0xFF) << 0) |
342  ((pdadcValues[4 * j + 1] & 0xFF) << 8) |
343  ((pdadcValues[4 * j + 2] & 0xFF) << 16)|
344  ((pdadcValues[4 * j + 3] & 0xFF) << 24);
345  REG_WRITE(ah, regOffset, reg32);
346 
347  DBG2("ath9k: "
348  "PDADC (%d,%4x): %4.4x %8.8x\n",
349  i, regChainOffset, regOffset,
350  reg32);
351  DBG2("ath9k: "
352  "PDADC: Chain %d | "
353  "PDADC %3d Value %3d | "
354  "PDADC %3d Value %3d | "
355  "PDADC %3d Value %3d | "
356  "PDADC %3d Value %3d |\n",
357  i, 4 * j, pdadcValues[4 * j],
358  4 * j + 1, pdadcValues[4 * j + 1],
359  4 * j + 2, pdadcValues[4 * j + 2],
360  4 * j + 3, pdadcValues[4 * j + 3]);
361 
362  regOffset += 4;
363  }
364 
366  }
367  }
368 
369  *pTxPowerIndexOffset = 0;
370 }
371 
373  struct ath9k_channel *chan,
374  int16_t *ratesArray,
375  u16 cfgCtl,
376  u16 AntennaReduction,
377  u16 twiceMaxRegulatoryPower,
378  u16 powerLimit)
379 {
380 #define CMP_TEST_GRP \
381  (((cfgCtl & ~CTL_MODE_M)| (pCtlMode[ctlMode] & CTL_MODE_M)) == \
382  pEepData->ctlIndex[i]) \
383  || (((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) == \
384  ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL))
385 
386  struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
387  unsigned int i;
388  int16_t twiceLargestAntenna;
389  u16 twiceMinEdgePower;
390  u16 twiceMaxEdgePower = MAX_RATE_POWER;
391  u16 scaledPower = 0, minCtlPower, maxRegAllowedPower;
392  u16 numCtlModes;
393  const u16 *pCtlMode;
394  u16 ctlMode, freq;
395  struct chan_centers centers;
396  struct cal_ctl_data_4k *rep;
397  struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
398  static const u16 tpScaleReductionTable[5] =
399  { 0, 3, 6, 9, MAX_RATE_POWER };
400  struct cal_target_power_leg targetPowerOfdm, targetPowerCck = {
401  0, { 0, 0, 0, 0}
402  };
403  struct cal_target_power_leg targetPowerOfdmExt = {
404  0, { 0, 0, 0, 0} }, targetPowerCckExt = {
405  0, { 0, 0, 0, 0 }
406  };
407  struct cal_target_power_ht targetPowerHt20, targetPowerHt40 = {
408  0, {0, 0, 0, 0}
409  };
410  static const u16 ctlModesFor11g[] = {
413  };
414 
415  ath9k_hw_get_channel_centers(ah, chan, &centers);
416 
417  twiceLargestAntenna = pEepData->modalHeader.antennaGainCh[0];
418  twiceLargestAntenna = (int16_t)min(AntennaReduction -
419  twiceLargestAntenna, 0);
420 
421  maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna;
422  if (regulatory->tp_scale != ATH9K_TP_SCALE_MAX) {
423  maxRegAllowedPower -=
424  (tpScaleReductionTable[(regulatory->tp_scale)] * 2);
425  }
426 
427  scaledPower = min(powerLimit, maxRegAllowedPower);
428  scaledPower = max((u16)0, scaledPower);
429 
430  numCtlModes = ARRAY_SIZE(ctlModesFor11g) - SUB_NUM_CTL_MODES_AT_2G_40;
431  pCtlMode = ctlModesFor11g;
432 
434  pEepData->calTargetPowerCck,
436  &targetPowerCck, 4, 0);
438  pEepData->calTargetPower2G,
440  &targetPowerOfdm, 4, 0);
442  pEepData->calTargetPower2GHT20,
444  &targetPowerHt20, 8, 0);
445 
446  if (IS_CHAN_HT40(chan)) {
447  numCtlModes = ARRAY_SIZE(ctlModesFor11g);
449  pEepData->calTargetPower2GHT40,
451  &targetPowerHt40, 8, 1);
453  pEepData->calTargetPowerCck,
455  &targetPowerCckExt, 4, 1);
457  pEepData->calTargetPower2G,
459  &targetPowerOfdmExt, 4, 1);
460  }
461 
462  for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
463  int isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) ||
464  (pCtlMode[ctlMode] == CTL_2GHT40);
465 
466  if (isHt40CtlMode)
467  freq = centers.synth_center;
468  else if (pCtlMode[ctlMode] & EXT_ADDITIVE)
469  freq = centers.ext_center;
470  else
471  freq = centers.ctl_center;
472 
473  if (ah->eep_ops->get_eeprom_ver(ah) == 14 &&
474  ah->eep_ops->get_eeprom_rev(ah) <= 2)
475  twiceMaxEdgePower = MAX_RATE_POWER;
476 
477  for (i = 0; (i < AR5416_EEP4K_NUM_CTLS) &&
478  pEepData->ctlIndex[i]; i++) {
479 
480  if (CMP_TEST_GRP) {
481  rep = &(pEepData->ctlData[i]);
482 
483  twiceMinEdgePower = ath9k_hw_get_max_edge_power(
484  freq,
485  rep->ctlEdges[
486  ar5416_get_ntxchains(ah->txchainmask) - 1],
487  IS_CHAN_2GHZ(chan),
489 
490  if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) {
491  twiceMaxEdgePower =
492  min(twiceMaxEdgePower,
493  twiceMinEdgePower);
494  } else {
495  twiceMaxEdgePower = twiceMinEdgePower;
496  break;
497  }
498  }
499  }
500 
501  minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower);
502 
503  switch (pCtlMode[ctlMode]) {
504  case CTL_11B:
505  for (i = 0; i < ARRAY_SIZE(targetPowerCck.tPow2x); i++) {
506  targetPowerCck.tPow2x[i] =
507  min((u16)targetPowerCck.tPow2x[i],
508  minCtlPower);
509  }
510  break;
511  case CTL_11G:
512  for (i = 0; i < ARRAY_SIZE(targetPowerOfdm.tPow2x); i++) {
513  targetPowerOfdm.tPow2x[i] =
514  min((u16)targetPowerOfdm.tPow2x[i],
515  minCtlPower);
516  }
517  break;
518  case CTL_2GHT20:
519  for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) {
520  targetPowerHt20.tPow2x[i] =
521  min((u16)targetPowerHt20.tPow2x[i],
522  minCtlPower);
523  }
524  break;
525  case CTL_11B_EXT:
526  targetPowerCckExt.tPow2x[0] =
527  min((u16)targetPowerCckExt.tPow2x[0],
528  minCtlPower);
529  break;
530  case CTL_11G_EXT:
531  targetPowerOfdmExt.tPow2x[0] =
532  min((u16)targetPowerOfdmExt.tPow2x[0],
533  minCtlPower);
534  break;
535  case CTL_2GHT40:
536  for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
537  targetPowerHt40.tPow2x[i] =
538  min((u16)targetPowerHt40.tPow2x[i],
539  minCtlPower);
540  }
541  break;
542  default:
543  break;
544  }
545  }
546 
547  ratesArray[rate6mb] =
548  ratesArray[rate9mb] =
549  ratesArray[rate12mb] =
550  ratesArray[rate18mb] =
551  ratesArray[rate24mb] =
552  targetPowerOfdm.tPow2x[0];
553 
554  ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1];
555  ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2];
556  ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3];
557  ratesArray[rateXr] = targetPowerOfdm.tPow2x[0];
558 
559  for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++)
560  ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i];
561 
562  ratesArray[rate1l] = targetPowerCck.tPow2x[0];
563  ratesArray[rate2s] = ratesArray[rate2l] = targetPowerCck.tPow2x[1];
564  ratesArray[rate5_5s] = ratesArray[rate5_5l] = targetPowerCck.tPow2x[2];
565  ratesArray[rate11s] = ratesArray[rate11l] = targetPowerCck.tPow2x[3];
566 
567  if (IS_CHAN_HT40(chan)) {
568  for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
569  ratesArray[rateHt40_0 + i] =
570  targetPowerHt40.tPow2x[i];
571  }
572  ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0];
573  ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0];
574  ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0];
575  ratesArray[rateExtCck] = targetPowerCckExt.tPow2x[0];
576  }
577 
578 #undef CMP_TEST_GRP
579 }
580 
581 static void ath9k_hw_4k_set_txpower(struct ath_hw *ah,
582  struct ath9k_channel *chan,
583  u16 cfgCtl,
584  u8 twiceAntennaReduction,
585  u8 twiceMaxRegulatoryPower,
586  u8 powerLimit, int test)
587 {
588  struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
589  struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
590  struct modal_eep_4k_header *pModal = &pEepData->modalHeader;
591  int16_t ratesArray[Ar5416RateSize];
592  int16_t txPowerIndexOffset = 0;
594  unsigned int i;
595 
596  memset(ratesArray, 0, sizeof(ratesArray));
597 
598  if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
601  }
602 
604  &ratesArray[0], cfgCtl,
605  twiceAntennaReduction,
606  twiceMaxRegulatoryPower,
607  powerLimit);
608 
609  ath9k_hw_set_4k_power_cal_table(ah, chan, &txPowerIndexOffset);
610 
611  regulatory->max_power_level = 0;
612  for (i = 0; i < ARRAY_SIZE(ratesArray); i++) {
613  ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]);
614  if (ratesArray[i] > MAX_RATE_POWER)
615  ratesArray[i] = MAX_RATE_POWER;
616 
617  if (ratesArray[i] > regulatory->max_power_level)
618  regulatory->max_power_level = ratesArray[i];
619  }
620 
621  if (test)
622  return;
623 
624  /* Update regulatory */
625  i = rate6mb;
626  if (IS_CHAN_HT40(chan))
627  i = rateHt40_0;
628  else if (IS_CHAN_HT20(chan))
629  i = rateHt20_0;
630 
631  regulatory->max_power_level = ratesArray[i];
632 
634  for (i = 0; i < Ar5416RateSize; i++)
635  ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2;
636  }
637 
639 
640  /* OFDM power per rate */
642  ATH9K_POW_SM(ratesArray[rate18mb], 24)
643  | ATH9K_POW_SM(ratesArray[rate12mb], 16)
644  | ATH9K_POW_SM(ratesArray[rate9mb], 8)
645  | ATH9K_POW_SM(ratesArray[rate6mb], 0));
647  ATH9K_POW_SM(ratesArray[rate54mb], 24)
648  | ATH9K_POW_SM(ratesArray[rate48mb], 16)
649  | ATH9K_POW_SM(ratesArray[rate36mb], 8)
650  | ATH9K_POW_SM(ratesArray[rate24mb], 0));
651 
652  /* CCK power per rate */
654  ATH9K_POW_SM(ratesArray[rate2s], 24)
655  | ATH9K_POW_SM(ratesArray[rate2l], 16)
656  | ATH9K_POW_SM(ratesArray[rateXr], 8)
657  | ATH9K_POW_SM(ratesArray[rate1l], 0));
659  ATH9K_POW_SM(ratesArray[rate11s], 24)
660  | ATH9K_POW_SM(ratesArray[rate11l], 16)
661  | ATH9K_POW_SM(ratesArray[rate5_5s], 8)
662  | ATH9K_POW_SM(ratesArray[rate5_5l], 0));
663 
664  /* HT20 power per rate */
666  ATH9K_POW_SM(ratesArray[rateHt20_3], 24)
667  | ATH9K_POW_SM(ratesArray[rateHt20_2], 16)
668  | ATH9K_POW_SM(ratesArray[rateHt20_1], 8)
669  | ATH9K_POW_SM(ratesArray[rateHt20_0], 0));
671  ATH9K_POW_SM(ratesArray[rateHt20_7], 24)
672  | ATH9K_POW_SM(ratesArray[rateHt20_6], 16)
673  | ATH9K_POW_SM(ratesArray[rateHt20_5], 8)
674  | ATH9K_POW_SM(ratesArray[rateHt20_4], 0));
675 
676  /* HT40 power per rate */
677  if (IS_CHAN_HT40(chan)) {
679  ATH9K_POW_SM(ratesArray[rateHt40_3] +
681  | ATH9K_POW_SM(ratesArray[rateHt40_2] +
683  | ATH9K_POW_SM(ratesArray[rateHt40_1] +
685  | ATH9K_POW_SM(ratesArray[rateHt40_0] +
688  ATH9K_POW_SM(ratesArray[rateHt40_7] +
690  | ATH9K_POW_SM(ratesArray[rateHt40_6] +
692  | ATH9K_POW_SM(ratesArray[rateHt40_5] +
694  | ATH9K_POW_SM(ratesArray[rateHt40_4] +
697  ATH9K_POW_SM(ratesArray[rateExtOfdm], 24)
698  | ATH9K_POW_SM(ratesArray[rateExtCck], 16)
699  | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8)
700  | ATH9K_POW_SM(ratesArray[rateDupCck], 0));
701  }
702 
704 }
705 
706 static void ath9k_hw_4k_set_addac(struct ath_hw *ah,
707  struct ath9k_channel *chan __unused)
708 {
709  struct modal_eep_4k_header *pModal;
710  struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
711  u8 biaslevel;
712 
713  if (ah->hw_version.macVersion != AR_SREV_VERSION_9160)
714  return;
715 
716  if (ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_MINOR_VER_7)
717  return;
718 
719  pModal = &eep->modalHeader;
720 
721  if (pModal->xpaBiasLvl != 0xff) {
722  biaslevel = pModal->xpaBiasLvl;
723  INI_RA(&ah->iniAddac, 7, 1) =
724  (INI_RA(&ah->iniAddac, 7, 1) & (~0x18)) | biaslevel << 3;
725  }
726 }
727 
728 static void ath9k_hw_4k_set_gain(struct ath_hw *ah,
729  struct modal_eep_4k_header *pModal,
730  struct ar5416_eeprom_4k *eep,
731  u8 txRxAttenLocal)
732 {
734  pModal->antCtrlChain[0]);
735 
742 
745  txRxAttenLocal = pModal->txRxAttenCh[0];
746 
753  pModal->xatten2Margin[0]);
756 
757  /* Set the block 1 value to block 0 value */
760  pModal->bswMargin[0]);
765  pModal->xatten2Margin[0]);
768  pModal->xatten2Db[0]);
769  }
770 
772  AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
775 
776  REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
777  AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
778  REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
780 }
781 
782 /*
783  * Read EEPROM header info and program the device for correct operation
784  * given the channel value.
785  */
787  struct ath9k_channel *chan)
788 {
789  struct modal_eep_4k_header *pModal;
790  struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
791  struct base_eep_header_4k *pBase = &eep->baseEepHeader;
792  u8 txRxAttenLocal;
793  u8 ob[5], db1[5], db2[5];
794  u8 ant_div_control1, ant_div_control2;
795  u32 regVal;
796 
797  pModal = &eep->modalHeader;
798  txRxAttenLocal = 23;
799 
801 
802  /* Single chain for 4K EEPROM*/
803  ath9k_hw_4k_set_gain(ah, pModal, eep, txRxAttenLocal);
804 
805  /* Initialize Ant Diversity settings from EEPROM */
806  if (pModal->version >= 3) {
807  ant_div_control1 = pModal->antdiv_ctl1;
808  ant_div_control2 = pModal->antdiv_ctl2;
809 
811  regVal &= (~(AR_PHY_9285_ANT_DIV_CTL_ALL));
812 
813  regVal |= SM(ant_div_control1,
815  regVal |= SM(ant_div_control2,
817  regVal |= SM((ant_div_control2 >> 2),
819  regVal |= SM((ant_div_control1 >> 1),
821  regVal |= SM((ant_div_control1 >> 2),
823 
824 
827  regVal = REG_READ(ah, AR_PHY_CCK_DETECT);
829  regVal |= SM((ant_div_control1 >> 3),
831 
832  REG_WRITE(ah, AR_PHY_CCK_DETECT, regVal);
833  regVal = REG_READ(ah, AR_PHY_CCK_DETECT);
834  }
835 
836  if (pModal->version >= 2) {
837  ob[0] = pModal->ob_0;
838  ob[1] = pModal->ob_1;
839  ob[2] = pModal->ob_2;
840  ob[3] = pModal->ob_3;
841  ob[4] = pModal->ob_4;
842 
843  db1[0] = pModal->db1_0;
844  db1[1] = pModal->db1_1;
845  db1[2] = pModal->db1_2;
846  db1[3] = pModal->db1_3;
847  db1[4] = pModal->db1_4;
848 
849  db2[0] = pModal->db2_0;
850  db2[1] = pModal->db2_1;
851  db2[2] = pModal->db2_2;
852  db2[3] = pModal->db2_3;
853  db2[4] = pModal->db2_4;
854  } else if (pModal->version == 1) {
855  ob[0] = pModal->ob_0;
856  ob[1] = ob[2] = ob[3] = ob[4] = pModal->ob_1;
857  db1[0] = pModal->db1_0;
858  db1[1] = db1[2] = db1[3] = db1[4] = pModal->db1_1;
859  db2[0] = pModal->db2_0;
860  db2[1] = db2[2] = db2[3] = db2[4] = pModal->db2_1;
861  } else {
862  int i;
863 
864  for (i = 0; i < 5; i++) {
865  ob[i] = pModal->ob_0;
866  db1[i] = pModal->db1_0;
867  db2[i] = pModal->db1_0;
868  }
869  }
870 
871  if (AR_SREV_9271(ah)) {
876  ob[0]);
881  ob[1]);
886  ob[2]);
891  db1[0]);
896  db2[0]);
897  } else {
902  ob[0]);
907  ob[1]);
912  ob[2]);
917  ob[3]);
922  ob[4]);
923 
928  db1[0]);
933  db1[1]);
938  db1[2]);
943  db1[3]);
947  AR9285_AN_RF2G4_DB1_4_S, db1[4]);
948 
953  db2[0]);
958  db2[1]);
963  db2[2]);
968  db2[3]);
973  db2[4]);
974  }
975 
976 
978  pModal->switchSettling);
980  pModal->adcDesiredSize);
981 
987 
989  pModal->txEndToRxOn);
990 
991  if (AR_SREV_9271_10(ah))
993  pModal->txEndToRxOn);
995  pModal->thresh62);
997  pModal->thresh62);
998 
1002  pModal->txFrameToDataStart);
1004  pModal->txFrameToPaOn);
1005  }
1006 
1009  if (IS_CHAN_HT40(chan))
1012  pModal->swSettleHt40);
1013  }
1014  if (AR_SREV_9271(ah) || AR_SREV_9285(ah)) {
1015  u8 bb_desired_scale = (pModal->bb_scale_smrt_antenna &
1017  if ((pBase->txGainType == 0) && (bb_desired_scale != 0)) {
1018  u32 pwrctrl, mask, clr;
1019 
1020  mask = BIT(0)|BIT(5)|BIT(10)|BIT(15)|BIT(20)|BIT(25);
1021  pwrctrl = mask * bb_desired_scale;
1022  clr = mask * 0x1f;
1023  REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr);
1024  REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr);
1025  REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr);
1026 
1027  mask = BIT(0)|BIT(5)|BIT(15);
1028  pwrctrl = mask * bb_desired_scale;
1029  clr = mask * 0x1f;
1030  REG_RMW(ah, AR_PHY_TX_PWRCTRL9, pwrctrl, clr);
1031 
1032  mask = BIT(0)|BIT(5);
1033  pwrctrl = mask * bb_desired_scale;
1034  clr = mask * 0x1f;
1035  REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr);
1036  REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr);
1037  }
1038  }
1039 }
1040 
1041 static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, int is2GHz)
1042 {
1043 #define EEP_MAP4K_SPURCHAN \
1044  (ah->eeprom.map4k.modalHeader.spurChans[i].spurChan)
1045 
1046  u16 spur_val = AR_NO_SPUR;
1047 
1048  DBG2("ath9k: "
1049  "Getting spur idx:%d is2Ghz:%d val:%x\n",
1050  i, is2GHz, ah->config.spurchans[i][is2GHz]);
1051 
1052  switch (ah->config.spurmode) {
1053  case SPUR_DISABLE:
1054  break;
1055  case SPUR_ENABLE_IOCTL:
1056  spur_val = ah->config.spurchans[i][is2GHz];
1057  DBG2("ath9k: "
1058  "Getting spur val from new loc. %d\n", spur_val);
1059  break;
1060  case SPUR_ENABLE_EEPROM:
1061  spur_val = EEP_MAP4K_SPURCHAN;
1062  break;
1063  }
1064 
1065  return spur_val;
1066 
1067 #undef EEP_MAP4K_SPURCHAN
1068 }
1069 
1070 const struct eeprom_ops eep_4k_ops = {
1072  .get_eeprom = ath9k_hw_4k_get_eeprom,
1073  .fill_eeprom = ath9k_hw_4k_fill_eeprom,
1074  .get_eeprom_ver = ath9k_hw_4k_get_eeprom_ver,
1075  .get_eeprom_rev = ath9k_hw_4k_get_eeprom_rev,
1076  .set_board_values = ath9k_hw_4k_set_board_values,
1077  .set_addac = ath9k_hw_4k_set_addac,
1078  .set_txpower = ath9k_hw_4k_set_txpower,
1079  .get_spur_channel = ath9k_hw_4k_get_spur_channel
1080 };
static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, struct ath9k_channel *chan, int16_t *ratesArray, u16 cfgCtl, u16 AntennaReduction, u16 twiceMaxRegulatoryPower, u16 powerLimit)
#define AR_PHY_RF_CTL4_FRAME_XPAA_ON
Definition: ar9002_phy.h:87
void ath9k_hw_get_target_powers(struct ath_hw *ah, struct ath9k_channel *chan, struct cal_target_power_ht *powInfo, u16 numChannels, struct cal_target_power_ht *pNewPower, u16 numRates, int isHt40Target)
Definition: ath9k_eeprom.c:218
#define u16
Definition: vga.h:20
uint16_t u16
Definition: stdint.h:22
#define AR_PHY_POWER_TX_RATE5
Definition: ar9002_phy.h:556
#define AR_PHY_RF_CTL4_TX_END_XPAB_OFF
Definition: ar9002_phy.h:81
#define EINVAL
Invalid argument.
Definition: errno.h:429
iPXE I/O API
#define AR_PHY_9285_ANT_DIV_MAIN_GAINTB
Definition: ar9002_phy.h:319
Definition: hw.h:657
u16 synth_center
Definition: hw.h:423
static int ath9k_hw_4k_get_eeprom_ver(struct ath_hw *ah)
#define AR5416_EEP_VER_MINOR_MASK
Definition: eeprom.h:133
#define AR_PHY_RF_CTL3
Definition: ar9002_phy.h:63
#define AR9285_AN_RF2G4_DB2_4
Definition: reg.h:1331
static int __ath9k_hw_usb_4k_fill_eeprom(struct ath_hw *ah)
static int ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
#define AR_PHY_RXGAIN
Definition: ar9002_phy.h:96
#define AR_PHY_POWER_TX_RATE3
Definition: ar9002_phy.h:452
#define max(x, y)
Definition: ath.h:41
#define AR_SREV_9280_20_OR_LATER(_ah)
Definition: reg.h:825
#define ar5416_get_ntxchains(_txchainmask)
Definition: eeprom.h:707
#define CTL_2GHT40
Definition: eeprom.h:76
#define AR9285_AN_RF2G4_DB2_0_S
Definition: reg.h:1324
#define AR9285_AN_RF2G4_DB1_4_S
Definition: reg.h:1321
#define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF
Definition: ar9002_phy.h:191
#define AR9271_AN_RF2G4_DB_2
Definition: reg.h:1355
#define AR_PHY_POWER_TX_RATE2
Definition: ar9002_phy.h:208
#define AR_PHY_TX_PWRCTRL9
Definition: ar9002_phy.h:491
#define AR5416_EEP4K_NUM_PD_GAINS
Definition: eeprom.h:180
#define AR5416_EEPROM_MAGIC_OFFSET
Definition: eeprom.h:60
#define AR5416_EEP4K_MAX_CHAINS
Definition: eeprom.h:181
#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV
Definition: ar9002_phy.h:420
u8 bswMargin[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:419
uint16_t magic
Magic signature.
Definition: bzimage.h:6
#define EXT_ADDITIVE
static void ath9k_hw_4k_set_addac(struct ath_hw *ah, struct ath9k_channel *chan __unused)
#define IS_CHAN_2GHZ(_c)
Definition: hw.h:362
#define AR_EEPROM_MODAL_SPURS
Definition: eeprom.h:26
u8 txRxAttenCh[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:392
#define MS(_v, _f)
Definition: hw.h:103
#define AR_PHY_9285_ANT_DIV_CTL_ALL
Definition: ar9002_phy.h:310
#define AR9285_AN_RF2G3_OB_3_S
Definition: reg.h:1307
#define INI_RA(iniarray, row, column)
Definition: calib.h:46
u16 ext_center
Definition: hw.h:425
#define REGWRITE_BUFFER_FLUSH(_ah)
Definition: hw.h:96
#define AR_PHY_RF_CTL2
Definition: ar9002_phy.h:57
#define AR9285_AN_RF2G3_OB_2
Definition: reg.h:1304
#define AR_PHY_POWER_TX_RATE4
Definition: ar9002_phy.h:453
#define SPUR_DISABLE
Definition: hw.h:236
#define min(x, y)
Definition: ath.h:36
#define AR9271_AN_RF2G4_DB_2_S
Definition: reg.h:1356
const struct eeprom_ops eep_4k_ops
static int __ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
#define REG_RMW(_ah, _reg, _set, _clr)
Definition: hw.h:87
#define AR_PHY_TPCRG1_PD_GAIN_3
Definition: ar9002_phy.h:468
#define AR_SREV_5416_20_OR_LATER(_ah)
Definition: reg.h:802
#define ATH9K_POW_SM(_r, _s)
Definition: eeprom.h:102
#define AR_PHY_9285_ANT_DIV_MAIN_LNACONF
Definition: ar9002_phy.h:315
u16 blueToothOptions
Definition: eeprom.h:323
#define AR5416_EEP4K_NUM_CTLS
Definition: eeprom.h:178
#define AR9285_AN_RF2G3_OB_3
Definition: reg.h:1306
#define AR_PHY_TX_PWRCTRL8
Definition: ar9002_phy.h:489
#define EEP_MAP4K_SPURCHAN
#define AR9271_AN_RF2G3_OB_cck
Definition: reg.h:1342
#define AR_SREV_9285(_ah)
Definition: reg.h:830
#define AR_PHY_MULTICHAIN_GAIN_CTL
Definition: ar9002_phy.h:307
#define AR9285_AN_RF2G4_DB2_4_S
Definition: reg.h:1332
#define AR9280_PHY_CCA_THRESH62
Definition: ar9002_phy.h:137
u8 ob[AR9300_MAX_CHAINS]
Definition: ar9003_eeprom.h:41
#define AR9271_AN_RF2G3_DB_1
Definition: reg.h:1349
#define AR5416_EEP_VER
Definition: eeprom.h:132
#define AR_PHY_POWER_TX_RATE1
Definition: ar9002_phy.h:207
#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2
Definition: ar9002_phy.h:544
#define AR9271_AN_RF2G3_OB_cck_S
Definition: reg.h:1343
u8 xatten2Db[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:421
#define REG_RMW_FIELD(_a, _r, _f, _v)
Definition: hw.h:104
#define AR5416_PD_GAINS_IN_MASK
Definition: eeprom.h:155
#define AR5416_EEP_TXGAIN_ORIGINAL
Definition: eeprom.h:170
struct modal_eep_4k_header modalHeader
Definition: eeprom.h:599
static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
#define AR9271_AN_RF2G3_OB_qam_S
Definition: reg.h:1347
u8 bb_scale_smrt_antenna
Definition: eeprom.h:446
Definition: ath.h:129
#define AR_PHY_DESIRED_SZ
Definition: ar9002_phy.h:106
#define AR5416_EEP_MINOR_VER_7
Definition: eeprom.h:136
#define AR_SREV_VERSION_9160
Definition: reg.h:773
static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah, enum eeprom_param param)
#define AR_PHY_GAIN_2GHZ_XATTEN2_DB
Definition: ar9002_phy.h:435
#define AR_PHY_SWITCH_COM
Definition: ar9002_phy.h:253
#define AR_PHY_CH0_TX_PWRCTRL13
Definition: ar9002_phy.h:506
#define SM(_v, _f)
Definition: hw.h:102
u8 calFreqPier2G[AR5416_EEP4K_NUM_2G_CAL_PIERS]
Definition: eeprom.h:600
#define AR9285_AN_RF2G3_OB_4
Definition: reg.h:1308
#define AR_PHY_TX_END_DATA_START
Definition: ar9002_phy.h:58
#define AR_PHY_GAIN_2GHZ_XATTEN1_DB
Definition: ar9002_phy.h:437
void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, struct ath9k_channel *chan, void *pRawDataSet, u8 *bChans, u16 availPiers, u16 tPdGainOverlap, u16 *pPdGainBoundaries, u8 *pPDADCValues, u16 numXpdGains)
Definition: ath9k_eeprom.c:320
#define AR_PHY_TIMING_CTRL4(_i)
Definition: ar9002_phy.h:188
#define AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN
Definition: ar9002_phy.h:431
#define __unused
Declare a variable or data structure as unused.
Definition: compiler.h:573
static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, int is2GHz)
#define AR9285_AN_RF2G3_DB1_2
Definition: reg.h:1315
#define SIZE_EEPROM_4K
static struct ath_regulatory * ath9k_hw_regulatory(struct ath_hw *ah)
Definition: hw.h:875
static void ath9k_hw_4k_set_gain(struct ath_hw *ah, struct modal_eep_4k_header *pModal, struct ar5416_eeprom_4k *eep, u8 txRxAttenLocal)
#define AR9285_AN_RF2G4_DB2_3_S
Definition: reg.h:1330
static int ath9k_hw_4k_get_eeprom_rev(struct ath_hw *ah)
#define AR_PHY_TX_END_TO_A2_RX_ON
Definition: ar9002_phy.h:64
#define AR_PHY_SETTLING_SWITCH
Definition: ar9002_phy.h:93
u8 rxTxMarginCh[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:393
#define AR_PHY_RF_CTL4
Definition: ar9002_phy.h:80
#define u8
Definition: igbvf_osdep.h:40
Definition: eeprom.h:268
#define SPUR_ENABLE_EEPROM
Definition: hw.h:238
#define AR9285_AN_RF2G4_DB2_2
Definition: reg.h:1327
#define AR_PHY_CH0_TX_PWRCTRL12
Definition: ar9002_phy.h:505
Definition: eeprom.h:267
#define AR9285_AN_RF2G3_DB1_1_S
Definition: reg.h:1314
#define ath9k_hw_use_flash(_ah)
Definition: eeprom.h:104
#define AR_PHY_TPCRG1_PD_GAIN_2
Definition: ar9002_phy.h:466
#define AR5416_NUM_PDADC_VALUES
Definition: eeprom.h:157
u16 spurChan
Definition: eeprom.h:332
#define AR5416_NUM_2G_CCK_TARGET_POWERS
Definition: eeprom.h:149
#define AR_PHY_TPCRG1_PD_GAIN_1
Definition: ar9002_phy.h:464
#define AR5416_EEP_NO_BACK_VER
Definition: eeprom.h:131
struct cal_target_power_leg calTargetPower2G[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]
Definition: eeprom.h:605
int ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data)
Definition: ath9k_eeprom.c:131
#define AR_SREV_9271_10(_ah)
Definition: reg.h:856
#define CTL_11G_EXT
u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, int is2GHz, int num_band_edges)
Definition: ath9k_eeprom.c:273
#define AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN
Definition: ar9002_phy.h:433
u8 ctlIndex[AR5416_EEP4K_NUM_CTLS]
Definition: eeprom.h:611
#define AR5416_EEP4K_NUM_BAND_EDGES
Definition: eeprom.h:179
#define AR9285_AN_RF2G3_DB1_0_S
Definition: reg.h:1312
struct hv_monitor_parameter param[4][32]
Parameters.
Definition: hyperv.h:24
#define AR9285_AN_RF2G4
Definition: reg.h:1317
uint32_t addr
Buffer address.
Definition: dwmac.h:20
#define AR9285_AN_RF2G3_OB_4_S
Definition: reg.h:1309
#define AR9285_AN_RF2G3_DB1_1
Definition: reg.h:1313
#define CMP_TEST_GRP
#define AR5416_NUM_2G_20_TARGET_POWERS
Definition: eeprom.h:150
#define AR9285_AN_RF2G4_DB1_3_S
Definition: reg.h:1319
static struct ath_common * ath9k_hw_common(struct ath_hw *ah)
Definition: hw.h:870
#define AR9285_AN_RF2G4_DB2_2_S
Definition: reg.h:1328
#define AR_PHY_TPCRG1
Definition: ar9002_phy.h:460
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
#define AR_PHY_EXT_CCA0_THRESH62
Definition: ar9002_phy.h:329
#define AR_PHY_9285_ANT_DIV_CTL
Definition: ar9002_phy.h:311
#define AR_PHY_CCK_DETECT
Definition: ar9002_phy.h:414
void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, u32 shift, u32 val)
Definition: ath9k_eeprom.c:42
#define EEP_4K_BB_DESIRED_SCALE_MASK
Definition: eeprom.h:447
#define CTL_11G
Definition: eeprom.h:73
#define AR_NO_SPUR
Definition: hw.h:241
#define AR9285_AN_RF2G4_DB2_3
Definition: reg.h:1329
#define AR_PHY_SETTLING
Definition: ar9002_phy.h:92
u8 iqCalQCh[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:405
u8 antennaGainCh[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:390
#define AR5416_NUM_2G_40_TARGET_POWERS
Definition: eeprom.h:151
#define AR9285_AN_RF2G4_DB1_4
Definition: reg.h:1320
struct ib_cm_common common
Definition: ib_mad.h:12
#define AR_PHY_CH0_TX_PWRCTRL11
Definition: ar9002_phy.h:503
int(* check_eeprom)(struct ath_hw *hw)
Definition: eeprom.h:654
#define REG_READ(_ah, _reg)
Definition: hw.h:81
struct cal_target_power_ht calTargetPower2GHT20[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]
Definition: eeprom.h:607
#define AR9285_AN_RF2G3_OB_0
Definition: reg.h:1300
struct cal_target_power_leg calTargetPowerCck[AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS]
Definition: eeprom.h:603
void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, struct ath9k_channel *chan, struct cal_target_power_leg *powInfo, u16 numChannels, struct cal_target_power_leg *pNewPower, u16 numRates, int isExtTarget)
Definition: ath9k_eeprom.c:163
#define AR9271_AN_RF2G3_DB_1_S
Definition: reg.h:1350
#define AR9285_AN_RF2G3
Definition: reg.h:1297
#define AR9285_AN_RF2G4_DB2_1_S
Definition: reg.h:1326
struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]
Definition: eeprom.h:449
#define AR5416_EEP_MINOR_VER_3
Definition: eeprom.h:135
#define AR5416_EEP4K_NUM_2G_CAL_PIERS
Definition: eeprom.h:174
#define AR_PHY_CCA
Definition: ar9002_phy.h:130
#define AR5416_PWR_TABLE_OFFSET_DB
Definition: eeprom.h:162
#define AR9285_AN_RF2G4_DB2_1
Definition: reg.h:1325
#define EEPROM_4K_SIZE
#define SUB_NUM_CTL_MODES_AT_2G_40
#define SD_NO_CTL
Definition: eeprom.h:68
#define AR9280_PHY_RXGAIN_TXRX_ATTEN
Definition: ar9002_phy.h:101
#define swab16
Definition: ath.h:68
#define AR9285_AN_RF2G3_OB_2_S
Definition: reg.h:1305
#define BIT(nr)
Definition: ath.h:34
#define AR_PHY_TPCRG5_PD_GAIN_OVERLAP
Definition: ar9002_phy.h:540
void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, int eep_start_loc, int size)
Definition: ath9k_eeprom.c:99
static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, struct ath9k_channel *chan, int16_t *pTxPowerIndexOffset)
eeprom_param
Definition: eeprom.h:226
#define AR9285_AN_RF2G3_DB1_0
Definition: reg.h:1311
#define AR_PHY_TX_END_PA_ON
Definition: ar9002_phy.h:60
u8 iqCalICh[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:404
#define AR_PHY_GAIN_2GHZ
Definition: ar9002_phy.h:423
#define REG_WRITE(_ah, _reg, _val)
Definition: hw.h:78
#define AR9271_AN_RF2G3_OB_qam
Definition: reg.h:1346
#define AR9285_AN_RF2G3_OB_1
Definition: reg.h:1302
#define AR9271_AN_RF2G3_OB_psk
Definition: reg.h:1344
#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4
Definition: ar9002_phy.h:548
#define AR_PHY_BASE
Definition: phy.h:27
u32 antCtrlChain[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:388
#define CTL_2GHT20
Definition: eeprom.h:74
#define AR_SREV_9271(_ah)
Definition: reg.h:854
#define AR_PHY_TPCRG5
Definition: ar9002_phy.h:539
#define CTL_11B
Definition: eeprom.h:72
#define AR5416_EEPROM_MAGIC
Definition: eeprom.h:34
#define AR9285_AN_RF2G3_DB1_2_S
Definition: reg.h:1316
#define AR_PHY_EXT_CCA0
Definition: ar9002_phy.h:328
unsigned short word
Definition: smc9000.h:39
#define AR9285_AN_RF2G4_DB2_0
Definition: reg.h:1323
#define AR9271_AN_RF2G3_OB_psk_S
Definition: reg.h:1345
#define CTL_MODE_M
Definition: eeprom.h:70
#define CTL_11B_EXT
void ath9k_hw_get_channel_centers(struct ath_hw *ah __unused, struct ath9k_channel *chan, struct chan_centers *centers)
Definition: ath9k_hw.c:191
#define SPUR_ENABLE_IOCTL
Definition: hw.h:237
uint8_t ah
Definition: registers.h:85
#define AR_PHY_SWITCH_CHAIN_0
Definition: ar9002_phy.h:252
#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3
Definition: ar9002_phy.h:546
#define AR5416_EEP_MINOR_VER_2
Definition: eeprom.h:134
signed short int16_t
Definition: stdint.h:16
#define IS_CHAN_HT20(_c)
Definition: hw.h:371
#define AR_PHY_POWER_TX_RATE9
Definition: ar9002_phy.h:564
#define AR_PHY_DESIRED_SZ_ADC
Definition: ar9002_phy.h:107
struct cal_data_per_freq_4k calPierData2G[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_2G_CAL_PIERS]
Definition: eeprom.h:601
struct cal_target_power_ht calTargetPower2GHT40[AR5416_EEP4K_NUM_2G_40_TARGET_POWERS]
Definition: eeprom.h:609
#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1
Definition: ar9002_phy.h:542
static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, struct ath9k_channel *chan, u16 cfgCtl, u8 twiceAntennaReduction, u8 twiceMaxRegulatoryPower, u8 powerLimit, int test)
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define IS_CHAN_HT40(_c)
Definition: hw.h:373
struct base_eep_header_4k baseEepHeader
Definition: eeprom.h:597
#define AR_PHY_RF_CTL4_TX_END_XPAA_OFF
Definition: ar9002_phy.h:83
struct cal_ctl_data_4k ctlData[AR5416_EEP4K_NUM_CTLS]
Definition: eeprom.h:612
u8 xatten2Margin[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:422
#define AR9280_PHY_RXGAIN_TXRX_MARGIN
Definition: ar9002_phy.h:103
#define CTL_5GHT40
Definition: eeprom.h:77
struct cal_ctl_edges ctlEdges[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_BAND_EDGES]
Definition: eeprom.h:563
#define AR_PHY_9285_ANT_DIV_ALT_GAINTB
Definition: ar9002_phy.h:317
#define AR_PHY_TX_PWRCTRL10
Definition: ar9002_phy.h:493
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
Definition: eeprom.h:267
FILE_SECBOOT(FORBIDDEN)
u8 bswAtten[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:418
#define AR_PHY_9285_ANT_DIV_ALT_LNACONF
Definition: ar9002_phy.h:313
uint8_t u8
Definition: stdint.h:20
static int test
Definition: epic100.c:73
static void ath9k_hw_4k_set_board_values(struct ath_hw *ah, struct ath9k_channel *chan)
u16 max_power_level
Definition: ath.h:141
#define MAX_RATE_POWER
Definition: hw.h:145
uint32_t u32
Definition: stdint.h:24
#define AR_PHY_TPCRG1_NUM_PD_GAIN
Definition: ar9002_phy.h:461
#define AR9285_AN_RF2G3_OB_0_S
Definition: reg.h:1301
#define swab32
Definition: ath.h:69
u8 noiseFloorThreshCh[AR5416_EEP4K_MAX_CHAINS]
Definition: eeprom.h:401
Definition: eeprom.h:267
#define AR_PHY_POWER_TX_RATE7
Definition: ar9002_phy.h:562
#define ENABLE_REGWRITE_BUFFER(_ah)
Definition: hw.h:90
#define AR5416_EEP_MINOR_VER_19
Definition: eeprom.h:140
#define AR_PHY_POWER_TX_RATE8
Definition: ar9002_phy.h:563
#define DBG2(...)
Definition: compiler.h:515
if(natsemi->flags &NATSEMI_64BIT) return 1
#define AR_PHY_POWER_TX_RATE6
Definition: ar9002_phy.h:557
#define AR_PHY_RF_CTL4_FRAME_XPAB_ON
Definition: ar9002_phy.h:85
u32 tp_scale
Definition: ath.h:142
void * memset(void *dest, int character, size_t len) __nonnull
#define AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF
Definition: ar9002_phy.h:189
#define AR9285_AN_RF2G3_OB_1_S
Definition: reg.h:1303
#define AR9285_AN_RF2G4_DB1_3
Definition: reg.h:1318
u16 ctl_center
Definition: hw.h:424