aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ar9003_phy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ar9003_phy.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 44c5454b2ad..656d8ce251a 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -128,7 +128,7 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
128static void ar9003_hw_spur_mitigate_mrc_cck(struct ath_hw *ah, 128static void ar9003_hw_spur_mitigate_mrc_cck(struct ath_hw *ah,
129 struct ath9k_channel *chan) 129 struct ath9k_channel *chan)
130{ 130{
131 u32 spur_freq[4] = { 2420, 2440, 2464, 2480 }; 131 static const u32 spur_freq[4] = { 2420, 2440, 2464, 2480 };
132 int cur_bb_spur, negative = 0, cck_spur_freq; 132 int cur_bb_spur, negative = 0, cck_spur_freq;
133 int i; 133 int i;
134 134
@@ -1113,10 +1113,55 @@ static void ar9003_hw_ani_cache_ini_regs(struct ath_hw *ah)
1113 aniState->mrcCCKOff = !ATH9K_ANI_ENABLE_MRC_CCK; 1113 aniState->mrcCCKOff = !ATH9K_ANI_ENABLE_MRC_CCK;
1114} 1114}
1115 1115
1116static void ar9003_hw_set_radar_params(struct ath_hw *ah,
1117 struct ath_hw_radar_conf *conf)
1118{
1119 u32 radar_0 = 0, radar_1 = 0;
1120
1121 if (!conf) {
1122 REG_CLR_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_ENA);
1123 return;
1124 }
1125
1126 radar_0 |= AR_PHY_RADAR_0_ENA | AR_PHY_RADAR_0_FFT_ENA;
1127 radar_0 |= SM(conf->fir_power, AR_PHY_RADAR_0_FIRPWR);
1128 radar_0 |= SM(conf->radar_rssi, AR_PHY_RADAR_0_RRSSI);
1129 radar_0 |= SM(conf->pulse_height, AR_PHY_RADAR_0_HEIGHT);
1130 radar_0 |= SM(conf->pulse_rssi, AR_PHY_RADAR_0_PRSSI);
1131 radar_0 |= SM(conf->pulse_inband, AR_PHY_RADAR_0_INBAND);
1132
1133 radar_1 |= AR_PHY_RADAR_1_MAX_RRSSI;
1134 radar_1 |= AR_PHY_RADAR_1_BLOCK_CHECK;
1135 radar_1 |= SM(conf->pulse_maxlen, AR_PHY_RADAR_1_MAXLEN);
1136 radar_1 |= SM(conf->pulse_inband_step, AR_PHY_RADAR_1_RELSTEP_THRESH);
1137 radar_1 |= SM(conf->radar_inband, AR_PHY_RADAR_1_RELPWR_THRESH);
1138
1139 REG_WRITE(ah, AR_PHY_RADAR_0, radar_0);
1140 REG_WRITE(ah, AR_PHY_RADAR_1, radar_1);
1141 if (conf->ext_channel)
1142 REG_SET_BIT(ah, AR_PHY_RADAR_EXT, AR_PHY_RADAR_EXT_ENA);
1143 else
1144 REG_CLR_BIT(ah, AR_PHY_RADAR_EXT, AR_PHY_RADAR_EXT_ENA);
1145}
1146
1147static void ar9003_hw_set_radar_conf(struct ath_hw *ah)
1148{
1149 struct ath_hw_radar_conf *conf = &ah->radar_conf;
1150
1151 conf->fir_power = -28;
1152 conf->radar_rssi = 0;
1153 conf->pulse_height = 10;
1154 conf->pulse_rssi = 24;
1155 conf->pulse_inband = 8;
1156 conf->pulse_maxlen = 255;
1157 conf->pulse_inband_step = 12;
1158 conf->radar_inband = 8;
1159}
1160
1116void ar9003_hw_attach_phy_ops(struct ath_hw *ah) 1161void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
1117{ 1162{
1118 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); 1163 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
1119 const u32 ar9300_cca_regs[6] = { 1164 static const u32 ar9300_cca_regs[6] = {
1120 AR_PHY_CCA_0, 1165 AR_PHY_CCA_0,
1121 AR_PHY_CCA_1, 1166 AR_PHY_CCA_1,
1122 AR_PHY_CCA_2, 1167 AR_PHY_CCA_2,
@@ -1141,8 +1186,10 @@ void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
1141 priv_ops->ani_control = ar9003_hw_ani_control; 1186 priv_ops->ani_control = ar9003_hw_ani_control;
1142 priv_ops->do_getnf = ar9003_hw_do_getnf; 1187 priv_ops->do_getnf = ar9003_hw_do_getnf;
1143 priv_ops->ani_cache_ini_regs = ar9003_hw_ani_cache_ini_regs; 1188 priv_ops->ani_cache_ini_regs = ar9003_hw_ani_cache_ini_regs;
1189 priv_ops->set_radar_params = ar9003_hw_set_radar_params;
1144 1190
1145 ar9003_hw_set_nf_limits(ah); 1191 ar9003_hw_set_nf_limits(ah);
1192 ar9003_hw_set_radar_conf(ah);
1146 memcpy(ah->nf_regs, ar9300_cca_regs, sizeof(ah->nf_regs)); 1193 memcpy(ah->nf_regs, ar9300_cca_regs, sizeof(ah->nf_regs));
1147} 1194}
1148 1195