mac80211: update to 2014-10-08
authorFelix Fietkau <nbd@openwrt.org>
Sat, 18 Oct 2014 17:38:59 +0000 (17:38 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 18 Oct 2014 17:38:59 +0000 (17:38 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 42952

77 files changed:
package/kernel/mac80211/Makefile
package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
package/kernel/mac80211/patches/210-ap_scan.patch [new file with mode: 0644]
package/kernel/mac80211/patches/300-Revert-ath5k-Remove-AHB-bus-support.patch [new file with mode: 0644]
package/kernel/mac80211/patches/300-pending_work.patch [deleted file]
package/kernel/mac80211/patches/301-ath5k-fix-AHB-kconfig-dependency.patch [new file with mode: 0644]
package/kernel/mac80211/patches/302-mac80211-trivial-fix-typo-in-starting-baserate-for-r.patch [new file with mode: 0644]
package/kernel/mac80211/patches/303-ath9k-Use-sta_state-callback.patch [new file with mode: 0644]
package/kernel/mac80211/patches/304-ath9k-Enable-multi-channel-properly.patch [new file with mode: 0644]
package/kernel/mac80211/patches/305-ath9k-Process-beacons-properly.patch [new file with mode: 0644]
package/kernel/mac80211/patches/306-ath9k-Unify-reset-API.patch [new file with mode: 0644]
package/kernel/mac80211/patches/307-ath9k-Set-ATH_OP_HW_RESET-before-HW-reset.patch [new file with mode: 0644]
package/kernel/mac80211/patches/308-ath9k-Disable-beacon-tasklet-during-reset.patch [new file with mode: 0644]
package/kernel/mac80211/patches/309-ath9k-Clear-NoA-schedule-properly.patch [new file with mode: 0644]
package/kernel/mac80211/patches/310-ap_scan.patch [deleted file]
package/kernel/mac80211/patches/310-ath9k-Use-configurable-timeout-for-flush.patch [new file with mode: 0644]
package/kernel/mac80211/patches/311-ath9k-Fix-MCC-flush-timeout.patch [new file with mode: 0644]
package/kernel/mac80211/patches/312-ath9k-Fix-offchannel-flush-timeout.patch [new file with mode: 0644]
package/kernel/mac80211/patches/313-ath9k-Check-for-pending-frames-properly.patch [new file with mode: 0644]
package/kernel/mac80211/patches/314-ath9k-Send-AUTHORIZED-event-only-for-station-mode.patch [new file with mode: 0644]
package/kernel/mac80211/patches/315-ath9k-Fix-address-management.patch [new file with mode: 0644]
package/kernel/mac80211/patches/316-ath9k-Add-a-function-to-check-for-an-active-GO.patch [new file with mode: 0644]
package/kernel/mac80211/patches/317-ath9k-Check-for-active-GO-in-mgd_prepare_tx.patch [new file with mode: 0644]
package/kernel/mac80211/patches/318-ath9k-Use-a-helper-function-for-offchannel-NoA.patch [new file with mode: 0644]
package/kernel/mac80211/patches/319-ath9k-Use-a-helper-function-to-set-NoA.patch [new file with mode: 0644]
package/kernel/mac80211/patches/320-ath9k-Use-a-helper-function-for-bmiss.patch [new file with mode: 0644]
package/kernel/mac80211/patches/321-ath9k-Fix-RoC-expiration.patch [new file with mode: 0644]
package/kernel/mac80211/patches/322-ath9k-Send-oneshot-NoA.patch [new file with mode: 0644]
package/kernel/mac80211/patches/323-ath9k-Fix-HW-scan-abort.patch [new file with mode: 0644]
package/kernel/mac80211/patches/324-ath9k-Improve-flush-in-mcc-mode.patch [new file with mode: 0644]
package/kernel/mac80211/patches/325-ath9k-Do-not-start-BA-when-scanning.patch [new file with mode: 0644]
package/kernel/mac80211/patches/326-ath9k_hw-make-support-for-PC-OEM-cards-optional.patch [new file with mode: 0644]
package/kernel/mac80211/patches/327-ath9k_hw-remove-support-for-UB124-tx-gain-table.patch [new file with mode: 0644]
package/kernel/mac80211/patches/328-ath9k-fix-processing-RXORN-interrupts.patch [new file with mode: 0644]
package/kernel/mac80211/patches/329-ath9k-clean-up-debugfs-print-of-reset-causes.patch [new file with mode: 0644]
package/kernel/mac80211/patches/330-ath9k-restart-hardware-after-noise-floor-calibration.patch [new file with mode: 0644]
package/kernel/mac80211/patches/331-ath9k_hw-do-not-run-NF-and-periodic-calibration-at-t.patch [new file with mode: 0644]
package/kernel/mac80211/patches/332-ath9k_hw-start-initial-NF-calibration-after-PA-calib.patch [new file with mode: 0644]
package/kernel/mac80211/patches/333-ath9k-add-support-for-endian-swap-of-eeprom-from-pla.patch [new file with mode: 0644]
package/kernel/mac80211/patches/334-ath9k-allow-disabling-bands-via-platform-data.patch [new file with mode: 0644]
package/kernel/mac80211/patches/335-ath9k-use-a-random-MAC-address-if-the-EEPROM-address.patch [new file with mode: 0644]
package/kernel/mac80211/patches/400-ath_move_debug_code.patch
package/kernel/mac80211/patches/402-ath9k-fix-invalid-mac-address-handling.patch [deleted file]
package/kernel/mac80211/patches/402-ath_regd_optional.patch [new file with mode: 0644]
package/kernel/mac80211/patches/403-ath_regd_optional.patch [deleted file]
package/kernel/mac80211/patches/403-world_regd_fixup.patch [new file with mode: 0644]
package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch [new file with mode: 0644]
package/kernel/mac80211/patches/404-world_regd_fixup.patch [deleted file]
package/kernel/mac80211/patches/405-ath_regd_us.patch [new file with mode: 0644]
package/kernel/mac80211/patches/405-regd_no_assoc_hints.patch [deleted file]
package/kernel/mac80211/patches/406-ath_regd_us.patch [deleted file]
package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
package/kernel/mac80211/patches/501-ath9k-eeprom_endianess.patch [deleted file]
package/kernel/mac80211/patches/501-ath9k_ahb_init.patch [new file with mode: 0644]
package/kernel/mac80211/patches/502-ath9k_ahb_init.patch [deleted file]
package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch
package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch [deleted file]
package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch [new file with mode: 0644]
package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch [new file with mode: 0644]
package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch [new file with mode: 0644]
package/kernel/mac80211/patches/550-ath9k_entropy_from_adc.patch [deleted file]
package/kernel/mac80211/patches/551-ath9k-ar933x-usb-hang-workaround.patch [deleted file]
package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch [deleted file]
package/kernel/mac80211/patches/561-ath9k_remove_gain_tables.patch [deleted file]
package/kernel/mac80211/patches/562-ath9k_ani_ws_detect.patch [deleted file]
package/kernel/mac80211/patches/563-ath9k_rxorn_intr_fix.patch [deleted file]
package/kernel/mac80211/patches/564-ath9k_cleanup_reset_debug.patch [deleted file]
package/kernel/mac80211/patches/565-ath9k_restart_after_nfcal_failure.patch [deleted file]
package/kernel/mac80211/patches/566-ath9k_nfcal_xor_percal.patch [deleted file]
package/kernel/mac80211/patches/567-ath9k_fix_init_nfcal.patch [deleted file]
package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch

index 4b877fb95771e73fb3288b22999fbeef2b18e9af..ab46a18627def4fab91c642dd1d6d32e3eb24500 100644 (file)
@@ -10,11 +10,11 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=mac80211
 
 
 PKG_NAME:=mac80211
 
-PKG_VERSION:=2014-09-26
+PKG_VERSION:=2014-10-08
 PKG_RELEASE:=1
 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
 PKG_BACKPORT_VERSION:=
 PKG_RELEASE:=1
 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
 PKG_BACKPORT_VERSION:=
-PKG_MD5SUM:=b66f5fbd10e335fc660182ce6114d41f
+PKG_MD5SUM:=20e9de70e63fd9649d61d4670a9cc1bd
 
 PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
 
 PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
index 16cfb88aedbc7726c0c2d457329b614b1bc51982..ddf835847c1e3f6ecdea8eb0b68ee2baa0c9ff16 100644 (file)
@@ -1,6 +1,6 @@
 --- a/.local-symbols
 +++ b/.local-symbols
 --- a/.local-symbols
 +++ b/.local-symbols
-@@ -414,42 +414,6 @@ USB_CDC_PHONET=
+@@ -416,42 +416,6 @@ USB_CDC_PHONET=
  USB_IPHETH=
  USB_SIERRA_NET=
  USB_VL600=
  USB_IPHETH=
  USB_SIERRA_NET=
  USB_VL600=
diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
new file mode 100644 (file)
index 0000000..01d3785
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/net/mac80211/cfg.c
++++ b/net/mac80211/cfg.c
+@@ -1895,7 +1895,7 @@ static int ieee80211_scan(struct wiphy *
+                * the  frames sent while scanning on other channel will be
+                * lost)
+                */
+-              if (sdata->u.ap.beacon &&
++              if (0 && sdata->u.ap.beacon &&
+                   (!(wiphy->features & NL80211_FEATURE_AP_SCAN) ||
+                    !(req->flags & NL80211_SCAN_FLAG_AP)))
+                       return -EOPNOTSUPP;
diff --git a/package/kernel/mac80211/patches/300-Revert-ath5k-Remove-AHB-bus-support.patch b/package/kernel/mac80211/patches/300-Revert-ath5k-Remove-AHB-bus-support.patch
new file mode 100644 (file)
index 0000000..cb71499
--- /dev/null
@@ -0,0 +1,395 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 27 Sep 2014 15:57:09 +0200
+Subject: [PATCH] Revert "ath5k: Remove AHB bus support"
+
+This reverts commit 093ec3c5337434f40d77c1af06c139da3e5ba6dc.
+---
+ create mode 100644 drivers/net/wireless/ath/ath5k/ahb.c
+
+--- a/drivers/net/wireless/ath/ath5k/Kconfig
++++ b/drivers/net/wireless/ath/ath5k/Kconfig
+@@ -1,13 +1,14 @@
+ config ATH5K
+       tristate "Atheros 5xxx wireless cards support"
+       depends on m
+-      depends on PCI && MAC80211
++      depends on (PCI || ATHEROS_AR231X) && MAC80211
+       select ATH_COMMON
+       select MAC80211_LEDS
+       select BACKPORT_LEDS_CLASS
+       select BACKPORT_NEW_LEDS
+       select BACKPORT_AVERAGE
+-      select ATH5K_PCI
++      select ATH5K_AHB if (ATHEROS_AR231X && !PCI)
++      select ATH5K_PCI if (!ATHEROS_AR231X && PCI)
+       ---help---
+         This module adds support for wireless adapters based on
+         Atheros 5xxx chipset.
+@@ -52,9 +53,16 @@ config ATH5K_TRACER
+         If unsure, say N.
++config ATH5K_AHB
++      bool "Atheros 5xxx AHB bus support"
++      depends on (ATHEROS_AR231X && !PCI)
++      ---help---
++        This adds support for WiSoC type chipsets of the 5xxx Atheros
++        family.
++
+ config ATH5K_PCI
+       bool "Atheros 5xxx PCI bus support"
+-      depends on PCI
++      depends on (!ATHEROS_AR231X && PCI)
+       ---help---
+         This adds support for PCI type chipsets of the 5xxx Atheros
+         family.
+--- a/drivers/net/wireless/ath/ath5k/Makefile
++++ b/drivers/net/wireless/ath/ath5k/Makefile
+@@ -17,5 +17,6 @@ ath5k-y                              += ani.o
+ ath5k-y                               += sysfs.o
+ ath5k-y                               += mac80211-ops.o
+ ath5k-$(CPTCFG_ATH5K_DEBUG)   += debug.o
++ath5k-$(CPTCFG_ATH5K_AHB)     += ahb.o
+ ath5k-$(CPTCFG_ATH5K_PCI)     += pci.o
+ obj-$(CPTCFG_ATH5K)           += ath5k.o
+--- /dev/null
++++ b/drivers/net/wireless/ath/ath5k/ahb.c
+@@ -0,0 +1,234 @@
++/*
++ * Copyright (c) 2008-2009 Atheros Communications Inc.
++ * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
++ * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include <linux/nl80211.h>
++#include <linux/platform_device.h>
++#include <linux/etherdevice.h>
++#include <linux/export.h>
++#include <ar231x_platform.h>
++#include "ath5k.h"
++#include "debug.h"
++#include "base.h"
++#include "reg.h"
++
++/* return bus cachesize in 4B word units */
++static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
++{
++      *csz = L1_CACHE_BYTES >> 2;
++}
++
++static bool
++ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
++{
++      struct ath5k_hw *ah = common->priv;
++      struct platform_device *pdev = to_platform_device(ah->dev);
++      struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
++      u16 *eeprom, *eeprom_end;
++
++      eeprom = (u16 *) bcfg->radio;
++      eeprom_end = ((void *) bcfg->config) + BOARD_CONFIG_BUFSZ;
++
++      eeprom += off;
++      if (eeprom > eeprom_end)
++              return false;
++
++      *data = *eeprom;
++      return true;
++}
++
++int ath5k_hw_read_srev(struct ath5k_hw *ah)
++{
++      struct platform_device *pdev = to_platform_device(ah->dev);
++      struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
++      ah->ah_mac_srev = bcfg->devid;
++      return 0;
++}
++
++static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
++{
++      struct platform_device *pdev = to_platform_device(ah->dev);
++      struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
++      u8 *cfg_mac;
++
++      if (to_platform_device(ah->dev)->id == 0)
++              cfg_mac = bcfg->config->wlan0_mac;
++      else
++              cfg_mac = bcfg->config->wlan1_mac;
++
++      memcpy(mac, cfg_mac, ETH_ALEN);
++      return 0;
++}
++
++static const struct ath_bus_ops ath_ahb_bus_ops = {
++      .ath_bus_type = ATH_AHB,
++      .read_cachesize = ath5k_ahb_read_cachesize,
++      .eeprom_read = ath5k_ahb_eeprom_read,
++      .eeprom_read_mac = ath5k_ahb_eeprom_read_mac,
++};
++
++/*Initialization*/
++static int ath_ahb_probe(struct platform_device *pdev)
++{
++      struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
++      struct ath5k_hw *ah;
++      struct ieee80211_hw *hw;
++      struct resource *res;
++      void __iomem *mem;
++      int irq;
++      int ret = 0;
++      u32 reg;
++
++      if (!dev_get_platdata(&pdev->dev)) {
++              dev_err(&pdev->dev, "no platform data specified\n");
++              ret = -EINVAL;
++              goto err_out;
++      }
++
++      res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++      if (res == NULL) {
++              dev_err(&pdev->dev, "no memory resource found\n");
++              ret = -ENXIO;
++              goto err_out;
++      }
++
++      mem = ioremap_nocache(res->start, resource_size(res));
++      if (mem == NULL) {
++              dev_err(&pdev->dev, "ioremap failed\n");
++              ret = -ENOMEM;
++              goto err_out;
++      }
++
++      res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
++      if (res == NULL) {
++              dev_err(&pdev->dev, "no IRQ resource found\n");
++              ret = -ENXIO;
++              goto err_iounmap;
++      }
++
++      irq = res->start;
++
++      hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops);
++      if (hw == NULL) {
++              dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
++              ret = -ENOMEM;
++              goto err_iounmap;
++      }
++
++      ah = hw->priv;
++      ah->hw = hw;
++      ah->dev = &pdev->dev;
++      ah->iobase = mem;
++      ah->irq = irq;
++      ah->devid = bcfg->devid;
++
++      if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
++              /* Enable WMAC AHB arbitration */
++              reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
++              reg |= AR5K_AR2315_AHB_ARB_CTL_WLAN;
++              iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
++
++              /* Enable global WMAC swapping */
++              reg = ioread32((void __iomem *) AR5K_AR2315_BYTESWAP);
++              reg |= AR5K_AR2315_BYTESWAP_WMAC;
++              iowrite32(reg, (void __iomem *) AR5K_AR2315_BYTESWAP);
++      } else {
++              /* Enable WMAC DMA access (assuming 5312 or 231x*/
++              /* TODO: check other platforms */
++              reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
++              if (to_platform_device(ah->dev)->id == 0)
++                      reg |= AR5K_AR5312_ENABLE_WLAN0;
++              else
++                      reg |= AR5K_AR5312_ENABLE_WLAN1;
++              iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
++
++              /*
++               * On a dual-band AR5312, the multiband radio is only
++               * used as pass-through. Disable 2 GHz support in the
++               * driver for it
++               */
++              if (to_platform_device(ah->dev)->id == 0 &&
++                  (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) ==
++                   (BD_WLAN1 | BD_WLAN0))
++                      ah->ah_capabilities.cap_needs_2GHz_ovr = true;
++              else
++                      ah->ah_capabilities.cap_needs_2GHz_ovr = false;
++      }
++
++      ret = ath5k_init_ah(ah, &ath_ahb_bus_ops);
++      if (ret != 0) {
++              dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
++              ret = -ENODEV;
++              goto err_free_hw;
++      }
++
++      platform_set_drvdata(pdev, hw);
++
++      return 0;
++
++ err_free_hw:
++      ieee80211_free_hw(hw);
++ err_iounmap:
++        iounmap(mem);
++ err_out:
++      return ret;
++}
++
++static int ath_ahb_remove(struct platform_device *pdev)
++{
++      struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
++      struct ieee80211_hw *hw = platform_get_drvdata(pdev);
++      struct ath5k_hw *ah;
++      u32 reg;
++
++      if (!hw)
++              return 0;
++
++      ah = hw->priv;
++
++      if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
++              /* Disable WMAC AHB arbitration */
++              reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
++              reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN;
++              iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
++      } else {
++              /*Stop DMA access */
++              reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
++              if (to_platform_device(ah->dev)->id == 0)
++                      reg &= ~AR5K_AR5312_ENABLE_WLAN0;
++              else
++                      reg &= ~AR5K_AR5312_ENABLE_WLAN1;
++              iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
++      }
++
++      ath5k_deinit_ah(ah);
++      iounmap(ah->iobase);
++      ieee80211_free_hw(hw);
++
++      return 0;
++}
++
++static struct platform_driver ath_ahb_driver = {
++      .probe      = ath_ahb_probe,
++      .remove     = ath_ahb_remove,
++      .driver         = {
++              .name   = "ar231x-wmac",
++              .owner  = THIS_MODULE,
++      },
++};
++
++module_platform_driver(ath_ahb_driver);
+--- a/drivers/net/wireless/ath/ath5k/ath5k.h
++++ b/drivers/net/wireless/ath/ath5k/ath5k.h
+@@ -1647,6 +1647,32 @@ static inline struct ath_regulatory *ath
+       return &(ath5k_hw_common(ah)->regulatory);
+ }
++#ifdef CONFIG_ATHEROS_AR231X
++#define AR5K_AR2315_PCI_BASE  ((void __iomem *)0xb0100000)
++
++static inline void __iomem *ath5k_ahb_reg(struct ath5k_hw *ah, u16 reg)
++{
++      /* On AR2315 and AR2317 the PCI clock domain registers
++       * are outside of the WMAC register space */
++      if (unlikely((reg >= 0x4000) && (reg < 0x5000) &&
++          (ah->ah_mac_srev >= AR5K_SREV_AR2315_R6)))
++              return AR5K_AR2315_PCI_BASE + reg;
++
++      return ah->iobase + reg;
++}
++
++static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
++{
++      return ioread32(ath5k_ahb_reg(ah, reg));
++}
++
++static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
++{
++      iowrite32(val, ath5k_ahb_reg(ah, reg));
++}
++
++#else
++
+ static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
+ {
+       return ioread32(ah->iobase + reg);
+@@ -1657,6 +1683,8 @@ static inline void ath5k_hw_reg_write(st
+       iowrite32(val, ah->iobase + reg);
+ }
++#endif
++
+ static inline enum ath_bus_type ath5k_get_bus_type(struct ath5k_hw *ah)
+ {
+       return ath5k_hw_common(ah)->bus_ops->ath_bus_type;
+--- a/drivers/net/wireless/ath/ath5k/base.c
++++ b/drivers/net/wireless/ath/ath5k/base.c
+@@ -99,6 +99,15 @@ static int ath5k_reset(struct ath5k_hw *
+ /* Known SREVs */
+ static const struct ath5k_srev_name srev_names[] = {
++#ifdef CONFIG_ATHEROS_AR231X
++      { "5312",       AR5K_VERSION_MAC,       AR5K_SREV_AR5312_R2 },
++      { "5312",       AR5K_VERSION_MAC,       AR5K_SREV_AR5312_R7 },
++      { "2313",       AR5K_VERSION_MAC,       AR5K_SREV_AR2313_R8 },
++      { "2315",       AR5K_VERSION_MAC,       AR5K_SREV_AR2315_R6 },
++      { "2315",       AR5K_VERSION_MAC,       AR5K_SREV_AR2315_R7 },
++      { "2317",       AR5K_VERSION_MAC,       AR5K_SREV_AR2317_R1 },
++      { "2317",       AR5K_VERSION_MAC,       AR5K_SREV_AR2317_R2 },
++#else
+       { "5210",       AR5K_VERSION_MAC,       AR5K_SREV_AR5210 },
+       { "5311",       AR5K_VERSION_MAC,       AR5K_SREV_AR5311 },
+       { "5311A",      AR5K_VERSION_MAC,       AR5K_SREV_AR5311A },
+@@ -117,6 +126,7 @@ static const struct ath5k_srev_name srev
+       { "5418",       AR5K_VERSION_MAC,       AR5K_SREV_AR5418 },
+       { "2425",       AR5K_VERSION_MAC,       AR5K_SREV_AR2425 },
+       { "2417",       AR5K_VERSION_MAC,       AR5K_SREV_AR2417 },
++#endif
+       { "xxxxx",      AR5K_VERSION_MAC,       AR5K_SREV_UNKNOWN },
+       { "5110",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5110 },
+       { "5111",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5111 },
+@@ -132,6 +142,10 @@ static const struct ath5k_srev_name srev
+       { "5413",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5413 },
+       { "5424",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5424 },
+       { "5133",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5133 },
++#ifdef CONFIG_ATHEROS_AR231X
++      { "2316",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_2316 },
++      { "2317",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_2317 },
++#endif
+       { "xxxxx",      AR5K_VERSION_RAD,       AR5K_SREV_UNKNOWN },
+ };
+--- a/drivers/net/wireless/ath/ath5k/led.c
++++ b/drivers/net/wireless/ath/ath5k/led.c
+@@ -163,14 +163,20 @@ int ath5k_init_leds(struct ath5k_hw *ah)
+ {
+       int ret = 0;
+       struct ieee80211_hw *hw = ah->hw;
++#ifndef CONFIG_ATHEROS_AR231X
+       struct pci_dev *pdev = ah->pdev;
++#endif
+       char name[ATH5K_LED_MAX_NAME_LEN + 1];
+       const struct pci_device_id *match;
+       if (!ah->pdev)
+               return 0;
++#ifdef CONFIG_ATHEROS_AR231X
++      match = NULL;
++#else
+       match = pci_match_id(&ath5k_led_devices[0], pdev);
++#endif
+       if (match) {
+               __set_bit(ATH_STAT_LEDSOFT, ah->status);
+               ah->led_pin = ATH_PIN(match->driver_data);
diff --git a/package/kernel/mac80211/patches/300-pending_work.patch b/package/kernel/mac80211/patches/300-pending_work.patch
deleted file mode 100644 (file)
index 6322952..0000000
+++ /dev/null
@@ -1,1288 +0,0 @@
-commit 6fb7eefaa4d8377e6b124435059656dd6f643e91
-Author: Karl Beldan <karl.beldan@rivierawaves.com>
-Date:   Tue Oct 7 15:53:38 2014 +0200
-
-    mac80211/trivial: fix typo in starting baserate for rts_cts_rate_idx
-    
-    Fixes: 5253ffb8 ("mac80211: always pick a basic rate to tx RTS/CTS for pre-HT rates")
-    Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
-
-commit b18111d911980af52bead74ee45250cc96ad5108
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Tue Oct 7 10:14:37 2014 +0530
-
-    ath9k: Fix crash in MCC mode
-    
-    When a channel context is removed, the hw_queue_base
-    is set to -1, this will result in a panic because
-    ath9k_chanctx_stop_queues() can be called on an interface
-    that is not assigned to any context yet - for example,
-    when trying to scan.
-    
-    Fix this issue by setting the hw_queue_base to zero
-    when a channel context is removed.
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit e2cba8d7590e76661e86f1f0987ef9f8c13c9a6d
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Thu Oct 2 06:33:20 2014 +0530
-
-    ath9k: Fix flushing in MCC mode
-    
-    When we are attempting to switch to a new
-    channel context, the TX queues are flushed, but
-    the mac80211 queues are not stopped and traffic
-    can still come down to the driver.
-    
-    This patch fixes it by stopping the queues
-    assigned to the current context/vif before
-    trying to flush.
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit 5ba8d9d2f018f2c4e23f9e68b90ca5b9d5470457
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Thu Oct 2 06:33:19 2014 +0530
-
-    ath9k: Fix queue handling for channel contexts
-    
-    When a full chip reset is done, all the queues
-    across all VIFs are stopped, but if MCC is enabled,
-    only the queues of the current context is awakened,
-    when we complete the reset.
-    
-    This results in unfairness for the inactive context.
-    Since frames are queued internally in the driver if
-    there is a context mismatch, we can awaken all the
-    queues when coming out of a reset.
-    
-    The VIF-specific queues are still used in flow control,
-    to ensure fairness when traffic is high.
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit a064eaa10ca4ec58d5a405c9a7f87efc6d2fa423
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Thu Oct 2 06:33:18 2014 +0530
-
-    ath9k: Add ath9k_chanctx_stop_queues()
-    
-    This can be used when the queues of a context
-    needs to be stopped.
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit b39031536aab9cb1324328cf46fa4ef940bd975f
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Thu Oct 2 06:33:17 2014 +0530
-
-    ath9k: Pass context to ath9k_chanctx_wake_queues()
-    
-    Change the ath9k_chanctx_wake_queues() API so
-    that we can pass the channel context that needs its
-    queues to be stopped.
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit 4f82eecf73019c27537f65c160e90385e159afd8
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Thu Oct 2 06:33:16 2014 +0530
-
-    ath9k: Fix queue handling in flush()
-    
-    When draining of the TX queues fails, a
-    full HW reset is done. ath_reset() makes sure
-    that the queues in mac80211 are restarted,
-    so there is no need to wake them up again.
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit 60913f4d2951f6410eed969aae4717c7ced37044
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Thu Oct 2 06:33:15 2014 +0530
-
-    ath9k: Remove duplicate code
-    
-    ath9k_has_tx_pending() can be used to
-    check if there are pending frames instead
-    of having duplicate code.
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit fc1314c75e0558c03cb434e2af2c257caa201e76
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Thu Oct 2 06:33:14 2014 +0530
-
-    ath9k: Fix pending frame check
-    
-    Checking for the queue depth outside of
-    the TX queue lock is incorrect and in this
-    case, is not required since it is done inside
-    ath9k_has_pending_frames().
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit b736728575af03488388e84fceac7bf0eac5dbb6
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Thu Oct 2 06:33:13 2014 +0530
-
-    ath9k: Check pending frames properly
-    
-    There is no need to check if the current
-    channel context has active ACs queued up
-    if the TX queue is not empty.
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit 4b60af4ab4363bd79eeba94bb6bed396cf2aaf62
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Thu Oct 2 06:33:12 2014 +0530
-
-    ath9k: Print RoC expiration
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit 4d9f634b02e4240f86719f30e4c9e62f6a4c4d36
-Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date:   Tue Sep 30 14:15:23 2014 +0530
-
-    ath9k: Check early for HW reset
-    
-    chan_lock is not required for checking if
-    we are in the middle of a HW reset, so do it
-    early. This also removes the small window
-    where the lock is dropped and reacquired.
-    
-    Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit c393d179924685d5c8c72446c5b6401f25fdb2a0
-Author: Marek Puzyniak <marek.puzyniak@tieto.com>
-Date:   Tue Oct 7 17:04:30 2014 +0200
-
-    ath9k_htc: avoid kernel panic in ath9k_hw_reset
-    
-    hw pointer of ath_hw is not assigned to proper value
-    in function ath9k_hw_reset what finally causes kernel panic.
-    This can be solved by proper initialization of ath_hw in
-    ath9k_init_priv.
-    
-    Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
-    Acked-by: Oleksij Rempel <linux@rempel-privat.de>
-    Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
-commit 065e0b64f71632f5ad7f00c102fde09c534cfbf0
-Author: Felix Fietkau <nbd@openwrt.org>
-Date:   Tue Sep 30 11:00:33 2014 +0200
-
-    ath9k: fix getting tx duration for dynack
-    
-    On AR9003, tx control and tx status are in separate descriptor rings.
-    Tx duration is extracted from the tx control descriptor data, which
-    ar9003_hw_proc_txdesc cannot access.
-    
-    Fix getting the duration by adding a separate callback for it.
-    
-    Acked-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
-    Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
-commit fdf9a4517b60d847b9bc0a30249efd96559fa450
-Author: Felix Fietkau <nbd@openwrt.org>
-Date:   Tue Sep 9 09:48:30 2014 +0200
-
-    ath9k_hw: fix PLL clock initialization for newer SoC
-    
-    On AR934x and newer SoC devices, the layout of the AR_RTC_PLL_CONTROL
-    register changed. This currently breaks at least 5/10 MHz operation.
-    AR933x uses the old layout.
-    
-    It might also have been causing other stability issues because of the
-    different location of the PLL_BYPASS bit which needs to be set during
-    PLL clock initialization.
-    
-    This patch also removes more instances of hardcoded register values in
-    favor of properly computed ones with the PLL_BYPASS bit added.
-    
-    Reported-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
-    Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
-commit b6d1f51cd8bdc9d952147a960fbf1f261d8e4188
-Author: Felix Fietkau <nbd@openwrt.org>
-Date:   Mon Sep 8 18:35:08 2014 +0200
-
-    ath9k_hw: reduce ANI spur immunity setting on HT40 extension channel
-    
-    The cycpwr_thr1 value needs to be lower on the extension channel than on
-    the control channel, similar to how the register settings are programmed
-    in the initvals.
-    
-    Also drop the unnecessary check for HT40 - this register can always be
-    written. This patch has been reported to improve HT40 stability and
-    throughput in some environments.
-    
-    Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
-commit 5ad2dfbaa19aa45d29184d30c8c5dae0e110074a
-Author: Felix Fietkau <nbd@openwrt.org>
-Date:   Mon Sep 8 18:31:26 2014 +0200
-
-    Revert "ath9k_hw: reduce ANI firstep range for older chips"
-    
-    This reverts commit 09efc56345be4146ab9fc87a55c837ed5d6ea1ab
-    
-    I've received reports that this change is decreasing throughput in some
-    rare conditions on an AR9280 based device
-    
-    Cc: stable@vger.kernel.org
-    Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
-commit 4c82fc569cf2f29e6c66d98ef4a1b0f3b6a98e9d
-Author: Felix Fietkau <nbd@openwrt.org>
-Date:   Sat Sep 27 22:39:27 2014 +0200
-
-    ath9k_hw: disable hardware ad-hoc flag on ar934x rev 3
-    
-    On AR934x rev 3, settin the ad-hoc flag completely messes up hardware
-    state - beacons get stuck, almost no packets make it out, hardware is
-    constantly reset.
-    
-    When leaving out that flag and setting up the hw like in AP mode, TSF
-    timers won't be automatically synced, but at least the rest works.
-    
-    AR934x rev 2 and older are not affected by this bug
-    
-    Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
-commit ecfb4b3fff006372ac5c40871f9bb182fd00444f
-Author: Felix Fietkau <nbd@openwrt.org>
-Date:   Sat Sep 27 22:15:43 2014 +0200
-
-    ath9k: use ah->get_mac_revision for all SoC devices if available
-    
-    It is needed for AR934x as well
-    
-    Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
-commit c11113bc25df22898fb995d3205bdc4f27c98073
-Author: Felix Fietkau <nbd@openwrt.org>
-Date:   Sat Sep 27 18:04:58 2014 +0200
-
-    ath5k: add missing include for debug code
-    
-    Needed for calling vmalloc()/vfree()
-    
-    Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
-commit 83f76a9f9a42773c7eef90bb86b4b2c16b0b3755
-Author: Felix Fietkau <nbd@openwrt.org>
-Date:   Sat Sep 27 15:58:51 2014 +0200
-
-    ath5k: fix AHB kconfig dependency
-    
-    Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
-commit ddd67f2a5cfd73fad4b78190025402d419b9f0a9
-Author: Felix Fietkau <nbd@openwrt.org>
-Date:   Sat Sep 27 15:57:09 2014 +0200
-
-    Revert "ath5k: Remove AHB bus support"
-    
-    This reverts commit 093ec3c5337434f40d77c1af06c139da3e5ba6dc.
-
---- a/drivers/net/wireless/ath/ath5k/Kconfig
-+++ b/drivers/net/wireless/ath/ath5k/Kconfig
-@@ -2,12 +2,14 @@ config ATH5K
-       tristate "Atheros 5xxx wireless cards support"
-       depends on m
-       depends on PCI && MAC80211
-+      depends on (PCI || ATHEROS_AR231X) && MAC80211
-       select ATH_COMMON
-       select MAC80211_LEDS
-       select BACKPORT_LEDS_CLASS
-       select BACKPORT_NEW_LEDS
-       select BACKPORT_AVERAGE
--      select ATH5K_PCI
-+      select ATH5K_AHB if ATHEROS_AR231X
-+      select ATH5K_PCI if !ATHEROS_AR231X
-       ---help---
-         This module adds support for wireless adapters based on
-         Atheros 5xxx chipset.
-@@ -52,9 +54,16 @@ config ATH5K_TRACER
-         If unsure, say N.
-+config ATH5K_AHB
-+      bool "Atheros 5xxx AHB bus support"
-+      depends on ATHEROS_AR231X
-+      ---help---
-+        This adds support for WiSoC type chipsets of the 5xxx Atheros
-+        family.
-+
- config ATH5K_PCI
-       bool "Atheros 5xxx PCI bus support"
--      depends on PCI
-+      depends on !ATHEROS_AR231X
-       ---help---
-         This adds support for PCI type chipsets of the 5xxx Atheros
-         family.
---- /dev/null
-+++ b/drivers/net/wireless/ath/ath5k/ahb.c
-@@ -0,0 +1,234 @@
-+/*
-+ * Copyright (c) 2008-2009 Atheros Communications Inc.
-+ * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
-+ * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
-+ *
-+ * Permission to use, copy, modify, and/or distribute this software for any
-+ * purpose with or without fee is hereby granted, provided that the above
-+ * copyright notice and this permission notice appear in all copies.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-+ */
-+
-+#include <linux/nl80211.h>
-+#include <linux/platform_device.h>
-+#include <linux/etherdevice.h>
-+#include <linux/export.h>
-+#include <ar231x_platform.h>
-+#include "ath5k.h"
-+#include "debug.h"
-+#include "base.h"
-+#include "reg.h"
-+
-+/* return bus cachesize in 4B word units */
-+static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
-+{
-+      *csz = L1_CACHE_BYTES >> 2;
-+}
-+
-+static bool
-+ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
-+{
-+      struct ath5k_hw *ah = common->priv;
-+      struct platform_device *pdev = to_platform_device(ah->dev);
-+      struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
-+      u16 *eeprom, *eeprom_end;
-+
-+      eeprom = (u16 *) bcfg->radio;
-+      eeprom_end = ((void *) bcfg->config) + BOARD_CONFIG_BUFSZ;
-+
-+      eeprom += off;
-+      if (eeprom > eeprom_end)
-+              return false;
-+
-+      *data = *eeprom;
-+      return true;
-+}
-+
-+int ath5k_hw_read_srev(struct ath5k_hw *ah)
-+{
-+      struct platform_device *pdev = to_platform_device(ah->dev);
-+      struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
-+      ah->ah_mac_srev = bcfg->devid;
-+      return 0;
-+}
-+
-+static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
-+{
-+      struct platform_device *pdev = to_platform_device(ah->dev);
-+      struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
-+      u8 *cfg_mac;
-+
-+      if (to_platform_device(ah->dev)->id == 0)
-+              cfg_mac = bcfg->config->wlan0_mac;
-+      else
-+              cfg_mac = bcfg->config->wlan1_mac;
-+
-+      memcpy(mac, cfg_mac, ETH_ALEN);
-+      return 0;
-+}
-+
-+static const struct ath_bus_ops ath_ahb_bus_ops = {
-+      .ath_bus_type = ATH_AHB,
-+      .read_cachesize = ath5k_ahb_read_cachesize,
-+      .eeprom_read = ath5k_ahb_eeprom_read,
-+      .eeprom_read_mac = ath5k_ahb_eeprom_read_mac,
-+};
-+
-+/*Initialization*/
-+static int ath_ahb_probe(struct platform_device *pdev)
-+{
-+      struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
-+      struct ath5k_hw *ah;
-+      struct ieee80211_hw *hw;
-+      struct resource *res;
-+      void __iomem *mem;
-+      int irq;
-+      int ret = 0;
-+      u32 reg;
-+
-+      if (!dev_get_platdata(&pdev->dev)) {
-+              dev_err(&pdev->dev, "no platform data specified\n");
-+              ret = -EINVAL;
-+              goto err_out;
-+      }
-+
-+      res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+      if (res == NULL) {
-+              dev_err(&pdev->dev, "no memory resource found\n");
-+              ret = -ENXIO;
-+              goto err_out;
-+      }
-+
-+      mem = ioremap_nocache(res->start, resource_size(res));
-+      if (mem == NULL) {
-+              dev_err(&pdev->dev, "ioremap failed\n");
-+              ret = -ENOMEM;
-+              goto err_out;
-+      }
-+
-+      res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-+      if (res == NULL) {
-+              dev_err(&pdev->dev, "no IRQ resource found\n");
-+              ret = -ENXIO;
-+              goto err_iounmap;
-+      }
-+
-+      irq = res->start;
-+
-+      hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops);
-+      if (hw == NULL) {
-+              dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
-+              ret = -ENOMEM;
-+              goto err_iounmap;
-+      }
-+
-+      ah = hw->priv;
-+      ah->hw = hw;
-+      ah->dev = &pdev->dev;
-+      ah->iobase = mem;
-+      ah->irq = irq;
-+      ah->devid = bcfg->devid;
-+
-+      if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
-+              /* Enable WMAC AHB arbitration */
-+              reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
-+              reg |= AR5K_AR2315_AHB_ARB_CTL_WLAN;
-+              iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
-+
-+              /* Enable global WMAC swapping */
-+              reg = ioread32((void __iomem *) AR5K_AR2315_BYTESWAP);
-+              reg |= AR5K_AR2315_BYTESWAP_WMAC;
-+              iowrite32(reg, (void __iomem *) AR5K_AR2315_BYTESWAP);
-+      } else {
-+              /* Enable WMAC DMA access (assuming 5312 or 231x*/
-+              /* TODO: check other platforms */
-+              reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
-+              if (to_platform_device(ah->dev)->id == 0)
-+                      reg |= AR5K_AR5312_ENABLE_WLAN0;
-+              else
-+                      reg |= AR5K_AR5312_ENABLE_WLAN1;
-+              iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
-+
-+              /*
-+               * On a dual-band AR5312, the multiband radio is only
-+               * used as pass-through. Disable 2 GHz support in the
-+               * driver for it
-+               */
-+              if (to_platform_device(ah->dev)->id == 0 &&
-+                  (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) ==
-+                   (BD_WLAN1 | BD_WLAN0))
-+                      ah->ah_capabilities.cap_needs_2GHz_ovr = true;
-+              else
-+                      ah->ah_capabilities.cap_needs_2GHz_ovr = false;
-+      }
-+
-+      ret = ath5k_init_ah(ah, &ath_ahb_bus_ops);
-+      if (ret != 0) {
-+              dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
-+              ret = -ENODEV;
-+              goto err_free_hw;
-+      }
-+
-+      platform_set_drvdata(pdev, hw);
-+
-+      return 0;
-+
-+ err_free_hw:
-+      ieee80211_free_hw(hw);
-+ err_iounmap:
-+        iounmap(mem);
-+ err_out:
-+      return ret;
-+}
-+
-+static int ath_ahb_remove(struct platform_device *pdev)
-+{
-+      struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
-+      struct ieee80211_hw *hw = platform_get_drvdata(pdev);
-+      struct ath5k_hw *ah;
-+      u32 reg;
-+
-+      if (!hw)
-+              return 0;
-+
-+      ah = hw->priv;
-+
-+      if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
-+              /* Disable WMAC AHB arbitration */
-+              reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
-+              reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN;
-+              iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
-+      } else {
-+              /*Stop DMA access */
-+              reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE);
-+              if (to_platform_device(ah->dev)->id == 0)
-+                      reg &= ~AR5K_AR5312_ENABLE_WLAN0;
-+              else
-+                      reg &= ~AR5K_AR5312_ENABLE_WLAN1;
-+              iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE);
-+      }
-+
-+      ath5k_deinit_ah(ah);
-+      iounmap(ah->iobase);
-+      ieee80211_free_hw(hw);
-+
-+      return 0;
-+}
-+
-+static struct platform_driver ath_ahb_driver = {
-+      .probe      = ath_ahb_probe,
-+      .remove     = ath_ahb_remove,
-+      .driver         = {
-+              .name   = "ar231x-wmac",
-+              .owner  = THIS_MODULE,
-+      },
-+};
-+
-+module_platform_driver(ath_ahb_driver);
---- a/drivers/net/wireless/ath/ath5k/ath5k.h
-+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
-@@ -1647,6 +1647,32 @@ static inline struct ath_regulatory *ath
-       return &(ath5k_hw_common(ah)->regulatory);
- }
-+#ifdef CONFIG_ATHEROS_AR231X
-+#define AR5K_AR2315_PCI_BASE  ((void __iomem *)0xb0100000)
-+
-+static inline void __iomem *ath5k_ahb_reg(struct ath5k_hw *ah, u16 reg)
-+{
-+      /* On AR2315 and AR2317 the PCI clock domain registers
-+       * are outside of the WMAC register space */
-+      if (unlikely((reg >= 0x4000) && (reg < 0x5000) &&
-+          (ah->ah_mac_srev >= AR5K_SREV_AR2315_R6)))
-+              return AR5K_AR2315_PCI_BASE + reg;
-+
-+      return ah->iobase + reg;
-+}
-+
-+static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
-+{
-+      return ioread32(ath5k_ahb_reg(ah, reg));
-+}
-+
-+static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
-+{
-+      iowrite32(val, ath5k_ahb_reg(ah, reg));
-+}
-+
-+#else
-+
- static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
- {
-       return ioread32(ah->iobase + reg);
-@@ -1657,6 +1683,8 @@ static inline void ath5k_hw_reg_write(st
-       iowrite32(val, ah->iobase + reg);
- }
-+#endif
-+
- static inline enum ath_bus_type ath5k_get_bus_type(struct ath5k_hw *ah)
- {
-       return ath5k_hw_common(ah)->bus_ops->ath_bus_type;
---- a/drivers/net/wireless/ath/ath5k/base.c
-+++ b/drivers/net/wireless/ath/ath5k/base.c
-@@ -99,6 +99,15 @@ static int ath5k_reset(struct ath5k_hw *
- /* Known SREVs */
- static const struct ath5k_srev_name srev_names[] = {
-+#ifdef CONFIG_ATHEROS_AR231X
-+      { "5312",       AR5K_VERSION_MAC,       AR5K_SREV_AR5312_R2 },
-+      { "5312",       AR5K_VERSION_MAC,       AR5K_SREV_AR5312_R7 },
-+      { "2313",       AR5K_VERSION_MAC,       AR5K_SREV_AR2313_R8 },
-+      { "2315",       AR5K_VERSION_MAC,       AR5K_SREV_AR2315_R6 },
-+      { "2315",       AR5K_VERSION_MAC,       AR5K_SREV_AR2315_R7 },
-+      { "2317",       AR5K_VERSION_MAC,       AR5K_SREV_AR2317_R1 },
-+      { "2317",       AR5K_VERSION_MAC,       AR5K_SREV_AR2317_R2 },
-+#else
-       { "5210",       AR5K_VERSION_MAC,       AR5K_SREV_AR5210 },
-       { "5311",       AR5K_VERSION_MAC,       AR5K_SREV_AR5311 },
-       { "5311A",      AR5K_VERSION_MAC,       AR5K_SREV_AR5311A },
-@@ -117,6 +126,7 @@ static const struct ath5k_srev_name srev
-       { "5418",       AR5K_VERSION_MAC,       AR5K_SREV_AR5418 },
-       { "2425",       AR5K_VERSION_MAC,       AR5K_SREV_AR2425 },
-       { "2417",       AR5K_VERSION_MAC,       AR5K_SREV_AR2417 },
-+#endif
-       { "xxxxx",      AR5K_VERSION_MAC,       AR5K_SREV_UNKNOWN },
-       { "5110",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5110 },
-       { "5111",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5111 },
-@@ -132,6 +142,10 @@ static const struct ath5k_srev_name srev
-       { "5413",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5413 },
-       { "5424",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5424 },
-       { "5133",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5133 },
-+#ifdef CONFIG_ATHEROS_AR231X
-+      { "2316",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_2316 },
-+      { "2317",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_2317 },
-+#endif
-       { "xxxxx",      AR5K_VERSION_RAD,       AR5K_SREV_UNKNOWN },
- };
---- a/drivers/net/wireless/ath/ath5k/led.c
-+++ b/drivers/net/wireless/ath/ath5k/led.c
-@@ -163,14 +163,20 @@ int ath5k_init_leds(struct ath5k_hw *ah)
- {
-       int ret = 0;
-       struct ieee80211_hw *hw = ah->hw;
-+#ifndef CONFIG_ATHEROS_AR231X
-       struct pci_dev *pdev = ah->pdev;
-+#endif
-       char name[ATH5K_LED_MAX_NAME_LEN + 1];
-       const struct pci_device_id *match;
-       if (!ah->pdev)
-               return 0;
-+#ifdef CONFIG_ATHEROS_AR231X
-+      match = NULL;
-+#else
-       match = pci_match_id(&ath5k_led_devices[0], pdev);
-+#endif
-       if (match) {
-               __set_bit(ATH_STAT_LEDSOFT, ah->status);
-               ah->led_pin = ATH_PIN(match->driver_data);
---- a/drivers/net/wireless/ath/ath5k/debug.c
-+++ b/drivers/net/wireless/ath/ath5k/debug.c
-@@ -65,6 +65,7 @@
- #include <linux/seq_file.h>
- #include <linux/list.h>
-+#include <linux/vmalloc.h>
- #include "debug.h"
- #include "ath5k.h"
- #include "reg.h"
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -222,31 +222,28 @@ static void ath9k_hw_read_revisions(stru
- {
-       u32 val;
-+      if (ah->get_mac_revision)
-+              ah->hw_version.macRev = ah->get_mac_revision();
-+
-       switch (ah->hw_version.devid) {
-       case AR5416_AR9100_DEVID:
-               ah->hw_version.macVersion = AR_SREV_VERSION_9100;
-               break;
-       case AR9300_DEVID_AR9330:
-               ah->hw_version.macVersion = AR_SREV_VERSION_9330;
--              if (ah->get_mac_revision) {
--                      ah->hw_version.macRev = ah->get_mac_revision();
--              } else {
-+              if (!ah->get_mac_revision) {
-                       val = REG_READ(ah, AR_SREV);
-                       ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
-               }
-               return;
-       case AR9300_DEVID_AR9340:
-               ah->hw_version.macVersion = AR_SREV_VERSION_9340;
--              val = REG_READ(ah, AR_SREV);
--              ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
-               return;
-       case AR9300_DEVID_QCA955X:
-               ah->hw_version.macVersion = AR_SREV_VERSION_9550;
-               return;
-       case AR9300_DEVID_AR953X:
-               ah->hw_version.macVersion = AR_SREV_VERSION_9531;
--              if (ah->get_mac_revision)
--                      ah->hw_version.macRev = ah->get_mac_revision();
-               return;
-       }
-@@ -704,6 +701,8 @@ static void ath9k_hw_init_pll(struct ath
- {
-       u32 pll;
-+      pll = ath9k_hw_compute_pll_control(ah, chan);
-+
-       if (AR_SREV_9485(ah) || AR_SREV_9565(ah)) {
-               /* program BB PLL ki and kd value, ki=0x4, kd=0x40 */
-               REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2,
-@@ -754,7 +753,8 @@ static void ath9k_hw_init_pll(struct ath
-               REG_RMW_FIELD(ah, AR_CH0_DDR_DPLL3,
-                             AR_CH0_DPLL3_PHASE_SHIFT, 0x1);
--              REG_WRITE(ah, AR_RTC_PLL_CONTROL, 0x1142c);
-+              REG_WRITE(ah, AR_RTC_PLL_CONTROL,
-+                        pll | AR_RTC_9300_PLL_BYPASS);
-               udelay(1000);
-               /* program refdiv, nint, frac to RTC register */
-@@ -770,7 +770,8 @@ static void ath9k_hw_init_pll(struct ath
-       } else if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
-               u32 regval, pll2_divint, pll2_divfrac, refdiv;
--              REG_WRITE(ah, AR_RTC_PLL_CONTROL, 0x1142c);
-+              REG_WRITE(ah, AR_RTC_PLL_CONTROL,
-+                        pll | AR_RTC_9300_SOC_PLL_BYPASS);
-               udelay(1000);
-               REG_SET_BIT(ah, AR_PHY_PLL_MODE, 0x1 << 16);
-@@ -843,7 +844,6 @@ static void ath9k_hw_init_pll(struct ath
-               udelay(1000);
-       }
--      pll = ath9k_hw_compute_pll_control(ah, chan);
-       if (AR_SREV_9565(ah))
-               pll |= 0x40000;
-       REG_WRITE(ah, AR_RTC_PLL_CONTROL, pll);
-@@ -1192,9 +1192,12 @@ static void ath9k_hw_set_operating_mode(
-       switch (opmode) {
-       case NL80211_IFTYPE_ADHOC:
--              set |= AR_STA_ID1_ADHOC;
--              REG_SET_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION);
--              break;
-+              if (!AR_SREV_9340_13(ah)) {
-+                      set |= AR_STA_ID1_ADHOC;
-+                      REG_SET_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION);
-+                      break;
-+              }
-+              /* fall through */
-       case NL80211_IFTYPE_MESH_POINT:
-       case NL80211_IFTYPE_AP:
-               set |= AR_STA_ID1_STA_AP;
---- a/drivers/net/wireless/ath/ath9k/reg.h
-+++ b/drivers/net/wireless/ath/ath9k/reg.h
-@@ -903,6 +903,10 @@
- #define AR_SREV_9340(_ah) \
-       (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340))
-+#define AR_SREV_9340_13(_ah) \
-+      (AR_SREV_9340((_ah)) && \
-+       ((_ah)->hw_version.macRev == AR_SREV_REVISION_9340_13))
-+
- #define AR_SREV_9340_13_OR_LATER(_ah) \
-       (AR_SREV_9340((_ah)) && \
-        ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9340_13))
-@@ -1240,12 +1244,23 @@ enum {
- #define AR_CH0_DPLL3_PHASE_SHIFT_S   23
- #define AR_PHY_CCA_NOM_VAL_2GHZ      -118
-+#define AR_RTC_9300_SOC_PLL_DIV_INT          0x0000003f
-+#define AR_RTC_9300_SOC_PLL_DIV_INT_S        0
-+#define AR_RTC_9300_SOC_PLL_DIV_FRAC         0x000fffc0
-+#define AR_RTC_9300_SOC_PLL_DIV_FRAC_S       6
-+#define AR_RTC_9300_SOC_PLL_REFDIV           0x01f00000
-+#define AR_RTC_9300_SOC_PLL_REFDIV_S         20
-+#define AR_RTC_9300_SOC_PLL_CLKSEL           0x06000000
-+#define AR_RTC_9300_SOC_PLL_CLKSEL_S         25
-+#define AR_RTC_9300_SOC_PLL_BYPASS           0x08000000
-+
- #define AR_RTC_9300_PLL_DIV          0x000003ff
- #define AR_RTC_9300_PLL_DIV_S        0
- #define AR_RTC_9300_PLL_REFDIV       0x00003C00
- #define AR_RTC_9300_PLL_REFDIV_S     10
- #define AR_RTC_9300_PLL_CLKSEL       0x0000C000
- #define AR_RTC_9300_PLL_CLKSEL_S     14
-+#define AR_RTC_9300_PLL_BYPASS       0x00010000
- #define AR_RTC_9160_PLL_DIV   0x000003ff
- #define AR_RTC_9160_PLL_DIV_S   0
---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
-@@ -1004,9 +1004,11 @@ static bool ar5008_hw_ani_control_new(st
-       case ATH9K_ANI_FIRSTEP_LEVEL:{
-               u32 level = param;
--              value = level;
-+              value = level * 2;
-               REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
-                             AR_PHY_FIND_SIG_FIRSTEP, value);
-+              REG_RMW_FIELD(ah, AR_PHY_FIND_SIG_LOW,
-+                            AR_PHY_FIND_SIG_FIRSTEP_LOW, value);
-               if (level != aniState->firstepLevel) {
-                       ath_dbg(common, ANI,
-@@ -1040,9 +1042,8 @@ static bool ar5008_hw_ani_control_new(st
-               REG_RMW_FIELD(ah, AR_PHY_TIMING5,
-                             AR_PHY_TIMING5_CYCPWR_THR1, value);
--              if (IS_CHAN_HT40(ah->curchan))
--                      REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
--                                    AR_PHY_EXT_TIMING5_CYCPWR_THR1, value);
-+              REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
-+                                AR_PHY_EXT_TIMING5_CYCPWR_THR1, value - 1);
-               if (level != aniState->spurImmunityLevel) {
-                       ath_dbg(common, ANI,
---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-@@ -517,6 +517,23 @@ static void ar9003_hw_spur_mitigate(stru
-       ar9003_hw_spur_mitigate_ofdm(ah, chan);
- }
-+static u32 ar9003_hw_compute_pll_control_soc(struct ath_hw *ah,
-+                                           struct ath9k_channel *chan)
-+{
-+      u32 pll;
-+
-+      pll = SM(0x5, AR_RTC_9300_SOC_PLL_REFDIV);
-+
-+      if (chan && IS_CHAN_HALF_RATE(chan))
-+              pll |= SM(0x1, AR_RTC_9300_SOC_PLL_CLKSEL);
-+      else if (chan && IS_CHAN_QUARTER_RATE(chan))
-+              pll |= SM(0x2, AR_RTC_9300_SOC_PLL_CLKSEL);
-+
-+      pll |= SM(0x2c, AR_RTC_9300_SOC_PLL_DIV_INT);
-+
-+      return pll;
-+}
-+
- static u32 ar9003_hw_compute_pll_control(struct ath_hw *ah,
-                                        struct ath9k_channel *chan)
- {
-@@ -1781,7 +1798,12 @@ void ar9003_hw_attach_phy_ops(struct ath
-       priv_ops->rf_set_freq = ar9003_hw_set_channel;
-       priv_ops->spur_mitigate_freq = ar9003_hw_spur_mitigate;
--      priv_ops->compute_pll_control = ar9003_hw_compute_pll_control;
-+
-+      if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah))
-+              priv_ops->compute_pll_control = ar9003_hw_compute_pll_control_soc;
-+      else
-+              priv_ops->compute_pll_control = ar9003_hw_compute_pll_control;
-+
-       priv_ops->set_channel_regs = ar9003_hw_set_channel_regs;
-       priv_ops->init_bb = ar9003_hw_init_bb;
-       priv_ops->process_ini = ar9003_hw_process_ini;
---- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
-@@ -381,16 +381,27 @@ static int ar9002_hw_proc_txdesc(struct 
-       ts->evm1 = ads->AR_TxEVM1;
-       ts->evm2 = ads->AR_TxEVM2;
--      status = ACCESS_ONCE(ads->ds_ctl4);
--      ts->duration[0] = MS(status, AR_PacketDur0);
--      ts->duration[1] = MS(status, AR_PacketDur1);
--      status = ACCESS_ONCE(ads->ds_ctl5);
--      ts->duration[2] = MS(status, AR_PacketDur2);
--      ts->duration[3] = MS(status, AR_PacketDur3);
--
-       return 0;
- }
-+static int ar9002_hw_get_duration(struct ath_hw *ah, const void *ds, int index)
-+{
-+      struct ar5416_desc *ads = AR5416DESC(ds);
-+
-+      switch (index) {
-+      case 0:
-+              return MS(ACCESS_ONCE(ads->ds_ctl4), AR_PacketDur0);
-+      case 1:
-+              return MS(ACCESS_ONCE(ads->ds_ctl4), AR_PacketDur1);
-+      case 2:
-+              return MS(ACCESS_ONCE(ads->ds_ctl5), AR_PacketDur2);
-+      case 3:
-+              return MS(ACCESS_ONCE(ads->ds_ctl5), AR_PacketDur3);
-+      default:
-+              return -1;
-+      }
-+}
-+
- void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds,
-                         u32 size, u32 flags)
- {
-@@ -413,4 +424,5 @@ void ar9002_hw_attach_mac_ops(struct ath
-       ops->get_isr = ar9002_hw_get_isr;
-       ops->set_txdesc = ar9002_set_txdesc;
-       ops->proc_txdesc = ar9002_hw_proc_txdesc;
-+      ops->get_duration = ar9002_hw_get_duration;
- }
---- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
-@@ -355,11 +355,9 @@ static int ar9003_hw_proc_txdesc(struct 
-                                struct ath_tx_status *ts)
- {
-       struct ar9003_txs *ads;
--      struct ar9003_txc *adc;
-       u32 status;
-       ads = &ah->ts_ring[ah->ts_tail];
--      adc = (struct ar9003_txc *)ads;
-       status = ACCESS_ONCE(ads->status8);
-       if ((status & AR_TxDone) == 0)
-@@ -428,18 +426,29 @@ static int ar9003_hw_proc_txdesc(struct 
-       ts->ts_rssi_ext1 = MS(status, AR_TxRSSIAnt11);
-       ts->ts_rssi_ext2 = MS(status, AR_TxRSSIAnt12);
--      status = ACCESS_ONCE(adc->ctl15);
--      ts->duration[0] = MS(status, AR_PacketDur0);
--      ts->duration[1] = MS(status, AR_PacketDur1);
--      status = ACCESS_ONCE(adc->ctl16);
--      ts->duration[2] = MS(status, AR_PacketDur2);
--      ts->duration[3] = MS(status, AR_PacketDur3);
--
-       memset(ads, 0, sizeof(*ads));
-       return 0;
- }
-+static int ar9003_hw_get_duration(struct ath_hw *ah, const void *ds, int index)
-+{
-+      const struct ar9003_txc *adc = ds;
-+
-+      switch (index) {
-+      case 0:
-+              return MS(ACCESS_ONCE(adc->ctl15), AR_PacketDur0);
-+      case 1:
-+              return MS(ACCESS_ONCE(adc->ctl15), AR_PacketDur1);
-+      case 2:
-+              return MS(ACCESS_ONCE(adc->ctl16), AR_PacketDur2);
-+      case 3:
-+              return MS(ACCESS_ONCE(adc->ctl16), AR_PacketDur3);
-+      default:
-+              return 0;
-+      }
-+}
-+
- void ar9003_hw_attach_mac_ops(struct ath_hw *hw)
- {
-       struct ath_hw_ops *ops = ath9k_hw_ops(hw);
-@@ -449,6 +458,7 @@ void ar9003_hw_attach_mac_ops(struct ath
-       ops->get_isr = ar9003_hw_get_isr;
-       ops->set_txdesc = ar9003_set_txdesc;
-       ops->proc_txdesc = ar9003_hw_proc_txdesc;
-+      ops->get_duration = ar9003_hw_get_duration;
- }
- void ath9k_hw_set_rx_bufsize(struct ath_hw *ah, u16 buf_size)
---- a/drivers/net/wireless/ath/ath9k/dynack.c
-+++ b/drivers/net/wireless/ath/ath9k/dynack.c
-@@ -202,7 +202,7 @@ void ath_dynack_sample_tx_ts(struct ath_
-       ridx = ts->ts_rateindex;
-       da->st_rbf.ts[da->st_rbf.t_rb].tstamp = ts->ts_tstamp;
--      da->st_rbf.ts[da->st_rbf.t_rb].dur = ts->duration[ts->ts_rateindex];
-+      da->st_rbf.ts[da->st_rbf.t_rb].dur = ts->duration;
-       ether_addr_copy(da->st_rbf.addr[da->st_rbf.t_rb].h_dest, hdr->addr1);
-       ether_addr_copy(da->st_rbf.addr[da->st_rbf.t_rb].h_src, hdr->addr2);
---- a/drivers/net/wireless/ath/ath9k/hw-ops.h
-+++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
-@@ -67,6 +67,12 @@ static inline int ath9k_hw_txprocdesc(st
-       return ath9k_hw_ops(ah)->proc_txdesc(ah, ds, ts);
- }
-+static inline int ath9k_hw_get_duration(struct ath_hw *ah, const void *ds,
-+                                      int index)
-+{
-+      return ath9k_hw_ops(ah)->get_duration(ah, ds, index);
-+}
-+
- static inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
-               struct ath_hw_antcomb_conf *antconf)
- {
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -691,6 +691,7 @@ struct ath_hw_ops {
-                          struct ath_tx_info *i);
-       int (*proc_txdesc)(struct ath_hw *ah, void *ds,
-                          struct ath_tx_status *ts);
-+      int (*get_duration)(struct ath_hw *ah, const void *ds, int index);
-       void (*antdiv_comb_conf_get)(struct ath_hw *ah,
-                       struct ath_hw_antcomb_conf *antconf);
-       void (*antdiv_comb_conf_set)(struct ath_hw *ah,
---- a/drivers/net/wireless/ath/ath9k/mac.h
-+++ b/drivers/net/wireless/ath/ath9k/mac.h
-@@ -121,7 +121,7 @@ struct ath_tx_status {
-       u32 evm0;
-       u32 evm1;
-       u32 evm2;
--      u32 duration[4];
-+      u32 duration;
- };
- struct ath_rx_status {
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -683,6 +683,8 @@ static void ath_tx_process_buffer(struct
-       if (bf_is_ampdu_not_probing(bf))
-               txq->axq_ampdu_depth--;
-+      ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc,
-+                                           ts->ts_rateindex);
-       if (!bf_isampdu(bf)) {
-               if (!flush) {
-                       info = IEEE80211_SKB_CB(bf->bf_mpdu);
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -455,7 +455,8 @@ void ath9k_p2p_bss_info_changed(struct a
- void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
-                         struct sk_buff *skb);
- void ath9k_p2p_ps_timer(void *priv);
--void ath9k_chanctx_wake_queues(struct ath_softc *sc);
-+void ath9k_chanctx_wake_queues(struct ath_softc *sc, struct ath_chanctx *ctx);
-+void ath9k_chanctx_stop_queues(struct ath_softc *sc, struct ath_chanctx *ctx);
- void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx);
- void ath_chanctx_beacon_recv_ev(struct ath_softc *sc,
-@@ -525,7 +526,12 @@ static inline void ath9k_beacon_add_noa(
- static inline void ath9k_p2p_ps_timer(struct ath_softc *sc)
- {
- }
--static inline void ath9k_chanctx_wake_queues(struct ath_softc *sc)
-+static inline void ath9k_chanctx_wake_queues(struct ath_softc *sc,
-+                                           struct ath_chanctx *ctx)
-+{
-+}
-+static inline void ath9k_chanctx_stop_queues(struct ath_softc *sc,
-+                                           struct ath_chanctx *ctx)
- {
- }
- static inline void ath_chanctx_check_active(struct ath_softc *sc,
---- a/drivers/net/wireless/ath/ath9k/channel.c
-+++ b/drivers/net/wireless/ath/ath9k/channel.c
-@@ -761,6 +761,13 @@ void ath_offchannel_next(struct ath_soft
- void ath_roc_complete(struct ath_softc *sc, bool abort)
- {
-+      struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-+
-+      if (abort)
-+              ath_dbg(common, CHAN_CTX, "RoC aborted\n");
-+      else
-+              ath_dbg(common, CHAN_CTX, "RoC expired\n");
-+
-       sc->offchannel.roc_vif = NULL;
-       sc->offchannel.roc_chan = NULL;
-       if (!abort)
-@@ -1037,9 +1044,11 @@ static void ath_offchannel_channel_chang
- void ath_chanctx_set_next(struct ath_softc *sc, bool force)
- {
-       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-+      struct ath_chanctx *old_ctx;
-       struct timespec ts;
-       bool measure_time = false;
-       bool send_ps = false;
-+      bool queues_stopped = false;
-       spin_lock_bh(&sc->chan_lock);
-       if (!sc->next_chan) {
-@@ -1069,6 +1078,10 @@ void ath_chanctx_set_next(struct ath_sof
-                       getrawmonotonic(&ts);
-                       measure_time = true;
-               }
-+
-+              ath9k_chanctx_stop_queues(sc, sc->cur_chan);
-+              queues_stopped = true;
-+
-               __ath9k_flush(sc->hw, ~0, true);
-               if (ath_chanctx_send_ps_frame(sc, true))
-@@ -1082,6 +1095,7 @@ void ath_chanctx_set_next(struct ath_sof
-                       sc->cur_chan->tsf_val = ath9k_hw_gettsf64(sc->sc_ah);
-               }
-       }
-+      old_ctx = sc->cur_chan;
-       sc->cur_chan = sc->next_chan;
-       sc->cur_chan->stopped = false;
-       sc->next_chan = NULL;
-@@ -1104,7 +1118,16 @@ void ath_chanctx_set_next(struct ath_sof
-               if (measure_time)
-                       sc->sched.channel_switch_time =
-                               ath9k_hw_get_tsf_offset(&ts, NULL);
-+              /*
-+               * A reset will ensure that all queues are woken up,
-+               * so there is no need to awaken them again.
-+               */
-+              goto out;
-       }
-+
-+      if (queues_stopped)
-+              ath9k_chanctx_wake_queues(sc, old_ctx);
-+out:
-       if (send_ps)
-               ath_chanctx_send_ps_frame(sc, false);
-@@ -1170,18 +1193,37 @@ bool ath9k_is_chanctx_enabled(void)
- /* Queue management */
- /********************/
--void ath9k_chanctx_wake_queues(struct ath_softc *sc)
-+void ath9k_chanctx_stop_queues(struct ath_softc *sc, struct ath_chanctx *ctx)
-+{
-+      struct ath_hw *ah = sc->sc_ah;
-+      int i;
-+
-+      if (ctx == &sc->offchannel.chan) {
-+              ieee80211_stop_queue(sc->hw,
-+                                   sc->hw->offchannel_tx_hw_queue);
-+      } else {
-+              for (i = 0; i < IEEE80211_NUM_ACS; i++)
-+                      ieee80211_stop_queue(sc->hw,
-+                                           ctx->hw_queue_base + i);
-+      }
-+
-+      if (ah->opmode == NL80211_IFTYPE_AP)
-+              ieee80211_stop_queue(sc->hw, sc->hw->queues - 2);
-+}
-+
-+
-+void ath9k_chanctx_wake_queues(struct ath_softc *sc, struct ath_chanctx *ctx)
- {
-       struct ath_hw *ah = sc->sc_ah;
-       int i;
--      if (sc->cur_chan == &sc->offchannel.chan) {
-+      if (ctx == &sc->offchannel.chan) {
-               ieee80211_wake_queue(sc->hw,
-                                    sc->hw->offchannel_tx_hw_queue);
-       } else {
-               for (i = 0; i < IEEE80211_NUM_ACS; i++)
-                       ieee80211_wake_queue(sc->hw,
--                                           sc->cur_chan->hw_queue_base + i);
-+                                           ctx->hw_queue_base + i);
-       }
-       if (ah->opmode == NL80211_IFTYPE_AP)
---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
-+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
-@@ -464,6 +464,7 @@ static int ath9k_init_priv(struct ath9k_
-               return -ENOMEM;
-       ah->dev = priv->dev;
-+      ah->hw = priv->hw;
-       ah->hw_version.devid = devid;
-       ah->hw_version.usbdev = drv_info;
-       ah->ah_flags |= AH_USE_EEPROM;
---- a/drivers/net/wireless/ath/ath9k/main.c
-+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -60,8 +60,10 @@ static bool ath9k_has_pending_frames(str
-       spin_lock_bh(&txq->axq_lock);
--      if (txq->axq_depth)
-+      if (txq->axq_depth) {
-               pending = true;
-+              goto out;
-+      }
-       if (txq->mac80211_qnum >= 0) {
-               struct list_head *list;
-@@ -70,6 +72,7 @@ static bool ath9k_has_pending_frames(str
-               if (!list_empty(list))
-                       pending = true;
-       }
-+out:
-       spin_unlock_bh(&txq->axq_lock);
-       return pending;
- }
-@@ -261,12 +264,7 @@ static bool ath_complete_reset(struct at
-       ath9k_hw_set_interrupts(ah);
-       ath9k_hw_enable_interrupts(ah);
--
--      if (!ath9k_is_chanctx_enabled())
--              ieee80211_wake_queues(sc->hw);
--      else
--              ath9k_chanctx_wake_queues(sc);
--
-+      ieee80211_wake_queues(sc->hw);
-       ath9k_p2p_ps_timer(sc);
-       return true;
-@@ -1971,9 +1969,6 @@ static bool ath9k_has_tx_pending(struct 
-               if (!ATH_TXQ_SETUP(sc, i))
-                       continue;
--              if (!sc->tx.txq[i].axq_depth)
--                      continue;
--
-               npend = ath9k_has_pending_frames(sc, &sc->tx.txq[i]);
-               if (npend)
-                       break;
-@@ -1999,7 +1994,6 @@ void __ath9k_flush(struct ieee80211_hw *
-       struct ath_common *common = ath9k_hw_common(ah);
-       int timeout = HZ / 5; /* 200 ms */
-       bool drain_txq;
--      int i;
-       cancel_delayed_work_sync(&sc->tx_complete_work);
-@@ -2027,10 +2021,6 @@ void __ath9k_flush(struct ieee80211_hw *
-                       ath_reset(sc);
-               ath9k_ps_restore(sc);
--              for (i = 0; i < IEEE80211_NUM_ACS; i++) {
--                      ieee80211_wake_queue(sc->hw,
--                                           sc->cur_chan->hw_queue_base + i);
--              }
-       }
-       ieee80211_queue_delayed_work(hw, &sc->tx_complete_work, 0);
-@@ -2039,16 +2029,8 @@ void __ath9k_flush(struct ieee80211_hw *
- static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw)
- {
-       struct ath_softc *sc = hw->priv;
--      int i;
--
--      for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
--              if (!ATH_TXQ_SETUP(sc, i))
--                      continue;
--              if (ath9k_has_pending_frames(sc, &sc->tx.txq[i]))
--                      return true;
--      }
--      return false;
-+      return ath9k_has_tx_pending(sc);
- }
- static int ath9k_tx_last_beacon(struct ieee80211_hw *hw)
-@@ -2350,7 +2332,7 @@ static void ath9k_remove_chanctx(struct 
-               conf->def.chan->center_freq);
-       ctx->assigned = false;
--      ctx->hw_queue_base = -1;
-+      ctx->hw_queue_base = 0;
-       ath_chanctx_event(sc, NULL, ATH_CHANCTX_EVENT_UNASSIGN);
-       mutex_unlock(&sc->mutex);
---- a/net/mac80211/rate.c
-+++ b/net/mac80211/rate.c
-@@ -448,7 +448,7 @@ static void rate_fixup_ratelist(struct i
-        */
-       if (!(rates[0].flags & IEEE80211_TX_RC_MCS)) {
-               u32 basic_rates = vif->bss_conf.basic_rates;
--              s8 baserate = basic_rates ? ffs(basic_rates - 1) : 0;
-+              s8 baserate = basic_rates ? ffs(basic_rates) - 1 : 0;
-               rate = &sband->bitrates[rates[0].idx];
diff --git a/package/kernel/mac80211/patches/301-ath5k-fix-AHB-kconfig-dependency.patch b/package/kernel/mac80211/patches/301-ath5k-fix-AHB-kconfig-dependency.patch
new file mode 100644 (file)
index 0000000..5db28be
--- /dev/null
@@ -0,0 +1,37 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 27 Sep 2014 15:58:51 +0200
+Subject: [PATCH] ath5k: fix AHB kconfig dependency
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath5k/Kconfig
++++ b/drivers/net/wireless/ath/ath5k/Kconfig
+@@ -7,8 +7,8 @@ config ATH5K
+       select BACKPORT_LEDS_CLASS
+       select BACKPORT_NEW_LEDS
+       select BACKPORT_AVERAGE
+-      select ATH5K_AHB if (ATHEROS_AR231X && !PCI)
+-      select ATH5K_PCI if (!ATHEROS_AR231X && PCI)
++      select ATH5K_AHB if ATHEROS_AR231X
++      select ATH5K_PCI if !ATHEROS_AR231X
+       ---help---
+         This module adds support for wireless adapters based on
+         Atheros 5xxx chipset.
+@@ -55,14 +55,14 @@ config ATH5K_TRACER
+ config ATH5K_AHB
+       bool "Atheros 5xxx AHB bus support"
+-      depends on (ATHEROS_AR231X && !PCI)
++      depends on ATHEROS_AR231X
+       ---help---
+         This adds support for WiSoC type chipsets of the 5xxx Atheros
+         family.
+ config ATH5K_PCI
+       bool "Atheros 5xxx PCI bus support"
+-      depends on (!ATHEROS_AR231X && PCI)
++      depends on !ATHEROS_AR231X
+       ---help---
+         This adds support for PCI type chipsets of the 5xxx Atheros
+         family.
diff --git a/package/kernel/mac80211/patches/302-mac80211-trivial-fix-typo-in-starting-baserate-for-r.patch b/package/kernel/mac80211/patches/302-mac80211-trivial-fix-typo-in-starting-baserate-for-r.patch
new file mode 100644 (file)
index 0000000..c4c416d
--- /dev/null
@@ -0,0 +1,20 @@
+From: Karl Beldan <karl.beldan@rivierawaves.com>
+Date: Tue, 7 Oct 2014 15:53:38 +0200
+Subject: [PATCH] mac80211/trivial: fix typo in starting baserate for
+ rts_cts_rate_idx
+
+Fixes: 5253ffb8 ("mac80211: always pick a basic rate to tx RTS/CTS for pre-HT rates")
+Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
+---
+
+--- a/net/mac80211/rate.c
++++ b/net/mac80211/rate.c
+@@ -448,7 +448,7 @@ static void rate_fixup_ratelist(struct i
+        */
+       if (!(rates[0].flags & IEEE80211_TX_RC_MCS)) {
+               u32 basic_rates = vif->bss_conf.basic_rates;
+-              s8 baserate = basic_rates ? ffs(basic_rates - 1) : 0;
++              s8 baserate = basic_rates ? ffs(basic_rates) - 1 : 0;
+               rate = &sband->bitrates[rates[0].idx];
diff --git a/package/kernel/mac80211/patches/303-ath9k-Use-sta_state-callback.patch b/package/kernel/mac80211/patches/303-ath9k-Use-sta_state-callback.patch
new file mode 100644 (file)
index 0000000..03f1304
--- /dev/null
@@ -0,0 +1,55 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:08 +0530
+Subject: [PATCH] ath9k: Use sta_state() callback
+
+Instead of using the sta_add()/sta_remove() callbacks,
+use the sta_state() callback since this gives
+more fine-grained control.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -1547,6 +1547,31 @@ static int ath9k_sta_remove(struct ieee8
+       return 0;
+ }
++static int ath9k_sta_state(struct ieee80211_hw *hw,
++                         struct ieee80211_vif *vif,
++                         struct ieee80211_sta *sta,
++                         enum ieee80211_sta_state old_state,
++                         enum ieee80211_sta_state new_state)
++{
++      struct ath_softc *sc = hw->priv;
++      struct ath_common *common = ath9k_hw_common(sc->sc_ah);
++      int ret = 0;
++
++      if (old_state == IEEE80211_STA_AUTH &&
++          new_state == IEEE80211_STA_ASSOC) {
++              ret = ath9k_sta_add(hw, vif, sta);
++              ath_dbg(common, CONFIG,
++                      "Add station: %pM\n", sta->addr);
++      } else if (old_state == IEEE80211_STA_ASSOC &&
++                 new_state == IEEE80211_STA_AUTH) {
++              ret = ath9k_sta_remove(hw, vif, sta);
++              ath_dbg(common, CONFIG,
++                      "Remove station: %pM\n", sta->addr);
++      }
++
++      return ret;
++}
++
+ static void ath9k_sta_set_tx_filter(struct ath_hw *ah,
+                                   struct ath_node *an,
+                                   bool set)
+@@ -2471,8 +2496,7 @@ struct ieee80211_ops ath9k_ops = {
+       .remove_interface   = ath9k_remove_interface,
+       .config             = ath9k_config,
+       .configure_filter   = ath9k_configure_filter,
+-      .sta_add            = ath9k_sta_add,
+-      .sta_remove         = ath9k_sta_remove,
++      .sta_state          = ath9k_sta_state,
+       .sta_notify         = ath9k_sta_notify,
+       .conf_tx            = ath9k_conf_tx,
+       .bss_info_changed   = ath9k_bss_info_changed,
diff --git a/package/kernel/mac80211/patches/304-ath9k-Enable-multi-channel-properly.patch b/package/kernel/mac80211/patches/304-ath9k-Enable-multi-channel-properly.patch
new file mode 100644 (file)
index 0000000..e743eb8
--- /dev/null
@@ -0,0 +1,82 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:09 +0530
+Subject: [PATCH] ath9k: Enable multi-channel properly
+
+In MCC mode, currently the decision to enable
+the multi-channel state machine is done
+based on the association status if one of
+the interfaces assigned to a context is in
+station mode.
+
+This allows the driver to switch to the other
+context before the current station is able to
+complete the 4-way handshake in case it is
+required and this causes problems.
+
+Instead, enable multi-channel mode when the
+station moves to the authorized state. This
+disallows an early switch to the other channel.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -362,7 +362,7 @@ enum ath_chanctx_event {
+       ATH_CHANCTX_EVENT_BEACON_SENT,
+       ATH_CHANCTX_EVENT_TSF_TIMER,
+       ATH_CHANCTX_EVENT_BEACON_RECEIVED,
+-      ATH_CHANCTX_EVENT_ASSOC,
++      ATH_CHANCTX_EVENT_AUTHORIZED,
+       ATH_CHANCTX_EVENT_SWITCH,
+       ATH_CHANCTX_EVENT_ASSIGN,
+       ATH_CHANCTX_EVENT_UNASSIGN,
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -171,7 +171,7 @@ static const char *chanctx_event_string(
+               case_rtn_string(ATH_CHANCTX_EVENT_BEACON_SENT);
+               case_rtn_string(ATH_CHANCTX_EVENT_TSF_TIMER);
+               case_rtn_string(ATH_CHANCTX_EVENT_BEACON_RECEIVED);
+-              case_rtn_string(ATH_CHANCTX_EVENT_ASSOC);
++              case_rtn_string(ATH_CHANCTX_EVENT_AUTHORIZED);
+               case_rtn_string(ATH_CHANCTX_EVENT_SWITCH);
+               case_rtn_string(ATH_CHANCTX_EVENT_ASSIGN);
+               case_rtn_string(ATH_CHANCTX_EVENT_UNASSIGN);
+@@ -510,7 +510,7 @@ void ath_chanctx_event(struct ath_softc 
+               ath_chanctx_setup_timer(sc, tsf_time);
+               break;
+-      case ATH_CHANCTX_EVENT_ASSOC:
++      case ATH_CHANCTX_EVENT_AUTHORIZED:
+               if (sc->sched.state != ATH_CHANCTX_STATE_FORCE_ACTIVE ||
+                   avp->chanctx != sc->cur_chan)
+                       break;
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -1569,6 +1569,13 @@ static int ath9k_sta_state(struct ieee80
+                       "Remove station: %pM\n", sta->addr);
+       }
++      if (ath9k_is_chanctx_enabled()) {
++              if (old_state == IEEE80211_STA_ASSOC &&
++                  new_state == IEEE80211_STA_AUTHORIZED)
++                      ath_chanctx_event(sc, vif,
++                                        ATH_CHANCTX_EVENT_AUTHORIZED);
++      }
++
+       return ret;
+ }
+@@ -1761,12 +1768,6 @@ static void ath9k_bss_info_changed(struc
+               avp->assoc = bss_conf->assoc;
+               ath9k_calculate_summary_state(sc, avp->chanctx);
+-
+-              if (ath9k_is_chanctx_enabled()) {
+-                      if (bss_conf->assoc)
+-                              ath_chanctx_event(sc, vif,
+-                                                ATH_CHANCTX_EVENT_ASSOC);
+-              }
+       }
+       if (changed & BSS_CHANGED_IBSS) {
diff --git a/package/kernel/mac80211/patches/305-ath9k-Process-beacons-properly.patch b/package/kernel/mac80211/patches/305-ath9k-Process-beacons-properly.patch
new file mode 100644 (file)
index 0000000..36da404
--- /dev/null
@@ -0,0 +1,37 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:10 +0530
+Subject: [PATCH] ath9k: Process beacons properly
+
+When the current operating channel context has
+been marked as ATH_CHANCTX_STATE_FORCE_ACTIVE,
+do not process beacons that might be received,
+since we have to wait for the station to become
+authorized.
+
+Also, since the cached TSF value will be zero
+initially do not rearm the timer in this
+case when a beacon is received, since it results
+in spurious values.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -495,10 +495,15 @@ void ath_chanctx_event(struct ath_softc 
+                   sc->cur_chan == &sc->offchannel.chan)
+                       break;
+-              ath_chanctx_adjust_tbtt_delta(sc);
+               sc->sched.beacon_pending = false;
+               sc->sched.beacon_miss = 0;
++              if (sc->sched.state == ATH_CHANCTX_STATE_FORCE_ACTIVE ||
++                  !sc->cur_chan->tsf_val)
++                      break;
++
++              ath_chanctx_adjust_tbtt_delta(sc);
++
+               /* TSF time might have been updated by the incoming beacon,
+                * need update the channel switch timer to reflect the change.
+                */
diff --git a/package/kernel/mac80211/patches/306-ath9k-Unify-reset-API.patch b/package/kernel/mac80211/patches/306-ath9k-Unify-reset-API.patch
new file mode 100644 (file)
index 0000000..6460a32
--- /dev/null
@@ -0,0 +1,108 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:11 +0530
+Subject: [PATCH] ath9k: Unify reset API
+
+Instead of having ath_reset_internal() and ath_reset()
+as two separate calls to perform a HW reset, have
+one function. This makes sure that the behavior will
+be the same at all callsites.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -540,7 +540,6 @@ static inline void ath_chanctx_check_act
+ #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
+-int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan);
+ void ath_startrecv(struct ath_softc *sc);
+ bool ath_stoprecv(struct ath_softc *sc);
+ u32 ath_calcrxfilter(struct ath_softc *sc);
+@@ -1069,7 +1068,7 @@ void ath9k_tasklet(unsigned long data);
+ int ath_cabq_update(struct ath_softc *);
+ u8 ath9k_parse_mpdudensity(u8 mpdudensity);
+ irqreturn_t ath_isr(int irq, void *dev);
+-int ath_reset(struct ath_softc *sc);
++int ath_reset(struct ath_softc *sc, struct ath9k_channel *hchan);
+ void ath_cancel_work(struct ath_softc *sc);
+ void ath_restart_work(struct ath_softc *sc);
+ int ath9k_init_device(u16 devid, struct ath_softc *sc,
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -66,7 +66,7 @@ static int ath_set_channel(struct ath_so
+       }
+       hchan = &sc->sc_ah->channels[pos];
+-      r = ath_reset_internal(sc, hchan);
++      r = ath_reset(sc, hchan);
+       if (r)
+               return r;
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -270,7 +270,7 @@ static bool ath_complete_reset(struct at
+       return true;
+ }
+-int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan)
++static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan)
+ {
+       struct ath_hw *ah = sc->sc_ah;
+       struct ath_common *common = ath9k_hw_common(ah);
+@@ -598,12 +598,12 @@ chip_reset:
+ #undef SCHED_INTR
+ }
+-int ath_reset(struct ath_softc *sc)
++int ath_reset(struct ath_softc *sc, struct ath9k_channel *hchan)
+ {
+       int r;
+       ath9k_ps_wakeup(sc);
+-      r = ath_reset_internal(sc, NULL);
++      r = ath_reset_internal(sc, hchan);
+       ath9k_ps_restore(sc);
+       return r;
+@@ -623,7 +623,9 @@ void ath_reset_work(struct work_struct *
+ {
+       struct ath_softc *sc = container_of(work, struct ath_softc, hw_reset_work);
+-      ath_reset(sc);
++      ath9k_ps_wakeup(sc);
++      ath_reset_internal(sc, NULL);
++      ath9k_ps_restore(sc);
+ }
+ /**********************/
+@@ -2044,7 +2046,7 @@ void __ath9k_flush(struct ieee80211_hw *
+               spin_unlock_bh(&sc->sc_pcu_lock);
+               if (!drain_txq)
+-                      ath_reset(sc);
++                      ath_reset(sc, NULL);
+               ath9k_ps_restore(sc);
+       }
+--- a/drivers/net/wireless/ath/ath9k/tx99.c
++++ b/drivers/net/wireless/ath/ath9k/tx99.c
+@@ -99,7 +99,7 @@ static struct sk_buff *ath9k_build_tx99_
+ static void ath9k_tx99_deinit(struct ath_softc *sc)
+ {
+-      ath_reset(sc);
++      ath_reset(sc, NULL);
+       ath9k_ps_wakeup(sc);
+       ath9k_tx99_stop(sc);
+@@ -127,7 +127,7 @@ static int ath9k_tx99_init(struct ath_so
+       memset(&txctl, 0, sizeof(txctl));
+       txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
+-      ath_reset(sc);
++      ath_reset(sc, NULL);
+       ath9k_ps_wakeup(sc);
diff --git a/package/kernel/mac80211/patches/307-ath9k-Set-ATH_OP_HW_RESET-before-HW-reset.patch b/package/kernel/mac80211/patches/307-ath9k-Set-ATH_OP_HW_RESET-before-HW-reset.patch
new file mode 100644 (file)
index 0000000..75a2ab5
--- /dev/null
@@ -0,0 +1,55 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:12 +0530
+Subject: [PATCH] ath9k: Set ATH_OP_HW_RESET before HW reset
+
+When a HW reset is done, the interrupt tasklet is
+disabled before ISRs are disabled in the HW. This
+allows a small window where the HW can still generate
+interrupts. Since the tasklet is disabled and not killed,
+it is not scheduled but deferred for execution at a later
+time.
+
+This happens because ATH_OP_HW_RESET is not set when ath_reset()
+is called. When the hw_reset_work workqueue is used, this
+problem doesn't arise because ATH_OP_HW_RESET is set
+and the ISR bails out.
+
+Set ATH_OP_HW_RESET properly in ath_reset() to avoid
+this race - all the ath_reset_internal() callers have
+been converted to use ath_reset() in the previous patch.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -598,10 +598,17 @@ chip_reset:
+ #undef SCHED_INTR
+ }
++/*
++ * This function is called when a HW reset cannot be deferred
++ * and has to be immediate.
++ */
+ int ath_reset(struct ath_softc *sc, struct ath9k_channel *hchan)
+ {
++      struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+       int r;
++      set_bit(ATH_OP_HW_RESET, &common->op_flags);
++
+       ath9k_ps_wakeup(sc);
+       r = ath_reset_internal(sc, hchan);
+       ath9k_ps_restore(sc);
+@@ -609,6 +616,11 @@ int ath_reset(struct ath_softc *sc, stru
+       return r;
+ }
++/*
++ * When a HW reset can be deferred, it is added to the
++ * hw_reset_work workqueue, but we set ATH_OP_HW_RESET before
++ * queueing.
++ */
+ void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type)
+ {
+       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
diff --git a/package/kernel/mac80211/patches/308-ath9k-Disable-beacon-tasklet-during-reset.patch b/package/kernel/mac80211/patches/308-ath9k-Disable-beacon-tasklet-during-reset.patch
new file mode 100644 (file)
index 0000000..faf282d
--- /dev/null
@@ -0,0 +1,29 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:13 +0530
+Subject: [PATCH] ath9k: Disable beacon tasklet during reset
+
+When a chip reset is done, all running timers,
+tasklets etc. are stopped but the beacon tasklet
+is left running. Fix this.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -281,6 +281,7 @@ static int ath_reset_internal(struct ath
+       __ath_cancel_work(sc);
+       tasklet_disable(&sc->intr_tq);
++      tasklet_disable(&sc->bcon_tasklet);
+       spin_lock_bh(&sc->sc_pcu_lock);
+       if (!sc->cur_chan->offchannel) {
+@@ -326,6 +327,7 @@ static int ath_reset_internal(struct ath
+ out:
+       spin_unlock_bh(&sc->sc_pcu_lock);
++      tasklet_enable(&sc->bcon_tasklet);
+       tasklet_enable(&sc->intr_tq);
+       return r;
diff --git a/package/kernel/mac80211/patches/309-ath9k-Clear-NoA-schedule-properly.patch b/package/kernel/mac80211/patches/309-ath9k-Clear-NoA-schedule-properly.patch
new file mode 100644 (file)
index 0000000..6089d60
--- /dev/null
@@ -0,0 +1,36 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:14 +0530
+Subject: [PATCH] ath9k: Clear NoA schedule properly
+
+When an active context transitions to inactive
+state, the NoA schedule needs to be removed
+for the context that has beaconing enabled.
+Not doing this will affect p2p clients.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -356,6 +356,21 @@ void ath_chanctx_event(struct ath_softc 
+                               "Move chanctx state from WAIT_FOR_TIMER to WAIT_FOR_BEACON\n");
+               }
++              /*
++               * When a context becomes inactive, for example,
++               * disassociation of a station context, the NoA
++               * attribute needs to be removed from subsequent
++               * beacons.
++               */
++              if (!ctx->active && avp->noa_duration &&
++                  sc->sched.state != ATH_CHANCTX_STATE_WAIT_FOR_BEACON) {
++                      avp->noa_duration = 0;
++                      avp->periodic_noa = false;
++
++                      ath_dbg(common, CHAN_CTX,
++                              "Clearing NoA schedule\n");
++              }
++
+               if (sc->sched.state != ATH_CHANCTX_STATE_WAIT_FOR_BEACON)
+                       break;
diff --git a/package/kernel/mac80211/patches/310-ap_scan.patch b/package/kernel/mac80211/patches/310-ap_scan.patch
deleted file mode 100644 (file)
index 01d3785..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/net/mac80211/cfg.c
-+++ b/net/mac80211/cfg.c
-@@ -1895,7 +1895,7 @@ static int ieee80211_scan(struct wiphy *
-                * the  frames sent while scanning on other channel will be
-                * lost)
-                */
--              if (sdata->u.ap.beacon &&
-+              if (0 && sdata->u.ap.beacon &&
-                   (!(wiphy->features & NL80211_FEATURE_AP_SCAN) ||
-                    !(req->flags & NL80211_SCAN_FLAG_AP)))
-                       return -EOPNOTSUPP;
diff --git a/package/kernel/mac80211/patches/310-ath9k-Use-configurable-timeout-for-flush.patch b/package/kernel/mac80211/patches/310-ath9k-Use-configurable-timeout-for-flush.patch
new file mode 100644 (file)
index 0000000..3a2c41b
--- /dev/null
@@ -0,0 +1,57 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:15 +0530
+Subject: [PATCH] ath9k: Use configurable timeout for flush
+
+The timeout value for flushing the TX queues
+is hardcoded at 200ms right now. Use a channel
+context-specific value instead to allow adjustments
+to the timeout in case MCC is enabled.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -345,6 +345,7 @@ struct ath_chanctx {
+       u64 tsf_val;
+       u32 last_beacon;
++      int flush_timeout;
+       u16 txpower;
+       bool offchannel;
+       bool stopped;
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -117,6 +117,7 @@ void ath_chanctx_init(struct ath_softc *
+               cfg80211_chandef_create(&ctx->chandef, chan, NL80211_CHAN_HT20);
+               INIT_LIST_HEAD(&ctx->vifs);
+               ctx->txpower = ATH_TXPOWER_MAX;
++              ctx->flush_timeout = HZ / 5; /* 200ms */
+               for (j = 0; j < ARRAY_SIZE(ctx->acq); j++)
+                       INIT_LIST_HEAD(&ctx->acq[j]);
+       }
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -2034,7 +2034,7 @@ void __ath9k_flush(struct ieee80211_hw *
+       struct ath_softc *sc = hw->priv;
+       struct ath_hw *ah = sc->sc_ah;
+       struct ath_common *common = ath9k_hw_common(ah);
+-      int timeout = HZ / 5; /* 200 ms */
++      int timeout;
+       bool drain_txq;
+       cancel_delayed_work_sync(&sc->tx_complete_work);
+@@ -2049,6 +2049,13 @@ void __ath9k_flush(struct ieee80211_hw *
+               return;
+       }
++      spin_lock_bh(&sc->chan_lock);
++      timeout = sc->cur_chan->flush_timeout;
++      spin_unlock_bh(&sc->chan_lock);
++
++      ath_dbg(common, CHAN_CTX,
++              "Flush timeout: %d\n", jiffies_to_msecs(timeout));
++
+       if (wait_event_timeout(sc->tx_wait, !ath9k_has_tx_pending(sc),
+                              timeout) > 0)
+               drop = false;
diff --git a/package/kernel/mac80211/patches/311-ath9k-Fix-MCC-flush-timeout.patch b/package/kernel/mac80211/patches/311-ath9k-Fix-MCC-flush-timeout.patch
new file mode 100644 (file)
index 0000000..020ac1a
--- /dev/null
@@ -0,0 +1,68 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:16 +0530
+Subject: [PATCH] ath9k: Fix MCC flush timeout
+
+In MCC mode, the duration for a channel context
+is half the beacon interval and having a large
+flush timeout will adversely affect GO operation,
+since the default value of 200ms will overshoot
+the advertised NoA absence duration.
+
+The scheduler initiates a channel context switch
+only when the slot duration for the current
+context expires, so there is no possibility of
+having a fixed timeout for flush.
+
+Since the channel_switch_time is added to the
+absence duration when the GO sets up the NoA
+attribute, this is the maximum time that we
+have to flush the TX queues. The duration is very
+small, but we don't have a choice in MCC mode.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -199,6 +199,7 @@ static const char *chanctx_state_string(
+ void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)
+ {
+       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
++      struct ath_chanctx *ictx;
+       struct ath_vif *avp;
+       bool active = false;
+       u8 n_active = 0;
+@@ -206,6 +207,8 @@ void ath_chanctx_check_active(struct ath
+       if (!ctx)
+               return;
++      ictx = ctx;
++
+       list_for_each_entry(avp, &ctx->vifs, list) {
+               struct ieee80211_vif *vif = avp->vif;
+@@ -228,12 +231,23 @@ void ath_chanctx_check_active(struct ath
+               n_active++;
+       }
++      spin_lock_bh(&sc->chan_lock);
++
+       if (n_active <= 1) {
++              ictx->flush_timeout = HZ / 5;
+               clear_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags);
++              spin_unlock_bh(&sc->chan_lock);
+               return;
+       }
+-      if (test_and_set_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags))
++
++      ictx->flush_timeout = usecs_to_jiffies(sc->sched.channel_switch_time);
++
++      if (test_and_set_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags)) {
++              spin_unlock_bh(&sc->chan_lock);
+               return;
++      }
++
++      spin_unlock_bh(&sc->chan_lock);
+       if (ath9k_is_chanctx_enabled()) {
+               ath_chanctx_event(sc, NULL,
diff --git a/package/kernel/mac80211/patches/312-ath9k-Fix-offchannel-flush-timeout.patch b/package/kernel/mac80211/patches/312-ath9k-Fix-offchannel-flush-timeout.patch
new file mode 100644 (file)
index 0000000..0a4257d
--- /dev/null
@@ -0,0 +1,43 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:17 +0530
+Subject: [PATCH] ath9k: Fix offchannel flush timeout
+
+An offchannel operation also needs to have
+a flush timeout that doesn't exceed the NoA
+absence duration of a GO context, so use
+channel_switch_time. The first offchannel
+operation is set a flush timeout of 10ms since
+channel_switch_time will be zero.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -207,6 +207,26 @@ void ath_chanctx_check_active(struct ath
+       if (!ctx)
+               return;
++      if (ctx == &sc->offchannel.chan) {
++              spin_lock_bh(&sc->chan_lock);
++
++              if (likely(sc->sched.channel_switch_time))
++                      ctx->flush_timeout =
++                              usecs_to_jiffies(sc->sched.channel_switch_time);
++              else
++                      ctx->flush_timeout =
++                              msecs_to_jiffies(10);
++
++              spin_unlock_bh(&sc->chan_lock);
++
++              /*
++               * There is no need to iterate over the
++               * active/assigned channel contexts if
++               * the current context is offchannel.
++               */
++              return;
++      }
++
+       ictx = ctx;
+       list_for_each_entry(avp, &ctx->vifs, list) {
diff --git a/package/kernel/mac80211/patches/313-ath9k-Check-for-pending-frames-properly.patch b/package/kernel/mac80211/patches/313-ath9k-Check-for-pending-frames-properly.patch
new file mode 100644 (file)
index 0000000..c1d8791
--- /dev/null
@@ -0,0 +1,125 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:18 +0530
+Subject: [PATCH] ath9k: Check for pending frames properly
+
+Pending frames in the driver can be present
+either in the HW queues or SW. ath9k_has_pending_frames()
+currently checks for the HW queues first and then
+checks if any ACs are queued in the driver.
+
+In MCC mode, we need to check the HW queues alone, since
+the SW queues are just marked as 'stopped' - they will
+be processed in the next context switch. But since we
+don't differentiate this now, mention whether we want
+to check if there are frames in the SW queues.
+
+* The flush() callback checks both HW and SW queues.
+* The tx_frames_pending() callback does the same.
+* The call to __ath9k_flush() in MCC mode checks HW queues alone.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -715,7 +715,8 @@ int ath_update_survey_stats(struct ath_s
+ void ath_update_survey_nf(struct ath_softc *sc, int channel);
+ void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type);
+ void ath_ps_full_sleep(unsigned long data);
+-void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop);
++void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop,
++                 bool sw_pending);
+ /**********/
+ /* BTCOEX */
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -1137,10 +1137,11 @@ void ath_chanctx_set_next(struct ath_sof
+               ath9k_chanctx_stop_queues(sc, sc->cur_chan);
+               queues_stopped = true;
+-              __ath9k_flush(sc->hw, ~0, true);
++              __ath9k_flush(sc->hw, ~0, true, false);
+               if (ath_chanctx_send_ps_frame(sc, true))
+-                      __ath9k_flush(sc->hw, BIT(IEEE80211_AC_VO), false);
++                      __ath9k_flush(sc->hw, BIT(IEEE80211_AC_VO),
++                                    false, false);
+               send_ps = true;
+               spin_lock_bh(&sc->chan_lock);
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -54,7 +54,8 @@ u8 ath9k_parse_mpdudensity(u8 mpdudensit
+       }
+ }
+-static bool ath9k_has_pending_frames(struct ath_softc *sc, struct ath_txq *txq)
++static bool ath9k_has_pending_frames(struct ath_softc *sc, struct ath_txq *txq,
++                                   bool sw_pending)
+ {
+       bool pending = false;
+@@ -65,6 +66,9 @@ static bool ath9k_has_pending_frames(str
+               goto out;
+       }
++      if (!sw_pending)
++              goto out;
++
+       if (txq->mac80211_qnum >= 0) {
+               struct list_head *list;
+@@ -2003,7 +2007,8 @@ static void ath9k_set_coverage_class(str
+       mutex_unlock(&sc->mutex);
+ }
+-static bool ath9k_has_tx_pending(struct ath_softc *sc)
++static bool ath9k_has_tx_pending(struct ath_softc *sc,
++                               bool sw_pending)
+ {
+       int i, npend = 0;
+@@ -2011,7 +2016,8 @@ static bool ath9k_has_tx_pending(struct 
+               if (!ATH_TXQ_SETUP(sc, i))
+                       continue;
+-              npend = ath9k_has_pending_frames(sc, &sc->tx.txq[i]);
++              npend = ath9k_has_pending_frames(sc, &sc->tx.txq[i],
++                                               sw_pending);
+               if (npend)
+                       break;
+       }
+@@ -2025,11 +2031,12 @@ static void ath9k_flush(struct ieee80211
+       struct ath_softc *sc = hw->priv;
+       mutex_lock(&sc->mutex);
+-      __ath9k_flush(hw, queues, drop);
++      __ath9k_flush(hw, queues, drop, true);
+       mutex_unlock(&sc->mutex);
+ }
+-void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
++void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop,
++                 bool sw_pending)
+ {
+       struct ath_softc *sc = hw->priv;
+       struct ath_hw *ah = sc->sc_ah;
+@@ -2056,7 +2063,7 @@ void __ath9k_flush(struct ieee80211_hw *
+       ath_dbg(common, CHAN_CTX,
+               "Flush timeout: %d\n", jiffies_to_msecs(timeout));
+-      if (wait_event_timeout(sc->tx_wait, !ath9k_has_tx_pending(sc),
++      if (wait_event_timeout(sc->tx_wait, !ath9k_has_tx_pending(sc, sw_pending),
+                              timeout) > 0)
+               drop = false;
+@@ -2079,7 +2086,7 @@ static bool ath9k_tx_frames_pending(stru
+ {
+       struct ath_softc *sc = hw->priv;
+-      return ath9k_has_tx_pending(sc);
++      return ath9k_has_tx_pending(sc, true);
+ }
+ static int ath9k_tx_last_beacon(struct ieee80211_hw *hw)
diff --git a/package/kernel/mac80211/patches/314-ath9k-Send-AUTHORIZED-event-only-for-station-mode.patch b/package/kernel/mac80211/patches/314-ath9k-Send-AUTHORIZED-event-only-for-station-mode.patch
new file mode 100644 (file)
index 0000000..4c56442
--- /dev/null
@@ -0,0 +1,33 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:19 +0530
+Subject: [PATCH] ath9k: Send AUTHORIZED event only for station mode
+
+ATH_CHANCTX_EVENT_AUTHORIZED is required to trigger
+the MCC scheduler when a station interface becomes
+authorized. But, since the driver gets station state
+notifications when the current operating mode is AP
+too, make sure that we send ATH_CHANCTX_EVENT_AUTHORIZED
+only when the interface is in station mode.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -1590,10 +1590,12 @@ static int ath9k_sta_state(struct ieee80
+       }
+       if (ath9k_is_chanctx_enabled()) {
+-              if (old_state == IEEE80211_STA_ASSOC &&
+-                  new_state == IEEE80211_STA_AUTHORIZED)
+-                      ath_chanctx_event(sc, vif,
+-                                        ATH_CHANCTX_EVENT_AUTHORIZED);
++              if (vif->type == NL80211_IFTYPE_STATION) {
++                      if (old_state == IEEE80211_STA_ASSOC &&
++                          new_state == IEEE80211_STA_AUTHORIZED)
++                              ath_chanctx_event(sc, vif,
++                                                ATH_CHANCTX_EVENT_AUTHORIZED);
++              }
+       }
+       return ret;
diff --git a/package/kernel/mac80211/patches/315-ath9k-Fix-address-management.patch b/package/kernel/mac80211/patches/315-ath9k-Fix-address-management.patch
new file mode 100644 (file)
index 0000000..a407861
--- /dev/null
@@ -0,0 +1,65 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:20 +0530
+Subject: [PATCH] ath9k: Fix address management
+
+Since both the arguments need to satisfy
+the alignment requirements of ether_addr_copy(),
+use memcpy() in cases where there will be no
+big performance benefit and make sure that
+ether_addr_copy() calls use properly aligned
+arguments.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath.h
++++ b/drivers/net/wireless/ath/ath.h
+@@ -147,7 +147,7 @@ struct ath_common {
+       u16 cachelsz;
+       u16 curaid;
+       u8 macaddr[ETH_ALEN];
+-      u8 curbssid[ETH_ALEN];
++      u8 curbssid[ETH_ALEN] __aligned(2);
+       u8 bssidmask[ETH_ALEN];
+       u32 rx_bufsize;
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -595,7 +595,7 @@ struct ath_vif {
+       u16 seq_no;
+       /* BSS info */
+-      u8 bssid[ETH_ALEN];
++      u8 bssid[ETH_ALEN] __aligned(2);
+       u16 aid;
+       bool assoc;
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -1057,7 +1057,7 @@ static void ath9k_set_offchannel_state(s
+       eth_zero_addr(common->curbssid);
+       eth_broadcast_addr(common->bssidmask);
+-      ether_addr_copy(common->macaddr, vif->addr);
++      memcpy(common->macaddr, vif->addr, ETH_ALEN);
+       common->curaid = 0;
+       ah->opmode = vif->type;
+       ah->imask &= ~ATH9K_INT_SWBA;
+@@ -1098,7 +1098,7 @@ void ath9k_calculate_summary_state(struc
+       ath9k_calculate_iter_data(sc, ctx, &iter_data);
+       if (iter_data.has_hw_macaddr)
+-              ether_addr_copy(common->macaddr, iter_data.hw_macaddr);
++              memcpy(common->macaddr, iter_data.hw_macaddr, ETH_ALEN);
+       memcpy(common->bssidmask, iter_data.mask, ETH_ALEN);
+       ath_hw_setbssidmask(common);
+@@ -1785,7 +1785,7 @@ static void ath9k_bss_info_changed(struc
+               ath_dbg(common, CONFIG, "BSSID %pM Changed ASSOC %d\n",
+                       bss_conf->bssid, bss_conf->assoc);
+-              ether_addr_copy(avp->bssid, bss_conf->bssid);
++              memcpy(avp->bssid, bss_conf->bssid, ETH_ALEN);
+               avp->aid = bss_conf->aid;
+               avp->assoc = bss_conf->assoc;
diff --git a/package/kernel/mac80211/patches/316-ath9k-Add-a-function-to-check-for-an-active-GO.patch b/package/kernel/mac80211/patches/316-ath9k-Add-a-function-to-check-for-an-active-GO.patch
new file mode 100644 (file)
index 0000000..80b919e
--- /dev/null
@@ -0,0 +1,56 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:21 +0530
+Subject: [PATCH] ath9k: Add a function to check for an active GO
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -469,6 +469,7 @@ void ath_chanctx_set_next(struct ath_sof
+ void ath_offchannel_next(struct ath_softc *sc);
+ void ath_scan_complete(struct ath_softc *sc, bool abort);
+ void ath_roc_complete(struct ath_softc *sc, bool abort);
++struct ath_chanctx* ath_is_go_chanctx_present(struct ath_softc *sc);
+ #else
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -146,6 +146,36 @@ void ath_chanctx_set_channel(struct ath_
+ #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
++/*************/
++/* Utilities */
++/*************/
++
++struct ath_chanctx* ath_is_go_chanctx_present(struct ath_softc *sc)
++{
++      struct ath_chanctx *ctx;
++      struct ath_vif *avp;
++      struct ieee80211_vif *vif;
++
++      spin_lock_bh(&sc->chan_lock);
++
++      ath_for_each_chanctx(sc, ctx) {
++              if (!ctx->active)
++                      continue;
++
++              list_for_each_entry(avp, &ctx->vifs, list) {
++                      vif = avp->vif;
++
++                      if (ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_P2P_GO) {
++                              spin_unlock_bh(&sc->chan_lock);
++                              return ctx;
++                      }
++              }
++      }
++
++      spin_unlock_bh(&sc->chan_lock);
++      return NULL;
++}
++
+ /**********************************************************/
+ /* Functions to handle the channel context state machine. */
+ /**********************************************************/
diff --git a/package/kernel/mac80211/patches/317-ath9k-Check-for-active-GO-in-mgd_prepare_tx.patch b/package/kernel/mac80211/patches/317-ath9k-Check-for-active-GO-in-mgd_prepare_tx.patch
new file mode 100644 (file)
index 0000000..6e9aa1f
--- /dev/null
@@ -0,0 +1,134 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:22 +0530
+Subject: [PATCH] ath9k: Check for active GO in mgd_prepare_tx()
+
+If a GO interface is active when we receive a
+mgd_prepare_tx() call, then we need to send
+out a new NoA before switching to a new context.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -385,6 +385,7 @@ struct ath_chanctx_sched {
+       bool wait_switch;
+       bool force_noa_update;
+       bool extend_absence;
++      bool mgd_prepare_tx;
+       enum ath_chanctx_state state;
+       u8 beacon_miss;
+@@ -977,6 +978,7 @@ struct ath_softc {
+       struct ath_chanctx_sched sched;
+       struct ath_offchannel offchannel;
+       struct ath_chanctx *next_chan;
++      struct completion go_beacon;
+ #endif
+       unsigned long driver_data;
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -421,6 +421,9 @@ void ath_chanctx_event(struct ath_softc 
+                               "Move chanctx state from WAIT_FOR_TIMER to WAIT_FOR_BEACON\n");
+               }
++              if (sc->sched.mgd_prepare_tx)
++                      sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_BEACON;
++
+               /*
+                * When a context becomes inactive, for example,
+                * disassociation of a station context, the NoA
+@@ -547,6 +550,15 @@ void ath_chanctx_event(struct ath_softc 
+               }
+               sc->sched.beacon_pending = false;
++
++              if (sc->sched.mgd_prepare_tx) {
++                      sc->sched.mgd_prepare_tx = false;
++                      complete(&sc->go_beacon);
++                      ath_dbg(common, CHAN_CTX,
++                              "Beacon sent, complete go_beacon\n");
++                      break;
++              }
++
+               if (sc->sched.state != ATH_CHANCTX_STATE_WAIT_FOR_BEACON)
+                       break;
+@@ -1263,6 +1275,8 @@ void ath9k_init_channel_context(struct a
+                   (unsigned long)sc);
+       setup_timer(&sc->sched.timer, ath_chanctx_timer,
+                   (unsigned long)sc);
++
++      init_completion(&sc->go_beacon);
+ }
+ void ath9k_deinit_channel_context(struct ath_softc *sc)
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -2474,7 +2474,11 @@ static void ath9k_mgd_prepare_tx(struct 
+       struct ath_softc *sc = hw->priv;
+       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+       struct ath_vif *avp = (struct ath_vif *) vif->drv_priv;
++      struct ath_beacon_config *cur_conf;
++      struct ath_chanctx *go_ctx;
++      unsigned long timeout;
+       bool changed = false;
++      u32 beacon_int;
+       if (!test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags))
+               return;
+@@ -2485,19 +2489,46 @@ static void ath9k_mgd_prepare_tx(struct 
+       mutex_lock(&sc->mutex);
+       spin_lock_bh(&sc->chan_lock);
+-      if (sc->next_chan || (sc->cur_chan != avp->chanctx)) {
+-              sc->next_chan = avp->chanctx;
++      if (sc->next_chan || (sc->cur_chan != avp->chanctx))
+               changed = true;
++      spin_unlock_bh(&sc->chan_lock);
++
++      if (!changed)
++              goto out;
++
++      go_ctx = ath_is_go_chanctx_present(sc);
++
++      if (go_ctx) {
++              /*
++               * Wait till the GO interface gets a chance
++               * to send out an NoA.
++               */
++              spin_lock_bh(&sc->chan_lock);
++              sc->sched.mgd_prepare_tx = true;
++              cur_conf = &go_ctx->beacon;
++              beacon_int = TU_TO_USEC(cur_conf->beacon_interval);
++              spin_unlock_bh(&sc->chan_lock);
++
++              timeout = usecs_to_jiffies(beacon_int);
++              init_completion(&sc->go_beacon);
++
++              if (wait_for_completion_timeout(&sc->go_beacon,
++                                              timeout) == 0)
++                      ath_dbg(common, CHAN_CTX,
++                              "Failed to send new NoA\n");
+       }
++
+       ath_dbg(common, CHAN_CTX,
+-              "%s: Set chanctx state to FORCE_ACTIVE, changed: %d\n",
+-              __func__, changed);
++              "%s: Set chanctx state to FORCE_ACTIVE for vif: %pM\n",
++              __func__, vif->addr);
++
++      spin_lock_bh(&sc->chan_lock);
++      sc->next_chan = avp->chanctx;
+       sc->sched.state = ATH_CHANCTX_STATE_FORCE_ACTIVE;
+       spin_unlock_bh(&sc->chan_lock);
+-      if (changed)
+-              ath_chanctx_set_next(sc, true);
+-
++      ath_chanctx_set_next(sc, true);
++out:
+       mutex_unlock(&sc->mutex);
+ }
diff --git a/package/kernel/mac80211/patches/318-ath9k-Use-a-helper-function-for-offchannel-NoA.patch b/package/kernel/mac80211/patches/318-ath9k-Use-a-helper-function-for-offchannel-NoA.patch
new file mode 100644 (file)
index 0000000..e51e2f8
--- /dev/null
@@ -0,0 +1,68 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:23 +0530
+Subject: [PATCH] ath9k: Use a helper function for offchannel NoA
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -366,6 +366,32 @@ static void ath_chanctx_setup_timer(stru
+               "Setup chanctx timer with timeout: %d ms\n", jiffies_to_msecs(tsf_time));
+ }
++static void ath_chanctx_offchannel_noa(struct ath_softc *sc,
++                                     struct ath_chanctx *ctx,
++                                     struct ath_vif *avp,
++                                     u32 tsf_time)
++{
++      struct ath_common *common = ath9k_hw_common(sc->sc_ah);
++
++      avp->noa_index++;
++      avp->offchannel_start = tsf_time;
++      avp->offchannel_duration = sc->sched.offchannel_duration;
++
++      ath_dbg(common, CHAN_CTX,
++              "offchannel noa_duration: %d, noa_start: %d, noa_index: %d\n",
++              avp->offchannel_duration,
++              avp->offchannel_start,
++              avp->noa_index);
++
++      /*
++       * When multiple contexts are active, the NoA
++       * has to be recalculated and advertised after
++       * an offchannel operation.
++       */
++      if (ctx->active && avp->noa_duration)
++              avp->noa_duration = 0;
++}
++
+ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
+                      enum ath_chanctx_event ev)
+ {
+@@ -461,24 +487,7 @@ void ath_chanctx_event(struct ath_softc 
+                * values and increment the index.
+                */
+               if (sc->next_chan == &sc->offchannel.chan) {
+-                      avp->noa_index++;
+-                      avp->offchannel_start = tsf_time;
+-                      avp->offchannel_duration = sc->sched.offchannel_duration;
+-
+-                      ath_dbg(common, CHAN_CTX,
+-                              "offchannel noa_duration: %d, noa_start: %d, noa_index: %d\n",
+-                              avp->offchannel_duration,
+-                              avp->offchannel_start,
+-                              avp->noa_index);
+-
+-                      /*
+-                       * When multiple contexts are active, the NoA
+-                       * has to be recalculated and advertised after
+-                       * an offchannel operation.
+-                       */
+-                      if (ctx->active && avp->noa_duration)
+-                              avp->noa_duration = 0;
+-
++                      ath_chanctx_offchannel_noa(sc, ctx, avp, tsf_time);
+                       break;
+               }
diff --git a/package/kernel/mac80211/patches/319-ath9k-Use-a-helper-function-to-set-NoA.patch b/package/kernel/mac80211/patches/319-ath9k-Use-a-helper-function-to-set-NoA.patch
new file mode 100644 (file)
index 0000000..e975995
--- /dev/null
@@ -0,0 +1,84 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:24 +0530
+Subject: [PATCH] ath9k: Use a helper function to set NoA
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -392,6 +392,39 @@ static void ath_chanctx_offchannel_noa(s
+               avp->noa_duration = 0;
+ }
++static void ath_chanctx_set_periodic_noa(struct ath_softc *sc,
++                                       struct ath_vif *avp,
++                                       struct ath_beacon_config *cur_conf,
++                                       u32 tsf_time,
++                                       u32 beacon_int)
++{
++      struct ath_common *common = ath9k_hw_common(sc->sc_ah);
++
++      avp->noa_index++;
++      avp->noa_start = tsf_time;
++
++      if (sc->sched.extend_absence)
++              avp->noa_duration = (3 * beacon_int / 2) +
++                      sc->sched.channel_switch_time;
++      else
++              avp->noa_duration =
++                      TU_TO_USEC(cur_conf->beacon_interval) / 2 +
++                      sc->sched.channel_switch_time;
++
++      if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
++          sc->sched.extend_absence)
++              avp->periodic_noa = false;
++      else
++              avp->periodic_noa = true;
++
++      ath_dbg(common, CHAN_CTX,
++              "noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
++              avp->noa_duration,
++              avp->noa_start,
++              avp->noa_index,
++              avp->periodic_noa);
++}
++
+ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
+                      enum ath_chanctx_event ev)
+ {
+@@ -521,31 +554,9 @@ void ath_chanctx_event(struct ath_softc 
+                * announcement.
+                */
+               if (ctx->active &&
+-                  (!avp->noa_duration || sc->sched.force_noa_update)) {
+-                      avp->noa_index++;
+-                      avp->noa_start = tsf_time;
+-
+-                      if (sc->sched.extend_absence)
+-                              avp->noa_duration = (3 * beacon_int / 2) +
+-                                      sc->sched.channel_switch_time;
+-                      else
+-                              avp->noa_duration =
+-                                      TU_TO_USEC(cur_conf->beacon_interval) / 2 +
+-                                      sc->sched.channel_switch_time;
+-
+-                      if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
+-                          sc->sched.extend_absence)
+-                              avp->periodic_noa = false;
+-                      else
+-                              avp->periodic_noa = true;
+-
+-                      ath_dbg(common, CHAN_CTX,
+-                              "noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
+-                              avp->noa_duration,
+-                              avp->noa_start,
+-                              avp->noa_index,
+-                              avp->periodic_noa);
+-              }
++                  (!avp->noa_duration || sc->sched.force_noa_update))
++                      ath_chanctx_set_periodic_noa(sc, avp, cur_conf,
++                                                   tsf_time, beacon_int);
+               if (ctx->active && sc->sched.force_noa_update)
+                       sc->sched.force_noa_update = false;
diff --git a/package/kernel/mac80211/patches/320-ath9k-Use-a-helper-function-for-bmiss.patch b/package/kernel/mac80211/patches/320-ath9k-Use-a-helper-function-for-bmiss.patch
new file mode 100644 (file)
index 0000000..03b76ec
--- /dev/null
@@ -0,0 +1,68 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:25 +0530
+Subject: [PATCH] ath9k: Use a helper function for bmiss
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -366,6 +366,31 @@ static void ath_chanctx_setup_timer(stru
+               "Setup chanctx timer with timeout: %d ms\n", jiffies_to_msecs(tsf_time));
+ }
++static void ath_chanctx_handle_bmiss(struct ath_softc *sc,
++                                   struct ath_chanctx *ctx,
++                                   struct ath_vif *avp)
++{
++      /*
++       * Clear the extend_absence flag if it had been
++       * set during the previous beacon transmission,
++       * since we need to revert to the normal NoA
++       * schedule.
++       */
++      if (ctx->active && sc->sched.extend_absence) {
++              avp->noa_duration = 0;
++              sc->sched.extend_absence = false;
++      }
++
++      /* If at least two consecutive beacons were missed on the STA
++       * chanctx, stay on the STA channel for one extra beacon period,
++       * to resync the timer properly.
++       */
++      if (ctx->active && sc->sched.beacon_miss >= 2) {
++              avp->noa_duration = 0;
++              sc->sched.extend_absence = true;
++      }
++}
++
+ static void ath_chanctx_offchannel_noa(struct ath_softc *sc,
+                                      struct ath_chanctx *ctx,
+                                      struct ath_vif *avp,
+@@ -524,25 +549,7 @@ void ath_chanctx_event(struct ath_softc 
+                       break;
+               }
+-              /*
+-               * Clear the extend_absence flag if it had been
+-               * set during the previous beacon transmission,
+-               * since we need to revert to the normal NoA
+-               * schedule.
+-               */
+-              if (ctx->active && sc->sched.extend_absence) {
+-                      avp->noa_duration = 0;
+-                      sc->sched.extend_absence = false;
+-              }
+-
+-              /* If at least two consecutive beacons were missed on the STA
+-               * chanctx, stay on the STA channel for one extra beacon period,
+-               * to resync the timer properly.
+-               */
+-              if (ctx->active && sc->sched.beacon_miss >= 2) {
+-                      avp->noa_duration = 0;
+-                      sc->sched.extend_absence = true;
+-              }
++              ath_chanctx_handle_bmiss(sc, ctx, avp);
+               /* Prevent wrap-around issues */
+               if (avp->noa_duration && tsf_time - avp->noa_start > BIT(30))
diff --git a/package/kernel/mac80211/patches/321-ath9k-Fix-RoC-expiration.patch b/package/kernel/mac80211/patches/321-ath9k-Fix-RoC-expiration.patch
new file mode 100644 (file)
index 0000000..5a99a33
--- /dev/null
@@ -0,0 +1,38 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:26 +0530
+Subject: [PATCH] ath9k: Fix RoC expiration
+
+mac80211 has to be notified when a RoC period
+expires in the driver. In MCC mode, since the
+offchannel/RoC timer is set with the requested
+duration, ieee80211_remain_on_channel_expired() needs
+to be called when the timer expires.
+
+But, currently it is done after we move back to
+the operating channel. This is incorrect - fix this
+by calling ieee80211_remain_on_channel_expired() when
+the RoC timer expires and in ath_roc_complete() when
+the RoC request is aborted.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -894,7 +894,7 @@ void ath_roc_complete(struct ath_softc *
+       sc->offchannel.roc_vif = NULL;
+       sc->offchannel.roc_chan = NULL;
+-      if (!abort)
++      if (abort)
+               ieee80211_remain_on_channel_expired(sc->hw);
+       ath_offchannel_next(sc);
+       ath9k_ps_restore(sc);
+@@ -1028,6 +1028,7 @@ static void ath_offchannel_timer(unsigne
+       case ATH_OFFCHANNEL_ROC_WAIT:
+               ctx = ath_chanctx_get_oper_chan(sc, false);
+               sc->offchannel.state = ATH_OFFCHANNEL_ROC_DONE;
++              ieee80211_remain_on_channel_expired(sc->hw);
+               ath_chanctx_switch(sc, ctx, NULL);
+               break;
+       default:
diff --git a/package/kernel/mac80211/patches/322-ath9k-Send-oneshot-NoA.patch b/package/kernel/mac80211/patches/322-ath9k-Send-oneshot-NoA.patch
new file mode 100644 (file)
index 0000000..331d714
--- /dev/null
@@ -0,0 +1,85 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:27 +0530
+Subject: [PATCH] ath9k: Send oneshot NoA
+
+This patch makes sure that a GO interface
+sends out a new NoA schedule with 200ms duration
+when mgd_prepare_tx() is called.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -620,6 +620,7 @@ struct ath_vif {
+       u32 noa_start;
+       u32 noa_duration;
+       bool periodic_noa;
++      bool oneshot_noa;
+ };
+ struct ath9k_vif_iter_data {
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -450,6 +450,27 @@ static void ath_chanctx_set_periodic_noa
+               avp->periodic_noa);
+ }
++static void ath_chanctx_set_oneshot_noa(struct ath_softc *sc,
++                                      struct ath_vif *avp,
++                                      u32 tsf_time,
++                                      u32 duration)
++{
++      struct ath_common *common = ath9k_hw_common(sc->sc_ah);
++
++      avp->noa_index++;
++      avp->noa_start = tsf_time;
++      avp->periodic_noa = false;
++      avp->oneshot_noa = true;
++      avp->noa_duration = duration + sc->sched.channel_switch_time;
++
++      ath_dbg(common, CHAN_CTX,
++              "oneshot noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
++              avp->noa_duration,
++              avp->noa_start,
++              avp->noa_index,
++              avp->periodic_noa);
++}
++
+ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
+                      enum ath_chanctx_event ev)
+ {
+@@ -476,6 +497,14 @@ void ath_chanctx_event(struct ath_softc 
+               if (avp->offchannel_duration)
+                       avp->offchannel_duration = 0;
++              if (avp->oneshot_noa) {
++                      avp->noa_duration = 0;
++                      avp->oneshot_noa = false;
++
++                      ath_dbg(common, CHAN_CTX,
++                              "Clearing oneshot NoA\n");
++              }
++
+               if (avp->chanctx != sc->cur_chan) {
+                       ath_dbg(common, CHAN_CTX,
+                               "Contexts differ, not preparing beacon\n");
+@@ -551,6 +580,18 @@ void ath_chanctx_event(struct ath_softc 
+               ath_chanctx_handle_bmiss(sc, ctx, avp);
++              /*
++               * If a mgd_prepare_tx() has been called by mac80211,
++               * a one-shot NoA needs to be sent. This can happen
++               * with one or more active channel contexts - in both
++               * cases, a new NoA schedule has to be advertised.
++               */
++              if (sc->sched.mgd_prepare_tx) {
++                      ath_chanctx_set_oneshot_noa(sc, avp, tsf_time,
++                                                  jiffies_to_usecs(HZ / 5));
++                      break;
++              }
++
+               /* Prevent wrap-around issues */
+               if (avp->noa_duration && tsf_time - avp->noa_start > BIT(30))
+                       avp->noa_duration = 0;
diff --git a/package/kernel/mac80211/patches/323-ath9k-Fix-HW-scan-abort.patch b/package/kernel/mac80211/patches/323-ath9k-Fix-HW-scan-abort.patch
new file mode 100644 (file)
index 0000000..56c0489
--- /dev/null
@@ -0,0 +1,68 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:28 +0530
+Subject: [PATCH] ath9k: Fix HW scan abort
+
+Instead of using ATH_CHANCTX_EVENT_ASSIGN to abort
+a HW scan when a new interface becomes active, use the
+mgd_prepare_tx() callback. This allows us to make
+sure that the GO's channel becomes operational by
+using flush_work().
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -743,22 +743,6 @@ void ath_chanctx_event(struct ath_softc 
+               ieee80211_queue_work(sc->hw, &sc->chanctx_work);
+               break;
+       case ATH_CHANCTX_EVENT_ASSIGN:
+-              /*
+-               * When adding a new channel context, check if a scan
+-               * is in progress and abort it since the addition of
+-               * a new channel context is usually followed by VIF
+-               * assignment, in which case we have to start multi-channel
+-               * operation.
+-               */
+-              if (test_bit(ATH_OP_SCANNING, &common->op_flags)) {
+-                      ath_dbg(common, CHAN_CTX,
+-                              "Aborting HW scan to add new context\n");
+-
+-                      spin_unlock_bh(&sc->chan_lock);
+-                      del_timer_sync(&sc->offchannel.timer);
+-                      ath_scan_complete(sc, true);
+-                      spin_lock_bh(&sc->chan_lock);
+-              }
+               break;
+       case ATH_CHANCTX_EVENT_CHANGE:
+               break;
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -2365,7 +2365,6 @@ static int ath9k_add_chanctx(struct ieee
+                       conf->def.chan->center_freq);
+               ath_chanctx_set_channel(sc, ctx, &conf->def);
+-              ath_chanctx_event(sc, NULL, ATH_CHANCTX_EVENT_ASSIGN);
+               mutex_unlock(&sc->mutex);
+               return 0;
+@@ -2496,6 +2495,19 @@ static void ath9k_mgd_prepare_tx(struct 
+       if (!changed)
+               goto out;
++      if (test_bit(ATH_OP_SCANNING, &common->op_flags)) {
++              ath_dbg(common, CHAN_CTX,
++                      "%s: Aborting HW scan\n", __func__);
++
++              mutex_unlock(&sc->mutex);
++
++              del_timer_sync(&sc->offchannel.timer);
++              ath_scan_complete(sc, true);
++              flush_work(&sc->chanctx_work);
++
++              mutex_lock(&sc->mutex);
++      }
++
+       go_ctx = ath_is_go_chanctx_present(sc);
+       if (go_ctx) {
diff --git a/package/kernel/mac80211/patches/324-ath9k-Improve-flush-in-mcc-mode.patch b/package/kernel/mac80211/patches/324-ath9k-Improve-flush-in-mcc-mode.patch
new file mode 100644 (file)
index 0000000..40e095b
--- /dev/null
@@ -0,0 +1,95 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:29 +0530
+Subject: [PATCH] ath9k: Improve flush() in mcc mode
+
+The flush timeout in MCC mode is very small, since
+we are constrained by the time slice for each
+channel context, but since only the HW queues are
+flushed when switching contexts, it is acceptable.
+
+Since the SW queues are also emptied in the mac80211 flush()
+callback, a larger duration is needed. Add an override
+argument to __ath9k_flush() and set it when flush()
+is called in MCC mode. This allows the driver to
+drain both the SW and HW queues.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -719,7 +719,7 @@ void ath_update_survey_nf(struct ath_sof
+ void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type);
+ void ath_ps_full_sleep(unsigned long data);
+ void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop,
+-                 bool sw_pending);
++                 bool sw_pending, bool timeout_override);
+ /**********/
+ /* BTCOEX */
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -1232,11 +1232,11 @@ void ath_chanctx_set_next(struct ath_sof
+               ath9k_chanctx_stop_queues(sc, sc->cur_chan);
+               queues_stopped = true;
+-              __ath9k_flush(sc->hw, ~0, true, false);
++              __ath9k_flush(sc->hw, ~0, true, false, false);
+               if (ath_chanctx_send_ps_frame(sc, true))
+                       __ath9k_flush(sc->hw, BIT(IEEE80211_AC_VO),
+-                                    false, false);
++                                    false, false, false);
+               send_ps = true;
+               spin_lock_bh(&sc->chan_lock);
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -2031,14 +2031,33 @@ static void ath9k_flush(struct ieee80211
+                       u32 queues, bool drop)
+ {
+       struct ath_softc *sc = hw->priv;
++      struct ath_common *common = ath9k_hw_common(sc->sc_ah);
++
++      if (ath9k_is_chanctx_enabled()) {
++              if (!test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags))
++                      goto flush;
++              /*
++               * If MCC is active, extend the flush timeout
++               * and wait for the HW/SW queues to become
++               * empty. This needs to be done outside the
++               * sc->mutex lock to allow the channel scheduler
++               * to switch channel contexts.
++               *
++               * The vif queues have been stopped in mac80211,
++               * so there won't be any incoming frames.
++               */
++              __ath9k_flush(hw, queues, drop, true, true);
++              return;
++      }
++flush:
+       mutex_lock(&sc->mutex);
+-      __ath9k_flush(hw, queues, drop, true);
++      __ath9k_flush(hw, queues, drop, true, false);
+       mutex_unlock(&sc->mutex);
+ }
+ void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop,
+-                 bool sw_pending)
++                 bool sw_pending, bool timeout_override)
+ {
+       struct ath_softc *sc = hw->priv;
+       struct ath_hw *ah = sc->sc_ah;
+@@ -2059,7 +2078,10 @@ void __ath9k_flush(struct ieee80211_hw *
+       }
+       spin_lock_bh(&sc->chan_lock);
+-      timeout = sc->cur_chan->flush_timeout;
++      if (timeout_override)
++              timeout = HZ / 5;
++      else
++              timeout = sc->cur_chan->flush_timeout;
+       spin_unlock_bh(&sc->chan_lock);
+       ath_dbg(common, CHAN_CTX,
diff --git a/package/kernel/mac80211/patches/325-ath9k-Do-not-start-BA-when-scanning.patch b/package/kernel/mac80211/patches/325-ath9k-Do-not-start-BA-when-scanning.patch
new file mode 100644 (file)
index 0000000..69eb58c
--- /dev/null
@@ -0,0 +1,60 @@
+From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+Date: Fri, 17 Oct 2014 07:40:30 +0530
+Subject: [PATCH] ath9k: Do not start BA when scanning
+
+mac80211 currently has a race which can be hit
+with this sequence:
+
+* Start a scan operation.
+* TX BA is initiated by ieee80211_start_tx_ba_session().
+* Driver sets up internal state and calls
+  ieee80211_start_tx_ba_cb_irqsafe().
+* mac80211 adds a packet to sdata->skb_queue with
+  type IEEE80211_SDATA_QUEUE_AGG_START.
+* ieee80211_iface_work() doesn't process the
+  packet because scan is in progress.
+* ADDBA response timer expires and the sta/tid is
+  torn down.
+* Driver receives BA stop notification and calls
+  ieee80211_stop_tx_ba_cb_irqsafe().
+* This is also added to the queue by mac80211.
+* Now, scan finishes.
+
+At this point, the queued up packets might be processed
+if some other operation schedules the sdata work. Since
+the tids have been cleaned up already, warnings are hit.
+
+If this doesn't happen, the packets are left in the queue
+until the interface is torn down.
+
+Since initiating a BA session when scan is in progress
+leads to flaky connections, especially in MCC mode, we
+can drop the TX BA request. This improves connectivity
+with legacy clients in MCC mode.
+
+Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -1885,6 +1885,7 @@ static int ath9k_ampdu_action(struct iee
+                             u16 tid, u16 *ssn, u8 buf_size)
+ {
+       struct ath_softc *sc = hw->priv;
++      struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+       bool flush = false;
+       int ret = 0;
+@@ -1896,6 +1897,12 @@ static int ath9k_ampdu_action(struct iee
+       case IEEE80211_AMPDU_RX_STOP:
+               break;
+       case IEEE80211_AMPDU_TX_START:
++              if (ath9k_is_chanctx_enabled()) {
++                      if (test_bit(ATH_OP_SCANNING, &common->op_flags)) {
++                              ret = -EBUSY;
++                              break;
++                      }
++              }
+               ath9k_ps_wakeup(sc);
+               ret = ath_tx_aggr_start(sc, sta, tid, ssn);
+               if (!ret)
diff --git a/package/kernel/mac80211/patches/326-ath9k_hw-make-support-for-PC-OEM-cards-optional.patch b/package/kernel/mac80211/patches/326-ath9k_hw-make-support-for-PC-OEM-cards-optional.patch
new file mode 100644 (file)
index 0000000..afc8f74
--- /dev/null
@@ -0,0 +1,259 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 18 Oct 2014 13:23:34 +0200
+Subject: [PATCH] ath9k_hw: make support for PC-OEM cards optional
+
+The initvals use up quite a bit of space, and PC-OEM support is
+typically not needed on embedded systems
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/Kconfig
++++ b/drivers/net/wireless/ath/ath9k/Kconfig
+@@ -151,6 +151,11 @@ config ATH9K_CHANNEL_CONTEXT
+        for multi-channel concurrency. Enable this if P2P PowerSave support
+        is required.
++config ATH9K_PCOEM
++      bool "Atheros ath9k support for PC OEM cards" if EXPERT
++      depends on ATH9K
++      default y
++
+ config ATH9K_HTC
+        tristate "Atheros HTC based wireless cards support"
+        depends on m
+--- a/drivers/net/wireless/ath/ath9k/Makefile
++++ b/drivers/net/wireless/ath/ath9k/Makefile
+@@ -32,7 +32,6 @@ ath9k_hw-y:= \
+               ar5008_phy.o \
+               ar9002_calib.o \
+               ar9003_calib.o \
+-              ar9003_rtt.o \
+               calib.o \
+               eeprom.o \
+               eeprom_def.o \
+@@ -50,6 +49,8 @@ ath9k_hw-$(CPTCFG_ATH9K_WOW) += ar9003_w
+ ath9k_hw-$(CPTCFG_ATH9K_BTCOEX_SUPPORT) += btcoex.o \
+                                          ar9003_mci.o
++ath9k_hw-$(CPTCFG_ATH9K_PCOEM) += ar9003_rtt.o
++
+ ath9k_hw-$(CPTCFG_ATH9K_DYNACK) += dynack.o
+ obj-$(CPTCFG_ATH9K_HW) += ath9k_hw.o
+--- a/drivers/net/wireless/ath/ath9k/ar9003_rtt.h
++++ b/drivers/net/wireless/ath/ath9k/ar9003_rtt.h
+@@ -17,6 +17,7 @@
+ #ifndef AR9003_RTT_H
+ #define AR9003_RTT_H
++#ifdef CPTCFG_ATH9K_PCOEM
+ void ar9003_hw_rtt_enable(struct ath_hw *ah);
+ void ar9003_hw_rtt_disable(struct ath_hw *ah);
+ void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask);
+@@ -25,5 +26,40 @@ void ar9003_hw_rtt_load_hist(struct ath_
+ void ar9003_hw_rtt_fill_hist(struct ath_hw *ah);
+ void ar9003_hw_rtt_clear_hist(struct ath_hw *ah);
+ bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan);
++#else
++static inline void ar9003_hw_rtt_enable(struct ath_hw *ah)
++{
++}
++
++static inline void ar9003_hw_rtt_disable(struct ath_hw *ah)
++{
++}
++
++static inline void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask)
++{
++}
++
++static inline bool ar9003_hw_rtt_force_restore(struct ath_hw *ah)
++{
++      return false;
++}
++
++static inline void ar9003_hw_rtt_load_hist(struct ath_hw *ah)
++{
++}
++
++static inline void ar9003_hw_rtt_fill_hist(struct ath_hw *ah)
++{
++}
++
++static inline void ar9003_hw_rtt_clear_hist(struct ath_hw *ah)
++{
++}
++
++static inline bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan)
++{
++      return false;
++}
++#endif
+ #endif
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -244,13 +244,20 @@ enum ath9k_hw_caps {
+       ATH9K_HW_CAP_2GHZ                       = BIT(11),
+       ATH9K_HW_CAP_5GHZ                       = BIT(12),
+       ATH9K_HW_CAP_APM                        = BIT(13),
++#ifdef CPTCFG_ATH9K_PCOEM
+       ATH9K_HW_CAP_RTT                        = BIT(14),
+       ATH9K_HW_CAP_MCI                        = BIT(15),
+-      ATH9K_HW_CAP_DFS                        = BIT(16),
+-      ATH9K_HW_WOW_DEVICE_CAPABLE             = BIT(17),
+-      ATH9K_HW_CAP_PAPRD                      = BIT(18),
+-      ATH9K_HW_CAP_FCC_BAND_SWITCH            = BIT(19),
+-      ATH9K_HW_CAP_BT_ANT_DIV                 = BIT(20),
++      ATH9K_HW_WOW_DEVICE_CAPABLE             = BIT(16),
++      ATH9K_HW_CAP_BT_ANT_DIV                 = BIT(17),
++#else
++      ATH9K_HW_CAP_RTT                        = 0,
++      ATH9K_HW_CAP_MCI                        = 0,
++      ATH9K_HW_WOW_DEVICE_CAPABLE             = 0,
++      ATH9K_HW_CAP_BT_ANT_DIV                 = 0,
++#endif
++      ATH9K_HW_CAP_DFS                        = BIT(18),
++      ATH9K_HW_CAP_PAPRD                      = BIT(19),
++      ATH9K_HW_CAP_FCC_BAND_SWITCH            = BIT(20),
+ };
+ /*
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -362,6 +362,9 @@ static void ath9k_init_pcoem_platform(st
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
+       struct ath_common *common = ath9k_hw_common(ah);
++      if (!IS_ENABLED(CPTCFG_ATH9K_PCOEM))
++              return;
++
+       if (common->bus_ops->ath_bus_type != ATH_PCI)
+               return;
+--- a/drivers/net/wireless/ath/ath9k/pci.c
++++ b/drivers/net/wireless/ath/ath9k/pci.c
+@@ -30,6 +30,7 @@ static const struct pci_device_id ath_pc
+       { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI   */
+       { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */
++#ifdef CPTCFG_ATH9K_PCOEM
+       { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
+                        0x002A,
+                        PCI_VENDOR_ID_AZWAVE,
+@@ -82,6 +83,7 @@ static const struct pci_device_id ath_pc
+                        PCI_VENDOR_ID_AZWAVE,
+                        0x2C37),
+         .driver_data = ATH9K_PCI_BT_ANT_DIV },
++#endif
+       { PCI_VDEVICE(ATHEROS, 0x002B) }, /* PCI-E */
+       { PCI_VDEVICE(ATHEROS, 0x002C) }, /* PCI-E 802.11n bonded out */
+@@ -102,6 +104,7 @@ static const struct pci_device_id ath_pc
+       { PCI_VDEVICE(ATHEROS, 0x0030) }, /* PCI-E  AR9300 */
++#ifdef CPTCFG_ATH9K_PCOEM
+       /* PCI-E CUS198 */
+       { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
+                        0x0032,
+@@ -294,10 +297,12 @@ static const struct pci_device_id ath_pc
+                        PCI_VENDOR_ID_ASUSTEK,
+                        0x850D),
+         .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
++#endif
+       { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E  AR9485 */
+       { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E  AR9580 */
++#ifdef CPTCFG_ATH9K_PCOEM
+       /* PCI-E CUS217 */
+       { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
+                        0x0034,
+@@ -657,6 +662,7 @@ static const struct pci_device_id ath_pc
+       /* PCI-E AR9565 (WB335) */
+       { PCI_VDEVICE(ATHEROS, 0x0036),
+         .driver_data = ATH9K_PCI_BT_ANT_DIV },
++#endif
+       { 0 }
+ };
+--- a/drivers/net/wireless/ath/ath9k/reg.h
++++ b/drivers/net/wireless/ath/ath9k/reg.h
+@@ -892,10 +892,21 @@
+       (AR_SREV_9330((_ah)) && \
+        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9330_12))
++#ifdef CPTCFG_ATH9K_PCOEM
++#define AR_SREV_9462(_ah) \
++      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462))
+ #define AR_SREV_9485(_ah) \
+       (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485))
++#define AR_SREV_9565(_ah) \
++      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565))
++#else
++#define AR_SREV_9462(_ah) 0
++#define AR_SREV_9485(_ah) 0
++#define AR_SREV_9565(_ah) 0
++#endif
++
+ #define AR_SREV_9485_11_OR_LATER(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485) && \
++      (AR_SREV_9485(_ah) && \
+        ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9485_11))
+ #define AR_SREV_9485_OR_LATER(_ah) \
+       (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9485))
+@@ -915,34 +926,30 @@
+     (AR_SREV_9285_12_OR_LATER(_ah) && \
+      ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))
+-#define AR_SREV_9462(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462))
+ #define AR_SREV_9462_20(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
++      (AR_SREV_9462(_ah) && \
+        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_20))
+ #define AR_SREV_9462_21(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
++      (AR_SREV_9462(_ah) && \
+        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_21))
+ #define AR_SREV_9462_20_OR_LATER(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
++      (AR_SREV_9462(_ah) && \
+        ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9462_20))
+ #define AR_SREV_9462_21_OR_LATER(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
++      (AR_SREV_9462(_ah) && \
+        ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9462_21))
+-#define AR_SREV_9565(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565))
+ #define AR_SREV_9565_10(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
++      (AR_SREV_9565(_ah) && \
+        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_10))
+ #define AR_SREV_9565_101(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
++      (AR_SREV_9565(_ah) && \
+        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_101))
+ #define AR_SREV_9565_11(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
++      (AR_SREV_9565(_ah) && \
+        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_11))
+ #define AR_SREV_9565_11_OR_LATER(_ah) \
+-      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
++      (AR_SREV_9565(_ah) && \
+        ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9565_11))
+ #define AR_SREV_9550(_ah) \
+--- a/.local-symbols
++++ b/.local-symbols
+@@ -124,6 +124,7 @@ ATH9K_HW=
+ ATH9K_COMMON=
+ ATH9K_DFS_DEBUGFS=
+ ATH9K_BTCOEX_SUPPORT=
++ATH9K_PCOEM=
+ ATH9K=
+ ATH9K_PCI=
+ ATH9K_AHB=
diff --git a/package/kernel/mac80211/patches/327-ath9k_hw-remove-support-for-UB124-tx-gain-table.patch b/package/kernel/mac80211/patches/327-ath9k_hw-remove-support-for-UB124-tx-gain-table.patch
new file mode 100644 (file)
index 0000000..a76819d
--- /dev/null
@@ -0,0 +1,22 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 18 Oct 2014 13:25:26 +0200
+Subject: [PATCH] ath9k_hw: remove support for UB124 tx gain table
+
+UB124 is a USB based reference design not supported by ath9k or
+ath9k_htc.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+@@ -670,9 +670,6 @@ static void ar9003_tx_gain_table_mode5(s
+       if (AR_SREV_9485_11_OR_LATER(ah))
+               INIT_INI_ARRAY(&ah->iniModesTxGain,
+                       ar9485Modes_green_ob_db_tx_gain_1_1);
+-      else if (AR_SREV_9340(ah))
+-              INIT_INI_ARRAY(&ah->iniModesTxGain,
+-                      ar9340Modes_ub124_tx_gain_table_1p0);
+       else if (AR_SREV_9580(ah))
+               INIT_INI_ARRAY(&ah->iniModesTxGain,
+                       ar9580_1p0_type5_tx_gain_table);
diff --git a/package/kernel/mac80211/patches/328-ath9k-fix-processing-RXORN-interrupts.patch b/package/kernel/mac80211/patches/328-ath9k-fix-processing-RXORN-interrupts.patch
new file mode 100644 (file)
index 0000000..e9dbc68
--- /dev/null
@@ -0,0 +1,33 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 18 Oct 2014 13:31:52 +0200
+Subject: [PATCH] ath9k: fix processing RXORN interrupts
+
+The "goto chip_reset" is a bit misleading, because it does not actually
+issue a chip reset. Instead it is bypassing processing of other
+interrupts and assumes that the tasklet will issue a chip reset.
+
+In the case of RXORN this does not happen, so bypassing processing of
+other interrupts will simply allow them to fire again. Even if RXORN
+was triggering a reset, it is not critical enough to need the bypass
+here.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -545,11 +545,10 @@ irqreturn_t ath_isr(int irq, void *dev)
+               sched = true;
+       /*
+-       * If a FATAL or RXORN interrupt is received, we have to reset the
+-       * chip immediately.
++       * If a FATAL interrupt is received, we have to reset the chip
++       * immediately.
+        */
+-      if ((status & ATH9K_INT_FATAL) || ((status & ATH9K_INT_RXORN) &&
+-          !(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)))
++      if (status & ATH9K_INT_FATAL)
+               goto chip_reset;
+       if ((ah->config.hw_hang_checks & HW_BB_WATCHDOG) &&
diff --git a/package/kernel/mac80211/patches/329-ath9k-clean-up-debugfs-print-of-reset-causes.patch b/package/kernel/mac80211/patches/329-ath9k-clean-up-debugfs-print-of-reset-causes.patch
new file mode 100644 (file)
index 0000000..0f01a3a
--- /dev/null
@@ -0,0 +1,69 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 18 Oct 2014 13:36:41 +0200
+Subject: [PATCH] ath9k: clean up debugfs print of reset causes
+
+Reduce code duplication
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/debug.c
++++ b/drivers/net/wireless/ath/ath9k/debug.c
+@@ -852,36 +852,30 @@ static ssize_t read_file_reset(struct fi
+                              size_t count, loff_t *ppos)
+ {
+       struct ath_softc *sc = file->private_data;
++      static const char * const reset_cause[__RESET_TYPE_MAX] = {
++              [RESET_TYPE_BB_HANG] = "Baseband Hang",
++              [RESET_TYPE_BB_WATCHDOG] = "Baseband Watchdog",
++              [RESET_TYPE_FATAL_INT] = "Fatal HW Error",
++              [RESET_TYPE_TX_ERROR] = "TX HW error",
++              [RESET_TYPE_TX_GTT] = "Transmit timeout",
++              [RESET_TYPE_TX_HANG] = "TX Path Hang",
++              [RESET_TYPE_PLL_HANG] = "PLL RX Hang",
++              [RESET_TYPE_MAC_HANG] = "MAC Hang",
++              [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
++              [RESET_TYPE_MCI] = "MCI Reset",
++      };
+       char buf[512];
+       unsigned int len = 0;
++      int i;
+-      len += scnprintf(buf + len, sizeof(buf) - len,
+-                       "%17s: %2d\n", "Baseband Hang",
+-                       sc->debug.stats.reset[RESET_TYPE_BB_HANG]);
+-      len += scnprintf(buf + len, sizeof(buf) - len,
+-                       "%17s: %2d\n", "Baseband Watchdog",
+-                       sc->debug.stats.reset[RESET_TYPE_BB_WATCHDOG]);
+-      len += scnprintf(buf + len, sizeof(buf) - len,
+-                       "%17s: %2d\n", "Fatal HW Error",
+-                       sc->debug.stats.reset[RESET_TYPE_FATAL_INT]);
+-      len += scnprintf(buf + len, sizeof(buf) - len,
+-                       "%17s: %2d\n", "TX HW error",
+-                       sc->debug.stats.reset[RESET_TYPE_TX_ERROR]);
+-      len += scnprintf(buf + len, sizeof(buf) - len,
+-                       "%17s: %2d\n", "TX Path Hang",
+-                       sc->debug.stats.reset[RESET_TYPE_TX_HANG]);
+-      len += scnprintf(buf + len, sizeof(buf) - len,
+-                       "%17s: %2d\n", "PLL RX Hang",
+-                       sc->debug.stats.reset[RESET_TYPE_PLL_HANG]);
+-      len += scnprintf(buf + len, sizeof(buf) - len,
+-                       "%17s: %2d\n", "MAC Hang",
+-                       sc->debug.stats.reset[RESET_TYPE_MAC_HANG]);
+-      len += scnprintf(buf + len, sizeof(buf) - len,
+-                       "%17s: %2d\n", "Stuck Beacon",
+-                       sc->debug.stats.reset[RESET_TYPE_BEACON_STUCK]);
+-      len += scnprintf(buf + len, sizeof(buf) - len,
+-                       "%17s: %2d\n", "MCI Reset",
+-                       sc->debug.stats.reset[RESET_TYPE_MCI]);
++      for (i = 0; i < ARRAY_SIZE(reset_cause); i++) {
++              if (!reset_cause[i])
++                  continue;
++
++              len += scnprintf(buf + len, sizeof(buf) - len,
++                               "%17s: %2d\n", reset_cause[i],
++                               sc->debug.stats.reset[i]);
++      }
+       if (len > sizeof(buf))
+               len = sizeof(buf);
diff --git a/package/kernel/mac80211/patches/330-ath9k-restart-hardware-after-noise-floor-calibration.patch b/package/kernel/mac80211/patches/330-ath9k-restart-hardware-after-noise-floor-calibration.patch
new file mode 100644 (file)
index 0000000..3b8370d
--- /dev/null
@@ -0,0 +1,184 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 18 Oct 2014 13:37:32 +0200
+Subject: [PATCH] ath9k: restart hardware after noise floor calibration
+ failure
+
+When NF calibration fails, the radio often becomes deaf. The usual
+hardware hang checks do not detect this, so it's better to issue a reset
+when that happens.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
++++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+@@ -657,14 +657,13 @@ static void ar9002_hw_olc_temp_compensat
+               ar9280_hw_olc_temp_compensation(ah);
+ }
+-static bool ar9002_hw_calibrate(struct ath_hw *ah,
+-                              struct ath9k_channel *chan,
+-                              u8 rxchainmask,
+-                              bool longcal)
++static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
++                             u8 rxchainmask, bool longcal)
+ {
+       bool iscaldone = true;
+       struct ath9k_cal_list *currCal = ah->cal_list_curr;
+       bool nfcal, nfcal_pending = false;
++      int ret;
+       nfcal = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF);
+       if (ah->caldata)
+@@ -698,7 +697,9 @@ static bool ar9002_hw_calibrate(struct a
+                        * NF is slow time-variant, so it is OK to use a
+                        * historical value.
+                        */
+-                      ath9k_hw_loadnf(ah, ah->curchan);
++                      ret = ath9k_hw_loadnf(ah, ah->curchan);
++                      if (ret < 0)
++                              return ret;
+               }
+               if (longcal) {
+--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+@@ -121,13 +121,12 @@ static bool ar9003_hw_per_calibration(st
+       return iscaldone;
+ }
+-static bool ar9003_hw_calibrate(struct ath_hw *ah,
+-                              struct ath9k_channel *chan,
+-                              u8 rxchainmask,
+-                              bool longcal)
++static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
++                             u8 rxchainmask, bool longcal)
+ {
+       bool iscaldone = true;
+       struct ath9k_cal_list *currCal = ah->cal_list_curr;
++      int ret;
+       /*
+        * For given calibration:
+@@ -163,7 +162,9 @@ static bool ar9003_hw_calibrate(struct a
+                * NF is slow time-variant, so it is OK to use a historical
+                * value.
+                */
+-              ath9k_hw_loadnf(ah, ah->curchan);
++              ret = ath9k_hw_loadnf(ah, ah->curchan);
++              if (ret < 0)
++                      return ret;
+               /* start NF calibration, without updating BB NF register */
+               ath9k_hw_start_nfcal(ah, false);
+--- a/drivers/net/wireless/ath/ath9k/calib.c
++++ b/drivers/net/wireless/ath/ath9k/calib.c
+@@ -234,7 +234,7 @@ void ath9k_hw_start_nfcal(struct ath_hw 
+       REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
+ }
+-void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
++int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
+ {
+       struct ath9k_nfcal_hist *h = NULL;
+       unsigned i, j;
+@@ -301,7 +301,7 @@ void ath9k_hw_loadnf(struct ath_hw *ah, 
+               ath_dbg(common, ANY,
+                       "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
+                       REG_READ(ah, AR_PHY_AGC_CONTROL));
+-              return;
++              return -ETIMEDOUT;
+       }
+       /*
+@@ -322,6 +322,8 @@ void ath9k_hw_loadnf(struct ath_hw *ah, 
+               }
+       }
+       REGWRITE_BUFFER_FLUSH(ah);
++
++      return 0;
+ }
+--- a/drivers/net/wireless/ath/ath9k/calib.h
++++ b/drivers/net/wireless/ath/ath9k/calib.h
+@@ -109,7 +109,7 @@ struct ath9k_pacal_info{
+ bool ath9k_hw_reset_calvalid(struct ath_hw *ah);
+ void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update);
+-void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan);
++int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan);
+ bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan);
+ void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
+                                 struct ath9k_channel *chan);
+--- a/drivers/net/wireless/ath/ath9k/debug.c
++++ b/drivers/net/wireless/ath/ath9k/debug.c
+@@ -863,6 +863,7 @@ static ssize_t read_file_reset(struct fi
+               [RESET_TYPE_MAC_HANG] = "MAC Hang",
+               [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
+               [RESET_TYPE_MCI] = "MCI Reset",
++              [RESET_TYPE_CALIBRATION] = "Calibration error",
+       };
+       char buf[512];
+       unsigned int len = 0;
+--- a/drivers/net/wireless/ath/ath9k/debug.h
++++ b/drivers/net/wireless/ath/ath9k/debug.h
+@@ -49,6 +49,7 @@ enum ath_reset_type {
+       RESET_TYPE_MAC_HANG,
+       RESET_TYPE_BEACON_STUCK,
+       RESET_TYPE_MCI,
++      RESET_TYPE_CALIBRATION,
+       __RESET_TYPE_MAX
+ };
+--- a/drivers/net/wireless/ath/ath9k/hw-ops.h
++++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
+@@ -41,10 +41,9 @@ static inline void ath9k_hw_set_desc_lin
+       ath9k_hw_ops(ah)->set_desc_link(ds, link);
+ }
+-static inline bool ath9k_hw_calibrate(struct ath_hw *ah,
+-                                    struct ath9k_channel *chan,
+-                                    u8 rxchainmask,
+-                                    bool longcal)
++static inline int ath9k_hw_calibrate(struct ath_hw *ah,
++                                   struct ath9k_channel *chan,
++                                   u8 rxchainmask, bool longcal)
+ {
+       return ath9k_hw_ops(ah)->calibrate(ah, chan, rxchainmask, longcal);
+ }
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -688,10 +688,8 @@ struct ath_hw_ops {
+                                    bool power_off);
+       void (*rx_enable)(struct ath_hw *ah);
+       void (*set_desc_link)(void *ds, u32 link);
+-      bool (*calibrate)(struct ath_hw *ah,
+-                        struct ath9k_channel *chan,
+-                        u8 rxchainmask,
+-                        bool longcal);
++      int (*calibrate)(struct ath_hw *ah, struct ath9k_channel *chan,
++                       u8 rxchainmask, bool longcal);
+       bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked,
+                       u32 *sync_cause_p);
+       void (*set_txdesc)(struct ath_hw *ah, void *ds,
+--- a/drivers/net/wireless/ath/ath9k/link.c
++++ b/drivers/net/wireless/ath/ath9k/link.c
+@@ -371,9 +371,14 @@ void ath_ani_calibrate(unsigned long dat
+       /* Perform calibration if necessary */
+       if (longcal || shortcal) {
+-              common->ani.caldone =
+-                      ath9k_hw_calibrate(ah, ah->curchan,
+-                                         ah->rxchainmask, longcal);
++              int ret = ath9k_hw_calibrate(ah, ah->curchan, ah->rxchainmask,
++                                           longcal);
++              if (ret < 0) {
++                      ath9k_queue_reset(sc, RESET_TYPE_CALIBRATION);
++                      return;
++              }
++
++              common->ani.caldone = ret;
+       }
+       ath_dbg(common, ANI,
diff --git a/package/kernel/mac80211/patches/331-ath9k_hw-do-not-run-NF-and-periodic-calibration-at-t.patch b/package/kernel/mac80211/patches/331-ath9k_hw-do-not-run-NF-and-periodic-calibration-at-t.patch
new file mode 100644 (file)
index 0000000..1d841a7
--- /dev/null
@@ -0,0 +1,53 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 18 Oct 2014 13:39:11 +0200
+Subject: [PATCH] ath9k_hw: do not run NF and periodic calibration at the
+ same time
+
+It can cause inconsistent calibration results or in some cases turn the
+radio deaf.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
++++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+@@ -660,7 +660,6 @@ static void ar9002_hw_olc_temp_compensat
+ static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
+                              u8 rxchainmask, bool longcal)
+ {
+-      bool iscaldone = true;
+       struct ath9k_cal_list *currCal = ah->cal_list_curr;
+       bool nfcal, nfcal_pending = false;
+       int ret;
+@@ -672,15 +671,13 @@ static int ar9002_hw_calibrate(struct at
+       if (currCal && !nfcal &&
+           (currCal->calState == CAL_RUNNING ||
+            currCal->calState == CAL_WAITING)) {
+-              iscaldone = ar9002_hw_per_calibration(ah, chan,
+-                                                    rxchainmask, currCal);
+-              if (iscaldone) {
+-                      ah->cal_list_curr = currCal = currCal->calNext;
+-
+-                      if (currCal->calState == CAL_WAITING) {
+-                              iscaldone = false;
+-                              ath9k_hw_reset_calibration(ah, currCal);
+-                      }
++              if (!ar9002_hw_per_calibration(ah, chan, rxchainmask, currCal))
++                      return 0;
++
++              ah->cal_list_curr = currCal = currCal->calNext;
++              if (currCal->calState == CAL_WAITING) {
++                      ath9k_hw_reset_calibration(ah, currCal);
++                      return 0;
+               }
+       }
+@@ -710,7 +707,7 @@ static int ar9002_hw_calibrate(struct at
+               }
+       }
+-      return iscaldone;
++      return 1;
+ }
+ /* Carrier leakage Calibration fix */
diff --git a/package/kernel/mac80211/patches/332-ath9k_hw-start-initial-NF-calibration-after-PA-calib.patch b/package/kernel/mac80211/patches/332-ath9k_hw-start-initial-NF-calibration-after-PA-calib.patch
new file mode 100644 (file)
index 0000000..e89c884
--- /dev/null
@@ -0,0 +1,35 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 18 Oct 2014 13:42:03 +0200
+Subject: [PATCH] ath9k_hw: start initial NF calibration after PA
+ calibration on <AR9003
+
+This makes the initial NF calibration less likely to fail.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
++++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+@@ -854,6 +854,7 @@ static bool ar9002_hw_init_cal(struct at
+       /* Do PA Calibration */
+       ar9002_hw_pa_cal(ah, true);
++      ath9k_hw_start_nfcal(ah, true);
+       if (ah->caldata)
+               set_bit(NFCAL_PENDING, &ah->caldata->cal_flags);
+--- a/drivers/net/wireless/ath/ath9k/hw.c
++++ b/drivers/net/wireless/ath/ath9k/hw.c
+@@ -1953,8 +1953,10 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+       if (ath9k_hw_mci_is_enabled(ah))
+               ar9003_mci_check_bt(ah);
+-      ath9k_hw_loadnf(ah, chan);
+-      ath9k_hw_start_nfcal(ah, true);
++      if (AR_SREV_9300_20_OR_LATER(ah)) {
++              ath9k_hw_loadnf(ah, chan);
++              ath9k_hw_start_nfcal(ah, true);
++      }
+       if (AR_SREV_9300_20_OR_LATER(ah))
+               ar9003_hw_bb_watchdog_config(ah);
diff --git a/package/kernel/mac80211/patches/333-ath9k-add-support-for-endian-swap-of-eeprom-from-pla.patch b/package/kernel/mac80211/patches/333-ath9k-add-support-for-endian-swap-of-eeprom-from-pla.patch
new file mode 100644 (file)
index 0000000..df1a710
--- /dev/null
@@ -0,0 +1,92 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 18 Oct 2014 18:24:15 +0200
+Subject: [PATCH] ath9k: add support for endian swap of eeprom from
+ platform data
+
+On some devices (especially little-endian ones), the flash EEPROM data
+has a different endian, which needs to be detected.
+Add a flag to the platform data to allow overriding that behavior
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
++++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
+@@ -262,7 +262,7 @@ static int ath9k_hw_def_check_eeprom(str
+ {
+       struct ar5416_eeprom_def *eep = &ah->eeprom.def;
+       struct ath_common *common = ath9k_hw_common(ah);
+-      u16 *eepdata, temp, magic, magic2;
++      u16 *eepdata, temp, magic;
+       u32 sum = 0, el;
+       bool need_swap = false;
+       int i, addr, size;
+@@ -272,27 +272,16 @@ static int ath9k_hw_def_check_eeprom(str
+               return false;
+       }
+-      if (!ath9k_hw_use_flash(ah)) {
+-              ath_dbg(common, EEPROM, "Read Magic = 0x%04X\n", magic);
+-
+-              if (magic != AR5416_EEPROM_MAGIC) {
+-                      magic2 = swab16(magic);
+-
+-                      if (magic2 == AR5416_EEPROM_MAGIC) {
+-                              size = sizeof(struct ar5416_eeprom_def);
+-                              need_swap = true;
+-                              eepdata = (u16 *) (&ah->eeprom);
+-
+-                              for (addr = 0; addr < size / sizeof(u16); addr++) {
+-                                      temp = swab16(*eepdata);
+-                                      *eepdata = temp;
+-                                      eepdata++;
+-                              }
+-                      } else {
+-                              ath_err(common,
+-                                      "Invalid EEPROM Magic. Endianness mismatch.\n");
+-                              return -EINVAL;
+-                      }
++      if (swab16(magic) == AR5416_EEPROM_MAGIC &&
++          !(ah->ah_flags & AH_NO_EEP_SWAP)) {
++              size = sizeof(struct ar5416_eeprom_def);
++              need_swap = true;
++              eepdata = (u16 *) (&ah->eeprom);
++
++              for (addr = 0; addr < size / sizeof(u16); addr++) {
++                      temp = swab16(*eepdata);
++                      *eepdata = temp;
++                      eepdata++;
+               }
+       }
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -731,6 +731,7 @@ enum ath_cal_list {
+ #define AH_USE_EEPROM   0x1
+ #define AH_UNPLUGGED    0x2 /* The card has been physically removed. */
+ #define AH_FASTCC       0x4
++#define AH_NO_EEP_SWAP  0x8 /* Do not swap EEPROM data */
+ struct ath_hw {
+       struct ath_ops reg_ops;
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -531,6 +531,8 @@ static int ath9k_init_softc(u16 devid, s
+               ah->is_clk_25mhz = pdata->is_clk_25mhz;
+               ah->get_mac_revision = pdata->get_mac_revision;
+               ah->external_reset = pdata->external_reset;
++              if (!pdata->endian_check)
++                      ah->ah_flags |= AH_NO_EEP_SWAP;
+       }
+       common->ops = &ah->reg_ops;
+--- a/include/linux/ath9k_platform.h
++++ b/include/linux/ath9k_platform.h
+@@ -31,6 +31,7 @@ struct ath9k_platform_data {
+       u32 gpio_mask;
+       u32 gpio_val;
++      bool endian_check;
+       bool is_clk_25mhz;
+       bool tx_gain_buffalo;
diff --git a/package/kernel/mac80211/patches/334-ath9k-allow-disabling-bands-via-platform-data.patch b/package/kernel/mac80211/patches/334-ath9k-allow-disabling-bands-via-platform-data.patch
new file mode 100644 (file)
index 0000000..f7185b0
--- /dev/null
@@ -0,0 +1,81 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 18 Oct 2014 18:27:23 +0200
+Subject: [PATCH] ath9k: allow disabling bands via platform data
+
+Some devices have multiple bands enables in the EEPROM data, even though
+they are only calibrated for one. Allow platform data to disable
+unsupported bands.
+
+Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/hw.c
++++ b/drivers/net/wireless/ath/ath9k/hw.c
+@@ -2344,17 +2344,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
+       }
+       eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
+-      if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) {
+-              ath_err(common,
+-                      "no band has been marked as supported in EEPROM\n");
+-              return -EINVAL;
++
++      if (eeval & AR5416_OPFLAGS_11A) {
++              if (ah->disable_5ghz)
++                      ath_warn(common, "disabling 5GHz band\n");
++              else
++                      pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
+       }
+-      if (eeval & AR5416_OPFLAGS_11A)
+-              pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
++      if (eeval & AR5416_OPFLAGS_11G) {
++              if (ah->disable_2ghz)
++                      ath_warn(common, "disabling 2GHz band\n");
++              else
++                      pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
++      }
+-      if (eeval & AR5416_OPFLAGS_11G)
+-              pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
++      if ((pCap->hw_caps & (ATH9K_HW_CAP_2GHZ | ATH9K_HW_CAP_5GHZ)) == 0) {
++              ath_err(common, "both bands are disabled\n");
++              return -EINVAL;
++      }
+       if (AR_SREV_9485(ah) ||
+           AR_SREV_9285(ah) ||
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -930,6 +930,8 @@ struct ath_hw {
+       bool is_clk_25mhz;
+       int (*get_mac_revision)(void);
+       int (*external_reset)(void);
++      bool disable_2ghz;
++      bool disable_5ghz;
+       const struct firmware *eeprom_blob;
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -531,6 +531,8 @@ static int ath9k_init_softc(u16 devid, s
+               ah->is_clk_25mhz = pdata->is_clk_25mhz;
+               ah->get_mac_revision = pdata->get_mac_revision;
+               ah->external_reset = pdata->external_reset;
++              ah->disable_2ghz = pdata->disable_2ghz;
++              ah->disable_5ghz = pdata->disable_5ghz;
+               if (!pdata->endian_check)
+                       ah->ah_flags |= AH_NO_EEP_SWAP;
+       }
+--- a/include/linux/ath9k_platform.h
++++ b/include/linux/ath9k_platform.h
+@@ -34,6 +34,8 @@ struct ath9k_platform_data {
+       bool endian_check;
+       bool is_clk_25mhz;
+       bool tx_gain_buffalo;
++      bool disable_2ghz;
++      bool disable_5ghz;
+       int (*get_mac_revision)(void);
+       int (*external_reset)(void);
diff --git a/package/kernel/mac80211/patches/335-ath9k-use-a-random-MAC-address-if-the-EEPROM-address.patch b/package/kernel/mac80211/patches/335-ath9k-use-a-random-MAC-address-if-the-EEPROM-address.patch
new file mode 100644 (file)
index 0000000..ce6c081
--- /dev/null
@@ -0,0 +1,39 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 18 Oct 2014 18:31:49 +0200
+Subject: [PATCH] ath9k: use a random MAC address if the EEPROM address
+ is invalid
+
+Based on OpenWrt patch by Gabor Juhos
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/hw.c
++++ b/drivers/net/wireless/ath/ath9k/hw.c
+@@ -19,6 +19,7 @@
+ #include <linux/module.h>
+ #include <linux/time.h>
+ #include <linux/bitops.h>
++#include <linux/etherdevice.h>
+ #include <asm/unaligned.h>
+ #include "hw.h"
+@@ -446,8 +447,16 @@ static int ath9k_hw_init_macaddr(struct 
+               common->macaddr[2 * i] = eeval >> 8;
+               common->macaddr[2 * i + 1] = eeval & 0xff;
+       }
+-      if (sum == 0 || sum == 0xffff * 3)
+-              return -EADDRNOTAVAIL;
++      if (!is_valid_ether_addr(common->macaddr)) {
++              ath_err(common,
++                      "eeprom contains invalid mac address: %pM\n",
++                      common->macaddr);
++
++              random_ether_addr(common->macaddr);
++              ath_err(common,
++                      "random mac address will be used: %pM\n",
++                      common->macaddr);
++      }
+       return 0;
+ }
index 636df1fe8aff210ac65aefa44a4e87ed3886bedb..ccd4a3e5015ed6474dd3de40d8d2f2729b902890 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/Makefile
 +++ b/drivers/net/wireless/ath/Makefile
 --- a/drivers/net/wireless/ath/Makefile
 +++ b/drivers/net/wireless/ath/Makefile
-@@ -13,8 +13,8 @@ ath-objs :=  main.o \
+@@ -13,10 +13,10 @@ ath-objs :=        main.o \
                regd.o \
                hw.o \
                key.o \
                regd.o \
                hw.o \
                key.o \
@@ -9,10 +9,12 @@
                dfs_pri_detector.o
  
 -ath-$(CPTCFG_ATH_DEBUG) += debug.o
                dfs_pri_detector.o
  
 -ath-$(CPTCFG_ATH_DEBUG) += debug.o
+ ath-$(CPTCFG_ATH_TRACEPOINTS) += trace.o
  ccflags-y += -D__CHECK_ENDIAN__
 --- a/drivers/net/wireless/ath/ath.h
 +++ b/drivers/net/wireless/ath/ath.h
  ccflags-y += -D__CHECK_ENDIAN__
 --- a/drivers/net/wireless/ath/ath.h
 +++ b/drivers/net/wireless/ath/ath.h
-@@ -299,13 +299,6 @@ void _ath_dbg(struct ath_common *common,
+@@ -300,13 +300,6 @@ void _ath_dbg(struct ath_common *common,
  #endif /* CPTCFG_ATH_DEBUG */
  
  /** Returns string describing opmode, or NULL if unknown mode. */
  #endif /* CPTCFG_ATH_DEBUG */
  
  /** Returns string describing opmode, or NULL if unknown mode. */
diff --git a/package/kernel/mac80211/patches/402-ath9k-fix-invalid-mac-address-handling.patch b/package/kernel/mac80211/patches/402-ath9k-fix-invalid-mac-address-handling.patch
deleted file mode 100644 (file)
index 29c5ac9..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -19,6 +19,7 @@
- #include <linux/module.h>
- #include <linux/time.h>
- #include <linux/bitops.h>
-+#include <linux/etherdevice.h>
- #include <asm/unaligned.h>
- #include "hw.h"
-@@ -446,8 +447,16 @@ static int ath9k_hw_init_macaddr(struct 
-               common->macaddr[2 * i] = eeval >> 8;
-               common->macaddr[2 * i + 1] = eeval & 0xff;
-       }
--      if (sum == 0 || sum == 0xffff * 3)
--              return -EADDRNOTAVAIL;
-+      if (!is_valid_ether_addr(common->macaddr)) {
-+              ath_err(common,
-+                      "eeprom contains invalid mac address: %pM\n",
-+                      common->macaddr);
-+
-+              random_ether_addr(common->macaddr);
-+              ath_err(common,
-+                      "random mac address will be used: %pM\n",
-+                      common->macaddr);
-+      }
-       return 0;
- }
diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
new file mode 100644 (file)
index 0000000..42260fc
--- /dev/null
@@ -0,0 +1,68 @@
+--- a/drivers/net/wireless/ath/regd.c
++++ b/drivers/net/wireless/ath/regd.c
+@@ -341,6 +341,10 @@ ath_reg_apply_beaconing_flags(struct wip
+       struct ieee80211_channel *ch;
+       unsigned int i;
++#ifdef CPTCFG_ATH_USER_REGD
++      return;
++#endif
++
+       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               if (!wiphy->bands[band])
+                       continue;
+@@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
+ {
+       struct ieee80211_supported_band *sband;
++#ifdef CPTCFG_ATH_USER_REGD
++      return;
++#endif
++
+       sband = wiphy->bands[IEEE80211_BAND_2GHZ];
+       if (!sband)
+               return;
+@@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
+       struct ieee80211_channel *ch;
+       unsigned int i;
++#ifdef CPTCFG_ATH_USER_REGD
++      return;
++#endif
++
+       if (!wiphy->bands[IEEE80211_BAND_5GHZ])
+               return;
+@@ -631,6 +643,10 @@ ath_regd_init_wiphy(struct ath_regulator
+ {
+       const struct ieee80211_regdomain *regd;
++#ifdef CPTCFG_ATH_USER_REGD
++      return 0;
++#endif
++
+       wiphy->reg_notifier = reg_notifier;
+       wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
+                                  REGULATORY_CUSTOM_REG;
+--- a/drivers/net/wireless/ath/Kconfig
++++ b/drivers/net/wireless/ath/Kconfig
+@@ -21,6 +21,9 @@ menuconfig ATH_CARDS
+ if ATH_CARDS
++config ATH_USER_REGD
++      bool "Do not enforce EEPROM regulatory restrictions"
++
+ config ATH_DEBUG
+       bool "Atheros wireless debugging"
+       ---help---
+--- a/.local-symbols
++++ b/.local-symbols
+@@ -112,6 +112,7 @@ RTL8187_LEDS=
+ ATH_COMMON=
+ ATH_CARDS=
+ ATH_DEBUG=
++ATH_USER_REGD=
+ ATH_TRACEPOINTS=
+ ATH_REG_DYNAMIC_USER_REG_HINTS=
+ ATH_REG_DYNAMIC_USER_CERT_TESTING=
diff --git a/package/kernel/mac80211/patches/403-ath_regd_optional.patch b/package/kernel/mac80211/patches/403-ath_regd_optional.patch
deleted file mode 100644 (file)
index 8efa92e..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
---- a/drivers/net/wireless/ath/regd.c
-+++ b/drivers/net/wireless/ath/regd.c
-@@ -341,6 +341,10 @@ ath_reg_apply_beaconing_flags(struct wip
-       struct ieee80211_channel *ch;
-       unsigned int i;
-+#ifdef CPTCFG_ATH_USER_REGD
-+      return;
-+#endif
-+
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
-               if (!wiphy->bands[band])
-                       continue;
-@@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
- {
-       struct ieee80211_supported_band *sband;
-+#ifdef CPTCFG_ATH_USER_REGD
-+      return;
-+#endif
-+
-       sband = wiphy->bands[IEEE80211_BAND_2GHZ];
-       if (!sband)
-               return;
-@@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
-       struct ieee80211_channel *ch;
-       unsigned int i;
-+#ifdef CPTCFG_ATH_USER_REGD
-+      return;
-+#endif
-+
-       if (!wiphy->bands[IEEE80211_BAND_5GHZ])
-               return;
-@@ -631,6 +643,10 @@ ath_regd_init_wiphy(struct ath_regulator
- {
-       const struct ieee80211_regdomain *regd;
-+#ifdef CPTCFG_ATH_USER_REGD
-+      return 0;
-+#endif
-+
-       wiphy->reg_notifier = reg_notifier;
-       wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
-                                  REGULATORY_CUSTOM_REG;
---- a/drivers/net/wireless/ath/Kconfig
-+++ b/drivers/net/wireless/ath/Kconfig
-@@ -21,6 +21,9 @@ menuconfig ATH_CARDS
- if ATH_CARDS
-+config ATH_USER_REGD
-+      bool "Do not enforce EEPROM regulatory restrictions"
-+
- config ATH_DEBUG
-       bool "Atheros wireless debugging"
-       ---help---
---- a/.local-symbols
-+++ b/.local-symbols
-@@ -112,6 +112,7 @@ RTL8187_LEDS=
- ATH_COMMON=
- ATH_CARDS=
- ATH_DEBUG=
-+ATH_USER_REGD=
- ATH_REG_DYNAMIC_USER_REG_HINTS=
- ATH_REG_DYNAMIC_USER_CERT_TESTING=
- ATH5K=
diff --git a/package/kernel/mac80211/patches/403-world_regd_fixup.patch b/package/kernel/mac80211/patches/403-world_regd_fixup.patch
new file mode 100644 (file)
index 0000000..2b04309
--- /dev/null
@@ -0,0 +1,84 @@
+--- a/drivers/net/wireless/ath/regd.c
++++ b/drivers/net/wireless/ath/regd.c
+@@ -43,7 +43,8 @@ static int __ath_regd_init(struct ath_re
+                                        NL80211_RRF_NO_OFDM)
+ /* We allow IBSS on these on a case by case basis by regulatory domain */
+-#define ATH9K_5GHZ_5150_5350  REG_RULE(5150-10, 5350+10, 80, 0, 30,\
++#define ATH9K_5GHZ_5150_5350  REG_RULE(5150-10, 5240+10, 80, 0, 30, 0),\
++                              REG_RULE(5260-10, 5350+10, 80, 0, 30,\
+                                        NL80211_RRF_NO_IR)
+ #define ATH9K_5GHZ_5470_5850  REG_RULE(5470-10, 5850+10, 80, 0, 30,\
+                                        NL80211_RRF_NO_IR)
+@@ -61,57 +62,56 @@ static int __ath_regd_init(struct ath_re
+ #define ATH9K_5GHZ_NO_MIDBAND ATH9K_5GHZ_5150_5350, \
+                               ATH9K_5GHZ_5725_5850
++#define REGD_RULES(...) \
++      .reg_rules = { __VA_ARGS__ }, \
++      .n_reg_rules = ARRAY_SIZE(((struct ieee80211_reg_rule[]) { __VA_ARGS__ }))
++
+ /* Can be used for:
+  * 0x60, 0x61, 0x62 */
+ static const struct ieee80211_regdomain ath_world_regdom_60_61_62 = {
+-      .n_reg_rules = 5,
+       .alpha2 =  "99",
+-      .reg_rules = {
++      REGD_RULES(
+               ATH9K_2GHZ_ALL,
+               ATH9K_5GHZ_ALL,
+-      }
++      )
+ };
+ /* Can be used by 0x63 and 0x65 */
+ static const struct ieee80211_regdomain ath_world_regdom_63_65 = {
+-      .n_reg_rules = 4,
+       .alpha2 =  "99",
+-      .reg_rules = {
++      REGD_RULES(
+               ATH9K_2GHZ_CH01_11,
+               ATH9K_2GHZ_CH12_13,
+               ATH9K_5GHZ_NO_MIDBAND,
+-      }
++      )
+ };
+ /* Can be used by 0x64 only */
+ static const struct ieee80211_regdomain ath_world_regdom_64 = {
+-      .n_reg_rules = 3,
+       .alpha2 =  "99",
+-      .reg_rules = {
++      REGD_RULES(
+               ATH9K_2GHZ_CH01_11,
+               ATH9K_5GHZ_NO_MIDBAND,
+-      }
++      )
+ };
+ /* Can be used by 0x66 and 0x69 */
+ static const struct ieee80211_regdomain ath_world_regdom_66_69 = {
+-      .n_reg_rules = 3,
+       .alpha2 =  "99",
+-      .reg_rules = {
++      REGD_RULES(
+               ATH9K_2GHZ_CH01_11,
+               ATH9K_5GHZ_ALL,
+-      }
++      )
+ };
+ /* Can be used by 0x67, 0x68, 0x6A and 0x6C */
+ static const struct ieee80211_regdomain ath_world_regdom_67_68_6A_6C = {
+-      .n_reg_rules = 4,
+       .alpha2 =  "99",
+-      .reg_rules = {
++      REGD_RULES(
+               ATH9K_2GHZ_CH01_11,
+               ATH9K_2GHZ_CH12_13,
+               ATH9K_5GHZ_ALL,
+-      }
++      )
+ };
+ static bool dynamic_country_user_possible(struct ath_regulatory *reg)
diff --git a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
new file mode 100644 (file)
index 0000000..85f1fc0
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/net/wireless/reg.c
++++ b/net/wireless/reg.c
+@@ -2112,6 +2112,8 @@ void regulatory_hint_country_ie(struct w
+       enum environment_cap env = ENVIRON_ANY;
+       struct regulatory_request *request = NULL, *lr;
++      return;
++
+       /* IE len must be evenly divisible by 2 */
+       if (country_ie_len & 0x01)
+               return;
+@@ -2308,6 +2310,7 @@ static void restore_regulatory_settings(
+ void regulatory_hint_disconnect(void)
+ {
++      return;
+       REG_DBG_PRINT("All devices are disconnected, going to restore regulatory settings\n");
+       restore_regulatory_settings(false);
+ }
diff --git a/package/kernel/mac80211/patches/404-world_regd_fixup.patch b/package/kernel/mac80211/patches/404-world_regd_fixup.patch
deleted file mode 100644 (file)
index 2b04309..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
---- a/drivers/net/wireless/ath/regd.c
-+++ b/drivers/net/wireless/ath/regd.c
-@@ -43,7 +43,8 @@ static int __ath_regd_init(struct ath_re
-                                        NL80211_RRF_NO_OFDM)
- /* We allow IBSS on these on a case by case basis by regulatory domain */
--#define ATH9K_5GHZ_5150_5350  REG_RULE(5150-10, 5350+10, 80, 0, 30,\
-+#define ATH9K_5GHZ_5150_5350  REG_RULE(5150-10, 5240+10, 80, 0, 30, 0),\
-+                              REG_RULE(5260-10, 5350+10, 80, 0, 30,\
-                                        NL80211_RRF_NO_IR)
- #define ATH9K_5GHZ_5470_5850  REG_RULE(5470-10, 5850+10, 80, 0, 30,\
-                                        NL80211_RRF_NO_IR)
-@@ -61,57 +62,56 @@ static int __ath_regd_init(struct ath_re
- #define ATH9K_5GHZ_NO_MIDBAND ATH9K_5GHZ_5150_5350, \
-                               ATH9K_5GHZ_5725_5850
-+#define REGD_RULES(...) \
-+      .reg_rules = { __VA_ARGS__ }, \
-+      .n_reg_rules = ARRAY_SIZE(((struct ieee80211_reg_rule[]) { __VA_ARGS__ }))
-+
- /* Can be used for:
-  * 0x60, 0x61, 0x62 */
- static const struct ieee80211_regdomain ath_world_regdom_60_61_62 = {
--      .n_reg_rules = 5,
-       .alpha2 =  "99",
--      .reg_rules = {
-+      REGD_RULES(
-               ATH9K_2GHZ_ALL,
-               ATH9K_5GHZ_ALL,
--      }
-+      )
- };
- /* Can be used by 0x63 and 0x65 */
- static const struct ieee80211_regdomain ath_world_regdom_63_65 = {
--      .n_reg_rules = 4,
-       .alpha2 =  "99",
--      .reg_rules = {
-+      REGD_RULES(
-               ATH9K_2GHZ_CH01_11,
-               ATH9K_2GHZ_CH12_13,
-               ATH9K_5GHZ_NO_MIDBAND,
--      }
-+      )
- };
- /* Can be used by 0x64 only */
- static const struct ieee80211_regdomain ath_world_regdom_64 = {
--      .n_reg_rules = 3,
-       .alpha2 =  "99",
--      .reg_rules = {
-+      REGD_RULES(
-               ATH9K_2GHZ_CH01_11,
-               ATH9K_5GHZ_NO_MIDBAND,
--      }
-+      )
- };
- /* Can be used by 0x66 and 0x69 */
- static const struct ieee80211_regdomain ath_world_regdom_66_69 = {
--      .n_reg_rules = 3,
-       .alpha2 =  "99",
--      .reg_rules = {
-+      REGD_RULES(
-               ATH9K_2GHZ_CH01_11,
-               ATH9K_5GHZ_ALL,
--      }
-+      )
- };
- /* Can be used by 0x67, 0x68, 0x6A and 0x6C */
- static const struct ieee80211_regdomain ath_world_regdom_67_68_6A_6C = {
--      .n_reg_rules = 4,
-       .alpha2 =  "99",
--      .reg_rules = {
-+      REGD_RULES(
-               ATH9K_2GHZ_CH01_11,
-               ATH9K_2GHZ_CH12_13,
-               ATH9K_5GHZ_ALL,
--      }
-+      )
- };
- static bool dynamic_country_user_possible(struct ath_regulatory *reg)
diff --git a/package/kernel/mac80211/patches/405-ath_regd_us.patch b/package/kernel/mac80211/patches/405-ath_regd_us.patch
new file mode 100644 (file)
index 0000000..cc55877
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/drivers/net/wireless/ath/regd_common.h
++++ b/drivers/net/wireless/ath/regd_common.h
+@@ -32,6 +32,7 @@ enum EnumRd {
+       FCC2_WORLD = 0x21,
+       FCC2_ETSIC = 0x22,
+       FCC6_WORLD = 0x23,
++      FCC3_FCCA_2 = 0x2A,
+       FRANCE_RES = 0x31,
+       FCC3_FCCA = 0x3A,
+       FCC3_WORLD = 0x3B,
+@@ -167,6 +168,7 @@ static struct reg_dmn_pair_mapping regDo
+       {FCC2_WORLD, CTL_FCC, CTL_ETSI},
+       {FCC2_ETSIC, CTL_FCC, CTL_ETSI},
+       {FCC3_FCCA, CTL_FCC, CTL_FCC},
++      {FCC3_FCCA_2, CTL_FCC, CTL_FCC},
+       {FCC3_WORLD, CTL_FCC, CTL_ETSI},
+       {FCC4_FCCA, CTL_FCC, CTL_FCC},
+       {FCC5_FCCA, CTL_FCC, CTL_FCC},
+@@ -463,6 +465,7 @@ static struct country_code_to_enum_rd al
+       {CTRY_UAE, NULL1_WORLD, "AE"},
+       {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},
+       {CTRY_UNITED_STATES, FCC3_FCCA, "US"},
++      {CTRY_UNITED_STATES, FCC3_FCCA_2, "US"},
+       /* This "PS" is for US public safety actually... to support this we
+        * would need to assign new special alpha2 to CRDA db as with the world
+        * regdomain and use another alpha2 */
diff --git a/package/kernel/mac80211/patches/405-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/405-regd_no_assoc_hints.patch
deleted file mode 100644 (file)
index 85f1fc0..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- a/net/wireless/reg.c
-+++ b/net/wireless/reg.c
-@@ -2112,6 +2112,8 @@ void regulatory_hint_country_ie(struct w
-       enum environment_cap env = ENVIRON_ANY;
-       struct regulatory_request *request = NULL, *lr;
-+      return;
-+
-       /* IE len must be evenly divisible by 2 */
-       if (country_ie_len & 0x01)
-               return;
-@@ -2308,6 +2310,7 @@ static void restore_regulatory_settings(
- void regulatory_hint_disconnect(void)
- {
-+      return;
-       REG_DBG_PRINT("All devices are disconnected, going to restore regulatory settings\n");
-       restore_regulatory_settings(false);
- }
diff --git a/package/kernel/mac80211/patches/406-ath_regd_us.patch b/package/kernel/mac80211/patches/406-ath_regd_us.patch
deleted file mode 100644 (file)
index cc55877..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/drivers/net/wireless/ath/regd_common.h
-+++ b/drivers/net/wireless/ath/regd_common.h
-@@ -32,6 +32,7 @@ enum EnumRd {
-       FCC2_WORLD = 0x21,
-       FCC2_ETSIC = 0x22,
-       FCC6_WORLD = 0x23,
-+      FCC3_FCCA_2 = 0x2A,
-       FRANCE_RES = 0x31,
-       FCC3_FCCA = 0x3A,
-       FCC3_WORLD = 0x3B,
-@@ -167,6 +168,7 @@ static struct reg_dmn_pair_mapping regDo
-       {FCC2_WORLD, CTL_FCC, CTL_ETSI},
-       {FCC2_ETSIC, CTL_FCC, CTL_ETSI},
-       {FCC3_FCCA, CTL_FCC, CTL_FCC},
-+      {FCC3_FCCA_2, CTL_FCC, CTL_FCC},
-       {FCC3_WORLD, CTL_FCC, CTL_ETSI},
-       {FCC4_FCCA, CTL_FCC, CTL_FCC},
-       {FCC5_FCCA, CTL_FCC, CTL_FCC},
-@@ -463,6 +465,7 @@ static struct country_code_to_enum_rd al
-       {CTRY_UAE, NULL1_WORLD, "AE"},
-       {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},
-       {CTRY_UNITED_STATES, FCC3_FCCA, "US"},
-+      {CTRY_UNITED_STATES, FCC3_FCCA_2, "US"},
-       /* This "PS" is for US public safety actually... to support this we
-        * would need to assign new special alpha2 to CRDA db as with the world
-        * regdomain and use another alpha2 */
index 67755c58af52a3bfc9c064dca2446edc7ab31973..ffd39b341fbffa8f90cb9f1daf22c3438568d087 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -670,6 +670,7 @@ static const struct ieee80211_iface_limi
+@@ -677,6 +677,7 @@ static const struct ieee80211_iface_limi
                                 BIT(NL80211_IFTYPE_AP) },
        { .max = 1,     .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
                                 BIT(NL80211_IFTYPE_P2P_GO) },
                                 BIT(NL80211_IFTYPE_AP) },
        { .max = 1,     .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
                                 BIT(NL80211_IFTYPE_P2P_GO) },
index 5e4d2a1ffe67bb88c0e77d92aa1f38607f7612bc..63e1b4523b40fca2cbbd50258166a678a22243d7 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -1318,6 +1318,53 @@ void ath9k_deinit_debug(struct ath_softc
+@@ -1313,6 +1313,53 @@ void ath9k_deinit_debug(struct ath_softc
        ath9k_spectral_deinit_debug(sc);
  }
  
        ath9k_spectral_deinit_debug(sc);
  }
  
@@ -54,7 +54,7 @@
  int ath9k_init_debug(struct ath_hw *ah)
  {
        struct ath_common *common = ath9k_hw_common(ah);
  int ath9k_init_debug(struct ath_hw *ah)
  {
        struct ath_common *common = ath9k_hw_common(ah);
-@@ -1337,6 +1384,8 @@ int ath9k_init_debug(struct ath_hw *ah)
+@@ -1332,6 +1379,8 @@ int ath9k_init_debug(struct ath_hw *ah)
        ath9k_tx99_init_debug(sc);
        ath9k_spectral_init_debug(sc);
  
        ath9k_tx99_init_debug(sc);
        ath9k_spectral_init_debug(sc);
  
diff --git a/package/kernel/mac80211/patches/501-ath9k-eeprom_endianess.patch b/package/kernel/mac80211/patches/501-ath9k-eeprom_endianess.patch
deleted file mode 100644 (file)
index abf3914..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
-@@ -262,7 +262,7 @@ static int ath9k_hw_def_check_eeprom(str
- {
-       struct ar5416_eeprom_def *eep = &ah->eeprom.def;
-       struct ath_common *common = ath9k_hw_common(ah);
--      u16 *eepdata, temp, magic, magic2;
-+      u16 *eepdata, temp, magic;
-       u32 sum = 0, el;
-       bool need_swap = false;
-       int i, addr, size;
-@@ -272,27 +272,16 @@ static int ath9k_hw_def_check_eeprom(str
-               return false;
-       }
--      if (!ath9k_hw_use_flash(ah)) {
--              ath_dbg(common, EEPROM, "Read Magic = 0x%04X\n", magic);
--
--              if (magic != AR5416_EEPROM_MAGIC) {
--                      magic2 = swab16(magic);
--
--                      if (magic2 == AR5416_EEPROM_MAGIC) {
--                              size = sizeof(struct ar5416_eeprom_def);
--                              need_swap = true;
--                              eepdata = (u16 *) (&ah->eeprom);
--
--                              for (addr = 0; addr < size / sizeof(u16); addr++) {
--                                      temp = swab16(*eepdata);
--                                      *eepdata = temp;
--                                      eepdata++;
--                              }
--                      } else {
--                              ath_err(common,
--                                      "Invalid EEPROM Magic. Endianness mismatch.\n");
--                              return -EINVAL;
--                      }
-+      if (swab16(magic) == AR5416_EEPROM_MAGIC &&
-+          !(ah->ah_flags & AH_NO_EEP_SWAP)) {
-+              size = sizeof(struct ar5416_eeprom_def);
-+              need_swap = true;
-+              eepdata = (u16 *) (&ah->eeprom);
-+
-+              for (addr = 0; addr < size / sizeof(u16); addr++) {
-+                      temp = swab16(*eepdata);
-+                      *eepdata = temp;
-+                      eepdata++;
-               }
-       }
---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
-@@ -57,7 +57,7 @@ static bool ath9k_hw_4k_fill_eeprom(stru
- {
-       struct ath_common *common = ath9k_hw_common(ah);
--      if (!ath9k_hw_use_flash(ah)) {
-+      if (!(ah->ah_flags & AH_NO_EEP_SWAP)) {
-               ath_dbg(common, EEPROM, "Reading from EEPROM, not flash\n");
-       }
---- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
-@@ -60,7 +60,7 @@ static bool ath9k_hw_ar9287_fill_eeprom(
- {
-       struct ath_common *common = ath9k_hw_common(ah);
--      if (!ath9k_hw_use_flash(ah)) {
-+      if (!(ah->ah_flags & AH_NO_EEP_SWAP)) {
-               ath_dbg(common, EEPROM, "Reading from EEPROM, not flash\n");
-       }
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -726,6 +726,7 @@ enum ath_cal_list {
- #define AH_USE_EEPROM   0x1
- #define AH_UNPLUGGED    0x2 /* The card has been physically removed. */
- #define AH_FASTCC       0x4
-+#define AH_NO_EEP_SWAP  0x8 /* Do not swap EEPROM data */
- struct ath_hw {
-       struct ath_ops reg_ops;
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -528,6 +528,8 @@ static int ath9k_init_softc(u16 devid, s
-               ah->is_clk_25mhz = pdata->is_clk_25mhz;
-               ah->get_mac_revision = pdata->get_mac_revision;
-               ah->external_reset = pdata->external_reset;
-+              if (!pdata->endian_check)
-+                      ah->ah_flags |= AH_NO_EEP_SWAP;
-       }
-       common->ops = &ah->reg_ops;
---- a/include/linux/ath9k_platform.h
-+++ b/include/linux/ath9k_platform.h
-@@ -31,6 +31,7 @@ struct ath9k_platform_data {
-       u32 gpio_mask;
-       u32 gpio_val;
-+      bool endian_check;
-       bool is_clk_25mhz;
-       bool tx_gain_buffalo;
diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
new file mode 100644 (file)
index 0000000..c59e8c9
--- /dev/null
@@ -0,0 +1,32 @@
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -981,23 +981,23 @@ static int __init ath9k_init(void)
+ {
+       int error;
+-      error = ath_pci_init();
++      error = ath_ahb_init();
+       if (error < 0) {
+-              pr_err("No PCI devices found, driver not installed\n");
+               error = -ENODEV;
+               goto err_out;
+       }
+-      error = ath_ahb_init();
++      error = ath_pci_init();
+       if (error < 0) {
++              pr_err("No PCI devices found, driver not installed\n");
+               error = -ENODEV;
+-              goto err_pci_exit;
++              goto err_ahb_exit;
+       }
+       return 0;
+- err_pci_exit:
+-      ath_pci_exit();
++ err_ahb_exit:
++      ath_ahb_exit();
+  err_out:
+       return error;
+ }
diff --git a/package/kernel/mac80211/patches/502-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/502-ath9k_ahb_init.patch
deleted file mode 100644 (file)
index a04abe4..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -976,23 +976,23 @@ static int __init ath9k_init(void)
- {
-       int error;
--      error = ath_pci_init();
-+      error = ath_ahb_init();
-       if (error < 0) {
--              pr_err("No PCI devices found, driver not installed\n");
-               error = -ENODEV;
-               goto err_out;
-       }
--      error = ath_ahb_init();
-+      error = ath_pci_init();
-       if (error < 0) {
-+              pr_err("No PCI devices found, driver not installed\n");
-               error = -ENODEV;
--              goto err_pci_exit;
-+              goto err_ahb_exit;
-       }
-       return 0;
-- err_pci_exit:
--      ath_pci_exit();
-+ err_ahb_exit:
-+      ath_ahb_exit();
-  err_out:
-       return error;
- }
index 04a6e8e8acd0425963b565bc32c2bae2c5a7d8fd..24671ca12ed3c28554cb9498aa0f41243a796139 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -1365,6 +1365,52 @@ static const struct file_operations fops
+@@ -1360,6 +1360,52 @@ static const struct file_operations fops
        .owner = THIS_MODULE
  };
  
        .owner = THIS_MODULE
  };
  
@@ -53,7 +53,7 @@
  int ath9k_init_debug(struct ath_hw *ah)
  {
        struct ath_common *common = ath9k_hw_common(ah);
  int ath9k_init_debug(struct ath_hw *ah)
  {
        struct ath_common *common = ath9k_hw_common(ah);
-@@ -1386,6 +1432,8 @@ int ath9k_init_debug(struct ath_hw *ah)
+@@ -1381,6 +1427,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  
        debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
                            &fops_eeprom);
  
        debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
                            &fops_eeprom);
index f1e856f4b318eec984a9a7ebf3846914d4c89761..09c16dd5bb9461356cc9ac7fc07b68df5a5f61fc 100644 (file)
@@ -20,9 +20,9 @@
  #define AR9160_DEVID_PCI      0x0027
 --- a/drivers/net/wireless/ath/ath9k/pci.c
 +++ b/drivers/net/wireless/ath/ath9k/pci.c
  #define AR9160_DEVID_PCI      0x0027
 --- a/drivers/net/wireless/ath/ath9k/pci.c
 +++ b/drivers/net/wireless/ath/ath9k/pci.c
-@@ -658,6 +658,7 @@ static const struct pci_device_id ath_pc
-       { PCI_VDEVICE(ATHEROS, 0x0036),
+@@ -664,6 +664,7 @@ static const struct pci_device_id ath_pc
          .driver_data = ATH9K_PCI_BT_ANT_DIV },
          .driver_data = ATH9K_PCI_BT_ANT_DIV },
+ #endif
  
 +      { PCI_VDEVICE(ATHEROS, 0xabcd) }, /* PCI-E  internal chip default ID */
        { 0 }
  
 +      { PCI_VDEVICE(ATHEROS, 0xabcd) }, /* PCI-E  internal chip default ID */
        { 0 }
index 9c16d59987f139961094b951037e3c0dd964c413..2ec64ac5e2c7c0d22440fc39ba5409f417b1391e 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -323,8 +323,12 @@ int ath_reset_internal(struct ath_softc 
+@@ -326,8 +326,12 @@ static int ath_reset_internal(struct ath
            sc->cur_chan->offchannel)
                ath9k_mci_set_txpower(sc, true, false);
  
            sc->cur_chan->offchannel)
                ath9k_mci_set_txpower(sc, true, false);
  
@@ -14,7 +14,7 @@
  
  out:
        spin_unlock_bh(&sc->sc_pcu_lock);
  
  out:
        spin_unlock_bh(&sc->sc_pcu_lock);
-@@ -1453,6 +1457,7 @@ static int ath9k_config(struct ieee80211
+@@ -1470,6 +1474,7 @@ static int ath9k_config(struct ieee80211
                sc->cur_chan->txpower = 2 * conf->power_level;
                ath9k_cmn_update_txpow(ah, sc->curtxpow,
                                       sc->cur_chan->txpower, &sc->curtxpow);
                sc->cur_chan->txpower = 2 * conf->power_level;
                ath9k_cmn_update_txpow(ah, sc->curtxpow,
                                       sc->cur_chan->txpower, &sc->curtxpow);
index 21d19e80d88f734a7195b1f7ac5ebbe83d0c746f..c8e23d524320bb3b8b85e176fe45615dcb54396b 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -799,6 +799,9 @@ static inline int ath9k_dump_btcoex(stru
+@@ -811,6 +811,9 @@ static inline int ath9k_dump_btcoex(stru
  void ath_init_leds(struct ath_softc *sc);
  void ath_deinit_leds(struct ath_softc *sc);
  void ath_fill_led_pin(struct ath_softc *sc);
  void ath_init_leds(struct ath_softc *sc);
  void ath_deinit_leds(struct ath_softc *sc);
  void ath_fill_led_pin(struct ath_softc *sc);
@@ -10,7 +10,7 @@
  #else
  static inline void ath_init_leds(struct ath_softc *sc)
  {
  #else
  static inline void ath_init_leds(struct ath_softc *sc)
  {
-@@ -939,6 +942,13 @@ void ath_ant_comb_scan(struct ath_softc 
+@@ -951,6 +954,13 @@ void ath_ant_comb_scan(struct ath_softc 
  
  #define ATH9K_NUM_CHANCTX  2 /* supports 2 operating channels */
  
  
  #define ATH9K_NUM_CHANCTX  2 /* supports 2 operating channels */
  
@@ -24,7 +24,7 @@
  struct ath_softc {
        struct ieee80211_hw *hw;
        struct device *dev;
  struct ath_softc {
        struct ieee80211_hw *hw;
        struct device *dev;
-@@ -990,9 +1000,8 @@ struct ath_softc {
+@@ -1003,9 +1013,8 @@ struct ath_softc {
        spinlock_t chan_lock;
  
  #ifdef CPTCFG_MAC80211_LEDS
        spinlock_t chan_lock;
  
  #ifdef CPTCFG_MAC80211_LEDS
  void ath_fill_led_pin(struct ath_softc *sc)
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
  void ath_fill_led_pin(struct ath_softc *sc)
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -889,7 +889,7 @@ int ath9k_init_device(u16 devid, struct 
+@@ -894,7 +894,7 @@ int ath9k_init_device(u16 devid, struct 
  
  #ifdef CPTCFG_MAC80211_LEDS
        /* must be initialized before ieee80211_register_hw */
  
  #ifdef CPTCFG_MAC80211_LEDS
        /* must be initialized before ieee80211_register_hw */
  #endif
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
  #endif
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -1410,6 +1410,61 @@ static const struct file_operations fops
+@@ -1405,6 +1405,61 @@ static const struct file_operations fops
        .llseek = default_llseek,
  };
  
        .llseek = default_llseek,
  };
  
  
  int ath9k_init_debug(struct ath_hw *ah)
  {
  
  int ath9k_init_debug(struct ath_hw *ah)
  {
-@@ -1434,6 +1489,10 @@ int ath9k_init_debug(struct ath_hw *ah)
+@@ -1429,6 +1484,10 @@ int ath9k_init_debug(struct ath_hw *ah)
                            &fops_eeprom);
        debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
                            sc, &fops_chanbw);
                            &fops_eeprom);
        debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
                            sc, &fops_chanbw);
index 718a3d0cd4a63225d5fa29e1dedaade01a2ddeb6..dc33cd029b5356623781aa7aeaa38aceb742d811 100644 (file)
@@ -1,6 +1,6 @@
 --- a/include/linux/ath9k_platform.h
 +++ b/include/linux/ath9k_platform.h
 --- a/include/linux/ath9k_platform.h
 +++ b/include/linux/ath9k_platform.h
-@@ -39,6 +39,9 @@ struct ath9k_platform_data {
+@@ -41,6 +41,9 @@ struct ath9k_platform_data {
        int (*external_reset)(void);
  
        bool use_eeprom;
        int (*external_reset)(void);
  
        bool use_eeprom;
index 62f5e8c73289ae0857df3b6d870e730be8734859..5b6aee632daf5e4145cb13b9bb6ea78fa2b910a7 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -1466,6 +1466,50 @@ static const struct file_operations fops
+@@ -1461,6 +1461,50 @@ static const struct file_operations fops
  #endif
  
  
  #endif
  
  
@@ -51,7 +51,7 @@
  int ath9k_init_debug(struct ath_hw *ah)
  {
        struct ath_common *common = ath9k_hw_common(ah);
  int ath9k_init_debug(struct ath_hw *ah)
  {
        struct ath_common *common = ath9k_hw_common(ah);
-@@ -1493,6 +1537,8 @@ int ath9k_init_debug(struct ath_hw *ah)
+@@ -1488,6 +1532,8 @@ int ath9k_init_debug(struct ath_hw *ah)
        debugfs_create_file("gpio_led", S_IWUSR,
                           sc->debug.debugfs_phy, sc, &fops_gpio_led);
  #endif
        debugfs_create_file("gpio_led", S_IWUSR,
                           sc->debug.debugfs_phy, sc, &fops_gpio_led);
  #endif
@@ -62,7 +62,7 @@
        debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
 --- a/drivers/net/wireless/ath/ath9k/hw.h
 +++ b/drivers/net/wireless/ath/ath9k/hw.h
        debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
 --- a/drivers/net/wireless/ath/ath9k/hw.h
 +++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -483,6 +483,12 @@ enum {
+@@ -490,6 +490,12 @@ enum {
        ATH9K_RESET_COLD,
  };
  
        ATH9K_RESET_COLD,
  };
  
@@ -75,7 +75,7 @@
  struct ath9k_hw_version {
        u32 magic;
        u16 devid;
  struct ath9k_hw_version {
        u32 magic;
        u16 devid;
-@@ -764,6 +770,8 @@ struct ath_hw {
+@@ -769,6 +775,8 @@ struct ath_hw {
        u32 rfkill_polarity;
        u32 ah_flags;
  
        u32 rfkill_polarity;
        u32 ah_flags;
  
@@ -84,7 +84,7 @@
        bool reset_power_on;
        bool htc_reset_init;
  
        bool reset_power_on;
        bool htc_reset_init;
  
-@@ -1018,6 +1026,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
+@@ -1025,6 +1033,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  bool ath9k_hw_check_alive(struct ath_hw *ah);
  
  bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  bool ath9k_hw_check_alive(struct ath_hw *ah);
  
  bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
                   struct ath9k_hw_cal_data *caldata, bool fastcc)
  {
  int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
                   struct ath9k_hw_cal_data *caldata, bool fastcc)
  {
-@@ -1968,6 +1982,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -1970,6 +1984,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
                ar9003_hw_disable_phy_restart(ah);
  
        ath9k_hw_apply_gpio_override(ah);
                ar9003_hw_disable_phy_restart(ah);
  
        ath9k_hw_apply_gpio_override(ah);
                REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON);
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
                REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON);
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -531,6 +531,11 @@ irqreturn_t ath_isr(int irq, void *dev)
+@@ -535,6 +535,11 @@ irqreturn_t ath_isr(int irq, void *dev)
        ath9k_debug_sync_cause(sc, sync_cause);
        status &= ah->imask;    /* discard unasked-for bits */
  
        ath9k_debug_sync_cause(sc, sync_cause);
        status &= ah->imask;    /* discard unasked-for bits */
  
diff --git a/package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch b/package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch
deleted file mode 100644 (file)
index e8cd5e6..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
---- a/include/linux/ath9k_platform.h
-+++ b/include/linux/ath9k_platform.h
-@@ -34,6 +34,8 @@ struct ath9k_platform_data {
-       bool endian_check;
-       bool is_clk_25mhz;
-       bool tx_gain_buffalo;
-+      bool disable_2ghz;
-+      bool disable_5ghz;
-       int (*get_mac_revision)(void);
-       int (*external_reset)(void);
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -2362,17 +2362,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
-       }
-       eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
--      if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) {
--              ath_err(common,
--                      "no band has been marked as supported in EEPROM\n");
--              return -EINVAL;
-+
-+      if (eeval & AR5416_OPFLAGS_11A) {
-+              if (ah->disable_5ghz)
-+                      ath_warn(common, "disabling 5GHz band\n");
-+              else
-+                      pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
-       }
--      if (eeval & AR5416_OPFLAGS_11A)
--              pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
-+      if (eeval & AR5416_OPFLAGS_11G) {
-+              if (ah->disable_2ghz)
-+                      ath_warn(common, "disabling 2GHz band\n");
-+              else
-+                      pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
-+      }
--      if (eeval & AR5416_OPFLAGS_11G)
--              pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
-+      if ((pCap->hw_caps & (ATH9K_HW_CAP_2GHZ | ATH9K_HW_CAP_5GHZ)) == 0) {
-+              ath_err(common, "both bands are disabled\n");
-+              return -EINVAL;
-+      }
-       if (AR_SREV_9485(ah) ||
-           AR_SREV_9285(ah) ||
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -934,6 +934,8 @@ struct ath_hw {
-       bool is_clk_25mhz;
-       int (*get_mac_revision)(void);
-       int (*external_reset)(void);
-+      bool disable_2ghz;
-+      bool disable_5ghz;
-       const struct firmware *eeprom_blob;
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -528,6 +528,8 @@ static int ath9k_init_softc(u16 devid, s
-               ah->is_clk_25mhz = pdata->is_clk_25mhz;
-               ah->get_mac_revision = pdata->get_mac_revision;
-               ah->external_reset = pdata->external_reset;
-+              ah->disable_2ghz = pdata->disable_2ghz;
-+              ah->disable_5ghz = pdata->disable_5ghz;
-               if (!pdata->endian_check)
-                       ah->ah_flags |= AH_NO_EEP_SWAP;
-       }
diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
new file mode 100644 (file)
index 0000000..53d56a9
--- /dev/null
@@ -0,0 +1,186 @@
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -686,6 +686,7 @@ struct ath_spec_scan {
+  * @config_pci_powersave:
+  * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
+  *
++ * @get_adc_entropy: get entropy from the raw ADC I/Q output
+  * @spectral_scan_config: set parameters for spectral scan and enable/disable it
+  * @spectral_scan_trigger: trigger a spectral scan run
+  * @spectral_scan_wait: wait for a spectral scan run to finish
+@@ -708,6 +709,7 @@ struct ath_hw_ops {
+                       struct ath_hw_antcomb_conf *antconf);
+       void (*antdiv_comb_conf_set)(struct ath_hw *ah,
+                       struct ath_hw_antcomb_conf *antconf);
++      void (*get_adc_entropy)(struct ath_hw *ah, u8 *buf, size_t len);
+       void (*spectral_scan_config)(struct ath_hw *ah,
+                                    struct ath_spec_scan *param);
+       void (*spectral_scan_trigger)(struct ath_hw *ah);
+--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+@@ -1783,6 +1783,26 @@ static void ar9003_hw_tx99_set_txpower(s
+                 ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_14],  0));
+ }
++static void ar9003_hw_get_adc_entropy(struct ath_hw *ah, u8 *buf, size_t len)
++{
++      int i, j;
++
++      REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1);
++      REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5);
++      REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, AR_PHY_TEST_CTL_RX_OBS_SEL, 0);
++
++      memset(buf, 0, len);
++      for (i = 0; i < len; i++) {
++              for (j = 0; j < 4; j++) {
++                      u32 regval = REG_READ(ah, AR_PHY_TST_ADC);
++
++                      buf[i] <<= 2;
++                      buf[i] |= (regval & 1) | ((regval & BIT(10)) >> 9);
++                      udelay(1);
++              }
++      }
++}
++
+ void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
+ {
+       struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
+@@ -1818,6 +1838,7 @@ void ar9003_hw_attach_phy_ops(struct ath
+       priv_ops->set_radar_params = ar9003_hw_set_radar_params;
+       priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
++      ops->get_adc_entropy = ar9003_hw_get_adc_entropy;
+       ops->antdiv_comb_conf_get = ar9003_hw_antdiv_comb_conf_get;
+       ops->antdiv_comb_conf_set = ar9003_hw_antdiv_comb_conf_set;
+       ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -665,7 +665,8 @@ static void ath9k_init_txpower_limits(st
+       if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
+               ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
+-      ah->curchan = curchan;
++      if (curchan)
++              ah->curchan = curchan;
+ }
+ static const struct ieee80211_iface_limit if_limits[] = {
+@@ -851,6 +852,18 @@ static void ath9k_set_hw_capab(struct at
+       SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
+ }
++static void ath_get_initial_entropy(struct ath_softc *sc)
++{
++      struct ath_hw *ah = sc->sc_ah;
++      char buf[256];
++
++      /* reuse last channel initialized by the tx power test */
++      ath9k_hw_reset(ah, ah->curchan, NULL, false);
++
++      ath9k_hw_get_adc_entropy(ah, buf, sizeof(buf));
++      add_device_randomness(buf, sizeof(buf));
++}
++
+ int ath9k_init_device(u16 devid, struct ath_softc *sc,
+                   const struct ath_bus_ops *bus_ops)
+ {
+@@ -899,6 +912,8 @@ int ath9k_init_device(u16 devid, struct 
+               ARRAY_SIZE(ath9k_tpt_blink));
+ #endif
++      ath_get_initial_entropy(sc);
++
+       /* Register with mac80211 */
+       error = ieee80211_register_hw(hw);
+       if (error)
+--- a/drivers/net/wireless/ath/ath9k/hw-ops.h
++++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
+@@ -100,6 +100,12 @@ static inline void ath9k_hw_tx99_set_txp
+               ath9k_hw_ops(ah)->tx99_set_txpower(ah, power);
+ }
++static inline void ath9k_hw_get_adc_entropy(struct ath_hw *ah,
++              u8 *buf, size_t len)
++{
++      ath9k_hw_ops(ah)->get_adc_entropy(ah, buf, len);
++}
++
+ #ifdef CPTCFG_ATH9K_BTCOEX_SUPPORT
+ static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
+--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
++++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+@@ -1232,9 +1232,30 @@ static void ar5008_hw_set_radar_conf(str
+       conf->radar_inband = 8;
+ }
++static void ar5008_hw_get_adc_entropy(struct ath_hw *ah, u8 *buf, size_t len)
++{
++      int i, j;
++
++      REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1);
++      REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5);
++      REG_RMW_FIELD(ah, AR_PHY_TEST2, AR_PHY_TEST2_RX_OBS_SEL, 0);
++
++      memset(buf, 0, len);
++      for (i = 0; i < len; i++) {
++              for (j = 0; j < 4; j++) {
++                      u32 regval = REG_READ(ah, AR_PHY_TST_ADC);
++
++                      buf[i] <<= 2;
++                      buf[i] |= (regval & 1) | ((regval & BIT(9)) >> 8);
++                      udelay(1);
++              }
++      }
++}
++
+ int ar5008_hw_attach_phy_ops(struct ath_hw *ah)
+ {
+       struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
++      struct ath_hw_ops *ops = ath9k_hw_ops(ah);
+       static const u32 ar5416_cca_regs[6] = {
+               AR_PHY_CCA,
+               AR_PHY_CH1_CCA,
+@@ -1249,6 +1270,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
+       if (ret)
+           return ret;
++      ops->get_adc_entropy = ar5008_hw_get_adc_entropy;
++
+       priv_ops->rf_set_freq = ar5008_hw_set_channel;
+       priv_ops->spur_mitigate_freq = ar5008_hw_spur_mitigate;
+--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
+@@ -20,6 +20,12 @@
+ #define PHY_AGC_CLR             0x10000000
+ #define RFSILENT_BB             0x00002000
++#define AR_PHY_TEST_BBB_OBS_SEL       0x780000
++#define AR_PHY_TEST_BBB_OBS_SEL_S     19
++
++#define AR_PHY_TEST_RX_OBS_SEL_BIT5_S 23
++#define AR_PHY_TEST_RX_OBS_SEL_BIT5   (1 << AR_PHY_TEST_RX_OBS_SEL_BIT5_S)
++
+ #define AR_PHY_TURBO                0x9804
+ #define AR_PHY_FC_TURBO_MODE        0x00000001
+ #define AR_PHY_FC_TURBO_SHORT       0x00000002
+@@ -36,6 +42,9 @@
+ #define AR_PHY_TEST2                  0x9808
++#define AR_PHY_TEST2_RX_OBS_SEL        0x3C00
++#define AR_PHY_TEST2_RX_OBS_SEL_S      10
++
+ #define AR_PHY_TIMING2           0x9810
+ #define AR_PHY_TIMING3           0x9814
+ #define AR_PHY_TIMING3_DSC_MAN   0xFFFE0000
+@@ -390,6 +399,8 @@
+ #define AR_PHY_RFBUS_GRANT       0x9C20
+ #define AR_PHY_RFBUS_GRANT_EN    0x00000001
++#define AR_PHY_TST_ADC      0x9C24
++
+ #define AR_PHY_CHAN_INFO_GAIN_DIFF             0x9CF4
+ #define AR_PHY_CHAN_INFO_GAIN_DIFF_UPPER_LIMIT 320
diff --git a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
new file mode 100644 (file)
index 0000000..b6e7b73
--- /dev/null
@@ -0,0 +1,79 @@
+--- a/drivers/net/wireless/ath/ath9k/hw.c
++++ b/drivers/net/wireless/ath/ath9k/hw.c
+@@ -215,6 +215,19 @@ void ath9k_hw_get_channel_centers(struct
+               centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT);
+ }
++static inline void ath9k_hw_disable_pll_lock_detect(struct ath_hw *ah)
++{
++      /* On AR9330 and AR9340 devices, some PHY registers must be
++       * tuned to gain better stability/performance. These registers
++       * might be changed while doing wlan reset so the registers must
++       * be reprogrammed after each reset.
++       */
++      REG_CLR_BIT(ah, AR_PHY_USB_CTRL1, BIT(20));
++      REG_RMW(ah, AR_PHY_USB_CTRL2,
++              (1 << 21) | (0xf << 22),
++              (1 << 21) | (0x3 << 22));
++}
++
+ /******************/
+ /* Chip Revisions */
+ /******************/
+@@ -1351,6 +1364,9 @@ static bool ath9k_hw_set_reset(struct at
+       if (AR_SREV_9100(ah))
+               udelay(50);
++      if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
++              ath9k_hw_disable_pll_lock_detect(ah);
++
+       return true;
+ }
+@@ -1450,6 +1466,9 @@ static bool ath9k_hw_chip_reset(struct a
+               ar9003_hw_internal_regulator_apply(ah);
+       ath9k_hw_init_pll(ah, chan);
++      if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
++              ath9k_hw_disable_pll_lock_detect(ah);
++
+       return true;
+ }
+@@ -1744,8 +1763,14 @@ static int ath9k_hw_do_fastcc(struct ath
+       if (AR_SREV_9271(ah))
+               ar9002_hw_load_ani_reg(ah, chan);
++      if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
++              ath9k_hw_disable_pll_lock_detect(ah);
++
+       return 0;
+ fail:
++      if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
++              ath9k_hw_disable_pll_lock_detect(ah);
++
+       return -EINVAL;
+ }
+@@ -1995,6 +2020,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+               ath9k_hw_set_radar_params(ah);
+       }
++      if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
++              ath9k_hw_disable_pll_lock_detect(ah);
++
+       return 0;
+ }
+ EXPORT_SYMBOL(ath9k_hw_reset);
+--- a/drivers/net/wireless/ath/ath9k/phy.h
++++ b/drivers/net/wireless/ath/ath9k/phy.h
+@@ -48,6 +48,9 @@
+ #define AR_PHY_PLL_CONTROL 0x16180
+ #define AR_PHY_PLL_MODE 0x16184
++#define AR_PHY_USB_CTRL1      0x16c84
++#define AR_PHY_USB_CTRL2      0x16c88
++
+ enum ath9k_ant_div_comb_lna_conf {
+       ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2,
+       ATH_ANT_DIV_COMB_LNA2,
diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
new file mode 100644 (file)
index 0000000..d18a1ff
--- /dev/null
@@ -0,0 +1,155 @@
+--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
++++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+@@ -929,55 +929,6 @@ static bool ar5008_hw_ani_control_new(st
+                * on == 0 means more noise imm
+                */
+               u32 on = param ? 1 : 0;
+-              /*
+-               * make register setting for default
+-               * (weak sig detect ON) come from INI file
+-               */
+-              int m1ThreshLow = on ?
+-                      aniState->iniDef.m1ThreshLow : m1ThreshLow_off;
+-              int m2ThreshLow = on ?
+-                      aniState->iniDef.m2ThreshLow : m2ThreshLow_off;
+-              int m1Thresh = on ?
+-                      aniState->iniDef.m1Thresh : m1Thresh_off;
+-              int m2Thresh = on ?
+-                      aniState->iniDef.m2Thresh : m2Thresh_off;
+-              int m2CountThr = on ?
+-                      aniState->iniDef.m2CountThr : m2CountThr_off;
+-              int m2CountThrLow = on ?
+-                      aniState->iniDef.m2CountThrLow : m2CountThrLow_off;
+-              int m1ThreshLowExt = on ?
+-                      aniState->iniDef.m1ThreshLowExt : m1ThreshLowExt_off;
+-              int m2ThreshLowExt = on ?
+-                      aniState->iniDef.m2ThreshLowExt : m2ThreshLowExt_off;
+-              int m1ThreshExt = on ?
+-                      aniState->iniDef.m1ThreshExt : m1ThreshExt_off;
+-              int m2ThreshExt = on ?
+-                      aniState->iniDef.m2ThreshExt : m2ThreshExt_off;
+-
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
+-                            AR_PHY_SFCORR_LOW_M1_THRESH_LOW,
+-                            m1ThreshLow);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
+-                            AR_PHY_SFCORR_LOW_M2_THRESH_LOW,
+-                            m2ThreshLow);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
+-                            AR_PHY_SFCORR_M1_THRESH, m1Thresh);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
+-                            AR_PHY_SFCORR_M2_THRESH, m2Thresh);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
+-                            AR_PHY_SFCORR_M2COUNT_THR, m2CountThr);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
+-                            AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW,
+-                            m2CountThrLow);
+-
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
+-                            AR_PHY_SFCORR_EXT_M1_THRESH_LOW, m1ThreshLowExt);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
+-                            AR_PHY_SFCORR_EXT_M2_THRESH_LOW, m2ThreshLowExt);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
+-                            AR_PHY_SFCORR_EXT_M1_THRESH, m1ThreshExt);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
+-                            AR_PHY_SFCORR_EXT_M2_THRESH, m2ThreshExt);
+               if (on)
+                       REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
+--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+@@ -26,20 +26,6 @@ static const int cycpwrThr1_table[] =
+ /* level:  0   1   2   3   4   5   6   7   8  */
+       { -6, -4, -2,  0,  2,  4,  6,  8 };     /* lvl 0-7, default 3 */
+-/*
+- * register values to turn OFDM weak signal detection OFF
+- */
+-static const int m1ThreshLow_off = 127;
+-static const int m2ThreshLow_off = 127;
+-static const int m1Thresh_off = 127;
+-static const int m2Thresh_off = 127;
+-static const int m2CountThr_off =  31;
+-static const int m2CountThrLow_off =  63;
+-static const int m1ThreshLowExt_off = 127;
+-static const int m2ThreshLowExt_off = 127;
+-static const int m1ThreshExt_off = 127;
+-static const int m2ThreshExt_off = 127;
+-
+ /**
+  * ar9003_hw_set_channel - set channel on single-chip device
+  * @ah: atheros hardware structure
+@@ -971,11 +957,6 @@ static bool ar9003_hw_ani_control(struct
+       struct ath_common *common = ath9k_hw_common(ah);
+       struct ath9k_channel *chan = ah->curchan;
+       struct ar5416AniState *aniState = &ah->ani;
+-      int m1ThreshLow, m2ThreshLow;
+-      int m1Thresh, m2Thresh;
+-      int m2CountThr, m2CountThrLow;
+-      int m1ThreshLowExt, m2ThreshLowExt;
+-      int m1ThreshExt, m2ThreshExt;
+       s32 value, value2;
+       switch (cmd & ah->ani_function) {
+@@ -989,61 +970,6 @@ static bool ar9003_hw_ani_control(struct
+                */
+               u32 on = param ? 1 : 0;
+-              if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
+-                      goto skip_ws_det;
+-
+-              m1ThreshLow = on ?
+-                      aniState->iniDef.m1ThreshLow : m1ThreshLow_off;
+-              m2ThreshLow = on ?
+-                      aniState->iniDef.m2ThreshLow : m2ThreshLow_off;
+-              m1Thresh = on ?
+-                      aniState->iniDef.m1Thresh : m1Thresh_off;
+-              m2Thresh = on ?
+-                      aniState->iniDef.m2Thresh : m2Thresh_off;
+-              m2CountThr = on ?
+-                      aniState->iniDef.m2CountThr : m2CountThr_off;
+-              m2CountThrLow = on ?
+-                      aniState->iniDef.m2CountThrLow : m2CountThrLow_off;
+-              m1ThreshLowExt = on ?
+-                      aniState->iniDef.m1ThreshLowExt : m1ThreshLowExt_off;
+-              m2ThreshLowExt = on ?
+-                      aniState->iniDef.m2ThreshLowExt : m2ThreshLowExt_off;
+-              m1ThreshExt = on ?
+-                      aniState->iniDef.m1ThreshExt : m1ThreshExt_off;
+-              m2ThreshExt = on ?
+-                      aniState->iniDef.m2ThreshExt : m2ThreshExt_off;
+-
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
+-                            AR_PHY_SFCORR_LOW_M1_THRESH_LOW,
+-                            m1ThreshLow);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
+-                            AR_PHY_SFCORR_LOW_M2_THRESH_LOW,
+-                            m2ThreshLow);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
+-                            AR_PHY_SFCORR_M1_THRESH,
+-                            m1Thresh);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
+-                            AR_PHY_SFCORR_M2_THRESH,
+-                            m2Thresh);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
+-                            AR_PHY_SFCORR_M2COUNT_THR,
+-                            m2CountThr);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
+-                            AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW,
+-                            m2CountThrLow);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
+-                            AR_PHY_SFCORR_EXT_M1_THRESH_LOW,
+-                            m1ThreshLowExt);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
+-                            AR_PHY_SFCORR_EXT_M2_THRESH_LOW,
+-                            m2ThreshLowExt);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
+-                            AR_PHY_SFCORR_EXT_M1_THRESH,
+-                            m1ThreshExt);
+-              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
+-                            AR_PHY_SFCORR_EXT_M2_THRESH,
+-                            m2ThreshExt);
+-skip_ws_det:
+               if (on)
+                       REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
+                                   AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
diff --git a/package/kernel/mac80211/patches/550-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/550-ath9k_entropy_from_adc.patch
deleted file mode 100644 (file)
index 6ca9eaa..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -679,6 +679,7 @@ struct ath_spec_scan {
-  * @config_pci_powersave:
-  * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
-  *
-+ * @get_adc_entropy: get entropy from the raw ADC I/Q output
-  * @spectral_scan_config: set parameters for spectral scan and enable/disable it
-  * @spectral_scan_trigger: trigger a spectral scan run
-  * @spectral_scan_wait: wait for a spectral scan run to finish
-@@ -703,6 +704,7 @@ struct ath_hw_ops {
-                       struct ath_hw_antcomb_conf *antconf);
-       void (*antdiv_comb_conf_set)(struct ath_hw *ah,
-                       struct ath_hw_antcomb_conf *antconf);
-+      void (*get_adc_entropy)(struct ath_hw *ah, u8 *buf, size_t len);
-       void (*spectral_scan_config)(struct ath_hw *ah,
-                                    struct ath_spec_scan *param);
-       void (*spectral_scan_trigger)(struct ath_hw *ah);
---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-@@ -1783,6 +1783,26 @@ static void ar9003_hw_tx99_set_txpower(s
-                 ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_14],  0));
- }
-+static void ar9003_hw_get_adc_entropy(struct ath_hw *ah, u8 *buf, size_t len)
-+{
-+      int i, j;
-+
-+      REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1);
-+      REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5);
-+      REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, AR_PHY_TEST_CTL_RX_OBS_SEL, 0);
-+
-+      memset(buf, 0, len);
-+      for (i = 0; i < len; i++) {
-+              for (j = 0; j < 4; j++) {
-+                      u32 regval = REG_READ(ah, AR_PHY_TST_ADC);
-+
-+                      buf[i] <<= 2;
-+                      buf[i] |= (regval & 1) | ((regval & BIT(10)) >> 9);
-+                      udelay(1);
-+              }
-+      }
-+}
-+
- void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
- {
-       struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
-@@ -1818,6 +1838,7 @@ void ar9003_hw_attach_phy_ops(struct ath
-       priv_ops->set_radar_params = ar9003_hw_set_radar_params;
-       priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
-+      ops->get_adc_entropy = ar9003_hw_get_adc_entropy;
-       ops->antdiv_comb_conf_get = ar9003_hw_antdiv_comb_conf_get;
-       ops->antdiv_comb_conf_set = ar9003_hw_antdiv_comb_conf_set;
-       ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -662,7 +662,8 @@ static void ath9k_init_txpower_limits(st
-       if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
-               ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
--      ah->curchan = curchan;
-+      if (curchan)
-+              ah->curchan = curchan;
- }
- static const struct ieee80211_iface_limit if_limits[] = {
-@@ -848,6 +849,18 @@ static void ath9k_set_hw_capab(struct at
-       SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
- }
-+static void ath_get_initial_entropy(struct ath_softc *sc)
-+{
-+      struct ath_hw *ah = sc->sc_ah;
-+      char buf[256];
-+
-+      /* reuse last channel initialized by the tx power test */
-+      ath9k_hw_reset(ah, ah->curchan, NULL, false);
-+
-+      ath9k_hw_get_adc_entropy(ah, buf, sizeof(buf));
-+      add_device_randomness(buf, sizeof(buf));
-+}
-+
- int ath9k_init_device(u16 devid, struct ath_softc *sc,
-                   const struct ath_bus_ops *bus_ops)
- {
-@@ -896,6 +909,8 @@ int ath9k_init_device(u16 devid, struct 
-               ARRAY_SIZE(ath9k_tpt_blink));
- #endif
-+      ath_get_initial_entropy(sc);
-+
-       /* Register with mac80211 */
-       error = ieee80211_register_hw(hw);
-       if (error)
---- a/drivers/net/wireless/ath/ath9k/hw-ops.h
-+++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
-@@ -101,6 +101,12 @@ static inline void ath9k_hw_tx99_set_txp
-               ath9k_hw_ops(ah)->tx99_set_txpower(ah, power);
- }
-+static inline void ath9k_hw_get_adc_entropy(struct ath_hw *ah,
-+              u8 *buf, size_t len)
-+{
-+      ath9k_hw_ops(ah)->get_adc_entropy(ah, buf, len);
-+}
-+
- #ifdef CPTCFG_ATH9K_BTCOEX_SUPPORT
- static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
-@@ -1232,9 +1232,30 @@ static void ar5008_hw_set_radar_conf(str
-       conf->radar_inband = 8;
- }
-+static void ar5008_hw_get_adc_entropy(struct ath_hw *ah, u8 *buf, size_t len)
-+{
-+      int i, j;
-+
-+      REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1);
-+      REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5);
-+      REG_RMW_FIELD(ah, AR_PHY_TEST2, AR_PHY_TEST2_RX_OBS_SEL, 0);
-+
-+      memset(buf, 0, len);
-+      for (i = 0; i < len; i++) {
-+              for (j = 0; j < 4; j++) {
-+                      u32 regval = REG_READ(ah, AR_PHY_TST_ADC);
-+
-+                      buf[i] <<= 2;
-+                      buf[i] |= (regval & 1) | ((regval & BIT(9)) >> 8);
-+                      udelay(1);
-+              }
-+      }
-+}
-+
- int ar5008_hw_attach_phy_ops(struct ath_hw *ah)
- {
-       struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
-+      struct ath_hw_ops *ops = ath9k_hw_ops(ah);
-       static const u32 ar5416_cca_regs[6] = {
-               AR_PHY_CCA,
-               AR_PHY_CH1_CCA,
-@@ -1249,6 +1270,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
-       if (ret)
-           return ret;
-+      ops->get_adc_entropy = ar5008_hw_get_adc_entropy;
-+
-       priv_ops->rf_set_freq = ar5008_hw_set_channel;
-       priv_ops->spur_mitigate_freq = ar5008_hw_spur_mitigate;
---- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
-+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
-@@ -20,6 +20,12 @@
- #define PHY_AGC_CLR             0x10000000
- #define RFSILENT_BB             0x00002000
-+#define AR_PHY_TEST_BBB_OBS_SEL       0x780000
-+#define AR_PHY_TEST_BBB_OBS_SEL_S     19
-+
-+#define AR_PHY_TEST_RX_OBS_SEL_BIT5_S 23
-+#define AR_PHY_TEST_RX_OBS_SEL_BIT5   (1 << AR_PHY_TEST_RX_OBS_SEL_BIT5_S)
-+
- #define AR_PHY_TURBO                0x9804
- #define AR_PHY_FC_TURBO_MODE        0x00000001
- #define AR_PHY_FC_TURBO_SHORT       0x00000002
-@@ -36,6 +42,9 @@
- #define AR_PHY_TEST2                  0x9808
-+#define AR_PHY_TEST2_RX_OBS_SEL        0x3C00
-+#define AR_PHY_TEST2_RX_OBS_SEL_S      10
-+
- #define AR_PHY_TIMING2           0x9810
- #define AR_PHY_TIMING3           0x9814
- #define AR_PHY_TIMING3_DSC_MAN   0xFFFE0000
-@@ -390,6 +399,8 @@
- #define AR_PHY_RFBUS_GRANT       0x9C20
- #define AR_PHY_RFBUS_GRANT_EN    0x00000001
-+#define AR_PHY_TST_ADC      0x9C24
-+
- #define AR_PHY_CHAN_INFO_GAIN_DIFF             0x9CF4
- #define AR_PHY_CHAN_INFO_GAIN_DIFF_UPPER_LIMIT 320
diff --git a/package/kernel/mac80211/patches/551-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/551-ath9k-ar933x-usb-hang-workaround.patch
deleted file mode 100644 (file)
index 1bea163..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -215,6 +215,19 @@ void ath9k_hw_get_channel_centers(struct
-               centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT);
- }
-+static inline void ath9k_hw_disable_pll_lock_detect(struct ath_hw *ah)
-+{
-+      /* On AR9330 and AR9340 devices, some PHY registers must be
-+       * tuned to gain better stability/performance. These registers
-+       * might be changed while doing wlan reset so the registers must
-+       * be reprogrammed after each reset.
-+       */
-+      REG_CLR_BIT(ah, AR_PHY_USB_CTRL1, BIT(20));
-+      REG_RMW(ah, AR_PHY_USB_CTRL2,
-+              (1 << 21) | (0xf << 22),
-+              (1 << 21) | (0x3 << 22));
-+}
-+
- /******************/
- /* Chip Revisions */
- /******************/
-@@ -1351,6 +1364,9 @@ static bool ath9k_hw_set_reset(struct at
-       if (AR_SREV_9100(ah))
-               udelay(50);
-+      if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
-+              ath9k_hw_disable_pll_lock_detect(ah);
-+
-       return true;
- }
-@@ -1450,6 +1466,9 @@ static bool ath9k_hw_chip_reset(struct a
-               ar9003_hw_internal_regulator_apply(ah);
-       ath9k_hw_init_pll(ah, chan);
-+      if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
-+              ath9k_hw_disable_pll_lock_detect(ah);
-+
-       return true;
- }
-@@ -1744,8 +1763,14 @@ static int ath9k_hw_do_fastcc(struct ath
-       if (AR_SREV_9271(ah))
-               ar9002_hw_load_ani_reg(ah, chan);
-+      if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
-+              ath9k_hw_disable_pll_lock_detect(ah);
-+
-       return 0;
- fail:
-+      if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
-+              ath9k_hw_disable_pll_lock_detect(ah);
-+
-       return -EINVAL;
- }
-@@ -1993,6 +2018,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
-               ath9k_hw_set_radar_params(ah);
-       }
-+      if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
-+              ath9k_hw_disable_pll_lock_detect(ah);
-+
-       return 0;
- }
- EXPORT_SYMBOL(ath9k_hw_reset);
---- a/drivers/net/wireless/ath/ath9k/phy.h
-+++ b/drivers/net/wireless/ath/ath9k/phy.h
-@@ -48,6 +48,9 @@
- #define AR_PHY_PLL_CONTROL 0x16180
- #define AR_PHY_PLL_MODE 0x16184
-+#define AR_PHY_USB_CTRL1      0x16c84
-+#define AR_PHY_USB_CTRL2      0x16c88
-+
- enum ath9k_ant_div_comb_lna_conf {
-       ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2,
-       ATH_ANT_DIV_COMB_LNA2,
diff --git a/package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch b/package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch
deleted file mode 100644 (file)
index cc32688..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/Kconfig
-+++ b/drivers/net/wireless/ath/ath9k/Kconfig
-@@ -151,6 +151,11 @@ config ATH9K_CHANNEL_CONTEXT
-        for multi-channel concurrency. Enable this if P2P PowerSave support
-        is required.
-+config ATH9K_PCOEM
-+      bool "Atheros ath9k support for PC OEM cards" if EXPERT
-+      depends on ATH9K
-+      default y
-+
- config ATH9K_HTC
-        tristate "Atheros HTC based wireless cards support"
-        depends on m
---- a/drivers/net/wireless/ath/ath9k/Makefile
-+++ b/drivers/net/wireless/ath/ath9k/Makefile
-@@ -32,7 +32,6 @@ ath9k_hw-y:= \
-               ar5008_phy.o \
-               ar9002_calib.o \
-               ar9003_calib.o \
--              ar9003_rtt.o \
-               calib.o \
-               eeprom.o \
-               eeprom_def.o \
-@@ -50,6 +49,8 @@ ath9k_hw-$(CPTCFG_ATH9K_WOW) += ar9003_w
- ath9k_hw-$(CPTCFG_ATH9K_BTCOEX_SUPPORT) += btcoex.o \
-                                          ar9003_mci.o
-+ath9k_hw-$(CPTCFG_ATH9K_PCOEM) += ar9003_rtt.o
-+
- ath9k_hw-$(CPTCFG_ATH9K_DYNACK) += dynack.o
- obj-$(CPTCFG_ATH9K_HW) += ath9k_hw.o
---- a/drivers/net/wireless/ath/ath9k/ar9003_rtt.h
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_rtt.h
-@@ -17,6 +17,7 @@
- #ifndef AR9003_RTT_H
- #define AR9003_RTT_H
-+#ifdef CPTCFG_ATH9K_PCOEM
- void ar9003_hw_rtt_enable(struct ath_hw *ah);
- void ar9003_hw_rtt_disable(struct ath_hw *ah);
- void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask);
-@@ -25,5 +26,40 @@ void ar9003_hw_rtt_load_hist(struct ath_
- void ar9003_hw_rtt_fill_hist(struct ath_hw *ah);
- void ar9003_hw_rtt_clear_hist(struct ath_hw *ah);
- bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan);
-+#else
-+static inline void ar9003_hw_rtt_enable(struct ath_hw *ah)
-+{
-+}
-+
-+static inline void ar9003_hw_rtt_disable(struct ath_hw *ah)
-+{
-+}
-+
-+static inline void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask)
-+{
-+}
-+
-+static inline bool ar9003_hw_rtt_force_restore(struct ath_hw *ah)
-+{
-+      return false;
-+}
-+
-+static inline void ar9003_hw_rtt_load_hist(struct ath_hw *ah)
-+{
-+}
-+
-+static inline void ar9003_hw_rtt_fill_hist(struct ath_hw *ah)
-+{
-+}
-+
-+static inline void ar9003_hw_rtt_clear_hist(struct ath_hw *ah)
-+{
-+}
-+
-+static inline bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan)
-+{
-+      return false;
-+}
-+#endif
- #endif
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -245,13 +245,20 @@ enum ath9k_hw_caps {
-       ATH9K_HW_CAP_2GHZ                       = BIT(11),
-       ATH9K_HW_CAP_5GHZ                       = BIT(12),
-       ATH9K_HW_CAP_APM                        = BIT(13),
-+#ifdef CPTCFG_ATH9K_PCOEM
-       ATH9K_HW_CAP_RTT                        = BIT(14),
-       ATH9K_HW_CAP_MCI                        = BIT(15),
--      ATH9K_HW_CAP_DFS                        = BIT(16),
--      ATH9K_HW_WOW_DEVICE_CAPABLE             = BIT(17),
--      ATH9K_HW_CAP_PAPRD                      = BIT(18),
--      ATH9K_HW_CAP_FCC_BAND_SWITCH            = BIT(19),
--      ATH9K_HW_CAP_BT_ANT_DIV                 = BIT(20),
-+      ATH9K_HW_WOW_DEVICE_CAPABLE             = BIT(16),
-+      ATH9K_HW_CAP_BT_ANT_DIV                 = BIT(17),
-+#else
-+      ATH9K_HW_CAP_RTT                        = 0,
-+      ATH9K_HW_CAP_MCI                        = 0,
-+      ATH9K_HW_WOW_DEVICE_CAPABLE             = 0,
-+      ATH9K_HW_CAP_BT_ANT_DIV                 = 0,
-+#endif
-+      ATH9K_HW_CAP_DFS                        = BIT(18),
-+      ATH9K_HW_CAP_PAPRD                      = BIT(19),
-+      ATH9K_HW_CAP_FCC_BAND_SWITCH            = BIT(20),
- };
- /*
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -362,6 +362,9 @@ static void ath9k_init_pcoem_platform(st
-       struct ath9k_hw_capabilities *pCap = &ah->caps;
-       struct ath_common *common = ath9k_hw_common(ah);
-+      if (!IS_ENABLED(CPTCFG_ATH9K_PCOEM))
-+              return;
-+
-       if (common->bus_ops->ath_bus_type != ATH_PCI)
-               return;
---- a/drivers/net/wireless/ath/ath9k/pci.c
-+++ b/drivers/net/wireless/ath/ath9k/pci.c
-@@ -30,6 +30,7 @@ static const struct pci_device_id ath_pc
-       { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI   */
-       { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */
-+#ifdef CPTCFG_ATH9K_PCOEM
-       { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-                        0x002A,
-                        PCI_VENDOR_ID_AZWAVE,
-@@ -82,6 +83,7 @@ static const struct pci_device_id ath_pc
-                        PCI_VENDOR_ID_AZWAVE,
-                        0x2C37),
-         .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+#endif
-       { PCI_VDEVICE(ATHEROS, 0x002B) }, /* PCI-E */
-       { PCI_VDEVICE(ATHEROS, 0x002C) }, /* PCI-E 802.11n bonded out */
-@@ -102,6 +104,7 @@ static const struct pci_device_id ath_pc
-       { PCI_VDEVICE(ATHEROS, 0x0030) }, /* PCI-E  AR9300 */
-+#ifdef CPTCFG_ATH9K_PCOEM
-       /* PCI-E CUS198 */
-       { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-                        0x0032,
-@@ -294,10 +297,12 @@ static const struct pci_device_id ath_pc
-                        PCI_VENDOR_ID_ASUSTEK,
-                        0x850D),
-         .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
-+#endif
-       { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E  AR9485 */
-       { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E  AR9580 */
-+#ifdef CPTCFG_ATH9K_PCOEM
-       /* PCI-E CUS217 */
-       { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-                        0x0034,
-@@ -657,6 +662,7 @@ static const struct pci_device_id ath_pc
-       /* PCI-E AR9565 (WB335) */
-       { PCI_VDEVICE(ATHEROS, 0x0036),
-         .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+#endif
-       { PCI_VDEVICE(ATHEROS, 0xabcd) }, /* PCI-E  internal chip default ID */
-       { 0 }
---- a/drivers/net/wireless/ath/ath9k/reg.h
-+++ b/drivers/net/wireless/ath/ath9k/reg.h
-@@ -892,10 +892,21 @@
-       (AR_SREV_9330((_ah)) && \
-        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9330_12))
-+#ifdef CPTCFG_ATH9K_PCOEM
-+#define AR_SREV_9462(_ah) \
-+      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462))
- #define AR_SREV_9485(_ah) \
-       (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485))
-+#define AR_SREV_9565(_ah) \
-+      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565))
-+#else
-+#define AR_SREV_9462(_ah) 0
-+#define AR_SREV_9485(_ah) 0
-+#define AR_SREV_9565(_ah) 0
-+#endif
-+
- #define AR_SREV_9485_11_OR_LATER(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485) && \
-+      (AR_SREV_9485(_ah) && \
-        ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9485_11))
- #define AR_SREV_9485_OR_LATER(_ah) \
-       (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9485))
-@@ -915,34 +926,30 @@
-     (AR_SREV_9285_12_OR_LATER(_ah) && \
-      ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))
--#define AR_SREV_9462(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462))
- #define AR_SREV_9462_20(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
-+      (AR_SREV_9462(_ah) && \
-        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_20))
- #define AR_SREV_9462_21(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
-+      (AR_SREV_9462(_ah) && \
-        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_21))
- #define AR_SREV_9462_20_OR_LATER(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
-+      (AR_SREV_9462(_ah) && \
-        ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9462_20))
- #define AR_SREV_9462_21_OR_LATER(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
-+      (AR_SREV_9462(_ah) && \
-        ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9462_21))
--#define AR_SREV_9565(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565))
- #define AR_SREV_9565_10(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
-+      (AR_SREV_9565(_ah) && \
-        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_10))
- #define AR_SREV_9565_101(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
-+      (AR_SREV_9565(_ah) && \
-        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_101))
- #define AR_SREV_9565_11(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
-+      (AR_SREV_9565(_ah) && \
-        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_11))
- #define AR_SREV_9565_11_OR_LATER(_ah) \
--      (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
-+      (AR_SREV_9565(_ah) && \
-        ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9565_11))
- #define AR_SREV_9550(_ah) \
---- a/.local-symbols
-+++ b/.local-symbols
-@@ -124,6 +124,7 @@ ATH9K_HW=
- ATH9K_COMMON=
- ATH9K_DFS_DEBUGFS=
- ATH9K_BTCOEX_SUPPORT=
-+ATH9K_PCOEM=
- ATH9K=
- ATH9K_PCI=
- ATH9K_AHB=
diff --git a/package/kernel/mac80211/patches/561-ath9k_remove_gain_tables.patch b/package/kernel/mac80211/patches/561-ath9k_remove_gain_tables.patch
deleted file mode 100644 (file)
index 4d2b975..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
-@@ -670,9 +670,6 @@ static void ar9003_tx_gain_table_mode5(s
-       if (AR_SREV_9485_11_OR_LATER(ah))
-               INIT_INI_ARRAY(&ah->iniModesTxGain,
-                       ar9485Modes_green_ob_db_tx_gain_1_1);
--      else if (AR_SREV_9340(ah))
--              INIT_INI_ARRAY(&ah->iniModesTxGain,
--                      ar9340Modes_ub124_tx_gain_table_1p0);
-       else if (AR_SREV_9580(ah))
-               INIT_INI_ARRAY(&ah->iniModesTxGain,
-                       ar9580_1p0_type5_tx_gain_table);
diff --git a/package/kernel/mac80211/patches/562-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/562-ath9k_ani_ws_detect.patch
deleted file mode 100644 (file)
index d18a1ff..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
-@@ -929,55 +929,6 @@ static bool ar5008_hw_ani_control_new(st
-                * on == 0 means more noise imm
-                */
-               u32 on = param ? 1 : 0;
--              /*
--               * make register setting for default
--               * (weak sig detect ON) come from INI file
--               */
--              int m1ThreshLow = on ?
--                      aniState->iniDef.m1ThreshLow : m1ThreshLow_off;
--              int m2ThreshLow = on ?
--                      aniState->iniDef.m2ThreshLow : m2ThreshLow_off;
--              int m1Thresh = on ?
--                      aniState->iniDef.m1Thresh : m1Thresh_off;
--              int m2Thresh = on ?
--                      aniState->iniDef.m2Thresh : m2Thresh_off;
--              int m2CountThr = on ?
--                      aniState->iniDef.m2CountThr : m2CountThr_off;
--              int m2CountThrLow = on ?
--                      aniState->iniDef.m2CountThrLow : m2CountThrLow_off;
--              int m1ThreshLowExt = on ?
--                      aniState->iniDef.m1ThreshLowExt : m1ThreshLowExt_off;
--              int m2ThreshLowExt = on ?
--                      aniState->iniDef.m2ThreshLowExt : m2ThreshLowExt_off;
--              int m1ThreshExt = on ?
--                      aniState->iniDef.m1ThreshExt : m1ThreshExt_off;
--              int m2ThreshExt = on ?
--                      aniState->iniDef.m2ThreshExt : m2ThreshExt_off;
--
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
--                            AR_PHY_SFCORR_LOW_M1_THRESH_LOW,
--                            m1ThreshLow);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
--                            AR_PHY_SFCORR_LOW_M2_THRESH_LOW,
--                            m2ThreshLow);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
--                            AR_PHY_SFCORR_M1_THRESH, m1Thresh);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
--                            AR_PHY_SFCORR_M2_THRESH, m2Thresh);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
--                            AR_PHY_SFCORR_M2COUNT_THR, m2CountThr);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
--                            AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW,
--                            m2CountThrLow);
--
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
--                            AR_PHY_SFCORR_EXT_M1_THRESH_LOW, m1ThreshLowExt);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
--                            AR_PHY_SFCORR_EXT_M2_THRESH_LOW, m2ThreshLowExt);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
--                            AR_PHY_SFCORR_EXT_M1_THRESH, m1ThreshExt);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
--                            AR_PHY_SFCORR_EXT_M2_THRESH, m2ThreshExt);
-               if (on)
-                       REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-@@ -26,20 +26,6 @@ static const int cycpwrThr1_table[] =
- /* level:  0   1   2   3   4   5   6   7   8  */
-       { -6, -4, -2,  0,  2,  4,  6,  8 };     /* lvl 0-7, default 3 */
--/*
-- * register values to turn OFDM weak signal detection OFF
-- */
--static const int m1ThreshLow_off = 127;
--static const int m2ThreshLow_off = 127;
--static const int m1Thresh_off = 127;
--static const int m2Thresh_off = 127;
--static const int m2CountThr_off =  31;
--static const int m2CountThrLow_off =  63;
--static const int m1ThreshLowExt_off = 127;
--static const int m2ThreshLowExt_off = 127;
--static const int m1ThreshExt_off = 127;
--static const int m2ThreshExt_off = 127;
--
- /**
-  * ar9003_hw_set_channel - set channel on single-chip device
-  * @ah: atheros hardware structure
-@@ -971,11 +957,6 @@ static bool ar9003_hw_ani_control(struct
-       struct ath_common *common = ath9k_hw_common(ah);
-       struct ath9k_channel *chan = ah->curchan;
-       struct ar5416AniState *aniState = &ah->ani;
--      int m1ThreshLow, m2ThreshLow;
--      int m1Thresh, m2Thresh;
--      int m2CountThr, m2CountThrLow;
--      int m1ThreshLowExt, m2ThreshLowExt;
--      int m1ThreshExt, m2ThreshExt;
-       s32 value, value2;
-       switch (cmd & ah->ani_function) {
-@@ -989,61 +970,6 @@ static bool ar9003_hw_ani_control(struct
-                */
-               u32 on = param ? 1 : 0;
--              if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
--                      goto skip_ws_det;
--
--              m1ThreshLow = on ?
--                      aniState->iniDef.m1ThreshLow : m1ThreshLow_off;
--              m2ThreshLow = on ?
--                      aniState->iniDef.m2ThreshLow : m2ThreshLow_off;
--              m1Thresh = on ?
--                      aniState->iniDef.m1Thresh : m1Thresh_off;
--              m2Thresh = on ?
--                      aniState->iniDef.m2Thresh : m2Thresh_off;
--              m2CountThr = on ?
--                      aniState->iniDef.m2CountThr : m2CountThr_off;
--              m2CountThrLow = on ?
--                      aniState->iniDef.m2CountThrLow : m2CountThrLow_off;
--              m1ThreshLowExt = on ?
--                      aniState->iniDef.m1ThreshLowExt : m1ThreshLowExt_off;
--              m2ThreshLowExt = on ?
--                      aniState->iniDef.m2ThreshLowExt : m2ThreshLowExt_off;
--              m1ThreshExt = on ?
--                      aniState->iniDef.m1ThreshExt : m1ThreshExt_off;
--              m2ThreshExt = on ?
--                      aniState->iniDef.m2ThreshExt : m2ThreshExt_off;
--
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
--                            AR_PHY_SFCORR_LOW_M1_THRESH_LOW,
--                            m1ThreshLow);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
--                            AR_PHY_SFCORR_LOW_M2_THRESH_LOW,
--                            m2ThreshLow);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
--                            AR_PHY_SFCORR_M1_THRESH,
--                            m1Thresh);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
--                            AR_PHY_SFCORR_M2_THRESH,
--                            m2Thresh);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR,
--                            AR_PHY_SFCORR_M2COUNT_THR,
--                            m2CountThr);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
--                            AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW,
--                            m2CountThrLow);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
--                            AR_PHY_SFCORR_EXT_M1_THRESH_LOW,
--                            m1ThreshLowExt);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
--                            AR_PHY_SFCORR_EXT_M2_THRESH_LOW,
--                            m2ThreshLowExt);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
--                            AR_PHY_SFCORR_EXT_M1_THRESH,
--                            m1ThreshExt);
--              REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
--                            AR_PHY_SFCORR_EXT_M2_THRESH,
--                            m2ThreshExt);
--skip_ws_det:
-               if (on)
-                       REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
-                                   AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
diff --git a/package/kernel/mac80211/patches/563-ath9k_rxorn_intr_fix.patch b/package/kernel/mac80211/patches/563-ath9k_rxorn_intr_fix.patch
deleted file mode 100644 (file)
index 5d4c5dc..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/main.c
-+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -553,8 +553,7 @@ irqreturn_t ath_isr(int irq, void *dev)
-        * If a FATAL or RXORN interrupt is received, we have to reset the
-        * chip immediately.
-        */
--      if ((status & ATH9K_INT_FATAL) || ((status & ATH9K_INT_RXORN) &&
--          !(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)))
-+      if (status & ATH9K_INT_FATAL)
-               goto chip_reset;
-       if ((ah->config.hw_hang_checks & HW_BB_WATCHDOG) &&
diff --git a/package/kernel/mac80211/patches/564-ath9k_cleanup_reset_debug.patch b/package/kernel/mac80211/patches/564-ath9k_cleanup_reset_debug.patch
deleted file mode 100644 (file)
index 60d56e6..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/debug.c
-+++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -852,36 +852,30 @@ static ssize_t read_file_reset(struct fi
-                              size_t count, loff_t *ppos)
- {
-       struct ath_softc *sc = file->private_data;
-+      static const char * const reset_cause[__RESET_TYPE_MAX] = {
-+              [RESET_TYPE_BB_HANG] = "Baseband Hang",
-+              [RESET_TYPE_BB_WATCHDOG] = "Baseband Watchdog",
-+              [RESET_TYPE_FATAL_INT] = "Fatal HW Error",
-+              [RESET_TYPE_TX_ERROR] = "TX HW error",
-+              [RESET_TYPE_TX_GTT] = "Transmit timeout",
-+              [RESET_TYPE_TX_HANG] = "TX Path Hang",
-+              [RESET_TYPE_PLL_HANG] = "PLL RX Hang",
-+              [RESET_TYPE_MAC_HANG] = "MAC Hang",
-+              [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
-+              [RESET_TYPE_MCI] = "MCI Reset",
-+      };
-       char buf[512];
-       unsigned int len = 0;
-+      int i;
--      len += scnprintf(buf + len, sizeof(buf) - len,
--                       "%17s: %2d\n", "Baseband Hang",
--                       sc->debug.stats.reset[RESET_TYPE_BB_HANG]);
--      len += scnprintf(buf + len, sizeof(buf) - len,
--                       "%17s: %2d\n", "Baseband Watchdog",
--                       sc->debug.stats.reset[RESET_TYPE_BB_WATCHDOG]);
--      len += scnprintf(buf + len, sizeof(buf) - len,
--                       "%17s: %2d\n", "Fatal HW Error",
--                       sc->debug.stats.reset[RESET_TYPE_FATAL_INT]);
--      len += scnprintf(buf + len, sizeof(buf) - len,
--                       "%17s: %2d\n", "TX HW error",
--                       sc->debug.stats.reset[RESET_TYPE_TX_ERROR]);
--      len += scnprintf(buf + len, sizeof(buf) - len,
--                       "%17s: %2d\n", "TX Path Hang",
--                       sc->debug.stats.reset[RESET_TYPE_TX_HANG]);
--      len += scnprintf(buf + len, sizeof(buf) - len,
--                       "%17s: %2d\n", "PLL RX Hang",
--                       sc->debug.stats.reset[RESET_TYPE_PLL_HANG]);
--      len += scnprintf(buf + len, sizeof(buf) - len,
--                       "%17s: %2d\n", "MAC Hang",
--                       sc->debug.stats.reset[RESET_TYPE_MAC_HANG]);
--      len += scnprintf(buf + len, sizeof(buf) - len,
--                       "%17s: %2d\n", "Stuck Beacon",
--                       sc->debug.stats.reset[RESET_TYPE_BEACON_STUCK]);
--      len += scnprintf(buf + len, sizeof(buf) - len,
--                       "%17s: %2d\n", "MCI Reset",
--                       sc->debug.stats.reset[RESET_TYPE_MCI]);
-+      for (i = 0; i < ARRAY_SIZE(reset_cause); i++) {
-+              if (!reset_cause[i])
-+                  continue;
-+
-+              len += scnprintf(buf + len, sizeof(buf) - len,
-+                               "%17s: %2d\n", reset_cause[i],
-+                               sc->debug.stats.reset[i]);
-+      }
-       if (len > sizeof(buf))
-               len = sizeof(buf);
diff --git a/package/kernel/mac80211/patches/565-ath9k_restart_after_nfcal_failure.patch b/package/kernel/mac80211/patches/565-ath9k_restart_after_nfcal_failure.patch
deleted file mode 100644 (file)
index b53d50a..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/calib.c
-+++ b/drivers/net/wireless/ath/ath9k/calib.c
-@@ -234,7 +234,7 @@ void ath9k_hw_start_nfcal(struct ath_hw 
-       REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
- }
--void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
-+int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
- {
-       struct ath9k_nfcal_hist *h = NULL;
-       unsigned i, j;
-@@ -301,7 +301,7 @@ void ath9k_hw_loadnf(struct ath_hw *ah, 
-               ath_dbg(common, ANY,
-                       "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
-                       REG_READ(ah, AR_PHY_AGC_CONTROL));
--              return;
-+              return -ETIMEDOUT;
-       }
-       /*
-@@ -322,6 +322,8 @@ void ath9k_hw_loadnf(struct ath_hw *ah, 
-               }
-       }
-       REGWRITE_BUFFER_FLUSH(ah);
-+
-+      return 0;
- }
---- a/drivers/net/wireless/ath/ath9k/calib.h
-+++ b/drivers/net/wireless/ath/ath9k/calib.h
-@@ -109,7 +109,7 @@ struct ath9k_pacal_info{
- bool ath9k_hw_reset_calvalid(struct ath_hw *ah);
- void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update);
--void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan);
-+int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan);
- bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan);
- void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
-                                 struct ath9k_channel *chan);
---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-@@ -657,14 +657,13 @@ static void ar9002_hw_olc_temp_compensat
-               ar9280_hw_olc_temp_compensation(ah);
- }
--static bool ar9002_hw_calibrate(struct ath_hw *ah,
--                              struct ath9k_channel *chan,
--                              u8 rxchainmask,
--                              bool longcal)
-+static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
-+                             u8 rxchainmask, bool longcal)
- {
-       bool iscaldone = true;
-       struct ath9k_cal_list *currCal = ah->cal_list_curr;
-       bool nfcal, nfcal_pending = false;
-+      int ret;
-       nfcal = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF);
-       if (ah->caldata)
-@@ -698,7 +697,9 @@ static bool ar9002_hw_calibrate(struct a
-                        * NF is slow time-variant, so it is OK to use a
-                        * historical value.
-                        */
--                      ath9k_hw_loadnf(ah, ah->curchan);
-+                      ret = ath9k_hw_loadnf(ah, ah->curchan);
-+                      if (ret < 0)
-+                              return ret;
-               }
-               if (longcal) {
---- a/drivers/net/wireless/ath/ath9k/hw-ops.h
-+++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
-@@ -41,10 +41,9 @@ static inline void ath9k_hw_set_desc_lin
-       ath9k_hw_ops(ah)->set_desc_link(ds, link);
- }
--static inline bool ath9k_hw_calibrate(struct ath_hw *ah,
--                                    struct ath9k_channel *chan,
--                                    u8 rxchainmask,
--                                    bool longcal)
-+static inline int ath9k_hw_calibrate(struct ath_hw *ah,
-+                                   struct ath9k_channel *chan,
-+                                   u8 rxchainmask, bool longcal)
- {
-       return ath9k_hw_ops(ah)->calibrate(ah, chan, rxchainmask, longcal);
- }
---- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
-@@ -121,13 +121,12 @@ static bool ar9003_hw_per_calibration(st
-       return iscaldone;
- }
--static bool ar9003_hw_calibrate(struct ath_hw *ah,
--                              struct ath9k_channel *chan,
--                              u8 rxchainmask,
--                              bool longcal)
-+static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
-+                             u8 rxchainmask, bool longcal)
- {
-       bool iscaldone = true;
-       struct ath9k_cal_list *currCal = ah->cal_list_curr;
-+      int ret;
-       /*
-        * For given calibration:
-@@ -163,7 +162,9 @@ static bool ar9003_hw_calibrate(struct a
-                * NF is slow time-variant, so it is OK to use a historical
-                * value.
-                */
--              ath9k_hw_loadnf(ah, ah->curchan);
-+              ret = ath9k_hw_loadnf(ah, ah->curchan);
-+              if (ret < 0)
-+                      return ret;
-               /* start NF calibration, without updating BB NF register */
-               ath9k_hw_start_nfcal(ah, false);
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -696,10 +696,8 @@ struct ath_hw_ops {
-                                    bool power_off);
-       void (*rx_enable)(struct ath_hw *ah);
-       void (*set_desc_link)(void *ds, u32 link);
--      bool (*calibrate)(struct ath_hw *ah,
--                        struct ath9k_channel *chan,
--                        u8 rxchainmask,
--                        bool longcal);
-+      int (*calibrate)(struct ath_hw *ah, struct ath9k_channel *chan,
-+                       u8 rxchainmask, bool longcal);
-       bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked,
-                       u32 *sync_cause_p);
-       void (*set_txdesc)(struct ath_hw *ah, void *ds,
---- a/drivers/net/wireless/ath/ath9k/debug.h
-+++ b/drivers/net/wireless/ath/ath9k/debug.h
-@@ -49,6 +49,7 @@ enum ath_reset_type {
-       RESET_TYPE_MAC_HANG,
-       RESET_TYPE_BEACON_STUCK,
-       RESET_TYPE_MCI,
-+      RESET_TYPE_CALIBRATION,
-       __RESET_TYPE_MAX
- };
---- a/drivers/net/wireless/ath/ath9k/debug.c
-+++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -863,6 +863,7 @@ static ssize_t read_file_reset(struct fi
-               [RESET_TYPE_MAC_HANG] = "MAC Hang",
-               [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
-               [RESET_TYPE_MCI] = "MCI Reset",
-+              [RESET_TYPE_CALIBRATION] = "Calibration error",
-       };
-       char buf[512];
-       unsigned int len = 0;
---- a/drivers/net/wireless/ath/ath9k/link.c
-+++ b/drivers/net/wireless/ath/ath9k/link.c
-@@ -371,9 +371,14 @@ void ath_ani_calibrate(unsigned long dat
-       /* Perform calibration if necessary */
-       if (longcal || shortcal) {
--              common->ani.caldone =
--                      ath9k_hw_calibrate(ah, ah->curchan,
--                                         ah->rxchainmask, longcal);
-+              int ret = ath9k_hw_calibrate(ah, ah->curchan, ah->rxchainmask,
-+                                           longcal);
-+              if (ret < 0) {
-+                      ath9k_queue_reset(sc, RESET_TYPE_CALIBRATION);
-+                      return;
-+              }
-+
-+              common->ani.caldone = ret;
-       }
-       ath_dbg(common, ANI,
diff --git a/package/kernel/mac80211/patches/566-ath9k_nfcal_xor_percal.patch b/package/kernel/mac80211/patches/566-ath9k_nfcal_xor_percal.patch
deleted file mode 100644 (file)
index 917bc2d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-@@ -660,7 +660,6 @@ static void ar9002_hw_olc_temp_compensat
- static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
-                              u8 rxchainmask, bool longcal)
- {
--      bool iscaldone = true;
-       struct ath9k_cal_list *currCal = ah->cal_list_curr;
-       bool nfcal, nfcal_pending = false;
-       int ret;
-@@ -672,15 +671,13 @@ static int ar9002_hw_calibrate(struct at
-       if (currCal && !nfcal &&
-           (currCal->calState == CAL_RUNNING ||
-            currCal->calState == CAL_WAITING)) {
--              iscaldone = ar9002_hw_per_calibration(ah, chan,
--                                                    rxchainmask, currCal);
--              if (iscaldone) {
--                      ah->cal_list_curr = currCal = currCal->calNext;
--
--                      if (currCal->calState == CAL_WAITING) {
--                              iscaldone = false;
--                              ath9k_hw_reset_calibration(ah, currCal);
--                      }
-+              if (!ar9002_hw_per_calibration(ah, chan, rxchainmask, currCal))
-+                      return 0;
-+
-+              ah->cal_list_curr = currCal = currCal->calNext;
-+              if (currCal->calState == CAL_WAITING) {
-+                      ath9k_hw_reset_calibration(ah, currCal);
-+                      return 0;
-               }
-       }
-@@ -710,7 +707,7 @@ static int ar9002_hw_calibrate(struct at
-               }
-       }
--      return iscaldone;
-+      return 1;
- }
- /* Carrier leakage Calibration fix */
diff --git a/package/kernel/mac80211/patches/567-ath9k_fix_init_nfcal.patch b/package/kernel/mac80211/patches/567-ath9k_fix_init_nfcal.patch
deleted file mode 100644 (file)
index aaa4e29..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-@@ -854,6 +854,7 @@ static bool ar9002_hw_init_cal(struct at
-       /* Do PA Calibration */
-       ar9002_hw_pa_cal(ah, true);
-+      ath9k_hw_start_nfcal(ah, true);
-       if (ah->caldata)
-               set_bit(NFCAL_PENDING, &ah->caldata->cal_flags);
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1997,8 +1997,10 @@ int ath9k_hw_reset(struct ath_hw *ah, st
-       if (ath9k_hw_mci_is_enabled(ah))
-               ar9003_mci_check_bt(ah);
--      ath9k_hw_loadnf(ah, chan);
--      ath9k_hw_start_nfcal(ah, true);
-+      if (AR_SREV_9300_20_OR_LATER(ah)) {
-+              ath9k_hw_loadnf(ah, chan);
-+              ath9k_hw_start_nfcal(ah, true);
-+      }
-       if (AR_SREV_9300_20_OR_LATER(ah))
-               ar9003_hw_bb_watchdog_config(ah);
index 994433c00019ab970e32b2e639403f7d2d8bfebb..6b4aedab00dd73f1d4247d316d6ab9e9afd94ee4 100644 (file)
@@ -1,6 +1,6 @@
 --- a/.local-symbols
 +++ b/.local-symbols
 --- a/.local-symbols
 +++ b/.local-symbols
-@@ -284,6 +284,7 @@ RT2X00_LIB_FIRMWARE=
+@@ -285,6 +285,7 @@ RT2X00_LIB_FIRMWARE=
  RT2X00_LIB_CRYPTO=
  RT2X00_LIB_LEDS=
  RT2X00_LIB_DEBUGFS=
  RT2X00_LIB_CRYPTO=
  RT2X00_LIB_LEDS=
  RT2X00_LIB_DEBUGFS=