58d972cb031b734e5754084c50736005da51ad59
[openwrt-10.03/.git] / package / mac80211 / patches / 580-ath9k_remove_common_chainmask.patch
1 --- a/drivers/net/wireless/ath/ath.h
2 +++ b/drivers/net/wireless/ath/ath.h
3 @@ -140,9 +140,6 @@ struct ath_common {
4         u8 curbssid[ETH_ALEN];
5         u8 bssidmask[ETH_ALEN];
6  
7 -       u8 tx_chainmask;
8 -       u8 rx_chainmask;
9 -
10         u32 rx_bufsize;
11  
12         u32 keymax;
13 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
14 +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
15 @@ -113,7 +113,7 @@ static int ar9003_get_training_power_5g(
16         if (delta > scale)
17                 return -1;
18  
19 -       switch (get_streams(common->tx_chainmask)) {
20 +       switch (get_streams(ah->txchainmask)) {
21         case 1:
22                 delta = 6;
23                 break;
24 @@ -126,7 +126,7 @@ static int ar9003_get_training_power_5g(
25         default:
26                 delta = 0;
27                 ath_dbg(common, ATH_DBG_CALIBRATE,
28 -               "Invalid tx-chainmask: %u\n", common->tx_chainmask);
29 +               "Invalid tx-chainmask: %u\n", ah->txchainmask);
30         }
31  
32         power += delta;
33 --- a/drivers/net/wireless/ath/ath9k/main.c
34 +++ b/drivers/net/wireless/ath/ath9k/main.c
35 @@ -318,7 +318,6 @@ static void ath_paprd_activate(struct at
36  {
37         struct ath_hw *ah = sc->sc_ah;
38         struct ath9k_hw_cal_data *caldata = ah->caldata;
39 -       struct ath_common *common = ath9k_hw_common(ah);
40         int chain;
41  
42         if (!caldata || !caldata->paprd_done)
43 @@ -327,7 +326,7 @@ static void ath_paprd_activate(struct at
44         ath9k_ps_wakeup(sc);
45         ar9003_paprd_enable(ah, false);
46         for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
47 -               if (!(common->tx_chainmask & BIT(chain)))
48 +               if (!(ah->txchainmask & BIT(chain)))
49                         continue;
50  
51                 ar9003_paprd_populate_single_table(ah, caldata, chain);
52 @@ -414,7 +413,7 @@ void ath_paprd_calibrate(struct work_str
53         memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN);
54  
55         for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
56 -               if (!(common->tx_chainmask & BIT(chain)))
57 +               if (!(ah->txchainmask & BIT(chain)))
58                         continue;
59  
60                 chain_ok = 0;
61 @@ -535,7 +534,7 @@ void ath_ani_calibrate(unsigned long dat
62         if (longcal || shortcal) {
63                 common->ani.caldone =
64                         ath9k_hw_calibrate(ah, ah->curchan,
65 -                                               common->rx_chainmask, longcal);
66 +                                               ah->rxchainmask, longcal);
67         }
68  
69         ath9k_ps_restore(sc);
70 --- a/drivers/net/wireless/ath/ath9k/hw.c
71 +++ b/drivers/net/wireless/ath/ath9k/hw.c
72 @@ -1488,9 +1488,6 @@ int ath9k_hw_reset(struct ath_hw *ah, st
73         u64 tsf = 0;
74         int i, r;
75  
76 -       ah->txchainmask = common->tx_chainmask;
77 -       ah->rxchainmask = common->rx_chainmask;
78 -
79         if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
80                 return -EIO;
81  
82 @@ -2108,6 +2105,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw
83  
84         pCap->tx_chainmask = fixup_chainmask(chip_chainmask, pCap->tx_chainmask);
85         pCap->rx_chainmask = fixup_chainmask(chip_chainmask, pCap->rx_chainmask);
86 +       ah->txchainmask = pCap->tx_chainmask;
87 +       ah->rxchainmask = pCap->rx_chainmask;
88  
89         ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA;
90  
91 --- a/drivers/net/wireless/ath/ath9k/xmit.c
92 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
93 @@ -1660,7 +1660,7 @@ u8 ath_txchainmask_reduction(struct ath_
94  
95  static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
96  {
97 -       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
98 +       struct ath_hw *ah = sc->sc_ah;
99         struct ath9k_11n_rate_series series[4];
100         struct sk_buff *skb;
101         struct ieee80211_tx_info *tx_info;
102 @@ -1720,7 +1720,7 @@ static void ath_buf_set_rate(struct ath_
103                         /* MCS rates */
104                         series[i].Rate = rix | 0x80;
105                         series[i].ChSel = ath_txchainmask_reduction(sc,
106 -                                       common->tx_chainmask, series[i].Rate);
107 +                                       ah->txchainmask, series[i].Rate);
108                         series[i].PktDuration = ath_pkt_duration(sc, rix, len,
109                                  is_40, is_sgi, is_sp);
110                         if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC))
111 @@ -1745,10 +1745,10 @@ static void ath_buf_set_rate(struct ath_
112                 }
113  
114                 if (bf->bf_state.bfs_paprd)
115 -                       series[i].ChSel = common->tx_chainmask;
116 +                       series[i].ChSel = ah->txchainmask;
117                 else
118                         series[i].ChSel = ath_txchainmask_reduction(sc,
119 -                                       common->tx_chainmask, series[i].Rate);
120 +                                       ah->txchainmask, series[i].Rate);
121  
122                 series[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah,
123                         phy, rate->bitrate * 100, len, rix, is_sp);
124 --- a/drivers/net/wireless/ath/ath9k/beacon.c
125 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
126 @@ -107,7 +107,7 @@ static void ath_beacon_setup(struct ath_
127         series[0].Tries = 1;
128         series[0].Rate = rate;
129         series[0].ChSel = ath_txchainmask_reduction(sc,
130 -                       common->tx_chainmask, series[0].Rate);
131 +                       ah->txchainmask, series[0].Rate);
132         series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0;
133         ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, ctsrate, ctsduration,
134                                      series, 4, 0);
135 --- a/drivers/net/wireless/ath/ath9k/debug.c
136 +++ b/drivers/net/wireless/ath/ath9k/debug.c
137 @@ -95,11 +95,11 @@ static ssize_t read_file_tx_chainmask(st
138                              size_t count, loff_t *ppos)
139  {
140         struct ath_softc *sc = file->private_data;
141 -       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
142 +       struct ath_hw *ah = sc->sc_ah;
143         char buf[32];
144         unsigned int len;
145  
146 -       len = sprintf(buf, "0x%08x\n", common->tx_chainmask);
147 +       len = sprintf(buf, "0x%08x\n", ah->txchainmask);
148         return simple_read_from_buffer(user_buf, count, ppos, buf, len);
149  }
150  
151 @@ -107,7 +107,7 @@ static ssize_t write_file_tx_chainmask(s
152                              size_t count, loff_t *ppos)
153  {
154         struct ath_softc *sc = file->private_data;
155 -       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
156 +       struct ath_hw *ah = sc->sc_ah;
157         unsigned long mask;
158         char buf[32];
159         ssize_t len;
160 @@ -120,8 +120,8 @@ static ssize_t write_file_tx_chainmask(s
161         if (strict_strtoul(buf, 0, &mask))
162                 return -EINVAL;
163  
164 -       common->tx_chainmask = mask;
165 -       sc->sc_ah->caps.tx_chainmask = mask;
166 +       ah->txchainmask = mask;
167 +       ah->caps.tx_chainmask = mask;
168         return count;
169  }
170  
171 @@ -138,11 +138,11 @@ static ssize_t read_file_rx_chainmask(st
172                              size_t count, loff_t *ppos)
173  {
174         struct ath_softc *sc = file->private_data;
175 -       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
176 +       struct ath_hw *ah = sc->sc_ah;
177         char buf[32];
178         unsigned int len;
179  
180 -       len = sprintf(buf, "0x%08x\n", common->rx_chainmask);
181 +       len = sprintf(buf, "0x%08x\n", ah->rxchainmask);
182         return simple_read_from_buffer(user_buf, count, ppos, buf, len);
183  }
184  
185 @@ -150,7 +150,7 @@ static ssize_t write_file_rx_chainmask(s
186                              size_t count, loff_t *ppos)
187  {
188         struct ath_softc *sc = file->private_data;
189 -       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
190 +       struct ath_hw *ah = sc->sc_ah;
191         unsigned long mask;
192         char buf[32];
193         ssize_t len;
194 @@ -163,8 +163,8 @@ static ssize_t write_file_rx_chainmask(s
195         if (strict_strtoul(buf, 0, &mask))
196                 return -EINVAL;
197  
198 -       common->rx_chainmask = mask;
199 -       sc->sc_ah->caps.rx_chainmask = mask;
200 +       ah->rxchainmask = mask;
201 +       ah->caps.rx_chainmask = mask;
202         return count;
203  }
204  
205 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
206 +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
207 @@ -509,8 +509,8 @@ static void setup_ht_cap(struct ath9k_ht
208         memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
209  
210         /* ath9k_htc supports only 1 or 2 stream devices */
211 -       tx_streams = ath9k_cmn_count_streams(common->tx_chainmask, 2);
212 -       rx_streams = ath9k_cmn_count_streams(common->rx_chainmask, 2);
213 +       tx_streams = ath9k_cmn_count_streams(priv->ah->txchainmask, 2);
214 +       rx_streams = ath9k_cmn_count_streams(priv->ah->rxchainmask, 2);
215  
216         ath_dbg(common, ATH_DBG_CONFIG,
217                 "TX streams %d, RX streams: %d\n",
218 @@ -601,9 +601,6 @@ static void ath9k_init_misc(struct ath9k
219  {
220         struct ath_common *common = ath9k_hw_common(priv->ah);
221  
222 -       common->tx_chainmask = priv->ah->caps.tx_chainmask;
223 -       common->rx_chainmask = priv->ah->caps.rx_chainmask;
224 -
225         memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
226  
227         priv->ah->opmode = NL80211_IFTYPE_STATION;
228 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
229 +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
230 @@ -826,8 +826,7 @@ void ath9k_htc_ani_work(struct work_stru
231                 if (longcal || shortcal)
232                         common->ani.caldone =
233                                 ath9k_hw_calibrate(ah, ah->curchan,
234 -                                                  common->rx_chainmask,
235 -                                                  longcal);
236 +                                                  ah->rxchainmask, longcal);
237  
238                 ath9k_htc_ps_restore(priv);
239         }
240 --- a/drivers/net/wireless/ath/ath9k/init.c
241 +++ b/drivers/net/wireless/ath/ath9k/init.c
242 @@ -270,8 +270,8 @@ static void setup_ht_cap(struct ath_soft
243  
244         /* set up supported mcs set */
245         memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
246 -       tx_streams = ath9k_cmn_count_streams(common->tx_chainmask, max_streams);
247 -       rx_streams = ath9k_cmn_count_streams(common->rx_chainmask, max_streams);
248 +       tx_streams = ath9k_cmn_count_streams(ah->txchainmask, max_streams);
249 +       rx_streams = ath9k_cmn_count_streams(ah->rxchainmask, max_streams);
250  
251         ath_dbg(common, ATH_DBG_CONFIG,
252                 "TX streams %d, RX streams: %d\n",
253 @@ -506,9 +506,6 @@ static void ath9k_init_misc(struct ath_s
254                 sc->sc_flags |= SC_OP_RXAGGR;
255         }
256  
257 -       common->tx_chainmask = sc->sc_ah->caps.tx_chainmask;
258 -       common->rx_chainmask = sc->sc_ah->caps.rx_chainmask;
259 -
260         ath9k_hw_set_diversity(sc->sc_ah, true);
261         sc->rx.defant = ath9k_hw_getdefantenna(sc->sc_ah);
262  
263 @@ -645,10 +642,8 @@ static void ath9k_init_band_txpower(stru
264  static void ath9k_init_txpower_limits(struct ath_softc *sc)
265  {
266         struct ath_hw *ah = sc->sc_ah;
267 -       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
268         struct ath9k_channel *curchan = ah->curchan;
269  
270 -       ah->txchainmask = common->tx_chainmask;
271         if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
272                 ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ);
273         if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)