aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_calib.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index e5407df10ea0..ddeba8693fab 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -18,6 +18,7 @@
18#include "hw-ops.h" 18#include "hw-ops.h"
19#include "ar9003_phy.h" 19#include "ar9003_phy.h"
20#include "ar9003_rtt.h" 20#include "ar9003_rtt.h"
21#include "ar9003_mci.h"
21 22
22#define MAX_MEASUREMENT MAX_IQCAL_MEASUREMENT 23#define MAX_MEASUREMENT MAX_IQCAL_MEASUREMENT
23#define MAX_MAG_DELTA 11 24#define MAX_MAG_DELTA 11
@@ -934,10 +935,12 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
934{ 935{
935 struct ath_common *common = ath9k_hw_common(ah); 936 struct ath_common *common = ath9k_hw_common(ah);
936 struct ath9k_hw_cal_data *caldata = ah->caldata; 937 struct ath9k_hw_cal_data *caldata = ah->caldata;
938 struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci;
937 bool txiqcal_done = false, txclcal_done = false; 939 bool txiqcal_done = false, txclcal_done = false;
938 bool is_reusable = true, status = true; 940 bool is_reusable = true, status = true;
939 bool run_rtt_cal = false, run_agc_cal; 941 bool run_rtt_cal = false, run_agc_cal;
940 bool rtt = !!(ah->caps.hw_caps & ATH9K_HW_CAP_RTT); 942 bool rtt = !!(ah->caps.hw_caps & ATH9K_HW_CAP_RTT);
943 bool mci = !!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI);
941 u32 agc_ctrl = 0, agc_supp_cals = AR_PHY_AGC_CONTROL_OFFSET_CAL | 944 u32 agc_ctrl = 0, agc_supp_cals = AR_PHY_AGC_CONTROL_OFFSET_CAL |
942 AR_PHY_AGC_CONTROL_FLTR_CAL | 945 AR_PHY_AGC_CONTROL_FLTR_CAL |
943 AR_PHY_AGC_CONTROL_PKDET_CAL; 946 AR_PHY_AGC_CONTROL_PKDET_CAL;
@@ -1005,6 +1008,31 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
1005 } else if (caldata && !caldata->done_txiqcal_once) 1008 } else if (caldata && !caldata->done_txiqcal_once)
1006 run_agc_cal = true; 1009 run_agc_cal = true;
1007 1010
1011 if (mci && IS_CHAN_2GHZ(chan) &&
1012 (mci_hw->bt_state == MCI_BT_AWAKE) &&
1013 run_agc_cal &&
1014 !(mci_hw->config & ATH_MCI_CONFIG_DISABLE_MCI_CAL)) {
1015
1016 u32 pld[4] = {0, 0, 0, 0};
1017
1018 /* send CAL_REQ only when BT is AWAKE. */
1019 ath_dbg(common, ATH_DBG_MCI, "MCI send WLAN_CAL_REQ 0x%x\n",
1020 mci_hw->wlan_cal_seq);
1021 MCI_GPM_SET_CAL_TYPE(pld, MCI_GPM_WLAN_CAL_REQ);
1022 pld[MCI_GPM_WLAN_CAL_W_SEQUENCE] = mci_hw->wlan_cal_seq++;
1023 ar9003_mci_send_message(ah, MCI_GPM, 0, pld, 16, true, false);
1024
1025 /* Wait BT_CAL_GRANT for 50ms */
1026 ath_dbg(common, ATH_DBG_MCI, "MCI wait for BT_CAL_GRANT");
1027
1028 if (ar9003_mci_wait_for_gpm(ah, MCI_GPM_BT_CAL_GRANT, 0, 50000))
1029 ath_dbg(common, ATH_DBG_MCI, "MCI got BT_CAL_GRANT");
1030 else {
1031 is_reusable = false;
1032 ath_dbg(common, ATH_DBG_MCI, "\nMCI BT is not responding");
1033 }
1034 }
1035
1008 txiqcal_done = ar9003_hw_tx_iq_cal_run(ah); 1036 txiqcal_done = ar9003_hw_tx_iq_cal_run(ah);
1009 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS); 1037 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS);
1010 udelay(5); 1038 udelay(5);
@@ -1022,6 +1050,21 @@ skip_tx_iqcal:
1022 AR_PHY_AGC_CONTROL_CAL, 1050 AR_PHY_AGC_CONTROL_CAL,
1023 0, AH_WAIT_TIMEOUT); 1051 0, AH_WAIT_TIMEOUT);
1024 } 1052 }
1053
1054 if (mci && IS_CHAN_2GHZ(chan) &&
1055 (mci_hw->bt_state == MCI_BT_AWAKE) &&
1056 run_agc_cal &&
1057 !(mci_hw->config & ATH_MCI_CONFIG_DISABLE_MCI_CAL)) {
1058
1059 u32 pld[4] = {0, 0, 0, 0};
1060
1061 ath_dbg(common, ATH_DBG_MCI, "MCI Send WLAN_CAL_DONE 0x%x\n",
1062 mci_hw->wlan_cal_done);
1063 MCI_GPM_SET_CAL_TYPE(pld, MCI_GPM_WLAN_CAL_DONE);
1064 pld[MCI_GPM_WLAN_CAL_W_SEQUENCE] = mci_hw->wlan_cal_done++;
1065 ar9003_mci_send_message(ah, MCI_GPM, 0, pld, 16, true, false);
1066 }
1067
1025 if (rtt && !run_rtt_cal) { 1068 if (rtt && !run_rtt_cal) {
1026 agc_ctrl |= agc_supp_cals; 1069 agc_ctrl |= agc_supp_cals;
1027 REG_WRITE(ah, AR_PHY_AGC_CONTROL, agc_ctrl); 1070 REG_WRITE(ah, AR_PHY_AGC_CONTROL, agc_ctrl);