diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2009-02-11 23:36:49 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:51:44 -0500 |
commit | edf7c060f094f33b68b34b9312688fb823ebc0ff (patch) | |
tree | 69a1b45cc59d2d7b1361bf02aec3d5008b611557 /drivers/net/wireless/ath9k/calib.c | |
parent | 4af9cf4fda28c5f794861c52e0db5a3de9ee574d (diff) |
ath9k: Initialize AGC calibration properly
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/calib.c')
-rw-r--r-- | drivers/net/wireless/ath9k/calib.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath9k/calib.c b/drivers/net/wireless/ath9k/calib.c index 1fc3a08e85c6..a7ce8c5d48f5 100644 --- a/drivers/net/wireless/ath9k/calib.c +++ b/drivers/net/wireless/ath9k/calib.c | |||
@@ -851,6 +851,30 @@ static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah) | |||
851 | bool ath9k_hw_init_cal(struct ath_hw *ah, | 851 | bool ath9k_hw_init_cal(struct ath_hw *ah, |
852 | struct ath9k_channel *chan) | 852 | struct ath9k_channel *chan) |
853 | { | 853 | { |
854 | if (AR_SREV_9280_10_OR_LATER(ah)) { | ||
855 | REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); | ||
856 | REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); | ||
857 | REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE); | ||
858 | |||
859 | /* Kick off the cal */ | ||
860 | REG_WRITE(ah, AR_PHY_AGC_CONTROL, | ||
861 | REG_READ(ah, AR_PHY_AGC_CONTROL) | | ||
862 | AR_PHY_AGC_CONTROL_CAL); | ||
863 | |||
864 | if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, | ||
865 | AR_PHY_AGC_CONTROL_CAL, 0)) { | ||
866 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, | ||
867 | "offset calibration failed to complete in 1ms; " | ||
868 | "noisy environment?\n"); | ||
869 | return false; | ||
870 | } | ||
871 | |||
872 | REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); | ||
873 | REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); | ||
874 | REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE); | ||
875 | } | ||
876 | |||
877 | /* Calibrate the AGC */ | ||
854 | REG_WRITE(ah, AR_PHY_AGC_CONTROL, | 878 | REG_WRITE(ah, AR_PHY_AGC_CONTROL, |
855 | REG_READ(ah, AR_PHY_AGC_CONTROL) | | 879 | REG_READ(ah, AR_PHY_AGC_CONTROL) | |
856 | AR_PHY_AGC_CONTROL_CAL); | 880 | AR_PHY_AGC_CONTROL_CAL); |
@@ -862,9 +886,16 @@ bool ath9k_hw_init_cal(struct ath_hw *ah, | |||
862 | return false; | 886 | return false; |
863 | } | 887 | } |
864 | 888 | ||
889 | if (AR_SREV_9280_10_OR_LATER(ah)) { | ||
890 | REG_SET_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); | ||
891 | REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); | ||
892 | } | ||
893 | |||
894 | /* Do PA Calibration */ | ||
865 | if (AR_SREV_9285(ah) && AR_SREV_9285_11_OR_LATER(ah)) | 895 | if (AR_SREV_9285(ah) && AR_SREV_9285_11_OR_LATER(ah)) |
866 | ath9k_hw_9285_pa_cal(ah); | 896 | ath9k_hw_9285_pa_cal(ah); |
867 | 897 | ||
898 | /* Do NF Calibration */ | ||
868 | REG_WRITE(ah, AR_PHY_AGC_CONTROL, | 899 | REG_WRITE(ah, AR_PHY_AGC_CONTROL, |
869 | REG_READ(ah, AR_PHY_AGC_CONTROL) | | 900 | REG_READ(ah, AR_PHY_AGC_CONTROL) | |
870 | AR_PHY_AGC_CONTROL_NF); | 901 | AR_PHY_AGC_CONTROL_NF); |