iPXE
ath9k_ar9003_phy.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010-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
20FILE_SECBOOT ( FORBIDDEN );
21
22#include <ipxe/io.h>
23
24#include "hw.h"
25#include "ar9003_phy.h"
26
27static const int firstep_table[] =
28/* level: 0 1 2 3 4 5 6 7 8 */
29 { -4, -2, 0, 2, 4, 6, 8, 10, 12 }; /* lvl 0-8, default 2 */
30
31static const int cycpwrThr1_table[] =
32/* level: 0 1 2 3 4 5 6 7 8 */
33 { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
34
35/*
36 * register values to turn OFDM weak signal detection OFF
37 */
38static const int m1ThreshLow_off = 127;
39static const int m2ThreshLow_off = 127;
40static const int m1Thresh_off = 127;
41static const int m2Thresh_off = 127;
42static const int m2CountThr_off = 31;
43static const int m2CountThrLow_off = 63;
44static const int m1ThreshLowExt_off = 127;
45static const int m2ThreshLowExt_off = 127;
46static const int m1ThreshExt_off = 127;
47static const int m2ThreshExt_off = 127;
48
49/**
50 * ar9003_hw_set_channel - set channel on single-chip device
51 * @ah: atheros hardware structure
52 * @chan:
53 *
54 * This is the function to change channel on single-chip devices, that is
55 * all devices after ar9280.
56 *
57 * This function takes the channel value in MHz and sets
58 * hardware channel value. Assumes writes have been enabled to analog bus.
59 *
60 * Actual Expression,
61 *
62 * For 2GHz channel,
63 * Channel Frequency = (3/4) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17)
64 * (freq_ref = 40MHz)
65 *
66 * For 5GHz channel,
67 * Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^10)
68 * (freq_ref = 40MHz/(24>>amodeRefSel))
69 *
70 * For 5GHz channels which are 5MHz spaced,
71 * Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17)
72 * (freq_ref = 40MHz)
73 */
74static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
75{
76 u16 bMode, fracMode = 0, aModeRefSel = 0;
77 u32 freq, channelSel = 0, reg32 = 0;
78 struct chan_centers centers;
79 int loadSynthChannel;
80
81 ath9k_hw_get_channel_centers(ah, chan, &centers);
82 freq = centers.synth_center;
83
84 if (freq < 4800) { /* 2 GHz, fractional mode */
85 if (AR_SREV_9485(ah)) {
86 u32 chan_frac;
87
88 /*
89 * freq_ref = 40 / (refdiva >> amoderefsel); where refdiva=1 and amoderefsel=0
90 * ndiv = ((chan_mhz * 4) / 3) / freq_ref;
91 * chansel = int(ndiv), chanfrac = (ndiv - chansel) * 0x20000
92 */
93 channelSel = (freq * 4) / 120;
94 chan_frac = (((freq * 4) % 120) * 0x20000) / 120;
95 channelSel = (channelSel << 17) | chan_frac;
96 } else if (AR_SREV_9340(ah)) {
97 if (ah->is_clk_25mhz) {
98 u32 chan_frac;
99
100 channelSel = (freq * 2) / 75;
101 chan_frac = (((freq * 2) % 75) * 0x20000) / 75;
102 channelSel = (channelSel << 17) | chan_frac;
103 } else
104 channelSel = CHANSEL_2G(freq) >> 1;
105 } else
106 channelSel = CHANSEL_2G(freq);
107 /* Set to 2G mode */
108 bMode = 1;
109 } else {
110 if (AR_SREV_9340(ah) && ah->is_clk_25mhz) {
111 u32 chan_frac;
112
113 channelSel = (freq * 2) / 75;
114 chan_frac = ((freq % 75) * 0x20000) / 75;
115 channelSel = (channelSel << 17) | chan_frac;
116 } else {
117 channelSel = CHANSEL_5G(freq);
118 /* Doubler is ON, so, divide channelSel by 2. */
119 channelSel >>= 1;
120 }
121 /* Set to 5G mode */
122 bMode = 0;
123 }
124
125 /* Enable fractional mode for all channels */
126 fracMode = 1;
127 aModeRefSel = 0;
128 loadSynthChannel = 0;
129
130 reg32 = (bMode << 29);
132
133 /* Enable Long shift Select for Synthesizer */
136
137 /* Program Synth. setting */
138 reg32 = (channelSel << 2) | (fracMode << 30) |
139 (aModeRefSel << 28) | (loadSynthChannel << 31);
141
142 /* Toggle Load Synth channel bit */
143 loadSynthChannel = 1;
144 reg32 = (channelSel << 2) | (fracMode << 30) |
145 (aModeRefSel << 28) | (loadSynthChannel << 31);
147
148 ah->curchan = chan;
149 ah->curchan_rad_index = -1;
150
151 return 0;
152}
153
154/**
155 * ar9003_hw_spur_mitigate_mrc_cck - convert baseband spur frequency
156 * @ah: atheros hardware structure
157 * @chan:
158 *
159 * For single-chip solutions. Converts to baseband spur frequency given the
160 * input channel frequency and compute register settings below.
161 *
162 * Spur mitigation for MRC CCK
163 */
165 struct ath9k_channel *chan)
166{
167 static const u32 spur_freq[4] = { 2420, 2440, 2464, 2480 };
168 int cur_bb_spur, negative = 0, cck_spur_freq;
169 int i;
170 int range, max_spur_cnts, synth_freq;
171 u8 *spur_fbin_ptr = NULL;
172
173 /*
174 * Need to verify range +/- 10 MHz in control channel, otherwise spur
175 * is out-of-band and can be ignored.
176 */
177
178 if (AR_SREV_9485(ah) || AR_SREV_9340(ah)) {
179 spur_fbin_ptr = ar9003_get_spur_chan_ptr(ah,
180 IS_CHAN_2GHZ(chan));
181 if (spur_fbin_ptr[0] == 0) /* No spur */
182 return;
183 max_spur_cnts = 5;
184 if (IS_CHAN_HT40(chan)) {
185 range = 19;
188 synth_freq = chan->channel + 10;
189 else
190 synth_freq = chan->channel - 10;
191 } else {
192 range = 10;
193 synth_freq = chan->channel;
194 }
195 } else {
196 range = 10;
197 max_spur_cnts = 4;
198 synth_freq = chan->channel;
199 }
200
201 for (i = 0; i < max_spur_cnts; i++) {
202 negative = 0;
204 cur_bb_spur = FBIN2FREQ(spur_fbin_ptr[i],
205 IS_CHAN_2GHZ(chan)) - synth_freq;
206 else
207 cur_bb_spur = spur_freq[i] - synth_freq;
208
209 if (cur_bb_spur < 0) {
210 negative = 1;
211 cur_bb_spur = -cur_bb_spur;
212 }
213 if (cur_bb_spur < range) {
214 cck_spur_freq = (int)((cur_bb_spur << 19) / 11);
215
216 if (negative == 1)
217 cck_spur_freq = -cck_spur_freq;
218
219 cck_spur_freq = cck_spur_freq & 0xfffff;
220
227 0x2);
230 0x1);
233 cck_spur_freq);
234
235 return;
236 }
237 }
238
245}
246
247/* Clean all spur register fields */
249{
268
289}
290
291static void ar9003_hw_spur_ofdm(struct ath_hw *ah,
292 int freq_offset,
293 int spur_freq_sd,
294 int spur_delta_phase,
295 int spur_subchannel_sd)
296{
297 int mask_index = 0;
298
299 /* OFDM Spur mitigation */
303 AR_PHY_TIMING11_SPUR_FREQ_SD, spur_freq_sd);
305 AR_PHY_TIMING11_SPUR_DELTA_PHASE, spur_delta_phase);
307 AR_PHY_SFCORR_EXT_SPUR_SUBCHANNEL_SD, spur_subchannel_sd);
318
320 AR_PHY_MODE_DYNAMIC) == 0x1)
323
324 mask_index = (freq_offset << 4) / 5;
325 if (mask_index < 0)
326 mask_index = mask_index - 1;
327
328 mask_index = mask_index & 0x7f;
329
350}
351
353 struct ath9k_channel *chan,
354 int freq_offset)
355{
356 int spur_freq_sd = 0;
357 int spur_subchannel_sd = 0;
358 int spur_delta_phase = 0;
359
360 if (IS_CHAN_HT40(chan)) {
361 if (freq_offset < 0) {
364 spur_subchannel_sd = 1;
365 else
366 spur_subchannel_sd = 0;
367
368 spur_freq_sd = ((freq_offset + 10) << 9) / 11;
369
370 } else {
373 spur_subchannel_sd = 0;
374 else
375 spur_subchannel_sd = 1;
376
377 spur_freq_sd = ((freq_offset - 10) << 9) / 11;
378
379 }
380
381 spur_delta_phase = (freq_offset << 17) / 5;
382
383 } else {
384 spur_subchannel_sd = 0;
385 spur_freq_sd = (freq_offset << 9) /11;
386 spur_delta_phase = (freq_offset << 18) / 5;
387 }
388
389 spur_freq_sd = spur_freq_sd & 0x3ff;
390 spur_delta_phase = spur_delta_phase & 0xfffff;
391
393 freq_offset,
394 spur_freq_sd,
395 spur_delta_phase,
396 spur_subchannel_sd);
397}
398
399/* Spur mitigation for OFDM */
401 struct ath9k_channel *chan)
402{
403 int synth_freq;
404 int range = 10;
405 int freq_offset = 0;
406 int mode;
407 u8* spurChansPtr;
408 unsigned int i;
409 struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
410
411 if (IS_CHAN_5GHZ(chan)) {
412 spurChansPtr = &(eep->modalHeader5G.spurChans[0]);
413 mode = 0;
414 }
415 else {
416 spurChansPtr = &(eep->modalHeader2G.spurChans[0]);
417 mode = 1;
418 }
419
420 if (spurChansPtr[0] == 0)
421 return; /* No spur in the mode */
422
423 if (IS_CHAN_HT40(chan)) {
424 range = 19;
427 synth_freq = chan->channel - 10;
428 else
429 synth_freq = chan->channel + 10;
430 } else {
431 range = 10;
432 synth_freq = chan->channel;
433 }
434
436
437 for (i = 0; i < AR_EEPROM_MODAL_SPURS && spurChansPtr[i]; i++) {
438 freq_offset = FBIN2FREQ(spurChansPtr[i], mode) - synth_freq;
439 if (abs(freq_offset) < range) {
440 ar9003_hw_spur_ofdm_work(ah, chan, freq_offset);
441 break;
442 }
443 }
444}
445
447 struct ath9k_channel *chan)
448{
451}
452
454 struct ath9k_channel *chan)
455{
456 u32 pll;
457
458 pll = SM(0x5, AR_RTC_9300_PLL_REFDIV);
459
460 if (chan && IS_CHAN_HALF_RATE(chan))
461 pll |= SM(0x1, AR_RTC_9300_PLL_CLKSEL);
462 else if (chan && IS_CHAN_QUARTER_RATE(chan))
463 pll |= SM(0x2, AR_RTC_9300_PLL_CLKSEL);
464
465 pll |= SM(0x2c, AR_RTC_9300_PLL_DIV);
466
467 return pll;
468}
469
471 struct ath9k_channel *chan)
472{
473 u32 phymode;
474 u32 enableDacFifo = 0;
475
476 enableDacFifo =
478
479 /* Enable 11n HT, 20 MHz */
481 AR_PHY_GC_SHORT_GI_40 | enableDacFifo;
482
483 /* Configure baseband for dynamic 20/40 operation */
484 if (IS_CHAN_HT40(chan)) {
485 phymode |= AR_PHY_GC_DYN2040_EN;
486 /* Configure control (primary) channel at +-10MHz */
487 if ((chan->chanmode == CHANNEL_A_HT40PLUS) ||
488 (chan->chanmode == CHANNEL_G_HT40PLUS))
489 phymode |= AR_PHY_GC_DYN2040_PRI_CH;
490
491 }
492
493 /* make sure we preserve INI settings */
494 phymode |= REG_READ(ah, AR_PHY_GEN_CTRL);
495 /* turn off Green Field detection for STA for now */
496 phymode &= ~AR_PHY_GC_GF_DETECT_EN;
497
498 REG_WRITE(ah, AR_PHY_GEN_CTRL, phymode);
499
500 /* Configure MAC for 20/40 operation */
502
503 /* global transmit timeout (25 TUs default)*/
505 /* carrier sense timeout */
507}
508
509static void ar9003_hw_init_bb(struct ath_hw *ah,
510 struct ath9k_channel *chan)
511{
512 u32 synthDelay;
513
514 /*
515 * Wait for the frequency synth to settle (synth goes on
516 * via AR_PHY_ACTIVE_EN). Read the phy active delay register.
517 * Value is in 100ns increments.
518 */
520 if (IS_CHAN_B(chan))
521 synthDelay = (4 * synthDelay) / 22;
522 else
523 synthDelay /= 10;
524
525 /* Activate the PHY (includes baseband activate + synthesizer on) */
527
528 /*
529 * There is an issue if the AP starts the calibration before
530 * the base band timeout completes. This could result in the
531 * rx_clear false triggering. As a workaround we add delay an
532 * extra BASE_ACTIVATE_DELAY usecs to ensure this condition
533 * does not happen.
534 */
535 udelay(synthDelay + BASE_ACTIVATE_DELAY);
536}
537
539{
540 switch (rx) {
541 case 0x5:
544 /* Fall through */
545 case 0x3:
546 case 0x1:
547 case 0x2:
548 case 0x7:
551 break;
552 default:
553 break;
554 }
555
556 if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7))
558 else
560
561 if (tx == 0x5) {
564 }
565}
566
567/*
568 * Override INI values with chip specific configuration.
569 */
570static void ar9003_hw_override_ini(struct ath_hw *ah)
571{
572 u32 val;
573
574 /*
575 * Set the RX_ABORT and RX_DIS and clear it only after
576 * RXE is set for MAC. This prevents frames with
577 * corrupted descriptor status.
578 */
580
581 /*
582 * For AR9280 and above, there is a new feature that allows
583 * Multicast search based on both MAC Address and Key ID. By default,
584 * this feature is enabled. But since the driver is not using this
585 * feature, we switch it off; otherwise multicast search based on
586 * MAC addr only will fail.
587 */
591}
592
593static void ar9003_hw_prog_ini(struct ath_hw *ah,
594 struct ar5416IniArray *iniArr,
595 int column)
596{
597 unsigned int i, regWrites = 0;
598
599 /* New INI format: Array may be undefined (pre, core, post arrays) */
600 if (!iniArr->ia_array)
601 return;
602
603 /*
604 * New INI format: Pre, core, and post arrays for a given subsystem
605 * may be modal (> 2 columns) or non-modal (2 columns). Determine if
606 * the array is non-modal and force the column to 1.
607 */
608 if ((unsigned int)column >= iniArr->ia_columns)
609 column = 1;
610
611 for (i = 0; i < iniArr->ia_rows; i++) {
612 u32 reg = INI_RA(iniArr, i, 0);
613 u32 val = INI_RA(iniArr, i, column);
614
615 REG_WRITE(ah, reg, val);
616
617 DO_DELAY(regWrites);
618 }
619}
620
621static int ar9003_hw_process_ini(struct ath_hw *ah,
622 struct ath9k_channel *chan)
623{
624 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
625 unsigned int regWrites = 0, i;
626 struct net80211_channel *channel = chan->chan;
627 u32 modesIndex;
628
629 switch (chan->chanmode) {
630 case CHANNEL_A:
631 case CHANNEL_A_HT20:
632 modesIndex = 1;
633 break;
636 modesIndex = 2;
637 break;
638 case CHANNEL_G:
639 case CHANNEL_G_HT20:
640 case CHANNEL_B:
641 modesIndex = 4;
642 break;
645 modesIndex = 3;
646 break;
647
648 default:
649 return -EINVAL;
650 }
651
652 for (i = 0; i < ATH_INI_NUM_SPLIT; i++) {
653 ar9003_hw_prog_ini(ah, &ah->iniSOC[i], modesIndex);
654 ar9003_hw_prog_ini(ah, &ah->iniMac[i], modesIndex);
655 ar9003_hw_prog_ini(ah, &ah->iniBB[i], modesIndex);
656 ar9003_hw_prog_ini(ah, &ah->iniRadio[i], modesIndex);
657 }
658
659 REG_WRITE_ARRAY(&ah->iniModesRxGain, 1, regWrites);
660 REG_WRITE_ARRAY(&ah->iniModesTxGain, modesIndex, regWrites);
661
662 /*
663 * For 5GHz channels requiring Fast Clock, apply
664 * different modal values.
665 */
666 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
667 REG_WRITE_ARRAY(&ah->iniModesAdditional,
668 modesIndex, regWrites);
669
670 if (AR_SREV_9340(ah) && !ah->is_clk_25mhz)
671 REG_WRITE_ARRAY(&ah->iniModesAdditional_40M, 1, regWrites);
672
675 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
676
677 /* Set TX power */
678 ah->eep_ops->set_txpower(ah, chan,
679 ath9k_regd_get_ctl(regulatory, chan),
680 0,
681 channel->maxpower * 2,
683 (u32) regulatory->power_limit), 0);
684
685 return 0;
686}
687
688static void ar9003_hw_set_rfmode(struct ath_hw *ah,
689 struct ath9k_channel *chan)
690{
691 u32 rfMode = 0;
692
693 if (chan == NULL)
694 return;
695
696 rfMode |= (IS_CHAN_B(chan) || IS_CHAN_G(chan))
698
699 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
701
702 REG_WRITE(ah, AR_PHY_MODE, rfMode);
703}
704
709
711 struct ath9k_channel *chan)
712{
713 u32 coef_scaled, ds_coef_exp, ds_coef_man;
714 u32 clockMhzScaled = 0x64000000;
715 struct chan_centers centers;
716
717 /*
718 * half and quarter rate can divide the scaled clock by 2 or 4
719 * scale for selected channel bandwidth
720 */
721 if (IS_CHAN_HALF_RATE(chan))
722 clockMhzScaled = clockMhzScaled >> 1;
723 else if (IS_CHAN_QUARTER_RATE(chan))
724 clockMhzScaled = clockMhzScaled >> 2;
725
726 /*
727 * ALGO -> coef = 1e8/fcarrier*fclock/40;
728 * scaled coef to provide precision for this floating calculation
729 */
730 ath9k_hw_get_channel_centers(ah, chan, &centers);
731 coef_scaled = clockMhzScaled / centers.synth_center;
732
733 ath9k_hw_get_delta_slope_vals(ah, coef_scaled, &ds_coef_man,
734 &ds_coef_exp);
735
737 AR_PHY_TIMING3_DSC_MAN, ds_coef_man);
739 AR_PHY_TIMING3_DSC_EXP, ds_coef_exp);
740
741 /*
742 * For Short GI,
743 * scaled coeff is 9/10 that of normal coeff
744 */
745 coef_scaled = (9 * coef_scaled) / 10;
746
747 ath9k_hw_get_delta_slope_vals(ah, coef_scaled, &ds_coef_man,
748 &ds_coef_exp);
749
750 /* for short gi */
752 AR_PHY_SGI_DSC_MAN, ds_coef_man);
754 AR_PHY_SGI_DSC_EXP, ds_coef_exp);
755}
756
763
764/*
765 * Wait for the frequency synth to settle (synth goes on via PHY_ACTIVE_EN).
766 * Read the phy active delay register. Value is in 100ns increments.
767 */
768static void ar9003_hw_rfbus_done(struct ath_hw *ah)
769{
771 if (IS_CHAN_B(ah->curchan))
772 synthDelay = (4 * synthDelay) / 22;
773 else
774 synthDelay /= 10;
775
776 udelay(synthDelay + BASE_ACTIVATE_DELAY);
777
779}
780
790
791static int ar9003_hw_ani_control(struct ath_hw *ah,
792 enum ath9k_ani_cmd cmd, int param)
793{
794 struct ath9k_channel *chan = ah->curchan;
795 struct ar5416AniState *aniState = &chan->ani;
796 s32 value, value2;
797
798 switch (cmd & ah->ani_function) {
800 /*
801 * on == 1 means ofdm weak signal detection is ON
802 * on == 1 is the default, for less noise immunity
803 *
804 * on == 0 means ofdm weak signal detection is OFF
805 * on == 0 means more noise imm
806 */
807 u32 on = param ? 1 : 0;
808 /*
809 * make register setting for default
810 * (weak sig detect ON) come from INI file
811 */
812 int m1ThreshLow = on ?
814 int m2ThreshLow = on ?
816 int m1Thresh = on ?
817 aniState->iniDef.m1Thresh : m1Thresh_off;
818 int m2Thresh = on ?
819 aniState->iniDef.m2Thresh : m2Thresh_off;
820 int m2CountThr = on ?
821 aniState->iniDef.m2CountThr : m2CountThr_off;
822 int m2CountThrLow = on ?
824 int m1ThreshLowExt = on ?
826 int m2ThreshLowExt = on ?
828 int m1ThreshExt = on ?
830 int m2ThreshExt = on ?
832
835 m1ThreshLow);
838 m2ThreshLow);
840 AR_PHY_SFCORR_M1_THRESH, m1Thresh);
842 AR_PHY_SFCORR_M2_THRESH, m2Thresh);
844 AR_PHY_SFCORR_M2COUNT_THR, m2CountThr);
847 m2CountThrLow);
848
850 AR_PHY_SFCORR_EXT_M1_THRESH_LOW, m1ThreshLowExt);
852 AR_PHY_SFCORR_EXT_M2_THRESH_LOW, m2ThreshLowExt);
854 AR_PHY_SFCORR_EXT_M1_THRESH, m1ThreshExt);
856 AR_PHY_SFCORR_EXT_M2_THRESH, m2ThreshExt);
857
858 if (on)
861 else
864
865 if (on != aniState->ofdmWeakSigDetect) {
866 DBG2("ath9k: "
867 "** ch %d: ofdm weak signal: %s=>%s\n",
868 chan->channel,
869 aniState->ofdmWeakSigDetect ?
870 "on" : "off",
871 on ? "on" : "off");
872 if (on)
873 ah->stats.ast_ani_ofdmon++;
874 else
875 ah->stats.ast_ani_ofdmoff++;
876 aniState->ofdmWeakSigDetect = on;
877 }
878 break;
879 }
881 u32 level = param;
882
883 if (level >= ARRAY_SIZE(firstep_table)) {
884 DBG("ath9k: "
885 "ATH9K_ANI_FIRSTEP_LEVEL: level out of range (%d > %zd)\n",
886 level, ARRAY_SIZE(firstep_table));
887 return 0;
888 }
889
890 /*
891 * make register setting relative to default
892 * from INI file & cap value
893 */
894 value = firstep_table[level] -
896 aniState->iniDef.firstep;
903 value);
904 /*
905 * we need to set first step low register too
906 * make register setting relative to default
907 * from INI file & cap value
908 */
909 value2 = firstep_table[level] -
911 aniState->iniDef.firstepLow;
916
919
920 if (level != aniState->firstepLevel) {
921 DBG2("ath9k: "
922 "** ch %d: level %d=>%d[def:%d] firstep[level]=%d ini=%d\n",
923 chan->channel,
924 aniState->firstepLevel,
925 level,
927 value,
928 aniState->iniDef.firstep);
929 DBG2("ath9k: "
930 "** ch %d: level %d=>%d[def:%d] firstep_low[level]=%d ini=%d\n",
931 chan->channel,
932 aniState->firstepLevel,
933 level,
935 value2,
936 aniState->iniDef.firstepLow);
937 if (level > aniState->firstepLevel)
938 ah->stats.ast_ani_stepup++;
939 else if (level < aniState->firstepLevel)
940 ah->stats.ast_ani_stepdown++;
941 aniState->firstepLevel = level;
942 }
943 break;
944 }
946 u32 level = param;
947
948 if (level >= ARRAY_SIZE(cycpwrThr1_table)) {
949 DBG("ath9k: "
950 "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%d > %zd)\n",
952 return 0;
953 }
954 /*
955 * make register setting relative to default
956 * from INI file & cap value
957 */
958 value = cycpwrThr1_table[level] -
960 aniState->iniDef.cycpwrThr1;
967 value);
968
969 /*
970 * set AR_PHY_EXT_CCA for extension channel
971 * make register setting relative to default
972 * from INI file & cap value
973 */
974 value2 = cycpwrThr1_table[level] -
976 aniState->iniDef.cycpwrThr1Ext;
982 AR_PHY_EXT_CYCPWR_THR1, value2);
983
984 if (level != aniState->spurImmunityLevel) {
985 DBG2("ath9k: "
986 "** ch %d: level %d=>%d[def:%d] cycpwrThr1[level]=%d ini=%d\n",
987 chan->channel,
988 aniState->spurImmunityLevel,
989 level,
991 value,
992 aniState->iniDef.cycpwrThr1);
993 DBG2("ath9k: "
994 "** ch %d: level %d=>%d[def:%d] cycpwrThr1Ext[level]=%d ini=%d\n",
995 chan->channel,
996 aniState->spurImmunityLevel,
997 level,
999 value2,
1000 aniState->iniDef.cycpwrThr1Ext);
1001 if (level > aniState->spurImmunityLevel)
1002 ah->stats.ast_ani_spurup++;
1003 else if (level < aniState->spurImmunityLevel)
1004 ah->stats.ast_ani_spurdown++;
1005 aniState->spurImmunityLevel = level;
1006 }
1007 break;
1008 }
1009 case ATH9K_ANI_MRC_CCK:{
1010 /*
1011 * is_on == 1 means MRC CCK ON (default, less noise imm)
1012 * is_on == 0 means MRC CCK is OFF (more noise imm)
1013 */
1014 int is_on = param ? 1 : 0;
1016 AR_PHY_MRC_CCK_ENABLE, is_on);
1018 AR_PHY_MRC_CCK_MUX_REG, is_on);
1019 if (!(is_on != aniState->mrcCCKOff)) {
1020 DBG2("ath9k: "
1021 "** ch %d: MRC CCK: %s=>%s\n",
1022 chan->channel,
1023 !aniState->mrcCCKOff ? "on" : "off",
1024 is_on ? "on" : "off");
1025 if (is_on)
1026 ah->stats.ast_ani_ccklow++;
1027 else
1028 ah->stats.ast_ani_cckhigh++;
1029 aniState->mrcCCKOff = !is_on;
1030 }
1031 break;
1032 }
1033 case ATH9K_ANI_PRESENT:
1034 break;
1035 default:
1036 DBG2("ath9k: invalid cmd %d\n", cmd);
1037 return 0;
1038 }
1039
1040 DBG2("ath9k: "
1041 "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n",
1042 aniState->spurImmunityLevel,
1043 aniState->ofdmWeakSigDetect ? "on" : "off",
1044 aniState->firstepLevel,
1045 !aniState->mrcCCKOff ? "on" : "off",
1046 aniState->listenTime,
1047 aniState->ofdmPhyErrCount,
1048 aniState->cckPhyErrCount);
1049 return 1;
1050}
1051
1052static void ar9003_hw_do_getnf(struct ath_hw *ah,
1053 int16_t nfarray[NUM_NF_READINGS])
1054{
1055#define AR_PHY_CH_MINCCA_PWR 0x1FF00000
1056#define AR_PHY_CH_MINCCA_PWR_S 20
1057#define AR_PHY_CH_EXT_MINCCA_PWR 0x01FF0000
1058#define AR_PHY_CH_EXT_MINCCA_PWR_S 16
1059
1060 int16_t nf;
1061 int i;
1062
1063 for (i = 0; i < AR9300_MAX_CHAINS; i++) {
1064 if (ah->rxchainmask & BIT(i)) {
1065 nf = MS(REG_READ(ah, ah->nf_regs[i]),
1067 nfarray[i] = sign_extend32(nf, 8);
1068
1069 if (IS_CHAN_HT40(ah->curchan)) {
1070 u8 ext_idx = AR9300_MAX_CHAINS + i;
1071
1072 nf = MS(REG_READ(ah, ah->nf_regs[ext_idx]),
1074 nfarray[ext_idx] = sign_extend32(nf, 8);
1075 }
1076 }
1077 }
1078}
1079
1081{
1084 ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9300_2GHZ;
1087 ah->nf_5g.nominal = AR_PHY_CCA_NOM_VAL_9300_5GHZ;
1088}
1089
1090/*
1091 * Initialize the ANI register values with default (ini) values.
1092 * This routine is called during a (full) hardware reset after
1093 * all the registers are initialised from the INI.
1094 */
1096{
1097 struct ar5416AniState *aniState;
1098 struct ath9k_channel *chan = ah->curchan;
1099 struct ath9k_ani_default *iniDef;
1100 u32 val;
1101
1102 aniState = &ah->curchan->ani;
1103 iniDef = &aniState->iniDef;
1104
1105 DBG2("ath9k: "
1106 "ver %d.%d chan %d Mhz/0x%x\n",
1107 ah->hw_version.macVersion,
1108 ah->hw_version.macRev,
1109 chan->channel,
1110 chan->channelFlags);
1111
1116
1121
1127 iniDef->firstep = REG_READ_FIELD(ah,
1130 iniDef->firstepLow = REG_READ_FIELD(ah,
1133 iniDef->cycpwrThr1 = REG_READ_FIELD(ah,
1139
1140 /* these levels just got reset to defaults by the INI */
1145}
1146
1148 struct ath_hw_radar_conf *conf)
1149{
1150 u32 radar_0 = 0, radar_1 = 0;
1151
1152 if (!conf) {
1154 return;
1155 }
1156
1158 radar_0 |= SM(conf->fir_power, AR_PHY_RADAR_0_FIRPWR);
1159 radar_0 |= SM(conf->radar_rssi, AR_PHY_RADAR_0_RRSSI);
1160 radar_0 |= SM(conf->pulse_height, AR_PHY_RADAR_0_HEIGHT);
1161 radar_0 |= SM(conf->pulse_rssi, AR_PHY_RADAR_0_PRSSI);
1162 radar_0 |= SM(conf->pulse_inband, AR_PHY_RADAR_0_INBAND);
1163
1164 radar_1 |= AR_PHY_RADAR_1_MAX_RRSSI;
1165 radar_1 |= AR_PHY_RADAR_1_BLOCK_CHECK;
1166 radar_1 |= SM(conf->pulse_maxlen, AR_PHY_RADAR_1_MAXLEN);
1168 radar_1 |= SM(conf->radar_inband, AR_PHY_RADAR_1_RELPWR_THRESH);
1169
1170 REG_WRITE(ah, AR_PHY_RADAR_0, radar_0);
1171 REG_WRITE(ah, AR_PHY_RADAR_1, radar_1);
1172 if (conf->ext_channel)
1174 else
1176}
1177
1179{
1180 struct ath_hw_radar_conf *conf = &ah->radar_conf;
1181
1182 conf->fir_power = -28;
1183 conf->radar_rssi = 0;
1184 conf->pulse_height = 10;
1185 conf->pulse_rssi = 24;
1186 conf->pulse_inband = 8;
1187 conf->pulse_maxlen = 255;
1188 conf->pulse_inband_step = 12;
1189 conf->radar_inband = 8;
1190}
1191
1193 struct ath_hw_antcomb_conf *antconf)
1194{
1195 u32 regval;
1196
1197 regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
1198 antconf->main_lna_conf = (regval & AR_PHY_9485_ANT_DIV_MAIN_LNACONF) >>
1200 antconf->alt_lna_conf = (regval & AR_PHY_9485_ANT_DIV_ALT_LNACONF) >>
1202 antconf->fast_div_bias = (regval & AR_PHY_9485_ANT_FAST_DIV_BIAS) >>
1204 antconf->lna1_lna2_delta = -9;
1205 antconf->div_group = 2;
1206}
1207
1233
1235{
1236 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
1237 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
1238 static const u32 ar9300_cca_regs[6] = {
1245 };
1246
1251 priv_ops->init_bb = ar9003_hw_init_bb;
1253 priv_ops->set_rfmode = ar9003_hw_set_rfmode;
1256 priv_ops->rfbus_req = ar9003_hw_rfbus_req;
1257 priv_ops->rfbus_done = ar9003_hw_rfbus_done;
1260 priv_ops->do_getnf = ar9003_hw_do_getnf;
1263
1266
1269 memcpy(ah->nf_regs, ar9300_cca_regs, sizeof(ah->nf_regs));
1270}
1271
1273{
1274 u32 val;
1275
1278
1280}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
struct golan_eqe_cmd cmd
Definition CIB_PRM.h:1
#define ATH9K_ANI_ENABLE_MRC_CCK
Definition ani.h:77
#define ATH9K_SIG_SPUR_IMM_SETTING_MAX
Definition ani.h:75
#define ATH9K_SIG_FIRSTEP_SETTING_MIN
Definition ani.h:72
#define ATH9K_ANI_SPUR_IMMUNE_LVL_NEW
Definition ani.h:53
ath9k_ani_cmd
Definition ani.h:81
@ ATH9K_ANI_FIRSTEP_LEVEL
Definition ani.h:86
@ ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION
Definition ani.h:84
@ ATH9K_ANI_PRESENT
Definition ani.h:82
@ ATH9K_ANI_SPUR_IMMUNITY_LEVEL
Definition ani.h:87
@ ATH9K_ANI_MRC_CCK
Definition ani.h:90
#define ATH9K_ANI_USE_OFDM_WEAK_SIG
Definition ani.h:49
#define ATH9K_SIG_SPUR_IMM_SETTING_MIN
Definition ani.h:74
#define ATH9K_ANI_FIRSTEP_LVL_NEW
Definition ani.h:56
#define ATH9K_SIG_FIRSTEP_SETTING_MAX
Definition ani.h:73
#define AR_PHY_TIMING5
Definition ar9002_phy.h:203
#define AR_PHY_ACTIVE_EN
Definition ar9002_phy.h:54
#define AR_PHY_MODE_DYNAMIC
Definition ar9002_phy.h:402
#define AR_PHY_RFBUS_GRANT_EN
Definition ar9002_phy.h:390
#define AR_PHY_SWAP_ALT_CHAIN
Definition ar9002_phy.h:537
#define AR_PHY_SFCORR_M2COUNT_THR
Definition ar9002_phy.h:150
#define AR_PHY_RADAR_EXT
Definition ar9002_phy.h:222
#define AR_PHY_TIMING5_CYCPWR_THR1
Definition ar9002_phy.h:204
#define AR_PHY_RFBUS_GRANT
Definition ar9002_phy.h:389
#define AR_PHY_RX_CHAINMASK
Definition ar9002_phy.h:302
#define AR_PHY_TIMING11
Definition ar9002_phy.h:296
#define AR_PHY_RADAR_0_INBAND
Definition ar9002_phy.h:228
#define AR_PHY_CCK_DETECT
Definition ar9002_phy.h:414
#define AR_PHY_SFCORR_EXT_M1_THRESH
Definition ar9002_phy.h:346
#define AR_PHY_SPUR_REG
Definition ar9002_phy.h:518
#define AR_PHY_SFCORR_LOW_M2_THRESH_LOW
Definition ar9002_phy.h:146
#define AR_PHY_SFCORR_EXT_M2_THRESH_LOW
Definition ar9002_phy.h:352
#define AR_PHY_SFCORR
Definition ar9002_phy.h:149
#define AR_PHY_RX_DELAY_DELAY
Definition ar9002_phy.h:186
#define AR_PHY_RX_DELAY
Definition ar9002_phy.h:184
#define AR_PHY_EXT_CCA
Definition ar9002_phy.h:332
#define AR_PHY_RFBUS_REQ
Definition ar9002_phy.h:269
#define AR_PHY_RFBUS_REQ_EN
Definition ar9002_phy.h:270
#define AR_PHY_SFCORR_EXT
Definition ar9002_phy.h:345
#define AR_PHY_RADAR_0
Definition ar9002_phy.h:225
#define AR_PHY_SPUR_REG_MASK_RATE_CNTL
Definition ar9002_phy.h:520
#define AR_PHY_SYNTH_CONTROL
Definition ar9002_phy.h:159
#define AR_PHY_RADAR_0_ENA
Definition ar9002_phy.h:226
#define AR_PHY_RADAR_0_PRSSI
Definition ar9002_phy.h:230
#define AR_PHY_SFCORR_EXT_M2_THRESH
Definition ar9002_phy.h:348
#define AR_PHY_SFCORR_LOW_M1_THRESH_LOW
Definition ar9002_phy.h:144
#define AR_PHY_RADAR_0_HEIGHT
Definition ar9002_phy.h:232
#define AR_PHY_RADAR_0_RRSSI
Definition ar9002_phy.h:234
#define AR_PHY_TIMING3_DSC_MAN
Definition ar9002_phy.h:44
#define AR_PHY_RADAR_0_FFT_ENA
Definition ar9002_phy.h:227
#define AR_PHY_ACTIVE_DIS
Definition ar9002_phy.h:55
#define AR_PHY_MODE_OFDM
Definition ar9002_phy.h:406
#define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH
Definition ar9002_phy.h:527
#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV
Definition ar9002_phy.h:420
#define AR_PHY_RADAR_1_RELPWR_THRESH
Definition ar9002_phy.h:242
#define AR_PHY_FIND_SIG_LOW
Definition ar9002_phy.h:120
#define AR_PHY_RADAR_1
Definition ar9002_phy.h:239
#define AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW
Definition ar9002_phy.h:142
#define AR_PHY_SFCORR_LOW
Definition ar9002_phy.h:140
#define AR_PHY_MODE_DYN_CCK_DISABLE
Definition ar9002_phy.h:407
#define AR_PHY_TIMING3
Definition ar9002_phy.h:43
#define AR_PHY_RADAR_1_BLOCK_CHECK
Definition ar9002_phy.h:244
#define AR_PHY_FIND_SIG
Definition ar9002_phy.h:114
#define AR_PHY_SFCORR_EXT_M1_THRESH_LOW
Definition ar9002_phy.h:350
#define AR_PHY_SPUR_REG_ENABLE_MASK_PPM
Definition ar9002_phy.h:523
#define AR_PHY_RESTART
Definition ar9002_phy.h:265
#define AR_PHY_SFCORR_M1_THRESH
Definition ar9002_phy.h:152
#define AR_PHY_RADAR_1_MAX_RRSSI
Definition ar9002_phy.h:245
#define AR_PHY_ANALOG_SWAP
Definition ar9002_phy.h:536
#define AR_PHY_SFCORR_M2_THRESH
Definition ar9002_phy.h:154
#define AR_PHY_RADAR_0_FIRPWR
Definition ar9002_phy.h:236
#define AR_PHY_ACTIVE
Definition ar9002_phy.h:53
#define AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW
Definition ar9002_phy.h:141
#define AR_PHY_TIMING11_SPUR_DELTA_PHASE
Definition ar9002_phy.h:297
#define AR_PHY_FIND_SIG_FIRSTEP
Definition ar9002_phy.h:115
#define AR_PHY_TIMING3_DSC_EXP
Definition ar9002_phy.h:46
#define AR_PHY_MODE
Definition ar9002_phy.h:397
#define AR_PHY_RADAR_EXT_ENA
Definition ar9002_phy.h:223
#define AR_PHY_CAL_CHAINMASK
Definition ar9002_phy.h:559
#define AR_PHY_RADAR_1_RELSTEP_THRESH
Definition ar9002_phy.h:247
#define AR_PHY_RADAR_1_MAXLEN
Definition ar9002_phy.h:249
u8 * ar9003_get_spur_chan_ptr(struct ath_hw *ah, int is_2ghz)
#define FBIN2FREQ(x, y)
#define AR9300_MAX_CHAINS
#define AR_PHY_GEN_CTRL
Definition ar9003_phy.h:428
#define AR_PHY_CCK_SPUR_MIT_SPUR_RSSI_THR
Definition ar9003_phy.h:313
#define AR_PHY_TIMING4
Definition ar9003_phy.h:30
#define AR_PHY_SFCORR_EXT_SPUR_SUBCHANNEL_SD
Definition ar9003_phy.h:147
#define AR_PHY_CCA_NOM_VAL_9300_2GHZ
Definition ar9003_phy.h:330
#define AR_PHY_SPUR_MASK_A
Definition ar9003_phy.h:431
#define AR_PHY_TIMING4_ENABLE_PILOT_MASK
Definition ar9003_phy.h:114
#define AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI
Definition ar9003_phy.h:57
#define AR_PHY_CCK_SPUR_MIT
Definition ar9003_phy.h:312
#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A
Definition ar9003_phy.h:233
#define AR_PHY_65NM_CH0_SYNTH7
Definition ar9003_phy.h:607
#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A
Definition ar9003_phy.h:464
#define AR_PHY_TIMING11_SPUR_FREQ_SD
Definition ar9003_phy.h:38
#define AR_PHY_9485_ANT_FAST_DIV_BIAS
Definition ar9003_phy.h:276
#define AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT
Definition ar9003_phy.h:50
#define AR_PHY_CCA_2
Definition ar9003_phy.h:880
#define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_SELFCOR
Definition ar9003_phy.h:47
#define AR_PHY_9485_ANT_DIV_ALT_LNACONF_S
Definition ar9003_phy.h:281
#define AR_PHY_CCA_MIN_GOOD_VAL_9300_2GHZ
Definition ar9003_phy.h:332
#define AR_PHY_GC_ENABLE_DAC_FIFO
Definition ar9003_phy.h:688
#define AR_PHY_CCK_SPUR_MIT_USE_CCK_SPUR_MIT
Definition ar9003_phy.h:317
#define AR_PHY_CHAN_SPUR_MASK
Definition ar9003_phy.h:222
#define AR_PHY_SGI_DSC_EXP
Definition ar9003_phy.h:243
#define AR_PHY_SYNTH4_LONG_SHIFT_SELECT
Definition ar9003_phy.h:605
#define AR_PHY_EXT_CCA_2
Definition ar9003_phy.h:860
#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A
Definition ar9003_phy.h:466
#define AR_PHY_CCK_SPUR_MIT_SPUR_FILTER_TYPE
Definition ar9003_phy.h:315
#define AR_PHY_TIMING4_ENABLE_CHAN_MASK
Definition ar9003_phy.h:116
#define AR_PHY_GC_HT_EN
Definition ar9003_phy.h:683
#define AR_PHY_9485_ANT_DIV_ALT_GAINTB
Definition ar9003_phy.h:284
#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A
Definition ar9003_phy.h:228
#define AR_PHY_MC_GAIN_CTRL
Definition ar9003_phy.h:269
#define AR_PHY_GC_SHORT_GI_40
Definition ar9003_phy.h:684
#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_A
Definition ar9003_phy.h:230
#define AR_PHY_PILOT_SPUR_MASK
Definition ar9003_phy.h:221
#define AR_PHY_TIMING4_ENABLE_SPUR_FILTER
Definition ar9003_phy.h:119
#define AR_PHY_CCA_MAX_GOOD_VAL_9300_5GHZ
Definition ar9003_phy.h:335
#define AR_PHY_TIMING4_ENABLE_SPUR_RSSI
Definition ar9003_phy.h:121
#define AR_PHY_9485_ANT_FAST_DIV_BIAS_S
Definition ar9003_phy.h:277
#define AR_PHY_9485_ANT_DIV_MAIN_GAINTB_S
Definition ar9003_phy.h:287
#define AR_PHY_CCA_1
Definition ar9003_phy.h:825
#define AR_PHY_RESTART_ENA
Definition ar9003_phy.h:411
#define AR_PHY_CCA_MIN_GOOD_VAL_9300_5GHZ
Definition ar9003_phy.h:333
#define AR_PHY_65NM_CH0_SYNTH4
Definition ar9003_phy.h:604
#define AR_PHY_GC_DYN2040_PRI_CH
Definition ar9003_phy.h:680
#define AR_PHY_CCA_0
Definition ar9003_phy.h:262
#define AR_PHY_9485_ANT_DIV_ALT_LNACONF
Definition ar9003_phy.h:280
#define AR_PHY_EXT_CYCPWR_THR1
Definition ar9003_phy.h:154
#define AR_PHY_EXT_CCA_1
Definition ar9003_phy.h:804
#define AR_PHY_GC_GF_DETECT_EN
Definition ar9003_phy.h:687
#define AR_PHY_SGI_DSC_MAN
Definition ar9003_phy.h:241
#define AR_PHY_MRC_CCK_MUX_REG
Definition ar9003_phy.h:325
#define AR_PHY_9485_ANT_DIV_MAIN_GAINTB
Definition ar9003_phy.h:286
#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_A
Definition ar9003_phy.h:235
#define AR_PHY_SGI_DELTA
Definition ar9003_phy.h:223
#define AR_PHY_9485_ANT_DIV_MAIN_LNACONF_S
Definition ar9003_phy.h:283
#define AR_PHY_MRC_CCK_CTRL
Definition ar9003_phy.h:322
#define AR_PHY_CCA_MAX_GOOD_VAL_9300_2GHZ
Definition ar9003_phy.h:334
#define AR_PHY_GC_WALSH
Definition ar9003_phy.h:685
#define AR_PHY_FIND_SIG_LOW_FIRSTEP_LOW
Definition ar9003_phy.h:193
#define AR_PHY_CCK_SPUR_MIT_CCK_SPUR_FREQ
Definition ar9003_phy.h:319
#define AR_PHY_9485_ANT_DIV_MAIN_LNACONF
Definition ar9003_phy.h:282
#define AR_PHY_MRC_CCK_ENABLE
Definition ar9003_phy.h:323
#define AR_PHY_GC_SINGLE_HT_LTF1
Definition ar9003_phy.h:686
#define AR_PHY_9485_ANT_DIV_ALT_GAINTB_S
Definition ar9003_phy.h:285
#define AR_PHY_GC_DYN2040_EN
Definition ar9003_phy.h:678
#define AR_PHY_CCA_NOM_VAL_9300_5GHZ
Definition ar9003_phy.h:331
#define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_AGC
Definition ar9003_phy.h:44
pseudo_bit_t value[0x00020]
Definition arbel.h:2
signed short int16_t
Definition stdint.h:16
#define CHANNEL_B
Definition ath5k.h:641
#define CHANNEL_G
Definition ath5k.h:642
#define IS_CHAN_B(_c)
Definition ath5k.h:660
#define CHANNEL_A
Definition ath5k.h:640
#define AR_EEPROM_MODAL_SPURS
Definition eeprom.h:26
#define AR_SELFGEN_MASK
Definition reg.h:1824
#define AR_AGG_WEP_ENABLE
Definition reg.h:1896
#define AR_GTXTO_TIMEOUT_LIMIT_S
Definition reg.h:156
#define AR_DIAG_RX_ABORT
Definition reg.h:1525
#define AR_GTXTO
Definition reg.h:153
#define AR_AGG_WEP_ENABLE_FIX
Definition reg.h:1894
#define AR_SREV_9485(_ah)
Definition reg.h:868
#define AR_ADHOC_MCAST_KEYID_ENABLE
Definition reg.h:1895
#define AR_RTC_9300_PLL_CLKSEL
Definition reg.h:1148
#define AR_CST
Definition reg.h:164
#define AR_PCU_MISC_MODE2
Definition reg.h:1831
#define AR_RTC_9300_PLL_REFDIV
Definition reg.h:1146
#define AR_RTC_9300_PLL_DIV
Definition reg.h:1144
#define AR_CST_TIMEOUT_LIMIT_S
Definition reg.h:167
#define AR_PHY_AGC_CONTROL_YCOK_MAX
Definition reg.h:1910
#define AR_SREV_9340(_ah)
Definition reg.h:879
#define AR_DIAG_RX_DIS
Definition reg.h:1511
#define AR_DIAG_SW
Definition reg.h:1505
#define AR_PHY_AGC_CONTROL
Definition reg.h:1901
static const int m2CountThrLow_off
static const int m1ThreshLowExt_off
static const int m2ThreshExt_off
static const int m2ThreshLow_off
static const int firstep_table[]
static const int m2Thresh_off
static const int m1Thresh_off
static const int m1ThreshExt_off
static const int m2ThreshLowExt_off
static const int cycpwrThr1_table[]
static const int m2CountThr_off
static const int m1ThreshLow_off
#define AR_PHY_CH_MINCCA_PWR
static void ar9003_hw_set_rfmode(struct ath_hw *ah, struct ath9k_channel *chan)
static int ar9003_hw_process_ini(struct ath_hw *ah, struct ath9k_channel *chan)
static void ar9003_hw_init_bb(struct ath_hw *ah, struct ath9k_channel *chan)
static void ar9003_hw_prog_ini(struct ath_hw *ah, struct ar5416IniArray *iniArr, int column)
static void ar9003_hw_set_delta_slope(struct ath_hw *ah, struct ath9k_channel *chan)
static void ar9003_hw_antdiv_comb_conf_get(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
static void ar9003_hw_spur_mitigate_mrc_cck(struct ath_hw *ah, struct ath9k_channel *chan)
ar9003_hw_spur_mitigate_mrc_cck - convert baseband spur frequency @ah: atheros hardware structure @ch...
void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx)
static void ar9003_hw_spur_ofdm_clear(struct ath_hw *ah)
static void ar9003_hw_spur_ofdm(struct ath_hw *ah, int freq_offset, int spur_freq_sd, int spur_delta_phase, int spur_subchannel_sd)
static void ar9003_hw_antdiv_comb_conf_set(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
static void ar9003_hw_rfbus_done(struct ath_hw *ah)
static int ar9003_hw_ani_control(struct ath_hw *ah, enum ath9k_ani_cmd cmd, int param)
static void ar9003_hw_spur_mitigate_ofdm(struct ath_hw *ah, struct ath9k_channel *chan)
static void ar9003_hw_set_radar_conf(struct ath_hw *ah)
static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah, struct ath9k_channel *chan, int freq_offset)
static void ar9003_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan)
void ar9003_hw_disable_phy_restart(struct ath_hw *ah)
static void ar9003_hw_ani_cache_ini_regs(struct ath_hw *ah)
static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
ar9003_hw_set_channel - set channel on single-chip device @ah: atheros hardware structure @chan:
static u32 ar9003_hw_compute_pll_control(struct ath_hw *ah __unused, struct ath9k_channel *chan)
static void ar9003_hw_override_ini(struct ath_hw *ah)
static void ar9003_hw_set_nf_limits(struct ath_hw *ah)
static void ar9003_hw_set_diversity(struct ath_hw *ah, int value)
static void ar9003_hw_set_channel_regs(struct ath_hw *ah, struct ath9k_channel *chan)
static int ar9003_hw_rfbus_req(struct ath_hw *ah)
static void ar9003_hw_mark_phy_inactive(struct ath_hw *ah)
void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
#define AR_PHY_CH_EXT_MINCCA_PWR
static void ar9003_hw_set_radar_params(struct ath_hw *ah, struct ath_hw_radar_conf *conf)
static void ar9003_hw_do_getnf(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS])
u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan)
Definition ath9k_hw.c:869
void ath9k_hw_get_channel_centers(struct ath_hw *ah __unused, struct ath9k_channel *chan, struct chan_centers *centers)
Definition ath9k_hw.c:191
int ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout)
Definition ath9k_hw.c:95
void ath9k_hw_set11nmac2040(struct ath_hw *ah)
Definition ath9k_hw.c:1975
void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah __unused, u32 coef_scaled, u32 *coef_mantissa, u32 *coef_exponent)
Definition ath9k_hw.c:966
#define abs(x)
Definition ath.h:46
static int32_t sign_extend32(uint32_t value, int index)
Definition ath.h:71
#define BIT(nr)
Definition ath.h:34
#define min(x, y)
Definition ath.h:36
#define NUM_NF_READINGS
Definition calib.h:31
#define INI_RA(iniarray, row, column)
Definition calib.h:46
#define ARRAY_SIZE(x)
Definition efx_common.h:43
uint16_t mode
Acceleration mode.
Definition ena.h:15
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define DBG2(...)
Definition compiler.h:515
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
#define EINVAL
Invalid argument.
Definition errno.h:429
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define IS_CHAN_G(_c)
Definition hw.h:356
@ ATH9K_HW_CAP_APM
Definition hw.h:196
#define BASE_ACTIVATE_DELAY
Definition hw.h:134
static struct ath_regulatory * ath9k_hw_regulatory(struct ath_hw *ah)
Definition hw.h:875
#define CHANNEL_A_HT20
Definition hw.h:319
#define REG_WRITE(_ah, _reg, _val)
Definition hw.h:78
#define SM(_v, _f)
Definition hw.h:102
#define IS_CHAN_QUARTER_RATE(_c)
Definition hw.h:364
#define MS(_v, _f)
Definition hw.h:103
@ ATH_INI_NUM_SPLIT
Definition hw.h:178
#define REG_READ(_ah, _reg)
Definition hw.h:81
static struct ath_hw_private_ops * ath9k_hw_private_ops(struct ath_hw *ah)
Definition hw.h:880
static struct ath_hw_ops * ath9k_hw_ops(struct ath_hw *ah)
Definition hw.h:885
#define IS_CHAN_HT40(_c)
Definition hw.h:373
#define AH_WAIT_TIMEOUT
Definition hw.h:146
#define REG_RMW_FIELD(_a, _r, _f, _v)
Definition hw.h:104
#define MAX_RATE_POWER
Definition hw.h:145
#define CHANNEL_G_HT40MINUS
Definition hw.h:321
#define CHANNEL_A_HT40MINUS
Definition hw.h:323
#define CHANNEL_G_HT20
Definition hw.h:318
#define IS_CHAN_A_FAST_CLOCK(_ah, _c)
Definition hw.h:365
#define IS_CHAN_HALF_RATE(_c)
Definition hw.h:363
#define CHANNEL_G_HT40PLUS
Definition hw.h:320
#define REG_CLR_BIT(_a, _r, _f)
Definition hw.h:110
#define CHANNEL_A_HT40PLUS
Definition hw.h:322
#define REG_WRITE_ARRAY(iniarray, column, regWr)
Definition hw.h:120
#define IS_CHAN_2GHZ(_c)
Definition hw.h:362
#define REG_SET_BIT(_a, _r, _f)
Definition hw.h:108
#define REG_READ_FIELD(_a, _r, _f)
Definition hw.h:106
#define DO_DELAY(x)
Definition hw.h:113
#define IS_CHAN_5GHZ(_c)
Definition hw.h:361
#define u8
Definition igbvf_osdep.h:40
struct hv_monitor_parameter param[4][32]
Parameters.
Definition hyperv.h:13
iPXE I/O API
void __asmcall int val
Definition setjmp.h:12
int32_t s32
Definition stdint.h:23
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static unsigned int unsigned int reg
Definition myson.h:162
uint32_t channel
RNDIS channel.
Definition netvsc.h:3
struct pci_range range
PCI bus:dev.fn address range.
Definition pcicloud.c:40
#define CHANSEL_5G(_freq)
Definition phy.h:25
#define CHANSEL_2G(_freq)
Definition phy.h:24
uint8_t ah
Definition registers.h:1
u32 cckPhyErrCount
Definition ani.h:136
u8 firstepLevel
Definition ani.h:128
u32 listenTime
Definition ani.h:131
u32 ofdmPhyErrCount
Definition ani.h:135
u8 spurImmunityLevel
Definition ani.h:127
struct ath9k_ani_default iniDef
Definition ani.h:140
u8 ofdmWeakSigDetect
Definition ani.h:129
u8 mrcCCKOff
Definition ani.h:126
u32 ia_columns
Definition calib.h:37
u32 * ia_array
Definition calib.h:35
u32 ia_rows
Definition calib.h:36
struct ar9300_modal_eep_header modalHeader5G
struct ar9300_modal_eep_header modalHeader2G
u8 spurChans[AR_EEPROM_MODAL_SPURS]
u16 m1ThreshExt
Definition ani.h:112
u16 m1ThreshLowExt
Definition ani.h:110
u16 m2ThreshLow
Definition ani.h:105
u16 m1ThreshLow
Definition ani.h:104
u16 m2ThreshExt
Definition ani.h:113
u16 m2CountThrLow
Definition ani.h:109
u16 m2ThreshLowExt
Definition ani.h:111
u16 cycpwrThr1Ext
Definition ani.h:117
u16 channel
Definition hw.h:350
struct ar5416AniState ani
Definition hw.h:349
u32 chanmode
Definition hw.h:352
struct net80211_channel * chan
Definition hw.h:348
u32 channelFlags
Definition hw.h:351
int lna1_lna2_delta
Definition hw.h:488
struct ath_hw_ops - callbacks used by hardware code and driver code
Definition hw.h:604
void(* antdiv_comb_conf_set)(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
Definition hw.h:642
void(* antdiv_comb_conf_get)(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
Definition hw.h:640
struct ath_hw_private_ops - callbacks used internally by hardware code
Definition hw.h:551
void(* set_channel_regs)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:571
void(* rfbus_done)(struct ath_hw *ah)
Definition hw.h:580
void(* init_bb)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:572
void(* mark_phy_inactive)(struct ath_hw *ah)
Definition hw.h:577
void(* set_delta_slope)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:578
int(* ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd, int param)
Definition hw.h:585
int(* rf_set_freq)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:562
u32(* compute_pll_control)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:583
void(* spur_mitigate_freq)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:564
void(* set_diversity)(struct ath_hw *ah, int value)
Definition hw.h:582
int(* process_ini)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:574
void(* ani_cache_ini_regs)(struct ath_hw *ah)
Definition hw.h:592
int(* rfbus_req)(struct ath_hw *ah)
Definition hw.h:579
void(* set_rfmode)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:576
void(* do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS])
Definition hw.h:587
void(* set_radar_params)(struct ath_hw *ah, struct ath_hw_radar_conf *conf)
Definition hw.h:588
struct ath_hw_radar_conf - radar detection initialization parameters
Definition hw.h:512
int ext_channel
Definition hw.h:523
unsigned int radar_rssi
Definition hw.h:519
unsigned int radar_inband
Definition hw.h:520
unsigned int pulse_height
Definition hw.h:515
int fir_power
Definition hw.h:521
unsigned int pulse_inband
Definition hw.h:513
unsigned int pulse_maxlen
Definition hw.h:517
unsigned int pulse_inband_step
Definition hw.h:514
unsigned int pulse_rssi
Definition hw.h:516
Definition hw.h:657
int16_t power_limit
Definition ath.h:145
u16 synth_center
Definition hw.h:423
An 802.11 RF channel.
Definition net80211.h:386
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61
#define u16
Definition vga.h:20
#define u32
Definition vga.h:21
u8 tx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets to the AP.
Definition wpa.h:4
u8 rx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets from the AP.
Definition wpa.h:1