aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2013-12-06 05:58:52 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-12-09 15:38:01 -0500
commitbb46662894c24dce9be1414400b4ce969dafc1dd (patch)
treee1b4b621db0cf2dd18db9e948a3f52b9f1ad873f
parent6b416d0511153916a140feeabe58cd5443c97fd8 (diff)
ath9k: Enable manual peak calibration for AR9331 v1.1
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_calib.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index aa0127265746..97e09d5f3a42 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -898,7 +898,7 @@ static void ar9003_hw_tx_iq_cal_reload(struct ath_hw *ah)
898 898
899static void ar9003_hw_manual_peak_cal(struct ath_hw *ah, u8 chain, bool is_2g) 899static void ar9003_hw_manual_peak_cal(struct ath_hw *ah, u8 chain, bool is_2g)
900{ 900{
901 int offset[8], total = 0, test; 901 int offset[8] = {0}, total = 0, test;
902 int agc_out, i; 902 int agc_out, i;
903 903
904 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_GAINSTAGES(chain), 904 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_GAINSTAGES(chain),
@@ -923,12 +923,18 @@ static void ar9003_hw_manual_peak_cal(struct ath_hw *ah, u8 chain, bool is_2g)
923 AR_PHY_65NM_RXRF_AGC_AGC_ON_OVR, 0x1); 923 AR_PHY_65NM_RXRF_AGC_AGC_ON_OVR, 0x1);
924 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), 924 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain),
925 AR_PHY_65NM_RXRF_AGC_AGC_CAL_OVR, 0x1); 925 AR_PHY_65NM_RXRF_AGC_AGC_CAL_OVR, 0x1);
926 if (is_2g) 926
927 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), 927 if (AR_SREV_9330_11(ah)) {
928 AR_PHY_65NM_RXRF_AGC_AGC2G_DBDAC_OVR, 0x0);
929 else
930 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), 928 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain),
931 AR_PHY_65NM_RXRF_AGC_AGC5G_DBDAC_OVR, 0x0); 929 AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR, 0x0);
930 } else {
931 if (is_2g)
932 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain),
933 AR_PHY_65NM_RXRF_AGC_AGC2G_DBDAC_OVR, 0x0);
934 else
935 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain),
936 AR_PHY_65NM_RXRF_AGC_AGC5G_DBDAC_OVR, 0x0);
937 }
932 938
933 for (i = 6; i > 0; i--) { 939 for (i = 6; i > 0; i--) {
934 offset[i] = BIT(i - 1); 940 offset[i] = BIT(i - 1);
@@ -964,9 +970,9 @@ static void ar9003_hw_manual_peak_cal(struct ath_hw *ah, u8 chain, bool is_2g)
964 AR_PHY_65NM_RXRF_AGC_AGC_CAL_OVR, 0); 970 AR_PHY_65NM_RXRF_AGC_AGC_CAL_OVR, 0);
965} 971}
966 972
967static void ar9003_hw_do_manual_peak_cal(struct ath_hw *ah, 973static void ar9003_hw_do_pcoem_manual_peak_cal(struct ath_hw *ah,
968 struct ath9k_channel *chan, 974 struct ath9k_channel *chan,
969 bool run_rtt_cal) 975 bool run_rtt_cal)
970{ 976{
971 struct ath9k_hw_cal_data *caldata = ah->caldata; 977 struct ath9k_hw_cal_data *caldata = ah->caldata;
972 int i; 978 int i;
@@ -1145,7 +1151,7 @@ skip_tx_iqcal:
1145 AR_PHY_AGC_CONTROL_CAL, 1151 AR_PHY_AGC_CONTROL_CAL,
1146 0, AH_WAIT_TIMEOUT); 1152 0, AH_WAIT_TIMEOUT);
1147 1153
1148 ar9003_hw_do_manual_peak_cal(ah, chan, run_rtt_cal); 1154 ar9003_hw_do_pcoem_manual_peak_cal(ah, chan, run_rtt_cal);
1149 } 1155 }
1150 1156
1151 if (REG_READ(ah, AR_PHY_CL_CAL_CTL) & AR_PHY_CL_CAL_ENABLE) { 1157 if (REG_READ(ah, AR_PHY_CL_CAL_CTL) & AR_PHY_CL_CAL_ENABLE) {
@@ -1267,6 +1273,9 @@ static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
1267 1273
1268skip_tx_iqcal: 1274skip_tx_iqcal:
1269 if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) { 1275 if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) {
1276 if (AR_SREV_9330_11(ah))
1277 ar9003_hw_manual_peak_cal(ah, 0, IS_CHAN_2GHZ(chan));
1278
1270 /* Calibrate the AGC */ 1279 /* Calibrate the AGC */
1271 REG_WRITE(ah, AR_PHY_AGC_CONTROL, 1280 REG_WRITE(ah, AR_PHY_AGC_CONTROL,
1272 REG_READ(ah, AR_PHY_AGC_CONTROL) | 1281 REG_READ(ah, AR_PHY_AGC_CONTROL) |