aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-02-11 23:36:49 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:51:44 -0500
commitedf7c060f094f33b68b34b9312688fb823ebc0ff (patch)
tree69a1b45cc59d2d7b1361bf02aec3d5008b611557
parent4af9cf4fda28c5f794861c52e0db5a3de9ee574d (diff)
ath9k: Initialize AGC calibration properly
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath9k/calib.c31
-rw-r--r--drivers/net/wireless/ath9k/phy.h4
2 files changed, 35 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)
851bool ath9k_hw_init_cal(struct ath_hw *ah, 851bool 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);
diff --git a/drivers/net/wireless/ath9k/phy.h b/drivers/net/wireless/ath9k/phy.h
index 837a598a7ae5..4758c37e4b88 100644
--- a/drivers/net/wireless/ath9k/phy.h
+++ b/drivers/net/wireless/ath9k/phy.h
@@ -485,6 +485,10 @@ bool ath9k_hw_init_rf(struct ath_hw *ah,
485#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4 0x0FC00000 485#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4 0x0FC00000
486#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4_S 22 486#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4_S 22
487 487
488/* Carrier leak calibration control, do it after AGC calibration */
489#define AR_PHY_CL_CAL_CTL 0xA358
490#define AR_PHY_CL_CAL_ENABLE 0x00000002
491
488#define AR_PHY_POWER_TX_RATE5 0xA38C 492#define AR_PHY_POWER_TX_RATE5 0xA38C
489#define AR_PHY_POWER_TX_RATE6 0xA390 493#define AR_PHY_POWER_TX_RATE6 0xA390
490 494