aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-07-30 15:02:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-04 15:27:36 -0400
commit00c86590e36bd42574821b43b5124d75f30df9dd (patch)
treeddf43562d2f1a26237c32764c46630a07c7d9dd5 /drivers/net
parent1601b1e56e1093d6deb8f475fafc30cc30143357 (diff)
ath9k_hw: clean up and fix initial noise floor calibration
On AR9003 the initial noise floor calibration is currently triggered at the end of the reset without allowing the hardware to update the baseband settings. This could potentially make scans in noisy environments a bit more unreliable, so use the same calibration sequence that is used on AR9002. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Acked-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_calib.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_calib.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c7
5 files changed, 16 insertions, 12 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
index dabafb874c36..2387ad1a23a0 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
@@ -721,7 +721,7 @@ static bool ar9002_hw_calibrate(struct ath_hw *ah,
721 */ 721 */
722 ath9k_hw_loadnf(ah, ah->curchan); 722 ath9k_hw_loadnf(ah, ah->curchan);
723 723
724 ath9k_hw_start_nfcal(ah); 724 ath9k_hw_start_nfcal(ah, false);
725 } 725 }
726 726
727 return iscaldone; 727 return iscaldone;
@@ -869,8 +869,7 @@ static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
869 ar9002_hw_pa_cal(ah, true); 869 ar9002_hw_pa_cal(ah, true);
870 870
871 /* Do NF Calibration after DC offset and other calibrations */ 871 /* Do NF Calibration after DC offset and other calibrations */
872 REG_WRITE(ah, AR_PHY_AGC_CONTROL, 872 ath9k_hw_start_nfcal(ah, true);
873 REG_READ(ah, AR_PHY_AGC_CONTROL) | AR_PHY_AGC_CONTROL_NF);
874 873
875 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; 874 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
876 875
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 5a0650399136..938365eebae6 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -156,7 +156,7 @@ static bool ar9003_hw_calibrate(struct ath_hw *ah,
156 ath9k_hw_loadnf(ah, ah->curchan); 156 ath9k_hw_loadnf(ah, ah->curchan);
157 157
158 /* start NF calibration, without updating BB NF register */ 158 /* start NF calibration, without updating BB NF register */
159 ath9k_hw_start_nfcal(ah); 159 ath9k_hw_start_nfcal(ah, false);
160 } 160 }
161 161
162 return iscaldone; 162 return iscaldone;
@@ -762,6 +762,8 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
762 /* Revert chainmasks to their original values before NF cal */ 762 /* Revert chainmasks to their original values before NF cal */
763 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); 763 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
764 764
765 ath9k_hw_start_nfcal(ah, true);
766
765 /* Initialize list pointers */ 767 /* Initialize list pointers */
766 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; 768 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
767 769
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index 139289e4e933..294016f9ce7d 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -158,12 +158,18 @@ bool ath9k_hw_reset_calvalid(struct ath_hw *ah)
158} 158}
159EXPORT_SYMBOL(ath9k_hw_reset_calvalid); 159EXPORT_SYMBOL(ath9k_hw_reset_calvalid);
160 160
161void ath9k_hw_start_nfcal(struct ath_hw *ah) 161void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update)
162{ 162{
163 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, 163 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
164 AR_PHY_AGC_CONTROL_ENABLE_NF); 164 AR_PHY_AGC_CONTROL_ENABLE_NF);
165 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, 165
166 if (update)
167 REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
166 AR_PHY_AGC_CONTROL_NO_UPDATE_NF); 168 AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
169 else
170 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
171 AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
172
167 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); 173 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
168} 174}
169 175
diff --git a/drivers/net/wireless/ath/ath9k/calib.h b/drivers/net/wireless/ath/ath9k/calib.h
index cd60d09cdda7..bf4474220d1d 100644
--- a/drivers/net/wireless/ath/ath9k/calib.h
+++ b/drivers/net/wireless/ath/ath9k/calib.h
@@ -108,7 +108,7 @@ struct ath9k_pacal_info{
108}; 108};
109 109
110bool ath9k_hw_reset_calvalid(struct ath_hw *ah); 110bool ath9k_hw_reset_calvalid(struct ath_hw *ah);
111void ath9k_hw_start_nfcal(struct ath_hw *ah); 111void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update);
112void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan); 112void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan);
113int16_t ath9k_hw_getnf(struct ath_hw *ah, 113int16_t ath9k_hw_getnf(struct ath_hw *ah,
114 struct ath9k_channel *chan); 114 struct ath9k_channel *chan);
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 8d291ccf5c88..257b623185cd 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1256,7 +1256,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1256 1256
1257 if (ath9k_hw_channel_change(ah, chan)) { 1257 if (ath9k_hw_channel_change(ah, chan)) {
1258 ath9k_hw_loadnf(ah, ah->curchan); 1258 ath9k_hw_loadnf(ah, ah->curchan);
1259 ath9k_hw_start_nfcal(ah); 1259 ath9k_hw_start_nfcal(ah, true);
1260 return 0; 1260 return 0;
1261 } 1261 }
1262 } 1262 }
@@ -1461,11 +1461,8 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1461 if (ah->btcoex_hw.enabled) 1461 if (ah->btcoex_hw.enabled)
1462 ath9k_hw_btcoex_enable(ah); 1462 ath9k_hw_btcoex_enable(ah);
1463 1463
1464 if (AR_SREV_9300_20_OR_LATER(ah)) { 1464 if (AR_SREV_9300_20_OR_LATER(ah))
1465 ath9k_hw_loadnf(ah, curchan);
1466 ath9k_hw_start_nfcal(ah);
1467 ar9003_hw_bb_watchdog_config(ah); 1465 ar9003_hw_bb_watchdog_config(ah);
1468 }
1469 1466
1470 return 0; 1467 return 0;
1471} 1468}