072e657e2e4491058f680074fe0e9f48fa14f0a4
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 571-ath9k_fix_dma_stop.patch
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)
5 return true;
6
7 - /* Stop beacon queue */
8 - ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
9 + ath9k_hw_abort_tx_dma(ah);
10
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);
18 - }
19 + if (!ATH_TXQ_SETUP(sc, i))
20 + continue;
21 +
22 + npend += ath9k_hw_numtxpending(ah, sc->tx.txq[i].axq_qnum);
23 }
24
25 if (npend)
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
29 }
30 EXPORT_SYMBOL(ath9k_hw_updatetxtriglevel);
31
32 +void ath9k_hw_abort_tx_dma(struct ath_hw *ah)
33 +{
34 + int i, q;
35 +
36 + REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M);
37 +
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);
41 +
42 + for (q = 0; q < AR_NUM_QCU; q++) {
43 + for (i = 1000; i > 0; i--) {
44 + if (!ath9k_hw_numtxpending(ah, q))
45 + break;
46 +
47 + udelay(5);
48 + }
49 + }
50 +
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);
54 +
55 + REG_WRITE(ah, AR_Q_TXD, 0);
56 +}
57 +EXPORT_SYMBOL(ath9k_hw_abort_tx_dma);
58 +
59 bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q)
60 {
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);