ath9k_hw: Fix fixed antenna for AR9462
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Mon, 4 Mar 2013 07:12:55 +0000 (12:42 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 6 Mar 2013 21:28:57 +0000 (16:28 -0500)
When the RX chainmask is set to 0x2 for AR9462, certain values
from chain1 have to be programmed for chain0 also.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c

index 881e989ea4701b0dc98c3229e196b5b2b2a5b70f..e6b92ff265fd6e878274a2d0b35660a5bfa9a1c5 100644 (file)
@@ -3606,6 +3606,12 @@ static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
        value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz);
        REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value);
 
+       if ((AR_SREV_9462(ah)) && (ah->rxchainmask == 0x2)) {
+               value = ar9003_hw_ant_ctrl_chain_get(ah, 1, is2ghz);
+               REG_RMW_FIELD(ah, switch_chain_reg[0],
+                             AR_SWITCH_TABLE_ALL, value);
+       }
+
        for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
                if ((ah->rxchainmask & BIT(chain)) ||
                    (ah->txchainmask & BIT(chain))) {
@@ -3772,6 +3778,17 @@ static void ar9003_hw_atten_apply(struct ath_hw *ah, struct ath9k_channel *chan)
                                          AR_PHY_EXT_ATTEN_CTL_2,
                                         };
 
+       if ((AR_SREV_9462(ah)) && (ah->rxchainmask == 0x2)) {
+               value = ar9003_hw_atten_chain_get(ah, 1, chan);
+               REG_RMW_FIELD(ah, ext_atten_reg[0],
+                             AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB, value);
+
+               value = ar9003_hw_atten_chain_get_margin(ah, 1, chan);
+               REG_RMW_FIELD(ah, ext_atten_reg[0],
+                             AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN,
+                             value);
+       }
+
        /* Test value. if 0 then attenuation is unused. Don't load anything. */
        for (i = 0; i < 3; i++) {
                if (ah->txchainmask & BIT(i)) {