diff options
author | Sujith Manoharan <c_manoha@qualcomm.com> | 2012-09-15 22:36:36 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-09-24 14:59:11 -0400 |
commit | 362cd03fd828af38327fb448416c07a7c7a8e3cb (patch) | |
tree | 4df21d826863210993df76fa0871597bb6f34e2a | |
parent | 68f7586c7b2c471750f11ccb3e5ac8f57b1b953e (diff) |
ath9k_hw: Add a HW callback to set diversity
This patch adds a new callback to handle WLAN RX diversity for
AR9565.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_phy.c | 60 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_phy.h | 24 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw-ops.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 3 |
6 files changed, 107 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 8d434df26818..e65aad07d9ee 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -3629,6 +3629,16 @@ static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz) | |||
3629 | /* enable_lnadiv */ | 3629 | /* enable_lnadiv */ |
3630 | regval &= (~AR_PHY_ANT_DIV_LNADIV); | 3630 | regval &= (~AR_PHY_ANT_DIV_LNADIV); |
3631 | regval |= ((value >> 6) & 0x1) << AR_PHY_ANT_DIV_LNADIV_S; | 3631 | regval |= ((value >> 6) & 0x1) << AR_PHY_ANT_DIV_LNADIV_S; |
3632 | |||
3633 | if (AR_SREV_9565(ah)) { | ||
3634 | if (ah->shared_chain_lnadiv) { | ||
3635 | regval |= (1 << AR_PHY_ANT_SW_RX_PROT_S); | ||
3636 | } else { | ||
3637 | regval &= ~(1 << AR_PHY_ANT_DIV_LNADIV_S); | ||
3638 | regval &= ~(1 << AR_PHY_ANT_SW_RX_PROT_S); | ||
3639 | } | ||
3640 | } | ||
3641 | |||
3632 | REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); | 3642 | REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); |
3633 | 3643 | ||
3634 | /*enable fast_div */ | 3644 | /*enable fast_div */ |
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); |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h index fdabc9a28a96..9a48e3d2f231 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h | |||
@@ -282,6 +282,8 @@ | |||
282 | 282 | ||
283 | #define AR_PHY_ANT_FAST_DIV_BIAS 0x00007e00 | 283 | #define AR_PHY_ANT_FAST_DIV_BIAS 0x00007e00 |
284 | #define AR_PHY_ANT_FAST_DIV_BIAS_S 9 | 284 | #define AR_PHY_ANT_FAST_DIV_BIAS_S 9 |
285 | #define AR_PHY_ANT_SW_RX_PROT 0x00800000 | ||
286 | #define AR_PHY_ANT_SW_RX_PROT_S 23 | ||
285 | #define AR_PHY_ANT_DIV_LNADIV 0x01000000 | 287 | #define AR_PHY_ANT_DIV_LNADIV 0x01000000 |
286 | #define AR_PHY_ANT_DIV_LNADIV_S 24 | 288 | #define AR_PHY_ANT_DIV_LNADIV_S 24 |
287 | #define AR_PHY_ANT_DIV_ALT_LNACONF 0x06000000 | 289 | #define AR_PHY_ANT_DIV_ALT_LNACONF 0x06000000 |
@@ -422,6 +424,8 @@ | |||
422 | #define AR_PHY_FIND_SIG_RELSTEP 0x1f | 424 | #define AR_PHY_FIND_SIG_RELSTEP 0x1f |
423 | #define AR_PHY_FIND_SIG_RELSTEP_S 0 | 425 | #define AR_PHY_FIND_SIG_RELSTEP_S 0 |
424 | #define AR_PHY_FIND_SIG_RELSTEP_SIGN_BIT 5 | 426 | #define AR_PHY_FIND_SIG_RELSTEP_SIGN_BIT 5 |
427 | #define AR_PHY_RESTART_ENABLE_DIV_M2FLAG 0x00200000 | ||
428 | #define AR_PHY_RESTART_ENABLE_DIV_M2FLAG_S 21 | ||
425 | #define AR_PHY_RESTART_DIV_GC 0x001C0000 | 429 | #define AR_PHY_RESTART_DIV_GC 0x001C0000 |
426 | #define AR_PHY_RESTART_DIV_GC_S 18 | 430 | #define AR_PHY_RESTART_DIV_GC_S 18 |
427 | #define AR_PHY_RESTART_ENA 0x01 | 431 | #define AR_PHY_RESTART_ENA 0x01 |
@@ -1261,4 +1265,24 @@ | |||
1261 | #define AR_PHY_CL_TAB_CL_GAIN_MOD 0x1f | 1265 | #define AR_PHY_CL_TAB_CL_GAIN_MOD 0x1f |
1262 | #define AR_PHY_CL_TAB_CL_GAIN_MOD_S 0 | 1266 | #define AR_PHY_CL_TAB_CL_GAIN_MOD_S 0 |
1263 | 1267 | ||
1268 | #define AR_BTCOEX_WL_LNADIV 0x1a64 | ||
1269 | #define AR_BTCOEX_WL_LNADIV_PREDICTED_PERIOD 0x00003FFF | ||
1270 | #define AR_BTCOEX_WL_LNADIV_PREDICTED_PERIOD_S 0 | ||
1271 | #define AR_BTCOEX_WL_LNADIV_DPDT_IGNORE_PRIORITY 0x00004000 | ||
1272 | #define AR_BTCOEX_WL_LNADIV_DPDT_IGNORE_PRIORITY_S 14 | ||
1273 | #define AR_BTCOEX_WL_LNADIV_FORCE_ON 0x00008000 | ||
1274 | #define AR_BTCOEX_WL_LNADIV_FORCE_ON_S 15 | ||
1275 | #define AR_BTCOEX_WL_LNADIV_MODE_OPTION 0x00030000 | ||
1276 | #define AR_BTCOEX_WL_LNADIV_MODE_OPTION_S 16 | ||
1277 | #define AR_BTCOEX_WL_LNADIV_MODE 0x007c0000 | ||
1278 | #define AR_BTCOEX_WL_LNADIV_MODE_S 18 | ||
1279 | #define AR_BTCOEX_WL_LNADIV_ALLOWED_TX_ANTDIV_WL_TX_REQ 0x00800000 | ||
1280 | #define AR_BTCOEX_WL_LNADIV_ALLOWED_TX_ANTDIV_WL_TX_REQ_S 23 | ||
1281 | #define AR_BTCOEX_WL_LNADIV_DISABLE_TX_ANTDIV_ENABLE 0x01000000 | ||
1282 | #define AR_BTCOEX_WL_LNADIV_DISABLE_TX_ANTDIV_ENABLE_S 24 | ||
1283 | #define AR_BTCOEX_WL_LNADIV_CONTINUOUS_BT_ACTIVE_PROTECT 0x02000000 | ||
1284 | #define AR_BTCOEX_WL_LNADIV_CONTINUOUS_BT_ACTIVE_PROTECT_S 25 | ||
1285 | #define AR_BTCOEX_WL_LNADIV_BT_INACTIVE_THRESHOLD 0xFC000000 | ||
1286 | #define AR_BTCOEX_WL_LNADIV_BT_INACTIVE_THRESHOLD_S 26 | ||
1287 | |||
1264 | #endif /* AR9003_PHY_H */ | 1288 | #endif /* AR9003_PHY_H */ |
diff --git a/drivers/net/wireless/ath/ath9k/hw-ops.h b/drivers/net/wireless/ath/ath9k/hw-ops.h index 265bf77598a2..0f2b97f6b739 100644 --- a/drivers/net/wireless/ath/ath9k/hw-ops.h +++ b/drivers/net/wireless/ath/ath9k/hw-ops.h | |||
@@ -78,6 +78,13 @@ static inline void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah, | |||
78 | ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf); | 78 | ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf); |
79 | } | 79 | } |
80 | 80 | ||
81 | static inline void ath9k_hw_antctrl_shared_chain_lnadiv(struct ath_hw *ah, | ||
82 | bool enable) | ||
83 | { | ||
84 | if (ath9k_hw_ops(ah)->antctrl_shared_chain_lnadiv) | ||
85 | ath9k_hw_ops(ah)->antctrl_shared_chain_lnadiv(ah, enable); | ||
86 | } | ||
87 | |||
81 | /* Private hardware call ops */ | 88 | /* Private hardware call ops */ |
82 | 89 | ||
83 | /* PHY ops */ | 90 | /* PHY ops */ |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index c40e901c2bf8..1ac2e5c0fcfb 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "rc.h" | 24 | #include "rc.h" |
25 | #include "ar9003_mac.h" | 25 | #include "ar9003_mac.h" |
26 | #include "ar9003_mci.h" | 26 | #include "ar9003_mci.h" |
27 | #include "ar9003_phy.h" | ||
27 | #include "debug.h" | 28 | #include "debug.h" |
28 | #include "ath9k.h" | 29 | #include "ath9k.h" |
29 | 30 | ||
@@ -2025,6 +2026,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
2025 | 2026 | ||
2026 | ath9k_hw_apply_gpio_override(ah); | 2027 | ath9k_hw_apply_gpio_override(ah); |
2027 | 2028 | ||
2029 | if (AR_SREV_9565(ah) && ah->shared_chain_lnadiv) | ||
2030 | REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON); | ||
2031 | |||
2028 | return 0; | 2032 | return 0; |
2029 | } | 2033 | } |
2030 | EXPORT_SYMBOL(ath9k_hw_reset); | 2034 | EXPORT_SYMBOL(ath9k_hw_reset); |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 0d17ce0b0ff4..17203b527507 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -687,7 +687,7 @@ struct ath_hw_ops { | |||
687 | struct ath_hw_antcomb_conf *antconf); | 687 | struct ath_hw_antcomb_conf *antconf); |
688 | void (*antdiv_comb_conf_set)(struct ath_hw *ah, | 688 | void (*antdiv_comb_conf_set)(struct ath_hw *ah, |
689 | struct ath_hw_antcomb_conf *antconf); | 689 | struct ath_hw_antcomb_conf *antconf); |
690 | 690 | void (*antctrl_shared_chain_lnadiv)(struct ath_hw *hw, bool enable); | |
691 | }; | 691 | }; |
692 | 692 | ||
693 | struct ath_nf_limits { | 693 | struct ath_nf_limits { |
@@ -731,6 +731,7 @@ struct ath_hw { | |||
731 | bool aspm_enabled; | 731 | bool aspm_enabled; |
732 | bool is_monitoring; | 732 | bool is_monitoring; |
733 | bool need_an_top2_fixup; | 733 | bool need_an_top2_fixup; |
734 | bool shared_chain_lnadiv; | ||
734 | u16 tx_trig_level; | 735 | u16 tx_trig_level; |
735 | 736 | ||
736 | u32 nf_regs[6]; | 737 | u32 nf_regs[6]; |