27 { -4, -2, 0, 2, 4, 6, 8, 10, 12 };
31 { -6, -4, -2, 0, 2, 4, 6, 8 };
74 u16 bMode, fracMode = 0, aModeRefSel = 0;
75 u32 freq, channelSel = 0, reg32 = 0;
91 channelSel = (freq * 4) / 120;
92 chan_frac = (((freq * 4) % 120) * 0x20000) / 120;
93 channelSel = (channelSel << 17) | chan_frac;
95 if (
ah->is_clk_25mhz) {
98 channelSel = (freq * 2) / 75;
99 chan_frac = (((freq * 2) % 75) * 0x20000) / 75;
100 channelSel = (channelSel << 17) | chan_frac;
111 channelSel = (freq * 2) / 75;
112 chan_frac = ((freq % 75) * 0x20000) / 75;
113 channelSel = (channelSel << 17) | chan_frac;
126 loadSynthChannel = 0;
128 reg32 = (bMode << 29);
136 reg32 = (channelSel << 2) | (fracMode << 30) |
137 (aModeRefSel << 28) | (loadSynthChannel << 31);
141 loadSynthChannel = 1;
142 reg32 = (channelSel << 2) | (fracMode << 30) |
143 (aModeRefSel << 28) | (loadSynthChannel << 31);
147 ah->curchan_rad_index = -1;
165 static const u32 spur_freq[4] = { 2420, 2440, 2464, 2480 };
166 int cur_bb_spur, negative = 0, cck_spur_freq;
168 int range, max_spur_cnts, synth_freq;
179 if (spur_fbin_ptr[0] == 0)
186 synth_freq = chan->
channel + 10;
188 synth_freq = chan->
channel - 10;
199 for (i = 0; i < max_spur_cnts; i++) {
202 cur_bb_spur =
FBIN2FREQ(spur_fbin_ptr[i],
205 cur_bb_spur = spur_freq[i] - synth_freq;
207 if (cur_bb_spur < 0) {
209 cur_bb_spur = -cur_bb_spur;
211 if (cur_bb_spur <
range) {
212 cck_spur_freq = (int)((cur_bb_spur << 19) / 11);
215 cck_spur_freq = -cck_spur_freq;
217 cck_spur_freq = cck_spur_freq & 0xfffff;
292 int spur_delta_phase,
293 int spur_subchannel_sd)
322 mask_index = (freq_offset << 4) / 5;
324 mask_index = mask_index - 1;
326 mask_index = mask_index & 0x7f;
354 int spur_freq_sd = 0;
355 int spur_subchannel_sd = 0;
356 int spur_delta_phase = 0;
359 if (freq_offset < 0) {
362 spur_subchannel_sd = 1;
364 spur_subchannel_sd = 0;
366 spur_freq_sd = ((freq_offset + 10) << 9) / 11;
371 spur_subchannel_sd = 0;
373 spur_subchannel_sd = 1;
375 spur_freq_sd = ((freq_offset - 10) << 9) / 11;
379 spur_delta_phase = (freq_offset << 17) / 5;
382 spur_subchannel_sd = 0;
383 spur_freq_sd = (freq_offset << 9) /11;
384 spur_delta_phase = (freq_offset << 18) / 5;
387 spur_freq_sd = spur_freq_sd & 0x3ff;
388 spur_delta_phase = spur_delta_phase & 0xfffff;
418 if (spurChansPtr[0] == 0)
425 synth_freq = chan->
channel - 10;
427 synth_freq = chan->
channel + 10;
436 freq_offset =
FBIN2FREQ(spurChansPtr[i], mode) - synth_freq;
472 u32 enableDacFifo = 0;
519 synthDelay = (4 * synthDelay) / 22;
595 unsigned int i, regWrites = 0;
606 if ((
unsigned int)column >= iniArr->
ia_columns)
609 for (i = 0; i < iniArr->
ia_rows; i++) {
623 unsigned int regWrites = 0, i;
666 modesIndex, regWrites);
676 ah->eep_ops->set_txpower(
ah, chan,
711 u32 coef_scaled, ds_coef_exp, ds_coef_man;
712 u32 clockMhzScaled = 0x64000000;
720 clockMhzScaled = clockMhzScaled >> 1;
722 clockMhzScaled = clockMhzScaled >> 2;
743 coef_scaled = (9 * coef_scaled) / 10;
770 synthDelay = (4 * synthDelay) / 22;
796 switch (
cmd &
ah->ani_function) {
810 int m1ThreshLow = on ?
812 int m2ThreshLow = on ?
818 int m2CountThr = on ?
820 int m2CountThrLow = on ?
822 int m1ThreshLowExt = on ?
824 int m2ThreshLowExt = on ?
826 int m1ThreshExt = on ?
828 int m2ThreshExt = on ?
865 "** ch %d: ofdm weak signal: %s=>%s\n",
871 ah->stats.ast_ani_ofdmon++;
873 ah->stats.ast_ani_ofdmoff++;
883 "ATH9K_ANI_FIRSTEP_LEVEL: level out of range (%d > %zd)\n",
920 "** ch %d: level %d=>%d[def:%d] firstep[level]=%d ini=%d\n",
928 "** ch %d: level %d=>%d[def:%d] firstep_low[level]=%d ini=%d\n",
936 ah->stats.ast_ani_stepup++;
938 ah->stats.ast_ani_stepdown++;
948 "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%d > %zd)\n",
984 "** ch %d: level %d=>%d[def:%d] cycpwrThr1[level]=%d ini=%d\n",
992 "** ch %d: level %d=>%d[def:%d] cycpwrThr1Ext[level]=%d ini=%d\n",
1000 ah->stats.ast_ani_spurup++;
1002 ah->stats.ast_ani_spurdown++;
1012 int is_on =
param ? 1 : 0;
1019 "** ch %d: MRC CCK: %s=>%s\n",
1022 is_on ?
"on" :
"off");
1024 ah->stats.ast_ani_ccklow++;
1026 ah->stats.ast_ani_cckhigh++;
1034 DBG2(
"ath9k: invalid cmd %d\n",
cmd);
1039 "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n",
1053 #define AR_PHY_CH_MINCCA_PWR 0x1FF00000 1054 #define AR_PHY_CH_MINCCA_PWR_S 20 1055 #define AR_PHY_CH_EXT_MINCCA_PWR 0x01FF0000 1056 #define AR_PHY_CH_EXT_MINCCA_PWR_S 16 1062 if (
ah->rxchainmask &
BIT(i)) {
1100 aniState = &
ah->curchan->ani;
1101 iniDef = &aniState->
iniDef;
1104 "ver %d.%d chan %d Mhz/0x%x\n",
1105 ah->hw_version.macVersion,
1106 ah->hw_version.macRev,
1148 u32 radar_0 = 0, radar_1 = 0;
1236 static const u32 ar9300_cca_regs[6] = {
1267 memcpy(
ah->nf_regs, ar9300_cca_regs,
sizeof(
ah->nf_regs));
#define BASE_ACTIVATE_DELAY
#define AR_PHY_SFCORR_LOW
#define AR_PHY_SFCORR_LOW_M2_THRESH_LOW
#define AR9300_MAX_CHAINS
static const int m2CountThrLow_off
void(* set_delta_slope)(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_GC_SHORT_GI_40
#define EINVAL
Invalid argument.
static void ar9003_hw_prog_ini(struct ath_hw *ah, struct ar5416IniArray *iniArr, int column)
#define AR_PHY_9485_ANT_DIV_MAIN_LNACONF
static u32 ar9003_hw_compute_pll_control(struct ath_hw *ah __unused, struct ath9k_channel *chan)
#define AR_PHY_CCK_SPUR_MIT_SPUR_FILTER_TYPE
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...
#define AR_PHY_9485_ANT_DIV_MAIN_LNACONF_S
#define AR_PHY_MRC_CCK_CTRL
static const int firstep_table[]
#define AR_GTXTO_TIMEOUT_LIMIT_S
static unsigned int unsigned int reg
#define AR_PHY_SFCORR_LOW_M1_THRESH_LOW
void(* init_bb)(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_CCK_SPUR_MIT_USE_CCK_SPUR_MIT
#define AR_PHY_CCA_NOM_VAL_9300_5GHZ
#define AR_PHY_CCK_SPUR_MIT_SPUR_RSSI_THR
#define AR_PHY_GC_ENABLE_DAC_FIFO
static void ar9003_hw_set_radar_conf(struct ath_hw *ah)
static void ar9003_hw_override_ini(struct ath_hw *ah)
static void ar9003_hw_do_getnf(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS])
#define AR_PHY_RFBUS_REQ_EN
#define AR_PHY_TIMING4_ENABLE_CHAN_MASK
#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV
static void ar9003_hw_set_delta_slope(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_CCA_MAX_GOOD_VAL_9300_5GHZ
#define AR_RTC_9300_PLL_REFDIV
#define AR_EEPROM_MODAL_SPURS
#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A
#define AR_PHY_RADAR_0_FFT_ENA
#define INI_RA(iniarray, row, column)
#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A
#define REG_CLR_BIT(_a, _r, _f)
#define ATH9K_SIG_FIRSTEP_SETTING_MAX
#define AR_PHY_MRC_CCK_MUX_REG
#define CHANSEL_5G(_freq)
void(* spur_mitigate_freq)(struct ath_hw *ah, struct ath9k_channel *chan)
static int32_t sign_extend32(uint32_t value, int index)
#define AR_PHY_9485_ANT_FAST_DIV_BIAS
static void ar9003_hw_mark_phy_inactive(struct ath_hw *ah)
void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah __unused, u32 coef_scaled, u32 *coef_mantissa, u32 *coef_exponent)
#define AR_PHY_FIND_SIG_LOW
#define AR_PHY_SFCORR_EXT_M1_THRESH_LOW
static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah, struct ath9k_channel *chan, int freq_offset)
#define AR_PHY_RADAR_1_MAX_RRSSI
#define IS_CHAN_HALF_RATE(_c)
#define AR_PHY_RESTART_ENA
#define CHANNEL_A_HT40MINUS
#define AR_PHY_TIMING11_SPUR_FREQ_SD
#define AR_SREV_9485(_ah)
void(* rfbus_done)(struct ath_hw *ah)
void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
static const int m2ThreshLow_off
static void ar9003_hw_set_channel_regs(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_SFCORR_EXT_M2_THRESH_LOW
#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_A
struct ath_hw_private_ops - callbacks used internally by hardware code
#define CHANSEL_2G(_freq)
#define AR_RTC_9300_PLL_CLKSEL
#define AR_PHY_SPUR_REG_ENABLE_MASK_PPM
struct net80211_channel * chan
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)
#define AR_PHY_GC_DYN2040_EN
static void ar9003_hw_set_nf_limits(struct ath_hw *ah)
#define AR_PHY_CCA_MIN_GOOD_VAL_9300_2GHZ
#define REG_RMW_FIELD(_a, _r, _f, _v)
#define AR_PHY_ACTIVE_DIS
static const int m1ThreshLowExt_off
static void ar9003_hw_set_rfmode(struct ath_hw *ah, struct ath9k_channel *chan)
void(* antdiv_comb_conf_set)(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
void(* mark_phy_inactive)(struct ath_hw *ah)
static void ar9003_hw_ani_cache_ini_regs(struct ath_hw *ah)
#define AR_PHY_SYNTH4_LONG_SHIFT_SELECT
#define IS_CHAN_QUARTER_RATE(_c)
unsigned int pulse_maxlen
#define AR_PHY_TIMING4_ENABLE_SPUR_RSSI
#define AR_PHY_SFCORR_EXT_M2_THRESH
void * memcpy(void *dest, const void *src, size_t len) __nonnull
u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan)
int(* process_ini)(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_GC_SINGLE_HT_LTF1
#define AR_PHY_RX_DELAY_DELAY
#define AR_PHY_ANALOG_SWAP
#define AR_PHY_RADAR_0_HEIGHT
#define AR_PHY_65NM_CH0_SYNTH7
#define AR_PHY_65NM_CH0_SYNTH4
#define AR_PHY_SFCORR_M1_THRESH
#define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_SELFCOR
#define AR_PHY_SFCORR_EXT_SPUR_SUBCHANNEL_SD
static void ar9003_hw_antdiv_comb_conf_get(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
pseudo_bit_t value[0x00020]
#define __unused
Declare a variable or data structure as unused.
#define AR_PHY_CH_EXT_MINCCA_PWR
unsigned int pulse_inband_step
unsigned int pulse_height
static struct ath_regulatory * ath9k_hw_regulatory(struct ath_hw *ah)
#define AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW
#define AR_PHY_PILOT_SPUR_MASK
#define AR_PCU_MISC_MODE2
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
#define AR_PHY_AGC_CONTROL
#define AR_PHY_RADAR_1_RELSTEP_THRESH
void(* ani_cache_ini_regs)(struct ath_hw *ah)
#define AR_PHY_RADAR_0_RRSSI
static const int m2ThreshLowExt_off
#define AR_PHY_9485_ANT_DIV_ALT_GAINTB_S
uint32_t channel
RNDIS channel.
#define ATH9K_ANI_FIRSTEP_LVL_NEW
#define AR_SREV_9340(_ah)
u8 * ar9003_get_spur_chan_ptr(struct ath_hw *ah, int is_2ghz)
#define AR_PHY_TIMING5_CYCPWR_THR1
static void ar9003_hw_init_bb(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_A
#define AR_PHY_9485_ANT_DIV_MAIN_GAINTB_S
#define AR_PHY_CCA_MAX_GOOD_VAL_9300_2GHZ
#define AR_PHY_RFBUS_GRANT_EN
static __always_inline void struct pci_range * range
#define ATH9K_SIG_SPUR_IMM_SETTING_MIN
#define AR_PHY_RADAR_0_INBAND
#define AR_PHY_CCA_NOM_VAL_9300_2GHZ
#define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH
#define AR_PHY_9485_ANT_DIV_ALT_GAINTB
#define AR_PHY_FIND_SIG_LOW_FIRSTEP_LOW
#define AR_PHY_SGI_DSC_MAN
static void ar9003_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_TIMING3_DSC_EXP
#define AR_PHY_RADAR_0_PRSSI
#define AR_PHY_SPUR_REG_MASK_RATE_CNTL
#define AR_PHY_CH_MINCCA_PWR
struct ath_hw_radar_conf - radar detection initialization parameters
void ar9003_hw_disable_phy_restart(struct ath_hw *ah)
struct hv_monitor_parameter param[4][32]
Parameters.
#define AR_PHY_RX_CHAINMASK
#define AR_PHY_RADAR_1_MAXLEN
#define AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW
#define AR_PHY_TIMING11_SPUR_DELTA_PHASE
struct ath_hw_ops - callbacks used by hardware code and driver code
#define AR_PHY_CHAN_SPUR_MASK
#define AR_PHY_9485_ANT_FAST_DIV_BIAS_S
#define AR_PHY_CAL_CHAINMASK
#define AR_PHY_TIMING4_ENABLE_PILOT_MASK
struct ar9300_modal_eep_header modalHeader2G
static void ar9003_hw_rfbus_done(struct ath_hw *ah)
struct ar9300_modal_eep_header modalHeader5G
#define AR_PHY_SWAP_ALT_CHAIN
#define AR_PHY_CCK_DETECT
#define AR_AGG_WEP_ENABLE
#define ATH9K_SIG_SPUR_IMM_SETTING_MAX
static int ar9003_hw_process_ini(struct ath_hw *ah, struct ath9k_channel *chan)
static void ar9003_hw_set_diversity(struct ath_hw *ah, int value)
static const int m1Thresh_off
unsigned int radar_inband
#define AR_PHY_SFCORR_M2COUNT_THR
#define AR_PHY_GC_DYN2040_PRI_CH
static int ar9003_hw_rfbus_req(struct ath_hw *ah)
#define AR_PHY_TIMING4_ENABLE_SPUR_FILTER
#define ATH9K_ANI_SPUR_IMMUNE_LVL_NEW
#define AR_PHY_CCK_SPUR_MIT
static const int cycpwrThr1_table[]
static int ar9003_hw_ani_control(struct ath_hw *ah, enum ath9k_ani_cmd cmd, int param)
void(* set_rfmode)(struct ath_hw *ah, struct ath9k_channel *chan)
#define REG_READ(_ah, _reg)
#define AR_PHY_RADAR_0_ENA
#define AR_PHY_FIND_SIG_FIRSTEP
#define AR_PHY_TIMING3_DSC_MAN
#define AR_CST_TIMEOUT_LIMIT_S
#define AR_PHY_SGI_DSC_EXP
#define AR_PHY_RADAR_0_FIRPWR
void(* set_diversity)(struct ath_hw *ah, int value)
#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A
#define REG_SET_BIT(_a, _r, _f)
static struct ath_hw_ops * ath9k_hw_ops(struct ath_hw *ah)
int(* rfbus_req)(struct ath_hw *ah)
#define REG_WRITE_ARRAY(iniarray, column, regWr)
#define AR_PHY_SFCORR_M2_THRESH
#define AR_PHY_MODE_DYN_CCK_DISABLE
static const int m2Thresh_off
#define AR_PHY_CCA_MIN_GOOD_VAL_9300_5GHZ
#define AR_PHY_SFCORR_EXT
#define AR_PHY_EXT_CYCPWR_THR1
struct ar5416AniState ani
#define AR_PHY_RADAR_1_BLOCK_CHECK
int ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout)
void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx)
#define REG_WRITE(_ah, _reg, _val)
void ath9k_hw_set11nmac2040(struct ath_hw *ah)
#define CHANNEL_A_HT40PLUS
static const int m2CountThr_off
#define AR_RTC_9300_PLL_DIV
#define AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI
#define AR_PHY_AGC_CONTROL_YCOK_MAX
static void ar9003_hw_spur_mitigate_ofdm(struct ath_hw *ah, struct ath9k_channel *chan)
static void ar9003_hw_spur_ofdm_clear(struct ath_hw *ah)
u8 rx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets from the AP.
#define REG_READ_FIELD(_a, _r, _f)
int(* ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd, int param)
#define ATH9K_SIG_FIRSTEP_SETTING_MIN
#define AR_PHY_SFCORR_EXT_M1_THRESH
#define ATH9K_ANI_USE_OFDM_WEAK_SIG
void(* antdiv_comb_conf_get)(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
int(* rf_set_freq)(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_CCK_SPUR_MIT_CCK_SPUR_FREQ
void(* set_channel_regs)(struct ath_hw *ah, struct ath9k_channel *chan)
void ath9k_hw_get_channel_centers(struct ath_hw *ah __unused, struct ath9k_channel *chan, struct chan_centers *centers)
unsigned int pulse_inband
static const int m2ThreshExt_off
u32(* compute_pll_control)(struct ath_hw *ah, struct ath9k_channel *chan)
void(* set_radar_params)(struct ath_hw *ah, struct ath_hw_radar_conf *conf)
#define AR_PHY_MC_GAIN_CTRL
static const int m1ThreshLow_off
static struct ath_hw_private_ops * ath9k_hw_private_ops(struct ath_hw *ah)
void(* do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS])
static void ar9003_hw_antdiv_comb_conf_set(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
#define ATH9K_ANI_ENABLE_MRC_CCK
#define DBG(...)
Print a debugging message.
#define AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT
struct ath9k_ani_default iniDef
#define CHANNEL_G_HT40PLUS
static void ar9003_hw_set_radar_params(struct ath_hw *ah, struct ath_hw_radar_conf *conf)
#define IS_CHAN_A_FAST_CLOCK(_ah, _c)
#define AR_PHY_9485_ANT_DIV_ALT_LNACONF
#define AR_PHY_RADAR_EXT_ENA
#define AR_PHY_RFBUS_GRANT
#define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_AGC
#define NULL
NULL pointer (VOID *)
#define AR_PHY_MRC_CCK_ENABLE
#define AR_PHY_9485_ANT_DIV_ALT_LNACONF_S
#define CHANNEL_G_HT40MINUS
static const int m1ThreshExt_off
#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A
#define AR_AGG_WEP_ENABLE_FIX
u8 tx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets to the AP.
#define AR_PHY_MODE_DYNAMIC
#define AR_PHY_RADAR_1_RELPWR_THRESH
#define AR_PHY_SPUR_MASK_A
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:
#define AR_PHY_9485_ANT_DIV_MAIN_GAINTB
#define AR_ADHOC_MCAST_KEYID_ENABLE
#define AR_PHY_GC_GF_DETECT_EN
#define AR_PHY_SYNTH_CONTROL