aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>2011-06-17 04:38:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-20 15:34:18 -0400
commit0e44d48cbb010db492a27302b247049d5d43e065 (patch)
treedb1878c8d194c271fe5e1caaa12b2a2f160ffa01
parent81dc67601a49d1bfcfa85f644b14a013fc59e0ef (diff)
ath9k_hw: make sure PAPRD training is properly done
checking the status of PAPRD_AGC2_POWER(Log(ADC_power) measured after last gain-change in dB) field suggests whether the PAPRD is completely/properly done. This is an additional check apart from polling for PAPRD done bit being set. Susinder suggests that the ideal power range value should be 0xf0 to 0xfe. With AR9382 we do have the values in this range. to have a common check for all platforms we take agc2_power should be atleast greater than 0xe0 Cc: susinder@qca.qualcomm.com Cc: senthilb@qca.qualcomm.com Cc: kmuthusa@qca.qualcomm.com Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_paprd.c21
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h5
2 files changed, 23 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index 2e7f0f2567eb..fc9c08f513cf 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -785,7 +785,26 @@ EXPORT_SYMBOL(ar9003_paprd_init_table);
785 785
786bool ar9003_paprd_is_done(struct ath_hw *ah) 786bool ar9003_paprd_is_done(struct ath_hw *ah)
787{ 787{
788 return !!REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1, 788 int paprd_done, agc2_pwr;
789 paprd_done = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1,
789 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE); 790 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE);
791
792 if (paprd_done == 0x1) {
793 agc2_pwr = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1,
794 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR);
795
796 ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE,
797 "AGC2_PWR = 0x%x training done = 0x%x\n",
798 agc2_pwr, paprd_done);
799 /*
800 * agc2_pwr range should not be less than 'IDEAL_AGC2_PWR_CHANGE'
801 * when the training is completely done, otherwise retraining is
802 * done to make sure the value is in ideal range
803 */
804 if (agc2_pwr <= PAPRD_IDEAL_AGC2_PWR_RANGE)
805 paprd_done = 0;
806 }
807
808 return !!paprd_done;
790} 809}
791EXPORT_SYMBOL(ar9003_paprd_is_done); 810EXPORT_SYMBOL(ar9003_paprd_is_done);
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 6a6fb5439831..66d2225b95f3 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -157,8 +157,9 @@
157#define ATH9K_HW_RX_HP_QDEPTH 16 157#define ATH9K_HW_RX_HP_QDEPTH 16
158#define ATH9K_HW_RX_LP_QDEPTH 128 158#define ATH9K_HW_RX_LP_QDEPTH 128
159 159
160#define PAPRD_GAIN_TABLE_ENTRIES 32 160#define PAPRD_GAIN_TABLE_ENTRIES 32
161#define PAPRD_TABLE_SZ 24 161#define PAPRD_TABLE_SZ 24
162#define PAPRD_IDEAL_AGC2_PWR_RANGE 0xe0
162 163
163enum ath_hw_txq_subtype { 164enum ath_hw_txq_subtype {
164 ATH_TXQ_AC_BE = 0, 165 ATH_TXQ_AC_BE = 0,