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,33 @@ 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 = 1000; i > 0; i--) {
44 + if (!ath9k_hw_numtxpending(ah, q))
51 + REG_CLR_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF);
52 + REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH);
53 + REG_CLR_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF);
55 + REG_WRITE(ah, AR_Q_TXD, 0);
57 +EXPORT_SYMBOL(ath9k_hw_abort_tx_dma);
59 bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q)
61 #define ATH9K_TX_STOP_DMA_TIMEOUT 4000 /* usec */
62 --- a/drivers/net/wireless/ath/ath9k/mac.h
63 +++ b/drivers/net/wireless/ath/ath9k/mac.h
64 @@ -676,6 +676,7 @@ void ath9k_hw_cleartxdesc(struct ath_hw
65 u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q);
66 bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel);
67 bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q);
68 +void ath9k_hw_abort_tx_dma(struct ath_hw *ah);
69 void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs);
70 bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q,
71 const struct ath9k_tx_queue_info *qinfo);