diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ar9003_phy.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_phy.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index a8ab81bf74c4..fc67844a1430 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -1325,6 +1325,65 @@ static void ar9003_hw_antdiv_comb_conf_set(struct ath_hw *ah, | |||
1325 | REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); | 1325 | REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | static void ar9003_hw_antctrl_shared_chain_lnadiv(struct ath_hw *ah, | ||
1329 | bool enable) | ||
1330 | { | ||
1331 | u8 ant_div_ctl1; | ||
1332 | u32 regval; | ||
1333 | |||
1334 | if (!AR_SREV_9565(ah)) | ||
1335 | return; | ||
1336 | |||
1337 | ah->shared_chain_lnadiv = enable; | ||
1338 | ant_div_ctl1 = ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1); | ||
1339 | |||
1340 | regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL); | ||
1341 | regval &= (~AR_ANT_DIV_CTRL_ALL); | ||
1342 | regval |= (ant_div_ctl1 & 0x3f) << AR_ANT_DIV_CTRL_ALL_S; | ||
1343 | regval &= ~AR_PHY_ANT_DIV_LNADIV; | ||
1344 | regval |= ((ant_div_ctl1 >> 6) & 0x1) << AR_PHY_ANT_DIV_LNADIV_S; | ||
1345 | |||
1346 | if (enable) | ||
1347 | regval |= AR_ANT_DIV_ENABLE; | ||
1348 | |||
1349 | REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); | ||
1350 | |||
1351 | regval = REG_READ(ah, AR_PHY_CCK_DETECT); | ||
1352 | regval &= ~AR_FAST_DIV_ENABLE; | ||
1353 | regval |= ((ant_div_ctl1 >> 7) & 0x1) << AR_FAST_DIV_ENABLE_S; | ||
1354 | |||
1355 | if (enable) | ||
1356 | regval |= AR_FAST_DIV_ENABLE; | ||
1357 | |||
1358 | REG_WRITE(ah, AR_PHY_CCK_DETECT, regval); | ||
1359 | |||
1360 | if (enable) { | ||
1361 | REG_SET_BIT(ah, AR_PHY_MC_GAIN_CTRL, | ||
1362 | (1 << AR_PHY_ANT_SW_RX_PROT_S)); | ||
1363 | if (IS_CHAN_2GHZ(ah->curchan)) | ||
1364 | REG_SET_BIT(ah, AR_PHY_RESTART, | ||
1365 | AR_PHY_RESTART_ENABLE_DIV_M2FLAG); | ||
1366 | REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, | ||
1367 | AR_BTCOEX_WL_LNADIV_FORCE_ON); | ||
1368 | } else { | ||
1369 | REG_CLR_BIT(ah, AR_PHY_MC_GAIN_CTRL, AR_ANT_DIV_ENABLE); | ||
1370 | REG_CLR_BIT(ah, AR_PHY_MC_GAIN_CTRL, | ||
1371 | (1 << AR_PHY_ANT_SW_RX_PROT_S)); | ||
1372 | REG_CLR_BIT(ah, AR_PHY_CCK_DETECT, AR_FAST_DIV_ENABLE); | ||
1373 | REG_CLR_BIT(ah, AR_BTCOEX_WL_LNADIV, | ||
1374 | AR_BTCOEX_WL_LNADIV_FORCE_ON); | ||
1375 | |||
1376 | regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL); | ||
1377 | regval &= ~(AR_PHY_ANT_DIV_MAIN_LNACONF | | ||
1378 | AR_PHY_ANT_DIV_ALT_LNACONF | | ||
1379 | AR_PHY_ANT_DIV_MAIN_GAINTB | | ||
1380 | AR_PHY_ANT_DIV_ALT_GAINTB); | ||
1381 | regval |= (AR_PHY_ANT_DIV_LNA1 << AR_PHY_ANT_DIV_MAIN_LNACONF_S); | ||
1382 | regval |= (AR_PHY_ANT_DIV_LNA2 << AR_PHY_ANT_DIV_ALT_LNACONF_S); | ||
1383 | REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); | ||
1384 | } | ||
1385 | } | ||
1386 | |||
1328 | static int ar9003_hw_fast_chan_change(struct ath_hw *ah, | 1387 | static int ar9003_hw_fast_chan_change(struct ath_hw *ah, |
1329 | struct ath9k_channel *chan, | 1388 | struct ath9k_channel *chan, |
1330 | u8 *ini_reloaded) | 1389 | u8 *ini_reloaded) |
@@ -1423,6 +1482,7 @@ void ar9003_hw_attach_phy_ops(struct ath_hw *ah) | |||
1423 | 1482 | ||
1424 | ops->antdiv_comb_conf_get = ar9003_hw_antdiv_comb_conf_get; | 1483 | ops->antdiv_comb_conf_get = ar9003_hw_antdiv_comb_conf_get; |
1425 | ops->antdiv_comb_conf_set = ar9003_hw_antdiv_comb_conf_set; | 1484 | ops->antdiv_comb_conf_set = ar9003_hw_antdiv_comb_conf_set; |
1485 | ops->antctrl_shared_chain_lnadiv = ar9003_hw_antctrl_shared_chain_lnadiv; | ||
1426 | 1486 | ||
1427 | ar9003_hw_set_nf_limits(ah); | 1487 | ar9003_hw_set_nf_limits(ah); |
1428 | ar9003_hw_set_radar_conf(ah); | 1488 | ar9003_hw_set_radar_conf(ah); |