1 commit 6fb7eefaa4d8377e6b124435059656dd6f643e91
2 Author: Karl Beldan <karl.beldan@rivierawaves.com>
3 Date: Tue Oct 7 15:53:38 2014 +0200
5 mac80211/trivial: fix typo in starting baserate for rts_cts_rate_idx
7 Fixes: 5253ffb8 ("mac80211: always pick a basic rate to tx RTS/CTS for pre-HT rates")
8 Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
10 commit b18111d911980af52bead74ee45250cc96ad5108
11 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
12 Date: Tue Oct 7 10:14:37 2014 +0530
14 ath9k: Fix crash in MCC mode
16 When a channel context is removed, the hw_queue_base
17 is set to -1, this will result in a panic because
18 ath9k_chanctx_stop_queues() can be called on an interface
19 that is not assigned to any context yet - for example,
22 Fix this issue by setting the hw_queue_base to zero
23 when a channel context is removed.
25 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
26 Signed-off-by: John W. Linville <linville@tuxdriver.com>
28 commit e2cba8d7590e76661e86f1f0987ef9f8c13c9a6d
29 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
30 Date: Thu Oct 2 06:33:20 2014 +0530
32 ath9k: Fix flushing in MCC mode
34 When we are attempting to switch to a new
35 channel context, the TX queues are flushed, but
36 the mac80211 queues are not stopped and traffic
37 can still come down to the driver.
39 This patch fixes it by stopping the queues
40 assigned to the current context/vif before
43 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
44 Signed-off-by: John W. Linville <linville@tuxdriver.com>
46 commit 5ba8d9d2f018f2c4e23f9e68b90ca5b9d5470457
47 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
48 Date: Thu Oct 2 06:33:19 2014 +0530
50 ath9k: Fix queue handling for channel contexts
52 When a full chip reset is done, all the queues
53 across all VIFs are stopped, but if MCC is enabled,
54 only the queues of the current context is awakened,
55 when we complete the reset.
57 This results in unfairness for the inactive context.
58 Since frames are queued internally in the driver if
59 there is a context mismatch, we can awaken all the
60 queues when coming out of a reset.
62 The VIF-specific queues are still used in flow control,
63 to ensure fairness when traffic is high.
65 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
66 Signed-off-by: John W. Linville <linville@tuxdriver.com>
68 commit a064eaa10ca4ec58d5a405c9a7f87efc6d2fa423
69 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
70 Date: Thu Oct 2 06:33:18 2014 +0530
72 ath9k: Add ath9k_chanctx_stop_queues()
74 This can be used when the queues of a context
77 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
78 Signed-off-by: John W. Linville <linville@tuxdriver.com>
80 commit b39031536aab9cb1324328cf46fa4ef940bd975f
81 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
82 Date: Thu Oct 2 06:33:17 2014 +0530
84 ath9k: Pass context to ath9k_chanctx_wake_queues()
86 Change the ath9k_chanctx_wake_queues() API so
87 that we can pass the channel context that needs its
90 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
91 Signed-off-by: John W. Linville <linville@tuxdriver.com>
93 commit 4f82eecf73019c27537f65c160e90385e159afd8
94 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
95 Date: Thu Oct 2 06:33:16 2014 +0530
97 ath9k: Fix queue handling in flush()
99 When draining of the TX queues fails, a
100 full HW reset is done. ath_reset() makes sure
101 that the queues in mac80211 are restarted,
102 so there is no need to wake them up again.
104 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
105 Signed-off-by: John W. Linville <linville@tuxdriver.com>
107 commit 60913f4d2951f6410eed969aae4717c7ced37044
108 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
109 Date: Thu Oct 2 06:33:15 2014 +0530
111 ath9k: Remove duplicate code
113 ath9k_has_tx_pending() can be used to
114 check if there are pending frames instead
115 of having duplicate code.
117 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
118 Signed-off-by: John W. Linville <linville@tuxdriver.com>
120 commit fc1314c75e0558c03cb434e2af2c257caa201e76
121 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
122 Date: Thu Oct 2 06:33:14 2014 +0530
124 ath9k: Fix pending frame check
126 Checking for the queue depth outside of
127 the TX queue lock is incorrect and in this
128 case, is not required since it is done inside
129 ath9k_has_pending_frames().
131 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
132 Signed-off-by: John W. Linville <linville@tuxdriver.com>
134 commit b736728575af03488388e84fceac7bf0eac5dbb6
135 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
136 Date: Thu Oct 2 06:33:13 2014 +0530
138 ath9k: Check pending frames properly
140 There is no need to check if the current
141 channel context has active ACs queued up
142 if the TX queue is not empty.
144 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
145 Signed-off-by: John W. Linville <linville@tuxdriver.com>
147 commit 4b60af4ab4363bd79eeba94bb6bed396cf2aaf62
148 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
149 Date: Thu Oct 2 06:33:12 2014 +0530
151 ath9k: Print RoC expiration
153 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
154 Signed-off-by: John W. Linville <linville@tuxdriver.com>
156 commit 4d9f634b02e4240f86719f30e4c9e62f6a4c4d36
157 Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
158 Date: Tue Sep 30 14:15:23 2014 +0530
160 ath9k: Check early for HW reset
162 chan_lock is not required for checking if
163 we are in the middle of a HW reset, so do it
164 early. This also removes the small window
165 where the lock is dropped and reacquired.
167 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
168 Signed-off-by: John W. Linville <linville@tuxdriver.com>
170 commit c393d179924685d5c8c72446c5b6401f25fdb2a0
171 Author: Marek Puzyniak <marek.puzyniak@tieto.com>
172 Date: Tue Oct 7 17:04:30 2014 +0200
174 ath9k_htc: avoid kernel panic in ath9k_hw_reset
176 hw pointer of ath_hw is not assigned to proper value
177 in function ath9k_hw_reset what finally causes kernel panic.
178 This can be solved by proper initialization of ath_hw in
181 Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
182 Acked-by: Oleksij Rempel <linux@rempel-privat.de>
183 Signed-off-by: John W. Linville <linville@tuxdriver.com>
185 commit 065e0b64f71632f5ad7f00c102fde09c534cfbf0
186 Author: Felix Fietkau <nbd@openwrt.org>
187 Date: Tue Sep 30 11:00:33 2014 +0200
189 ath9k: fix getting tx duration for dynack
191 On AR9003, tx control and tx status are in separate descriptor rings.
192 Tx duration is extracted from the tx control descriptor data, which
193 ar9003_hw_proc_txdesc cannot access.
195 Fix getting the duration by adding a separate callback for it.
197 Acked-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
198 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
200 commit fdf9a4517b60d847b9bc0a30249efd96559fa450
201 Author: Felix Fietkau <nbd@openwrt.org>
202 Date: Tue Sep 9 09:48:30 2014 +0200
204 ath9k_hw: fix PLL clock initialization for newer SoC
206 On AR934x and newer SoC devices, the layout of the AR_RTC_PLL_CONTROL
207 register changed. This currently breaks at least 5/10 MHz operation.
208 AR933x uses the old layout.
210 It might also have been causing other stability issues because of the
211 different location of the PLL_BYPASS bit which needs to be set during
212 PLL clock initialization.
214 This patch also removes more instances of hardcoded register values in
215 favor of properly computed ones with the PLL_BYPASS bit added.
217 Reported-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
218 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
220 commit b6d1f51cd8bdc9d952147a960fbf1f261d8e4188
221 Author: Felix Fietkau <nbd@openwrt.org>
222 Date: Mon Sep 8 18:35:08 2014 +0200
224 ath9k_hw: reduce ANI spur immunity setting on HT40 extension channel
226 The cycpwr_thr1 value needs to be lower on the extension channel than on
227 the control channel, similar to how the register settings are programmed
230 Also drop the unnecessary check for HT40 - this register can always be
231 written. This patch has been reported to improve HT40 stability and
232 throughput in some environments.
234 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
236 commit 5ad2dfbaa19aa45d29184d30c8c5dae0e110074a
237 Author: Felix Fietkau <nbd@openwrt.org>
238 Date: Mon Sep 8 18:31:26 2014 +0200
240 Revert "ath9k_hw: reduce ANI firstep range for older chips"
242 This reverts commit 09efc56345be4146ab9fc87a55c837ed5d6ea1ab
244 I've received reports that this change is decreasing throughput in some
245 rare conditions on an AR9280 based device
247 Cc: stable@vger.kernel.org
248 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
250 commit 4c82fc569cf2f29e6c66d98ef4a1b0f3b6a98e9d
251 Author: Felix Fietkau <nbd@openwrt.org>
252 Date: Sat Sep 27 22:39:27 2014 +0200
254 ath9k_hw: disable hardware ad-hoc flag on ar934x rev 3
256 On AR934x rev 3, settin the ad-hoc flag completely messes up hardware
257 state - beacons get stuck, almost no packets make it out, hardware is
260 When leaving out that flag and setting up the hw like in AP mode, TSF
261 timers won't be automatically synced, but at least the rest works.
263 AR934x rev 2 and older are not affected by this bug
265 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
267 commit ecfb4b3fff006372ac5c40871f9bb182fd00444f
268 Author: Felix Fietkau <nbd@openwrt.org>
269 Date: Sat Sep 27 22:15:43 2014 +0200
271 ath9k: use ah->get_mac_revision for all SoC devices if available
273 It is needed for AR934x as well
275 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
277 commit c11113bc25df22898fb995d3205bdc4f27c98073
278 Author: Felix Fietkau <nbd@openwrt.org>
279 Date: Sat Sep 27 18:04:58 2014 +0200
281 ath5k: add missing include for debug code
283 Needed for calling vmalloc()/vfree()
285 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
287 commit 83f76a9f9a42773c7eef90bb86b4b2c16b0b3755
288 Author: Felix Fietkau <nbd@openwrt.org>
289 Date: Sat Sep 27 15:58:51 2014 +0200
291 ath5k: fix AHB kconfig dependency
293 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
295 commit ddd67f2a5cfd73fad4b78190025402d419b9f0a9
296 Author: Felix Fietkau <nbd@openwrt.org>
297 Date: Sat Sep 27 15:57:09 2014 +0200
299 Revert "ath5k: Remove AHB bus support"
301 This reverts commit 093ec3c5337434f40d77c1af06c139da3e5ba6dc.
303 --- a/drivers/net/wireless/ath/ath5k/Kconfig
304 +++ b/drivers/net/wireless/ath/ath5k/Kconfig
305 @@ -2,12 +2,14 @@ config ATH5K
306 tristate "Atheros 5xxx wireless cards support"
308 depends on PCI && MAC80211
309 + depends on (PCI || ATHEROS_AR231X) && MAC80211
312 select BACKPORT_LEDS_CLASS
313 select BACKPORT_NEW_LEDS
314 select BACKPORT_AVERAGE
316 + select ATH5K_AHB if ATHEROS_AR231X
317 + select ATH5K_PCI if !ATHEROS_AR231X
319 This module adds support for wireless adapters based on
320 Atheros 5xxx chipset.
321 @@ -52,9 +54,16 @@ config ATH5K_TRACER
326 + bool "Atheros 5xxx AHB bus support"
327 + depends on ATHEROS_AR231X
329 + This adds support for WiSoC type chipsets of the 5xxx Atheros
333 bool "Atheros 5xxx PCI bus support"
335 + depends on !ATHEROS_AR231X
337 This adds support for PCI type chipsets of the 5xxx Atheros
340 +++ b/drivers/net/wireless/ath/ath5k/ahb.c
343 + * Copyright (c) 2008-2009 Atheros Communications Inc.
344 + * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
345 + * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
347 + * Permission to use, copy, modify, and/or distribute this software for any
348 + * purpose with or without fee is hereby granted, provided that the above
349 + * copyright notice and this permission notice appear in all copies.
351 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
352 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
353 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
354 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
355 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
356 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
357 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
360 +#include <linux/nl80211.h>
361 +#include <linux/platform_device.h>
362 +#include <linux/etherdevice.h>
363 +#include <linux/export.h>
364 +#include <ar231x_platform.h>
370 +/* return bus cachesize in 4B word units */
371 +static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
373 + *csz = L1_CACHE_BYTES >> 2;
377 +ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
379 + struct ath5k_hw *ah = common->priv;
380 + struct platform_device *pdev = to_platform_device(ah->dev);
381 + struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
382 + u16 *eeprom, *eeprom_end;
384 + eeprom = (u16 *) bcfg->radio;
385 + eeprom_end = ((void *) bcfg->config) + BOARD_CONFIG_BUFSZ;
388 + if (eeprom > eeprom_end)
395 +int ath5k_hw_read_srev(struct ath5k_hw *ah)
397 + struct platform_device *pdev = to_platform_device(ah->dev);
398 + struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
399 + ah->ah_mac_srev = bcfg->devid;
403 +static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
405 + struct platform_device *pdev = to_platform_device(ah->dev);
406 + struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
409 + if (to_platform_device(ah->dev)->id == 0)
410 + cfg_mac = bcfg->config->wlan0_mac;
412 + cfg_mac = bcfg->config->wlan1_mac;
414 + memcpy(mac, cfg_mac, ETH_ALEN);
418 +static const struct ath_bus_ops ath_ahb_bus_ops = {
419 + .ath_bus_type = ATH_AHB,
420 + .read_cachesize = ath5k_ahb_read_cachesize,
421 + .eeprom_read = ath5k_ahb_eeprom_read,
422 + .eeprom_read_mac = ath5k_ahb_eeprom_read_mac,
426 +static int ath_ahb_probe(struct platform_device *pdev)
428 + struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
429 + struct ath5k_hw *ah;
430 + struct ieee80211_hw *hw;
431 + struct resource *res;
437 + if (!dev_get_platdata(&pdev->dev)) {
438 + dev_err(&pdev->dev, "no platform data specified\n");
443 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
445 + dev_err(&pdev->dev, "no memory resource found\n");
450 + mem = ioremap_nocache(res->start, resource_size(res));
452 + dev_err(&pdev->dev, "ioremap failed\n");
457 + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
459 + dev_err(&pdev->dev, "no IRQ resource found\n");
466 + hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops);
468 + dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
475 + ah->dev = &pdev->dev;
478 + ah->devid = bcfg->devid;
480 + if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
481 + /* Enable WMAC AHB arbitration */
482 + reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
483 + reg |= AR5K_AR2315_AHB_ARB_CTL_WLAN;
484 + iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
486 + /* Enable global WMAC swapping */
487 + reg = ioread32((void __iomem *) AR5K_AR2315_BYTESWAP);
488 + reg |= AR5K_AR2315_BYTESWAP_WMAC;
489 + iowrite32(reg, (void __iomem *) AR5K_AR2315_BYTESWAP);
491 + /* Enable WMAC DMA access (assuming 5312 or 231x*/
492 + /* TODO: check other platforms */
493 + reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
494 + if (to_platform_device(ah->dev)->id == 0)
495 + reg |= AR5K_AR5312_ENABLE_WLAN0;
497 + reg |= AR5K_AR5312_ENABLE_WLAN1;
498 + iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
501 + * On a dual-band AR5312, the multiband radio is only
502 + * used as pass-through. Disable 2 GHz support in the
505 + if (to_platform_device(ah->dev)->id == 0 &&
506 + (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) ==
507 + (BD_WLAN1 | BD_WLAN0))
508 + ah->ah_capabilities.cap_needs_2GHz_ovr = true;
510 + ah->ah_capabilities.cap_needs_2GHz_ovr = false;
513 + ret = ath5k_init_ah(ah, &ath_ahb_bus_ops);
515 + dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
520 + platform_set_drvdata(pdev, hw);
525 + ieee80211_free_hw(hw);
532 +static int ath_ahb_remove(struct platform_device *pdev)
534 + struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
535 + struct ieee80211_hw *hw = platform_get_drvdata(pdev);
536 + struct ath5k_hw *ah;
544 + if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
545 + /* Disable WMAC AHB arbitration */
546 + reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
547 + reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN;
548 + iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
550 + /*Stop DMA access */
551 + reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
552 + if (to_platform_device(ah->dev)->id == 0)
553 + reg &= ~AR5K_AR5312_ENABLE_WLAN0;
555 + reg &= ~AR5K_AR5312_ENABLE_WLAN1;
556 + iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
559 + ath5k_deinit_ah(ah);
560 + iounmap(ah->iobase);
561 + ieee80211_free_hw(hw);
566 +static struct platform_driver ath_ahb_driver = {
567 + .probe = ath_ahb_probe,
568 + .remove = ath_ahb_remove,
570 + .name = "ar231x-wmac",
571 + .owner = THIS_MODULE,
575 +module_platform_driver(ath_ahb_driver);
576 --- a/drivers/net/wireless/ath/ath5k/ath5k.h
577 +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
578 @@ -1647,6 +1647,32 @@ static inline struct ath_regulatory *ath
579 return &(ath5k_hw_common(ah)->regulatory);
582 +#ifdef CONFIG_ATHEROS_AR231X
583 +#define AR5K_AR2315_PCI_BASE ((void __iomem *)0xb0100000)
585 +static inline void __iomem *ath5k_ahb_reg(struct ath5k_hw *ah, u16 reg)
587 + /* On AR2315 and AR2317 the PCI clock domain registers
588 + * are outside of the WMAC register space */
589 + if (unlikely((reg >= 0x4000) && (reg < 0x5000) &&
590 + (ah->ah_mac_srev >= AR5K_SREV_AR2315_R6)))
591 + return AR5K_AR2315_PCI_BASE + reg;
593 + return ah->iobase + reg;
596 +static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
598 + return ioread32(ath5k_ahb_reg(ah, reg));
601 +static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
603 + iowrite32(val, ath5k_ahb_reg(ah, reg));
608 static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
610 return ioread32(ah->iobase + reg);
611 @@ -1657,6 +1683,8 @@ static inline void ath5k_hw_reg_write(st
612 iowrite32(val, ah->iobase + reg);
617 static inline enum ath_bus_type ath5k_get_bus_type(struct ath5k_hw *ah)
619 return ath5k_hw_common(ah)->bus_ops->ath_bus_type;
620 --- a/drivers/net/wireless/ath/ath5k/base.c
621 +++ b/drivers/net/wireless/ath/ath5k/base.c
622 @@ -99,6 +99,15 @@ static int ath5k_reset(struct ath5k_hw *
625 static const struct ath5k_srev_name srev_names[] = {
626 +#ifdef CONFIG_ATHEROS_AR231X
627 + { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R2 },
628 + { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R7 },
629 + { "2313", AR5K_VERSION_MAC, AR5K_SREV_AR2313_R8 },
630 + { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R6 },
631 + { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R7 },
632 + { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R1 },
633 + { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R2 },
635 { "5210", AR5K_VERSION_MAC, AR5K_SREV_AR5210 },
636 { "5311", AR5K_VERSION_MAC, AR5K_SREV_AR5311 },
637 { "5311A", AR5K_VERSION_MAC, AR5K_SREV_AR5311A },
638 @@ -117,6 +126,7 @@ static const struct ath5k_srev_name srev
639 { "5418", AR5K_VERSION_MAC, AR5K_SREV_AR5418 },
640 { "2425", AR5K_VERSION_MAC, AR5K_SREV_AR2425 },
641 { "2417", AR5K_VERSION_MAC, AR5K_SREV_AR2417 },
643 { "xxxxx", AR5K_VERSION_MAC, AR5K_SREV_UNKNOWN },
644 { "5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110 },
645 { "5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111 },
646 @@ -132,6 +142,10 @@ static const struct ath5k_srev_name srev
647 { "5413", AR5K_VERSION_RAD, AR5K_SREV_RAD_5413 },
648 { "5424", AR5K_VERSION_RAD, AR5K_SREV_RAD_5424 },
649 { "5133", AR5K_VERSION_RAD, AR5K_SREV_RAD_5133 },
650 +#ifdef CONFIG_ATHEROS_AR231X
651 + { "2316", AR5K_VERSION_RAD, AR5K_SREV_RAD_2316 },
652 + { "2317", AR5K_VERSION_RAD, AR5K_SREV_RAD_2317 },
654 { "xxxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN },
657 --- a/drivers/net/wireless/ath/ath5k/led.c
658 +++ b/drivers/net/wireless/ath/ath5k/led.c
659 @@ -163,14 +163,20 @@ int ath5k_init_leds(struct ath5k_hw *ah)
662 struct ieee80211_hw *hw = ah->hw;
663 +#ifndef CONFIG_ATHEROS_AR231X
664 struct pci_dev *pdev = ah->pdev;
666 char name[ATH5K_LED_MAX_NAME_LEN + 1];
667 const struct pci_device_id *match;
672 +#ifdef CONFIG_ATHEROS_AR231X
675 match = pci_match_id(&ath5k_led_devices[0], pdev);
678 __set_bit(ATH_STAT_LEDSOFT, ah->status);
679 ah->led_pin = ATH_PIN(match->driver_data);
680 --- a/drivers/net/wireless/ath/ath5k/debug.c
681 +++ b/drivers/net/wireless/ath/ath5k/debug.c
684 #include <linux/seq_file.h>
685 #include <linux/list.h>
686 +#include <linux/vmalloc.h>
690 --- a/drivers/net/wireless/ath/ath9k/hw.c
691 +++ b/drivers/net/wireless/ath/ath9k/hw.c
692 @@ -222,31 +222,28 @@ static void ath9k_hw_read_revisions(stru
696 + if (ah->get_mac_revision)
697 + ah->hw_version.macRev = ah->get_mac_revision();
699 switch (ah->hw_version.devid) {
700 case AR5416_AR9100_DEVID:
701 ah->hw_version.macVersion = AR_SREV_VERSION_9100;
703 case AR9300_DEVID_AR9330:
704 ah->hw_version.macVersion = AR_SREV_VERSION_9330;
705 - if (ah->get_mac_revision) {
706 - ah->hw_version.macRev = ah->get_mac_revision();
708 + if (!ah->get_mac_revision) {
709 val = REG_READ(ah, AR_SREV);
710 ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
713 case AR9300_DEVID_AR9340:
714 ah->hw_version.macVersion = AR_SREV_VERSION_9340;
715 - val = REG_READ(ah, AR_SREV);
716 - ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
718 case AR9300_DEVID_QCA955X:
719 ah->hw_version.macVersion = AR_SREV_VERSION_9550;
721 case AR9300_DEVID_AR953X:
722 ah->hw_version.macVersion = AR_SREV_VERSION_9531;
723 - if (ah->get_mac_revision)
724 - ah->hw_version.macRev = ah->get_mac_revision();
728 @@ -704,6 +701,8 @@ static void ath9k_hw_init_pll(struct ath
732 + pll = ath9k_hw_compute_pll_control(ah, chan);
734 if (AR_SREV_9485(ah) || AR_SREV_9565(ah)) {
735 /* program BB PLL ki and kd value, ki=0x4, kd=0x40 */
736 REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2,
737 @@ -754,7 +753,8 @@ static void ath9k_hw_init_pll(struct ath
738 REG_RMW_FIELD(ah, AR_CH0_DDR_DPLL3,
739 AR_CH0_DPLL3_PHASE_SHIFT, 0x1);
741 - REG_WRITE(ah, AR_RTC_PLL_CONTROL, 0x1142c);
742 + REG_WRITE(ah, AR_RTC_PLL_CONTROL,
743 + pll | AR_RTC_9300_PLL_BYPASS);
746 /* program refdiv, nint, frac to RTC register */
747 @@ -770,7 +770,8 @@ static void ath9k_hw_init_pll(struct ath
748 } else if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
749 u32 regval, pll2_divint, pll2_divfrac, refdiv;
751 - REG_WRITE(ah, AR_RTC_PLL_CONTROL, 0x1142c);
752 + REG_WRITE(ah, AR_RTC_PLL_CONTROL,
753 + pll | AR_RTC_9300_SOC_PLL_BYPASS);
756 REG_SET_BIT(ah, AR_PHY_PLL_MODE, 0x1 << 16);
757 @@ -843,7 +844,6 @@ static void ath9k_hw_init_pll(struct ath
761 - pll = ath9k_hw_compute_pll_control(ah, chan);
762 if (AR_SREV_9565(ah))
764 REG_WRITE(ah, AR_RTC_PLL_CONTROL, pll);
765 @@ -1192,9 +1192,12 @@ static void ath9k_hw_set_operating_mode(
768 case NL80211_IFTYPE_ADHOC:
769 - set |= AR_STA_ID1_ADHOC;
770 - REG_SET_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION);
772 + if (!AR_SREV_9340_13(ah)) {
773 + set |= AR_STA_ID1_ADHOC;
774 + REG_SET_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION);
778 case NL80211_IFTYPE_MESH_POINT:
779 case NL80211_IFTYPE_AP:
780 set |= AR_STA_ID1_STA_AP;
781 --- a/drivers/net/wireless/ath/ath9k/reg.h
782 +++ b/drivers/net/wireless/ath/ath9k/reg.h
784 #define AR_SREV_9340(_ah) \
785 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340))
787 +#define AR_SREV_9340_13(_ah) \
788 + (AR_SREV_9340((_ah)) && \
789 + ((_ah)->hw_version.macRev == AR_SREV_REVISION_9340_13))
791 #define AR_SREV_9340_13_OR_LATER(_ah) \
792 (AR_SREV_9340((_ah)) && \
793 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9340_13))
794 @@ -1240,12 +1244,23 @@ enum {
795 #define AR_CH0_DPLL3_PHASE_SHIFT_S 23
796 #define AR_PHY_CCA_NOM_VAL_2GHZ -118
798 +#define AR_RTC_9300_SOC_PLL_DIV_INT 0x0000003f
799 +#define AR_RTC_9300_SOC_PLL_DIV_INT_S 0
800 +#define AR_RTC_9300_SOC_PLL_DIV_FRAC 0x000fffc0
801 +#define AR_RTC_9300_SOC_PLL_DIV_FRAC_S 6
802 +#define AR_RTC_9300_SOC_PLL_REFDIV 0x01f00000
803 +#define AR_RTC_9300_SOC_PLL_REFDIV_S 20
804 +#define AR_RTC_9300_SOC_PLL_CLKSEL 0x06000000
805 +#define AR_RTC_9300_SOC_PLL_CLKSEL_S 25
806 +#define AR_RTC_9300_SOC_PLL_BYPASS 0x08000000
808 #define AR_RTC_9300_PLL_DIV 0x000003ff
809 #define AR_RTC_9300_PLL_DIV_S 0
810 #define AR_RTC_9300_PLL_REFDIV 0x00003C00
811 #define AR_RTC_9300_PLL_REFDIV_S 10
812 #define AR_RTC_9300_PLL_CLKSEL 0x0000C000
813 #define AR_RTC_9300_PLL_CLKSEL_S 14
814 +#define AR_RTC_9300_PLL_BYPASS 0x00010000
816 #define AR_RTC_9160_PLL_DIV 0x000003ff
817 #define AR_RTC_9160_PLL_DIV_S 0
818 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
819 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
820 @@ -1004,9 +1004,11 @@ static bool ar5008_hw_ani_control_new(st
821 case ATH9K_ANI_FIRSTEP_LEVEL:{
826 REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
827 AR_PHY_FIND_SIG_FIRSTEP, value);
828 + REG_RMW_FIELD(ah, AR_PHY_FIND_SIG_LOW,
829 + AR_PHY_FIND_SIG_FIRSTEP_LOW, value);
831 if (level != aniState->firstepLevel) {
833 @@ -1040,9 +1042,8 @@ static bool ar5008_hw_ani_control_new(st
834 REG_RMW_FIELD(ah, AR_PHY_TIMING5,
835 AR_PHY_TIMING5_CYCPWR_THR1, value);
837 - if (IS_CHAN_HT40(ah->curchan))
838 - REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
839 - AR_PHY_EXT_TIMING5_CYCPWR_THR1, value);
840 + REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
841 + AR_PHY_EXT_TIMING5_CYCPWR_THR1, value - 1);
843 if (level != aniState->spurImmunityLevel) {
845 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
846 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
847 @@ -517,6 +517,23 @@ static void ar9003_hw_spur_mitigate(stru
848 ar9003_hw_spur_mitigate_ofdm(ah, chan);
851 +static u32 ar9003_hw_compute_pll_control_soc(struct ath_hw *ah,
852 + struct ath9k_channel *chan)
856 + pll = SM(0x5, AR_RTC_9300_SOC_PLL_REFDIV);
858 + if (chan && IS_CHAN_HALF_RATE(chan))
859 + pll |= SM(0x1, AR_RTC_9300_SOC_PLL_CLKSEL);
860 + else if (chan && IS_CHAN_QUARTER_RATE(chan))
861 + pll |= SM(0x2, AR_RTC_9300_SOC_PLL_CLKSEL);
863 + pll |= SM(0x2c, AR_RTC_9300_SOC_PLL_DIV_INT);
868 static u32 ar9003_hw_compute_pll_control(struct ath_hw *ah,
869 struct ath9k_channel *chan)
871 @@ -1781,7 +1798,12 @@ void ar9003_hw_attach_phy_ops(struct ath
873 priv_ops->rf_set_freq = ar9003_hw_set_channel;
874 priv_ops->spur_mitigate_freq = ar9003_hw_spur_mitigate;
875 - priv_ops->compute_pll_control = ar9003_hw_compute_pll_control;
877 + if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah))
878 + priv_ops->compute_pll_control = ar9003_hw_compute_pll_control_soc;
880 + priv_ops->compute_pll_control = ar9003_hw_compute_pll_control;
882 priv_ops->set_channel_regs = ar9003_hw_set_channel_regs;
883 priv_ops->init_bb = ar9003_hw_init_bb;
884 priv_ops->process_ini = ar9003_hw_process_ini;
885 --- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
886 +++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
887 @@ -381,16 +381,27 @@ static int ar9002_hw_proc_txdesc(struct
888 ts->evm1 = ads->AR_TxEVM1;
889 ts->evm2 = ads->AR_TxEVM2;
891 - status = ACCESS_ONCE(ads->ds_ctl4);
892 - ts->duration[0] = MS(status, AR_PacketDur0);
893 - ts->duration[1] = MS(status, AR_PacketDur1);
894 - status = ACCESS_ONCE(ads->ds_ctl5);
895 - ts->duration[2] = MS(status, AR_PacketDur2);
896 - ts->duration[3] = MS(status, AR_PacketDur3);
901 +static int ar9002_hw_get_duration(struct ath_hw *ah, const void *ds, int index)
903 + struct ar5416_desc *ads = AR5416DESC(ds);
907 + return MS(ACCESS_ONCE(ads->ds_ctl4), AR_PacketDur0);
909 + return MS(ACCESS_ONCE(ads->ds_ctl4), AR_PacketDur1);
911 + return MS(ACCESS_ONCE(ads->ds_ctl5), AR_PacketDur2);
913 + return MS(ACCESS_ONCE(ads->ds_ctl5), AR_PacketDur3);
919 void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds,
922 @@ -413,4 +424,5 @@ void ar9002_hw_attach_mac_ops(struct ath
923 ops->get_isr = ar9002_hw_get_isr;
924 ops->set_txdesc = ar9002_set_txdesc;
925 ops->proc_txdesc = ar9002_hw_proc_txdesc;
926 + ops->get_duration = ar9002_hw_get_duration;
928 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
929 +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
930 @@ -355,11 +355,9 @@ static int ar9003_hw_proc_txdesc(struct
931 struct ath_tx_status *ts)
933 struct ar9003_txs *ads;
934 - struct ar9003_txc *adc;
937 ads = &ah->ts_ring[ah->ts_tail];
938 - adc = (struct ar9003_txc *)ads;
940 status = ACCESS_ONCE(ads->status8);
941 if ((status & AR_TxDone) == 0)
942 @@ -428,18 +426,29 @@ static int ar9003_hw_proc_txdesc(struct
943 ts->ts_rssi_ext1 = MS(status, AR_TxRSSIAnt11);
944 ts->ts_rssi_ext2 = MS(status, AR_TxRSSIAnt12);
946 - status = ACCESS_ONCE(adc->ctl15);
947 - ts->duration[0] = MS(status, AR_PacketDur0);
948 - ts->duration[1] = MS(status, AR_PacketDur1);
949 - status = ACCESS_ONCE(adc->ctl16);
950 - ts->duration[2] = MS(status, AR_PacketDur2);
951 - ts->duration[3] = MS(status, AR_PacketDur3);
953 memset(ads, 0, sizeof(*ads));
958 +static int ar9003_hw_get_duration(struct ath_hw *ah, const void *ds, int index)
960 + const struct ar9003_txc *adc = ds;
964 + return MS(ACCESS_ONCE(adc->ctl15), AR_PacketDur0);
966 + return MS(ACCESS_ONCE(adc->ctl15), AR_PacketDur1);
968 + return MS(ACCESS_ONCE(adc->ctl16), AR_PacketDur2);
970 + return MS(ACCESS_ONCE(adc->ctl16), AR_PacketDur3);
976 void ar9003_hw_attach_mac_ops(struct ath_hw *hw)
978 struct ath_hw_ops *ops = ath9k_hw_ops(hw);
979 @@ -449,6 +458,7 @@ void ar9003_hw_attach_mac_ops(struct ath
980 ops->get_isr = ar9003_hw_get_isr;
981 ops->set_txdesc = ar9003_set_txdesc;
982 ops->proc_txdesc = ar9003_hw_proc_txdesc;
983 + ops->get_duration = ar9003_hw_get_duration;
986 void ath9k_hw_set_rx_bufsize(struct ath_hw *ah, u16 buf_size)
987 --- a/drivers/net/wireless/ath/ath9k/dynack.c
988 +++ b/drivers/net/wireless/ath/ath9k/dynack.c
989 @@ -202,7 +202,7 @@ void ath_dynack_sample_tx_ts(struct ath_
990 ridx = ts->ts_rateindex;
992 da->st_rbf.ts[da->st_rbf.t_rb].tstamp = ts->ts_tstamp;
993 - da->st_rbf.ts[da->st_rbf.t_rb].dur = ts->duration[ts->ts_rateindex];
994 + da->st_rbf.ts[da->st_rbf.t_rb].dur = ts->duration;
995 ether_addr_copy(da->st_rbf.addr[da->st_rbf.t_rb].h_dest, hdr->addr1);
996 ether_addr_copy(da->st_rbf.addr[da->st_rbf.t_rb].h_src, hdr->addr2);
998 --- a/drivers/net/wireless/ath/ath9k/hw-ops.h
999 +++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
1000 @@ -67,6 +67,12 @@ static inline int ath9k_hw_txprocdesc(st
1001 return ath9k_hw_ops(ah)->proc_txdesc(ah, ds, ts);
1004 +static inline int ath9k_hw_get_duration(struct ath_hw *ah, const void *ds,
1007 + return ath9k_hw_ops(ah)->get_duration(ah, ds, index);
1010 static inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
1011 struct ath_hw_antcomb_conf *antconf)
1013 --- a/drivers/net/wireless/ath/ath9k/hw.h
1014 +++ b/drivers/net/wireless/ath/ath9k/hw.h
1015 @@ -691,6 +691,7 @@ struct ath_hw_ops {
1016 struct ath_tx_info *i);
1017 int (*proc_txdesc)(struct ath_hw *ah, void *ds,
1018 struct ath_tx_status *ts);
1019 + int (*get_duration)(struct ath_hw *ah, const void *ds, int index);
1020 void (*antdiv_comb_conf_get)(struct ath_hw *ah,
1021 struct ath_hw_antcomb_conf *antconf);
1022 void (*antdiv_comb_conf_set)(struct ath_hw *ah,
1023 --- a/drivers/net/wireless/ath/ath9k/mac.h
1024 +++ b/drivers/net/wireless/ath/ath9k/mac.h
1025 @@ -121,7 +121,7 @@ struct ath_tx_status {
1033 struct ath_rx_status {
1034 --- a/drivers/net/wireless/ath/ath9k/xmit.c
1035 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
1036 @@ -683,6 +683,8 @@ static void ath_tx_process_buffer(struct
1037 if (bf_is_ampdu_not_probing(bf))
1038 txq->axq_ampdu_depth--;
1040 + ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc,
1041 + ts->ts_rateindex);
1042 if (!bf_isampdu(bf)) {
1044 info = IEEE80211_SKB_CB(bf->bf_mpdu);
1045 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
1046 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
1047 @@ -455,7 +455,8 @@ void ath9k_p2p_bss_info_changed(struct a
1048 void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
1049 struct sk_buff *skb);
1050 void ath9k_p2p_ps_timer(void *priv);
1051 -void ath9k_chanctx_wake_queues(struct ath_softc *sc);
1052 +void ath9k_chanctx_wake_queues(struct ath_softc *sc, struct ath_chanctx *ctx);
1053 +void ath9k_chanctx_stop_queues(struct ath_softc *sc, struct ath_chanctx *ctx);
1054 void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx);
1056 void ath_chanctx_beacon_recv_ev(struct ath_softc *sc,
1057 @@ -525,7 +526,12 @@ static inline void ath9k_beacon_add_noa(
1058 static inline void ath9k_p2p_ps_timer(struct ath_softc *sc)
1061 -static inline void ath9k_chanctx_wake_queues(struct ath_softc *sc)
1062 +static inline void ath9k_chanctx_wake_queues(struct ath_softc *sc,
1063 + struct ath_chanctx *ctx)
1066 +static inline void ath9k_chanctx_stop_queues(struct ath_softc *sc,
1067 + struct ath_chanctx *ctx)
1070 static inline void ath_chanctx_check_active(struct ath_softc *sc,
1071 --- a/drivers/net/wireless/ath/ath9k/channel.c
1072 +++ b/drivers/net/wireless/ath/ath9k/channel.c
1073 @@ -761,6 +761,13 @@ void ath_offchannel_next(struct ath_soft
1075 void ath_roc_complete(struct ath_softc *sc, bool abort)
1077 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1080 + ath_dbg(common, CHAN_CTX, "RoC aborted\n");
1082 + ath_dbg(common, CHAN_CTX, "RoC expired\n");
1084 sc->offchannel.roc_vif = NULL;
1085 sc->offchannel.roc_chan = NULL;
1087 @@ -1037,9 +1044,11 @@ static void ath_offchannel_channel_chang
1088 void ath_chanctx_set_next(struct ath_softc *sc, bool force)
1090 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1091 + struct ath_chanctx *old_ctx;
1093 bool measure_time = false;
1094 bool send_ps = false;
1095 + bool queues_stopped = false;
1097 spin_lock_bh(&sc->chan_lock);
1098 if (!sc->next_chan) {
1099 @@ -1069,6 +1078,10 @@ void ath_chanctx_set_next(struct ath_sof
1100 getrawmonotonic(&ts);
1101 measure_time = true;
1104 + ath9k_chanctx_stop_queues(sc, sc->cur_chan);
1105 + queues_stopped = true;
1107 __ath9k_flush(sc->hw, ~0, true);
1109 if (ath_chanctx_send_ps_frame(sc, true))
1110 @@ -1082,6 +1095,7 @@ void ath_chanctx_set_next(struct ath_sof
1111 sc->cur_chan->tsf_val = ath9k_hw_gettsf64(sc->sc_ah);
1114 + old_ctx = sc->cur_chan;
1115 sc->cur_chan = sc->next_chan;
1116 sc->cur_chan->stopped = false;
1117 sc->next_chan = NULL;
1118 @@ -1104,7 +1118,16 @@ void ath_chanctx_set_next(struct ath_sof
1120 sc->sched.channel_switch_time =
1121 ath9k_hw_get_tsf_offset(&ts, NULL);
1123 + * A reset will ensure that all queues are woken up,
1124 + * so there is no need to awaken them again.
1129 + if (queues_stopped)
1130 + ath9k_chanctx_wake_queues(sc, old_ctx);
1133 ath_chanctx_send_ps_frame(sc, false);
1135 @@ -1170,18 +1193,37 @@ bool ath9k_is_chanctx_enabled(void)
1136 /* Queue management */
1137 /********************/
1139 -void ath9k_chanctx_wake_queues(struct ath_softc *sc)
1140 +void ath9k_chanctx_stop_queues(struct ath_softc *sc, struct ath_chanctx *ctx)
1142 + struct ath_hw *ah = sc->sc_ah;
1145 + if (ctx == &sc->offchannel.chan) {
1146 + ieee80211_stop_queue(sc->hw,
1147 + sc->hw->offchannel_tx_hw_queue);
1149 + for (i = 0; i < IEEE80211_NUM_ACS; i++)
1150 + ieee80211_stop_queue(sc->hw,
1151 + ctx->hw_queue_base + i);
1154 + if (ah->opmode == NL80211_IFTYPE_AP)
1155 + ieee80211_stop_queue(sc->hw, sc->hw->queues - 2);
1159 +void ath9k_chanctx_wake_queues(struct ath_softc *sc, struct ath_chanctx *ctx)
1161 struct ath_hw *ah = sc->sc_ah;
1164 - if (sc->cur_chan == &sc->offchannel.chan) {
1165 + if (ctx == &sc->offchannel.chan) {
1166 ieee80211_wake_queue(sc->hw,
1167 sc->hw->offchannel_tx_hw_queue);
1169 for (i = 0; i < IEEE80211_NUM_ACS; i++)
1170 ieee80211_wake_queue(sc->hw,
1171 - sc->cur_chan->hw_queue_base + i);
1172 + ctx->hw_queue_base + i);
1175 if (ah->opmode == NL80211_IFTYPE_AP)
1176 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
1177 +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
1178 @@ -464,6 +464,7 @@ static int ath9k_init_priv(struct ath9k_
1181 ah->dev = priv->dev;
1182 + ah->hw = priv->hw;
1183 ah->hw_version.devid = devid;
1184 ah->hw_version.usbdev = drv_info;
1185 ah->ah_flags |= AH_USE_EEPROM;
1186 --- a/drivers/net/wireless/ath/ath9k/main.c
1187 +++ b/drivers/net/wireless/ath/ath9k/main.c
1188 @@ -60,8 +60,10 @@ static bool ath9k_has_pending_frames(str
1190 spin_lock_bh(&txq->axq_lock);
1192 - if (txq->axq_depth)
1193 + if (txq->axq_depth) {
1198 if (txq->mac80211_qnum >= 0) {
1199 struct list_head *list;
1200 @@ -70,6 +72,7 @@ static bool ath9k_has_pending_frames(str
1201 if (!list_empty(list))
1205 spin_unlock_bh(&txq->axq_lock);
1208 @@ -261,12 +264,7 @@ static bool ath_complete_reset(struct at
1210 ath9k_hw_set_interrupts(ah);
1211 ath9k_hw_enable_interrupts(ah);
1213 - if (!ath9k_is_chanctx_enabled())
1214 - ieee80211_wake_queues(sc->hw);
1216 - ath9k_chanctx_wake_queues(sc);
1218 + ieee80211_wake_queues(sc->hw);
1219 ath9k_p2p_ps_timer(sc);
1222 @@ -1971,9 +1969,6 @@ static bool ath9k_has_tx_pending(struct
1223 if (!ATH_TXQ_SETUP(sc, i))
1226 - if (!sc->tx.txq[i].axq_depth)
1229 npend = ath9k_has_pending_frames(sc, &sc->tx.txq[i]);
1232 @@ -1999,7 +1994,6 @@ void __ath9k_flush(struct ieee80211_hw *
1233 struct ath_common *common = ath9k_hw_common(ah);
1234 int timeout = HZ / 5; /* 200 ms */
1238 cancel_delayed_work_sync(&sc->tx_complete_work);
1240 @@ -2027,10 +2021,6 @@ void __ath9k_flush(struct ieee80211_hw *
1243 ath9k_ps_restore(sc);
1244 - for (i = 0; i < IEEE80211_NUM_ACS; i++) {
1245 - ieee80211_wake_queue(sc->hw,
1246 - sc->cur_chan->hw_queue_base + i);
1250 ieee80211_queue_delayed_work(hw, &sc->tx_complete_work, 0);
1251 @@ -2039,16 +2029,8 @@ void __ath9k_flush(struct ieee80211_hw *
1252 static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw)
1254 struct ath_softc *sc = hw->priv;
1257 - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
1258 - if (!ATH_TXQ_SETUP(sc, i))
1261 - if (ath9k_has_pending_frames(sc, &sc->tx.txq[i]))
1265 + return ath9k_has_tx_pending(sc);
1268 static int ath9k_tx_last_beacon(struct ieee80211_hw *hw)
1269 @@ -2350,7 +2332,7 @@ static void ath9k_remove_chanctx(struct
1270 conf->def.chan->center_freq);
1272 ctx->assigned = false;
1273 - ctx->hw_queue_base = -1;
1274 + ctx->hw_queue_base = 0;
1275 ath_chanctx_event(sc, NULL, ATH_CHANCTX_EVENT_UNASSIGN);
1277 mutex_unlock(&sc->mutex);
1278 --- a/net/mac80211/rate.c
1279 +++ b/net/mac80211/rate.c
1280 @@ -448,7 +448,7 @@ static void rate_fixup_ratelist(struct i
1282 if (!(rates[0].flags & IEEE80211_TX_RC_MCS)) {
1283 u32 basic_rates = vif->bss_conf.basic_rates;
1284 - s8 baserate = basic_rates ? ffs(basic_rates - 1) : 0;
1285 + s8 baserate = basic_rates ? ffs(basic_rates) - 1 : 0;
1287 rate = &sband->bitrates[rates[0].idx];