aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index c83be2dd5718..d2a5d2737cd3 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -1184,9 +1184,50 @@ static void ar9003_hw_set_radar_conf(struct ath_hw *ah)
1184 conf->radar_inband = 8; 1184 conf->radar_inband = 8;
1185} 1185}
1186 1186
1187static void ar9003_hw_antdiv_comb_conf_get(struct ath_hw *ah,
1188 struct ath_hw_antcomb_conf *antconf)
1189{
1190 u32 regval;
1191
1192 regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
1193 antconf->main_lna_conf = (regval & AR_PHY_9485_ANT_DIV_MAIN_LNACONF) >>
1194 AR_PHY_9485_ANT_DIV_MAIN_LNACONF_S;
1195 antconf->alt_lna_conf = (regval & AR_PHY_9485_ANT_DIV_ALT_LNACONF) >>
1196 AR_PHY_9485_ANT_DIV_ALT_LNACONF_S;
1197 antconf->fast_div_bias = (regval & AR_PHY_9485_ANT_FAST_DIV_BIAS) >>
1198 AR_PHY_9485_ANT_FAST_DIV_BIAS_S;
1199}
1200
1201static void ar9003_hw_antdiv_comb_conf_set(struct ath_hw *ah,
1202 struct ath_hw_antcomb_conf *antconf)
1203{
1204 u32 regval;
1205
1206 regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
1207 regval &= ~(AR_PHY_9485_ANT_DIV_MAIN_LNACONF |
1208 AR_PHY_9485_ANT_DIV_ALT_LNACONF |
1209 AR_PHY_9485_ANT_FAST_DIV_BIAS |
1210 AR_PHY_9485_ANT_DIV_MAIN_GAINTB |
1211 AR_PHY_9485_ANT_DIV_ALT_GAINTB);
1212 regval |= ((antconf->main_lna_conf <<
1213 AR_PHY_9485_ANT_DIV_MAIN_LNACONF_S)
1214 & AR_PHY_9485_ANT_DIV_MAIN_LNACONF);
1215 regval |= ((antconf->alt_lna_conf << AR_PHY_9485_ANT_DIV_ALT_LNACONF_S)
1216 & AR_PHY_9485_ANT_DIV_ALT_LNACONF);
1217 regval |= ((antconf->fast_div_bias << AR_PHY_9485_ANT_FAST_DIV_BIAS_S)
1218 & AR_PHY_9485_ANT_FAST_DIV_BIAS);
1219 regval |= ((antconf->main_gaintb << AR_PHY_9485_ANT_DIV_MAIN_GAINTB_S)
1220 & AR_PHY_9485_ANT_DIV_MAIN_GAINTB);
1221 regval |= ((antconf->alt_gaintb << AR_PHY_9485_ANT_DIV_ALT_GAINTB_S)
1222 & AR_PHY_9485_ANT_DIV_ALT_GAINTB);
1223
1224 REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval);
1225}
1226
1187void ar9003_hw_attach_phy_ops(struct ath_hw *ah) 1227void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
1188{ 1228{
1189 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); 1229 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
1230 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
1190 static const u32 ar9300_cca_regs[6] = { 1231 static const u32 ar9300_cca_regs[6] = {
1191 AR_PHY_CCA_0, 1232 AR_PHY_CCA_0,
1192 AR_PHY_CCA_1, 1233 AR_PHY_CCA_1,
@@ -1213,6 +1254,9 @@ void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
1213 priv_ops->ani_cache_ini_regs = ar9003_hw_ani_cache_ini_regs; 1254 priv_ops->ani_cache_ini_regs = ar9003_hw_ani_cache_ini_regs;
1214 priv_ops->set_radar_params = ar9003_hw_set_radar_params; 1255 priv_ops->set_radar_params = ar9003_hw_set_radar_params;
1215 1256
1257 ops->antdiv_comb_conf_get = ar9003_hw_antdiv_comb_conf_get;
1258 ops->antdiv_comb_conf_set = ar9003_hw_antdiv_comb_conf_set;
1259
1216 ar9003_hw_set_nf_limits(ah); 1260 ar9003_hw_set_nf_limits(ah);
1217 ar9003_hw_set_radar_conf(ah); 1261 ar9003_hw_set_radar_conf(ah);
1218 memcpy(ah->nf_regs, ar9300_cca_regs, sizeof(ah->nf_regs)); 1262 memcpy(ah->nf_regs, ar9300_cca_regs, sizeof(ah->nf_regs));