|
@@ -16,6 +16,7 @@
|
|
|
|
|
|
#include <linux/nl80211.h>
|
|
|
#include "ath9k.h"
|
|
|
+#include "btcoex.h"
|
|
|
|
|
|
static char *dev_info = "ath9k";
|
|
|
|
|
@@ -439,8 +440,10 @@ static void ath_start_ani(struct ath_softc *sc)
|
|
|
*/
|
|
|
void ath_update_chainmask(struct ath_softc *sc, int is_ht)
|
|
|
{
|
|
|
+ struct ath_hw *ah = sc->sc_ah;
|
|
|
+
|
|
|
if ((sc->sc_flags & SC_OP_SCANNING) || is_ht ||
|
|
|
- (sc->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE)) {
|
|
|
+ (ah->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE)) {
|
|
|
sc->tx_chainmask = sc->sc_ah->caps.tx_chainmask;
|
|
|
sc->rx_chainmask = sc->sc_ah->caps.rx_chainmask;
|
|
|
} else {
|
|
@@ -448,7 +451,7 @@ void ath_update_chainmask(struct ath_softc *sc, int is_ht)
|
|
|
sc->rx_chainmask = 1;
|
|
|
}
|
|
|
|
|
|
- DPRINTF(sc->sc_ah, ATH_DBG_CONFIG, "tx chmask: %d, rx chmask: %d\n",
|
|
|
+ DPRINTF(ah, ATH_DBG_CONFIG, "tx chmask: %d, rx chmask: %d\n",
|
|
|
sc->tx_chainmask, sc->rx_chainmask);
|
|
|
}
|
|
|
|
|
@@ -478,6 +481,8 @@ static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta)
|
|
|
static void ath9k_tasklet(unsigned long data)
|
|
|
{
|
|
|
struct ath_softc *sc = (struct ath_softc *)data;
|
|
|
+ struct ath_hw *ah = sc->sc_ah;
|
|
|
+
|
|
|
u32 status = sc->intrstatus;
|
|
|
|
|
|
ath9k_ps_wakeup(sc);
|
|
@@ -502,16 +507,16 @@ static void ath9k_tasklet(unsigned long data)
|
|
|
* TSF sync does not look correct; remain awake to sync with
|
|
|
* the next Beacon.
|
|
|
*/
|
|
|
- DPRINTF(sc->sc_ah, ATH_DBG_PS, "TSFOOR - Sync with next Beacon\n");
|
|
|
+ DPRINTF(ah, ATH_DBG_PS, "TSFOOR - Sync with next Beacon\n");
|
|
|
sc->sc_flags |= SC_OP_WAIT_FOR_BEACON | SC_OP_BEACON_SYNC;
|
|
|
}
|
|
|
|
|
|
- if (sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
|
|
|
+ if (ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
|
|
|
if (status & ATH9K_INT_GENTIMER)
|
|
|
ath_gen_timer_isr(sc->sc_ah);
|
|
|
|
|
|
/* re-enable hardware interrupt */
|
|
|
- ath9k_hw_set_interrupts(sc->sc_ah, sc->imask);
|
|
|
+ ath9k_hw_set_interrupts(ah, sc->imask);
|
|
|
ath9k_ps_restore(sc);
|
|
|
}
|
|
|
|
|
@@ -1281,12 +1286,12 @@ void ath_detach(struct ath_softc *sc)
|
|
|
if (ATH_TXQ_SETUP(sc, i))
|
|
|
ath_tx_cleanupq(sc, &sc->tx.txq[i]);
|
|
|
|
|
|
- if ((sc->btcoex_info.no_stomp_timer) &&
|
|
|
- sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
|
|
|
- ath_gen_timer_free(ah, sc->btcoex_info.no_stomp_timer);
|
|
|
+ if ((ah->btcoex_info.no_stomp_timer) &&
|
|
|
+ ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
|
|
|
+ ath_gen_timer_free(ah, ah->btcoex_info.no_stomp_timer);
|
|
|
|
|
|
ath9k_hw_detach(ah);
|
|
|
- ath9k_exit_debug(sc->sc_ah);
|
|
|
+ ath9k_exit_debug(ah);
|
|
|
sc->sc_ah = NULL;
|
|
|
}
|
|
|
|
|
@@ -1516,7 +1521,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid)
|
|
|
ARRAY_SIZE(ath9k_5ghz_chantable);
|
|
|
}
|
|
|
|
|
|
- if (sc->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) {
|
|
|
+ if (ah->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) {
|
|
|
r = ath9k_hw_btcoex_init(ah);
|
|
|
if (r)
|
|
|
goto bad2;
|
|
@@ -1905,11 +1910,12 @@ static int ath9k_start(struct ieee80211_hw *hw)
|
|
|
{
|
|
|
struct ath_wiphy *aphy = hw->priv;
|
|
|
struct ath_softc *sc = aphy->sc;
|
|
|
+ struct ath_hw *ah = sc->sc_ah;
|
|
|
struct ieee80211_channel *curchan = hw->conf.channel;
|
|
|
struct ath9k_channel *init_channel;
|
|
|
int r;
|
|
|
|
|
|
- DPRINTF(sc->sc_ah, ATH_DBG_CONFIG, "Starting driver with "
|
|
|
+ DPRINTF(ah, ATH_DBG_CONFIG, "Starting driver with "
|
|
|
"initial channel: %d MHz\n", curchan->center_freq);
|
|
|
|
|
|
mutex_lock(&sc->mutex);
|
|
@@ -1942,7 +1948,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
|
|
|
init_channel = ath_get_curchannel(sc, hw);
|
|
|
|
|
|
/* Reset SERDES registers */
|
|
|
- ath9k_hw_configpcipowersave(sc->sc_ah, 0, 0);
|
|
|
+ ath9k_hw_configpcipowersave(ah, 0, 0);
|
|
|
|
|
|
/*
|
|
|
* The basic interface to setting the hardware in a good
|
|
@@ -1952,9 +1958,9 @@ static int ath9k_start(struct ieee80211_hw *hw)
|
|
|
* and then setup of the interrupt mask.
|
|
|
*/
|
|
|
spin_lock_bh(&sc->sc_resetlock);
|
|
|
- r = ath9k_hw_reset(sc->sc_ah, init_channel, false);
|
|
|
+ r = ath9k_hw_reset(ah, init_channel, false);
|
|
|
if (r) {
|
|
|
- DPRINTF(sc->sc_ah, ATH_DBG_FATAL,
|
|
|
+ DPRINTF(ah, ATH_DBG_FATAL,
|
|
|
"Unable to reset hardware; reset status %d "
|
|
|
"(freq %u MHz)\n", r,
|
|
|
curchan->center_freq);
|
|
@@ -1977,7 +1983,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
|
|
|
* here except setup the interrupt mask.
|
|
|
*/
|
|
|
if (ath_startrecv(sc) != 0) {
|
|
|
- DPRINTF(sc->sc_ah, ATH_DBG_FATAL, "Unable to start recv logic\n");
|
|
|
+ DPRINTF(ah, ATH_DBG_FATAL, "Unable to start recv logic\n");
|
|
|
r = -EIO;
|
|
|
goto mutex_unlock;
|
|
|
}
|
|
@@ -1987,10 +1993,10 @@ static int ath9k_start(struct ieee80211_hw *hw)
|
|
|
| ATH9K_INT_RXEOL | ATH9K_INT_RXORN
|
|
|
| ATH9K_INT_FATAL | ATH9K_INT_GLOBAL;
|
|
|
|
|
|
- if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_GTT)
|
|
|
+ if (ah->caps.hw_caps & ATH9K_HW_CAP_GTT)
|
|
|
sc->imask |= ATH9K_INT_GTT;
|
|
|
|
|
|
- if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
|
|
|
+ if (ah->caps.hw_caps & ATH9K_HW_CAP_HT)
|
|
|
sc->imask |= ATH9K_INT_CST;
|
|
|
|
|
|
ath_cache_conf_rate(sc, &hw->conf);
|
|
@@ -1999,20 +2005,19 @@ static int ath9k_start(struct ieee80211_hw *hw)
|
|
|
|
|
|
/* Disable BMISS interrupt when we're not associated */
|
|
|
sc->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
|
|
|
- ath9k_hw_set_interrupts(sc->sc_ah, sc->imask);
|
|
|
+ ath9k_hw_set_interrupts(ah, sc->imask);
|
|
|
|
|
|
ieee80211_wake_queues(hw);
|
|
|
|
|
|
ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
|
|
|
|
|
|
- if ((sc->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) &&
|
|
|
+ if ((ah->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) &&
|
|
|
!(sc->sc_flags & SC_OP_BTCOEX_ENABLED)) {
|
|
|
- ath_btcoex_set_weight(&sc->btcoex_info, AR_BT_COEX_WGHT,
|
|
|
- AR_STOMP_LOW_WLAN_WGHT);
|
|
|
- ath9k_hw_btcoex_enable(sc->sc_ah);
|
|
|
+ ath9k_hw_btcoex_init_weight(ah);
|
|
|
+ ath9k_hw_btcoex_enable(ah);
|
|
|
|
|
|
ath_pcie_aspm_disable(sc);
|
|
|
- if (sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
|
|
|
+ if (ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
|
|
|
ath_btcoex_timer_resume(sc);
|
|
|
}
|
|
|
|
|
@@ -2125,6 +2130,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
|
|
|
{
|
|
|
struct ath_wiphy *aphy = hw->priv;
|
|
|
struct ath_softc *sc = aphy->sc;
|
|
|
+ struct ath_hw *ah = sc->sc_ah;
|
|
|
|
|
|
mutex_lock(&sc->mutex);
|
|
|
|
|
@@ -2139,7 +2145,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
|
|
|
}
|
|
|
|
|
|
if (sc->sc_flags & SC_OP_INVALID) {
|
|
|
- DPRINTF(sc->sc_ah, ATH_DBG_ANY, "Device not present\n");
|
|
|
+ DPRINTF(ah, ATH_DBG_ANY, "Device not present\n");
|
|
|
mutex_unlock(&sc->mutex);
|
|
|
return;
|
|
|
}
|
|
@@ -2150,32 +2156,32 @@ static void ath9k_stop(struct ieee80211_hw *hw)
|
|
|
}
|
|
|
|
|
|
if (sc->sc_flags & SC_OP_BTCOEX_ENABLED) {
|
|
|
- ath9k_hw_btcoex_disable(sc->sc_ah);
|
|
|
- if (sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
|
|
|
+ ath9k_hw_btcoex_disable(ah);
|
|
|
+ if (ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
|
|
|
ath_btcoex_timer_pause(sc);
|
|
|
}
|
|
|
|
|
|
/* make sure h/w will not generate any interrupt
|
|
|
* before setting the invalid flag. */
|
|
|
- ath9k_hw_set_interrupts(sc->sc_ah, 0);
|
|
|
+ ath9k_hw_set_interrupts(ah, 0);
|
|
|
|
|
|
if (!(sc->sc_flags & SC_OP_INVALID)) {
|
|
|
ath_drain_all_txq(sc, false);
|
|
|
ath_stoprecv(sc);
|
|
|
- ath9k_hw_phy_disable(sc->sc_ah);
|
|
|
+ ath9k_hw_phy_disable(ah);
|
|
|
} else
|
|
|
sc->rx.rxlink = NULL;
|
|
|
|
|
|
/* disable HAL and put h/w to sleep */
|
|
|
- ath9k_hw_disable(sc->sc_ah);
|
|
|
- ath9k_hw_configpcipowersave(sc->sc_ah, 1, 1);
|
|
|
- ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP);
|
|
|
+ ath9k_hw_disable(ah);
|
|
|
+ ath9k_hw_configpcipowersave(ah, 1, 1);
|
|
|
+ ath9k_hw_setpower(ah, ATH9K_PM_FULL_SLEEP);
|
|
|
|
|
|
sc->sc_flags |= SC_OP_INVALID;
|
|
|
|
|
|
mutex_unlock(&sc->mutex);
|
|
|
|
|
|
- DPRINTF(sc->sc_ah, ATH_DBG_CONFIG, "Driver halt\n");
|
|
|
+ DPRINTF(ah, ATH_DBG_CONFIG, "Driver halt\n");
|
|
|
}
|
|
|
|
|
|
static int ath9k_add_interface(struct ieee80211_hw *hw,
|