if (AR_SREV_9340(ah) && !ah->is_clk_25mhz)
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -997,8 +997,14 @@ void ath9k_hw_init_global_settings(struc
+@@ -975,7 +975,10 @@ void ath9k_hw_init_global_settings(struc
+ if (ah->misc_mode != 0)
+ REG_SET_BIT(ah, AR_PCU_MISC, ah->misc_mode);
+
+- rx_lat = 37;
++ if (IS_CHAN_A_FAST_CLOCK(ah, chan))
++ rx_lat = 41;
++ else
++ rx_lat = 37;
+ tx_lat = 54;
+
+ if (IS_CHAN_HALF_RATE(chan)) {
+@@ -989,7 +992,7 @@ void ath9k_hw_init_global_settings(struc
+ sifstime = 32;
+ } else if (IS_CHAN_QUARTER_RATE(chan)) {
+ eifs = 340;
+- rx_lat *= 4;
++ rx_lat = (rx_lat * 4) - 1;
+ tx_lat *= 4;
+ if (IS_CHAN_A_FAST_CLOCK(ah, chan))
+ tx_lat += 22;
+@@ -997,8 +1000,14 @@ void ath9k_hw_init_global_settings(struc
slottime = 21;
sifstime = 64;
} else {
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1671,8 +1671,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -1674,8 +1674,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
REG_WRITE(ah, AR_OBS, 8);
if (ah->config.rx_intr_mitigation) {
return -EINVAL;
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1504,6 +1504,10 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -1507,6 +1507,10 @@ int ath9k_hw_reset(struct ath_hw *ah, st
}
ah->noise = ath9k_hw_getchan_noise(ah, chan);
int slottime;
int sifstime;
int rx_lat = 0, tx_lat = 0, eifs = 0;
-@@ -1026,6 +1026,7 @@ void ath9k_hw_init_global_settings(struc
+@@ -1029,6 +1029,7 @@ void ath9k_hw_init_global_settings(struc
/* As defined by IEEE 802.11-2007 17.3.8.6 */
acktimeout = slottime + sifstime + 3 * ah->coverage_class;
/*
* Workaround for early ACK timeouts, add an offset to match the
-@@ -1040,7 +1041,7 @@ void ath9k_hw_init_global_settings(struc
+@@ -1043,7 +1044,7 @@ void ath9k_hw_init_global_settings(struc
ath9k_hw_set_sifs_time(ah, sifstime);
ath9k_hw_setslottime(ah, slottime);
ath9k_hw_set_ack_timeout(ah, acktimeout);
ath9k_ps_restore(sc);
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1485,9 +1485,6 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -1488,9 +1488,6 @@ int ath9k_hw_reset(struct ath_hw *ah, st
u64 tsf = 0;
int i, r;
if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
return -EIO;
-@@ -2105,6 +2102,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw
+@@ -2108,6 +2105,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw
pCap->tx_chainmask = fixup_chainmask(chip_chainmask, pCap->tx_chainmask);
pCap->rx_chainmask = fixup_chainmask(chip_chainmask, pCap->rx_chainmask);
INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work);
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -595,74 +595,6 @@ static void ath_node_detach(struct ath_s
+@@ -236,6 +236,7 @@ static int ath_set_channel(struct ath_so
+ del_timer_sync(&common->ani.timer);
+ cancel_work_sync(&sc->paprd_work);
+ cancel_work_sync(&sc->hw_check_work);
++ cancel_work_sync(&sc->hw_reset_work);
+ cancel_delayed_work_sync(&sc->tx_complete_work);
+ cancel_delayed_work_sync(&sc->hw_pll_work);
+
+@@ -595,74 +596,6 @@ static void ath_node_detach(struct ath_s
ath_tx_node_cleanup(sc, an);
}
void ath9k_tasklet(unsigned long data)
{
-@@ -675,9 +607,7 @@ void ath9k_tasklet(unsigned long data)
+@@ -675,9 +608,7 @@ void ath9k_tasklet(unsigned long data)
if ((status & ATH9K_INT_FATAL) ||
(status & ATH9K_INT_BB_WATCHDOG)) {
return;
}
-@@ -968,13 +898,14 @@ void ath_radio_disable(struct ath_softc
+@@ -968,13 +899,14 @@ void ath_radio_disable(struct ath_softc
ath9k_ps_restore(sc);
}
sc->hw_busy_count = 0;
/* Stop ANI */
-@@ -1035,6 +966,84 @@ int ath_reset(struct ath_softc *sc, bool
+@@ -1035,6 +967,84 @@ int ath_reset(struct ath_softc *sc, bool
return r;
}
/**********************/
/* mac80211 callbacks */
/**********************/
+@@ -1227,6 +1237,7 @@ static void ath9k_stop(struct ieee80211_
+ cancel_delayed_work_sync(&sc->hw_pll_work);
+ cancel_work_sync(&sc->paprd_work);
+ cancel_work_sync(&sc->hw_check_work);
++ cancel_work_sync(&sc->hw_reset_work);
+
+ if (sc->sc_flags & SC_OP_INVALID) {
+ ath_dbg(common, ATH_DBG_ANY, "Device not present\n");
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -603,8 +603,10 @@ static void ath_tx_complete_aggr(struct
}
static bool ath_lookup_legacy(struct ath_buf *bf)
+@@ -1357,7 +1359,7 @@ void ath_txq_schedule(struct ath_softc *
+ struct ath_atx_ac *ac, *ac_tmp, *last_ac;
+ struct ath_atx_tid *tid, *last_tid;
+
+- if (list_empty(&txq->axq_acq) ||
++ if ((sc->sc_flags & SC_OP_HW_RESET) || list_empty(&txq->axq_acq) ||
+ txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
+ return;
+
@@ -2184,6 +2186,9 @@ static void ath_tx_processq(struct ath_s
spin_lock_bh(&txq->axq_lock);
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -212,83 +212,57 @@ static int ath_update_survey_stats(struc
+@@ -212,84 +212,57 @@ static int ath_update_survey_stats(struc
return ret;
}
- del_timer_sync(&common->ani.timer);
cancel_work_sync(&sc->paprd_work);
cancel_work_sync(&sc->hw_check_work);
+- cancel_work_sync(&sc->hw_reset_work);
cancel_delayed_work_sync(&sc->tx_complete_work);
cancel_delayed_work_sync(&sc->hw_pll_work);
+}
}
ath9k_cmn_update_txpow(ah, sc->curtxpow,
-@@ -296,21 +270,95 @@ static int ath_set_channel(struct ath_so
+@@ -297,21 +270,95 @@ static int ath_set_channel(struct ath_so
ath9k_hw_set_interrupts(ah, ah->imask);
ath9k_hw_enable_interrupts(ah);
return r;
}
-@@ -823,28 +871,13 @@ static void ath_radio_enable(struct ath_
+@@ -824,28 +871,13 @@ static void ath_radio_enable(struct ath_
channel->center_freq, r);
}
spin_unlock_bh(&sc->sc_pcu_lock);
ath9k_ps_restore(sc);
-@@ -857,11 +890,10 @@ void ath_radio_disable(struct ath_softc
+@@ -858,11 +890,10 @@ void ath_radio_disable(struct ath_softc
int r;
ath9k_ps_wakeup(sc);
/*
* Keep the LED on when the radio is disabled
-@@ -872,13 +904,7 @@ void ath_radio_disable(struct ath_softc
+@@ -873,13 +904,7 @@ void ath_radio_disable(struct ath_softc
ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
}
if (!ah->curchan)
ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
-@@ -900,49 +926,11 @@ void ath_radio_disable(struct ath_softc
+@@ -901,49 +926,11 @@ void ath_radio_disable(struct ath_softc
static int ath_reset(struct ath_softc *sc, bool retry_tx)
{
if (retry_tx) {
int i;
-@@ -955,12 +943,6 @@ static int ath_reset(struct ath_softc *s
+@@ -956,12 +943,6 @@ static int ath_reset(struct ath_softc *s
}
}
ath9k_ps_restore(sc);
return r;
-@@ -970,9 +952,7 @@ void ath_reset_work(struct work_struct *
+@@ -971,9 +952,7 @@ void ath_reset_work(struct work_struct *
{
struct ath_softc *sc = container_of(work, struct ath_softc, hw_check_work);
}
void ath_hw_check(struct work_struct *work)
-@@ -993,11 +973,8 @@ void ath_hw_check(struct work_struct *wo
+@@ -994,11 +973,8 @@ void ath_hw_check(struct work_struct *wo
ath_dbg(common, ATH_DBG_RESET, "Possible baseband hang, "
"busy=%d (try %d)\n", busy, sc->hw_busy_count + 1);
if (busy >= 99) {
} else if (busy >= 0)
sc->hw_busy_count = 0;
-@@ -1017,9 +994,7 @@ static void ath_hw_pll_rx_hang_check(str
+@@ -1018,9 +994,7 @@ static void ath_hw_pll_rx_hang_check(str
/* Rx is hung for more than 500ms. Reset it */
ath_dbg(common, ATH_DBG_RESET,
"Possible RX hang, resetting");
count = 0;
}
} else
-@@ -1090,28 +1065,6 @@ static int ath9k_start(struct ieee80211_
+@@ -1091,28 +1065,6 @@ static int ath9k_start(struct ieee80211_
goto mutex_unlock;
}
/* Setup our intr mask. */
ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL |
ATH9K_INT_RXORN | ATH9K_INT_FATAL |
-@@ -1134,12 +1087,14 @@ static int ath9k_start(struct ieee80211_
+@@ -1135,12 +1087,14 @@ static int ath9k_start(struct ieee80211_
/* Disable BMISS interrupt when we're not associated */
ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
if ((ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE) &&
!ah->btcoex_hw.enabled) {
-@@ -1232,10 +1187,7 @@ static void ath9k_stop(struct ieee80211_
+@@ -1233,11 +1187,7 @@ static void ath9k_stop(struct ieee80211_
mutex_lock(&sc->mutex);
- cancel_delayed_work_sync(&sc->hw_pll_work);
- cancel_work_sync(&sc->paprd_work);
- cancel_work_sync(&sc->hw_check_work);
+- cancel_work_sync(&sc->hw_reset_work);
+ ath_cancel_work(sc);
if (sc->sc_flags & SC_OP_INVALID) {
ath_dbg(common, ATH_DBG_ANY, "Device not present\n");
-@@ -2352,9 +2304,11 @@ static void ath9k_flush(struct ieee80211
+@@ -2354,9 +2304,11 @@ static void ath9k_flush(struct ieee80211
ath9k_ps_wakeup(sc);
spin_lock_bh(&sc->sc_pcu_lock);
drain_txq = ath_drain_all_txq(sc, false);
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1368,10 +1368,16 @@ static bool ath9k_hw_set_reset_reg(struc
+@@ -1371,10 +1371,16 @@ static bool ath9k_hw_set_reset_reg(struc
static bool ath9k_hw_chip_reset(struct ath_hw *ah,
struct ath9k_channel *chan)
{