aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_calib.c27
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c13
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h7
5 files changed, 40 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 5f406382677e..3506e7bd36eb 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -906,15 +906,13 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
906 struct ath_common *common = ath9k_hw_common(ah); 906 struct ath_common *common = ath9k_hw_common(ah);
907 struct ath9k_hw_cal_data *caldata = ah->caldata; 907 struct ath9k_hw_cal_data *caldata = ah->caldata;
908 bool txiqcal_done = false, txclcal_done = false; 908 bool txiqcal_done = false, txclcal_done = false;
909 bool is_reusable = true, txclcal_enabled; 909 bool is_reusable = true;
910 int i, j;
910 u32 cl_idx[AR9300_MAX_CHAINS] = { AR_PHY_CL_TAB_0, 911 u32 cl_idx[AR9300_MAX_CHAINS] = { AR_PHY_CL_TAB_0,
911 AR_PHY_CL_TAB_1, 912 AR_PHY_CL_TAB_1,
912 AR_PHY_CL_TAB_2 }; 913 AR_PHY_CL_TAB_2 };
913 914
914 txclcal_enabled = !!(REG_READ(ah, AR_PHY_CL_CAL_CTL) & 915 if (ah->enabled_cals & TX_CL_CAL) {
915 AR_PHY_CL_CAL_ENABLE);
916
917 if (txclcal_enabled) {
918 if (caldata && caldata->done_txclcal_once) 916 if (caldata && caldata->done_txclcal_once)
919 REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, 917 REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL,
920 AR_PHY_CL_CAL_ENABLE); 918 AR_PHY_CL_CAL_ENABLE);
@@ -923,6 +921,9 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
923 AR_PHY_CL_CAL_ENABLE); 921 AR_PHY_CL_CAL_ENABLE);
924 } 922 }
925 923
924 if (!(ah->enabled_cals & TX_IQ_CAL))
925 goto skip_tx_iqcal;
926
926 /* Do Tx IQ Calibration */ 927 /* Do Tx IQ Calibration */
927 REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_1, 928 REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_1,
928 AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT, 929 AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT,
@@ -932,7 +933,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
932 * For AR9485 or later chips, TxIQ cal runs as part of 933 * For AR9485 or later chips, TxIQ cal runs as part of
933 * AGC calibration 934 * AGC calibration
934 */ 935 */
935 if (AR_SREV_9485_OR_LATER(ah) && !AR_SREV_9340(ah)) { 936 if (ah->enabled_cals & TX_IQ_ON_AGC_CAL) {
936 if (caldata && !caldata->done_txiqcal_once) 937 if (caldata && !caldata->done_txiqcal_once)
937 REG_SET_BIT(ah, AR_PHY_TX_IQCAL_CONTROL_0, 938 REG_SET_BIT(ah, AR_PHY_TX_IQCAL_CONTROL_0,
938 AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL); 939 AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL);
@@ -940,13 +941,14 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
940 REG_CLR_BIT(ah, AR_PHY_TX_IQCAL_CONTROL_0, 941 REG_CLR_BIT(ah, AR_PHY_TX_IQCAL_CONTROL_0,
941 AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL); 942 AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL);
942 txiqcal_done = true; 943 txiqcal_done = true;
943 } else { 944 goto skip_tx_iqcal;
944 txiqcal_done = ar9003_hw_tx_iq_cal_run(ah);
945 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS);
946 udelay(5);
947 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
948 } 945 }
946 txiqcal_done = ar9003_hw_tx_iq_cal_run(ah);
947 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS);
948 udelay(5);
949 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
949 950
951skip_tx_iqcal:
950 /* Calibrate the AGC */ 952 /* Calibrate the AGC */
951 REG_WRITE(ah, AR_PHY_AGC_CONTROL, 953 REG_WRITE(ah, AR_PHY_AGC_CONTROL,
952 REG_READ(ah, AR_PHY_AGC_CONTROL) | 954 REG_READ(ah, AR_PHY_AGC_CONTROL) |
@@ -966,8 +968,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
966 ar9003_hw_tx_iq_cal_reload(ah); 968 ar9003_hw_tx_iq_cal_reload(ah);
967 969
968#define CL_TAB_ENTRY(reg_base) (reg_base + (4 * j)) 970#define CL_TAB_ENTRY(reg_base) (reg_base + (4 * j))
969 if (caldata && txclcal_enabled) { 971 if (caldata && (ah->enabled_cals & TX_CL_CAL)) {
970 int i, j;
971 txclcal_done = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & 972 txclcal_done = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) &
972 AR_PHY_AGC_CONTROL_CLC_SUCCESS); 973 AR_PHY_AGC_CONTROL_CLC_SUCCESS);
973 if (caldata->done_txclcal_once) { 974 if (caldata->done_txclcal_once) {
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 4e31d655c4ea..f38307eb24b8 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -694,6 +694,19 @@ static int ar9003_hw_process_ini(struct ath_hw *ah,
694 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); 694 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
695 ath9k_hw_apply_txpower(ah, chan); 695 ath9k_hw_apply_txpower(ah, chan);
696 696
697 if (AR_SREV_9480(ah)) {
698 if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0,
699 AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL))
700 ah->enabled_cals |= TX_IQ_CAL;
701 else
702 ah->enabled_cals &= ~TX_IQ_CAL;
703
704 if (REG_READ(ah, AR_PHY_CL_CAL_CTL) & AR_PHY_CL_CAL_ENABLE)
705 ah->enabled_cals |= TX_CL_CAL;
706 else
707 ah->enabled_cals &= ~TX_CL_CAL;
708 }
709
697 return 0; 710 return 0;
698} 711}
699 712
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
index c6ed51fb6858..ef90ab7dbd63 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
@@ -826,6 +826,7 @@
826#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 826#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24
827#define AR_PHY_CHANNEL_STATUS_RX_CLEAR 0x00000004 827#define AR_PHY_CHANNEL_STATUS_RX_CLEAR 0x00000004
828#define AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL 0x80000000 828#define AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL 0x80000000
829#define AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL_S 31
829#define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT 0x01fc0000 830#define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT 0x01fc0000
830#define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_S 18 831#define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_S 18
831#define AR_PHY_TX_IQCAL_START_DO_CAL 0x00000001 832#define AR_PHY_TX_IQCAL_START_DO_CAL 0x00000001
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 0aa05841b263..88bbdc46fd88 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2315,6 +2315,11 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
2315 rx_chainmask >>= 1; 2315 rx_chainmask >>= 1;
2316 } 2316 }
2317 2317
2318 if (AR_SREV_9300_20_OR_LATER(ah)) {
2319 ah->enabled_cals |= TX_IQ_CAL;
2320 if (!AR_SREV_9330(ah))
2321 ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
2322 }
2318 return 0; 2323 return 0;
2319} 2324}
2320 2325
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 446f4d309bec..75982a7ebcc0 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -634,6 +634,12 @@ struct ath_nf_limits {
634 s16 nominal; 634 s16 nominal;
635}; 635};
636 636
637enum ath_cal_list {
638 TX_IQ_CAL = BIT(0),
639 TX_IQ_ON_AGC_CAL = BIT(1),
640 TX_CL_CAL = BIT(2),
641};
642
637/* ah_flags */ 643/* ah_flags */
638#define AH_USE_EEPROM 0x1 644#define AH_USE_EEPROM 0x1
639#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */ 645#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */
@@ -733,6 +739,7 @@ struct ath_hw {
733 int32_t sign[AR5416_MAX_CHAINS]; 739 int32_t sign[AR5416_MAX_CHAINS];
734 } meas3; 740 } meas3;
735 u16 cal_samples; 741 u16 cal_samples;
742 u8 enabled_cals;
736 743
737 u32 sta_id1_defaults; 744 u32 sta_id1_defaults;
738 u32 misc_mode; 745 u32 misc_mode;