29 { -4, -2, 0, 2, 4, 6, 8, 10, 12 };
33 { -6, -4, -2, 0, 2, 4, 6, 8 };
76 u16 bMode, fracMode = 0, aModeRefSel = 0;
77 u32 freq, channelSel = 0, reg32 = 0;
93 channelSel = (freq * 4) / 120;
94 chan_frac = (((freq * 4) % 120) * 0x20000) / 120;
95 channelSel = (channelSel << 17) | chan_frac;
97 if (
ah->is_clk_25mhz) {
100 channelSel = (freq * 2) / 75;
101 chan_frac = (((freq * 2) % 75) * 0x20000) / 75;
102 channelSel = (channelSel << 17) | chan_frac;
113 channelSel = (freq * 2) / 75;
114 chan_frac = ((freq % 75) * 0x20000) / 75;
115 channelSel = (channelSel << 17) | chan_frac;
128 loadSynthChannel = 0;
130 reg32 = (bMode << 29);
138 reg32 = (channelSel << 2) | (fracMode << 30) |
139 (aModeRefSel << 28) | (loadSynthChannel << 31);
143 loadSynthChannel = 1;
144 reg32 = (channelSel << 2) | (fracMode << 30) |
145 (aModeRefSel << 28) | (loadSynthChannel << 31);
149 ah->curchan_rad_index = -1;
167 static const u32 spur_freq[4] = { 2420, 2440, 2464, 2480 };
168 int cur_bb_spur, negative = 0, cck_spur_freq;
170 int range, max_spur_cnts, synth_freq;
181 if (spur_fbin_ptr[0] == 0)
188 synth_freq = chan->
channel + 10;
190 synth_freq = chan->
channel - 10;
201 for (i = 0; i < max_spur_cnts; i++) {
204 cur_bb_spur =
FBIN2FREQ(spur_fbin_ptr[i],
207 cur_bb_spur = spur_freq[i] - synth_freq;
209 if (cur_bb_spur < 0) {
211 cur_bb_spur = -cur_bb_spur;
213 if (cur_bb_spur <
range) {
214 cck_spur_freq = (int)((cur_bb_spur << 19) / 11);
217 cck_spur_freq = -cck_spur_freq;
219 cck_spur_freq = cck_spur_freq & 0xfffff;
294 int spur_delta_phase,
295 int spur_subchannel_sd)
324 mask_index = (freq_offset << 4) / 5;
326 mask_index = mask_index - 1;
328 mask_index = mask_index & 0x7f;
356 int spur_freq_sd = 0;
357 int spur_subchannel_sd = 0;
358 int spur_delta_phase = 0;
361 if (freq_offset < 0) {
364 spur_subchannel_sd = 1;
366 spur_subchannel_sd = 0;
368 spur_freq_sd = ((freq_offset + 10) << 9) / 11;
373 spur_subchannel_sd = 0;
375 spur_subchannel_sd = 1;
377 spur_freq_sd = ((freq_offset - 10) << 9) / 11;
381 spur_delta_phase = (freq_offset << 17) / 5;
384 spur_subchannel_sd = 0;
385 spur_freq_sd = (freq_offset << 9) /11;
386 spur_delta_phase = (freq_offset << 18) / 5;
389 spur_freq_sd = spur_freq_sd & 0x3ff;
390 spur_delta_phase = spur_delta_phase & 0xfffff;
420 if (spurChansPtr[0] == 0)
427 synth_freq = chan->
channel - 10;
429 synth_freq = chan->
channel + 10;
474 u32 enableDacFifo = 0;
521 synthDelay = (4 * synthDelay) / 22;
597 unsigned int i, regWrites = 0;
608 if ((
unsigned int)column >= iniArr->
ia_columns)
611 for (i = 0; i < iniArr->
ia_rows; i++) {
625 unsigned int regWrites = 0, i;
668 modesIndex, regWrites);
678 ah->eep_ops->set_txpower(
ah, chan,
713 u32 coef_scaled, ds_coef_exp, ds_coef_man;
714 u32 clockMhzScaled = 0x64000000;
722 clockMhzScaled = clockMhzScaled >> 1;
724 clockMhzScaled = clockMhzScaled >> 2;
745 coef_scaled = (9 * coef_scaled) / 10;
772 synthDelay = (4 * synthDelay) / 22;
798 switch (
cmd &
ah->ani_function) {
812 int m1ThreshLow = on ?
814 int m2ThreshLow = on ?
820 int m2CountThr = on ?
822 int m2CountThrLow = on ?
824 int m1ThreshLowExt = on ?
826 int m2ThreshLowExt = on ?
828 int m1ThreshExt = on ?
830 int m2ThreshExt = on ?
867 "** ch %d: ofdm weak signal: %s=>%s\n",
873 ah->stats.ast_ani_ofdmon++;
875 ah->stats.ast_ani_ofdmoff++;
885 "ATH9K_ANI_FIRSTEP_LEVEL: level out of range (%d > %zd)\n",
922 "** ch %d: level %d=>%d[def:%d] firstep[level]=%d ini=%d\n",
930 "** ch %d: level %d=>%d[def:%d] firstep_low[level]=%d ini=%d\n",
938 ah->stats.ast_ani_stepup++;
940 ah->stats.ast_ani_stepdown++;
950 "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%d > %zd)\n",
986 "** ch %d: level %d=>%d[def:%d] cycpwrThr1[level]=%d ini=%d\n",
994 "** ch %d: level %d=>%d[def:%d] cycpwrThr1Ext[level]=%d ini=%d\n",
1002 ah->stats.ast_ani_spurup++;
1004 ah->stats.ast_ani_spurdown++;
1014 int is_on =
param ? 1 : 0;
1021 "** ch %d: MRC CCK: %s=>%s\n",
1024 is_on ?
"on" :
"off");
1026 ah->stats.ast_ani_ccklow++;
1028 ah->stats.ast_ani_cckhigh++;
1036 DBG2(
"ath9k: invalid cmd %d\n",
cmd);
1041 "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n",
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 1064 if (
ah->rxchainmask &
BIT(i)) {
1102 aniState = &
ah->curchan->ani;
1103 iniDef = &aniState->
iniDef;
1106 "ver %d.%d chan %d Mhz/0x%x\n",
1107 ah->hw_version.macVersion,
1108 ah->hw_version.macRev,
1150 u32 radar_0 = 0, radar_1 = 0;
1238 static const u32 ar9300_cca_regs[6] = {
1269 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...
struct pci_range range
PCI bus:dev.fn address range.
#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
uint16_t mode
Acceleration mode.
#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
#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