1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -1271,16 +1271,14 @@ bool ath_drain_all_txq(struct ath_softc
4 if (sc->sc_flags & SC_OP_INVALID)
7 - /* Stop beacon queue */
8 - ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
9 + ath9k_hw_abort_tx_dma(ah);
11 - /* Stop data queues */
12 + /* Check if any queue remains active */
13 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
14 - if (ATH_TXQ_SETUP(sc, i)) {
15 - txq = &sc->tx.txq[i];
16 - ath9k_hw_stoptxdma(ah, txq->axq_qnum);
17 - npend += ath9k_hw_numtxpending(ah, txq->axq_qnum);
19 + if (!ATH_TXQ_SETUP(sc, i))
22 + npend += ath9k_hw_numtxpending(ah, sc->tx.txq[i].axq_qnum);
26 --- a/drivers/net/wireless/ath/ath9k/mac.c
27 +++ b/drivers/net/wireless/ath/ath9k/mac.c
28 @@ -143,6 +143,34 @@ bool ath9k_hw_updatetxtriglevel(struct a
30 EXPORT_SYMBOL(ath9k_hw_updatetxtriglevel);
32 +void ath9k_hw_abort_tx_dma(struct ath_hw *ah)
36 + REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M);
38 + REG_SET_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF);
39 + REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH);
40 + REG_SET_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF);
42 + for (q = 0; q < AR_NUM_QCU; q++) {
43 + for (i = 0; i < 1000; i++) {
47 + if (!ath9k_hw_numtxpending(ah, q))
52 + REG_CLR_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF);
53 + REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH);
54 + REG_CLR_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF);
56 + REG_WRITE(ah, AR_Q_TXD, 0);
58 +EXPORT_SYMBOL(ath9k_hw_abort_tx_dma);
60 bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q)
62 #define ATH9K_TX_STOP_DMA_TIMEOUT 4000 /* usec */
63 --- a/drivers/net/wireless/ath/ath9k/mac.h
64 +++ b/drivers/net/wireless/ath/ath9k/mac.h
65 @@ -676,6 +676,7 @@ void ath9k_hw_cleartxdesc(struct ath_hw
66 u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q);
67 bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel);
68 bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q);
69 +void ath9k_hw_abort_tx_dma(struct ath_hw *ah);
70 void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs);
71 bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q,
72 const struct ath9k_tx_queue_info *qinfo);