ath9k: Fix AR9285 specific noise floor eeprom reads.
authorSenthil Balasubramanian <senthilkumar@atheros.com>
Mon, 26 Jan 2009 14:58:14 +0000 (20:28 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 29 Jan 2009 21:01:49 +0000 (16:01 -0500)
Fix AR9285 specific noise floor reads and initialize tx and rx
chainmask during reset. This along with the following earlier
patches of ath9k fixes an issue with association noticed in
noisy environment.

ath9k: Fix typo in chip version check
ath9k: Remove unnecessary gpio configuration in ath9k_hw_reset()
ath9k: Fix bug in NF calibration

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath9k/calib.c
drivers/net/wireless/ath9k/hw.c

index c6d1de0f1e2179db75eaa9ac25ec5cae105b7136..69ff01ce968b4a9b330fdfc697bf69b0dbb1dfca 100644 (file)
@@ -105,27 +105,29 @@ static void ath9k_hw_do_getnf(struct ath_hal *ah,
                "NF calibrated [ctl] [chain 0] is %d\n", nf);
        nfarray[0] = nf;
 
                "NF calibrated [ctl] [chain 0] is %d\n", nf);
        nfarray[0] = nf;
 
-       if (AR_SREV_9280_10_OR_LATER(ah))
-               nf = MS(REG_READ(ah, AR_PHY_CH1_CCA),
-                       AR9280_PHY_CH1_MINCCA_PWR);
-       else
-               nf = MS(REG_READ(ah, AR_PHY_CH1_CCA),
-                       AR_PHY_CH1_MINCCA_PWR);
-
-       if (nf & 0x100)
-               nf = 0 - ((nf ^ 0x1ff) + 1);
-       DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-               "NF calibrated [ctl] [chain 1] is %d\n", nf);
-       nfarray[1] = nf;
+       if (!AR_SREV_9285(ah)) {
+               if (AR_SREV_9280_10_OR_LATER(ah))
+                       nf = MS(REG_READ(ah, AR_PHY_CH1_CCA),
+                                       AR9280_PHY_CH1_MINCCA_PWR);
+               else
+                       nf = MS(REG_READ(ah, AR_PHY_CH1_CCA),
+                                       AR_PHY_CH1_MINCCA_PWR);
 
 
-       if (!AR_SREV_9280(ah)) {
-               nf = MS(REG_READ(ah, AR_PHY_CH2_CCA),
-                       AR_PHY_CH2_MINCCA_PWR);
                if (nf & 0x100)
                        nf = 0 - ((nf ^ 0x1ff) + 1);
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                if (nf & 0x100)
                        nf = 0 - ((nf ^ 0x1ff) + 1);
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-                       "NF calibrated [ctl] [chain 2] is %d\n", nf);
-               nfarray[2] = nf;
+                               "NF calibrated [ctl] [chain 1] is %d\n", nf);
+               nfarray[1] = nf;
+
+               if (!AR_SREV_9280(ah)) {
+                       nf = MS(REG_READ(ah, AR_PHY_CH2_CCA),
+                                       AR_PHY_CH2_MINCCA_PWR);
+                       if (nf & 0x100)
+                               nf = 0 - ((nf ^ 0x1ff) + 1);
+                       DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
+                               "NF calibrated [ctl] [chain 2] is %d\n", nf);
+                       nfarray[2] = nf;
+               }
        }
 
        if (AR_SREV_9280_10_OR_LATER(ah))
        }
 
        if (AR_SREV_9280_10_OR_LATER(ah))
@@ -141,27 +143,29 @@ static void ath9k_hw_do_getnf(struct ath_hal *ah,
                "NF calibrated [ext] [chain 0] is %d\n", nf);
        nfarray[3] = nf;
 
                "NF calibrated [ext] [chain 0] is %d\n", nf);
        nfarray[3] = nf;
 
-       if (AR_SREV_9280_10_OR_LATER(ah))
-               nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA),
-                       AR9280_PHY_CH1_EXT_MINCCA_PWR);
-       else
-               nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA),
-                       AR_PHY_CH1_EXT_MINCCA_PWR);
+       if (!AR_SREV_9285(ah)) {
+               if (AR_SREV_9280_10_OR_LATER(ah))
+                       nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA),
+                                       AR9280_PHY_CH1_EXT_MINCCA_PWR);
+               else
+                       nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA),
+                                       AR_PHY_CH1_EXT_MINCCA_PWR);
 
 
-       if (nf & 0x100)
-               nf = 0 - ((nf ^ 0x1ff) + 1);
-       DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-               "NF calibrated [ext] [chain 1] is %d\n", nf);
-       nfarray[4] = nf;
-
-       if (!AR_SREV_9280(ah)) {
-               nf = MS(REG_READ(ah, AR_PHY_CH2_EXT_CCA),
-                       AR_PHY_CH2_EXT_MINCCA_PWR);
                if (nf & 0x100)
                        nf = 0 - ((nf ^ 0x1ff) + 1);
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                if (nf & 0x100)
                        nf = 0 - ((nf ^ 0x1ff) + 1);
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-                       "NF calibrated [ext] [chain 2] is %d\n", nf);
-               nfarray[5] = nf;
+                               "NF calibrated [ext] [chain 1] is %d\n", nf);
+               nfarray[4] = nf;
+
+               if (!AR_SREV_9280(ah)) {
+                       nf = MS(REG_READ(ah, AR_PHY_CH2_EXT_CCA),
+                                       AR_PHY_CH2_EXT_MINCCA_PWR);
+                       if (nf & 0x100)
+                               nf = 0 - ((nf ^ 0x1ff) + 1);
+                       DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
+                               "NF calibrated [ext] [chain 2] is %d\n", nf);
+                       nfarray[5] = nf;
+               }
        }
 }
 
        }
 }
 
@@ -668,12 +672,6 @@ int16_t ath9k_hw_getnf(struct ath_hal *ah,
        int16_t nfarray[NUM_NF_READINGS] = { 0 };
        struct ath9k_nfcal_hist *h;
        struct ieee80211_channel *c = chan->chan;
        int16_t nfarray[NUM_NF_READINGS] = { 0 };
        struct ath9k_nfcal_hist *h;
        struct ieee80211_channel *c = chan->chan;
-       u8 chainmask;
-
-       if (AR_SREV_9280(ah))
-               chainmask = 0x1B;
-       else
-               chainmask = 0x3F;
 
        chan->channelFlags &= (~CHANNEL_CW_INT);
        if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) {
 
        chan->channelFlags &= (~CHANNEL_CW_INT);
        if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) {
index bb8628c7efa1cbfa3850945132fa830d0e137ca6..77282345efc1748c00ed25acf90fec95d9a94532 100644 (file)
@@ -2165,7 +2165,10 @@ int ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
        ahp->ah_txchainmask = sc->sc_tx_chainmask;
        ahp->ah_rxchainmask = sc->sc_rx_chainmask;
 
        ahp->ah_txchainmask = sc->sc_tx_chainmask;
        ahp->ah_rxchainmask = sc->sc_rx_chainmask;
 
-       if (AR_SREV_9280(ah)) {
+       if (AR_SREV_9285(ah)) {
+               ahp->ah_txchainmask &= 0x1;
+               ahp->ah_rxchainmask &= 0x1;
+       } else if (AR_SREV_9280(ah)) {
                ahp->ah_txchainmask &= 0x3;
                ahp->ah_rxchainmask &= 0x3;
        }
                ahp->ah_txchainmask &= 0x3;
                ahp->ah_rxchainmask &= 0x3;
        }