Commit e1ff147d authored by Sujith Manoharan's avatar Sujith Manoharan Committed by Kalle Valo

ath9k: Fix MCI scheme initialization

Commit "ath9k_hw: remove ATH_BTCOEX_CFG_MCI" removed
MCI as a separate coex scheme, but we need it to
avoid fiddling with GPIO registers during
ath9k_init_btcoex() that are meant only for 3-wire
cards.

Cc: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 510baea1
...@@ -103,7 +103,9 @@ void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah) ...@@ -103,7 +103,9 @@ void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah)
return; return;
} }
if (AR_SREV_9300_20_OR_LATER(ah)) { if (ah->caps.hw_caps & ATH9K_HW_CAP_MCI) {
btcoex_hw->scheme = ATH_BTCOEX_CFG_MCI;
} else if (AR_SREV_9300_20_OR_LATER(ah)) {
btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE; btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300; btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300;
btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300; btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300;
...@@ -307,6 +309,18 @@ static void ath9k_hw_btcoex_enable_mci(struct ath_hw *ah) ...@@ -307,6 +309,18 @@ static void ath9k_hw_btcoex_enable_mci(struct ath_hw *ah)
btcoex->enabled = true; btcoex->enabled = true;
} }
static void ath9k_hw_btcoex_disable_mci(struct ath_hw *ah)
{
struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
int i;
ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE);
for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++)
REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i),
btcoex_hw->wlan_weight[i]);
}
void ath9k_hw_btcoex_enable(struct ath_hw *ah) void ath9k_hw_btcoex_enable(struct ath_hw *ah)
{ {
struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
...@@ -318,17 +332,18 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah) ...@@ -318,17 +332,18 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah)
ath9k_hw_btcoex_enable_2wire(ah); ath9k_hw_btcoex_enable_2wire(ah);
break; break;
case ATH_BTCOEX_CFG_3WIRE: case ATH_BTCOEX_CFG_3WIRE:
if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) {
ath9k_hw_btcoex_enable_mci(ah);
return;
}
ath9k_hw_btcoex_enable_3wire(ah); ath9k_hw_btcoex_enable_3wire(ah);
break; break;
case ATH_BTCOEX_CFG_MCI:
ath9k_hw_btcoex_enable_mci(ah);
break;
} }
REG_RMW(ah, AR_GPIO_PDPU, if (ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_MCI) {
(0x2 << (btcoex_hw->btactive_gpio * 2)), REG_RMW(ah, AR_GPIO_PDPU,
(0x3 << (btcoex_hw->btactive_gpio * 2))); (0x2 << (btcoex_hw->btactive_gpio * 2)),
(0x3 << (btcoex_hw->btactive_gpio * 2)));
}
ah->btcoex_hw.enabled = true; ah->btcoex_hw.enabled = true;
} }
...@@ -340,13 +355,12 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah) ...@@ -340,13 +355,12 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah)
int i; int i;
btcoex_hw->enabled = false; btcoex_hw->enabled = false;
if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) {
ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_MCI) {
for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) ath9k_hw_btcoex_disable_mci(ah);
REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i),
btcoex_hw->wlan_weight[i]);
return; return;
} }
ath9k_hw_set_gpio(ah, btcoex_hw->wlanactive_gpio, 0); ath9k_hw_set_gpio(ah, btcoex_hw->wlanactive_gpio, 0);
ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio, ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio,
......
...@@ -58,6 +58,7 @@ enum ath_btcoex_scheme { ...@@ -58,6 +58,7 @@ enum ath_btcoex_scheme {
ATH_BTCOEX_CFG_NONE, ATH_BTCOEX_CFG_NONE,
ATH_BTCOEX_CFG_2WIRE, ATH_BTCOEX_CFG_2WIRE,
ATH_BTCOEX_CFG_3WIRE, ATH_BTCOEX_CFG_3WIRE,
ATH_BTCOEX_CFG_MCI,
}; };
struct ath9k_hw_mci { struct ath9k_hw_mci {
......
...@@ -280,6 +280,7 @@ static void ath_init_btcoex_timer(struct ath_softc *sc) ...@@ -280,6 +280,7 @@ static void ath_init_btcoex_timer(struct ath_softc *sc)
btcoex->btcoex_period / 100; btcoex->btcoex_period / 100;
btcoex->btscan_no_stomp = (100 - ATH_BTCOEX_BTSCAN_DUTY_CYCLE) * btcoex->btscan_no_stomp = (100 - ATH_BTCOEX_BTSCAN_DUTY_CYCLE) *
btcoex->btcoex_period / 100; btcoex->btcoex_period / 100;
btcoex->bt_stomp_type = ATH_BTCOEX_STOMP_LOW;
setup_timer(&btcoex->period_timer, ath_btcoex_period_timer, setup_timer(&btcoex->period_timer, ath_btcoex_period_timer,
(unsigned long) sc); (unsigned long) sc);
...@@ -408,19 +409,19 @@ int ath9k_init_btcoex(struct ath_softc *sc) ...@@ -408,19 +409,19 @@ int ath9k_init_btcoex(struct ath_softc *sc)
case ATH_BTCOEX_CFG_3WIRE: case ATH_BTCOEX_CFG_3WIRE:
ath9k_hw_btcoex_init_3wire(sc->sc_ah); ath9k_hw_btcoex_init_3wire(sc->sc_ah);
ath_init_btcoex_timer(sc); ath_init_btcoex_timer(sc);
txq = sc->tx.txq_map[IEEE80211_AC_BE]; txq = sc->tx.txq_map[IEEE80211_AC_BE];
ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum); ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum);
sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; break;
if (ath9k_hw_mci_is_enabled(ah)) { case ATH_BTCOEX_CFG_MCI:
sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE; ath_init_btcoex_timer(sc);
INIT_LIST_HEAD(&sc->btcoex.mci.info);
ath9k_hw_btcoex_init_mci(ah); sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE;
INIT_LIST_HEAD(&sc->btcoex.mci.info);
r = ath_mci_setup(sc); ath9k_hw_btcoex_init_mci(ah);
if (r)
return r; r = ath_mci_setup(sc);
} if (r)
return r;
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment