iPXE
ath9k_eeprom_9287.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 
27 #define SIZE_EEPROM_AR9287 (sizeof(struct ar9287_eeprom) / sizeof(u16))
28 
30 {
31  return (ah->eeprom.map9287.baseEepHeader.version >> 12) & 0xF;
32 }
33 
35 {
36  return (ah->eeprom.map9287.baseEepHeader.version) & 0xFFF;
37 }
38 
40 {
41  struct ar9287_eeprom *eep = &ah->eeprom.map9287;
43  u16 *eep_data;
44  unsigned int addr;
45  int eep_start_loc = AR9287_EEP_START_LOC;
46  eep_data = (u16 *)eep;
47 
48  for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) {
49  if (!ath9k_hw_nvram_read(common, addr + eep_start_loc,
50  eep_data)) {
51  DBG("ath9k: "
52  "Unable to read eeprom region\n");
53  return 0;
54  }
55  eep_data++;
56  }
57 
58  return 1;
59 }
60 
62 {
63  u16 *eep_data = (u16 *)&ah->eeprom.map9287;
64 
68  return 1;
69 }
70 
72 {
74 
75  if (!ath9k_hw_use_flash(ah)) {
76  DBG2("ath9k: "
77  "Reading from EEPROM, not flash\n");
78  }
79 
80  if (common->bus_ops->ath_bus_type == ATH_USB)
82  else
84 }
85 
87 {
88  u32 sum = 0, el, integer;
89  u16 temp, word, magic, magic2, *eepdata;
90  unsigned int i, addr;
91  int need_swap = 0;
92  struct ar9287_eeprom *eep = &ah->eeprom.map9287;
94 
95  if (!ath9k_hw_use_flash(ah)) {
97  &magic)) {
98  DBG("ath9k: Reading Magic # failed\n");
99  return 0;
100  }
101 
102  DBG2("ath9k: "
103  "Read Magic = 0x%04X\n", magic);
104 
105  if (magic != AR5416_EEPROM_MAGIC) {
106  magic2 = swab16(magic);
107 
108  if (magic2 == AR5416_EEPROM_MAGIC) {
109  need_swap = 1;
110  eepdata = (u16 *)(&ah->eeprom);
111 
112  for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) {
113  temp = swab16(*eepdata);
114  *eepdata = temp;
115  eepdata++;
116  }
117  } else {
118  DBG("ath9k: "
119  "Invalid EEPROM Magic. Endianness mismatch.\n");
120  return -EINVAL;
121  }
122  }
123  }
124 
125  DBG2("ath9k: need_swap = %s.\n",
126  need_swap ? "True" : "False");
127 
128  if (need_swap)
129  el = swab16(ah->eeprom.map9287.baseEepHeader.length);
130  else
131  el = ah->eeprom.map9287.baseEepHeader.length;
132 
133  if (el > sizeof(struct ar9287_eeprom))
134  el = sizeof(struct ar9287_eeprom) / sizeof(u16);
135  else
136  el = el / sizeof(u16);
137 
138  eepdata = (u16 *)(&ah->eeprom);
139 
140  for (i = 0; i < el; i++)
141  sum ^= *eepdata++;
142 
143  if (need_swap) {
145  eep->baseEepHeader.length = word;
146 
148  eep->baseEepHeader.checksum = word;
149 
151  eep->baseEepHeader.version = word;
152 
153  word = swab16(eep->baseEepHeader.regDmn[0]);
154  eep->baseEepHeader.regDmn[0] = word;
155 
156  word = swab16(eep->baseEepHeader.regDmn[1]);
157  eep->baseEepHeader.regDmn[1] = word;
158 
160  eep->baseEepHeader.rfSilent = word;
161 
164 
167 
168  integer = swab32(eep->modalHeader.antCtrlCommon);
169  eep->modalHeader.antCtrlCommon = integer;
170 
171  for (i = 0; i < AR9287_MAX_CHAINS; i++) {
172  integer = swab32(eep->modalHeader.antCtrlChain[i]);
173  eep->modalHeader.antCtrlChain[i] = integer;
174  }
175 
176  for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
179  }
180  }
181 
182  if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR9287_EEP_VER
183  || ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) {
184  DBG("ath9k: Bad EEPROM checksum 0x%x or revision 0x%04x\n",
185  sum, ah->eep_ops->get_eeprom_ver(ah));
186  return -EINVAL;
187  }
188 
189  return 0;
190 }
191 
193  enum eeprom_param param)
194 {
195  struct ar9287_eeprom *eep = &ah->eeprom.map9287;
196  struct modal_eep_ar9287_header *pModal = &eep->modalHeader;
197  struct base_eep_ar9287_header *pBase = &eep->baseEepHeader;
198  u16 ver_minor;
199 
200  ver_minor = pBase->version & AR9287_EEP_VER_MINOR_MASK;
201 
202  switch (param) {
203  case EEP_NFTHRESH_2:
204  return pModal->noiseFloorThreshCh[0];
205  case EEP_MAC_LSW:
206  return pBase->macAddr[0] << 8 | pBase->macAddr[1];
207  case EEP_MAC_MID:
208  return pBase->macAddr[2] << 8 | pBase->macAddr[3];
209  case EEP_MAC_MSW:
210  return pBase->macAddr[4] << 8 | pBase->macAddr[5];
211  case EEP_REG_0:
212  return pBase->regDmn[0];
213  case EEP_REG_1:
214  return pBase->regDmn[1];
215  case EEP_OP_CAP:
216  return pBase->deviceCap;
217  case EEP_OP_MODE:
218  return pBase->opCapFlags;
219  case EEP_RF_SILENT:
220  return pBase->rfSilent;
221  case EEP_MINOR_REV:
222  return ver_minor;
223  case EEP_TX_MASK:
224  return pBase->txMask;
225  case EEP_RX_MASK:
226  return pBase->rxMask;
227  case EEP_DEV_TYPE:
228  return pBase->deviceType;
229  case EEP_OL_PWRCTRL:
230  return pBase->openLoopPwrCntl;
231  case EEP_TEMPSENSE_SLOPE:
232  if (ver_minor >= AR9287_EEP_MINOR_VER_2)
233  return pBase->tempSensSlope;
234  else
235  return 0;
237  if (ver_minor >= AR9287_EEP_MINOR_VER_3)
238  return pBase->tempSensSlopePalOn;
239  else
240  return 0;
241  default:
242  return 0;
243  }
244 }
245 
247  struct ath9k_channel *chan,
248  struct cal_data_op_loop_ar9287 *pRawDatasetOpLoop,
249  u8 *pCalChans, u16 availPiers, int8_t *pPwr)
250 {
251  u16 idxL = 0, idxR = 0, numPiers;
252  int match;
253  struct chan_centers centers;
254 
255  ath9k_hw_get_channel_centers(ah, chan, &centers);
256 
257  for (numPiers = 0; numPiers < availPiers; numPiers++) {
258  if (pCalChans[numPiers] == AR5416_BCHAN_UNUSED)
259  break;
260  }
261 
263  (u8)FREQ2FBIN(centers.synth_center, IS_CHAN_2GHZ(chan)),
264  pCalChans, numPiers, &idxL, &idxR);
265 
266  if (match) {
267  *pPwr = (int8_t) pRawDatasetOpLoop[idxL].pwrPdg[0][0];
268  } else {
269  *pPwr = ((int8_t) pRawDatasetOpLoop[idxL].pwrPdg[0][0] +
270  (int8_t) pRawDatasetOpLoop[idxR].pwrPdg[0][0])/2;
271  }
272 
273 }
274 
276  int32_t txPower, u16 chain)
277 {
278  u32 tmpVal;
279  u32 a;
280 
281  /* Enable OLPC for chain 0 */
282 
283  tmpVal = REG_READ(ah, 0xa270);
284  tmpVal = tmpVal & 0xFCFFFFFF;
285  tmpVal = tmpVal | (0x3 << 24);
286  REG_WRITE(ah, 0xa270, tmpVal);
287 
288  /* Enable OLPC for chain 1 */
289 
290  tmpVal = REG_READ(ah, 0xb270);
291  tmpVal = tmpVal & 0xFCFFFFFF;
292  tmpVal = tmpVal | (0x3 << 24);
293  REG_WRITE(ah, 0xb270, tmpVal);
294 
295  /* Write the OLPC ref power for chain 0 */
296 
297  if (chain == 0) {
298  tmpVal = REG_READ(ah, 0xa398);
299  tmpVal = tmpVal & 0xff00ffff;
300  a = (txPower)&0xff;
301  tmpVal = tmpVal | (a << 16);
302  REG_WRITE(ah, 0xa398, tmpVal);
303  }
304 
305  /* Write the OLPC ref power for chain 1 */
306 
307  if (chain == 1) {
308  tmpVal = REG_READ(ah, 0xb398);
309  tmpVal = tmpVal & 0xff00ffff;
310  a = (txPower)&0xff;
311  tmpVal = tmpVal | (a << 16);
312  REG_WRITE(ah, 0xb398, tmpVal);
313  }
314 }
315 
317  struct ath9k_channel *chan,
318  int16_t *pTxPowerIndexOffset)
319 {
320  struct cal_data_per_freq_ar9287 *pRawDataset;
321  struct cal_data_op_loop_ar9287 *pRawDatasetOpenLoop;
322  u8 *pCalBChans = NULL;
323  u16 pdGainOverlap_t2;
324  u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
325  u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
326  u16 numPiers = 0, i, j;
327  u16 numXpdGain, xpdMask;
328  u16 xpdGainValues[AR5416_NUM_PD_GAINS] = {0, 0, 0, 0};
329  u32 reg32, regOffset, regChainOffset, regval;
330  int16_t diff = 0;
331  struct ar9287_eeprom *pEepData = &ah->eeprom.map9287;
332 
333  xpdMask = pEepData->modalHeader.xpdGain;
334 
335  if ((pEepData->baseEepHeader.version & AR9287_EEP_VER_MINOR_MASK) >=
337  pdGainOverlap_t2 = pEepData->modalHeader.pdGainOverlap;
338  else
339  pdGainOverlap_t2 = (u16)(MS(REG_READ(ah, AR_PHY_TPCRG5),
341 
342  if (IS_CHAN_2GHZ(chan)) {
343  pCalBChans = pEepData->calFreqPier2G;
344  numPiers = AR9287_NUM_2G_CAL_PIERS;
346  pRawDatasetOpenLoop =
347  (struct cal_data_op_loop_ar9287 *)pEepData->calPierData2G[0];
348  ah->initPDADC = pRawDatasetOpenLoop->vpdPdg[0][0];
349  }
350  }
351 
352  numXpdGain = 0;
353 
354  /* Calculate the value of xpdgains from the xpdGain Mask */
355  for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) {
356  if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) {
357  if (numXpdGain >= AR5416_NUM_PD_GAINS)
358  break;
359  xpdGainValues[numXpdGain] =
361  numXpdGain++;
362  }
363  }
364 
366  (numXpdGain - 1) & 0x3);
368  xpdGainValues[0]);
370  xpdGainValues[1]);
372  xpdGainValues[2]);
373 
374  for (i = 0; i < AR9287_MAX_CHAINS; i++) {
375  regChainOffset = i * 0x1000;
376 
377  if (pEepData->baseEepHeader.txMask & (1 << i)) {
378  pRawDatasetOpenLoop =
379  (struct cal_data_op_loop_ar9287 *)pEepData->calPierData2G[i];
380 
382  int8_t txPower;
384  pRawDatasetOpenLoop,
385  pCalBChans, numPiers,
386  &txPower);
387  ar9287_eeprom_olpc_set_pdadcs(ah, txPower, i);
388  } else {
389  pRawDataset =
390  (struct cal_data_per_freq_ar9287 *)
391  pEepData->calPierData2G[i];
392 
394  pRawDataset,
395  pCalBChans, numPiers,
396  pdGainOverlap_t2,
397  gainBoundaries,
398  pdadcValues,
399  numXpdGain);
400  }
401 
403 
404  if (i == 0) {
406  EEP_OL_PWRCTRL)) {
407 
408  regval = SM(pdGainOverlap_t2,
410  | SM(gainBoundaries[0],
412  | SM(gainBoundaries[1],
414  | SM(gainBoundaries[2],
416  | SM(gainBoundaries[3],
418 
419  REG_WRITE(ah,
420  AR_PHY_TPCRG5 + regChainOffset,
421  regval);
422  }
423  }
424 
426  pEepData->baseEepHeader.pwrTableOffset) {
427  diff = (u16)(pEepData->baseEepHeader.pwrTableOffset -
429  diff *= 2;
430 
431  for (j = 0; j < ((u16)AR5416_NUM_PDADC_VALUES-diff); j++)
432  pdadcValues[j] = pdadcValues[j+diff];
433 
434  for (j = (u16)(AR5416_NUM_PDADC_VALUES-diff);
435  j < AR5416_NUM_PDADC_VALUES; j++)
436  pdadcValues[j] =
437  pdadcValues[AR5416_NUM_PDADC_VALUES-diff];
438  }
439 
441  regOffset = AR_PHY_BASE +
442  (672 << 2) + regChainOffset;
443 
444  for (j = 0; j < 32; j++) {
445  reg32 = ((pdadcValues[4*j + 0] & 0xFF) << 0)
446  | ((pdadcValues[4*j + 1] & 0xFF) << 8)
447  | ((pdadcValues[4*j + 2] & 0xFF) << 16)
448  | ((pdadcValues[4*j + 3] & 0xFF) << 24);
449 
450  REG_WRITE(ah, regOffset, reg32);
451  regOffset += 4;
452  }
453  }
455  }
456  }
457 
458  *pTxPowerIndexOffset = 0;
459 }
460 
462  struct ath9k_channel *chan,
463  int16_t *ratesArray,
464  u16 cfgCtl,
465  u16 AntennaReduction,
466  u16 twiceMaxRegulatoryPower,
467  u16 powerLimit)
468 {
469 #define CMP_CTL \
470  (((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) == \
471  pEepData->ctlIndex[i])
472 
473 #define CMP_NO_CTL \
474  (((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) == \
475  ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL))
476 
477 #define REDUCE_SCALED_POWER_BY_TWO_CHAIN 6
478 #define REDUCE_SCALED_POWER_BY_THREE_CHAIN 10
479 
480  struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
481  u16 twiceMaxEdgePower = MAX_RATE_POWER;
482  static const u16 tpScaleReductionTable[5] =
483  { 0, 3, 6, 9, MAX_RATE_POWER };
484  unsigned int i;
485  int16_t twiceLargestAntenna;
486  struct cal_ctl_data_ar9287 *rep;
487  struct cal_target_power_leg targetPowerOfdm = {0, {0, 0, 0, 0} },
488  targetPowerCck = {0, {0, 0, 0, 0} };
489  struct cal_target_power_leg targetPowerOfdmExt = {0, {0, 0, 0, 0} },
490  targetPowerCckExt = {0, {0, 0, 0, 0} };
491  struct cal_target_power_ht targetPowerHt20,
492  targetPowerHt40 = {0, {0, 0, 0, 0} };
493  u16 scaledPower = 0, minCtlPower, maxRegAllowedPower;
494  static const u16 ctlModesFor11g[] = {
497  };
498  u16 numCtlModes = 0;
499  const u16 *pCtlMode = NULL;
500  u16 ctlMode, freq;
501  struct chan_centers centers;
502  int tx_chainmask;
503  u16 twiceMinEdgePower;
504  struct ar9287_eeprom *pEepData = &ah->eeprom.map9287;
505  tx_chainmask = ah->txchainmask;
506 
507  ath9k_hw_get_channel_centers(ah, chan, &centers);
508 
509  /* Compute TxPower reduction due to Antenna Gain */
510  twiceLargestAntenna = max(pEepData->modalHeader.antennaGainCh[0],
511  pEepData->modalHeader.antennaGainCh[1]);
512  twiceLargestAntenna = (int16_t)min((AntennaReduction) -
513  twiceLargestAntenna, 0);
514 
515  /*
516  * scaledPower is the minimum of the user input power level
517  * and the regulatory allowed power level.
518  */
519  maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna;
520 
521  if (regulatory->tp_scale != ATH9K_TP_SCALE_MAX)
522  maxRegAllowedPower -=
523  (tpScaleReductionTable[(regulatory->tp_scale)] * 2);
524 
525  scaledPower = min(powerLimit, maxRegAllowedPower);
526 
527  /*
528  * Reduce scaled Power by number of chains active
529  * to get the per chain tx power level.
530  */
531  switch (ar5416_get_ntxchains(tx_chainmask)) {
532  case 1:
533  break;
534  case 2:
535  if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN)
536  scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
537  else
538  scaledPower = 0;
539  break;
540  case 3:
541  if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN)
542  scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
543  else
544  scaledPower = 0;
545  break;
546  }
547  scaledPower = max((u16)0, scaledPower);
548 
549  /*
550  * Get TX power from EEPROM.
551  */
552  if (IS_CHAN_2GHZ(chan)) {
553  /* CTL_11B, CTL_11G, CTL_2GHT20 */
554  numCtlModes =
555  ARRAY_SIZE(ctlModesFor11g) - SUB_NUM_CTL_MODES_AT_2G_40;
556 
557  pCtlMode = ctlModesFor11g;
558 
560  pEepData->calTargetPowerCck,
562  &targetPowerCck, 4, 0);
564  pEepData->calTargetPower2G,
566  &targetPowerOfdm, 4, 0);
568  pEepData->calTargetPower2GHT20,
570  &targetPowerHt20, 8, 0);
571 
572  if (IS_CHAN_HT40(chan)) {
573  /* All 2G CTLs */
574  numCtlModes = ARRAY_SIZE(ctlModesFor11g);
576  pEepData->calTargetPower2GHT40,
578  &targetPowerHt40, 8, 1);
580  pEepData->calTargetPowerCck,
582  &targetPowerCckExt, 4, 1);
584  pEepData->calTargetPower2G,
586  &targetPowerOfdmExt, 4, 1);
587  }
588  }
589 
590  for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
591  int isHt40CtlMode =
592  (pCtlMode[ctlMode] == CTL_2GHT40) ? 1 : 0;
593 
594  if (isHt40CtlMode)
595  freq = centers.synth_center;
596  else if (pCtlMode[ctlMode] & EXT_ADDITIVE)
597  freq = centers.ext_center;
598  else
599  freq = centers.ctl_center;
600 
601  /* Walk through the CTL indices stored in EEPROM */
602  for (i = 0; (i < AR9287_NUM_CTLS) && pEepData->ctlIndex[i]; i++) {
603  struct cal_ctl_edges *pRdEdgesPower;
604 
605  /*
606  * Compare test group from regulatory channel list
607  * with test mode from pCtlMode list
608  */
609  if (CMP_CTL || CMP_NO_CTL) {
610  rep = &(pEepData->ctlData[i]);
611  pRdEdgesPower =
612  rep->ctlEdges[ar5416_get_ntxchains(tx_chainmask) - 1];
613 
614  twiceMinEdgePower = ath9k_hw_get_max_edge_power(freq,
615  pRdEdgesPower,
616  IS_CHAN_2GHZ(chan),
618 
619  if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) {
620  twiceMaxEdgePower = min(twiceMaxEdgePower,
621  twiceMinEdgePower);
622  } else {
623  twiceMaxEdgePower = twiceMinEdgePower;
624  break;
625  }
626  }
627  }
628 
629  minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower);
630 
631  /* Apply ctl mode to correct target power set */
632  switch (pCtlMode[ctlMode]) {
633  case CTL_11B:
634  for (i = 0; i < ARRAY_SIZE(targetPowerCck.tPow2x); i++) {
635  targetPowerCck.tPow2x[i] =
636  (u8)min((u16)targetPowerCck.tPow2x[i],
637  minCtlPower);
638  }
639  break;
640  case CTL_11A:
641  case CTL_11G:
642  for (i = 0; i < ARRAY_SIZE(targetPowerOfdm.tPow2x); i++) {
643  targetPowerOfdm.tPow2x[i] =
644  (u8)min((u16)targetPowerOfdm.tPow2x[i],
645  minCtlPower);
646  }
647  break;
648  case CTL_5GHT20:
649  case CTL_2GHT20:
650  for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) {
651  targetPowerHt20.tPow2x[i] =
652  (u8)min((u16)targetPowerHt20.tPow2x[i],
653  minCtlPower);
654  }
655  break;
656  case CTL_11B_EXT:
657  targetPowerCckExt.tPow2x[0] =
658  (u8)min((u16)targetPowerCckExt.tPow2x[0],
659  minCtlPower);
660  break;
661  case CTL_11A_EXT:
662  case CTL_11G_EXT:
663  targetPowerOfdmExt.tPow2x[0] =
664  (u8)min((u16)targetPowerOfdmExt.tPow2x[0],
665  minCtlPower);
666  break;
667  case CTL_5GHT40:
668  case CTL_2GHT40:
669  for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
670  targetPowerHt40.tPow2x[i] =
671  (u8)min((u16)targetPowerHt40.tPow2x[i],
672  minCtlPower);
673  }
674  break;
675  default:
676  break;
677  }
678  }
679 
680  /* Now set the rates array */
681 
682  ratesArray[rate6mb] =
683  ratesArray[rate9mb] =
684  ratesArray[rate12mb] =
685  ratesArray[rate18mb] =
686  ratesArray[rate24mb] = targetPowerOfdm.tPow2x[0];
687 
688  ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1];
689  ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2];
690  ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3];
691  ratesArray[rateXr] = targetPowerOfdm.tPow2x[0];
692 
693  for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++)
694  ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i];
695 
696  if (IS_CHAN_2GHZ(chan)) {
697  ratesArray[rate1l] = targetPowerCck.tPow2x[0];
698  ratesArray[rate2s] =
699  ratesArray[rate2l] = targetPowerCck.tPow2x[1];
700  ratesArray[rate5_5s] =
701  ratesArray[rate5_5l] = targetPowerCck.tPow2x[2];
702  ratesArray[rate11s] =
703  ratesArray[rate11l] = targetPowerCck.tPow2x[3];
704  }
705  if (IS_CHAN_HT40(chan)) {
706  for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++)
707  ratesArray[rateHt40_0 + i] = targetPowerHt40.tPow2x[i];
708 
709  ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0];
710  ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0];
711  ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0];
712 
713  if (IS_CHAN_2GHZ(chan))
714  ratesArray[rateExtCck] = targetPowerCckExt.tPow2x[0];
715  }
716 
717 #undef CMP_CTL
718 #undef CMP_NO_CTL
719 #undef REDUCE_SCALED_POWER_BY_TWO_CHAIN
720 #undef REDUCE_SCALED_POWER_BY_THREE_CHAIN
721 }
722 
724  struct ath9k_channel *chan, u16 cfgCtl,
725  u8 twiceAntennaReduction,
726  u8 twiceMaxRegulatoryPower,
727  u8 powerLimit, int test)
728 {
729  struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
730  struct ar9287_eeprom *pEepData = &ah->eeprom.map9287;
731  struct modal_eep_ar9287_header *pModal = &pEepData->modalHeader;
732  int16_t ratesArray[Ar5416RateSize];
733  int16_t txPowerIndexOffset = 0;
735  unsigned int i;
736 
737  memset(ratesArray, 0, sizeof(ratesArray));
738 
739  if ((pEepData->baseEepHeader.version & AR9287_EEP_VER_MINOR_MASK) >=
742 
744  &ratesArray[0], cfgCtl,
745  twiceAntennaReduction,
746  twiceMaxRegulatoryPower,
747  powerLimit);
748 
749  ath9k_hw_set_ar9287_power_cal_table(ah, chan, &txPowerIndexOffset);
750 
751  regulatory->max_power_level = 0;
752  for (i = 0; i < ARRAY_SIZE(ratesArray); i++) {
753  ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]);
754  if (ratesArray[i] > MAX_RATE_POWER)
755  ratesArray[i] = MAX_RATE_POWER;
756 
757  if (ratesArray[i] > regulatory->max_power_level)
758  regulatory->max_power_level = ratesArray[i];
759  }
760 
761  if (test)
762  return;
763 
764  if (IS_CHAN_2GHZ(chan))
765  i = rate1l;
766  else
767  i = rate6mb;
768 
769  regulatory->max_power_level = ratesArray[i];
770 
772  for (i = 0; i < Ar5416RateSize; i++)
773  ratesArray[i] -= AR9287_PWR_TABLE_OFFSET_DB * 2;
774  }
775 
777 
778  /* OFDM power per rate */
780  ATH9K_POW_SM(ratesArray[rate18mb], 24)
781  | ATH9K_POW_SM(ratesArray[rate12mb], 16)
782  | ATH9K_POW_SM(ratesArray[rate9mb], 8)
783  | ATH9K_POW_SM(ratesArray[rate6mb], 0));
784 
786  ATH9K_POW_SM(ratesArray[rate54mb], 24)
787  | ATH9K_POW_SM(ratesArray[rate48mb], 16)
788  | ATH9K_POW_SM(ratesArray[rate36mb], 8)
789  | ATH9K_POW_SM(ratesArray[rate24mb], 0));
790 
791  /* CCK power per rate */
792  if (IS_CHAN_2GHZ(chan)) {
794  ATH9K_POW_SM(ratesArray[rate2s], 24)
795  | ATH9K_POW_SM(ratesArray[rate2l], 16)
796  | ATH9K_POW_SM(ratesArray[rateXr], 8)
797  | ATH9K_POW_SM(ratesArray[rate1l], 0));
799  ATH9K_POW_SM(ratesArray[rate11s], 24)
800  | ATH9K_POW_SM(ratesArray[rate11l], 16)
801  | ATH9K_POW_SM(ratesArray[rate5_5s], 8)
802  | ATH9K_POW_SM(ratesArray[rate5_5l], 0));
803  }
804 
805  /* HT20 power per rate */
807  ATH9K_POW_SM(ratesArray[rateHt20_3], 24)
808  | ATH9K_POW_SM(ratesArray[rateHt20_2], 16)
809  | ATH9K_POW_SM(ratesArray[rateHt20_1], 8)
810  | ATH9K_POW_SM(ratesArray[rateHt20_0], 0));
811 
813  ATH9K_POW_SM(ratesArray[rateHt20_7], 24)
814  | ATH9K_POW_SM(ratesArray[rateHt20_6], 16)
815  | ATH9K_POW_SM(ratesArray[rateHt20_5], 8)
816  | ATH9K_POW_SM(ratesArray[rateHt20_4], 0));
817 
818  /* HT40 power per rate */
819  if (IS_CHAN_HT40(chan)) {
822  ATH9K_POW_SM(ratesArray[rateHt40_3], 24)
823  | ATH9K_POW_SM(ratesArray[rateHt40_2], 16)
824  | ATH9K_POW_SM(ratesArray[rateHt40_1], 8)
825  | ATH9K_POW_SM(ratesArray[rateHt40_0], 0));
826 
828  ATH9K_POW_SM(ratesArray[rateHt40_7], 24)
829  | ATH9K_POW_SM(ratesArray[rateHt40_6], 16)
830  | ATH9K_POW_SM(ratesArray[rateHt40_5], 8)
831  | ATH9K_POW_SM(ratesArray[rateHt40_4], 0));
832  } else {
834  ATH9K_POW_SM(ratesArray[rateHt40_3] +
836  | ATH9K_POW_SM(ratesArray[rateHt40_2] +
838  | ATH9K_POW_SM(ratesArray[rateHt40_1] +
840  | ATH9K_POW_SM(ratesArray[rateHt40_0] +
842 
844  ATH9K_POW_SM(ratesArray[rateHt40_7] +
846  | ATH9K_POW_SM(ratesArray[rateHt40_6] +
848  | ATH9K_POW_SM(ratesArray[rateHt40_5] +
850  | ATH9K_POW_SM(ratesArray[rateHt40_4] +
852  }
853 
854  /* Dup/Ext power per rate */
856  ATH9K_POW_SM(ratesArray[rateExtOfdm], 24)
857  | ATH9K_POW_SM(ratesArray[rateExtCck], 16)
858  | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8)
859  | ATH9K_POW_SM(ratesArray[rateDupCck], 0));
860  }
862 }
863 
865  struct ath9k_channel *chan __unused)
866 {
867 }
868 
870  struct ath9k_channel *chan)
871 {
872  struct ar9287_eeprom *eep = &ah->eeprom.map9287;
873  struct modal_eep_ar9287_header *pModal = &eep->modalHeader;
874  u32 regChainOffset, regval;
875  u8 txRxAttenLocal;
876  int i;
877 
878  pModal = &eep->modalHeader;
879 
881 
882  for (i = 0; i < AR9287_MAX_CHAINS; i++) {
883  regChainOffset = i * 0x1000;
884 
885  REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset,
886  pModal->antCtrlChain[i]);
887 
888  REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset,
889  (REG_READ(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset)
892  SM(pModal->iqCalICh[i],
894  SM(pModal->iqCalQCh[i],
896 
897  txRxAttenLocal = pModal->txRxAttenCh[i];
898 
899  REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
901  pModal->bswMargin[i]);
902  REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
904  pModal->bswAtten[i]);
905  REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
907  txRxAttenLocal);
908  REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
910  pModal->rxTxMarginCh[i]);
911  }
912 
913 
914  if (IS_CHAN_HT40(chan))
917  else
920 
923 
929 
932 
937 
938  regval = REG_READ(ah, AR9287_AN_RF2G3_CH0);
939  regval &= ~(AR9287_AN_RF2G3_DB1 |
945  regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) |
946  SM(pModal->db2, AR9287_AN_RF2G3_DB2) |
947  SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) |
948  SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) |
949  SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) |
951 
953 
954  regval = REG_READ(ah, AR9287_AN_RF2G3_CH1);
955  regval &= ~(AR9287_AN_RF2G3_DB1 |
961  regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) |
962  SM(pModal->db2, AR9287_AN_RF2G3_DB2) |
963  SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) |
964  SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) |
965  SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) |
967 
969 
974 
978  pModal->xpaBiasLvl);
979 }
980 
982  u16 i, int is2GHz)
983 {
984 #define EEP_MAP9287_SPURCHAN \
985  (ah->eeprom.map9287.modalHeader.spurChans[i].spurChan)
986 
987  u16 spur_val = AR_NO_SPUR;
988 
989  DBG2("ath9k: "
990  "Getting spur idx:%d is2Ghz:%d val:%x\n",
991  i, is2GHz, ah->config.spurchans[i][is2GHz]);
992 
993  switch (ah->config.spurmode) {
994  case SPUR_DISABLE:
995  break;
996  case SPUR_ENABLE_IOCTL:
997  spur_val = ah->config.spurchans[i][is2GHz];
998  DBG2("ath9k: "
999  "Getting spur val from new loc. %d\n", spur_val);
1000  break;
1001  case SPUR_ENABLE_EEPROM:
1002  spur_val = EEP_MAP9287_SPURCHAN;
1003  break;
1004  }
1005 
1006  return spur_val;
1007 
1008 #undef EEP_MAP9287_SPURCHAN
1009 }
1010 
1011 const struct eeprom_ops eep_ar9287_ops = {
1013  .get_eeprom = ath9k_hw_ar9287_get_eeprom,
1014  .fill_eeprom = ath9k_hw_ar9287_fill_eeprom,
1015  .get_eeprom_ver = ath9k_hw_ar9287_get_eeprom_ver,
1016  .get_eeprom_rev = ath9k_hw_ar9287_get_eeprom_rev,
1017  .set_board_values = ath9k_hw_ar9287_set_board_values,
1018  .set_addac = ath9k_hw_ar9287_set_addac,
1019  .set_txpower = ath9k_hw_ar9287_set_txpower,
1020  .get_spur_channel = ath9k_hw_ar9287_get_spur_channel
1021 };
struct cal_target_power_ht calTargetPower2GHT20[AR9287_NUM_2G_20_TARGET_POWERS]
Definition: eeprom.h:627
#define AR9287_EEP_MINOR_VER_3
Definition: eeprom.h:189
#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 AR5416_NUM_PD_GAINS
Definition: eeprom.h:154
#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
#define AR9287_AN_TOP2_XPABIAS_LVL_S
Definition: reg.h:1425
u8 calFreqPier2G[AR9287_NUM_2G_CAL_PIERS]
Definition: eeprom.h:620
iPXE I/O API
#define AR9287_NUM_2G_CCK_TARGET_POWERS
Definition: eeprom.h:197
u8 bswMargin[AR9287_MAX_CHAINS]
Definition: eeprom.h:497
Definition: hw.h:657
u16 synth_center
Definition: hw.h:423
int8_t tempSensSlopePalOn
Definition: eeprom.h:470
u32 antCtrlChain[AR9287_MAX_CHAINS]
Definition: eeprom.h:475
#define AR_PHY_RF_CTL3
Definition: ar9002_phy.h:63
#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 AR9287_HTC_EEP_START_LOC
Definition: eeprom.h:195
#define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF
Definition: ar9002_phy.h:191
static int ath9k_hw_ar9287_get_eeprom_rev(struct ath_hw *ah)
static void ath9k_hw_ar9287_set_board_values(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_POWER_TX_RATE2
Definition: ar9002_phy.h:208
#define AR9287_AN_RF2G3_CH1
Definition: reg.h:1401
#define AR5416_EEPROM_MAGIC_OFFSET
Definition: eeprom.h:60
struct cal_ctl_edges ctlEdges[AR9287_MAX_CHAINS][AR9287_NUM_BAND_EDGES]
Definition: eeprom.h:553
uint16_t magic
Magic signature.
Definition: bzimage.h:6
#define AR9287_PWR_TABLE_OFFSET_DB
Definition: eeprom.h:210
static void ar9287_eeprom_get_tx_gain_index(struct ath_hw *ah, struct ath9k_channel *chan, struct cal_data_op_loop_ar9287 *pRawDatasetOpLoop, u8 *pCalChans, u16 availPiers, int8_t *pPwr)
#define EXT_ADDITIVE
#define IS_CHAN_2GHZ(_c)
Definition: hw.h:362
#define AR9287_EEP_VER
Definition: eeprom.h:185
#define AR_EEPROM_MODAL_SPURS
Definition: eeprom.h:26
#define MS(_v, _f)
Definition: hw.h:103
u16 ext_center
Definition: hw.h:425
#define REGWRITE_BUFFER_FLUSH(_ah)
Definition: hw.h:96
int8_t iqCalICh[AR9287_MAX_CHAINS]
Definition: eeprom.h:489
static void ath9k_hw_ar9287_set_addac(struct ath_hw *ah __unused, struct ath9k_channel *chan __unused)
#define AR_PHY_RF_CTL2
Definition: ar9002_phy.h:57
#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 AR_PHY_TPCRG1_PD_GAIN_3
Definition: ar9002_phy.h:468
static int ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah)
#define ATH9K_POW_SM(_r, _s)
Definition: eeprom.h:102
#define AR9287_EEP_MINOR_VER_2
Definition: eeprom.h:188
#define AR9287_AN_RF2G3_DB1
Definition: reg.h:1402
int8_t antennaGainCh[AR9287_MAX_CHAINS]
Definition: eeprom.h:477
#define AR9287_AN_TOP2
Definition: reg.h:1423
#define AR9280_PHY_CCA_THRESH62
Definition: ar9002_phy.h:137
#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 REG_RMW_FIELD(_a, _r, _f, _v)
Definition: hw.h:104
#define FREQ2FBIN(x, y)
Definition: eeprom.h:103
#define AR5416_PD_GAINS_IN_MASK
Definition: eeprom.h:155
Definition: ath.h:129
#define AR_PHY_DESIRED_SZ
Definition: ar9002_phy.h:106
void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val)
Definition: ath9k_eeprom.c:34
#define AR_PHY_SWITCH_COM
Definition: ar9002_phy.h:253
#define AR9287_NUM_2G_CAL_PIERS
Definition: eeprom.h:196
int8_t noiseFloorThreshCh[AR9287_MAX_CHAINS]
Definition: eeprom.h:486
#define SM(_v, _f)
Definition: hw.h:102
struct cal_target_power_leg calTargetPower2G[AR9287_NUM_2G_20_TARGET_POWERS]
Definition: eeprom.h:625
#define AR9287_AN_RF2G3_DB2
Definition: reg.h:1404
static int ath9k_hw_ar9287_get_eeprom_ver(struct ath_hw *ah)
#define SIZE_EEPROM_AR9287
#define AR_PHY_TX_END_DATA_START
Definition: ar9002_phy.h:58
#define AR_PHY_GAIN_2GHZ_XATTEN1_DB
Definition: ar9002_phy.h:437
static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah, struct ath9k_channel *chan, int16_t *ratesArray, u16 cfgCtl, u16 AntennaReduction, u16 twiceMaxRegulatoryPower, u16 powerLimit)
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 __unused
Declare a variable or data structure as unused.
Definition: compiler.h:573
static void ath9k_hw_set_ar9287_power_cal_table(struct ath_hw *ah, struct ath9k_channel *chan, int16_t *pTxPowerIndexOffset)
static struct ath_regulatory * ath9k_hw_regulatory(struct ath_hw *ah)
Definition: hw.h:875
#define AR_PHY_TX_END_TO_A2_RX_ON
Definition: ar9002_phy.h:64
#define AR_PHY_SETTLING_SWITCH
Definition: ar9002_phy.h:93
static u16 ath9k_hw_ar9287_get_spur_channel(struct ath_hw *ah, u16 i, int is2GHz)
#define AR_PHY_RF_CTL4
Definition: ar9002_phy.h:80
#define u8
Definition: igbvf_osdep.h:40
Definition: eeprom.h:268
static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah, struct ath9k_channel *chan, u16 cfgCtl, u8 twiceAntennaReduction, u8 twiceMaxRegulatoryPower, u8 powerLimit, int test)
#define SPUR_ENABLE_EEPROM
Definition: hw.h:238
signed char int8_t
Definition: stdint.h:15
#define AR9287_NUM_2G_40_TARGET_POWERS
Definition: eeprom.h:199
Definition: eeprom.h:267
struct cal_target_power_leg calTargetPowerCck[AR9287_NUM_2G_CCK_TARGET_POWERS]
Definition: eeprom.h:623
#define AR9287_AN_RF2G3_OB_PSK
Definition: reg.h:1408
#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
const struct eeprom_ops eep_ar9287_ops
int ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, u16 *indexL, u16 *indexR)
Definition: ath9k_eeprom.c:71
#define AR_PHY_TPCRG1_PD_GAIN_1
Definition: ar9002_phy.h:464
#define AR5416_EEP_NO_BACK_VER
Definition: eeprom.h:131
#define AR5416_NUM_BAND_EDGES
Definition: eeprom.h:153
int ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data)
Definition: ath9k_eeprom.c:131
#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
#define AR5416_BCHAN_UNUSED
Definition: eeprom.h:158
struct hv_monitor_parameter param[4][32]
Parameters.
Definition: hyperv.h:24
static int __ath9k_hw_usb_ar9287_fill_eeprom(struct ath_hw *ah)
struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]
Definition: eeprom.h:507
uint32_t addr
Buffer address.
Definition: dwmac.h:20
union cal_data_per_freq_ar9287_u calPierData2G[AR9287_MAX_CHAINS][AR9287_NUM_2G_CAL_PIERS]
Definition: eeprom.h:621
static void ar9287_eeprom_olpc_set_pdadcs(struct ath_hw *ah, int32_t txPower, u16 chain)
static struct ath_common * ath9k_hw_common(struct ath_hw *ah)
Definition: hw.h:870
#define AR_PHY_TPCRG1
Definition: ar9002_phy.h:460
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
#define CMP_NO_CTL
#define AR_PHY_EXT_CCA0_THRESH62
Definition: ar9002_phy.h:329
#define CTL_11A
Definition: eeprom.h:71
#define AR9287_NUM_CTLS
Definition: eeprom.h:200
void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, u32 shift, u32 val)
Definition: ath9k_eeprom.c:42
#define AR9287_NUM_2G_20_TARGET_POWERS
Definition: eeprom.h:198
#define CTL_11G
Definition: eeprom.h:73
#define AR_NO_SPUR
Definition: hw.h:241
#define AR_PHY_SETTLING
Definition: ar9002_phy.h:92
static int __ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah)
static u32 ath9k_hw_ar9287_get_eeprom(struct ath_hw *ah, enum eeprom_param param)
FILE_SECBOOT(FORBIDDEN)
struct ib_cm_common common
Definition: ib_mad.h:12
u8 rxTxMarginCh[AR9287_MAX_CHAINS]
Definition: eeprom.h:480
struct cal_target_power_ht calTargetPower2GHT40[AR9287_NUM_2G_40_TARGET_POWERS]
Definition: eeprom.h:629
int(* check_eeprom)(struct ath_hw *hw)
Definition: eeprom.h:654
static int ath9k_hw_ar9287_check_eeprom(struct ath_hw *ah)
#define REG_READ(_ah, _reg)
Definition: hw.h:81
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 AR9287_AN_RF2G3_OB_QAM
Definition: reg.h:1410
#define REDUCE_SCALED_POWER_BY_THREE_CHAIN
#define AR_PHY_CCA
Definition: ar9002_phy.h:130
#define SUB_NUM_CTL_MODES_AT_2G_40
#define SD_NO_CTL
Definition: eeprom.h:68
#define EEP_MAP9287_SPURCHAN
#define AR9280_PHY_RXGAIN_TXRX_ATTEN
Definition: ar9002_phy.h:101
#define swab16
Definition: ath.h:68
#define AR9287_AN_TOP2_XPABIAS_LVL
Definition: reg.h:1424
#define AR_PHY_TPCRG5_PD_GAIN_OVERLAP
Definition: ar9002_phy.h:540
struct cal_ctl_data_ar9287 ctlData[AR9287_NUM_CTLS]
Definition: eeprom.h:632
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
signed int int32_t
Definition: stdint.h:17
#define CTL_11A_EXT
eeprom_param
Definition: eeprom.h:226
#define AR_PHY_TX_END_PA_ON
Definition: ar9002_phy.h:60
#define AR_PHY_GAIN_2GHZ
Definition: ar9002_phy.h:423
#define REG_WRITE(_ah, _reg, _val)
Definition: hw.h:78
#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4
Definition: ar9002_phy.h:548
#define AR_PHY_BASE
Definition: phy.h:27
#define AR9287_AN_RF2G3_OB_CCK
Definition: reg.h:1406
#define CTL_2GHT20
Definition: eeprom.h:74
#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 AR_PHY_EXT_CCA0
Definition: ar9002_phy.h:328
unsigned short word
Definition: smc9000.h:39
#define CMP_CTL
#define CTL_MODE_M
Definition: eeprom.h:70
#define CTL_11B_EXT
#define AR9287_AN_RF2G3_OB_PAL_OFF
Definition: reg.h:1412
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
signed short int16_t
Definition: stdint.h:16
#define AR_PHY_POWER_TX_RATE9
Definition: ar9002_phy.h:564
#define AR_PHY_DESIRED_SZ_ADC
Definition: ar9002_phy.h:107
#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1
Definition: ar9002_phy.h:542
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define IS_CHAN_HT40(_c)
Definition: hw.h:373
#define AR_PHY_RF_CTL4_TX_END_XPAA_OFF
Definition: ar9002_phy.h:83
#define AR9280_PHY_RXGAIN_TXRX_MARGIN
Definition: ar9002_phy.h:103
#define REDUCE_SCALED_POWER_BY_TWO_CHAIN
#define CTL_5GHT40
Definition: eeprom.h:77
struct modal_eep_ar9287_header modalHeader
Definition: eeprom.h:619
u8 txRxAttenCh[AR9287_MAX_CHAINS]
Definition: eeprom.h:479
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
Definition: eeprom.h:267
#define AR9287_AN_RF2G3_CH0
Definition: reg.h:1400
struct base_eep_ar9287_header baseEepHeader
Definition: eeprom.h:617
#define AR9287_EEP_VER_MINOR_MASK
Definition: eeprom.h:186
#define CTL_5GHT20
Definition: eeprom.h:75
u8 bswAtten[AR9287_MAX_CHAINS]
Definition: eeprom.h:496
u8 ctlIndex[AR9287_NUM_CTLS]
Definition: eeprom.h:631
uint8_t u8
Definition: stdint.h:20
static int test
Definition: epic100.c:73
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 AR9287_MAX_CHAINS
Definition: eeprom.h:205
#define swab32
Definition: ath.h:69
#define AR9287_EEP_START_LOC
Definition: eeprom.h:194
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 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
int8_t iqCalQCh[AR9287_MAX_CHAINS]
Definition: eeprom.h:490
u16 ctl_center
Definition: hw.h:424