ath9k: merge a pending patch for fixing tsf read and write
[openwrt.git] / package / mac80211 / patches / 320-ath9k_pending_work.patch
1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -1685,17 +1685,20 @@ static void ath_tx_start_dma(struct ath_
4         struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
5         struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
6         struct list_head bf_head;
7 -       struct ath_atx_tid *tid;
8 +       struct ath_atx_tid *tid = NULL;
9         u8 tidno;
10  
11         spin_lock_bh(&txctl->txq->axq_lock);
12  
13 -       if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && txctl->an) {
14 +       if (ieee80211_is_data_qos(hdr->frame_control) && txctl->an) {
15                 tidno = ieee80211_get_qos_ctl(hdr)[0] &
16                         IEEE80211_QOS_CTL_TID_MASK;
17                 tid = ATH_AN_2_TID(txctl->an, tidno);
18  
19                 WARN_ON(tid->ac->txq != txctl->txq);
20 +       }
21 +
22 +       if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && tid) {
23                 /*
24                  * Try aggregation if it's a unicast data frame
25                  * and the destination is HT capable.
26 @@ -1712,7 +1715,7 @@ static void ath_tx_start_dma(struct ath_
27                         ar9003_hw_set_paprd_txdesc(sc->sc_ah, bf->bf_desc,
28                                                    bf->bf_state.bfs_paprd);
29  
30 -               ath_tx_send_normal(sc, txctl->txq, NULL, &bf_head);
31 +               ath_tx_send_normal(sc, txctl->txq, tid, &bf_head);
32         }
33  
34         spin_unlock_bh(&txctl->txq->axq_lock);
35 --- a/drivers/net/wireless/ath/ath9k/hw.c
36 +++ b/drivers/net/wireless/ath/ath9k/hw.c
37 @@ -284,11 +284,9 @@ static void ath9k_hw_read_revisions(stru
38  
39  static void ath9k_hw_disablepcie(struct ath_hw *ah)
40  {
41 -       if (AR_SREV_9100(ah))
42 +       if (!AR_SREV_5416(ah))
43                 return;
44  
45 -       ENABLE_REGWRITE_BUFFER(ah);
46 -
47         REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00);
48         REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924);
49         REG_WRITE(ah, AR_PCIE_SERDES, 0x28000029);
50 @@ -300,8 +298,6 @@ static void ath9k_hw_disablepcie(struct 
51         REG_WRITE(ah, AR_PCIE_SERDES, 0x000e1007);
52  
53         REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
54 -
55 -       REGWRITE_BUFFER_FLUSH(ah);
56  }
57  
58  /* This should work for all families including legacy */
59 --- a/drivers/net/wireless/ath/ath9k/main.c
60 +++ b/drivers/net/wireless/ath/ath9k/main.c
61 @@ -1940,7 +1940,9 @@ static u64 ath9k_get_tsf(struct ieee8021
62         struct ath_softc *sc = aphy->sc;
63  
64         mutex_lock(&sc->mutex);
65 +       ath9k_ps_wakeup(sc);
66         tsf = ath9k_hw_gettsf64(sc->sc_ah);
67 +       ath9k_ps_restore(sc);
68         mutex_unlock(&sc->mutex);
69  
70         return tsf;
71 @@ -1952,7 +1954,9 @@ static void ath9k_set_tsf(struct ieee802
72         struct ath_softc *sc = aphy->sc;
73  
74         mutex_lock(&sc->mutex);
75 +       ath9k_ps_wakeup(sc);
76         ath9k_hw_settsf64(sc->sc_ah, tsf);
77 +       ath9k_ps_restore(sc);
78         mutex_unlock(&sc->mutex);
79  }
80