diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index dfe9781be2..0c9849811b 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -10,14 +10,14 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=mac80211
 
-PKG_VERSION:=2017-01-31
-PKG_RELEASE:=3
-PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
+PKG_VERSION:=4.14-rc1
+PKG_RELEASE:=1
+PKG_SOURCE_URL:=https://www.hauke-m.de/files
 PKG_BACKPORT_VERSION:=
-PKG_HASH:=75e6d39e34cf156212a2509172a4a62b673b69eb4a1d9aaa565f7fa719fa2317
+PKG_HASH:=171b8b93caa63a14ab3118610ac001df5476eefeae2ddb54085ab38a56162ebd
 
-PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.xz
-PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
+PKG_SOURCE:=backports-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.xz
+PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
 PKG_BUILD_PARALLEL:=1
 
 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
@@ -101,7 +101,7 @@ endef
 define KernelPackage/mac80211
   $(call KernelPackage/mac80211/Default)
   TITLE:=Linux 802.11 Wireless Networking Stack
-  DEPENDS+= +kmod-cfg80211 +hostapd-common
+  DEPENDS+= +kmod-cfg80211 +kmod-crypto-hash +kmod-crypto-cmac +hostapd-common
   KCONFIG:=\
 	CONFIG_AVERAGE=y
   FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
@@ -929,7 +929,7 @@ endef
 define KernelPackage/libipw
   $(call KernelPackage/mac80211/Default)
   TITLE:=libipw for ipw2100 and ipw2200
-  DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
+  DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-ecb +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN @!LINUX_3_18
   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko
   AUTOLOAD:=$(call AutoProbe,libipw)
 endef
@@ -989,7 +989,7 @@ endef
 
 define KernelPackage/libertas-usb
   $(call KernelPackage/mac80211/Default)
-  DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-usb-firmware
+  DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-usb-firmware @!LINUX_3_18
   TITLE:=Marvell 88W8015 Wireless Driver
   FILES:= \
 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \
@@ -999,7 +999,7 @@ endef
 
 define KernelPackage/libertas-sdio
   $(call KernelPackage/mac80211/Default)
-  DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-sdio-firmware
+  DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-sdio-firmware @!LINUX_3_18
   TITLE:=Marvell 88W8686 Wireless Driver
   FILES:= \
 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \
@@ -1010,7 +1010,7 @@ endef
 define KernelPackage/libertas-spi
   $(call KernelPackage/mac80211/Default)
   SUBMENU:=Wireless Drivers
-  DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware
+  DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware @!LINUX_3_18
   KCONFIG := \
 	CONFIG_SPI=y \
 	CONFIG_SPI_MASTER=y
diff --git a/package/kernel/mac80211/patches/001-fix_build.patch b/package/kernel/mac80211/patches/001-fix_build.patch
index 402649d2cc..9e272e90af 100644
--- a/package/kernel/mac80211/patches/001-fix_build.patch
+++ b/package/kernel/mac80211/patches/001-fix_build.patch
@@ -24,7 +24,7 @@
 -.DEFAULT:
 +.SILENT: $(STAMP_KERNEL_CONFIG)
 +$(STAMP_KERNEL_CONFIG):
- 	@set -e ; test -f .local-symbols || (						\
+ 	@set -e ; test -f local-symbols || (						\
  	echo "/--------------"								;\
  	echo "| You shouldn't run make in the backports tree, but only in"		;\
 @@ -60,57 +62,61 @@ mrproper:
@@ -34,7 +34,7 @@
 -	@set -e ; if [ "$$(cat .kernel_config_md5 2>/dev/null)" != "$(CONFIG_MD5)" ]	;\
 -	then 										\
 -		echo -n "Generating local configuration database from kernel ..."	;\
--		grep -v -f .local-symbols $(KERNEL_CONFIG) | grep = | (			\
+-		grep -v -f local-symbols $(KERNEL_CONFIG) | grep = | (			\
 -			while read l ; do						\
 -				if [ "$${l:0:7}" != "CONFIG_" ] ; then			\
 -					continue					;\
@@ -85,9 +85,9 @@
 +	@rm -f .kernel_config_md5_*
 +	@touch $@
 +
-+Kconfig.kernel: $(STAMP_KERNEL_CONFIG) .local-symbols
++Kconfig.kernel: $(STAMP_KERNEL_CONFIG) local-symbols
 +	@printf "Generating local configuration database from kernel ..."
-+	@grep -v -f .local-symbols $(KERNEL_CONFIG) | grep = | (			\
++	@grep -v -f local-symbols $(KERNEL_CONFIG) | grep = | (			\
 +		while read l ; do						\
 +			if [ "$${l:0:7}" != "CONFIG_" ] ; then			\
 +				continue					;\
@@ -148,7 +148,7 @@
  	@$(MAKE) oldconfig
 -	@echo -n "Building backport-include/backport/autoconf.h ..."
 +	@printf "Building backport-include/backport/autoconf.h ..."
- 	@grep -f .local-symbols .config | (				\
+ 	@grep -f local-symbols .config | (				\
  		echo "#ifndef COMPAT_AUTOCONF_INCLUDED"			;\
  		echo "#define COMPAT_AUTOCONF_INCLUDED"			;\
 @@ -80,7 +80,12 @@ backport-include/backport/autoconf.h: .c
diff --git a/package/kernel/mac80211/patches/002-change_allconfig.patch b/package/kernel/mac80211/patches/002-change_allconfig.patch
index a071ae6370..bd5bebfa45 100644
--- a/package/kernel/mac80211/patches/002-change_allconfig.patch
+++ b/package/kernel/mac80211/patches/002-change_allconfig.patch
@@ -1,6 +1,6 @@
 --- a/kconf/conf.c
 +++ b/kconf/conf.c
-@@ -594,40 +594,12 @@ int main(int ac, char **av)
+@@ -593,40 +593,12 @@ int main(int ac, char **av)
  	case oldconfig:
  	case listnewconfig:
  	case olddefconfig:
@@ -44,7 +44,7 @@
  		break;
 --- a/kconf/confdata.c
 +++ b/kconf/confdata.c
-@@ -1170,6 +1170,8 @@ bool conf_set_all_new_symbols(enum conf_
+@@ -1169,6 +1169,8 @@ bool conf_set_all_new_symbols(enum conf_
  	}
  	bool has_changed = false;
  
@@ -53,7 +53,7 @@
  	for_all_symbols(i, sym) {
  		if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
  			continue;
-@@ -1213,8 +1215,6 @@ bool conf_set_all_new_symbols(enum conf_
+@@ -1212,8 +1214,6 @@ bool conf_set_all_new_symbols(enum conf_
  
  	}
  
diff --git a/package/kernel/mac80211/patches/004-kconfig_backport_fix.patch b/package/kernel/mac80211/patches/004-kconfig_backport_fix.patch
index f11029844c..2c9572ec93 100644
--- a/package/kernel/mac80211/patches/004-kconfig_backport_fix.patch
+++ b/package/kernel/mac80211/patches/004-kconfig_backport_fix.patch
@@ -17,7 +17,7 @@
  #undef IS_ENABLED
  #define IS_ENABLED(option) \
          (config_enabled(option) || config_enabled(option##_MODULE))
-@@ -24,6 +27,8 @@
+@@ -31,6 +34,8 @@
  #undef IS_BUILTIN
  #define IS_BUILTIN(option) config_enabled(option)
  
diff --git a/package/kernel/mac80211/patches/005-revert-devcoredump.patch b/package/kernel/mac80211/patches/005-revert-devcoredump.patch
index ff460900ff..1216b99574 100644
--- a/package/kernel/mac80211/patches/005-revert-devcoredump.patch
+++ b/package/kernel/mac80211/patches/005-revert-devcoredump.patch
@@ -1,6 +1,6 @@
 --- a/compat/Makefile
 +++ b/compat/Makefile
-@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
+@@ -39,8 +39,6 @@ compat-$(CPTCFG_KERNEL_4_10) += backport
  
  compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
  compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
@@ -9,144 +9,3 @@
  compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o
  compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o
  cordic-objs += lib-cordic.o
---- a/compat/drivers-base-devcoredump.c
-+++ b/compat/drivers-base-devcoredump.c
-@@ -31,6 +31,7 @@
- #include <linux/slab.h>
- #include <linux/fs.h>
- #include <linux/workqueue.h>
-+#include "backports.h"
- 
- static struct class devcd_class;
- 
-@@ -40,6 +41,10 @@ static bool devcd_disabled;
- /* if data isn't read by userspace after 5 minutes then delete it */
- #define DEVCD_TIMEOUT	(HZ * 60 * 5)
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
-+static struct bin_attribute devcd_attr_data;
-+#endif
-+
- struct devcd_entry {
- 	struct device devcd_dev;
- 	void *data;
-@@ -69,8 +74,7 @@ static void devcd_dev_release(struct dev
- 	 * a struct device to know when it goes away?
- 	 */
- 	if (devcd->failing_dev->kobj.sd)
--		sysfs_delete_link(&devcd->failing_dev->kobj, &dev->kobj,
--				  "devcoredump");
-+		sysfs_remove_link(&devcd->failing_dev->kobj, "devcoredump");
- 
- 	put_device(devcd->failing_dev);
- 	kfree(devcd);
-@@ -82,6 +86,9 @@ static void devcd_del(struct work_struct
- 
- 	devcd = container_of(wk, struct devcd_entry, del_wk.work);
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
-+	device_remove_bin_file(&devcd->devcd_dev, &devcd_attr_data);
-+#endif
- 	device_del(&devcd->devcd_dev);
- 	put_device(&devcd->devcd_dev);
- }
-@@ -115,6 +122,7 @@ static struct bin_attribute devcd_attr_d
- 	.write = devcd_data_write,
- };
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
- static struct bin_attribute *devcd_dev_bin_attrs[] = {
- 	&devcd_attr_data, NULL,
- };
-@@ -126,6 +134,7 @@ static const struct attribute_group devc
- static const struct attribute_group *devcd_dev_groups[] = {
- 	&devcd_dev_group, NULL,
- };
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) */
- 
- static int devcd_free(struct device *dev, void *data)
- {
-@@ -160,18 +169,11 @@ static ssize_t disabled_store(struct cla
- 
- 	return count;
- }
--static CLASS_ATTR_RW(disabled);
- 
--static struct attribute *devcd_class_attrs[] = {
--	&class_attr_disabled.attr,
--	NULL,
-+static struct class_attribute devcd_class_attrs[] = {
-+	__ATTR_RW(disabled),
-+	__ATTR_NULL
- };
--#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
--ATTRIBUTE_GROUPS(devcd_class);
--#else
--#define BP_ATTR_GRP_STRUCT device_attribute
--ATTRIBUTE_GROUPS_BACKPORT(devcd_class);
--#endif
- 
- static struct class devcd_class = {
- 	.name		= "devcoredump",
-@@ -179,10 +181,8 @@ static struct class devcd_class = {
- 	.dev_release	= devcd_dev_release,
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
- 	.dev_groups	= devcd_dev_groups,
--#else
--	.dev_attrs = devcd_class_dev_attrs,
- #endif
--	.class_groups	= devcd_class_groups,
-+	.class_attrs	= devcd_class_attrs,
- };
- 
- static ssize_t devcd_readv(char *buffer, loff_t offset, size_t count,
-@@ -325,6 +325,11 @@ void dev_coredumpm(struct device *dev, s
- 	if (device_add(&devcd->devcd_dev))
- 		goto put_device;
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
-+	if (device_create_bin_file(&devcd->devcd_dev, &devcd_attr_data))
-+		goto put_device;
-+#endif
-+
- 	if (sysfs_create_link(&devcd->devcd_dev.kobj, &dev->kobj,
- 			      "failing_device"))
- 		/* nothing - symlink will be missing */;
-@@ -367,16 +372,13 @@ void dev_coredumpsg(struct device *dev,
- }
- EXPORT_SYMBOL_GPL(dev_coredumpsg);
- 
--static int __init devcoredump_init(void)
-+int __init devcoredump_init(void)
- {
--	init_devcd_class_attrs();
- 	return class_register(&devcd_class);
- }
--__initcall(devcoredump_init);
- 
--static void __exit devcoredump_exit(void)
-+void __exit devcoredump_exit(void)
- {
- 	class_for_each_device(&devcd_class, NULL, NULL, devcd_free);
- 	class_unregister(&devcd_class);
- }
--__exitcall(devcoredump_exit);
---- a/include/linux/backport-devcoredump.h
-+++ b/include/linux/backport-devcoredump.h
-@@ -66,7 +66,7 @@ static inline void _devcd_free_sgtable(s
- }
- 
- 
--#ifdef CONFIG_DEV_COREDUMP
-+#ifdef CPTCFG_BPAUTO_WANT_DEV_COREDUMP
- void dev_coredumpv(struct device *dev, void *data, size_t datalen,
- 		   gfp_t gfp);
- 
-@@ -100,6 +100,6 @@ static inline void dev_coredumpsg(struct
- {
- 	_devcd_free_sgtable(table);
- }
--#endif /* CONFIG_DEV_COREDUMP */
-+#endif /* CPTCFG_BPAUTO_WANT_DEV_COREDUMP */
- 
- #endif /* __DEVCOREDUMP_H */
diff --git a/package/kernel/mac80211/patches/006-revert-ktime-changes.patch b/package/kernel/mac80211/patches/006-revert-ktime-changes.patch
deleted file mode 100644
index b839eb4c8d..0000000000
--- a/package/kernel/mac80211/patches/006-revert-ktime-changes.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
-@@ -177,7 +177,7 @@ static bool rt2800usb_tx_sta_fifo_read_c
- 	if (rt2800usb_txstatus_pending(rt2x00dev)) {
- 		/* Read register after 1 ms */
- 		hrtimer_start(&rt2x00dev->txstatus_timer,
--			      TXSTATUS_READ_INTERVAL,
-+			      ktime_set(0, TXSTATUS_READ_INTERVAL),
- 			      HRTIMER_MODE_REL);
- 		return false;
- 	}
-@@ -204,7 +204,7 @@ static void rt2800usb_async_read_tx_stat
- 
- 	/* Read TX_STA_FIFO register after 2 ms */
- 	hrtimer_start(&rt2x00dev->txstatus_timer,
--		      2 * TXSTATUS_READ_INTERVAL,
-+		      ktime_set(0, 2*TXSTATUS_READ_INTERVAL),
- 		      HRTIMER_MODE_REL);
- }
- 
diff --git a/package/kernel/mac80211/patches/007-revert-genetlink-changes.patch b/package/kernel/mac80211/patches/007-revert-genetlink-changes.patch
deleted file mode 100644
index 1a85106bc2..0000000000
--- a/package/kernel/mac80211/patches/007-revert-genetlink-changes.patch
+++ /dev/null
@@ -1,266 +0,0 @@
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -32,8 +32,22 @@ static int nl80211_crypto_settings(struc
- 				   struct cfg80211_crypto_settings *settings,
- 				   int cipher_limit);
- 
-+static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb,
-+			    struct genl_info *info);
-+static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb,
-+			      struct genl_info *info);
-+
- /* the netlink family */
--static struct genl_family nl80211_fam;
-+static struct genl_family nl80211_fam = {
-+	.id = GENL_ID_GENERATE,		/* don't bother with a hardcoded ID */
-+	.name = NL80211_GENL_NAME,	/* have users key off the name instead */
-+	.hdrsize = 0,			/* no private header */
-+	.version = 1,			/* no particular meaning now */
-+	.maxattr = NL80211_ATTR_MAX,
-+	.netnsok = true,
-+	.pre_doit = nl80211_pre_doit,
-+	.post_doit = nl80211_post_doit,
-+};
- 
- /* multicast groups */
- enum nl80211_multicast_groups {
-@@ -549,14 +563,13 @@ static int nl80211_prepare_wdev_dump(str
- 
- 	if (!cb->args[0]) {
- 		err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
--				  genl_family_attrbuf(&nl80211_fam),
--				  nl80211_fam.maxattr, nl80211_policy);
-+				  nl80211_fam.attrbuf, nl80211_fam.maxattr,
-+				  nl80211_policy);
- 		if (err)
- 			goto out_unlock;
- 
--		*wdev = __cfg80211_wdev_from_attrs(
--					sock_net(skb->sk),
--					genl_family_attrbuf(&nl80211_fam));
-+		*wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk),
-+						   nl80211_fam.attrbuf);
- 		if (IS_ERR(*wdev)) {
- 			err = PTR_ERR(*wdev);
- 			goto out_unlock;
-@@ -1903,7 +1916,7 @@ static int nl80211_dump_wiphy_parse(stru
- 				    struct netlink_callback *cb,
- 				    struct nl80211_dump_wiphy_state *state)
- {
--	struct nlattr **tb = genl_family_attrbuf(&nl80211_fam);
-+	struct nlattr **tb = nl80211_fam.attrbuf;
- 	int ret = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
- 			      tb, nl80211_fam.maxattr, nl80211_policy);
- 	/* ignore parse errors for backward compatibility */
-@@ -7733,7 +7746,6 @@ static int nl80211_send_survey(struct sk
- 
- static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb)
- {
--	struct nlattr **attrbuf = genl_family_attrbuf(&nl80211_fam);
- 	struct survey_info survey;
- 	struct cfg80211_registered_device *rdev;
- 	struct wireless_dev *wdev;
-@@ -7746,7 +7758,7 @@ static int nl80211_dump_survey(struct sk
- 		return res;
- 
- 	/* prepare_wdev_dump parsed the attributes */
--	radio_stats = attrbuf[NL80211_ATTR_SURVEY_RADIO_STATS];
-+	radio_stats = nl80211_fam.attrbuf[NL80211_ATTR_SURVEY_RADIO_STATS];
- 
- 	if (!wdev->netdev) {
- 		res = -EINVAL;
-@@ -8594,14 +8606,14 @@ static int nl80211_testmode_dump(struct
- 		 */
- 		phy_idx = cb->args[0] - 1;
- 	} else {
--		struct nlattr **attrbuf = genl_family_attrbuf(&nl80211_fam);
--
- 		err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
--				  attrbuf, nl80211_fam.maxattr, nl80211_policy);
-+				  nl80211_fam.attrbuf, nl80211_fam.maxattr,
-+				  nl80211_policy);
- 		if (err)
- 			goto out_err;
- 
--		rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk), attrbuf);
-+		rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk),
-+						  nl80211_fam.attrbuf);
- 		if (IS_ERR(rdev)) {
- 			err = PTR_ERR(rdev);
- 			goto out_err;
-@@ -8609,8 +8621,9 @@ static int nl80211_testmode_dump(struct
- 		phy_idx = rdev->wiphy_idx;
- 		rdev = NULL;
- 
--		if (attrbuf[NL80211_ATTR_TESTDATA])
--			cb->args[1] = (long)attrbuf[NL80211_ATTR_TESTDATA];
-+		if (nl80211_fam.attrbuf[NL80211_ATTR_TESTDATA])
-+			cb->args[1] =
-+				(long)nl80211_fam.attrbuf[NL80211_ATTR_TESTDATA];
- 	}
- 
- 	if (cb->args[1]) {
-@@ -10814,7 +10827,8 @@ static int handle_nan_filter(struct nlat
- 
- 	i = 0;
- 	nla_for_each_nested(attr, attr_filter, rem) {
--		filter[i].filter = nla_memdup(attr, GFP_KERNEL);
-+		filter[i].filter = kmemdup(nla_data(attr), nla_len(attr),
-+					   GFP_KERNEL);
- 		filter[i].len = nla_len(attr);
- 		i++;
- 	}
-@@ -11450,7 +11464,6 @@ static int nl80211_prepare_vendor_dump(s
- 				       struct cfg80211_registered_device **rdev,
- 				       struct wireless_dev **wdev)
- {
--	struct nlattr **attrbuf = genl_family_attrbuf(&nl80211_fam);
- 	u32 vid, subcmd;
- 	unsigned int i;
- 	int vcmd_idx = -1;
-@@ -11486,28 +11499,31 @@ static int nl80211_prepare_vendor_dump(s
- 	}
- 
- 	err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
--			  attrbuf, nl80211_fam.maxattr, nl80211_policy);
-+			  nl80211_fam.attrbuf, nl80211_fam.maxattr,
-+			  nl80211_policy);
- 	if (err)
- 		goto out_unlock;
- 
--	if (!attrbuf[NL80211_ATTR_VENDOR_ID] ||
--	    !attrbuf[NL80211_ATTR_VENDOR_SUBCMD]) {
-+	if (!nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_ID] ||
-+	    !nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_SUBCMD]) {
- 		err = -EINVAL;
- 		goto out_unlock;
- 	}
- 
--	*wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk), attrbuf);
-+	*wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk),
-+					   nl80211_fam.attrbuf);
- 	if (IS_ERR(*wdev))
- 		*wdev = NULL;
- 
--	*rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk), attrbuf);
-+	*rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk),
-+					   nl80211_fam.attrbuf);
- 	if (IS_ERR(*rdev)) {
- 		err = PTR_ERR(*rdev);
- 		goto out_unlock;
- 	}
- 
--	vid = nla_get_u32(attrbuf[NL80211_ATTR_VENDOR_ID]);
--	subcmd = nla_get_u32(attrbuf[NL80211_ATTR_VENDOR_SUBCMD]);
-+	vid = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_ID]);
-+	subcmd = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_SUBCMD]);
- 
- 	for (i = 0; i < (*rdev)->wiphy.n_vendor_commands; i++) {
- 		const struct wiphy_vendor_command *vcmd;
-@@ -11531,9 +11547,9 @@ static int nl80211_prepare_vendor_dump(s
- 		goto out_unlock;
- 	}
- 
--	if (attrbuf[NL80211_ATTR_VENDOR_DATA]) {
--		data = nla_data(attrbuf[NL80211_ATTR_VENDOR_DATA]);
--		data_len = nla_len(attrbuf[NL80211_ATTR_VENDOR_DATA]);
-+	if (nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_DATA]) {
-+		data = nla_data(nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_DATA]);
-+		data_len = nla_len(nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_DATA]);
- 	}
- 
- 	/* 0 is the first index - add 1 to parse only once */
-@@ -12795,21 +12811,6 @@ static __genl_const struct genl_ops nl80
- 	},
- };
- 
--static struct genl_family nl80211_fam __ro_after_init = {
--	.name = NL80211_GENL_NAME,	/* have users key off the name instead */
--	.hdrsize = 0,			/* no private header */
--	.version = 1,			/* no particular meaning now */
--	.maxattr = NL80211_ATTR_MAX,
--	.netnsok = true,
--	.pre_doit = nl80211_pre_doit,
--	.post_doit = nl80211_post_doit,
--	.module = THIS_MODULE,
--	.ops = nl80211_ops,
--	.n_ops = ARRAY_SIZE(nl80211_ops),
--	.mcgrps = nl80211_mcgrps,
--	.n_mcgrps = ARRAY_SIZE(nl80211_mcgrps),
--};
--
- /* notification functions */
- 
- void nl80211_notify_wiphy(struct cfg80211_registered_device *rdev,
-@@ -14759,11 +14760,12 @@ void nl80211_send_ap_stopped(struct wire
- 
- /* initialisation/exit functions */
- 
--int __init nl80211_init(void)
-+int nl80211_init(void)
- {
- 	int err;
- 
--	err = genl_register_family(&nl80211_fam);
-+	err = genl_register_family_with_ops_groups(&nl80211_fam, nl80211_ops,
-+						   nl80211_mcgrps);
- 	if (err)
- 		return err;
- 
---- a/drivers/net/wireless/mac80211_hwsim.c
-+++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -587,8 +587,15 @@ struct hwsim_radiotap_ack_hdr {
- 	__le16 rt_chbitmask;
- } __packed;
- 
--/* MAC80211_HWSIM netlink family */
--static struct genl_family hwsim_genl_family;
-+/* MAC80211_HWSIM netlinf family */
-+static struct genl_family hwsim_genl_family = {
-+	.id = GENL_ID_GENERATE,
-+	.hdrsize = 0,
-+	.name = "MAC80211_HWSIM",
-+	.version = 1,
-+	.maxattr = HWSIM_ATTR_MAX,
-+	.netnsok = true,
-+};
- 
- enum hwsim_multicast_groups {
- 	HWSIM_MCGRP_CONFIG,
-@@ -3250,18 +3257,6 @@ static __genl_const struct genl_ops hwsi
- 	},
- };
- 
--static struct genl_family hwsim_genl_family __ro_after_init = {
--	.name = "MAC80211_HWSIM",
--	.version = 1,
--	.maxattr = HWSIM_ATTR_MAX,
--	.netnsok = true,
--	.module = THIS_MODULE,
--	.ops = hwsim_ops,
--	.n_ops = ARRAY_SIZE(hwsim_ops),
--	.mcgrps = hwsim_mcgrps,
--	.n_mcgrps = ARRAY_SIZE(hwsim_mcgrps),
--};
--
- static void destroy_radio(struct work_struct *work)
- {
- 	struct mac80211_hwsim_data *data =
-@@ -3309,13 +3304,15 @@ static struct notifier_block hwsim_netli
- 	.notifier_call = mac80211_hwsim_netlink_notify,
- };
- 
--static int __init hwsim_init_netlink(void)
-+static int hwsim_init_netlink(void)
- {
- 	int rc;
- 
- 	printk(KERN_INFO "mac80211_hwsim: initializing netlink\n");
- 
--	rc = genl_register_family(&hwsim_genl_family);
-+	rc = genl_register_family_with_ops_groups(&hwsim_genl_family,
-+						  hwsim_ops,
-+						  hwsim_mcgrps);
- 	if (rc)
- 		goto failure;
- 
diff --git a/package/kernel/mac80211/patches/008-revert-ndo_stats64-cleanup.patch b/package/kernel/mac80211/patches/008-revert-ndo_stats64-cleanup.patch
deleted file mode 100644
index 0f6f0f919f..0000000000
--- a/package/kernel/mac80211/patches/008-revert-ndo_stats64-cleanup.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -1133,7 +1133,7 @@ static u16 ieee80211_netdev_select_queue
- 	return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb);
- }
- 
--static void
-+static struct rtnl_link_stats64 *
- ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
- {
- 	int i;
-@@ -1158,6 +1158,8 @@ ieee80211_get_stats64(struct net_device
- 		stats->rx_bytes   += rx_bytes;
- 		stats->tx_bytes   += tx_bytes;
- 	}
-+
-+	return stats;
- }
- 
- static const struct net_device_ops ieee80211_dataif_ops = {
diff --git a/package/kernel/mac80211/patches/009-revert-mtu-changes.patch b/package/kernel/mac80211/patches/009-revert-mtu-changes.patch
deleted file mode 100644
index f5e2757d3f..0000000000
--- a/package/kernel/mac80211/patches/009-revert-mtu-changes.patch
+++ /dev/null
@@ -1,338 +0,0 @@
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -151,6 +151,15 @@ void ieee80211_recalc_idle(struct ieee80
- 		ieee80211_hw_config(local, change);
- }
- 
-+static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
-+{
-+	if (new_mtu < 256 || new_mtu > IEEE80211_MAX_DATA_LEN)
-+		return -EINVAL;
-+
-+	dev->mtu = new_mtu;
-+	return 0;
-+}
-+
- static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 *addr,
- 				bool check_dup)
- {
-@@ -1168,6 +1177,7 @@ static const struct net_device_ops ieee8
- 	.ndo_uninit		= ieee80211_uninit,
- 	.ndo_start_xmit		= ieee80211_subif_start_xmit,
- 	.ndo_set_rx_mode	= ieee80211_set_multicast_list,
-+	.ndo_change_mtu 	= ieee80211_change_mtu,
- 	.ndo_set_mac_address 	= ieee80211_change_mac,
- 	.ndo_select_queue	= ieee80211_netdev_select_queue,
- 	.ndo_get_stats64	= ieee80211_get_stats64,
-@@ -1211,6 +1221,7 @@ static const struct net_device_ops ieee8
- 	.ndo_uninit		= ieee80211_uninit,
- 	.ndo_start_xmit		= ieee80211_monitor_start_xmit,
- 	.ndo_set_rx_mode	= ieee80211_set_multicast_list,
-+	.ndo_change_mtu 	= ieee80211_change_mtu,
- 	.ndo_set_mac_address 	= ieee80211_change_mac,
- 	.ndo_select_queue	= ieee80211_monitor_select_queue,
- 	.ndo_get_stats64	= ieee80211_get_stats64,
-@@ -1919,10 +1930,6 @@ int ieee80211_if_add(struct ieee80211_lo
- 
- 		netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
- 
--		/* MTU range: 256 - 2304 */
--		ndev->min_mtu = 256;
--		ndev->max_mtu = IEEE80211_MAX_DATA_LEN;
--
- 		ret = register_netdevice(ndev);
- 		if (ret) {
- 			ieee80211_if_free(ndev);
---- a/drivers/net/wireless/ath/wil6210/netdev.c
-+++ b/drivers/net/wireless/ath/wil6210/netdev.c
-@@ -42,6 +42,21 @@ static int wil_stop(struct net_device *n
- 	return wil_down(wil);
- }
- 
-+static int wil_change_mtu(struct net_device *ndev, int new_mtu)
-+{
-+	struct wil6210_priv *wil = ndev_to_wil(ndev);
-+
-+	if (new_mtu < 68 || new_mtu > mtu_max) {
-+		wil_err(wil, "invalid MTU %d\n", new_mtu);
-+		return -EINVAL;
-+	}
-+
-+	wil_dbg_misc(wil, "change MTU %d -> %d\n", ndev->mtu, new_mtu);
-+	ndev->mtu = new_mtu;
-+
-+	return 0;
-+}
-+
- static int wil_do_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
- {
- 	struct wil6210_priv *wil = ndev_to_wil(ndev);
-@@ -55,6 +70,7 @@ static const struct net_device_ops wil_n
- 	.ndo_start_xmit		= wil_start_xmit,
- 	.ndo_set_mac_address	= eth_mac_addr,
- 	.ndo_validate_addr	= eth_validate_addr,
-+	.ndo_change_mtu		= wil_change_mtu,
- 	.ndo_do_ioctl		= wil_do_ioctl,
- };
- 
-@@ -111,7 +127,6 @@ static int wil6210_netdev_poll_tx(struct
- static void wil_dev_setup(struct net_device *dev)
- {
- 	ether_setup(dev);
--	dev->max_mtu = mtu_max;
- 	dev->tx_queue_len = WIL_TX_Q_LEN_DEFAULT;
- }
- 
---- a/drivers/net/wireless/atmel/atmel.c
-+++ b/drivers/net/wireless/atmel/atmel.c
-@@ -1295,6 +1295,14 @@ static struct iw_statistics *atmel_get_w
- 	return &priv->wstats;
- }
- 
-+static int atmel_change_mtu(struct net_device *dev, int new_mtu)
-+{
-+	if ((new_mtu < 68) || (new_mtu > 2312))
-+		return -EINVAL;
-+	dev->mtu = new_mtu;
-+	return 0;
-+}
-+
- static int atmel_set_mac_address(struct net_device *dev, void *p)
- {
- 	struct sockaddr *addr = p;
-@@ -1498,6 +1506,7 @@ static const struct file_operations atme
- static const struct net_device_ops atmel_netdev_ops = {
- 	.ndo_open 		= atmel_open,
- 	.ndo_stop		= atmel_close,
-+	.ndo_change_mtu 	= atmel_change_mtu,
- 	.ndo_set_mac_address 	= atmel_set_mac_address,
- 	.ndo_start_xmit 	= start_tx,
- 	.ndo_do_ioctl 		= atmel_ioctl,
-@@ -1591,10 +1600,6 @@ struct net_device *init_atmel_card(unsig
- 	dev->irq = irq;
- 	dev->base_addr = port;
- 
--	/* MTU range: 68 - 2312 */
--	dev->min_mtu = 68;
--	dev->max_mtu = MAX_WIRELESS_BODY - ETH_FCS_LEN;
--
- 	SET_NETDEV_DEV(dev, sys_dev);
- 
- 	if ((rc = request_irq(dev->irq, service_interrupt, IRQF_SHARED, dev->name, dev))) {
---- a/drivers/net/wireless/cisco/airo.c
-+++ b/drivers/net/wireless/cisco/airo.c
-@@ -2329,6 +2329,14 @@ static int airo_set_mac_address(struct n
- 	return 0;
- }
- 
-+static int airo_change_mtu(struct net_device *dev, int new_mtu)
-+{
-+	if ((new_mtu < 68) || (new_mtu > 2400))
-+		return -EINVAL;
-+	dev->mtu = new_mtu;
-+	return 0;
-+}
-+
- static LIST_HEAD(airo_devices);
- 
- static void add_airo_dev(struct airo_info *ai)
-@@ -2648,6 +2656,7 @@ static const struct net_device_ops airo1
- 	.ndo_get_stats 		= airo_get_stats,
- 	.ndo_set_mac_address	= airo_set_mac_address,
- 	.ndo_do_ioctl		= airo_ioctl,
-+	.ndo_change_mtu		= airo_change_mtu,
- };
- 
- static void wifi_setup(struct net_device *dev)
-@@ -2659,8 +2668,6 @@ static void wifi_setup(struct net_device
- 	dev->type               = ARPHRD_IEEE80211;
- 	dev->hard_header_len    = ETH_HLEN;
- 	dev->mtu                = AIRO_DEF_MTU;
--	dev->min_mtu            = 68;
--	dev->max_mtu            = MIC_MSGLEN_MAX;
- 	dev->addr_len           = ETH_ALEN;
- 	dev->tx_queue_len       = 100; 
- 
-@@ -2747,6 +2754,7 @@ static const struct net_device_ops airo_
- 	.ndo_set_rx_mode	= airo_set_multicast_list,
- 	.ndo_set_mac_address	= airo_set_mac_address,
- 	.ndo_do_ioctl		= airo_ioctl,
-+	.ndo_change_mtu		= airo_change_mtu,
- 	.ndo_validate_addr	= eth_validate_addr,
- };
- 
-@@ -2758,6 +2766,7 @@ static const struct net_device_ops mpi_n
- 	.ndo_set_rx_mode	= airo_set_multicast_list,
- 	.ndo_set_mac_address	= airo_set_mac_address,
- 	.ndo_do_ioctl		= airo_ioctl,
-+	.ndo_change_mtu		= airo_change_mtu,
- 	.ndo_validate_addr	= eth_validate_addr,
- };
- 
-@@ -2813,7 +2822,6 @@ static struct net_device *_init_airo_car
- 	dev->irq = irq;
- 	dev->base_addr = port;
- 	dev->priv_flags &= ~IFF_TX_SKB_SHARING;
--	dev->max_mtu = MIC_MSGLEN_MAX;
- 
- 	SET_NETDEV_DEV(dev, dmdev);
- 
---- a/drivers/net/wireless/intel/ipw2x00/ipw2100.c
-+++ b/drivers/net/wireless/intel/ipw2x00/ipw2100.c
-@@ -6039,6 +6039,7 @@ static const struct net_device_ops ipw21
- 	.ndo_open		= ipw2100_open,
- 	.ndo_stop		= ipw2100_close,
- 	.ndo_start_xmit		= libipw_xmit,
-+	.ndo_change_mtu		= libipw_change_mtu,
- 	.ndo_tx_timeout		= ipw2100_tx_timeout,
- 	.ndo_set_mac_address	= ipw2100_set_address,
- 	.ndo_validate_addr	= eth_validate_addr,
-@@ -6074,8 +6075,6 @@ static struct net_device *ipw2100_alloc_
- 	dev->wireless_data = &priv->wireless_data;
- 	dev->watchdog_timeo = 3 * HZ;
- 	dev->irq = 0;
--	dev->min_mtu = 68;
--	dev->max_mtu = LIBIPW_DATA_LEN;
- 
- 	/* NOTE: We don't use the wireless_handlers hook
- 	 * in dev as the system will start throwing WX requests
---- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
-+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
-@@ -11561,6 +11561,7 @@ static const struct net_device_ops ipw_p
- 	.ndo_open 		= ipw_prom_open,
- 	.ndo_stop		= ipw_prom_stop,
- 	.ndo_start_xmit		= ipw_prom_hard_start_xmit,
-+	.ndo_change_mtu		= libipw_change_mtu,
- 	.ndo_set_mac_address 	= eth_mac_addr,
- 	.ndo_validate_addr	= eth_validate_addr,
- };
-@@ -11586,9 +11587,6 @@ static int ipw_prom_alloc(struct ipw_pri
- 	priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP;
- 	priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops;
- 
--	priv->prom_net_dev->min_mtu = 68;
--	priv->prom_net_dev->max_mtu = LIBIPW_DATA_LEN;
--
- 	priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR;
- 	SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev);
- 
-@@ -11621,6 +11619,7 @@ static const struct net_device_ops ipw_n
- 	.ndo_set_rx_mode	= ipw_net_set_multicast_list,
- 	.ndo_set_mac_address	= ipw_net_set_mac_address,
- 	.ndo_start_xmit		= libipw_xmit,
-+	.ndo_change_mtu		= libipw_change_mtu,
- 	.ndo_validate_addr	= eth_validate_addr,
- };
- 
-@@ -11730,9 +11729,6 @@ static int ipw_pci_probe(struct pci_dev
- 	net_dev->wireless_handlers = &ipw_wx_handler_def;
- 	net_dev->ethtool_ops = &ipw_ethtool_ops;
- 
--	net_dev->min_mtu = 68;
--	net_dev->max_mtu = LIBIPW_DATA_LEN;
--
- 	err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group);
- 	if (err) {
- 		IPW_ERROR("failed to create sysfs device attributes\n");
---- a/drivers/net/wireless/intel/ipw2x00/libipw.h
-+++ b/drivers/net/wireless/intel/ipw2x00/libipw.h
-@@ -948,6 +948,7 @@ static inline int libipw_is_cck_rate(u8
- /* libipw.c */
- void free_libipw(struct net_device *dev, int monitor);
- struct net_device *alloc_libipw(int sizeof_priv, int monitor);
-+int libipw_change_mtu(struct net_device *dev, int new_mtu);
- 
- void libipw_networks_age(struct libipw_device *ieee, unsigned long age_secs);
- 
---- a/drivers/net/wireless/intel/ipw2x00/libipw_module.c
-+++ b/drivers/net/wireless/intel/ipw2x00/libipw_module.c
-@@ -118,6 +118,15 @@ static void libipw_networks_initialize(s
- 			      &ieee->network_free_list);
- }
- 
-+int libipw_change_mtu(struct net_device *dev, int new_mtu)
-+{
-+	if ((new_mtu < 68) || (new_mtu > LIBIPW_DATA_LEN))
-+		return -EINVAL;
-+	dev->mtu = new_mtu;
-+	return 0;
-+}
-+EXPORT_SYMBOL(libipw_change_mtu);
-+
- struct net_device *alloc_libipw(int sizeof_priv, int monitor)
- {
- 	struct libipw_device *ieee;
---- a/drivers/net/wireless/intersil/hostap/hostap_main.c
-+++ b/drivers/net/wireless/intersil/hostap/hostap_main.c
-@@ -765,6 +765,16 @@ static void hostap_set_multicast_list(st
- }
- 
- 
-+static int prism2_change_mtu(struct net_device *dev, int new_mtu)
-+{
-+	if (new_mtu < PRISM2_MIN_MTU || new_mtu > PRISM2_MAX_MTU)
-+		return -EINVAL;
-+
-+	dev->mtu = new_mtu;
-+	return 0;
-+}
-+
-+
- static void prism2_tx_timeout(struct net_device *dev)
- {
- 	struct hostap_interface *iface;
-@@ -803,6 +813,7 @@ static const struct net_device_ops hosta
- 	.ndo_do_ioctl		= hostap_ioctl,
- 	.ndo_set_mac_address	= prism2_set_mac_address,
- 	.ndo_set_rx_mode	= hostap_set_multicast_list,
-+	.ndo_change_mtu 	= prism2_change_mtu,
- 	.ndo_tx_timeout 	= prism2_tx_timeout,
- 	.ndo_validate_addr	= eth_validate_addr,
- };
-@@ -815,6 +826,7 @@ static const struct net_device_ops hosta
- 	.ndo_do_ioctl		= hostap_ioctl,
- 	.ndo_set_mac_address	= prism2_set_mac_address,
- 	.ndo_set_rx_mode	= hostap_set_multicast_list,
-+	.ndo_change_mtu 	= prism2_change_mtu,
- 	.ndo_tx_timeout 	= prism2_tx_timeout,
- 	.ndo_validate_addr	= eth_validate_addr,
- };
-@@ -827,6 +839,7 @@ static const struct net_device_ops hosta
- 	.ndo_do_ioctl		= hostap_ioctl,
- 	.ndo_set_mac_address	= prism2_set_mac_address,
- 	.ndo_set_rx_mode	= hostap_set_multicast_list,
-+	.ndo_change_mtu 	= prism2_change_mtu,
- 	.ndo_tx_timeout 	= prism2_tx_timeout,
- 	.ndo_validate_addr	= eth_validate_addr,
- };
-@@ -838,8 +851,6 @@ void hostap_setup_dev(struct net_device
- 
- 	iface = netdev_priv(dev);
- 	ether_setup(dev);
--	dev->min_mtu = PRISM2_MIN_MTU;
--	dev->max_mtu = PRISM2_MAX_MTU;
- 	dev->priv_flags &= ~IFF_TX_SKB_SHARING;
- 
- 	/* kernel callbacks */
---- a/drivers/net/wireless/intersil/orinoco/main.c
-+++ b/drivers/net/wireless/intersil/orinoco/main.c
-@@ -322,6 +322,9 @@ int orinoco_change_mtu(struct net_device
- {
- 	struct orinoco_private *priv = ndev_priv(dev);
- 
-+	if ((new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU))
-+		return -EINVAL;
-+
- 	/* MTU + encapsulation + header length */
- 	if ((new_mtu + ENCAPS_OVERHEAD + sizeof(struct ieee80211_hdr)) >
- 	     (priv->nicbuf_size - ETH_HLEN))
-@@ -2285,9 +2288,6 @@ int orinoco_if_add(struct orinoco_privat
- 	dev->base_addr = base_addr;
- 	dev->irq = irq;
- 
--	dev->min_mtu = ORINOCO_MIN_MTU;
--	dev->max_mtu = ORINOCO_MAX_MTU;
--
- 	SET_NETDEV_DEV(dev, priv->dev);
- 	ret = register_netdev(dev);
- 	if (ret)
diff --git a/package/kernel/mac80211/patches/010-disable_rfkill.patch b/package/kernel/mac80211/patches/010-disable_rfkill.patch
index 2902e498d8..d5253063ce 100644
--- a/package/kernel/mac80211/patches/010-disable_rfkill.patch
+++ b/package/kernel/mac80211/patches/010-disable_rfkill.patch
@@ -10,6 +10,6 @@
 +#undef CONFIG_RFKILL_MODULE
 +#undef CONFIG_RFKILL_FULL_MODULE
 +
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ #if LINUX_VERSION_IS_GEQ(3,10,0)
  #include_next <linux/rfkill.h>
  #else
diff --git a/package/kernel/mac80211/patches/011-backport_strscpy.patch b/package/kernel/mac80211/patches/011-backport_strscpy.patch
deleted file mode 100644
index c8e26c46f2..0000000000
--- a/package/kernel/mac80211/patches/011-backport_strscpy.patch
+++ /dev/null
@@ -1,43 +0,0 @@
---- a/backport-include/linux/string.h
-+++ b/backport-include/linux/string.h
-@@ -25,4 +25,8 @@ extern void *memdup_user_nul(const void
- void memzero_explicit(void *s, size_t count);
- #endif
- 
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0))
-+ssize_t strscpy(char *dest, const char *src, size_t count);
-+#endif
-+
- #endif /* __BACKPORT_LINUX_STRING_H */
---- a/compat/backport-4.3.c
-+++ b/compat/backport-4.3.c
-@@ -57,3 +57,29 @@ void seq_hex_dump(struct seq_file *m, co
- 	}
- }
- EXPORT_SYMBOL_GPL(seq_hex_dump);
-+
-+ssize_t strscpy(char *dest, const char *src, size_t count)
-+{
-+	long res = 0;
-+
-+	if (count == 0)
-+		return -E2BIG;
-+
-+	while (count) {
-+		char c;
-+
-+		c = src[res];
-+		dest[res] = c;
-+		if (!c)
-+			return res;
-+		res++;
-+		count--;
-+	}
-+
-+	/* Hit buffer length without finding a NUL; force NUL-termination. */
-+	if (res)
-+		dest[res-1] = '\0';
-+
-+	return -E2BIG;
-+}
-+EXPORT_SYMBOL_GPL(strscpy);
diff --git a/package/kernel/mac80211/patches/013-backport-dev_coredumpm-function.patch b/package/kernel/mac80211/patches/013-backport-dev_coredumpm-function.patch
deleted file mode 100644
index 2c80aedc48..0000000000
--- a/package/kernel/mac80211/patches/013-backport-dev_coredumpm-function.patch
+++ /dev/null
@@ -1,156 +0,0 @@
-From ec8549e611465558bdf1bb5e9d308f39e5e248cd Mon Sep 17 00:00:00 2001
-From: Hauke Mehrtens <hauke@hauke-m.de>
-Date: Sun, 17 Sep 2017 14:41:48 +0200
-Subject: backport dev_coredumpm() function
-
-This is copied from a more recent backports version to add the
-dev_coredumpm() function when the internal core devdump is not used.
----
- compat/Makefile                |  1 +
- compat/backport-4.7.c          | 82 ++++++++++++++++++++++++++++++++++++++++++
- include/linux/bp-devcoredump.h | 32 +++++++++++++++++
- include/linux/devcoredump.h    |  1 +
- 4 files changed, 116 insertions(+)
- create mode 100644 compat/backport-4.7.c
- create mode 100644 include/linux/bp-devcoredump.h
-
---- a/compat/Makefile
-+++ b/compat/Makefile
-@@ -32,6 +32,7 @@ compat-$(CPTCFG_KERNEL_4_3) += backport-
- compat-$(CPTCFG_KERNEL_4_4) += backport-4.4.o
- compat-$(CPTCFG_KERNEL_4_5) += backport-4.5.o
- compat-$(CPTCFG_KERNEL_4_6) += backport-4.6.o
-+compat-$(CPTCFG_KERNEL_4_6) += backport-4.7.o
- 
- compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
- compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
---- /dev/null
-+++ b/compat/backport-4.7.c
-@@ -0,0 +1,82 @@
-+/*
-+ * Copyright(c) 2016 Hauke Mehrtens <hauke@hauke-m.de>
-+ *
-+ * Backport functionality introduced in Linux 4.7.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+
-+#include <linux/export.h>
-+#include <linux/list.h>
-+#include <linux/rcupdate.h>
-+#include <linux/slab.h>
-+#include <linux/spinlock.h>
-+#include <linux/skbuff.h>
-+#include <net/netlink.h>
-+
-+/*
-+ * Below 3.18 or if the kernel has devcoredump disabled, we copied the
-+ * entire devcoredump, so no need to define these functions.
-+ */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) && \
-+	!defined(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP)
-+#include <linux/devcoredump.h>
-+#include <linux/scatterlist.h>
-+
-+static void devcd_free_sgtable(void *data)
-+{
-+	struct scatterlist *table = data;
-+	int i;
-+	struct page *page;
-+	struct scatterlist *iter;
-+	struct scatterlist *delete_iter;
-+
-+	/* free pages */
-+	iter = table;
-+	for_each_sg(table, iter, sg_nents(table), i) {
-+		page = sg_page(iter);
-+		if (page)
-+			__free_page(page);
-+	}
-+
-+	/* then free all chained tables */
-+	iter = table;
-+	delete_iter = table;	/* always points on a head of a table */
-+	while (!sg_is_last(iter)) {
-+		iter++;
-+		if (sg_is_chain(iter)) {
-+			iter = sg_chain_ptr(iter);
-+			kfree(delete_iter);
-+			delete_iter = iter;
-+		}
-+	}
-+
-+	/* free the last table */
-+	kfree(delete_iter);
-+}
-+
-+static ssize_t devcd_read_from_sgtable(char *buffer, loff_t offset,
-+				       size_t buf_len, void *data,
-+				       size_t data_len)
-+{
-+	struct scatterlist *table = data;
-+
-+	if (offset > data_len)
-+		return -EINVAL;
-+
-+	if (offset + buf_len > data_len)
-+		buf_len = data_len - offset;
-+	return sg_pcopy_to_buffer(table, sg_nents(table), buffer, buf_len,
-+				  offset);
-+}
-+
-+void dev_coredumpsg(struct device *dev, struct scatterlist *table,
-+		    size_t datalen, gfp_t gfp)
-+{
-+	dev_coredumpm(dev, THIS_MODULE, table, datalen, gfp,
-+		      devcd_read_from_sgtable, devcd_free_sgtable);
-+}
-+EXPORT_SYMBOL_GPL(dev_coredumpsg);
-+#endif /* >= 3.18.0 */
---- /dev/null
-+++ b/include/linux/bp-devcoredump.h
-@@ -0,0 +1,32 @@
-+#ifndef __BACKPORT_LINUX_DEVCOREDUMP_H
-+#define __BACKPORT_LINUX_DEVCOREDUMP_H
-+#include <linux/version.h>
-+#include <linux/scatterlist.h>
-+
-+/* We only need to add our wrapper inside the range from 3.18 until
-+ * 4.6, outside that we can let our BPAUTO mechanism handle it.
-+ */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)  &&	\
-+     LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0))
-+static inline
-+void backport_dev_coredumpm(struct device *dev, struct module *owner,
-+			    void *data, size_t datalen, gfp_t gfp,
-+			    ssize_t (*read_fn)(char *buffer, loff_t offset,
-+					    size_t count, void *data,
-+					    size_t datalen),
-+			    void (*free_fn)(void *data))
-+{
-+	return dev_coredumpm(dev, owner, (const void *)data, datalen, gfp,
-+			     (void *)read_fn, (void *)free_fn);
-+}
-+
-+#define dev_coredumpm LINUX_BACKPORT(dev_coredumpm)
-+
-+#define dev_coredumpsg LINUX_BACKPORT(dev_coredumpsg)
-+void dev_coredumpsg(struct device *dev, struct scatterlist *table,
-+		    size_t datalen, gfp_t gfp);
-+
-+#endif /* (LINUX_VERSION_IS_GEQ(3,18,0) &&	\
-+	   LINUX_VERSION_IS_LESS(4,7,0)) */
-+
-+#endif /* __BACKPORT_LINUX_DEVCOREDUMP_H */
---- a/include/linux/devcoredump.h
-+++ b/include/linux/devcoredump.h
-@@ -1,6 +1,7 @@
- /* Automatically created during backport process */
- #ifndef CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP
- #include_next <linux/devcoredump.h>
-+#include <linux/bp-devcoredump.h>
- #else
- #undef dev_coredumpv
- #define dev_coredumpv LINUX_BACKPORT(dev_coredumpv)
diff --git a/package/kernel/mac80211/patches/015-ipw200-mtu.patch b/package/kernel/mac80211/patches/015-ipw200-mtu.patch
new file mode 100644
index 0000000000..8d273a095b
--- /dev/null
+++ b/package/kernel/mac80211/patches/015-ipw200-mtu.patch
@@ -0,0 +1,34 @@
+--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
++++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+@@ -11506,6 +11506,15 @@ static const struct attribute_group ipw_
+ 	.attrs = ipw_sysfs_entries,
+ };
+ 
++#if LINUX_VERSION_IS_LESS(4,10,0)
++static int __change_mtu(struct net_device *ndev, int new_mtu){
++	if (new_mtu < 68 || new_mtu > LIBIPW_DATA_LEN)
++		return -EINVAL;
++	ndev->mtu = new_mtu;
++	return 0;
++}
++#endif
++
+ #ifdef CPTCFG_IPW2200_PROMISCUOUS
+ static int ipw_prom_open(struct net_device *dev)
+ {
+@@ -11554,15 +11563,6 @@ static netdev_tx_t ipw_prom_hard_start_x
+ 	return NETDEV_TX_OK;
+ }
+ 
+-#if LINUX_VERSION_IS_LESS(4,10,0)
+-static int __change_mtu(struct net_device *ndev, int new_mtu){
+-	if (new_mtu < 68 || new_mtu > LIBIPW_DATA_LEN)
+-		return -EINVAL;
+-	ndev->mtu = new_mtu;
+-	return 0;
+-}
+-#endif
+-
+ static const struct net_device_ops ipw_prom_netdev_ops = {
+ #if LINUX_VERSION_IS_LESS(4,10,0)
+ 	.ndo_change_mtu = __change_mtu,
diff --git a/package/kernel/mac80211/patches/020-01-rt2x00-avoid-introducing-a-USB-dependency-in-the-rt2.patch b/package/kernel/mac80211/patches/020-01-rt2x00-avoid-introducing-a-USB-dependency-in-the-rt2.patch
deleted file mode 100644
index cf551fde02..0000000000
--- a/package/kernel/mac80211/patches/020-01-rt2x00-avoid-introducing-a-USB-dependency-in-the-rt2.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 6232c17438ed01f43665197db5a98a4a4f77ef47 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Thu, 2 Feb 2017 10:57:40 +0100
-Subject: [PATCH 01/19] rt2x00: avoid introducing a USB dependency in the
- rt2x00lib module
-
-As reported by Felix:
-
-Though protected by an ifdef, introducing an usb symbol dependency in
-the rt2x00lib module is a major inconvenience for distributions that
-package kernel modules split into individual packages.
-
-Get rid of this unnecessary dependency by calling the usb related
-function from a more suitable place.
-
-Cc: Vishal Thanki <vishalthanki@gmail.com>
-Reported-by: Felix Fietkau <nbd@nbd.name>
-Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 23 ++++++++---------------
- drivers/net/wireless/ralink/rt2x00/rt2x00usb.c |  5 +++++
- 2 files changed, 13 insertions(+), 15 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1436,21 +1436,6 @@ void rt2x00lib_remove_dev(struct rt2x00_
- 	cancel_work_sync(&rt2x00dev->intf_work);
- 	cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
- 	cancel_work_sync(&rt2x00dev->sleep_work);
--#if IS_ENABLED(CPTCFG_RT2X00_LIB_USB)
--	if (rt2x00_is_usb(rt2x00dev)) {
--		usb_kill_anchored_urbs(rt2x00dev->anchor);
--		hrtimer_cancel(&rt2x00dev->txstatus_timer);
--		cancel_work_sync(&rt2x00dev->rxdone_work);
--		cancel_work_sync(&rt2x00dev->txdone_work);
--	}
--#endif
--	if (rt2x00dev->workqueue)
--		destroy_workqueue(rt2x00dev->workqueue);
--
--	/*
--	 * Free the tx status fifo.
--	 */
--	kfifo_free(&rt2x00dev->txstatus_fifo);
- 
- 	/*
- 	 * Kill the tx status tasklet.
-@@ -1466,6 +1451,14 @@ void rt2x00lib_remove_dev(struct rt2x00_
- 	 */
- 	rt2x00lib_uninitialize(rt2x00dev);
- 
-+	if (rt2x00dev->workqueue)
-+		destroy_workqueue(rt2x00dev->workqueue);
-+
-+	/*
-+	 * Free the tx status fifo.
-+	 */
-+	kfifo_free(&rt2x00dev->txstatus_fifo);
-+
- 	/*
- 	 * Free extra components
- 	 */
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
-@@ -744,6 +744,11 @@ void rt2x00usb_uninitialize(struct rt2x0
- {
- 	struct data_queue *queue;
- 
-+	usb_kill_anchored_urbs(rt2x00dev->anchor);
-+	hrtimer_cancel(&rt2x00dev->txstatus_timer);
-+	cancel_work_sync(&rt2x00dev->rxdone_work);
-+	cancel_work_sync(&rt2x00dev->txdone_work);
-+
- 	queue_for_each(rt2x00dev, queue)
- 		rt2x00usb_free_entries(queue);
- }
diff --git a/package/kernel/mac80211/patches/020-02-rt2x00usb-do-not-anchor-rx-and-tx-urb-s.patch b/package/kernel/mac80211/patches/020-02-rt2x00usb-do-not-anchor-rx-and-tx-urb-s.patch
deleted file mode 100644
index d096b64a8a..0000000000
--- a/package/kernel/mac80211/patches/020-02-rt2x00usb-do-not-anchor-rx-and-tx-urb-s.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 93c7018ec16bb83399dd4db61c361a6d6aba0d5a Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 8 Feb 2017 12:18:09 +0100
-Subject: [PATCH 02/19] rt2x00usb: do not anchor rx and tx urb's
-
-We might kill TX or RX urb during rt2x00usb_flush_entry(), what can
-cause anchor list corruption like shown below:
-
-[ 2074.035633] WARNING: CPU: 2 PID: 14480 at lib/list_debug.c:33 __list_add+0xac/0xc0
-[ 2074.035634] list_add corruption. prev->next should be next (ffff88020f362c28), but was dead000000000100. (prev=ffff8801d161bb70).
-<snip>
-[ 2074.035670] Call Trace:
-[ 2074.035672]  [<ffffffff813bde47>] dump_stack+0x63/0x8c
-[ 2074.035674]  [<ffffffff810a2231>] __warn+0xd1/0xf0
-[ 2074.035676]  [<ffffffff810a22af>] warn_slowpath_fmt+0x5f/0x80
-[ 2074.035678]  [<ffffffffa073855d>] ? rt2x00usb_register_write_lock+0x3d/0x60 [rt2800usb]
-[ 2074.035679]  [<ffffffff813dbe4c>] __list_add+0xac/0xc0
-[ 2074.035681]  [<ffffffff81591c6c>] usb_anchor_urb+0x4c/0xa0
-[ 2074.035683]  [<ffffffffa07322af>] rt2x00usb_kick_rx_entry+0xaf/0x100 [rt2x00usb]
-[ 2074.035684]  [<ffffffffa0732322>] rt2x00usb_clear_entry+0x22/0x30 [rt2x00usb]
-
-To fix do not anchor TX and RX urb's, it is not needed as during
-shutdown we kill those urbs in rt2x00usb_free_entries().
-
-Cc: Vishal Thanki <vishalthanki@gmail.com>
-Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 4 ----
- 1 file changed, 4 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
-@@ -319,10 +319,8 @@ static bool rt2x00usb_kick_tx_entry(stru
- 			  entry->skb->data, length,
- 			  rt2x00usb_interrupt_txdone, entry);
- 
--	usb_anchor_urb(entry_priv->urb, rt2x00dev->anchor);
- 	status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
- 	if (status) {
--		usb_unanchor_urb(entry_priv->urb);
- 		if (status == -ENODEV)
- 			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
- 		set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
-@@ -410,10 +408,8 @@ static bool rt2x00usb_kick_rx_entry(stru
- 			  entry->skb->data, entry->skb->len,
- 			  rt2x00usb_interrupt_rxdone, entry);
- 
--	usb_anchor_urb(entry_priv->urb, rt2x00dev->anchor);
- 	status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
- 	if (status) {
--		usb_unanchor_urb(entry_priv->urb);
- 		if (status == -ENODEV)
- 			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
- 		set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
diff --git a/package/kernel/mac80211/patches/020-03-rt2x00usb-fix-anchor-initialization.patch b/package/kernel/mac80211/patches/020-03-rt2x00usb-fix-anchor-initialization.patch
deleted file mode 100644
index 5ff73df2a6..0000000000
--- a/package/kernel/mac80211/patches/020-03-rt2x00usb-fix-anchor-initialization.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From 0488a6121dfe6cbd44de15ea3627913b7549a1e9 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 8 Feb 2017 12:18:10 +0100
-Subject: [PATCH 03/19] rt2x00usb: fix anchor initialization
-
-If device fail to initialize we can OOPS in rt2x00lib_remove_dev(), due
-to using uninitialized usb_anchor structure:
-
-[  855.435820] ieee80211 phy3: rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x1000 with error -19
-[  855.435826] ieee80211 phy3: rt2800_probe_rt: Error - Invalid RT chipset 0x0000, rev 0000 detected
-[  855.435829] ieee80211 phy3: rt2x00lib_probe_dev: Error - Failed to allocate device
-[  855.435845] BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
-[  855.435900] IP: _raw_spin_lock_irq+0xd/0x30
-[  855.435926] PGD 0
-[  855.435953] Oops: 0002 [#1] SMP
-<snip>
-[  855.437011] Call Trace:
-[  855.437029]  ? usb_kill_anchored_urbs+0x27/0xc0
-[  855.437061]  rt2x00lib_remove_dev+0x190/0x1c0 [rt2x00lib]
-[  855.437097]  rt2x00lib_probe_dev+0x246/0x7a0 [rt2x00lib]
-[  855.437149]  ? ieee80211_roc_setup+0x9e/0xd0 [mac80211]
-[  855.437183]  ? __kmalloc+0x1af/0x1f0
-[  855.437207]  ? rt2x00usb_probe+0x13d/0xc50 [rt2x00usb]
-[  855.437240]  rt2x00usb_probe+0x155/0xc50 [rt2x00usb]
-[  855.437273]  rt2800usb_probe+0x15/0x20 [rt2800usb]
-[  855.437304]  usb_probe_interface+0x159/0x2d0
-[  855.437333]  driver_probe_device+0x2bb/0x460
-
-Patch changes initialization sequence to fix the problem.
-
-Cc: Vishal Thanki <vishalthanki@gmail.com>
-Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
-@@ -825,10 +825,6 @@ int rt2x00usb_probe(struct usb_interface
- 	if (retval)
- 		goto exit_free_device;
- 
--	retval = rt2x00lib_probe_dev(rt2x00dev);
--	if (retval)
--		goto exit_free_reg;
--
- 	rt2x00dev->anchor = devm_kmalloc(&usb_dev->dev,
- 					sizeof(struct usb_anchor),
- 					GFP_KERNEL);
-@@ -836,10 +832,17 @@ int rt2x00usb_probe(struct usb_interface
- 		retval = -ENOMEM;
- 		goto exit_free_reg;
- 	}
--
- 	init_usb_anchor(rt2x00dev->anchor);
-+
-+	retval = rt2x00lib_probe_dev(rt2x00dev);
-+	if (retval)
-+		goto exit_free_anchor;
-+
- 	return 0;
- 
-+exit_free_anchor:
-+	usb_kill_anchored_urbs(rt2x00dev->anchor);
-+
- exit_free_reg:
- 	rt2x00usb_free_reg(rt2x00dev);
- 
diff --git a/package/kernel/mac80211/patches/020-04-rt61pci-use-entry-directly.patch b/package/kernel/mac80211/patches/020-04-rt61pci-use-entry-directly.patch
deleted file mode 100644
index 274d8f7c3f..0000000000
--- a/package/kernel/mac80211/patches/020-04-rt61pci-use-entry-directly.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From 80a97eae304631f57ff8560f87c0b18b95321443 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 8 Feb 2017 13:51:29 +0100
-Subject: [PATCH 04/19] rt61pci: use entry directly
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt61pci.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
-@@ -1903,8 +1903,7 @@ static void rt61pci_write_tx_desc(struct
- 
- 	rt2x00_desc_read(txd, 5, &word);
- 	rt2x00_set_field32(&word, TXD_W5_PID_TYPE, entry->queue->qid);
--	rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE,
--			   skbdesc->entry->entry_idx);
-+	rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE, entry->entry_idx);
- 	rt2x00_set_field32(&word, TXD_W5_TX_POWER,
- 			   TXPOWER_TO_DEV(entry->queue->rt2x00dev->tx_power));
- 	rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1);
diff --git a/package/kernel/mac80211/patches/020-05-rt2x00-call-entry-directly-in-rt2x00_dump_frame.patch b/package/kernel/mac80211/patches/020-05-rt2x00-call-entry-directly-in-rt2x00_dump_frame.patch
deleted file mode 100644
index 241c1127bc..0000000000
--- a/package/kernel/mac80211/patches/020-05-rt2x00-call-entry-directly-in-rt2x00_dump_frame.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-From 2ceb813798e1fd33e71a574771828c0f298e077b Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 8 Feb 2017 13:51:30 +0100
-Subject: [PATCH 05/19] rt2x00: call entry directly in rt2x00_dump_frame
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2400pci.c   | 2 +-
- drivers/net/wireless/ralink/rt2x00/rt2500pci.c   | 2 +-
- drivers/net/wireless/ralink/rt2x00/rt2500usb.c   | 2 +-
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c   | 2 +-
- drivers/net/wireless/ralink/rt2x00/rt2x00.h      | 4 ++--
- drivers/net/wireless/ralink/rt2x00/rt2x00debug.c | 7 ++++---
- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c   | 4 ++--
- drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 2 +-
- drivers/net/wireless/ralink/rt2x00/rt61pci.c     | 2 +-
- drivers/net/wireless/ralink/rt2x00/rt73usb.c     | 2 +-
- 10 files changed, 15 insertions(+), 14 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
-@@ -1200,7 +1200,7 @@ static void rt2400pci_write_beacon(struc
- 	/*
- 	 * Dump beacon to userspace through debugfs.
- 	 */
--	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
-+	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry);
- out:
- 	/*
- 	 * Enable beaconing again.
---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
-@@ -1349,7 +1349,7 @@ static void rt2500pci_write_beacon(struc
- 	/*
- 	 * Dump beacon to userspace through debugfs.
- 	 */
--	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
-+	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry);
- out:
- 	/*
- 	 * Enable beaconing again.
---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
-@@ -1170,7 +1170,7 @@ static void rt2500usb_write_beacon(struc
- 	/*
- 	 * Dump beacon to userspace through debugfs.
- 	 */
--	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
-+	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry);
- 
- 	/*
- 	 * USB devices cannot blindly pass the skb->len as the
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -1014,7 +1014,7 @@ void rt2800_write_beacon(struct queue_en
- 	/*
- 	 * Dump beacon to userspace through debugfs.
- 	 */
--	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
-+	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry);
- 
- 	/*
- 	 * Write entire beacon with TXWI and padding to register.
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -1400,11 +1400,11 @@ void rt2x00queue_flush_queues(struct rt2
-  */
- #ifdef CPTCFG_RT2X00_LIB_DEBUGFS
- void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
--			    enum rt2x00_dump_type type, struct sk_buff *skb);
-+			    enum rt2x00_dump_type type, struct queue_entry *entry);
- #else
- static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
- 					  enum rt2x00_dump_type type,
--					  struct sk_buff *skb)
-+					  struct queue_entry *entry)
- {
- }
- #endif /* CPTCFG_RT2X00_LIB_DEBUGFS */
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
-@@ -157,9 +157,10 @@ void rt2x00debug_update_crypto(struct rt
- }
- 
- void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
--			    enum rt2x00_dump_type type, struct sk_buff *skb)
-+			    enum rt2x00_dump_type type, struct queue_entry *entry)
- {
- 	struct rt2x00debug_intf *intf = rt2x00dev->debugfs_intf;
-+	struct sk_buff *skb = entry->skb;
- 	struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
- 	struct sk_buff *skbcopy;
- 	struct rt2x00dump_hdr *dump_hdr;
-@@ -196,8 +197,8 @@ void rt2x00debug_dump_frame(struct rt2x0
- 	dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf);
- 	dump_hdr->chip_rev = cpu_to_le16(rt2x00dev->chip.rev);
- 	dump_hdr->type = cpu_to_le16(type);
--	dump_hdr->queue_index = skbdesc->entry->queue->qid;
--	dump_hdr->entry_index = skbdesc->entry->entry_idx;
-+	dump_hdr->queue_index = entry->queue->qid;
-+	dump_hdr->entry_index = entry->entry_idx;
- 	dump_hdr->timestamp_sec = cpu_to_le32(timestamp.tv_sec);
- 	dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_usec);
- 
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -363,7 +363,7 @@ void rt2x00lib_txdone(struct queue_entry
- 	 * Send frame to debugfs immediately, after this call is completed
- 	 * we are going to overwrite the skb->cb array.
- 	 */
--	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry->skb);
-+	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
- 
- 	/*
- 	 * Determine if the frame has been successfully transmitted and
-@@ -772,7 +772,7 @@ void rt2x00lib_rxdone(struct queue_entry
- 	 */
- 	rt2x00link_update_stats(rt2x00dev, entry->skb, &rxdesc);
- 	rt2x00debug_update_crypto(rt2x00dev, &rxdesc);
--	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_RXDONE, entry->skb);
-+	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_RXDONE, entry);
- 
- 	/*
- 	 * Initialize RX status information, and send frame
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
-@@ -544,7 +544,7 @@ static void rt2x00queue_write_tx_descrip
- 	 * All processing on the frame has been completed, this means
- 	 * it is now ready to be dumped to userspace through debugfs.
- 	 */
--	rt2x00debug_dump_frame(queue->rt2x00dev, DUMP_FRAME_TX, entry->skb);
-+	rt2x00debug_dump_frame(queue->rt2x00dev, DUMP_FRAME_TX, entry);
- }
- 
- static void rt2x00queue_kick_tx_queue(struct data_queue *queue,
---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
-@@ -1988,7 +1988,7 @@ static void rt61pci_write_beacon(struct
- 	/*
- 	 * Dump beacon to userspace through debugfs.
- 	 */
--	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
-+	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry);
- 
- 	/*
- 	 * Write entire beacon with descriptor and padding to register.
---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
-@@ -1557,7 +1557,7 @@ static void rt73usb_write_beacon(struct
- 	/*
- 	 * Dump beacon to userspace through debugfs.
- 	 */
--	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
-+	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry);
- 
- 	/*
- 	 * Write entire beacon with descriptor and padding to register.
diff --git a/package/kernel/mac80211/patches/020-06-rt2x00-remove-queue_entry-from-skbdesc.patch b/package/kernel/mac80211/patches/020-06-rt2x00-remove-queue_entry-from-skbdesc.patch
deleted file mode 100644
index c2ef9c1bb0..0000000000
--- a/package/kernel/mac80211/patches/020-06-rt2x00-remove-queue_entry-from-skbdesc.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From cf81db30a6edcca791b1bfa5348a162471121d11 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 8 Feb 2017 13:51:31 +0100
-Subject: [PATCH 06/19] rt2x00: remove queue_entry from skbdesc
-
-queue_entry field of skbdesc is not read any more, remove it to allow
-skbdesc contain other data.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 3 ---
- drivers/net/wireless/ralink/rt2x00/rt2x00queue.h | 2 --
- 2 files changed, 5 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
-@@ -83,7 +83,6 @@ struct sk_buff *rt2x00queue_alloc_rxskb(
- 	 */
- 	skbdesc = get_skb_frame_desc(skb);
- 	memset(skbdesc, 0, sizeof(*skbdesc));
--	skbdesc->entry = entry;
- 
- 	if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DMA)) {
- 		dma_addr_t skb_dma;
-@@ -689,7 +688,6 @@ int rt2x00queue_write_tx_frame(struct da
- 		goto out;
- 	}
- 
--	skbdesc->entry = entry;
- 	entry->skb = skb;
- 
- 	/*
-@@ -774,7 +772,6 @@ int rt2x00queue_update_beacon(struct rt2
- 	 */
- 	skbdesc = get_skb_frame_desc(intf->beacon->skb);
- 	memset(skbdesc, 0, sizeof(*skbdesc));
--	skbdesc->entry = intf->beacon;
- 
- 	/*
- 	 * Send beacon to hardware.
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
-@@ -116,8 +116,6 @@ struct skb_frame_desc {
- 	__le32 iv[2];
- 
- 	dma_addr_t skb_dma;
--
--	struct queue_entry *entry;
- };
- 
- /**
diff --git a/package/kernel/mac80211/patches/020-07-rt2500usb-don-t-mark-register-accesses-as-inline.patch b/package/kernel/mac80211/patches/020-07-rt2500usb-don-t-mark-register-accesses-as-inline.patch
deleted file mode 100644
index 65496ca467..0000000000
--- a/package/kernel/mac80211/patches/020-07-rt2500usb-don-t-mark-register-accesses-as-inline.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 7272416609126e8910b7f0d0e3dba008aa87830c Mon Sep 17 00:00:00 2001
-From: Arnd Bergmann <arnd@arndb.de>
-Date: Tue, 14 Feb 2017 22:28:33 +0100
-Subject: [PATCH 07/19] rt2500usb: don't mark register accesses as inline
-
-When CONFIG_KASAN is set, we get a rather large stack here:
-
-drivers/net/wireless/ralink/rt2x00/rt2500usb.c: In function 'rt2500usb_set_device_state':
-drivers/net/wireless/ralink/rt2x00/rt2500usb.c:1074:1: error: the frame size of 3032 bytes is larger than 100 bytes [-Werror=frame-larger-than=]
-
-If we don't force those functions to be inline, the compiler can figure this
-out better itself and not inline the functions when doing so would be harmful,
-reducing the stack size to a merge 256 bytes.
-
-Note that there is another problem that manifests in this driver, as a result
-of the typecheck() macro causing even larger stack frames.
-
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2500usb.c | 19 +++++--------------
- 1 file changed, 5 insertions(+), 14 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
-@@ -55,7 +55,7 @@ MODULE_PARM_DESC(nohwcrypt, "Disable har
-  * If the csr_mutex is already held then the _lock variants must
-  * be used instead.
-  */
--static inline void rt2500usb_register_read(struct rt2x00_dev *rt2x00dev,
-+static void rt2500usb_register_read(struct rt2x00_dev *rt2x00dev,
- 					   const unsigned int offset,
- 					   u16 *value)
- {
-@@ -66,7 +66,7 @@ static inline void rt2500usb_register_re
- 	*value = le16_to_cpu(reg);
- }
- 
--static inline void rt2500usb_register_read_lock(struct rt2x00_dev *rt2x00dev,
-+static void rt2500usb_register_read_lock(struct rt2x00_dev *rt2x00dev,
- 						const unsigned int offset,
- 						u16 *value)
- {
-@@ -77,16 +77,7 @@ static inline void rt2500usb_register_re
- 	*value = le16_to_cpu(reg);
- }
- 
--static inline void rt2500usb_register_multiread(struct rt2x00_dev *rt2x00dev,
--						const unsigned int offset,
--						void *value, const u16 length)
--{
--	rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ,
--				      USB_VENDOR_REQUEST_IN, offset,
--				      value, length);
--}
--
--static inline void rt2500usb_register_write(struct rt2x00_dev *rt2x00dev,
-+static void rt2500usb_register_write(struct rt2x00_dev *rt2x00dev,
- 					    const unsigned int offset,
- 					    u16 value)
- {
-@@ -96,7 +87,7 @@ static inline void rt2500usb_register_wr
- 				      &reg, sizeof(reg));
- }
- 
--static inline void rt2500usb_register_write_lock(struct rt2x00_dev *rt2x00dev,
-+static void rt2500usb_register_write_lock(struct rt2x00_dev *rt2x00dev,
- 						 const unsigned int offset,
- 						 u16 value)
- {
-@@ -106,7 +97,7 @@ static inline void rt2500usb_register_wr
- 				       &reg, sizeof(reg), REGISTER_TIMEOUT);
- }
- 
--static inline void rt2500usb_register_multiwrite(struct rt2x00_dev *rt2x00dev,
-+static void rt2500usb_register_multiwrite(struct rt2x00_dev *rt2x00dev,
- 						 const unsigned int offset,
- 						 void *value, const u16 length)
- {
diff --git a/package/kernel/mac80211/patches/020-08-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch b/package/kernel/mac80211/patches/020-08-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
deleted file mode 100644
index 8b61235e11..0000000000
--- a/package/kernel/mac80211/patches/020-08-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From 96609f366c6f792421e1939c5c834abbe24eb88a Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Wed, 15 Feb 2017 10:25:04 +0100
-Subject: [PATCH 08/19] rt2x00: rt2800lib: move rt2800_drv_data declaration
- into rt2800lib.h
-
-The rt2800_drv_data structure contains driver specific
-information. Move the declaration into the rt2800lib.h
-header which is a more logical place for it. Also fix
-the comment style to avoid checkpatch warning.
-
-The patch contains no functional changes, it is in
-preparation for the next patch.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800.h    | 25 -------------------------
- drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 23 +++++++++++++++++++++++
- 2 files changed, 23 insertions(+), 25 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
-@@ -2987,29 +2987,4 @@ enum rt2800_eeprom_word {
-  */
- #define BCN_TBTT_OFFSET 64
- 
--/*
-- * Hardware has 255 WCID table entries. First 32 entries are reserved for
-- * shared keys. Since parts of the pairwise key table might be shared with
-- * the beacon frame buffers 6 & 7 we could only use the first 222 entries.
-- */
--#define WCID_START	33
--#define WCID_END	222
--#define STA_IDS_SIZE	(WCID_END - WCID_START + 2)
--
--/*
-- * RT2800 driver data structure
-- */
--struct rt2800_drv_data {
--	u8 calibration_bw20;
--	u8 calibration_bw40;
--	u8 bbp25;
--	u8 bbp26;
--	u8 txmixer_gain_24g;
--	u8 txmixer_gain_5g;
--	u8 max_psdu;
--	unsigned int tbtt_tick;
--	unsigned int ampdu_factor_cnt[4];
--	DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
--};
--
- #endif /* RT2800_H */
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -20,6 +20,29 @@
- #ifndef RT2800LIB_H
- #define RT2800LIB_H
- 
-+/*
-+ * Hardware has 255 WCID table entries. First 32 entries are reserved for
-+ * shared keys. Since parts of the pairwise key table might be shared with
-+ * the beacon frame buffers 6 & 7 we could only use the first 222 entries.
-+ */
-+#define WCID_START	33
-+#define WCID_END	222
-+#define STA_IDS_SIZE	(WCID_END - WCID_START + 2)
-+
-+/* RT2800 driver data structure */
-+struct rt2800_drv_data {
-+	u8 calibration_bw20;
-+	u8 calibration_bw40;
-+	u8 bbp25;
-+	u8 bbp26;
-+	u8 txmixer_gain_24g;
-+	u8 txmixer_gain_5g;
-+	u8 max_psdu;
-+	unsigned int tbtt_tick;
-+	unsigned int ampdu_factor_cnt[4];
-+	DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
-+};
-+
- struct rt2800_ops {
- 	void (*register_read)(struct rt2x00_dev *rt2x00dev,
- 			      const unsigned int offset, u32 *value);
diff --git a/package/kernel/mac80211/patches/020-09-rt2800-identify-station-based-on-status-WCID.patch b/package/kernel/mac80211/patches/020-09-rt2800-identify-station-based-on-status-WCID.patch
deleted file mode 100644
index 922c35833c..0000000000
--- a/package/kernel/mac80211/patches/020-09-rt2800-identify-station-based-on-status-WCID.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From a13d985f26f6df07d5c5c0e190477628e236babc Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 15 Feb 2017 10:25:05 +0100
-Subject: [PATCH 09/19] rt2800: identify station based on status WCID
-
-Add framework to identify sta based on tx status WCID. This is currently
-not used, will start be utilized in the future patch.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c   | 5 +++++
- drivers/net/wireless/ralink/rt2x00/rt2800lib.h   | 1 +
- drivers/net/wireless/ralink/rt2x00/rt2x00queue.h | 3 ++-
- 3 files changed, 8 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -855,11 +855,13 @@ EXPORT_SYMBOL_GPL(rt2800_process_rxwi);
- void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi)
- {
- 	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
-+	struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
- 	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
- 	struct txdone_entry_desc txdesc;
- 	u32 word;
- 	u16 mcs, real_mcs;
- 	int aggr, ampdu;
-+	int wcid;
- 
- 	/*
- 	 * Obtain the status about this packet.
-@@ -872,6 +874,7 @@ void rt2800_txdone_entry(struct queue_en
- 
- 	real_mcs = rt2x00_get_field32(status, TX_STA_FIFO_MCS);
- 	aggr = rt2x00_get_field32(status, TX_STA_FIFO_TX_AGGRE);
-+	wcid = rt2x00_get_field32(status, TX_STA_FIFO_WCID);
- 
- 	/*
- 	 * If a frame was meant to be sent as a single non-aggregated MPDU
-@@ -1468,6 +1471,7 @@ int rt2800_sta_add(struct rt2x00_dev *rt
- 		return 0;
- 
- 	__set_bit(wcid - WCID_START, drv_data->sta_ids);
-+	drv_data->wcid_to_sta[wcid - WCID_START] = sta;
- 
- 	/*
- 	 * Clean up WCID attributes and write STA address to the device.
-@@ -1498,6 +1502,7 @@ int rt2800_sta_remove(struct rt2x00_dev
- 	 * get renewed when the WCID is reused.
- 	 */
- 	rt2800_config_wcid(rt2x00dev, NULL, wcid);
-+	drv_data->wcid_to_sta[wcid - WCID_START] = NULL;
- 	__clear_bit(wcid - WCID_START, drv_data->sta_ids);
- 
- 	return 0;
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -41,6 +41,7 @@ struct rt2800_drv_data {
- 	unsigned int tbtt_tick;
- 	unsigned int ampdu_factor_cnt[4];
- 	DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
-+	struct ieee80211_sta *wcid_to_sta[STA_IDS_SIZE];
- };
- 
- struct rt2800_ops {
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
-@@ -102,7 +102,7 @@ enum skb_frame_desc_flags {
-  *	of the scope of the skb->data pointer.
-  * @iv: IV/EIV data used during encryption/decryption.
-  * @skb_dma: (PCI-only) the DMA address associated with the sk buffer.
-- * @entry: The entry to which this sk buffer belongs.
-+ * @sta: The station where sk buffer was sent.
-  */
- struct skb_frame_desc {
- 	u8 flags;
-@@ -116,6 +116,7 @@ struct skb_frame_desc {
- 	__le32 iv[2];
- 
- 	dma_addr_t skb_dma;
-+	struct ieee80211_sta *sta;
- };
- 
- /**
diff --git a/package/kernel/mac80211/patches/020-10-rt2x00-separte-filling-tx-status-from-rt2x00lib_txdo.patch b/package/kernel/mac80211/patches/020-10-rt2x00-separte-filling-tx-status-from-rt2x00lib_txdo.patch
deleted file mode 100644
index 84f2732b22..0000000000
--- a/package/kernel/mac80211/patches/020-10-rt2x00-separte-filling-tx-status-from-rt2x00lib_txdo.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-From 5edb05afebba8f488a30db29550e55c42eea6d6a Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 15 Feb 2017 10:25:06 +0100
-Subject: [PATCH 10/19] rt2x00: separte filling tx status from rt2x00lib_txdone
-
-This makes rt2x00lib_txdone a bit simpler and will allow to reuse code
-in different variant of txdone which I'm preparing.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 141 +++++++++++++------------
- 1 file changed, 76 insertions(+), 65 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -313,73 +313,14 @@ static inline int rt2x00lib_txdone_bar_s
- 	return ret;
- }
- 
--void rt2x00lib_txdone(struct queue_entry *entry,
--		      struct txdone_entry_desc *txdesc)
-+static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,
-+				     struct ieee80211_tx_info *tx_info,
-+				     struct skb_frame_desc *skbdesc,
-+				     struct txdone_entry_desc *txdesc,
-+				     bool success)
- {
--	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
--	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
--	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
--	unsigned int header_length, i;
- 	u8 rate_idx, rate_flags, retry_rates;
--	u8 skbdesc_flags = skbdesc->flags;
--	bool success;
--
--	/*
--	 * Unmap the skb.
--	 */
--	rt2x00queue_unmap_skb(entry);
--
--	/*
--	 * Remove the extra tx headroom from the skb.
--	 */
--	skb_pull(entry->skb, rt2x00dev->extra_tx_headroom);
--
--	/*
--	 * Signal that the TX descriptor is no longer in the skb.
--	 */
--	skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
--
--	/*
--	 * Determine the length of 802.11 header.
--	 */
--	header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
--
--	/*
--	 * Remove L2 padding which was added during
--	 */
--	if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
--		rt2x00queue_remove_l2pad(entry->skb, header_length);
--
--	/*
--	 * If the IV/EIV data was stripped from the frame before it was
--	 * passed to the hardware, we should now reinsert it again because
--	 * mac80211 will expect the same data to be present it the
--	 * frame as it was passed to us.
--	 */
--	if (rt2x00_has_cap_hw_crypto(rt2x00dev))
--		rt2x00crypto_tx_insert_iv(entry->skb, header_length);
--
--	/*
--	 * Send frame to debugfs immediately, after this call is completed
--	 * we are going to overwrite the skb->cb array.
--	 */
--	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
--
--	/*
--	 * Determine if the frame has been successfully transmitted and
--	 * remove BARs from our check list while checking for their
--	 * TX status.
--	 */
--	success =
--	    rt2x00lib_txdone_bar_status(entry) ||
--	    test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
--	    test_bit(TXDONE_UNKNOWN, &txdesc->flags);
--
--	/*
--	 * Update TX statistics.
--	 */
--	rt2x00dev->link.qual.tx_success += success;
--	rt2x00dev->link.qual.tx_failed += !success;
-+	int i;
- 
- 	rate_idx = skbdesc->tx_rate_idx;
- 	rate_flags = skbdesc->tx_rate_flags;
-@@ -448,6 +389,76 @@ void rt2x00lib_txdone(struct queue_entry
- 		else
- 			rt2x00dev->low_level_stats.dot11RTSFailureCount++;
- 	}
-+}
-+
-+void rt2x00lib_txdone(struct queue_entry *entry,
-+		      struct txdone_entry_desc *txdesc)
-+{
-+	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
-+	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
-+	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
-+	u8 skbdesc_flags = skbdesc->flags;
-+	unsigned int header_length;
-+	bool success;
-+
-+	/*
-+	 * Unmap the skb.
-+	 */
-+	rt2x00queue_unmap_skb(entry);
-+
-+	/*
-+	 * Remove the extra tx headroom from the skb.
-+	 */
-+	skb_pull(entry->skb, rt2x00dev->extra_tx_headroom);
-+
-+	/*
-+	 * Signal that the TX descriptor is no longer in the skb.
-+	 */
-+	skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
-+
-+	/*
-+	 * Determine the length of 802.11 header.
-+	 */
-+	header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
-+
-+	/*
-+	 * Remove L2 padding which was added during
-+	 */
-+	if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
-+		rt2x00queue_remove_l2pad(entry->skb, header_length);
-+
-+	/*
-+	 * If the IV/EIV data was stripped from the frame before it was
-+	 * passed to the hardware, we should now reinsert it again because
-+	 * mac80211 will expect the same data to be present it the
-+	 * frame as it was passed to us.
-+	 */
-+	if (rt2x00_has_cap_hw_crypto(rt2x00dev))
-+		rt2x00crypto_tx_insert_iv(entry->skb, header_length);
-+
-+	/*
-+	 * Send frame to debugfs immediately, after this call is completed
-+	 * we are going to overwrite the skb->cb array.
-+	 */
-+	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
-+
-+	/*
-+	 * Determine if the frame has been successfully transmitted and
-+	 * remove BARs from our check list while checking for their
-+	 * TX status.
-+	 */
-+	success =
-+	    rt2x00lib_txdone_bar_status(entry) ||
-+	    test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
-+	    test_bit(TXDONE_UNKNOWN, &txdesc->flags);
-+
-+	/*
-+	 * Update TX statistics.
-+	 */
-+	rt2x00dev->link.qual.tx_success += success;
-+	rt2x00dev->link.qual.tx_failed += !success;
-+
-+	rt2x00lib_fill_tx_status(rt2x00dev, tx_info, skbdesc, txdesc, success);
- 
- 	/*
- 	 * Only send the status report to mac80211 when it's a frame
diff --git a/package/kernel/mac80211/patches/020-11-rt2x00-separte-clearing-entry-from-rt2x00lib_txdone.patch b/package/kernel/mac80211/patches/020-11-rt2x00-separte-clearing-entry-from-rt2x00lib_txdone.patch
deleted file mode 100644
index e1359397ba..0000000000
--- a/package/kernel/mac80211/patches/020-11-rt2x00-separte-clearing-entry-from-rt2x00lib_txdone.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From 56646adf9cd60b488ddc5633a2d9aa1f30efa5db Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 15 Feb 2017 10:25:07 +0100
-Subject: [PATCH 11/19] rt2x00: separte clearing entry from rt2x00lib_txdone
-
-This makes rt2x00lib_txdone a bit simpler and will allow to reuse
-code in different variant of txdone which I'm preparing.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 51 +++++++++++++++-----------
- 1 file changed, 29 insertions(+), 22 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -391,6 +391,32 @@ static void rt2x00lib_fill_tx_status(str
- 	}
- }
- 
-+static void rt2x00lib_clear_entry(struct rt2x00_dev *rt2x00dev,
-+				  struct queue_entry *entry)
-+{
-+	/*
-+	 * Make this entry available for reuse.
-+	 */
-+	entry->skb = NULL;
-+	entry->flags = 0;
-+
-+	rt2x00dev->ops->lib->clear_entry(entry);
-+
-+	rt2x00queue_index_inc(entry, Q_INDEX_DONE);
-+
-+	/*
-+	 * If the data queue was below the threshold before the txdone
-+	 * handler we must make sure the packet queue in the mac80211 stack
-+	 * is reenabled when the txdone handler has finished. This has to be
-+	 * serialized with rt2x00mac_tx(), otherwise we can wake up queue
-+	 * before it was stopped.
-+	 */
-+	spin_lock_bh(&entry->queue->tx_lock);
-+	if (!rt2x00queue_threshold(entry->queue))
-+		rt2x00queue_unpause_queue(entry->queue);
-+	spin_unlock_bh(&entry->queue->tx_lock);
-+}
-+
- void rt2x00lib_txdone(struct queue_entry *entry,
- 		      struct txdone_entry_desc *txdesc)
- {
-@@ -471,30 +497,11 @@ void rt2x00lib_txdone(struct queue_entry
- 			ieee80211_tx_status(rt2x00dev->hw, entry->skb);
- 		else
- 			ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
--	} else
-+	} else {
- 		dev_kfree_skb_any(entry->skb);
-+	}
- 
--	/*
--	 * Make this entry available for reuse.
--	 */
--	entry->skb = NULL;
--	entry->flags = 0;
--
--	rt2x00dev->ops->lib->clear_entry(entry);
--
--	rt2x00queue_index_inc(entry, Q_INDEX_DONE);
--
--	/*
--	 * If the data queue was below the threshold before the txdone
--	 * handler we must make sure the packet queue in the mac80211 stack
--	 * is reenabled when the txdone handler has finished. This has to be
--	 * serialized with rt2x00mac_tx(), otherwise we can wake up queue
--	 * before it was stopped.
--	 */
--	spin_lock_bh(&entry->queue->tx_lock);
--	if (!rt2x00queue_threshold(entry->queue))
--		rt2x00queue_unpause_queue(entry->queue);
--	spin_unlock_bh(&entry->queue->tx_lock);
-+	rt2x00lib_clear_entry(rt2x00dev, entry);
- }
- EXPORT_SYMBOL_GPL(rt2x00lib_txdone);
- 
diff --git a/package/kernel/mac80211/patches/020-12-rt2x00-add-txdone-nomatch-function.patch b/package/kernel/mac80211/patches/020-12-rt2x00-add-txdone-nomatch-function.patch
deleted file mode 100644
index 60edb08e75..0000000000
--- a/package/kernel/mac80211/patches/020-12-rt2x00-add-txdone-nomatch-function.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From a09305d052166cb489402a63a5d275e954e0b923 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 15 Feb 2017 10:25:08 +0100
-Subject: [PATCH 12/19] rt2x00: add txdone nomatch function
-
-This txdone nomatch function will be used when we get status from the HW,
-but we could not match it with any sent skb.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00.h    |  2 ++
- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 50 ++++++++++++++++++++++++++
- 2 files changed, 52 insertions(+)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -1425,6 +1425,8 @@ void rt2x00lib_dmastart(struct queue_ent
- void rt2x00lib_dmadone(struct queue_entry *entry);
- void rt2x00lib_txdone(struct queue_entry *entry,
- 		      struct txdone_entry_desc *txdesc);
-+void rt2x00lib_txdone_nomatch(struct queue_entry *entry,
-+			      struct txdone_entry_desc *txdesc);
- void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status);
- void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp);
- 
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -417,6 +417,56 @@ static void rt2x00lib_clear_entry(struct
- 	spin_unlock_bh(&entry->queue->tx_lock);
- }
- 
-+void rt2x00lib_txdone_nomatch(struct queue_entry *entry,
-+			      struct txdone_entry_desc *txdesc)
-+{
-+	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
-+	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
-+	struct ieee80211_tx_info txinfo = {};
-+	bool success;
-+
-+	/*
-+	 * Unmap the skb.
-+	 */
-+	rt2x00queue_unmap_skb(entry);
-+
-+	/*
-+	 * Signal that the TX descriptor is no longer in the skb.
-+	 */
-+	skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
-+
-+	/*
-+	 * Send frame to debugfs immediately, after this call is completed
-+	 * we are going to overwrite the skb->cb array.
-+	 */
-+	rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
-+
-+	/*
-+	 * Determine if the frame has been successfully transmitted and
-+	 * remove BARs from our check list while checking for their
-+	 * TX status.
-+	 */
-+	success =
-+	    rt2x00lib_txdone_bar_status(entry) ||
-+	    test_bit(TXDONE_SUCCESS, &txdesc->flags);
-+
-+	if (!test_bit(TXDONE_UNKNOWN, &txdesc->flags)) {
-+		/*
-+		 * Update TX statistics.
-+		 */
-+		rt2x00dev->link.qual.tx_success += success;
-+		rt2x00dev->link.qual.tx_failed += !success;
-+
-+		rt2x00lib_fill_tx_status(rt2x00dev, &txinfo, skbdesc, txdesc,
-+					 success);
-+		ieee80211_tx_status_noskb(rt2x00dev->hw, skbdesc->sta, &txinfo);
-+	}
-+
-+	dev_kfree_skb_any(entry->skb);
-+	rt2x00lib_clear_entry(rt2x00dev, entry);
-+}
-+EXPORT_SYMBOL_GPL(rt2x00lib_txdone_nomatch);
-+
- void rt2x00lib_txdone(struct queue_entry *entry,
- 		      struct txdone_entry_desc *txdesc)
- {
diff --git a/package/kernel/mac80211/patches/020-13-rt2x00-fixup-fill_tx_status-for-nomatch-case.patch b/package/kernel/mac80211/patches/020-13-rt2x00-fixup-fill_tx_status-for-nomatch-case.patch
deleted file mode 100644
index a0cc37f491..0000000000
--- a/package/kernel/mac80211/patches/020-13-rt2x00-fixup-fill_tx_status-for-nomatch-case.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From ec80ad70d778af7665992672896633ebd3b02ac8 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 15 Feb 2017 10:25:09 +0100
-Subject: [PATCH 13/19] rt2x00: fixup fill_tx_status for nomatch case
-
-Add bits rt2x00lib_fill_tx_status() when filling status in nomatch
-case and hopefully do not break the function for existing cases.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c   | 6 +++++-
- drivers/net/wireless/ralink/rt2x00/rt2x00queue.h | 1 +
- 2 files changed, 6 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -357,6 +357,9 @@ static void rt2x00lib_fill_tx_status(str
- 	if (i < (IEEE80211_TX_MAX_RATES - 1))
- 		tx_info->status.rates[i].idx = -1; /* terminate */
- 
-+	if (test_bit(TXDONE_NO_ACK_REQ, &txdesc->flags))
-+		tx_info->flags |= IEEE80211_TX_CTL_NO_ACK;
-+
- 	if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) {
- 		if (success)
- 			tx_info->flags |= IEEE80211_TX_STAT_ACK;
-@@ -375,7 +378,8 @@ static void rt2x00lib_fill_tx_status(str
- 	 */
- 	if (test_bit(TXDONE_AMPDU, &txdesc->flags) ||
- 	    tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
--		tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
-+		tx_info->flags |= IEEE80211_TX_STAT_AMPDU |
-+				  IEEE80211_TX_CTL_AMPDU;
- 		tx_info->status.ampdu_len = 1;
- 		tx_info->status.ampdu_ack_len = success ? 1 : 0;
- 
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
-@@ -215,6 +215,7 @@ enum txdone_entry_desc_flags {
- 	TXDONE_FAILURE,
- 	TXDONE_EXCESSIVE_RETRY,
- 	TXDONE_AMPDU,
-+	TXDONE_NO_ACK_REQ,
- };
- 
- /**
diff --git a/package/kernel/mac80211/patches/020-14-rt2x00-use-txdone_nomatch-on-rt2800usb.patch b/package/kernel/mac80211/patches/020-14-rt2x00-use-txdone_nomatch-on-rt2800usb.patch
deleted file mode 100644
index 1e23ef7bcb..0000000000
--- a/package/kernel/mac80211/patches/020-14-rt2x00-use-txdone_nomatch-on-rt2800usb.patch
+++ /dev/null
@@ -1,180 +0,0 @@
-From 293dff78ee058ec1e0b90e05a803c512b6a2097f Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 15 Feb 2017 10:25:10 +0100
-Subject: [PATCH 14/19] rt2x00: use txdone_nomatch on rt2800usb
-
-If we do not match skb entry, provide tx status via nomatch procedure.
-
-Currently in that case we do rt2x00lib_txdone_noinfo(TXDONE_NOINFO),
-which actually assume that entry->skb was posted without retries and
-provide rate saved in skb desc as successful. Patch changed that to
-rate read from TX_STAT_FIFO, however still do not provide correct
-number of retries.
-
-On SoC/PCI devices we keep providing status via standard txdone
-procedure, no change in those devices, though we should thing about it.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c  | 31 ++++++++++++++++++++-----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.h  |  3 ++-
- drivers/net/wireless/ralink/rt2x00/rt2800mmio.c |  2 +-
- drivers/net/wireless/ralink/rt2x00/rt2800usb.c  | 18 ++++++--------
- 4 files changed, 35 insertions(+), 19 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -852,7 +852,8 @@ void rt2800_process_rxwi(struct queue_en
- }
- EXPORT_SYMBOL_GPL(rt2800_process_rxwi);
- 
--void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi)
-+void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi,
-+			 bool match)
- {
- 	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
- 	struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
-@@ -860,8 +861,7 @@ void rt2800_txdone_entry(struct queue_en
- 	struct txdone_entry_desc txdesc;
- 	u32 word;
- 	u16 mcs, real_mcs;
--	int aggr, ampdu;
--	int wcid;
-+	int aggr, ampdu, wcid, ack_req;
- 
- 	/*
- 	 * Obtain the status about this packet.
-@@ -875,6 +875,7 @@ void rt2800_txdone_entry(struct queue_en
- 	real_mcs = rt2x00_get_field32(status, TX_STA_FIFO_MCS);
- 	aggr = rt2x00_get_field32(status, TX_STA_FIFO_TX_AGGRE);
- 	wcid = rt2x00_get_field32(status, TX_STA_FIFO_WCID);
-+	ack_req	= rt2x00_get_field32(status, TX_STA_FIFO_TX_ACK_REQUIRED);
- 
- 	/*
- 	 * If a frame was meant to be sent as a single non-aggregated MPDU
-@@ -891,8 +892,12 @@ void rt2800_txdone_entry(struct queue_en
- 	 * Hence, replace the requested rate with the real tx rate to not
- 	 * confuse the rate control algortihm by providing clearly wrong
- 	 * data.
--	 */
--	if (unlikely(aggr == 1 && ampdu == 0 && real_mcs != mcs)) {
-+	 *
-+	 * FIXME: if we do not find matching entry, we tell that frame was
-+	 * posted without any retries. We need to find a way to fix that
-+	 * and provide retry count.
-+ 	 */
-+	if (unlikely((aggr == 1 && ampdu == 0 && real_mcs != mcs)) || !match) {
- 		skbdesc->tx_rate_idx = real_mcs;
- 		mcs = real_mcs;
- 	}
-@@ -900,6 +905,9 @@ void rt2800_txdone_entry(struct queue_en
- 	if (aggr == 1 || ampdu == 1)
- 		__set_bit(TXDONE_AMPDU, &txdesc.flags);
- 
-+	if (!ack_req)
-+		__set_bit(TXDONE_NO_ACK_REQ, &txdesc.flags);
-+
- 	/*
- 	 * Ralink has a retry mechanism using a global fallback
- 	 * table. We setup this fallback table to try the immediate
-@@ -931,7 +939,18 @@ void rt2800_txdone_entry(struct queue_en
- 	if (txdesc.retry)
- 		__set_bit(TXDONE_FALLBACK, &txdesc.flags);
- 
--	rt2x00lib_txdone(entry, &txdesc);
-+	if (!match) {
-+		/* RCU assures non-null sta will not be freed by mac80211. */
-+		rcu_read_lock();
-+		if (likely(wcid >= WCID_START && wcid <= WCID_END))
-+			skbdesc->sta = drv_data->wcid_to_sta[wcid - WCID_START];
-+		else
-+			skbdesc->sta = NULL;
-+		rt2x00lib_txdone_nomatch(entry, &txdesc);
-+		rcu_read_unlock();
-+	} else {
-+		rt2x00lib_txdone(entry, &txdesc);
-+	}
- }
- EXPORT_SYMBOL_GPL(rt2800_txdone_entry);
- 
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -191,7 +191,8 @@ void rt2800_write_tx_data(struct queue_e
- 			  struct txentry_desc *txdesc);
- void rt2800_process_rxwi(struct queue_entry *entry, struct rxdone_entry_desc *txdesc);
- 
--void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32* txwi);
-+void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi,
-+			 bool match);
- 
- void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc);
- void rt2800_clear_beacon(struct queue_entry *entry);
---- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
-@@ -239,7 +239,7 @@ static bool rt2800mmio_txdone_release_en
- {
- 	if (test_bit(ENTRY_DATA_STATUS_SET, &entry->flags)) {
- 		rt2800_txdone_entry(entry, entry->status,
--				    rt2800mmio_get_txwi(entry));
-+				    rt2800mmio_get_txwi(entry), true);
- 		return false;
- 	}
- 
---- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
-@@ -501,8 +501,7 @@ static int rt2800usb_get_tx_data_len(str
- /*
-  * TX control handlers
-  */
--static enum txdone_entry_desc_flags
--rt2800usb_txdone_entry_check(struct queue_entry *entry, u32 reg)
-+static bool rt2800usb_txdone_entry_check(struct queue_entry *entry, u32 reg)
- {
- 	__le32 *txwi;
- 	u32 word;
-@@ -515,7 +514,7 @@ rt2800usb_txdone_entry_check(struct queu
- 	 * frame.
- 	 */
- 	if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags))
--		return TXDONE_FAILURE;
-+		return false;
- 
- 	wcid	= rt2x00_get_field32(reg, TX_STA_FIFO_WCID);
- 	ack	= rt2x00_get_field32(reg, TX_STA_FIFO_TX_ACK_REQUIRED);
-@@ -537,10 +536,10 @@ rt2800usb_txdone_entry_check(struct queu
- 		rt2x00_dbg(entry->queue->rt2x00dev,
- 			   "TX status report missed for queue %d entry %d\n",
- 			   entry->queue->qid, entry->entry_idx);
--		return TXDONE_UNKNOWN;
-+		return false;
- 	}
- 
--	return TXDONE_SUCCESS;
-+	return true;
- }
- 
- static void rt2800usb_txdone(struct rt2x00_dev *rt2x00dev)
-@@ -549,7 +548,7 @@ static void rt2800usb_txdone(struct rt2x
- 	struct queue_entry *entry;
- 	u32 reg;
- 	u8 qid;
--	enum txdone_entry_desc_flags done_status;
-+	bool match;
- 
- 	while (kfifo_get(&rt2x00dev->txstatus_fifo, &reg)) {
- 		/*
-@@ -574,11 +573,8 @@ static void rt2800usb_txdone(struct rt2x
- 			break;
- 		}
- 
--		done_status = rt2800usb_txdone_entry_check(entry, reg);
--		if (likely(done_status == TXDONE_SUCCESS))
--			rt2800_txdone_entry(entry, reg, rt2800usb_get_txwi(entry));
--		else
--			rt2x00lib_txdone_noinfo(entry, done_status);
-+		match = rt2800usb_txdone_entry_check(entry, reg);
-+		rt2800_txdone_entry(entry, reg, rt2800usb_get_txwi(entry), match);
- 	}
- }
- 
diff --git a/package/kernel/mac80211/patches/020-15-rt2800-status-based-rate-flags-for-nomatch-case.patch b/package/kernel/mac80211/patches/020-15-rt2800-status-based-rate-flags-for-nomatch-case.patch
deleted file mode 100644
index 37838e8895..0000000000
--- a/package/kernel/mac80211/patches/020-15-rt2800-status-based-rate-flags-for-nomatch-case.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From 9d7a7a4d2b02bcd30fb5fe4270278212353cc332 Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 15 Feb 2017 10:25:11 +0100
-Subject: [PATCH 15/19] rt2800: status based rate flags for nomatch case
-
-We use skb_desc->tx_rate_flags from entry as rate[].flags even if
-skb does not match status. Patch corrects flags and also fixes
-mcs for legacy rates.
-
-rt2800_rate_from_status() is based on Felix's mt76
-mt76x2_mac_process_tx_rate() function.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800.h    |  2 ++
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 35 +++++++++++++++++++++++++-
- 2 files changed, 36 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
-@@ -1760,6 +1760,8 @@
- #define TX_STA_FIFO_WCID		FIELD32(0x0000ff00)
- #define TX_STA_FIFO_SUCCESS_RATE	FIELD32(0xffff0000)
- #define TX_STA_FIFO_MCS			FIELD32(0x007f0000)
-+#define TX_STA_FIFO_BW			FIELD32(0x00800000)
-+#define TX_STA_FIFO_SGI			FIELD32(0x01000000)
- #define TX_STA_FIFO_PHYMODE		FIELD32(0xc0000000)
- 
- /*
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -852,6 +852,39 @@ void rt2800_process_rxwi(struct queue_en
- }
- EXPORT_SYMBOL_GPL(rt2800_process_rxwi);
- 
-+static void rt2800_rate_from_status(struct skb_frame_desc *skbdesc,
-+				    u32 status, enum nl80211_band band)
-+{
-+	u8 flags = 0;
-+	u8 idx = rt2x00_get_field32(status, TX_STA_FIFO_MCS);
-+
-+	switch (rt2x00_get_field32(status, TX_STA_FIFO_PHYMODE)) {
-+	case RATE_MODE_HT_GREENFIELD:
-+		flags |= IEEE80211_TX_RC_GREEN_FIELD;
-+		/* fall through */
-+	case RATE_MODE_HT_MIX:
-+		flags |= IEEE80211_TX_RC_MCS;
-+		break;
-+	case RATE_MODE_OFDM:
-+		if (band == NL80211_BAND_2GHZ)
-+			idx += 4;
-+		break;
-+	case RATE_MODE_CCK:
-+		if (idx >= 8)
-+			idx -= 8;
-+		break;
-+	}
-+
-+	if (rt2x00_get_field32(status, TX_STA_FIFO_BW))
-+		flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
-+
-+	if (rt2x00_get_field32(status, TX_STA_FIFO_SGI))
-+		flags |= IEEE80211_TX_RC_SHORT_GI;
-+
-+	skbdesc->tx_rate_idx = idx;
-+	skbdesc->tx_rate_flags = flags;
-+}
-+
- void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi,
- 			 bool match)
- {
-@@ -898,7 +931,7 @@ void rt2800_txdone_entry(struct queue_en
- 	 * and provide retry count.
-  	 */
- 	if (unlikely((aggr == 1 && ampdu == 0 && real_mcs != mcs)) || !match) {
--		skbdesc->tx_rate_idx = real_mcs;
-+		rt2800_rate_from_status(skbdesc, status, rt2x00dev->curr_band);
- 		mcs = real_mcs;
- 	}
- 
diff --git a/package/kernel/mac80211/patches/020-16-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch b/package/kernel/mac80211/patches/020-16-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch
deleted file mode 100644
index 7825810cef..0000000000
--- a/package/kernel/mac80211/patches/020-16-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From fb47ada8dc3c30c8e7b415da155742b49536c61e Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 15 Feb 2017 10:25:12 +0100
-Subject: [PATCH 16/19] rt2800: use TXOP_BACKOFF for probe frames
-
-Even if we do not set AMPDU bit in TXWI, device still can aggregate
-frame and send it with rate not corresponding to requested. That mean
-we can do not sent probe frames with requested rate. To prevent that
-use TXOP_BACKOFF for probe frames.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
-@@ -372,15 +372,16 @@ static void rt2x00queue_create_tx_descri
- 
- 	/*
- 	 * Determine IFS values
--	 * - Use TXOP_BACKOFF for management frames except beacons
-+	 * - Use TXOP_BACKOFF for probe and management frames except beacons
- 	 * - Use TXOP_SIFS for fragment bursts
- 	 * - Use TXOP_HTTXOP for everything else
- 	 *
- 	 * Note: rt2800 devices won't use CTS protection (if used)
- 	 * for frames not transmitted with TXOP_HTTXOP
- 	 */
--	if (ieee80211_is_mgmt(hdr->frame_control) &&
--	    !ieee80211_is_beacon(hdr->frame_control))
-+	if ((ieee80211_is_mgmt(hdr->frame_control) &&
-+	     !ieee80211_is_beacon(hdr->frame_control)) ||
-+	    (tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE))
- 		txdesc->u.ht.txop = TXOP_BACKOFF;
- 	else if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT))
- 		txdesc->u.ht.txop = TXOP_SIFS;
diff --git a/package/kernel/mac80211/patches/020-17-rt2x00-fix-rt2x00debug_dump_frame-comment.patch b/package/kernel/mac80211/patches/020-17-rt2x00-fix-rt2x00debug_dump_frame-comment.patch
deleted file mode 100644
index 415bf5b2a6..0000000000
--- a/package/kernel/mac80211/patches/020-17-rt2x00-fix-rt2x00debug_dump_frame-comment.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From dd35cc0896faff5ed9d22eac9ea4a1920e2eec0c Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 15 Feb 2017 10:25:13 +0100
-Subject: [PATCH 17/19] rt2x00: fix rt2x00debug_dump_frame comment
-
-Reported-by: Jeroen Roovers <jer@airfi.aero>
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -1396,7 +1396,7 @@ void rt2x00queue_flush_queues(struct rt2
-  * rt2x00debug_dump_frame - Dump a frame to userspace through debugfs.
-  * @rt2x00dev: Pointer to &struct rt2x00_dev.
-  * @type: The type of frame that is being dumped.
-- * @skb: The skb containing the frame to be dumped.
-+ * @entry: The queue entry containing the frame to be dumped.
-  */
- #ifdef CPTCFG_RT2X00_LIB_DEBUGFS
- void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
diff --git a/package/kernel/mac80211/patches/020-18-rt2x00-fix-TX_PWR_CFG_4-register-definition.patch b/package/kernel/mac80211/patches/020-18-rt2x00-fix-TX_PWR_CFG_4-register-definition.patch
deleted file mode 100644
index c6fb7dd2c4..0000000000
--- a/package/kernel/mac80211/patches/020-18-rt2x00-fix-TX_PWR_CFG_4-register-definition.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 5ce33b603063f36272fcfb1b4a5fde69f46eca88 Mon Sep 17 00:00:00 2001
-From: Daniel Golle <daniel@makrotopia.org>
-Date: Thu, 9 Mar 2017 00:54:22 +0100
-Subject: [PATCH 18/19] rt2x00: fix TX_PWR_CFG_4 register definition
-
-Some of the macros used to describe the TX_PWR_CFG_4 register accidentally
-refer to TX_PWR_CFG_3, probably a copy&paste error. Fix that.
-
-Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800.h | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
-@@ -1171,10 +1171,10 @@
- #define TX_PWR_CFG_4_UKNOWN7		FIELD32(0x00000f00)
- #define TX_PWR_CFG_4_UKNOWN8		FIELD32(0x0000f000)
- /* bits for 3T devices */
--#define TX_PWR_CFG_3_STBC4_CH0		FIELD32(0x0000000f)
--#define TX_PWR_CFG_3_STBC4_CH1		FIELD32(0x000000f0)
--#define TX_PWR_CFG_3_STBC6_CH0		FIELD32(0x00000f00)
--#define TX_PWR_CFG_3_STBC6_CH1		FIELD32(0x0000f000)
-+#define TX_PWR_CFG_4_STBC4_CH0		FIELD32(0x0000000f)
-+#define TX_PWR_CFG_4_STBC4_CH1		FIELD32(0x000000f0)
-+#define TX_PWR_CFG_4_STBC6_CH0		FIELD32(0x00000f00)
-+#define TX_PWR_CFG_4_STBC6_CH1		FIELD32(0x0000f000)
- 
- /*
-  * TX_PIN_CFG:
diff --git a/package/kernel/mac80211/patches/020-19-rt2x00-add-support-for-MT7620.patch b/package/kernel/mac80211/patches/020-19-rt2x00-add-support-for-MT7620.patch
deleted file mode 100644
index b91e5821cd..0000000000
--- a/package/kernel/mac80211/patches/020-19-rt2x00-add-support-for-MT7620.patch
+++ /dev/null
@@ -1,2064 +0,0 @@
-From 41977e86c984fcdddb454a3d7887de5d47b5f530 Mon Sep 17 00:00:00 2001
-From: Roman Yeryomin <roman@advem.lv>
-Date: Tue, 21 Mar 2017 00:43:00 +0100
-Subject: [PATCH 19/19] rt2x00: add support for MT7620
-
-Basic support for MT7620 built-in wireless radio was added to
-OpenWrt in r41441. It has seen some heavy cleaning and refactoring
-since in order to match the Kernel's code quality standards.
-
-Signed-off-by: Roman Yeryomin <roman@advem.lv>
-Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/Kconfig     |    2 +-
- drivers/net/wireless/ralink/rt2x00/rt2800.h    |  177 +++
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1421 +++++++++++++++++++++++-
- drivers/net/wireless/ralink/rt2x00/rt2800lib.h |    4 +
- drivers/net/wireless/ralink/rt2x00/rt2x00.h    |    1 +
- 5 files changed, 1578 insertions(+), 27 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/Kconfig
-+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
-@@ -210,7 +210,7 @@ endif
- config RT2800SOC
- 	tristate "Ralink WiSoC support"
- 	depends on m
--	depends on SOC_RT288X || SOC_RT305X
-+	depends on SOC_RT288X || SOC_RT305X || SOC_MT7620
- 	select RT2X00_LIB_SOC
- 	select RT2X00_LIB_MMIO
- 	select RT2X00_LIB_CRYPTO
---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
-@@ -79,6 +79,7 @@
- #define RF5372				0x5372
- #define RF5390				0x5390
- #define RF5392				0x5392
-+#define RF7620				0x7620
- 
- /*
-  * Chipset revisions.
-@@ -639,6 +640,24 @@
- #define RF_CSR_CFG_BUSY			FIELD32(0x00020000)
- 
- /*
-+ * MT7620 RF registers (reversed order)
-+ */
-+#define RF_CSR_CFG_DATA_MT7620		FIELD32(0x0000ff00)
-+#define RF_CSR_CFG_REGNUM_MT7620	FIELD32(0x03ff0000)
-+#define RF_CSR_CFG_WRITE_MT7620		FIELD32(0x00000010)
-+#define RF_CSR_CFG_BUSY_MT7620		FIELD32(0x00000001)
-+
-+/* undocumented registers for calibration of new MAC */
-+#define RF_CONTROL0			0x0518
-+#define RF_BYPASS0			0x051c
-+#define RF_CONTROL1			0x0520
-+#define RF_BYPASS1			0x0524
-+#define RF_CONTROL2			0x0528
-+#define RF_BYPASS2			0x052c
-+#define RF_CONTROL3			0x0530
-+#define RF_BYPASS3			0x0534
-+
-+/*
-  * EFUSE_CSR: RT30x0 EEPROM
-  */
- #define EFUSE_CTRL			0x0580
-@@ -1022,6 +1041,16 @@
- #define AUTOWAKEUP_CFG_AUTOWAKE		FIELD32(0x00008000)
- 
- /*
-+ * MIMO_PS_CFG: MIMO Power-save Configuration
-+ */
-+#define MIMO_PS_CFG			0x1210
-+#define MIMO_PS_CFG_MMPS_BB_EN		FIELD32(0x00000001)
-+#define MIMO_PS_CFG_MMPS_RX_ANT_NUM	FIELD32(0x00000006)
-+#define MIMO_PS_CFG_MMPS_RF_EN		FIELD32(0x00000008)
-+#define MIMO_PS_CFG_RX_STBY_POL		FIELD32(0x00000010)
-+#define MIMO_PS_CFG_RX_RX_STBY0		FIELD32(0x00000020)
-+
-+/*
-  * EDCA_AC0_CFG:
-  */
- #define EDCA_AC0_CFG			0x1300
-@@ -1095,6 +1124,12 @@
- #define TX_PWR_CFG_0_OFDM6_CH1		FIELD32(0x00f00000)
- #define TX_PWR_CFG_0_OFDM12_CH0		FIELD32(0x0f000000)
- #define TX_PWR_CFG_0_OFDM12_CH1		FIELD32(0xf0000000)
-+/* bits for new 2T devices */
-+#define TX_PWR_CFG_0B_1MBS_2MBS		FIELD32(0x000000ff)
-+#define TX_PWR_CFG_0B_5MBS_11MBS		FIELD32(0x0000ff00)
-+#define TX_PWR_CFG_0B_6MBS_9MBS		FIELD32(0x00ff0000)
-+#define TX_PWR_CFG_0B_12MBS_18MBS	FIELD32(0xff000000)
-+
- 
- /*
-  * TX_PWR_CFG_1:
-@@ -1117,6 +1152,11 @@
- #define TX_PWR_CFG_1_MCS0_CH1		FIELD32(0x00f00000)
- #define TX_PWR_CFG_1_MCS2_CH0		FIELD32(0x0f000000)
- #define TX_PWR_CFG_1_MCS2_CH1		FIELD32(0xf0000000)
-+/* bits for new 2T devices */
-+#define TX_PWR_CFG_1B_24MBS_36MBS	FIELD32(0x000000ff)
-+#define TX_PWR_CFG_1B_48MBS		FIELD32(0x0000ff00)
-+#define TX_PWR_CFG_1B_MCS0_MCS1		FIELD32(0x00ff0000)
-+#define TX_PWR_CFG_1B_MCS2_MCS3		FIELD32(0xff000000)
- 
- /*
-  * TX_PWR_CFG_2:
-@@ -1139,6 +1179,11 @@
- #define TX_PWR_CFG_2_MCS8_CH1		FIELD32(0x00f00000)
- #define TX_PWR_CFG_2_MCS10_CH0		FIELD32(0x0f000000)
- #define TX_PWR_CFG_2_MCS10_CH1		FIELD32(0xf0000000)
-+/* bits for new 2T devices */
-+#define TX_PWR_CFG_2B_MCS4_MCS5		FIELD32(0x000000ff)
-+#define TX_PWR_CFG_2B_MCS6_MCS7		FIELD32(0x0000ff00)
-+#define TX_PWR_CFG_2B_MCS8_MCS9		FIELD32(0x00ff0000)
-+#define TX_PWR_CFG_2B_MCS10_MCS11	FIELD32(0xff000000)
- 
- /*
-  * TX_PWR_CFG_3:
-@@ -1161,6 +1206,11 @@
- #define TX_PWR_CFG_3_STBC0_CH1		FIELD32(0x00f00000)
- #define TX_PWR_CFG_3_STBC2_CH0		FIELD32(0x0f000000)
- #define TX_PWR_CFG_3_STBC2_CH1		FIELD32(0xf0000000)
-+/* bits for new 2T devices */
-+#define TX_PWR_CFG_3B_MCS12_MCS13	FIELD32(0x000000ff)
-+#define TX_PWR_CFG_3B_MCS14		FIELD32(0x0000ff00)
-+#define TX_PWR_CFG_3B_STBC_MCS0_MCS1	FIELD32(0x00ff0000)
-+#define TX_PWR_CFG_3B_STBC_MCS2_MSC3	FIELD32(0xff000000)
- 
- /*
-  * TX_PWR_CFG_4:
-@@ -1175,6 +1225,9 @@
- #define TX_PWR_CFG_4_STBC4_CH1		FIELD32(0x000000f0)
- #define TX_PWR_CFG_4_STBC6_CH0		FIELD32(0x00000f00)
- #define TX_PWR_CFG_4_STBC6_CH1		FIELD32(0x0000f000)
-+/* bits for new 2T devices */
-+#define TX_PWR_CFG_4B_STBC_MCS4_MCS5	FIELD32(0x000000ff)
-+#define TX_PWR_CFG_4B_STBC_MCS6		FIELD32(0x0000ff00)
- 
- /*
-  * TX_PIN_CFG:
-@@ -1201,6 +1254,8 @@
- #define TX_PIN_CFG_RFTR_POL		FIELD32(0x00020000)
- #define TX_PIN_CFG_TRSW_EN		FIELD32(0x00040000)
- #define TX_PIN_CFG_TRSW_POL		FIELD32(0x00080000)
-+#define TX_PIN_CFG_RFRX_EN		FIELD32(0x00100000)
-+#define TX_PIN_CFG_RFRX_POL		FIELD32(0x00200000)
- #define TX_PIN_CFG_PA_PE_A2_EN		FIELD32(0x01000000)
- #define TX_PIN_CFG_PA_PE_G2_EN		FIELD32(0x02000000)
- #define TX_PIN_CFG_PA_PE_A2_POL		FIELD32(0x04000000)
-@@ -1547,6 +1602,95 @@
- #define TX_PWR_CFG_4_EXT_STBC4_CH2	FIELD32(0x0000000f)
- #define TX_PWR_CFG_4_EXT_STBC6_CH2	FIELD32(0x00000f00)
- 
-+/* TXn_RF_GAIN_CORRECT: RF Gain Correction for each RF_ALC[3:2]
-+ * Unit: 0.1 dB, Range: -3.2 dB to 3.1 dB
-+ */
-+#define TX0_RF_GAIN_CORRECT		0x13a0
-+#define TX0_RF_GAIN_CORRECT_GAIN_CORR_0	FIELD32(0x0000003f)
-+#define TX0_RF_GAIN_CORRECT_GAIN_CORR_1	FIELD32(0x00003f00)
-+#define TX0_RF_GAIN_CORRECT_GAIN_CORR_2	FIELD32(0x003f0000)
-+#define TX0_RF_GAIN_CORRECT_GAIN_CORR_3	FIELD32(0x3f000000)
-+
-+#define TX1_RF_GAIN_CORRECT		0x13a4
-+#define TX1_RF_GAIN_CORRECT_GAIN_CORR_0	FIELD32(0x0000003f)
-+#define TX1_RF_GAIN_CORRECT_GAIN_CORR_1	FIELD32(0x00003f00)
-+#define TX1_RF_GAIN_CORRECT_GAIN_CORR_2	FIELD32(0x003f0000)
-+#define TX1_RF_GAIN_CORRECT_GAIN_CORR_3	FIELD32(0x3f000000)
-+
-+/* TXn_RF_GAIN_ATTEN: TXn RF Gain Attenuation Level
-+ * Format: 7-bit, signed value
-+ * Unit: 0.5 dB, Range: -20 dB to -5 dB
-+ */
-+#define TX0_RF_GAIN_ATTEN		0x13a8
-+#define TX0_RF_GAIN_ATTEN_LEVEL_0	FIELD32(0x0000007f)
-+#define TX0_RF_GAIN_ATTEN_LEVEL_1	FIELD32(0x00007f00)
-+#define TX0_RF_GAIN_ATTEN_LEVEL_2	FIELD32(0x007f0000)
-+#define TX0_RF_GAIN_ATTEN_LEVEL_3	FIELD32(0x7f000000)
-+#define TX1_RF_GAIN_ATTEN		0x13ac
-+#define TX1_RF_GAIN_ATTEN_LEVEL_0	FIELD32(0x0000007f)
-+#define TX1_RF_GAIN_ATTEN_LEVEL_1	FIELD32(0x00007f00)
-+#define TX1_RF_GAIN_ATTEN_LEVEL_2	FIELD32(0x007f0000)
-+#define TX1_RF_GAIN_ATTEN_LEVEL_3	FIELD32(0x7f000000)
-+
-+/* TX_ALC_CFG_0: TX Automatic Level Control Configuration 0
-+ * TX_ALC_LIMIT_n: TXn upper limit
-+ * TX_ALC_CH_INIT_n: TXn channel initial transmission gain
-+ * Unit: 0.5 dB, Range: 0 to 23.5 dB
-+ */
-+#define TX_ALC_CFG_0			0x13b0
-+#define TX_ALC_CFG_0_CH_INIT_0		FIELD32(0x0000003f)
-+#define TX_ALC_CFG_0_CH_INIT_1		FIELD32(0x00003f00)
-+#define TX_ALC_CFG_0_LIMIT_0		FIELD32(0x003f0000)
-+#define TX_ALC_CFG_0_LIMIT_1		FIELD32(0x3f000000)
-+
-+/* TX_ALC_CFG_1: TX Automatic Level Control Configuration 1
-+ * TX_TEMP_COMP:      TX Power Temperature Compensation
-+ *                    Unit: 0.5 dB, Range: -10 dB to 10 dB
-+ * TXn_GAIN_FINE:     TXn Gain Fine Adjustment
-+ *                    Unit: 0.1 dB, Range: -0.8 dB to 0.7 dB
-+ * RF_TOS_DLY:        Sets the RF_TOS_EN assertion delay after
-+ *                    deassertion of PA_PE.
-+ *                    Unit: 0.25 usec
-+ * TXn_RF_GAIN_ATTEN: TXn RF gain attentuation selector
-+ * RF_TOS_TIMEOUT:    time-out value for RF_TOS_ENABLE
-+ *                    deassertion if RF_TOS_DONE is missing.
-+ *                    Unit: 0.25 usec
-+ * RF_TOS_ENABLE:     TX offset calibration enable
-+ * ROS_BUSY_EN:       RX offset calibration busy enable
-+ */
-+#define TX_ALC_CFG_1			0x13b4
-+#define TX_ALC_CFG_1_TX_TEMP_COMP	FIELD32(0x0000003f)
-+#define TX_ALC_CFG_1_TX0_GAIN_FINE	FIELD32(0x00000f00)
-+#define TX_ALC_CFG_1_TX1_GAIN_FINE	FIELD32(0x0000f000)
-+#define TX_ALC_CFG_1_RF_TOS_DLY		FIELD32(0x00070000)
-+#define TX_ALC_CFG_1_TX0_RF_GAIN_ATTEN	FIELD32(0x00300000)
-+#define TX_ALC_CFG_1_TX1_RF_GAIN_ATTEN	FIELD32(0x00c00000)
-+#define TX_ALC_CFG_1_RF_TOS_TIMEOUT	FIELD32(0x3f000000)
-+#define TX_ALC_CFG_1_RF_TOS_ENABLE	FIELD32(0x40000000)
-+#define TX_ALC_CFG_1_ROS_BUSY_EN	FIELD32(0x80000000)
-+
-+/* TXn_BB_GAIN_ATTEN: TXn RF Gain Attenuation Level
-+ * Format: 5-bit signed values
-+ * Unit: 0.5 dB, Range: -8 dB to 7 dB
-+ */
-+#define TX0_BB_GAIN_ATTEN		0x13c0
-+#define TX0_BB_GAIN_ATTEN_LEVEL_0	FIELD32(0x0000001f)
-+#define TX0_BB_GAIN_ATTEN_LEVEL_1	FIELD32(0x00001f00)
-+#define TX0_BB_GAIN_ATTEN_LEVEL_2	FIELD32(0x001f0000)
-+#define TX0_BB_GAIN_ATTEN_LEVEL_3	FIELD32(0x1f000000)
-+#define TX1_BB_GAIN_ATTEN		0x13c4
-+#define TX1_BB_GAIN_ATTEN_LEVEL_0	FIELD32(0x0000001f)
-+#define TX1_BB_GAIN_ATTEN_LEVEL_1	FIELD32(0x00001f00)
-+#define TX1_BB_GAIN_ATTEN_LEVEL_2	FIELD32(0x001f0000)
-+#define TX1_BB_GAIN_ATTEN_LEVEL_3	FIELD32(0x1f000000)
-+
-+/* TX_ALC_VGA3: TX Automatic Level Correction Variable Gain Amplifier 3 */
-+#define TX_ALC_VGA3			0x13c8
-+#define TX_ALC_VGA3_TX0_ALC_VGA3	FIELD32(0x0000001f)
-+#define TX_ALC_VGA3_TX1_ALC_VGA3	FIELD32(0x00001f00)
-+#define TX_ALC_VGA3_TX0_ALC_VGA2	FIELD32(0x001f0000)
-+#define TX_ALC_VGA3_TX1_ALC_VGA2	FIELD32(0x1f000000)
-+
- /* TX_PWR_CFG_7 */
- #define TX_PWR_CFG_7			0x13d4
- #define TX_PWR_CFG_7_OFDM54_CH0		FIELD32(0x0000000f)
-@@ -1555,6 +1699,10 @@
- #define TX_PWR_CFG_7_MCS7_CH0		FIELD32(0x000f0000)
- #define TX_PWR_CFG_7_MCS7_CH1		FIELD32(0x00f00000)
- #define TX_PWR_CFG_7_MCS7_CH2		FIELD32(0x0f000000)
-+/* bits for new 2T devices */
-+#define TX_PWR_CFG_7B_54MBS		FIELD32(0x000000ff)
-+#define TX_PWR_CFG_7B_MCS7		FIELD32(0x00ff0000)
-+
- 
- /* TX_PWR_CFG_8 */
- #define TX_PWR_CFG_8			0x13d8
-@@ -1564,12 +1712,17 @@
- #define TX_PWR_CFG_8_MCS23_CH0		FIELD32(0x000f0000)
- #define TX_PWR_CFG_8_MCS23_CH1		FIELD32(0x00f00000)
- #define TX_PWR_CFG_8_MCS23_CH2		FIELD32(0x0f000000)
-+/* bits for new 2T devices */
-+#define TX_PWR_CFG_8B_MCS15		FIELD32(0x000000ff)
-+
- 
- /* TX_PWR_CFG_9 */
- #define TX_PWR_CFG_9			0x13dc
- #define TX_PWR_CFG_9_STBC7_CH0		FIELD32(0x0000000f)
- #define TX_PWR_CFG_9_STBC7_CH1		FIELD32(0x000000f0)
- #define TX_PWR_CFG_9_STBC7_CH2		FIELD32(0x00000f00)
-+/* bits for new 2T devices */
-+#define TX_PWR_CFG_9B_STBC_MCS7		FIELD32(0x000000ff)
- 
- /*
-  * RX_FILTER_CFG: RX configuration register.
-@@ -2137,11 +2290,14 @@ struct mac_iveiv_entry {
- #define RFCSR1_TX1_PD			FIELD8(0x20)
- #define RFCSR1_RX2_PD			FIELD8(0x40)
- #define RFCSR1_TX2_PD			FIELD8(0x80)
-+#define RFCSR1_TX2_EN_MT7620		FIELD8(0x02)
- 
- /*
-  * RFCSR 2:
-  */
- #define RFCSR2_RESCAL_EN		FIELD8(0x80)
-+#define RFCSR2_RX2_EN_MT7620		FIELD8(0x02)
-+#define RFCSR2_TX2_EN_MT7620		FIELD8(0x20)
- 
- /*
-  * RFCSR 3:
-@@ -2160,6 +2316,12 @@ struct mac_iveiv_entry {
- #define RFCSR3_BIT5			FIELD8(0x20)
- 
- /*
-+ * RFCSR 4:
-+ * VCOCAL_EN used by MT7620
-+ */
-+#define RFCSR4_VCOCAL_EN		FIELD8(0x80)
-+
-+/*
-  * FRCSR 5:
-  */
- #define RFCSR5_R1			FIELD8(0x0c)
-@@ -2214,6 +2376,7 @@ struct mac_iveiv_entry {
-  */
- #define RFCSR13_TX_POWER		FIELD8(0x1f)
- #define RFCSR13_DR0			FIELD8(0xe0)
-+#define RFCSR13_RDIV_MT7620		FIELD8(0x03)
- 
- /*
-  * RFCSR 15:
-@@ -2224,6 +2387,8 @@ struct mac_iveiv_entry {
-  * RFCSR 16:
-  */
- #define RFCSR16_TXMIXER_GAIN		FIELD8(0x07)
-+#define RFCSR16_RF_PLL_FREQ_SEL_MT7620	FIELD8(0x0F)
-+#define RFCSR16_SDM_MODE_MT7620		FIELD8(0xE0)
- 
- /*
-  * RFCSR 17:
-@@ -2236,6 +2401,8 @@ struct mac_iveiv_entry {
- /* RFCSR 18 */
- #define RFCSR18_XO_TUNE_BYPASS		FIELD8(0x40)
- 
-+/* RFCSR 19 */
-+#define RFCSR19_K			FIELD8(0x03)
- 
- /*
-  * RFCSR 20:
-@@ -2246,11 +2413,14 @@ struct mac_iveiv_entry {
-  * RFCSR 21:
-  */
- #define RFCSR21_RX_LO2_EN		FIELD8(0x08)
-+#define RFCSR21_BIT1			FIELD8(0x01)
-+#define RFCSR21_BIT8			FIELD8(0x80)
- 
- /*
-  * RFCSR 22:
-  */
- #define RFCSR22_BASEBAND_LOOPBACK	FIELD8(0x01)
-+#define RFCSR22_FREQPLAN_D_MT7620	FIELD8(0x07)
- 
- /*
-  * RFCSR 23:
-@@ -2273,6 +2443,11 @@ struct mac_iveiv_entry {
- #define RFCSR27_R4			FIELD8(0x40)
- 
- /*
-+ * RFCSR 28:
-+ */
-+#define RFCSR28_CH11_HT40		FIELD8(0x04)
-+
-+/*
-  * RFCSR 29:
-  */
- #define RFCSR29_ADC6_TEST		FIELD8(0x01)
-@@ -2333,6 +2508,7 @@ struct mac_iveiv_entry {
-  */
- #define RFCSR42_BIT1			FIELD8(0x01)
- #define RFCSR42_BIT4			FIELD8(0x08)
-+#define RFCSR42_TX2_EN_MT7620		FIELD8(0x40)
- 
- /*
-  * RFCSR 49:
-@@ -2435,6 +2611,7 @@ enum rt2800_eeprom_word {
- 	EEPROM_TSSI_BOUND_BG5,
- 	EEPROM_TXPOWER_A1,
- 	EEPROM_TXPOWER_A2,
-+	EEPROM_TXPOWER_INIT,
- 	EEPROM_TSSI_BOUND_A1,
- 	EEPROM_TSSI_BOUND_A2,
- 	EEPROM_TSSI_BOUND_A3,
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -59,6 +59,9 @@
- 	rt2800_regbusy_read((__dev), BBP_CSR_CFG, BBP_CSR_CFG_BUSY, (__reg))
- #define WAIT_FOR_RFCSR(__dev, __reg) \
- 	rt2800_regbusy_read((__dev), RF_CSR_CFG, RF_CSR_CFG_BUSY, (__reg))
-+#define WAIT_FOR_RFCSR_MT7620(__dev, __reg) \
-+	rt2800_regbusy_read((__dev), RF_CSR_CFG, RF_CSR_CFG_BUSY_MT7620, \
-+			    (__reg))
- #define WAIT_FOR_RF(__dev, __reg) \
- 	rt2800_regbusy_read((__dev), RF_CSR_CFG0, RF_CSR_CFG0_BUSY, (__reg))
- #define WAIT_FOR_MCU(__dev, __reg) \
-@@ -150,19 +153,56 @@ static void rt2800_rfcsr_write(struct rt
- 	 * Wait until the RFCSR becomes available, afterwards we
- 	 * can safely write the new data into the register.
- 	 */
--	if (WAIT_FOR_RFCSR(rt2x00dev, &reg)) {
--		reg = 0;
--		rt2x00_set_field32(&reg, RF_CSR_CFG_DATA, value);
--		rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
--		rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 1);
--		rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
-+	switch (rt2x00dev->chip.rt) {
-+	case RT6352:
-+		if (WAIT_FOR_RFCSR_MT7620(rt2x00dev, &reg)) {
-+			reg = 0;
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_DATA_MT7620, value);
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM_MT7620,
-+					   word);
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE_MT7620, 1);
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY_MT7620, 1);
-+
-+			rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
-+		}
-+		break;
-+
-+	default:
-+		if (WAIT_FOR_RFCSR(rt2x00dev, &reg)) {
-+			reg = 0;
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_DATA, value);
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 1);
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
- 
--		rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
-+			rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
-+		}
-+		break;
- 	}
- 
- 	mutex_unlock(&rt2x00dev->csr_mutex);
- }
- 
-+static void rt2800_rfcsr_write_bank(struct rt2x00_dev *rt2x00dev, const u8 bank,
-+				    const unsigned int reg, const u8 value)
-+{
-+	rt2800_rfcsr_write(rt2x00dev, (reg | (bank << 6)), value);
-+}
-+
-+static void rt2800_rfcsr_write_chanreg(struct rt2x00_dev *rt2x00dev,
-+				       const unsigned int reg, const u8 value)
-+{
-+	rt2800_rfcsr_write_bank(rt2x00dev, 4, reg, value);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 6, reg, value);
-+}
-+
-+static void rt2800_rfcsr_write_dccal(struct rt2x00_dev *rt2x00dev,
-+				     const unsigned int reg, const u8 value)
-+{
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, reg, value);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 7, reg, value);
-+}
-+
- static void rt2800_rfcsr_read(struct rt2x00_dev *rt2x00dev,
- 			      const unsigned int word, u8 *value)
- {
-@@ -178,22 +218,48 @@ static void rt2800_rfcsr_read(struct rt2
- 	 * doesn't become available in time, reg will be 0xffffffff
- 	 * which means we return 0xff to the caller.
- 	 */
--	if (WAIT_FOR_RFCSR(rt2x00dev, &reg)) {
--		reg = 0;
--		rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
--		rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 0);
--		rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
-+	switch (rt2x00dev->chip.rt) {
-+	case RT6352:
-+		if (WAIT_FOR_RFCSR_MT7620(rt2x00dev, &reg)) {
-+			reg = 0;
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM_MT7620,
-+					   word);
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE_MT7620, 0);
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY_MT7620, 1);
- 
--		rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
-+			rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
- 
--		WAIT_FOR_RFCSR(rt2x00dev, &reg);
--	}
-+			WAIT_FOR_RFCSR_MT7620(rt2x00dev, &reg);
-+		}
-+
-+		*value = rt2x00_get_field32(reg, RF_CSR_CFG_DATA_MT7620);
-+		break;
- 
--	*value = rt2x00_get_field32(reg, RF_CSR_CFG_DATA);
-+	default:
-+		if (WAIT_FOR_RFCSR(rt2x00dev, &reg)) {
-+			reg = 0;
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 0);
-+			rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
-+
-+			rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
-+
-+			WAIT_FOR_RFCSR(rt2x00dev, &reg);
-+		}
-+
-+		*value = rt2x00_get_field32(reg, RF_CSR_CFG_DATA);
-+		break;
-+	}
- 
- 	mutex_unlock(&rt2x00dev->csr_mutex);
- }
- 
-+static void rt2800_rfcsr_read_bank(struct rt2x00_dev *rt2x00dev, const u8 bank,
-+				   const unsigned int reg, u8 *value)
-+{
-+	rt2800_rfcsr_read(rt2x00dev, (reg | (bank << 6)), value);
-+}
-+
- static void rt2800_rf_write(struct rt2x00_dev *rt2x00dev,
- 			    const unsigned int word, const u32 value)
- {
-@@ -250,6 +316,7 @@ static const unsigned int rt2800_eeprom_
- 	[EEPROM_TSSI_BOUND_BG5]		= 0x003b,
- 	[EEPROM_TXPOWER_A1]		= 0x003c,
- 	[EEPROM_TXPOWER_A2]		= 0x0053,
-+	[EEPROM_TXPOWER_INIT]		= 0x0068,
- 	[EEPROM_TSSI_BOUND_A1]		= 0x006a,
- 	[EEPROM_TSSI_BOUND_A2]		= 0x006b,
- 	[EEPROM_TSSI_BOUND_A3]		= 0x006c,
-@@ -524,6 +591,7 @@ void rt2800_get_txwi_rxwi_size(struct rt
- 		break;
- 
- 	case RT5592:
-+	case RT6352:
- 		*txwi_size = TXWI_DESC_SIZE_5WORDS;
- 		*rxwi_size = RXWI_DESC_SIZE_6WORDS;
- 		break;
-@@ -2810,7 +2878,8 @@ static void rt2800_config_channel_rf53xx
- 				rt2800_rfcsr_write(rt2x00dev, 59,
- 						   r59_nonbt_rev[idx]);
- 			} else if (rt2x00_rt(rt2x00dev, RT5390) ||
--				   rt2x00_rt(rt2x00dev, RT5392)) {
-+				   rt2x00_rt(rt2x00dev, RT5392) ||
-+				   rt2x00_rt(rt2x00dev, RT6352)) {
- 				static const char r59_non_bt[] = {0x8f, 0x8f,
- 					0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
- 					0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
-@@ -3104,6 +3173,242 @@ static void rt2800_config_channel_rf55xx
- 	rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F);
- }
- 
-+static void rt2800_config_channel_rf7620(struct rt2x00_dev *rt2x00dev,
-+					 struct ieee80211_conf *conf,
-+					 struct rf_channel *rf,
-+					 struct channel_info *info)
-+{
-+	struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
-+	u8 rx_agc_fc, tx_agc_fc;
-+	u8 rfcsr;
-+
-+	/* Frequeny plan setting */
-+	/* Rdiv setting (set 0x03 if Xtal==20)
-+	 * R13[1:0]
-+	 */
-+	rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR13_RDIV_MT7620,
-+			  rt2800_clk_is_20mhz(rt2x00dev) ? 3 : 0);
-+	rt2800_rfcsr_write(rt2x00dev, 13, rfcsr);
-+
-+	/* N setting
-+	 * R20[7:0] in rf->rf1
-+	 * R21[0] always 0
-+	 */
-+	rt2800_rfcsr_read(rt2x00dev, 20, &rfcsr);
-+	rfcsr = (rf->rf1 & 0x00ff);
-+	rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
-+
-+	rt2800_rfcsr_read(rt2x00dev, 21, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR21_BIT1, 0);
-+	rt2800_rfcsr_write(rt2x00dev, 21, rfcsr);
-+
-+	/* K setting (always 0)
-+	 * R16[3:0] (RF PLL freq selection)
-+	 */
-+	rt2800_rfcsr_read(rt2x00dev, 16, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR16_RF_PLL_FREQ_SEL_MT7620, 0);
-+	rt2800_rfcsr_write(rt2x00dev, 16, rfcsr);
-+
-+	/* D setting (always 0)
-+	 * R22[2:0] (D=15, R22[2:0]=<111>)
-+	 */
-+	rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR22_FREQPLAN_D_MT7620, 0);
-+	rt2800_rfcsr_write(rt2x00dev, 22, rfcsr);
-+
-+	/* Ksd setting
-+	 * Ksd: R17<7:0> in rf->rf2
-+	 *      R18<7:0> in rf->rf3
-+	 *      R19<1:0> in rf->rf4
-+	 */
-+	rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
-+	rfcsr = rf->rf2;
-+	rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
-+
-+	rt2800_rfcsr_read(rt2x00dev, 18, &rfcsr);
-+	rfcsr = rf->rf3;
-+	rt2800_rfcsr_write(rt2x00dev, 18, rfcsr);
-+
-+	rt2800_rfcsr_read(rt2x00dev, 19, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR19_K, rf->rf4);
-+	rt2800_rfcsr_write(rt2x00dev, 19, rfcsr);
-+
-+	/* Default: XO=20MHz , SDM mode */
-+	rt2800_rfcsr_read(rt2x00dev, 16, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80);
-+	rt2800_rfcsr_write(rt2x00dev, 16, rfcsr);
-+
-+	rt2800_rfcsr_read(rt2x00dev, 21, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR21_BIT8, 1);
-+	rt2800_rfcsr_write(rt2x00dev, 21, rfcsr);
-+
-+	rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR1_TX2_EN_MT7620,
-+			  rt2x00dev->default_ant.tx_chain_num != 1);
-+	rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
-+
-+	rt2800_rfcsr_read(rt2x00dev, 2, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR2_TX2_EN_MT7620,
-+			  rt2x00dev->default_ant.tx_chain_num != 1);
-+	rt2x00_set_field8(&rfcsr, RFCSR2_RX2_EN_MT7620,
-+			  rt2x00dev->default_ant.rx_chain_num != 1);
-+	rt2800_rfcsr_write(rt2x00dev, 2, rfcsr);
-+
-+	rt2800_rfcsr_read(rt2x00dev, 42, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR42_TX2_EN_MT7620,
-+			  rt2x00dev->default_ant.tx_chain_num != 1);
-+	rt2800_rfcsr_write(rt2x00dev, 42, rfcsr);
-+
-+	/* RF for DC Cal BW */
-+	if (conf_is_ht40(conf)) {
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 6, 0x10);
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 7, 0x10);
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 8, 0x04);
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 58, 0x10);
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x10);
-+	} else {
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 6, 0x20);
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 7, 0x20);
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 8, 0x00);
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 58, 0x20);
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x20);
-+	}
-+
-+	if (conf_is_ht40(conf)) {
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 58, 0x08);
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x08);
-+	} else {
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 58, 0x28);
-+		rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x28);
-+	}
-+
-+	rt2800_rfcsr_read(rt2x00dev, 28, &rfcsr);
-+	rt2x00_set_field8(&rfcsr, RFCSR28_CH11_HT40,
-+			  conf_is_ht40(conf) && (rf->channel == 11));
-+	rt2800_rfcsr_write(rt2x00dev, 28, rfcsr);
-+
-+	if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) {
-+		if (conf_is_ht40(conf)) {
-+			rx_agc_fc = drv_data->rx_calibration_bw40;
-+			tx_agc_fc = drv_data->tx_calibration_bw40;
-+		} else {
-+			rx_agc_fc = drv_data->rx_calibration_bw20;
-+			tx_agc_fc = drv_data->tx_calibration_bw20;
-+		}
-+		rt2800_rfcsr_read_bank(rt2x00dev, 5, 6, &rfcsr);
-+		rfcsr &= (~0x3F);
-+		rfcsr |= rx_agc_fc;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 6, rfcsr);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 5, 7, &rfcsr);
-+		rfcsr &= (~0x3F);
-+		rfcsr |= rx_agc_fc;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 7, rfcsr);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 7, 6, &rfcsr);
-+		rfcsr &= (~0x3F);
-+		rfcsr |= rx_agc_fc;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 7, 6, rfcsr);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 7, 7, &rfcsr);
-+		rfcsr &= (~0x3F);
-+		rfcsr |= rx_agc_fc;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 7, 7, rfcsr);
-+
-+		rt2800_rfcsr_read_bank(rt2x00dev, 5, 58, &rfcsr);
-+		rfcsr &= (~0x3F);
-+		rfcsr |= tx_agc_fc;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 58, rfcsr);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 5, 59, &rfcsr);
-+		rfcsr &= (~0x3F);
-+		rfcsr |= tx_agc_fc;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 59, rfcsr);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 7, 58, &rfcsr);
-+		rfcsr &= (~0x3F);
-+		rfcsr |= tx_agc_fc;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 7, 58, rfcsr);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 7, 59, &rfcsr);
-+		rfcsr &= (~0x3F);
-+		rfcsr |= tx_agc_fc;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 7, 59, rfcsr);
-+	}
-+}
-+
-+static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev,
-+			      struct ieee80211_channel *chan,
-+			      int power_level) {
-+	u16 eeprom, target_power, max_power;
-+	u32 mac_sys_ctrl, mac_status;
-+	u32 reg;
-+	u8 bbp;
-+	int i;
-+
-+	/* hardware unit is 0.5dBm, limited to 23.5dBm */
-+	power_level *= 2;
-+	if (power_level > 0x2f)
-+		power_level = 0x2f;
-+
-+	max_power = chan->max_power * 2;
-+	if (max_power > 0x2f)
-+		max_power = 0x2f;
-+
-+	rt2800_register_read(rt2x00dev, TX_ALC_CFG_0, &reg);
-+	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_0, power_level);
-+	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_1, power_level);
-+	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_0, max_power);
-+	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_1, max_power);
-+
-+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
-+	if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_INTERNAL_TX_ALC)) {
-+		/* init base power by eeprom target power */
-+		rt2800_eeprom_read(rt2x00dev, EEPROM_TXPOWER_INIT,
-+				   &target_power);
-+		rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_0, target_power);
-+		rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_1, target_power);
-+	}
-+	rt2800_register_write(rt2x00dev, TX_ALC_CFG_0, reg);
-+
-+	rt2800_register_read(rt2x00dev, TX_ALC_CFG_1, &reg);
-+	rt2x00_set_field32(&reg, TX_ALC_CFG_1_TX_TEMP_COMP, 0);
-+	rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg);
-+
-+	/* Save MAC SYS CTRL registers */
-+	rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &mac_sys_ctrl);
-+	/* Disable Tx/Rx */
-+	rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0);
-+	/* Check MAC Tx/Rx idle */
-+	for (i = 0; i < 10000; i++) {
-+		rt2800_register_read(rt2x00dev, MAC_STATUS_CFG,
-+				     &mac_status);
-+		if (mac_status & 0x3)
-+			usleep_range(50, 200);
-+		else
-+			break;
-+	}
-+
-+	if (i == 10000)
-+		rt2x00_warn(rt2x00dev, "Wait MAC Status to MAX !!!\n");
-+
-+	if (chan->center_freq > 2457) {
-+		rt2800_bbp_read(rt2x00dev, 30, &bbp);
-+		bbp = 0x40;
-+		rt2800_bbp_write(rt2x00dev, 30, bbp);
-+		rt2800_rfcsr_write(rt2x00dev, 39, 0);
-+		if (rt2x00_has_cap_external_lna_bg(rt2x00dev))
-+			rt2800_rfcsr_write(rt2x00dev, 42, 0xfb);
-+		else
-+			rt2800_rfcsr_write(rt2x00dev, 42, 0x7b);
-+	} else {
-+		rt2800_bbp_read(rt2x00dev, 30, &bbp);
-+		bbp = 0x1f;
-+		rt2800_bbp_write(rt2x00dev, 30, bbp);
-+		rt2800_rfcsr_write(rt2x00dev, 39, 0x80);
-+		if (rt2x00_has_cap_external_lna_bg(rt2x00dev))
-+			rt2800_rfcsr_write(rt2x00dev, 42, 0xdb);
-+		else
-+			rt2800_rfcsr_write(rt2x00dev, 42, 0x5b);
-+	}
-+	rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl);
-+}
-+
- static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev,
- 					   const unsigned int word,
- 					   const u8 value)
-@@ -3228,7 +3533,7 @@ static void rt2800_config_channel(struct
- 				  struct channel_info *info)
- {
- 	u32 reg;
--	unsigned int tx_pin;
-+	u32 tx_pin;
- 	u8 bbp, rfcsr;
- 
- 	info->default_power1 = rt2800_txpower_to_dev(rt2x00dev, rf->channel,
-@@ -3273,6 +3578,9 @@ static void rt2800_config_channel(struct
- 	case RF5592:
- 		rt2800_config_channel_rf55xx(rt2x00dev, conf, rf, info);
- 		break;
-+	case RF7620:
-+		rt2800_config_channel_rf7620(rt2x00dev, conf, rf, info);
-+		break;
- 	default:
- 		rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info);
- 	}
-@@ -3347,7 +3655,8 @@ static void rt2800_config_channel(struct
- 
- 	if (rf->channel <= 14) {
- 		if (!rt2x00_rt(rt2x00dev, RT5390) &&
--		    !rt2x00_rt(rt2x00dev, RT5392)) {
-+		    !rt2x00_rt(rt2x00dev, RT5392) &&
-+		    !rt2x00_rt(rt2x00dev, RT6352)) {
- 			if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
- 				rt2800_bbp_write(rt2x00dev, 82, 0x62);
- 				rt2800_bbp_write(rt2x00dev, 75, 0x46);
-@@ -3367,7 +3676,7 @@ static void rt2800_config_channel(struct
- 			rt2800_bbp_write(rt2x00dev, 82, 0x94);
- 		else if (rt2x00_rt(rt2x00dev, RT3593))
- 			rt2800_bbp_write(rt2x00dev, 82, 0x82);
--		else
-+		else if (!rt2x00_rt(rt2x00dev, RT6352))
- 			rt2800_bbp_write(rt2x00dev, 82, 0xf2);
- 
- 		if (rt2x00_rt(rt2x00dev, RT3593))
-@@ -3388,7 +3697,7 @@ static void rt2800_config_channel(struct
- 	if (rt2x00_rt(rt2x00dev, RT3572))
- 		rt2800_rfcsr_write(rt2x00dev, 8, 0);
- 
--	tx_pin = 0;
-+	rt2800_register_read(rt2x00dev, TX_PIN_CFG, &tx_pin);
- 
- 	switch (rt2x00dev->default_ant.tx_chain_num) {
- 	case 3:
-@@ -3437,6 +3746,7 @@ static void rt2800_config_channel(struct
- 
- 	rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
- 	rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
-+	rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFRX_EN, 1); /* mt7620 */
- 
- 	rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
- 
-@@ -3495,7 +3805,7 @@ static void rt2800_config_channel(struct
- 		usleep_range(1000, 1500);
- 	}
- 
--	if (rt2x00_rt(rt2x00dev, RT5592)) {
-+	if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) {
- 		rt2800_bbp_write(rt2x00dev, 195, 141);
- 		rt2800_bbp_write(rt2x00dev, 196, conf_is_ht40(conf) ? 0x10 : 0x1a);
- 
-@@ -4182,6 +4492,128 @@ static void rt2800_config_txpower_rt3593
- 			   (unsigned long) regs[i]);
- }
- 
-+static void rt2800_config_txpower_rt6352(struct rt2x00_dev *rt2x00dev,
-+					 struct ieee80211_channel *chan,
-+					 int power_level)
-+{
-+	u32 reg, pwreg;
-+	u16 eeprom;
-+	u32 data, gdata;
-+	u8 t, i;
-+	enum nl80211_band band = chan->band;
-+	int delta;
-+
-+	/* Warn user if bw_comp is set in EEPROM */
-+	delta = rt2800_get_txpower_bw_comp(rt2x00dev, band);
-+
-+	if (delta)
-+		rt2x00_warn(rt2x00dev, "ignoring EEPROM HT40 power delta: %d\n",
-+			    delta);
-+
-+	/* populate TX_PWR_CFG_0 up to TX_PWR_CFG_4 from EEPROM for HT20, limit
-+	 * value to 0x3f and replace 0x20 by 0x21 as this is what the vendor
-+	 * driver does as well, though it looks kinda wrong.
-+	 * Maybe some misunderstanding of what a signed 8-bit value is? Maybe
-+	 * the hardware has a problem handling 0x20, and as the code initially
-+	 * used a fixed offset between HT20 and HT40 rates they had to work-
-+	 * around that issue and most likely just forgot about it later on.
-+	 * Maybe we should use rt2800_get_txpower_bw_comp() here as well,
-+	 * however, the corresponding EEPROM value is not respected by the
-+	 * vendor driver, so maybe this is rather being taken care of the
-+	 * TXALC and the driver doesn't need to handle it...?
-+	 * Though this is all very awkward, just do as they did, as that's what
-+	 * board vendors expected when they populated the EEPROM...
-+	 */
-+	for (i = 0; i < 5; i++) {
-+		rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE,
-+					      i * 2, &eeprom);
-+
-+		data = eeprom;
-+
-+		t = eeprom & 0x3f;
-+		if (t == 32)
-+			t++;
-+
-+		gdata = t;
-+
-+		t = (eeprom & 0x3f00) >> 8;
-+		if (t == 32)
-+			t++;
-+
-+		gdata |= (t << 8);
-+
-+		rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE,
-+					      (i * 2) + 1, &eeprom);
-+
-+		t = eeprom & 0x3f;
-+		if (t == 32)
-+			t++;
-+
-+		gdata |= (t << 16);
-+
-+		t = (eeprom & 0x3f00) >> 8;
-+		if (t == 32)
-+			t++;
-+
-+		gdata |= (t << 24);
-+		data |= (eeprom << 16);
-+
-+		if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) {
-+			/* HT20 */
-+			if (data != 0xffffffff)
-+				rt2800_register_write(rt2x00dev,
-+						      TX_PWR_CFG_0 + (i * 4),
-+						      data);
-+		} else {
-+			/* HT40 */
-+			if (gdata != 0xffffffff)
-+				rt2800_register_write(rt2x00dev,
-+						      TX_PWR_CFG_0 + (i * 4),
-+						      gdata);
-+		}
-+	}
-+
-+	/* Aparently Ralink ran out of space in the BYRATE calibration section
-+	 * of the EERPOM which is copied to the corresponding TX_PWR_CFG_x
-+	 * registers. As recent 2T chips use 8-bit instead of 4-bit values for
-+	 * power-offsets more space would be needed. Ralink decided to keep the
-+	 * EEPROM layout untouched and rather have some shared values covering
-+	 * multiple bitrates.
-+	 * Populate the registers not covered by the EEPROM in the same way the
-+	 * vendor driver does.
-+	 */
-+
-+	/* For OFDM 54MBS use value from OFDM 48MBS */
-+	pwreg = 0;
-+	rt2800_register_read(rt2x00dev, TX_PWR_CFG_1, &reg);
-+	t = rt2x00_get_field32(reg, TX_PWR_CFG_1B_48MBS);
-+	rt2x00_set_field32(&pwreg, TX_PWR_CFG_7B_54MBS, t);
-+
-+	/* For MCS 7 use value from MCS 6 */
-+	rt2800_register_read(rt2x00dev, TX_PWR_CFG_2, &reg);
-+	t = rt2x00_get_field32(reg, TX_PWR_CFG_2B_MCS6_MCS7);
-+	rt2x00_set_field32(&pwreg, TX_PWR_CFG_7B_MCS7, t);
-+	rt2800_register_write(rt2x00dev, TX_PWR_CFG_7, pwreg);
-+
-+	/* For MCS 15 use value from MCS 14 */
-+	pwreg = 0;
-+	rt2800_register_read(rt2x00dev, TX_PWR_CFG_3, &reg);
-+	t = rt2x00_get_field32(reg, TX_PWR_CFG_3B_MCS14);
-+	rt2x00_set_field32(&pwreg, TX_PWR_CFG_8B_MCS15, t);
-+	rt2800_register_write(rt2x00dev, TX_PWR_CFG_8, pwreg);
-+
-+	/* For STBC MCS 7 use value from STBC MCS 6 */
-+	pwreg = 0;
-+	rt2800_register_read(rt2x00dev, TX_PWR_CFG_4, &reg);
-+	t = rt2x00_get_field32(reg, TX_PWR_CFG_4B_STBC_MCS6);
-+	rt2x00_set_field32(&pwreg, TX_PWR_CFG_9B_STBC_MCS7, t);
-+	rt2800_register_write(rt2x00dev, TX_PWR_CFG_9, pwreg);
-+
-+	rt2800_config_alc(rt2x00dev, chan, power_level);
-+
-+	/* TODO: temperature compensation code! */
-+}
-+
- /*
-  * We configure transmit power using MAC TX_PWR_CFG_{0,...,N} registers and
-  * BBP R1 register. TX_PWR_CFG_X allow to configure per rate TX power values,
-@@ -4378,6 +4810,8 @@ static void rt2800_config_txpower(struct
- {
- 	if (rt2x00_rt(rt2x00dev, RT3593))
- 		rt2800_config_txpower_rt3593(rt2x00dev, chan, power_level);
-+	else if (rt2x00_rt(rt2x00dev, RT6352))
-+		rt2800_config_txpower_rt6352(rt2x00dev, chan, power_level);
- 	else
- 		rt2800_config_txpower_rt28xx(rt2x00dev, chan, power_level);
- }
-@@ -4393,6 +4827,7 @@ void rt2800_vco_calibration(struct rt2x0
- {
- 	u32	tx_pin;
- 	u8	rfcsr;
-+	unsigned long min_sleep = 0;
- 
- 	/*
- 	 * A voltage-controlled oscillator(VCO) is an electronic oscillator
-@@ -4431,6 +4866,15 @@ void rt2800_vco_calibration(struct rt2x0
- 		rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr);
- 		rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
- 		rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
-+		min_sleep = 1000;
-+		break;
-+	case RF7620:
-+		rt2800_rfcsr_write(rt2x00dev, 5, 0x40);
-+		rt2800_rfcsr_write(rt2x00dev, 4, 0x0C);
-+		rt2800_rfcsr_read(rt2x00dev, 4, &rfcsr);
-+		rt2x00_set_field8(&rfcsr, RFCSR4_VCOCAL_EN, 1);
-+		rt2800_rfcsr_write(rt2x00dev, 4, rfcsr);
-+		min_sleep = 2000;
- 		break;
- 	default:
- 		WARN_ONCE(1, "Not supported RF chipet %x for VCO recalibration",
-@@ -4438,7 +4882,8 @@ void rt2800_vco_calibration(struct rt2x0
- 		return;
- 	}
- 
--	usleep_range(1000, 1500);
-+	if (min_sleep > 0)
-+		usleep_range(min_sleep, min_sleep * 2);
- 
- 	rt2800_register_read(rt2x00dev, TX_PIN_CFG, &tx_pin);
- 	if (rt2x00dev->rf_channel <= 14) {
-@@ -4470,6 +4915,42 @@ void rt2800_vco_calibration(struct rt2x0
- 	}
- 	rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
- 
-+	if (rt2x00_rt(rt2x00dev, RT6352)) {
-+		if (rt2x00dev->default_ant.tx_chain_num == 1) {
-+			rt2800_bbp_write(rt2x00dev, 91, 0x07);
-+			rt2800_bbp_write(rt2x00dev, 95, 0x1A);
-+			rt2800_bbp_write(rt2x00dev, 195, 128);
-+			rt2800_bbp_write(rt2x00dev, 196, 0xA0);
-+			rt2800_bbp_write(rt2x00dev, 195, 170);
-+			rt2800_bbp_write(rt2x00dev, 196, 0x12);
-+			rt2800_bbp_write(rt2x00dev, 195, 171);
-+			rt2800_bbp_write(rt2x00dev, 196, 0x10);
-+		} else {
-+			rt2800_bbp_write(rt2x00dev, 91, 0x06);
-+			rt2800_bbp_write(rt2x00dev, 95, 0x9A);
-+			rt2800_bbp_write(rt2x00dev, 195, 128);
-+			rt2800_bbp_write(rt2x00dev, 196, 0xE0);
-+			rt2800_bbp_write(rt2x00dev, 195, 170);
-+			rt2800_bbp_write(rt2x00dev, 196, 0x30);
-+			rt2800_bbp_write(rt2x00dev, 195, 171);
-+			rt2800_bbp_write(rt2x00dev, 196, 0x30);
-+		}
-+
-+		if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
-+			rt2800_bbp_write(rt2x00dev, 75, 0x60);
-+			rt2800_bbp_write(rt2x00dev, 76, 0x44);
-+			rt2800_bbp_write(rt2x00dev, 79, 0x1C);
-+			rt2800_bbp_write(rt2x00dev, 80, 0x0C);
-+			rt2800_bbp_write(rt2x00dev, 82, 0xB6);
-+		}
-+
-+		/* On 11A, We should delay and wait RF/BBP to be stable
-+		 * and the appropriate time should be 1000 micro seconds
-+		 * 2005/06/05 - On 11G, we also need this delay time.
-+		 * Otherwise it's difficult to pass the WHQL.
-+		 */
-+		usleep_range(1000, 1500);
-+	}
- }
- EXPORT_SYMBOL_GPL(rt2800_vco_calibration);
- 
-@@ -4568,7 +5049,8 @@ static u8 rt2800_get_default_vgc(struct
- 		    rt2x00_rt(rt2x00dev, RT3593) ||
- 		    rt2x00_rt(rt2x00dev, RT5390) ||
- 		    rt2x00_rt(rt2x00dev, RT5392) ||
--		    rt2x00_rt(rt2x00dev, RT5592))
-+		    rt2x00_rt(rt2x00dev, RT5592) ||
-+		    rt2x00_rt(rt2x00dev, RT6352))
- 			vgc = 0x1c + (2 * rt2x00dev->lna_gain);
- 		else
- 			vgc = 0x2e + rt2x00dev->lna_gain;
-@@ -4795,7 +5277,8 @@ static int rt2800_init_registers(struct
- 					      0x00000000);
- 		}
- 	} else if (rt2x00_rt(rt2x00dev, RT5390) ||
--		   rt2x00_rt(rt2x00dev, RT5392)) {
-+		   rt2x00_rt(rt2x00dev, RT5392) ||
-+		   rt2x00_rt(rt2x00dev, RT6352)) {
- 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
- 		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
- 		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
-@@ -4805,6 +5288,24 @@ static int rt2800_init_registers(struct
- 		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
- 	} else if (rt2x00_rt(rt2x00dev, RT5350)) {
- 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
-+	} else if (rt2x00_rt(rt2x00dev, RT6352)) {
-+		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401);
-+		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000);
-+		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
-+		rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
-+		rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
-+		rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606);
-+		rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
-+		rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0);
-+		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
-+		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C);
-+		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT,
-+				      0x3630363A);
-+		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_CORRECT,
-+				      0x3630363A);
-+		rt2800_register_read(rt2x00dev, TX_ALC_CFG_1, &reg);
-+		rt2x00_set_field32(&reg, TX_ALC_CFG_1_ROS_BUSY_EN, 0);
-+		rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg);
- 	} else {
- 		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
- 		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
-@@ -5786,6 +6287,231 @@ static void rt2800_init_bbp_5592(struct
- 		rt2800_bbp_write(rt2x00dev, 103, 0xc0);
- }
- 
-+static void rt2800_bbp_glrt_write(struct rt2x00_dev *rt2x00dev,
-+				  const u8 reg, const u8 value)
-+{
-+	rt2800_bbp_write(rt2x00dev, 195, reg);
-+	rt2800_bbp_write(rt2x00dev, 196, value);
-+}
-+
-+static void rt2800_bbp_dcoc_write(struct rt2x00_dev *rt2x00dev,
-+				  const u8 reg, const u8 value)
-+{
-+	rt2800_bbp_write(rt2x00dev, 158, reg);
-+	rt2800_bbp_write(rt2x00dev, 159, value);
-+}
-+
-+static void rt2800_bbp_dcoc_read(struct rt2x00_dev *rt2x00dev,
-+				 const u8 reg, u8 *value)
-+{
-+	rt2800_bbp_write(rt2x00dev, 158, reg);
-+	rt2800_bbp_read(rt2x00dev, 159, value);
-+}
-+
-+static void rt2800_init_bbp_6352(struct rt2x00_dev *rt2x00dev)
-+{
-+	u8 bbp;
-+
-+	/* Apply Maximum Likelihood Detection (MLD) for 2 stream case */
-+	rt2800_bbp_read(rt2x00dev, 105, &bbp);
-+	rt2x00_set_field8(&bbp, BBP105_MLD,
-+			  rt2x00dev->default_ant.rx_chain_num == 2);
-+	rt2800_bbp_write(rt2x00dev, 105, bbp);
-+
-+	/* Avoid data loss and CRC errors */
-+	rt2800_bbp4_mac_if_ctrl(rt2x00dev);
-+
-+	/* Fix I/Q swap issue */
-+	rt2800_bbp_read(rt2x00dev, 1, &bbp);
-+	bbp |= 0x04;
-+	rt2800_bbp_write(rt2x00dev, 1, bbp);
-+
-+	/* BBP for G band */
-+	rt2800_bbp_write(rt2x00dev, 3, 0x08);
-+	rt2800_bbp_write(rt2x00dev, 4, 0x00); /* rt2800_bbp4_mac_if_ctrl? */
-+	rt2800_bbp_write(rt2x00dev, 6, 0x08);
-+	rt2800_bbp_write(rt2x00dev, 14, 0x09);
-+	rt2800_bbp_write(rt2x00dev, 15, 0xFF);
-+	rt2800_bbp_write(rt2x00dev, 16, 0x01);
-+	rt2800_bbp_write(rt2x00dev, 20, 0x06);
-+	rt2800_bbp_write(rt2x00dev, 21, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 22, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 27, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 28, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 30, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 31, 0x48);
-+	rt2800_bbp_write(rt2x00dev, 47, 0x40);
-+	rt2800_bbp_write(rt2x00dev, 62, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 63, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 64, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 65, 0x2C);
-+	rt2800_bbp_write(rt2x00dev, 66, 0x1C);
-+	rt2800_bbp_write(rt2x00dev, 67, 0x20);
-+	rt2800_bbp_write(rt2x00dev, 68, 0xDD);
-+	rt2800_bbp_write(rt2x00dev, 69, 0x10);
-+	rt2800_bbp_write(rt2x00dev, 70, 0x05);
-+	rt2800_bbp_write(rt2x00dev, 73, 0x18);
-+	rt2800_bbp_write(rt2x00dev, 74, 0x0F);
-+	rt2800_bbp_write(rt2x00dev, 75, 0x60);
-+	rt2800_bbp_write(rt2x00dev, 76, 0x44);
-+	rt2800_bbp_write(rt2x00dev, 77, 0x59);
-+	rt2800_bbp_write(rt2x00dev, 78, 0x1E);
-+	rt2800_bbp_write(rt2x00dev, 79, 0x1C);
-+	rt2800_bbp_write(rt2x00dev, 80, 0x0C);
-+	rt2800_bbp_write(rt2x00dev, 81, 0x3A);
-+	rt2800_bbp_write(rt2x00dev, 82, 0xB6);
-+	rt2800_bbp_write(rt2x00dev, 83, 0x9A);
-+	rt2800_bbp_write(rt2x00dev, 84, 0x9A);
-+	rt2800_bbp_write(rt2x00dev, 86, 0x38);
-+	rt2800_bbp_write(rt2x00dev, 88, 0x90);
-+	rt2800_bbp_write(rt2x00dev, 91, 0x04);
-+	rt2800_bbp_write(rt2x00dev, 92, 0x02);
-+	rt2800_bbp_write(rt2x00dev, 95, 0x9A);
-+	rt2800_bbp_write(rt2x00dev, 96, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 103, 0xC0);
-+	rt2800_bbp_write(rt2x00dev, 104, 0x92);
-+	/* FIXME BBP105 owerwrite */
-+	rt2800_bbp_write(rt2x00dev, 105, 0x3C);
-+	rt2800_bbp_write(rt2x00dev, 106, 0x12);
-+	rt2800_bbp_write(rt2x00dev, 109, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 134, 0x10);
-+	rt2800_bbp_write(rt2x00dev, 135, 0xA6);
-+	rt2800_bbp_write(rt2x00dev, 137, 0x04);
-+	rt2800_bbp_write(rt2x00dev, 142, 0x30);
-+	rt2800_bbp_write(rt2x00dev, 143, 0xF7);
-+	rt2800_bbp_write(rt2x00dev, 160, 0xEC);
-+	rt2800_bbp_write(rt2x00dev, 161, 0xC4);
-+	rt2800_bbp_write(rt2x00dev, 162, 0x77);
-+	rt2800_bbp_write(rt2x00dev, 163, 0xF9);
-+	rt2800_bbp_write(rt2x00dev, 164, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 165, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 186, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 187, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 188, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 186, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 187, 0x01);
-+	rt2800_bbp_write(rt2x00dev, 188, 0x00);
-+	rt2800_bbp_write(rt2x00dev, 189, 0x00);
-+
-+	rt2800_bbp_write(rt2x00dev, 91, 0x06);
-+	rt2800_bbp_write(rt2x00dev, 92, 0x04);
-+	rt2800_bbp_write(rt2x00dev, 93, 0x54);
-+	rt2800_bbp_write(rt2x00dev, 99, 0x50);
-+	rt2800_bbp_write(rt2x00dev, 148, 0x84);
-+	rt2800_bbp_write(rt2x00dev, 167, 0x80);
-+	rt2800_bbp_write(rt2x00dev, 178, 0xFF);
-+	rt2800_bbp_write(rt2x00dev, 106, 0x13);
-+
-+	/* BBP for G band GLRT function (BBP_128 ~ BBP_221) */
-+	rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00);
-+	rt2800_bbp_glrt_write(rt2x00dev, 1, 0x14);
-+	rt2800_bbp_glrt_write(rt2x00dev, 2, 0x20);
-+	rt2800_bbp_glrt_write(rt2x00dev, 3, 0x0A);
-+	rt2800_bbp_glrt_write(rt2x00dev, 10, 0x16);
-+	rt2800_bbp_glrt_write(rt2x00dev, 11, 0x06);
-+	rt2800_bbp_glrt_write(rt2x00dev, 12, 0x02);
-+	rt2800_bbp_glrt_write(rt2x00dev, 13, 0x07);
-+	rt2800_bbp_glrt_write(rt2x00dev, 14, 0x05);
-+	rt2800_bbp_glrt_write(rt2x00dev, 15, 0x09);
-+	rt2800_bbp_glrt_write(rt2x00dev, 16, 0x20);
-+	rt2800_bbp_glrt_write(rt2x00dev, 17, 0x08);
-+	rt2800_bbp_glrt_write(rt2x00dev, 18, 0x4A);
-+	rt2800_bbp_glrt_write(rt2x00dev, 19, 0x00);
-+	rt2800_bbp_glrt_write(rt2x00dev, 20, 0x00);
-+	rt2800_bbp_glrt_write(rt2x00dev, 128, 0xE0);
-+	rt2800_bbp_glrt_write(rt2x00dev, 129, 0x1F);
-+	rt2800_bbp_glrt_write(rt2x00dev, 130, 0x4F);
-+	rt2800_bbp_glrt_write(rt2x00dev, 131, 0x32);
-+	rt2800_bbp_glrt_write(rt2x00dev, 132, 0x08);
-+	rt2800_bbp_glrt_write(rt2x00dev, 133, 0x28);
-+	rt2800_bbp_glrt_write(rt2x00dev, 134, 0x19);
-+	rt2800_bbp_glrt_write(rt2x00dev, 135, 0x0A);
-+	rt2800_bbp_glrt_write(rt2x00dev, 138, 0x16);
-+	rt2800_bbp_glrt_write(rt2x00dev, 139, 0x10);
-+	rt2800_bbp_glrt_write(rt2x00dev, 140, 0x10);
-+	rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1A);
-+	rt2800_bbp_glrt_write(rt2x00dev, 142, 0x36);
-+	rt2800_bbp_glrt_write(rt2x00dev, 143, 0x2C);
-+	rt2800_bbp_glrt_write(rt2x00dev, 144, 0x26);
-+	rt2800_bbp_glrt_write(rt2x00dev, 145, 0x24);
-+	rt2800_bbp_glrt_write(rt2x00dev, 146, 0x42);
-+	rt2800_bbp_glrt_write(rt2x00dev, 147, 0x40);
-+	rt2800_bbp_glrt_write(rt2x00dev, 148, 0x30);
-+	rt2800_bbp_glrt_write(rt2x00dev, 149, 0x29);
-+	rt2800_bbp_glrt_write(rt2x00dev, 150, 0x4C);
-+	rt2800_bbp_glrt_write(rt2x00dev, 151, 0x46);
-+	rt2800_bbp_glrt_write(rt2x00dev, 152, 0x3D);
-+	rt2800_bbp_glrt_write(rt2x00dev, 153, 0x40);
-+	rt2800_bbp_glrt_write(rt2x00dev, 154, 0x3E);
-+	rt2800_bbp_glrt_write(rt2x00dev, 155, 0x38);
-+	rt2800_bbp_glrt_write(rt2x00dev, 156, 0x3D);
-+	rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2F);
-+	rt2800_bbp_glrt_write(rt2x00dev, 158, 0x3C);
-+	rt2800_bbp_glrt_write(rt2x00dev, 159, 0x34);
-+	rt2800_bbp_glrt_write(rt2x00dev, 160, 0x2C);
-+	rt2800_bbp_glrt_write(rt2x00dev, 161, 0x2F);
-+	rt2800_bbp_glrt_write(rt2x00dev, 162, 0x3C);
-+	rt2800_bbp_glrt_write(rt2x00dev, 163, 0x35);
-+	rt2800_bbp_glrt_write(rt2x00dev, 164, 0x2E);
-+	rt2800_bbp_glrt_write(rt2x00dev, 165, 0x2F);
-+	rt2800_bbp_glrt_write(rt2x00dev, 166, 0x49);
-+	rt2800_bbp_glrt_write(rt2x00dev, 167, 0x41);
-+	rt2800_bbp_glrt_write(rt2x00dev, 168, 0x36);
-+	rt2800_bbp_glrt_write(rt2x00dev, 169, 0x39);
-+	rt2800_bbp_glrt_write(rt2x00dev, 170, 0x30);
-+	rt2800_bbp_glrt_write(rt2x00dev, 171, 0x30);
-+	rt2800_bbp_glrt_write(rt2x00dev, 172, 0x0E);
-+	rt2800_bbp_glrt_write(rt2x00dev, 173, 0x0D);
-+	rt2800_bbp_glrt_write(rt2x00dev, 174, 0x28);
-+	rt2800_bbp_glrt_write(rt2x00dev, 175, 0x21);
-+	rt2800_bbp_glrt_write(rt2x00dev, 176, 0x1C);
-+	rt2800_bbp_glrt_write(rt2x00dev, 177, 0x16);
-+	rt2800_bbp_glrt_write(rt2x00dev, 178, 0x50);
-+	rt2800_bbp_glrt_write(rt2x00dev, 179, 0x4A);
-+	rt2800_bbp_glrt_write(rt2x00dev, 180, 0x43);
-+	rt2800_bbp_glrt_write(rt2x00dev, 181, 0x50);
-+	rt2800_bbp_glrt_write(rt2x00dev, 182, 0x10);
-+	rt2800_bbp_glrt_write(rt2x00dev, 183, 0x10);
-+	rt2800_bbp_glrt_write(rt2x00dev, 184, 0x10);
-+	rt2800_bbp_glrt_write(rt2x00dev, 185, 0x10);
-+	rt2800_bbp_glrt_write(rt2x00dev, 200, 0x7D);
-+	rt2800_bbp_glrt_write(rt2x00dev, 201, 0x14);
-+	rt2800_bbp_glrt_write(rt2x00dev, 202, 0x32);
-+	rt2800_bbp_glrt_write(rt2x00dev, 203, 0x2C);
-+	rt2800_bbp_glrt_write(rt2x00dev, 204, 0x36);
-+	rt2800_bbp_glrt_write(rt2x00dev, 205, 0x4C);
-+	rt2800_bbp_glrt_write(rt2x00dev, 206, 0x43);
-+	rt2800_bbp_glrt_write(rt2x00dev, 207, 0x2C);
-+	rt2800_bbp_glrt_write(rt2x00dev, 208, 0x2E);
-+	rt2800_bbp_glrt_write(rt2x00dev, 209, 0x36);
-+	rt2800_bbp_glrt_write(rt2x00dev, 210, 0x30);
-+	rt2800_bbp_glrt_write(rt2x00dev, 211, 0x6E);
-+
-+	/* BBP for G band DCOC function */
-+	rt2800_bbp_dcoc_write(rt2x00dev, 140, 0x0C);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 141, 0x00);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 142, 0x10);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 143, 0x10);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 144, 0x10);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 145, 0x10);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 146, 0x08);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 147, 0x40);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 148, 0x04);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 149, 0x04);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 150, 0x08);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 151, 0x08);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 152, 0x03);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 153, 0x03);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 154, 0x03);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 155, 0x02);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 156, 0x40);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 157, 0x40);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 158, 0x64);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 159, 0x64);
-+
-+	rt2800_bbp4_mac_if_ctrl(rt2x00dev);
-+}
-+
- static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
- {
- 	unsigned int i;
-@@ -5830,6 +6556,9 @@ static void rt2800_init_bbp(struct rt2x0
- 	case RT5592:
- 		rt2800_init_bbp_5592(rt2x00dev);
- 		return;
-+	case RT6352:
-+		rt2800_init_bbp_6352(rt2x00dev);
-+		break;
- 	}
- 
- 	for (i = 0; i < EEPROM_BBP_SIZE; i++) {
-@@ -6901,6 +7630,615 @@ static void rt2800_init_rfcsr_5592(struc
- 	rt2800_led_open_drain_enable(rt2x00dev);
- }
- 
-+static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev,
-+				       bool set_bw, bool is_ht40)
-+{
-+	u8 bbp_val;
-+
-+	rt2800_bbp_read(rt2x00dev, 21, &bbp_val);
-+	bbp_val |= 0x1;
-+	rt2800_bbp_write(rt2x00dev, 21, bbp_val);
-+	usleep_range(100, 200);
-+
-+	if (set_bw) {
-+		rt2800_bbp_read(rt2x00dev, 4, &bbp_val);
-+		rt2x00_set_field8(&bbp_val, BBP4_BANDWIDTH, 2 * is_ht40);
-+		rt2800_bbp_write(rt2x00dev, 4, bbp_val);
-+		usleep_range(100, 200);
-+	}
-+
-+	rt2800_bbp_read(rt2x00dev, 21, &bbp_val);
-+	bbp_val &= (~0x1);
-+	rt2800_bbp_write(rt2x00dev, 21, bbp_val);
-+	usleep_range(100, 200);
-+}
-+
-+static int rt2800_rf_lp_config(struct rt2x00_dev *rt2x00dev, bool btxcal)
-+{
-+	u8 rf_val;
-+
-+	if (btxcal)
-+		rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04);
-+	else
-+		rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x02);
-+
-+	rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x06);
-+
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 17, &rf_val);
-+	rf_val |= 0x80;
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, rf_val);
-+
-+	if (btxcal) {
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, 0xC1);
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, 0x20);
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, 0x02);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 5, 3, &rf_val);
-+		rf_val &= (~0x3F);
-+		rf_val |= 0x3F;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, rf_val);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 5, 4, &rf_val);
-+		rf_val &= (~0x3F);
-+		rf_val |= 0x3F;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, rf_val);
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 5, 0x31);
-+	} else {
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, 0xF1);
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, 0x18);
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, 0x02);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 5, 3, &rf_val);
-+		rf_val &= (~0x3F);
-+		rf_val |= 0x34;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, rf_val);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 5, 4, &rf_val);
-+		rf_val &= (~0x3F);
-+		rf_val |= 0x34;
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, rf_val);
-+	}
-+
-+	return 0;
-+}
-+
-+static char rt2800_lp_tx_filter_bw_cal(struct rt2x00_dev *rt2x00dev)
-+{
-+	unsigned int cnt;
-+	u8 bbp_val;
-+	char cal_val;
-+
-+	rt2800_bbp_dcoc_write(rt2x00dev, 0, 0x82);
-+
-+	cnt = 0;
-+	do {
-+		usleep_range(500, 2000);
-+		rt2800_bbp_read(rt2x00dev, 159, &bbp_val);
-+		if (bbp_val == 0x02 || cnt == 20)
-+			break;
-+
-+		cnt++;
-+	} while (cnt < 20);
-+
-+	rt2800_bbp_dcoc_read(rt2x00dev, 0x39, &bbp_val);
-+	cal_val = bbp_val & 0x7F;
-+	if (cal_val >= 0x40)
-+		cal_val -= 128;
-+
-+	return cal_val;
-+}
-+
-+static void rt2800_bw_filter_calibration(struct rt2x00_dev *rt2x00dev,
-+					 bool btxcal)
-+{
-+	struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
-+	u8 tx_agc_fc = 0, rx_agc_fc = 0, cmm_agc_fc;
-+	u8 filter_target;
-+	u8 tx_filter_target_20m = 0x09, tx_filter_target_40m = 0x02;
-+	u8 rx_filter_target_20m = 0x27, rx_filter_target_40m = 0x31;
-+	int loop = 0, is_ht40, cnt;
-+	u8 bbp_val, rf_val;
-+	char cal_r32_init, cal_r32_val, cal_diff;
-+	u8 saverfb5r00, saverfb5r01, saverfb5r03, saverfb5r04, saverfb5r05;
-+	u8 saverfb5r06, saverfb5r07;
-+	u8 saverfb5r08, saverfb5r17, saverfb5r18, saverfb5r19, saverfb5r20;
-+	u8 saverfb5r37, saverfb5r38, saverfb5r39, saverfb5r40, saverfb5r41;
-+	u8 saverfb5r42, saverfb5r43, saverfb5r44, saverfb5r45, saverfb5r46;
-+	u8 saverfb5r58, saverfb5r59;
-+	u8 savebbp159r0, savebbp159r2, savebbpr23;
-+	u32 MAC_RF_CONTROL0, MAC_RF_BYPASS0;
-+
-+	/* Save MAC registers */
-+	rt2800_register_read(rt2x00dev, RF_CONTROL0, &MAC_RF_CONTROL0);
-+	rt2800_register_read(rt2x00dev, RF_BYPASS0, &MAC_RF_BYPASS0);
-+
-+	/* save BBP registers */
-+	rt2800_bbp_read(rt2x00dev, 23, &savebbpr23);
-+
-+	rt2800_bbp_dcoc_read(rt2x00dev, 0, &savebbp159r0);
-+	rt2800_bbp_dcoc_read(rt2x00dev, 2, &savebbp159r2);
-+
-+	/* Save RF registers */
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 0, &saverfb5r00);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 1, &saverfb5r01);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 3, &saverfb5r03);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 4, &saverfb5r04);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 5, &saverfb5r05);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 6, &saverfb5r06);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 7, &saverfb5r07);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 8, &saverfb5r08);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 17, &saverfb5r17);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 18, &saverfb5r18);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 19, &saverfb5r19);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 20, &saverfb5r20);
-+
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 37, &saverfb5r37);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 38, &saverfb5r38);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 39, &saverfb5r39);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 40, &saverfb5r40);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 41, &saverfb5r41);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 42, &saverfb5r42);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 43, &saverfb5r43);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 44, &saverfb5r44);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 45, &saverfb5r45);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 46, &saverfb5r46);
-+
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 58, &saverfb5r58);
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 59, &saverfb5r59);
-+
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 0, &rf_val);
-+	rf_val |= 0x3;
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 0, rf_val);
-+
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 1, &rf_val);
-+	rf_val |= 0x1;
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 1, rf_val);
-+
-+	cnt = 0;
-+	do {
-+		usleep_range(500, 2000);
-+		rt2800_rfcsr_read_bank(rt2x00dev, 5, 1, &rf_val);
-+		if (((rf_val & 0x1) == 0x00) || (cnt == 40))
-+			break;
-+		cnt++;
-+	} while (cnt < 40);
-+
-+	rt2800_rfcsr_read_bank(rt2x00dev, 5, 0, &rf_val);
-+	rf_val &= (~0x3);
-+	rf_val |= 0x1;
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 0, rf_val);
-+
-+	/* I-3 */
-+	rt2800_bbp_read(rt2x00dev, 23, &bbp_val);
-+	bbp_val &= (~0x1F);
-+	bbp_val |= 0x10;
-+	rt2800_bbp_write(rt2x00dev, 23, bbp_val);
-+
-+	do {
-+		/* I-4,5,6,7,8,9 */
-+		if (loop == 0) {
-+			is_ht40 = false;
-+
-+			if (btxcal)
-+				filter_target = tx_filter_target_20m;
-+			else
-+				filter_target = rx_filter_target_20m;
-+		} else {
-+			is_ht40 = true;
-+
-+			if (btxcal)
-+				filter_target = tx_filter_target_40m;
-+			else
-+				filter_target = rx_filter_target_40m;
-+		}
-+
-+		rt2800_rfcsr_read_bank(rt2x00dev, 5, 8, &rf_val);
-+		rf_val &= (~0x04);
-+		if (loop == 1)
-+			rf_val |= 0x4;
-+
-+		rt2800_rfcsr_write_bank(rt2x00dev, 5, 8, rf_val);
-+
-+		rt2800_bbp_core_soft_reset(rt2x00dev, true, is_ht40);
-+
-+		rt2800_rf_lp_config(rt2x00dev, btxcal);
-+		if (btxcal) {
-+			tx_agc_fc = 0;
-+			rt2800_rfcsr_read_bank(rt2x00dev, 5, 58, &rf_val);
-+			rf_val &= (~0x7F);
-+			rt2800_rfcsr_write_bank(rt2x00dev, 5, 58, rf_val);
-+			rt2800_rfcsr_read_bank(rt2x00dev, 5, 59, &rf_val);
-+			rf_val &= (~0x7F);
-+			rt2800_rfcsr_write_bank(rt2x00dev, 5, 59, rf_val);
-+		} else {
-+			rx_agc_fc = 0;
-+			rt2800_rfcsr_read_bank(rt2x00dev, 5, 6, &rf_val);
-+			rf_val &= (~0x7F);
-+			rt2800_rfcsr_write_bank(rt2x00dev, 5, 6, rf_val);
-+			rt2800_rfcsr_read_bank(rt2x00dev, 5, 7, &rf_val);
-+			rf_val &= (~0x7F);
-+			rt2800_rfcsr_write_bank(rt2x00dev, 5, 7, rf_val);
-+		}
-+
-+		usleep_range(1000, 2000);
-+
-+		rt2800_bbp_dcoc_read(rt2x00dev, 2, &bbp_val);
-+		bbp_val &= (~0x6);
-+		rt2800_bbp_dcoc_write(rt2x00dev, 2, bbp_val);
-+
-+		rt2800_bbp_core_soft_reset(rt2x00dev, false, is_ht40);
-+
-+		cal_r32_init = rt2800_lp_tx_filter_bw_cal(rt2x00dev);
-+
-+		rt2800_bbp_dcoc_read(rt2x00dev, 2, &bbp_val);
-+		bbp_val |= 0x6;
-+		rt2800_bbp_dcoc_write(rt2x00dev, 2, bbp_val);
-+do_cal:
-+		if (btxcal) {
-+			rt2800_rfcsr_read_bank(rt2x00dev, 5, 58, &rf_val);
-+			rf_val &= (~0x7F);
-+			rf_val |= tx_agc_fc;
-+			rt2800_rfcsr_write_bank(rt2x00dev, 5, 58, rf_val);
-+			rt2800_rfcsr_read_bank(rt2x00dev, 5, 59, &rf_val);
-+			rf_val &= (~0x7F);
-+			rf_val |= tx_agc_fc;
-+			rt2800_rfcsr_write_bank(rt2x00dev, 5, 59, rf_val);
-+		} else {
-+			rt2800_rfcsr_read_bank(rt2x00dev, 5, 6, &rf_val);
-+			rf_val &= (~0x7F);
-+			rf_val |= rx_agc_fc;
-+			rt2800_rfcsr_write_bank(rt2x00dev, 5, 6, rf_val);
-+			rt2800_rfcsr_read_bank(rt2x00dev, 5, 7, &rf_val);
-+			rf_val &= (~0x7F);
-+			rf_val |= rx_agc_fc;
-+			rt2800_rfcsr_write_bank(rt2x00dev, 5, 7, rf_val);
-+		}
-+
-+		usleep_range(500, 1000);
-+
-+		rt2800_bbp_core_soft_reset(rt2x00dev, false, is_ht40);
-+
-+		cal_r32_val = rt2800_lp_tx_filter_bw_cal(rt2x00dev);
-+
-+		cal_diff = cal_r32_init - cal_r32_val;
-+
-+		if (btxcal)
-+			cmm_agc_fc = tx_agc_fc;
-+		else
-+			cmm_agc_fc = rx_agc_fc;
-+
-+		if (((cal_diff > filter_target) && (cmm_agc_fc == 0)) ||
-+		    ((cal_diff < filter_target) && (cmm_agc_fc == 0x3f))) {
-+			if (btxcal)
-+				tx_agc_fc = 0;
-+			else
-+				rx_agc_fc = 0;
-+		} else if ((cal_diff <= filter_target) && (cmm_agc_fc < 0x3f)) {
-+			if (btxcal)
-+				tx_agc_fc++;
-+			else
-+				rx_agc_fc++;
-+			goto do_cal;
-+		}
-+
-+		if (btxcal) {
-+			if (loop == 0)
-+				drv_data->tx_calibration_bw20 = tx_agc_fc;
-+			else
-+				drv_data->tx_calibration_bw40 = tx_agc_fc;
-+		} else {
-+			if (loop == 0)
-+				drv_data->rx_calibration_bw20 = rx_agc_fc;
-+			else
-+				drv_data->rx_calibration_bw40 = rx_agc_fc;
-+		}
-+
-+		loop++;
-+	} while (loop <= 1);
-+
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 0, saverfb5r00);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 1, saverfb5r01);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, saverfb5r03);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r04);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 5, saverfb5r05);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 6, saverfb5r06);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 7, saverfb5r07);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 8, saverfb5r08);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, saverfb5r17);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, saverfb5r18);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, saverfb5r19);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, saverfb5r20);
-+
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 37, saverfb5r37);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 38, saverfb5r38);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 39, saverfb5r39);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 40, saverfb5r40);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 41, saverfb5r41);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 42, saverfb5r42);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 43, saverfb5r43);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 44, saverfb5r44);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 45, saverfb5r45);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 46, saverfb5r46);
-+
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 58, saverfb5r58);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 5, 59, saverfb5r59);
-+
-+	rt2800_bbp_write(rt2x00dev, 23, savebbpr23);
-+
-+	rt2800_bbp_dcoc_write(rt2x00dev, 0, savebbp159r0);
-+	rt2800_bbp_dcoc_write(rt2x00dev, 2, savebbp159r2);
-+
-+	rt2800_bbp_read(rt2x00dev, 4, &bbp_val);
-+	rt2x00_set_field8(&bbp_val, BBP4_BANDWIDTH,
-+			  2 * test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags));
-+	rt2800_bbp_write(rt2x00dev, 4, bbp_val);
-+
-+	rt2800_register_write(rt2x00dev, RF_CONTROL0, MAC_RF_CONTROL0);
-+	rt2800_register_write(rt2x00dev, RF_BYPASS0, MAC_RF_BYPASS0);
-+}
-+
-+static void rt2800_init_rfcsr_6352(struct rt2x00_dev *rt2x00dev)
-+{
-+	/* Initialize RF central register to default value */
-+	rt2800_rfcsr_write(rt2x00dev, 0, 0x02);
-+	rt2800_rfcsr_write(rt2x00dev, 1, 0x03);
-+	rt2800_rfcsr_write(rt2x00dev, 2, 0x33);
-+	rt2800_rfcsr_write(rt2x00dev, 3, 0xFF);
-+	rt2800_rfcsr_write(rt2x00dev, 4, 0x0C);
-+	rt2800_rfcsr_write(rt2x00dev, 5, 0x40);
-+	rt2800_rfcsr_write(rt2x00dev, 6, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 7, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 8, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 9, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 10, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 11, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 12, rt2x00dev->freq_offset);
-+	rt2800_rfcsr_write(rt2x00dev, 13, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 14, 0x40);
-+	rt2800_rfcsr_write(rt2x00dev, 15, 0x22);
-+	rt2800_rfcsr_write(rt2x00dev, 16, 0x4C);
-+	rt2800_rfcsr_write(rt2x00dev, 17, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 18, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 19, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 20, 0xA0);
-+	rt2800_rfcsr_write(rt2x00dev, 21, 0x12);
-+	rt2800_rfcsr_write(rt2x00dev, 22, 0x07);
-+	rt2800_rfcsr_write(rt2x00dev, 23, 0x13);
-+	rt2800_rfcsr_write(rt2x00dev, 24, 0xFE);
-+	rt2800_rfcsr_write(rt2x00dev, 25, 0x24);
-+	rt2800_rfcsr_write(rt2x00dev, 26, 0x7A);
-+	rt2800_rfcsr_write(rt2x00dev, 27, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 28, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 29, 0x05);
-+	rt2800_rfcsr_write(rt2x00dev, 30, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 31, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 32, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 34, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 35, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 36, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 37, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 38, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 39, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 40, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 41, 0xD0);
-+	rt2800_rfcsr_write(rt2x00dev, 42, 0x5B);
-+	rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
-+
-+	rt2800_rfcsr_write(rt2x00dev, 11, 0x21);
-+	if (rt2800_clk_is_20mhz(rt2x00dev))
-+		rt2800_rfcsr_write(rt2x00dev, 13, 0x03);
-+	else
-+		rt2800_rfcsr_write(rt2x00dev, 13, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 14, 0x7C);
-+	rt2800_rfcsr_write(rt2x00dev, 16, 0x80);
-+	rt2800_rfcsr_write(rt2x00dev, 17, 0x99);
-+	rt2800_rfcsr_write(rt2x00dev, 18, 0x99);
-+	rt2800_rfcsr_write(rt2x00dev, 19, 0x09);
-+	rt2800_rfcsr_write(rt2x00dev, 20, 0x50);
-+	rt2800_rfcsr_write(rt2x00dev, 21, 0xB0);
-+	rt2800_rfcsr_write(rt2x00dev, 22, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 23, 0x06);
-+	rt2800_rfcsr_write(rt2x00dev, 24, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 25, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 26, 0x5D);
-+	rt2800_rfcsr_write(rt2x00dev, 27, 0x00);
-+	rt2800_rfcsr_write(rt2x00dev, 28, 0x61);
-+	rt2800_rfcsr_write(rt2x00dev, 29, 0xB5);
-+	rt2800_rfcsr_write(rt2x00dev, 43, 0x02);
-+
-+	rt2800_rfcsr_write(rt2x00dev, 28, 0x62);
-+	rt2800_rfcsr_write(rt2x00dev, 29, 0xAD);
-+	rt2800_rfcsr_write(rt2x00dev, 39, 0x80);
-+
-+	/* Initialize RF channel register to default value */
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 1, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 2, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 3, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 4, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 5, 0x08);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 6, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 7, 0x51);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x53);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x16);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x61);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 12, 0x22);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 13, 0x3D);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 15, 0x13);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 16, 0x22);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x27);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 20, 0x01);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 21, 0x52);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 22, 0x80);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 23, 0xB3);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 24, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 25, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 26, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 27, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x5C);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 29, 0x6B);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 30, 0x6B);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 31, 0x31);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 32, 0x5D);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 33, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 34, 0xE6);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 35, 0x55);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 36, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 37, 0xBB);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 38, 0xB3);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 39, 0xB3);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 40, 0x03);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 41, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 42, 0x00);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xB3);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xD3);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x07);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x68);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xEF);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1C);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x07);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xA8);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0x85);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x10);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x07);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6A);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0x85);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x10);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 62, 0x1C);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 63, 0x00);
-+
-+	rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5);
-+
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x47);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x71);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x33);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x0E);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA4);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 20, 0x02);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 21, 0x12);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x1C);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 29, 0xEB);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 32, 0x7D);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 34, 0xD6);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 36, 0x08);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 38, 0xB4);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xB3);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x69);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFF);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x20);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xFF);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1C);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x20);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09);
-+
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x2C);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x64);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x51);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16);
-+
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B);
-+
-+	/* Initialize RF channel register for DRQFN */
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xE3);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xE5);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x28);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x68);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xF7);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x02);
-+	rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xC7);
-+
-+	/* Initialize RF DC calibration register to default value */
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 1, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 2, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 3, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 6, 0x10);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 7, 0x10);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 8, 0x04);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 9, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 10, 0x07);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 11, 0x01);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 12, 0x07);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 13, 0x07);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 14, 0x07);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 15, 0x20);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 16, 0x22);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 18, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 19, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 20, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 21, 0xF1);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 22, 0x11);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 23, 0x02);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 24, 0x41);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 25, 0x20);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 26, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 27, 0xD7);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 28, 0xA2);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 29, 0x20);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 30, 0x49);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 31, 0x20);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 32, 0x04);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 33, 0xF1);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 34, 0xA1);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 35, 0x01);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 41, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 42, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 43, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 44, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 45, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 46, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 47, 0x3E);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 48, 0x3D);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 49, 0x3E);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 50, 0x3D);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 51, 0x3E);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 52, 0x3D);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 53, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 54, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 55, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 56, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 57, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 58, 0x10);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x10);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 60, 0x0A);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 61, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00);
-+
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 3, 0x08);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x04);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x20);
-+
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
-+	rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
-+
-+	rt2800_bw_filter_calibration(rt2x00dev, true);
-+	rt2800_bw_filter_calibration(rt2x00dev, false);
-+}
-+
- static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
- {
- 	if (rt2800_is_305x_soc(rt2x00dev)) {
-@@ -6941,6 +8279,9 @@ static void rt2800_init_rfcsr(struct rt2
- 	case RT5592:
- 		rt2800_init_rfcsr_5592(rt2x00dev);
- 		break;
-+	case RT6352:
-+		rt2800_init_rfcsr_6352(rt2x00dev);
-+		break;
- 	}
- }
- 
-@@ -7307,7 +8648,8 @@ static int rt2800_init_eeprom(struct rt2
- 	 */
- 	if (rt2x00_rt(rt2x00dev, RT3290) ||
- 	    rt2x00_rt(rt2x00dev, RT5390) ||
--	    rt2x00_rt(rt2x00dev, RT5392))
-+	    rt2x00_rt(rt2x00dev, RT5392) ||
-+	    rt2x00_rt(rt2x00dev, RT6352))
- 		rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
- 	else if (rt2x00_rt(rt2x00dev, RT3352))
- 		rf = RF3322;
-@@ -7339,6 +8681,7 @@ static int rt2800_init_eeprom(struct rt2
- 	case RF5390:
- 	case RF5392:
- 	case RF5592:
-+	case RF7620:
- 		break;
- 	default:
- 		rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
-@@ -7746,6 +9089,23 @@ static const struct rf_channel rf_vals_5
- 	{196, 83, 0, 12, 1},
- };
- 
-+static const struct rf_channel rf_vals_7620[] = {
-+	{1, 0x50, 0x99, 0x99, 1},
-+	{2, 0x50, 0x44, 0x44, 2},
-+	{3, 0x50, 0xEE, 0xEE, 2},
-+	{4, 0x50, 0x99, 0x99, 3},
-+	{5, 0x51, 0x44, 0x44, 0},
-+	{6, 0x51, 0xEE, 0xEE, 0},
-+	{7, 0x51, 0x99, 0x99, 1},
-+	{8, 0x51, 0x44, 0x44, 2},
-+	{9, 0x51, 0xEE, 0xEE, 2},
-+	{10, 0x51, 0x99, 0x99, 3},
-+	{11, 0x52, 0x44, 0x44, 0},
-+	{12, 0x52, 0xEE, 0xEE, 0},
-+	{13, 0x52, 0x99, 0x99, 1},
-+	{14, 0x52, 0x33, 0x33, 3},
-+};
-+
- static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
- {
- 	struct hw_mode_spec *spec = &rt2x00dev->spec;
-@@ -7849,6 +9209,11 @@ static int rt2800_probe_hw_mode(struct r
- 			spec->channels = rf_vals_3x;
- 		break;
- 
-+	case RF7620:
-+		spec->num_channels = ARRAY_SIZE(rf_vals_7620);
-+		spec->channels = rf_vals_7620;
-+		break;
-+
- 	case RF3052:
- 	case RF3053:
- 		spec->num_channels = ARRAY_SIZE(rf_vals_3x);
-@@ -7980,6 +9345,7 @@ static int rt2800_probe_hw_mode(struct r
- 	case RF5390:
- 	case RF5392:
- 	case RF5592:
-+	case RF7620:
- 		__set_bit(CAPABILITY_VCO_RECALIBRATION, &rt2x00dev->cap_flags);
- 		break;
- 	}
-@@ -8024,6 +9390,9 @@ static int rt2800_probe_rt(struct rt2x00
- 		return -ENODEV;
- 	}
- 
-+	if (rt == RT5390 && rt2x00_is_soc(rt2x00dev))
-+		rt = RT6352;
-+
- 	rt2x00_set_rt(rt2x00dev, rt, rev);
- 
- 	return 0;
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
-@@ -33,6 +33,10 @@
- struct rt2800_drv_data {
- 	u8 calibration_bw20;
- 	u8 calibration_bw40;
-+	char rx_calibration_bw20;
-+	char rx_calibration_bw40;
-+	char tx_calibration_bw20;
-+	char tx_calibration_bw40;
- 	u8 bbp25;
- 	u8 bbp26;
- 	u8 txmixer_gain_24g;
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -174,6 +174,7 @@ struct rt2x00_chip {
- #define RT5390		0x5390  /* 2.4GHz */
- #define RT5392		0x5392  /* 2.4GHz */
- #define RT5592		0x5592
-+#define RT6352		0x6352  /* WSOC 2.4GHz */
- 
- 	u16 rf;
- 	u16 rev;
diff --git a/package/kernel/mac80211/patches/020-20-rt2x00-reverse-external-PA-capability-flag-logic.patch b/package/kernel/mac80211/patches/020-20-rt2x00-reverse-external-PA-capability-flag-logic.patch
deleted file mode 100644
index 7994456de7..0000000000
--- a/package/kernel/mac80211/patches/020-20-rt2x00-reverse-external-PA-capability-flag-logic.patch
+++ /dev/null
@@ -1,121 +0,0 @@
-From 1f242a3de702d5a19c479685d35b050837122724 Mon Sep 17 00:00:00 2001
-From: Daniel Golle <daniel@makrotopia.org>
-Date: Mon, 10 Apr 2017 15:29:45 +0200
-Subject: [PATCH] rt2x00: reverse external PA capability flag logic
-
-Consequently refer to external PA instead of inverting the logic and
-use an internal PA capability flag which is a bit confusing.
-Currently this is used for Rt3352 only, but MT7620A also allows for an
-external PA which will be supported by a follow up patch.
-
-Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 40 +++++++++++++-------------
- drivers/net/wireless/ralink/rt2x00/rt2x00.h    |  4 +--
- 2 files changed, 22 insertions(+), 22 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -7014,9 +7014,9 @@ static void rt2800_init_rfcsr_3290(struc
- 
- static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
- {
--	int tx0_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX0,
-+	int tx0_ext_pa = test_bit(CAPABILITY_EXTERNAL_PA_TX0,
- 				  &rt2x00dev->cap_flags);
--	int tx1_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX1,
-+	int tx1_ext_pa = test_bit(CAPABILITY_EXTERNAL_PA_TX1,
- 				  &rt2x00dev->cap_flags);
- 	u8 rfcsr;
- 
-@@ -7056,9 +7056,9 @@ static void rt2800_init_rfcsr_3352(struc
- 	rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
- 	rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
- 	rfcsr = 0x01;
--	if (!tx0_int_pa)
-+	if (tx0_ext_pa)
- 		rt2x00_set_field8(&rfcsr, RFCSR34_TX0_EXT_PA, 1);
--	if (!tx1_int_pa)
-+	if (tx1_ext_pa)
- 		rt2x00_set_field8(&rfcsr, RFCSR34_TX1_EXT_PA, 1);
- 	rt2800_rfcsr_write(rt2x00dev, 34, rfcsr);
- 	rt2800_rfcsr_write(rt2x00dev, 35, 0x03);
-@@ -7068,13 +7068,13 @@ static void rt2800_init_rfcsr_3352(struc
- 	rt2800_rfcsr_write(rt2x00dev, 39, 0xc5);
- 	rt2800_rfcsr_write(rt2x00dev, 40, 0x33);
- 	rfcsr = 0x52;
--	if (tx0_int_pa) {
-+	if (!tx0_ext_pa) {
- 		rt2x00_set_field8(&rfcsr, RFCSR41_BIT1, 1);
- 		rt2x00_set_field8(&rfcsr, RFCSR41_BIT4, 1);
- 	}
- 	rt2800_rfcsr_write(rt2x00dev, 41, rfcsr);
- 	rfcsr = 0x52;
--	if (tx1_int_pa) {
-+	if (!tx1_ext_pa) {
- 		rt2x00_set_field8(&rfcsr, RFCSR42_BIT1, 1);
- 		rt2x00_set_field8(&rfcsr, RFCSR42_BIT4, 1);
- 	}
-@@ -7087,19 +7087,19 @@ static void rt2800_init_rfcsr_3352(struc
- 	rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
- 	rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
- 	rfcsr = 0x2d;
--	if (!tx0_int_pa)
-+	if (tx0_ext_pa)
- 		rt2x00_set_field8(&rfcsr, RFCSR50_TX0_EXT_PA, 1);
--	if (!tx1_int_pa)
-+	if (tx1_ext_pa)
- 		rt2x00_set_field8(&rfcsr, RFCSR50_TX1_EXT_PA, 1);
- 	rt2800_rfcsr_write(rt2x00dev, 50, rfcsr);
--	rt2800_rfcsr_write(rt2x00dev, 51, (tx0_int_pa ? 0x7f : 0x52));
--	rt2800_rfcsr_write(rt2x00dev, 52, (tx0_int_pa ? 0x00 : 0xc0));
--	rt2800_rfcsr_write(rt2x00dev, 53, (tx0_int_pa ? 0x52 : 0xd2));
--	rt2800_rfcsr_write(rt2x00dev, 54, (tx0_int_pa ? 0x1b : 0xc0));
--	rt2800_rfcsr_write(rt2x00dev, 55, (tx1_int_pa ? 0x7f : 0x52));
--	rt2800_rfcsr_write(rt2x00dev, 56, (tx1_int_pa ? 0x00 : 0xc0));
--	rt2800_rfcsr_write(rt2x00dev, 57, (tx0_int_pa ? 0x52 : 0x49));
--	rt2800_rfcsr_write(rt2x00dev, 58, (tx1_int_pa ? 0x1b : 0xc0));
-+	rt2800_rfcsr_write(rt2x00dev, 51, (tx0_ext_pa ? 0x52 : 0x7f));
-+	rt2800_rfcsr_write(rt2x00dev, 52, (tx0_ext_pa ? 0xc0 : 0x00));
-+	rt2800_rfcsr_write(rt2x00dev, 53, (tx0_ext_pa ? 0xd2 : 0x52));
-+	rt2800_rfcsr_write(rt2x00dev, 54, (tx0_ext_pa ? 0xc0 : 0x1b));
-+	rt2800_rfcsr_write(rt2x00dev, 55, (tx1_ext_pa ? 0x52 : 0x7f));
-+	rt2800_rfcsr_write(rt2x00dev, 56, (tx1_ext_pa ? 0xc0 : 0x00));
-+	rt2800_rfcsr_write(rt2x00dev, 57, (tx0_ext_pa ? 0x49 : 0x52));
-+	rt2800_rfcsr_write(rt2x00dev, 58, (tx1_ext_pa ? 0xc0 : 0x1b));
- 	rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
- 	rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
- 	rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
-@@ -8782,13 +8782,13 @@ static int rt2800_init_eeprom(struct rt2
- 	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
- 
- 	if (rt2x00_rt(rt2x00dev, RT3352)) {
--		if (!rt2x00_get_field16(eeprom,
-+		if (rt2x00_get_field16(eeprom,
- 		    EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352))
--		    __set_bit(CAPABILITY_INTERNAL_PA_TX0,
-+		    __set_bit(CAPABILITY_EXTERNAL_PA_TX0,
- 			      &rt2x00dev->cap_flags);
--		if (!rt2x00_get_field16(eeprom,
-+		if (rt2x00_get_field16(eeprom,
- 		    EEPROM_NIC_CONF1_EXTERNAL_TX1_PA_3352))
--		    __set_bit(CAPABILITY_INTERNAL_PA_TX1,
-+		    __set_bit(CAPABILITY_EXTERNAL_PA_TX1,
- 			      &rt2x00dev->cap_flags);
- 	}
- 
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
-@@ -719,8 +719,8 @@ enum rt2x00_capability_flags {
- 	CAPABILITY_DOUBLE_ANTENNA,
- 	CAPABILITY_BT_COEXIST,
- 	CAPABILITY_VCO_RECALIBRATION,
--	CAPABILITY_INTERNAL_PA_TX0,
--	CAPABILITY_INTERNAL_PA_TX1,
-+	CAPABILITY_EXTERNAL_PA_TX0,
-+	CAPABILITY_EXTERNAL_PA_TX1,
- };
- 
- /*
diff --git a/package/kernel/mac80211/patches/020-21-rt2800-fix-LNA-gain-assignment-for-MT7620.patch b/package/kernel/mac80211/patches/020-21-rt2800-fix-LNA-gain-assignment-for-MT7620.patch
deleted file mode 100644
index 71a4ffea45..0000000000
--- a/package/kernel/mac80211/patches/020-21-rt2800-fix-LNA-gain-assignment-for-MT7620.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 0109238d62a99ea779a7e28e21868118e7b8d69d Mon Sep 17 00:00:00 2001
-From: Daniel Golle <daniel@makrotopia.org>
-Date: Mon, 10 Apr 2017 14:28:14 +0200
-Subject: [PATCH 1/2] rt2800: fix LNA gain assignment for MT7620
-To: Stanislaw Gruszka <sgruszka@redhat.com>
-Cc: Helmut Schaa <helmut.schaa@googlemail.com>,
-    linux-wireless@vger.kernel.org,
-    Kalle Valo <kvalo@codeaurora.org>
-
-The base value used for MT7620 differs from Rt5392 which resulted in
-quite bad RX signal quality. Fix this by using the correct base value as
-well as the LNA calibration values for HT20.
-
-Reported-by: Tom Psyborg <pozega.tomislav@gmail.com>
-Signed-off-by: Daniel Golle <daniel@makrotopia.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 18 ++++++++++++++++--
- 1 file changed, 16 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -3806,11 +3806,25 @@ static void rt2800_config_channel(struct
- 	}
- 
- 	if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) {
-+		reg = 0x10;
-+		if (!conf_is_ht40(conf)) {
-+			if (rt2x00_rt(rt2x00dev, RT6352) &&
-+			    rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
-+				reg |= 0x5;
-+			} else {
-+				reg |= 0xa;
-+			}
-+		}
- 		rt2800_bbp_write(rt2x00dev, 195, 141);
--		rt2800_bbp_write(rt2x00dev, 196, conf_is_ht40(conf) ? 0x10 : 0x1a);
-+		rt2800_bbp_write(rt2x00dev, 196, reg);
- 
- 		/* AGC init */
--		reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain;
-+		if (rt2x00_rt(rt2x00dev, RT6352))
-+			reg = 0x04;
-+		else
-+			reg = rf->channel <= 14 ? 0x1c : 0x24;
-+
-+		reg += 2 * rt2x00dev->lna_gain;
- 		rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
- 
- 		rt2800_iq_calibrate(rt2x00dev, rf->channel);
diff --git a/package/kernel/mac80211/patches/020-22-rt2800-do-VCO-calibration-after-programming-ALC.patch b/package/kernel/mac80211/patches/020-22-rt2800-do-VCO-calibration-after-programming-ALC.patch
deleted file mode 100644
index 3d76408cd2..0000000000
--- a/package/kernel/mac80211/patches/020-22-rt2800-do-VCO-calibration-after-programming-ALC.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From feb608c7986c14bab153f31f8e96f251072e6578 Mon Sep 17 00:00:00 2001
-From: Daniel Golle <daniel@makrotopia.org>
-Date: Mon, 10 Apr 2017 15:33:20 +0200
-Subject: [PATCH 2/2] rt2800: do VCO calibration after programming ALC
-To: Stanislaw Gruszka <sgruszka@redhat.com>
-Cc: Helmut Schaa <helmut.schaa@googlemail.com>,
-    linux-wireless@vger.kernel.org,
-    Kalle Valo <kvalo@codeaurora.org>
-
-Scanning fails if we don't do VCO calibration every time.
-The vendor driver duplicates the VCO calibration function into the
-channel switching logic, we can do the same with less duplication.
-
-Signed-off-by: Daniel Golle <daniel@makrotopia.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++
- 1 file changed, 2 insertions(+)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -3407,6 +3407,8 @@ static void rt2800_config_alc(struct rt2
- 			rt2800_rfcsr_write(rt2x00dev, 42, 0x5b);
- 	}
- 	rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl);
-+
-+	rt2800_vco_calibration(rt2x00dev);
- }
- 
- static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev,
diff --git a/package/kernel/mac80211/patches/020-23-rt2800-fix-mt7620-vco-calibration-registers.patch b/package/kernel/mac80211/patches/020-23-rt2800-fix-mt7620-vco-calibration-registers.patch
deleted file mode 100644
index 360d06e8f8..0000000000
--- a/package/kernel/mac80211/patches/020-23-rt2800-fix-mt7620-vco-calibration-registers.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 02c452f317b4a4d06c433c294e66896a389731c1 Mon Sep 17 00:00:00 2001
-From: Daniel Golle <daniel@makrotopia.org>
-Date: Tue, 18 Apr 2017 11:09:53 +0200
-Subject: [PATCH] rt2800: fix mt7620 vco calibration registers
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-To: Stanislaw Gruszka <sgruszka@redhat.com>
-Cc: Helmut Schaa <helmut.schaa@googlemail.com>,
-    linux-wireless@vger.kernel.org,
-    Kalle Valo <kvalo@codeaurora.org>,
-    Tom Psyborg <pozega.tomislav@gmail.com>
-
-Use register values from init LNA function instead of the ones from
-restore LNA function. Apply register values based on rx path
-configuration.
-
-Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
-Signed-off-by: Daniel Golle <daniel@makrotopia.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -4932,7 +4932,7 @@ void rt2800_vco_calibration(struct rt2x0
- 	rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
- 
- 	if (rt2x00_rt(rt2x00dev, RT6352)) {
--		if (rt2x00dev->default_ant.tx_chain_num == 1) {
-+		if (rt2x00dev->default_ant.rx_chain_num == 1) {
- 			rt2800_bbp_write(rt2x00dev, 91, 0x07);
- 			rt2800_bbp_write(rt2x00dev, 95, 0x1A);
- 			rt2800_bbp_write(rt2x00dev, 195, 128);
-@@ -4953,8 +4953,8 @@ void rt2800_vco_calibration(struct rt2x0
- 		}
- 
- 		if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
--			rt2800_bbp_write(rt2x00dev, 75, 0x60);
--			rt2800_bbp_write(rt2x00dev, 76, 0x44);
-+			rt2800_bbp_write(rt2x00dev, 75, 0x68);
-+			rt2800_bbp_write(rt2x00dev, 76, 0x4C);
- 			rt2800_bbp_write(rt2x00dev, 79, 0x1C);
- 			rt2800_bbp_write(rt2x00dev, 80, 0x0C);
- 			rt2800_bbp_write(rt2x00dev, 82, 0xB6);
diff --git a/package/kernel/mac80211/patches/020-24-rt2800-fix-mt7620-E2-channel-registers.patch b/package/kernel/mac80211/patches/020-24-rt2800-fix-mt7620-E2-channel-registers.patch
deleted file mode 100644
index 92c2134845..0000000000
--- a/package/kernel/mac80211/patches/020-24-rt2800-fix-mt7620-E2-channel-registers.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From c426cb0ed15ee12dfdc8c53ddd1449ac617023cf Mon Sep 17 00:00:00 2001
-From: Daniel Golle <daniel@makrotopia.org>
-Date: Tue, 18 Apr 2017 11:45:37 +0200
-Subject: [PATCH] rt2800: fix mt7620 E2 channel registers
-To: Stanislaw Gruszka <sgruszka@redhat.com>
-Cc: Helmut Schaa <helmut.schaa@googlemail.com>,
-    linux-wireless@vger.kernel.org,
-    Kalle Valo <kvalo@codeaurora.org>,
-    Tom Psyborg <pozega.tomislav@gmail.com>
-
-From: Tomislav Požega <pozega.tomislav@gmail.com>
-
-update RF register 47 and 54 values according to vendor driver
-
-Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
-Signed-off-by: Daniel Golle <daniel@makrotopia.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -8145,9 +8145,11 @@ static void rt2800_init_rfcsr_6352(struc
- 	rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xB3);
- 	rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5);
- 	rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
--	rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x69);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 4, 47, 0x67);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 6, 47, 0x69);
- 	rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFF);
--	rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x20);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 4, 54, 0x27);
-+	rt2800_rfcsr_write_bank(rt2x00dev, 6, 54, 0x20);
- 	rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66);
- 	rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xFF);
- 	rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1C);
diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
index 527938f015..1fc52f9ab0 100644
--- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
+++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
@@ -1,6 +1,6 @@
---- a/.local-symbols
-+++ b/.local-symbols
-@@ -482,45 +482,6 @@ USB_IPHETH=
+--- a/local-symbols
++++ b/local-symbols
+@@ -383,45 +383,6 @@ USB_IPHETH=
  USB_SIERRA_NET=
  USB_VL600=
  USB_NET_CH9200=
@@ -48,7 +48,7 @@
  NFC_NCI=
 --- a/drivers/net/wireless/broadcom/b43/main.c
 +++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -2866,7 +2866,7 @@ static struct ssb_device *b43_ssb_gpio_d
+@@ -2876,7 +2876,7 @@ static struct ssb_device *b43_ssb_gpio_d
  {
  	struct ssb_bus *bus = dev->dev->sdev->bus;
  
@@ -57,7 +57,7 @@
  	return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  #else
  	return bus->chipco.dev;
-@@ -4883,7 +4883,7 @@ static int b43_wireless_core_init(struct
+@@ -4893,7 +4893,7 @@ static int b43_wireless_core_init(struct
  	}
  	if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  		hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
@@ -110,7 +110,7 @@
 --- a/Kconfig.sources
 +++ b/Kconfig.sources
 @@ -9,9 +9,6 @@ source "$BACKPORT_DIR/drivers/net/wirele
- source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
+ #source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  source "$BACKPORT_DIR/drivers/net/usb/Kconfig"
  
 -source "$BACKPORT_DIR/drivers/ssb/Kconfig"
@@ -118,15 +118,15 @@
 -
  source "$BACKPORT_DIR/net/nfc/Kconfig"
  
- source "$BACKPORT_DIR/drivers/media/Kconfig"
+ #source "$BACKPORT_DIR/drivers/media/Kconfig"
 --- a/Makefile.kernel
 +++ b/Makefile.kernel
-@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
+@@ -39,8 +39,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  obj-$(CPTCFG_WLAN) += drivers/net/wireless/
- obj-$(CPTCFG_BT) += net/bluetooth/
- obj-$(CPTCFG_BT) += drivers/bluetooth/
+ #obj-$(CPTCFG_BT) += net/bluetooth/
+ #obj-$(CPTCFG_BT) += drivers/bluetooth/
 -obj-$(CPTCFG_SSB) += drivers/ssb/
 -obj-$(CPTCFG_BCMA) += drivers/bcma/
- obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
+ #obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  obj-$(CPTCFG_NFC) += net/nfc/
diff --git a/package/kernel/mac80211/patches/080-ath10k_thermal_config.patch b/package/kernel/mac80211/patches/080-ath10k_thermal_config.patch
index e08fa32a3b..796615b03c 100644
--- a/package/kernel/mac80211/patches/080-ath10k_thermal_config.patch
+++ b/package/kernel/mac80211/patches/080-ath10k_thermal_config.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath10k/Kconfig
 +++ b/drivers/net/wireless/ath/ath10k/Kconfig
-@@ -48,6 +48,12 @@ config ATH10K_TRACING
+@@ -65,6 +65,12 @@ config ATH10K_TRACING
  	---help---
  	  Select this to ath10k use tracing infrastructure.
  
diff --git a/package/kernel/mac80211/patches/090-remove-cred.patch b/package/kernel/mac80211/patches/090-remove-cred.patch
deleted file mode 100644
index 3adb2afb86..0000000000
--- a/package/kernel/mac80211/patches/090-remove-cred.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-This is only needed for kernel < 2.6.29 and conflicts with kernel 4.4.42
-
---- a/backport-include/linux/cred.h
-+++ /dev/null
-@@ -1,10 +0,0 @@
--#ifndef __BACKPORT_LINUX_CRED_H
--#define __BACKPORT_LINUX_CRED_H
--#include_next <linux/cred.h>
--#include <linux/version.h>
--
--#ifndef current_user_ns
--#define current_user_ns()	(current->nsproxy->user_ns)
--#endif
--
--#endif /* __BACKPORT_LINUX_CRED_H */
diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
index 95fea441a4..263be3e209 100644
--- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
+++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
@@ -6,9 +6,9 @@
  	depends on CRYPTO_AES
 -	select BPAUTO_CRYPTO_CCM
 -	depends on CRYPTO_GCM
+ 	depends on CRYPTO_CMAC
  	depends on CRC32
  	---help---
- 	  This option enables the hardware independent IEEE 802.11
 --- a/net/mac80211/Makefile
 +++ b/net/mac80211/Makefile
 @@ -16,9 +16,7 @@ mac80211-y := \
@@ -275,7 +275,7 @@
  		struct {
 --- a/net/mac80211/wpa.c
 +++ b/net/mac80211/wpa.c
-@@ -305,7 +305,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
+@@ -306,7 +306,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  }
  
  
@@ -285,7 +285,7 @@
  {
  	__le16 mask_fc;
  	int a4_included, mgmt;
-@@ -335,14 +336,8 @@ static void ccmp_special_blocks(struct s
+@@ -336,14 +337,8 @@ static void ccmp_special_blocks(struct s
  	else
  		qos_tid = 0;
  
@@ -302,7 +302,7 @@
  
  	/* Nonce: Nonce Flags | A2 | PN
  	 * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
-@@ -350,6 +345,8 @@ static void ccmp_special_blocks(struct s
+@@ -351,6 +346,8 @@ static void ccmp_special_blocks(struct s
  	b_0[1] = qos_tid | (mgmt << 4);
  	memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  	memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
@@ -311,7 +311,7 @@
  
  	/* AAD (extra authenticate-only data) / masked 802.11 header
  	 * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
-@@ -406,7 +403,7 @@ static int ccmp_encrypt_skb(struct ieee8
+@@ -407,7 +404,7 @@ static int ccmp_encrypt_skb(struct ieee8
  	u8 *pos;
  	u8 pn[6];
  	u64 pn64;
@@ -320,7 +320,7 @@
  	u8 b_0[AES_BLOCK_SIZE];
  
  	if (info->control.hw_key &&
-@@ -461,9 +458,11 @@ static int ccmp_encrypt_skb(struct ieee8
+@@ -462,9 +459,11 @@ static int ccmp_encrypt_skb(struct ieee8
  		return 0;
  
  	pos += IEEE80211_CCMP_HDR_LEN;
@@ -335,7 +335,7 @@
  }
  
  
-@@ -536,7 +535,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
+@@ -537,7 +536,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  			u8 aad[2 * AES_BLOCK_SIZE];
  			u8 b_0[AES_BLOCK_SIZE];
  			/* hardware didn't decrypt/verify MIC */
@@ -344,7 +344,7 @@
  
  			if (ieee80211_aes_ccm_decrypt(
  				    key->u.ccmp.tfm, b_0, aad,
-@@ -638,7 +637,7 @@ static int gcmp_encrypt_skb(struct ieee8
+@@ -639,7 +638,7 @@ static int gcmp_encrypt_skb(struct ieee8
  	u8 *pos;
  	u8 pn[6];
  	u64 pn64;
@@ -353,7 +353,7 @@
  	u8 j_0[AES_BLOCK_SIZE];
  
  	if (info->control.hw_key &&
-@@ -695,8 +694,10 @@ static int gcmp_encrypt_skb(struct ieee8
+@@ -696,8 +695,10 @@ static int gcmp_encrypt_skb(struct ieee8
  
  	pos += IEEE80211_GCMP_HDR_LEN;
  	gcmp_special_blocks(skb, pn, j_0, aad);
@@ -366,7 +366,7 @@
  }
  
  ieee80211_tx_result
-@@ -1120,9 +1121,9 @@ ieee80211_crypto_aes_gmac_encrypt(struct
+@@ -1121,9 +1122,9 @@ ieee80211_crypto_aes_gmac_encrypt(struct
  	struct ieee80211_key *key = tx->key;
  	struct ieee80211_mmie_16 *mmie;
  	struct ieee80211_hdr *hdr;
@@ -378,7 +378,7 @@
  
  	if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  		return TX_DROP;
-@@ -1168,7 +1169,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct
+@@ -1169,7 +1170,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct
  	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  	struct ieee80211_key *key = rx->key;
  	struct ieee80211_mmie_16 *mmie;
diff --git a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
index ff619129d9..005e3e5d5d 100644
--- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
+++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
@@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
 
 --- a/net/mac80211/cfg.c
 +++ b/net/mac80211/cfg.c
-@@ -1014,7 +1014,6 @@ static int ieee80211_stop_ap(struct wiph
+@@ -1056,7 +1056,6 @@ static int ieee80211_stop_ap(struct wiph
  	sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  
  	__sta_info_flush(sdata, true);
diff --git a/package/kernel/mac80211/patches/130-mac80211-hwsim-hrtimer-clock.patch b/package/kernel/mac80211/patches/130-mac80211-hwsim-hrtimer-clock.patch
deleted file mode 100644
index 828ed83cb7..0000000000
--- a/package/kernel/mac80211/patches/130-mac80211-hwsim-hrtimer-clock.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/drivers/net/wireless/mac80211_hwsim.c
-+++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -2678,7 +2678,7 @@ static int mac80211_hwsim_new_radio(stru
- 
- 	tasklet_hrtimer_init(&data->beacon_timer,
- 			     mac80211_hwsim_beacon,
--			     CLOCK_MONOTONIC_RAW, HRTIMER_MODE_ABS);
-+			     CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
- 
- 	spin_lock_bh(&hwsim_radio_lock);
- 	list_add_tail(&data->list, &hwsim_radios);
diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
index ca1e53f8df..42a692a1fc 100644
--- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
+++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
@@ -1,6 +1,6 @@
 --- a/net/mac80211/main.c
 +++ b/net/mac80211/main.c
-@@ -291,7 +291,7 @@ void ieee80211_restart_hw(struct ieee802
+@@ -292,7 +292,7 @@ void ieee80211_restart_hw(struct ieee802
  }
  EXPORT_SYMBOL(ieee80211_restart_hw);
  
@@ -9,7 +9,7 @@
  static int ieee80211_ifa_changed(struct notifier_block *nb,
  				 unsigned long data, void *arg)
  {
-@@ -350,7 +350,7 @@ static int ieee80211_ifa_changed(struct
+@@ -351,7 +351,7 @@ static int ieee80211_ifa_changed(struct
  }
  #endif
  
@@ -18,7 +18,7 @@
  static int ieee80211_ifa6_changed(struct notifier_block *nb,
  				  unsigned long data, void *arg)
  {
-@@ -1111,14 +1111,14 @@ int ieee80211_register_hw(struct ieee802
+@@ -1115,14 +1115,14 @@ int ieee80211_register_hw(struct ieee802
  	if (result)
  		goto fail_flows;
  
@@ -35,7 +35,7 @@
  	local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  	result = register_inet6addr_notifier(&local->ifa6_notifier);
  	if (result)
-@@ -1127,13 +1127,13 @@ int ieee80211_register_hw(struct ieee802
+@@ -1131,13 +1131,13 @@ int ieee80211_register_hw(struct ieee802
  
  	return 0;
  
@@ -52,7 +52,7 @@
   fail_ifa:
  #endif
  	ieee80211_txq_teardown_flows(local);
-@@ -1163,10 +1163,10 @@ void ieee80211_unregister_hw(struct ieee
+@@ -1167,10 +1167,10 @@ void ieee80211_unregister_hw(struct ieee
  	tasklet_kill(&local->tx_pending_tasklet);
  	tasklet_kill(&local->tasklet);
  
diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
index 3b613bba0e..e9999e32b9 100644
--- a/package/kernel/mac80211/patches/210-ap_scan.patch
+++ b/package/kernel/mac80211/patches/210-ap_scan.patch
@@ -1,6 +1,6 @@
 --- a/net/mac80211/cfg.c
 +++ b/net/mac80211/cfg.c
-@@ -2165,7 +2165,7 @@ static int ieee80211_scan(struct wiphy *
+@@ -2212,7 +2212,7 @@ static int ieee80211_scan(struct wiphy *
  		 * the  frames sent while scanning on other channel will be
  		 * lost)
  		 */
diff --git a/package/kernel/mac80211/patches/304-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/304-ath9k-force-rx_clear-when-disabling-rx.patch
index eb6862db6d..8aaccf49b4 100644
--- a/package/kernel/mac80211/patches/304-ath9k-force-rx_clear-when-disabling-rx.patch
+++ b/package/kernel/mac80211/patches/304-ath9k-force-rx_clear-when-disabling-rx.patch
@@ -12,7 +12,7 @@ Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
 
 --- a/drivers/net/wireless/ath/ath9k/mac.c
 +++ b/drivers/net/wireless/ath/ath9k/mac.c
-@@ -677,13 +677,18 @@ void ath9k_hw_startpcureceive(struct ath
+@@ -678,13 +678,18 @@ void ath9k_hw_startpcureceive(struct ath
  
  	ath9k_ani_reset(ah, is_scanning);
  
diff --git a/package/kernel/mac80211/patches/305-ath9k-limit-retries-for-powersave-response-frames.patch b/package/kernel/mac80211/patches/305-ath9k-limit-retries-for-powersave-response-frames.patch
index 5923594be3..31825b819c 100644
--- a/package/kernel/mac80211/patches/305-ath9k-limit-retries-for-powersave-response-frames.patch
+++ b/package/kernel/mac80211/patches/305-ath9k-limit-retries-for-powersave-response-frames.patch
@@ -40,7 +40,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  }
  
  static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
-@@ -1522,7 +1537,7 @@ ath_tx_form_burst(struct ath_softc *sc,
+@@ -1502,7 +1517,7 @@ ath_tx_form_burst(struct ath_softc *sc,
  			break;
  		}
  
@@ -49,7 +49,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  	} while (1);
  }
  
-@@ -1552,7 +1567,7 @@ static bool ath_tx_sched_aggr(struct ath
+@@ -1532,7 +1547,7 @@ static bool ath_tx_sched_aggr(struct ath
  		return false;
  	}
  
@@ -58,7 +58,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  	if (aggr)
  		aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf);
  	else
-@@ -1710,7 +1725,7 @@ void ath9k_release_buffered_frames(struc
+@@ -1690,7 +1705,7 @@ void ath9k_release_buffered_frames(struc
  				break;
  
  			list_add_tail(&bf->list, &bf_q);
@@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  			if (bf_isampdu(bf)) {
  				ath_tx_addto_baw(sc, tid, bf);
  				bf->bf_state.bf_type &= ~BUF_AGGR;
-@@ -2410,7 +2425,7 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -2390,7 +2405,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  	if (txctl->paprd)
  		bf->bf_state.bfs_paprd_timestamp = jiffies;
  
@@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  	ath_tx_send_normal(sc, txq, tid, skb);
  
  out:
-@@ -2449,7 +2464,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw
+@@ -2429,7 +2444,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw
  			break;
  
  		bf->bf_lastbf = bf;
@@ -85,7 +85,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  		ath_buf_set_rate(sc, bf, &info, fi->framelen, false);
  		duration += info.rates[0].PktDuration;
  		if (bf_tail)
-@@ -2968,7 +2983,7 @@ int ath9k_tx99_send(struct ath_softc *sc
+@@ -2946,7 +2961,7 @@ int ath9k_tx99_send(struct ath_softc *sc
  		return -EINVAL;
  	}
  
diff --git a/package/kernel/mac80211/patches/306-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/306-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
index 956ab83903..35d07430eb 100644
--- a/package/kernel/mac80211/patches/306-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
+++ b/package/kernel/mac80211/patches/306-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
@@ -8,7 +8,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411.
 
 --- a/drivers/net/wireless/ath/ath9k/hw.c
 +++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -2931,7 +2931,8 @@ void ath9k_hw_apply_txpower(struct ath_h
+@@ -2935,7 +2935,8 @@ void ath9k_hw_apply_txpower(struct ath_h
  {
  	struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
  	struct ieee80211_channel *channel;
@@ -18,7 +18,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411.
  
  	if (!chan)
  		return;
-@@ -2939,10 +2940,15 @@ void ath9k_hw_apply_txpower(struct ath_h
+@@ -2943,10 +2944,15 @@ void ath9k_hw_apply_txpower(struct ath_h
  	channel = chan->chan;
  	chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
  	new_pwr = min_t(int, chan_pwr, reg->power_limit);
diff --git a/package/kernel/mac80211/patches/307-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/307-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
index 1a6fd8471c..baaca173c7 100644
--- a/package/kernel/mac80211/patches/307-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
+++ b/package/kernel/mac80211/patches/307-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
@@ -21,7 +21,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  
 --- a/net/mac80211/tx.c
 +++ b/net/mac80211/tx.c
-@@ -925,7 +925,7 @@ ieee80211_tx_h_fragment(struct ieee80211
+@@ -921,7 +921,7 @@ ieee80211_tx_h_fragment(struct ieee80211
  	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  	struct ieee80211_hdr *hdr = (void *)skb->data;
  	int frag_threshold = tx->local->hw.wiphy->frag_threshold;
@@ -30,7 +30,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	int fragnum;
  
  	/* no matter what happens, tx->skb moves to tx->skbs */
-@@ -946,8 +946,6 @@ ieee80211_tx_h_fragment(struct ieee80211
+@@ -942,8 +942,6 @@ ieee80211_tx_h_fragment(struct ieee80211
  	if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
  		return TX_DROP;
  
@@ -39,7 +39,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	/* internal error, why isn't DONTFRAG set? */
  	if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
  		return TX_DROP;
-@@ -1179,6 +1177,8 @@ ieee80211_tx_prepare(struct ieee80211_su
+@@ -1175,6 +1173,8 @@ ieee80211_tx_prepare(struct ieee80211_su
  
  	hdr = (struct ieee80211_hdr *) skb->data;
  
@@ -48,7 +48,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	if (likely(sta)) {
  		if (!IS_ERR(sta))
  			tx->sta = sta;
-@@ -3437,6 +3437,7 @@ begin:
+@@ -3434,6 +3434,7 @@ begin:
  	tx.local = local;
  	tx.skb = skb;
  	tx.sdata = vif_to_sdata(info->control.vif);
@@ -56,7 +56,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  
  	if (txq->sta)
  		tx.sta = container_of(txq->sta, struct sta_info, sta);
-@@ -3731,6 +3732,7 @@ ieee80211_build_data_template(struct iee
+@@ -3756,6 +3757,7 @@ ieee80211_build_data_template(struct iee
  	hdr = (void *)skb->data;
  	tx.sta = sta_info_get(sdata, hdr->addr1);
  	tx.skb = skb;
@@ -66,7 +66,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  		rcu_read_unlock();
 --- a/net/mac80211/util.c
 +++ b/net/mac80211/util.c
-@@ -1227,6 +1227,7 @@ void ieee80211_send_auth(struct ieee8021
+@@ -1232,6 +1232,7 @@ void ieee80211_send_auth(struct ieee8021
  	struct ieee80211_local *local = sdata->local;
  	struct sk_buff *skb;
  	struct ieee80211_mgmt *mgmt;
@@ -74,8 +74,8 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	int err;
  
  	/* 24 + 6 = header + auth_algo + auth_transaction + status_code */
-@@ -1251,8 +1252,10 @@ void ieee80211_send_auth(struct ieee8021
- 		memcpy(skb_put(skb, extra_len), extra, extra_len);
+@@ -1255,8 +1256,10 @@ void ieee80211_send_auth(struct ieee8021
+ 		skb_put_data(skb, extra, extra_len);
  
  	if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
 +		hdrlen = ieee80211_hdrlen(mgmt->frame_control);
@@ -155,7 +155,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  			       size_t klen, u8 *data, size_t data_len);
 --- a/net/mac80211/wpa.c
 +++ b/net/mac80211/wpa.c
-@@ -43,7 +43,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
+@@ -44,7 +44,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
  	    skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
  		return TX_CONTINUE;
  
@@ -164,7 +164,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	if (skb->len < hdrlen)
  		return TX_DROP;
  
-@@ -186,7 +186,6 @@ mic_fail_no_key:
+@@ -187,7 +187,6 @@ mic_fail_no_key:
  
  static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  {
@@ -172,7 +172,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	struct ieee80211_key *key = tx->key;
  	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  	unsigned int hdrlen;
-@@ -201,7 +200,7 @@ static int tkip_encrypt_skb(struct ieee8
+@@ -202,7 +201,7 @@ static int tkip_encrypt_skb(struct ieee8
  		return 0;
  	}
  
@@ -181,7 +181,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	len = skb->len - hdrlen;
  
  	if (info->control.hw_key)
-@@ -419,7 +418,7 @@ static int ccmp_encrypt_skb(struct ieee8
+@@ -420,7 +419,7 @@ static int ccmp_encrypt_skb(struct ieee8
  		return 0;
  	}
  
@@ -190,7 +190,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	len = skb->len - hdrlen;
  
  	if (info->control.hw_key)
-@@ -652,7 +651,7 @@ static int gcmp_encrypt_skb(struct ieee8
+@@ -653,7 +652,7 @@ static int gcmp_encrypt_skb(struct ieee8
  		return 0;
  	}
  
@@ -199,7 +199,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	len = skb->len - hdrlen;
  
  	if (info->control.hw_key)
-@@ -792,7 +791,6 @@ static ieee80211_tx_result
+@@ -793,7 +792,6 @@ static ieee80211_tx_result
  ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  			    struct sk_buff *skb)
  {
@@ -207,7 +207,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	struct ieee80211_key *key = tx->key;
  	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  	int hdrlen;
-@@ -808,8 +806,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
+@@ -809,8 +807,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
  		     pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC)))
  		return TX_DROP;
  
diff --git a/package/kernel/mac80211/patches/308-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/308-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
index 43455773f1..762458ba78 100644
--- a/package/kernel/mac80211/patches/308-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
+++ b/package/kernel/mac80211/patches/308-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
@@ -23,7 +23,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
 
 --- a/include/net/mac80211.h
 +++ b/include/net/mac80211.h
-@@ -2043,6 +2043,9 @@ struct ieee80211_txq {
+@@ -2056,6 +2056,9 @@ struct ieee80211_txq {
   *	The stack will not do fragmentation.
   *	The callback for @set_frag_threshold should be set as well.
   *
@@ -33,7 +33,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
   * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
   */
  enum ieee80211_hw_flags {
-@@ -2085,6 +2088,7 @@ enum ieee80211_hw_flags {
+@@ -2098,6 +2101,7 @@ enum ieee80211_hw_flags {
  	IEEE80211_HW_TX_FRAG_LIST,
  	IEEE80211_HW_REPORTS_LOW_ACK,
  	IEEE80211_HW_SUPPORTS_TX_FRAG,
@@ -53,7 +53,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  
 --- a/net/mac80211/ieee80211_i.h
 +++ b/net/mac80211/ieee80211_i.h
-@@ -1553,6 +1553,29 @@ ieee80211_vif_get_num_mcast_if(struct ie
+@@ -1547,6 +1547,29 @@ ieee80211_vif_get_num_mcast_if(struct ie
  	return -1;
  }
  
@@ -85,7 +85,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  				     unsigned int mpdu_len,
 --- a/net/mac80211/sta_info.h
 +++ b/net/mac80211/sta_info.h
-@@ -282,7 +282,7 @@ struct ieee80211_fast_tx {
+@@ -290,7 +290,7 @@ struct ieee80211_fast_tx {
  	u8 hdr_len;
  	u8 sa_offs, da_offs, pn_offs;
  	u8 band;
@@ -96,7 +96,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	struct rcu_head rcu_head;
 --- a/net/mac80211/status.c
 +++ b/net/mac80211/status.c
-@@ -693,9 +693,22 @@ void ieee80211_tx_monitor(struct ieee802
+@@ -642,9 +642,22 @@ void ieee80211_tx_monitor(struct ieee802
  	struct sk_buff *skb2;
  	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  	struct ieee80211_sub_if_data *sdata;
@@ -137,7 +137,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  
 --- a/net/mac80211/tx.c
 +++ b/net/mac80211/tx.c
-@@ -1176,8 +1176,7 @@ ieee80211_tx_prepare(struct ieee80211_su
+@@ -1172,8 +1172,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  	info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING;
  
  	hdr = (struct ieee80211_hdr *) skb->data;
@@ -147,7 +147,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  
  	if (likely(sta)) {
  		if (!IS_ERR(sta))
-@@ -2152,7 +2151,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
+@@ -2150,7 +2149,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  		goto fail;
  
  	hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
@@ -156,7 +156,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  
  	if (skb->len < len_rthdr + hdrlen)
  		goto fail;
-@@ -2370,7 +2369,7 @@ static struct sk_buff *ieee80211_build_h
+@@ -2368,7 +2367,7 @@ static struct sk_buff *ieee80211_build_h
  	struct ieee80211_chanctx_conf *chanctx_conf;
  	struct ieee80211_sub_if_data *ap_sdata;
  	enum nl80211_band band;
@@ -165,7 +165,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  
  	if (IS_ERR(sta))
  		sta = NULL;
-@@ -2590,6 +2589,9 @@ static struct sk_buff *ieee80211_build_h
+@@ -2588,6 +2587,9 @@ static struct sk_buff *ieee80211_build_h
  		hdrlen += 2;
  	}
  
@@ -175,7 +175,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	/*
  	 * Drop unicast frames to unauthorised stations unless they are
  	 * EAPOL frames from the local station.
-@@ -2670,6 +2672,7 @@ static struct sk_buff *ieee80211_build_h
+@@ -2668,6 +2670,7 @@ static struct sk_buff *ieee80211_build_h
  
  	skb_pull(skb, skip_header_bytes);
  	head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb);
@@ -183,7 +183,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  
  	/*
  	 * So we need to modify the skb header and hence need a copy of
-@@ -2702,6 +2705,9 @@ static struct sk_buff *ieee80211_build_h
+@@ -2700,6 +2703,9 @@ static struct sk_buff *ieee80211_build_h
  		memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen);
  #endif
  
@@ -193,7 +193,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	if (ieee80211_is_data_qos(fc)) {
  		__le16 *qos_control;
  
-@@ -2877,6 +2883,9 @@ void ieee80211_check_fast_xmit(struct st
+@@ -2875,6 +2881,9 @@ void ieee80211_check_fast_xmit(struct st
  		fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
  	}
  
@@ -203,7 +203,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	/* We store the key here so there's no point in using rcu_dereference()
  	 * but that's fine because the code that changes the pointers will call
  	 * this function after doing so. For a single CPU that would be enough,
-@@ -3464,7 +3473,7 @@ begin:
+@@ -3461,7 +3470,7 @@ begin:
  
  		if (tx.key &&
  		    (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV))
@@ -214,7 +214,7 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  					   tx.key, skb);
 --- a/net/mac80211/util.c
 +++ b/net/mac80211/util.c
-@@ -1225,6 +1225,7 @@ void ieee80211_send_auth(struct ieee8021
+@@ -1230,6 +1230,7 @@ void ieee80211_send_auth(struct ieee8021
  			 u32 tx_flags)
  {
  	struct ieee80211_local *local = sdata->local;
@@ -222,8 +222,8 @@ Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  	struct sk_buff *skb;
  	struct ieee80211_mgmt *mgmt;
  	unsigned int hdrlen;
-@@ -1252,7 +1253,7 @@ void ieee80211_send_auth(struct ieee8021
- 		memcpy(skb_put(skb, extra_len), extra, extra_len);
+@@ -1256,7 +1257,7 @@ void ieee80211_send_auth(struct ieee8021
+ 		skb_put_data(skb, extra, extra_len);
  
  	if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
 -		hdrlen = ieee80211_hdrlen(mgmt->frame_control);
diff --git a/package/kernel/mac80211/patches/309-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/309-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
index a62b1bb28e..609b15b832 100644
--- a/package/kernel/mac80211/patches/309-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
+++ b/package/kernel/mac80211/patches/309-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
@@ -10,7 +10,7 @@ Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
 
 --- a/include/linux/ieee80211.h
 +++ b/include/linux/ieee80211.h
-@@ -1553,6 +1553,7 @@ struct ieee80211_vht_operation {
+@@ -1556,6 +1556,7 @@ struct ieee80211_vht_operation {
  #define IEEE80211_VHT_CAP_RXSTBC_3				0x00000300
  #define IEEE80211_VHT_CAP_RXSTBC_4				0x00000400
  #define IEEE80211_VHT_CAP_RXSTBC_MASK				0x00000700
diff --git a/package/kernel/mac80211/patches/310-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch b/package/kernel/mac80211/patches/310-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch
index b2a74ccbac..c9c74bb836 100644
--- a/package/kernel/mac80211/patches/310-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch
+++ b/package/kernel/mac80211/patches/310-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch
@@ -7,7 +7,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/drivers/net/wireless/ath/ath9k/xmit.c
 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -1694,6 +1694,22 @@ void ath_tx_aggr_wakeup(struct ath_softc
+@@ -1674,6 +1674,22 @@ void ath_tx_aggr_wakeup(struct ath_softc
  	}
  }
  
@@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
  				   struct ieee80211_sta *sta,
  				   u16 tids, int nframes,
-@@ -1724,6 +1740,7 @@ void ath9k_release_buffered_frames(struc
+@@ -1704,6 +1720,7 @@ void ath9k_release_buffered_frames(struc
  			if (!bf)
  				break;
  
@@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  			list_add_tail(&bf->list, &bf_q);
  			ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  			if (bf_isampdu(bf)) {
-@@ -1747,6 +1764,9 @@ void ath9k_release_buffered_frames(struc
+@@ -1727,6 +1744,9 @@ void ath9k_release_buffered_frames(struc
  	if (list_empty(&bf_q))
  		return;
  
diff --git a/package/kernel/mac80211/patches/311-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch b/package/kernel/mac80211/patches/311-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch
index 9863dffc90..1893187e8a 100644
--- a/package/kernel/mac80211/patches/311-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch
+++ b/package/kernel/mac80211/patches/311-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch
@@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/drivers/net/wireless/ath/ath9k/xmit.c
 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -1004,7 +1004,8 @@ ath_tx_get_tid_subframe(struct ath_softc
+@@ -984,7 +984,8 @@ ath_tx_get_tid_subframe(struct ath_softc
  		bf->bf_lastbf = bf;
  
  		tx_info = IEEE80211_SKB_CB(skb);
diff --git a/package/kernel/mac80211/patches/313-ath9k-fix-block-ack-window-tracking-issues.patch b/package/kernel/mac80211/patches/313-ath9k-fix-block-ack-window-tracking-issues.patch
index fb8df08afe..59de1dfe1a 100644
--- a/package/kernel/mac80211/patches/313-ath9k-fix-block-ack-window-tracking-issues.patch
+++ b/package/kernel/mac80211/patches/313-ath9k-fix-block-ack-window-tracking-issues.patch
@@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
  					ath_tx_complete_buf(sc, bf, txq,
  							    &bf_head, NULL, ts,
-@@ -1046,11 +1054,14 @@ ath_tx_get_tid_subframe(struct ath_softc
+@@ -1026,11 +1034,14 @@ ath_tx_get_tid_subframe(struct ath_softc
  
  			INIT_LIST_HEAD(&bf_head);
  			list_add(&bf->list, &bf_head);
@@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  		return bf;
  	}
  
-@@ -1108,8 +1119,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s
+@@ -1088,8 +1099,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  		bf->bf_next = NULL;
  
  		/* link buffers of this frame to the aggregate */
@@ -100,7 +100,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  		bf->bf_state.ndelim = ndelim;
  
  		list_add_tail(&bf->list, bf_q);
-@@ -1745,10 +1754,8 @@ void ath9k_release_buffered_frames(struc
+@@ -1725,10 +1734,8 @@ void ath9k_release_buffered_frames(struc
  			ath9k_set_moredata(sc, bf, true);
  			list_add_tail(&bf->list, &bf_q);
  			ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
diff --git a/package/kernel/mac80211/patches/314-ath9k-rename-tx_complete_work-to-hw_check_work.patch b/package/kernel/mac80211/patches/314-ath9k-rename-tx_complete_work-to-hw_check_work.patch
deleted file mode 100644
index 5465df3ccf..0000000000
--- a/package/kernel/mac80211/patches/314-ath9k-rename-tx_complete_work-to-hw_check_work.patch
+++ /dev/null
@@ -1,175 +0,0 @@
-From: Felix Fietkau <nbd@nbd.name>
-Date: Wed, 25 Jan 2017 12:57:05 +0100
-Subject: [PATCH] ath9k: rename tx_complete_work to hw_check_work
-
-Also include common MAC alive check. This should make the hang checks
-more reliable for modes where beacons are not sent and is used as a
-starting point for further hang check improvements
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -108,7 +108,7 @@ int ath_descdma_setup(struct ath_softc *
- #define ATH_AGGR_MIN_QDEPTH        2
- /* minimum h/w qdepth for non-aggregated traffic */
- #define ATH_NON_AGGR_MIN_QDEPTH    8
--#define ATH_TX_COMPLETE_POLL_INT   1000
-+#define ATH_HW_CHECK_POLL_INT      1000
- #define ATH_TXFIFO_DEPTH           8
- #define ATH_TX_ERROR               0x01
- 
-@@ -745,7 +745,7 @@ void ath9k_csa_update(struct ath_softc *
- #define ATH_PAPRD_TIMEOUT         100 /* msecs */
- #define ATH_PLL_WORK_INTERVAL     100
- 
--void ath_tx_complete_poll_work(struct work_struct *work);
-+void ath_hw_check_work(struct work_struct *work);
- void ath_reset_work(struct work_struct *work);
- bool ath_hw_check(struct ath_softc *sc);
- void ath_hw_pll_work(struct work_struct *work);
-@@ -1053,7 +1053,7 @@ struct ath_softc {
- #ifdef CPTCFG_ATH9K_DEBUGFS
- 	struct ath9k_debug debug;
- #endif
--	struct delayed_work tx_complete_work;
-+	struct delayed_work hw_check_work;
- 	struct delayed_work hw_pll_work;
- 	struct timer_list sleep_timer;
- 
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -681,6 +681,7 @@ static int ath9k_init_softc(u16 devid, s
- 	INIT_WORK(&sc->hw_reset_work, ath_reset_work);
- 	INIT_WORK(&sc->paprd_work, ath_paprd_calibrate);
- 	INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work);
-+	INIT_DELAYED_WORK(&sc->hw_check_work, ath_hw_check_work);
- 
- 	ath9k_init_channel_context(sc);
- 
---- a/drivers/net/wireless/ath/ath9k/link.c
-+++ b/drivers/net/wireless/ath/ath9k/link.c
-@@ -20,20 +20,13 @@
-  * TX polling - checks if the TX engine is stuck somewhere
-  * and issues a chip reset if so.
-  */
--void ath_tx_complete_poll_work(struct work_struct *work)
-+static bool ath_tx_complete_check(struct ath_softc *sc)
- {
--	struct ath_softc *sc = container_of(work, struct ath_softc,
--					    tx_complete_work.work);
- 	struct ath_txq *txq;
- 	int i;
--	bool needreset = false;
--
- 
--	if (sc->tx99_state) {
--		ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
--			"skip tx hung detection on tx99\n");
--		return;
--	}
-+	if (sc->tx99_state)
-+		return true;
- 
- 	for (i = 0; i < IEEE80211_NUM_ACS; i++) {
- 		txq = sc->tx.txq_map[i];
-@@ -41,25 +34,36 @@ void ath_tx_complete_poll_work(struct wo
- 		ath_txq_lock(sc, txq);
- 		if (txq->axq_depth) {
- 			if (txq->axq_tx_inprogress) {
--				needreset = true;
- 				ath_txq_unlock(sc, txq);
--				break;
--			} else {
--				txq->axq_tx_inprogress = true;
-+				goto reset;
- 			}
-+
-+			txq->axq_tx_inprogress = true;
- 		}
- 		ath_txq_unlock(sc, txq);
- 	}
- 
--	if (needreset) {
--		ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
--			"tx hung, resetting the chip\n");
--		ath9k_queue_reset(sc, RESET_TYPE_TX_HANG);
-+	return true;
-+
-+reset:
-+	ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
-+		"tx hung, resetting the chip\n");
-+	ath9k_queue_reset(sc, RESET_TYPE_TX_HANG);
-+	return false;
-+
-+}
-+
-+void ath_hw_check_work(struct work_struct *work)
-+{
-+	struct ath_softc *sc = container_of(work, struct ath_softc,
-+					    hw_check_work.work);
-+
-+	if (!ath_hw_check(sc) ||
-+	    !ath_tx_complete_check(sc))
- 		return;
--	}
- 
--	ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
--				     msecs_to_jiffies(ATH_TX_COMPLETE_POLL_INT));
-+	ieee80211_queue_delayed_work(sc->hw, &sc->hw_check_work,
-+				     msecs_to_jiffies(ATH_HW_CHECK_POLL_INT));
- }
- 
- /*
---- a/drivers/net/wireless/ath/ath9k/main.c
-+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -181,7 +181,7 @@ void ath9k_ps_restore(struct ath_softc *
- static void __ath_cancel_work(struct ath_softc *sc)
- {
- 	cancel_work_sync(&sc->paprd_work);
--	cancel_delayed_work_sync(&sc->tx_complete_work);
-+	cancel_delayed_work_sync(&sc->hw_check_work);
- 	cancel_delayed_work_sync(&sc->hw_pll_work);
- 
- #ifdef CPTCFG_ATH9K_BTCOEX_SUPPORT
-@@ -198,7 +198,8 @@ void ath_cancel_work(struct ath_softc *s
- 
- void ath_restart_work(struct ath_softc *sc)
- {
--	ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
-+	ieee80211_queue_delayed_work(sc->hw, &sc->hw_check_work,
-+				     ATH_HW_CHECK_POLL_INT);
- 
- 	if (AR_SREV_9340(sc->sc_ah) || AR_SREV_9330(sc->sc_ah))
- 		ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work,
-@@ -2091,7 +2092,7 @@ void __ath9k_flush(struct ieee80211_hw *
- 	int timeout;
- 	bool drain_txq;
- 
--	cancel_delayed_work_sync(&sc->tx_complete_work);
-+	cancel_delayed_work_sync(&sc->hw_check_work);
- 
- 	if (ah->ah_flags & AH_UNPLUGGED) {
- 		ath_dbg(common, ANY, "Device has been unplugged!\n");
-@@ -2129,7 +2130,8 @@ void __ath9k_flush(struct ieee80211_hw *
- 		ath9k_ps_restore(sc);
- 	}
- 
--	ieee80211_queue_delayed_work(hw, &sc->tx_complete_work, 0);
-+	ieee80211_queue_delayed_work(hw, &sc->hw_check_work,
-+				     ATH_HW_CHECK_POLL_INT);
- }
- 
- static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw)
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -2916,8 +2916,6 @@ int ath_tx_init(struct ath_softc *sc, in
- 		return error;
- 	}
- 
--	INIT_DELAYED_WORK(&sc->tx_complete_work, ath_tx_complete_poll_work);
--
- 	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
- 		error = ath_tx_edma_init(sc);
- 
diff --git a/package/kernel/mac80211/patches/315-ath9k_hw-check-if-the-chip-failed-to-wake-up.patch b/package/kernel/mac80211/patches/315-ath9k_hw-check-if-the-chip-failed-to-wake-up.patch
deleted file mode 100644
index b0cb74ad05..0000000000
--- a/package/kernel/mac80211/patches/315-ath9k_hw-check-if-the-chip-failed-to-wake-up.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From: Felix Fietkau <nbd@nbd.name>
-Date: Wed, 25 Jan 2017 12:58:17 +0100
-Subject: [PATCH] ath9k_hw: check if the chip failed to wake up
-
-In an RFC patch, Sven Eckelmann and Simon Wunderlich reported:
-
-"QCA 802.11n chips (especially AR9330/AR9340) sometimes end up in a
-state in which a read of AR_CFG always returns 0xdeadbeef.
-This should not happen when when the power_mode of the device is
-ATH9K_PM_AWAKE."
-
-Include the check for the default register state in the existing MAC
-hang check.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1624,6 +1624,10 @@ bool ath9k_hw_check_alive(struct ath_hw
- 	int count = 50;
- 	u32 reg, last_val;
- 
-+	/* Check if chip failed to wake up */
-+	if (REG_READ(ah, AR_CFG) == 0xdeadbeef)
-+		return false;
-+
- 	if (AR_SREV_9300(ah))
- 		return !ath9k_hw_detect_mac_hang(ah);
- 
diff --git a/package/kernel/mac80211/patches/316-ath9k-fix-race-condition-in-enabling-disabling-IRQs.patch b/package/kernel/mac80211/patches/316-ath9k-fix-race-condition-in-enabling-disabling-IRQs.patch
deleted file mode 100644
index 7a41206132..0000000000
--- a/package/kernel/mac80211/patches/316-ath9k-fix-race-condition-in-enabling-disabling-IRQs.patch
+++ /dev/null
@@ -1,197 +0,0 @@
-From: Felix Fietkau <nbd@nbd.name>
-Date: Wed, 25 Jan 2017 15:10:37 +0100
-Subject: [PATCH] ath9k: fix race condition in enabling/disabling IRQs
-
-The code currently relies on refcounting to disable IRQs from within the
-IRQ handler and re-enabling them again after the tasklet has run.
-
-However, due to race conditions sometimes the IRQ handler might be
-called twice, or the tasklet may not run at all (if interrupted in the
-middle of a reset).
-
-This can cause nasty imbalances in the irq-disable refcount which will
-get the driver permanently stuck until the entire radio has been stopped
-and started again (ath_reset will not recover from this).
-
-Instead of using this fragile logic, change the code to ensure that
-running the irq handler during tasklet processing is safe, and leave the
-refcount untouched.
-
-Cc: stable@vger.kernel.org
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -998,6 +998,7 @@ struct ath_softc {
- 	struct survey_info *cur_survey;
- 	struct survey_info survey[ATH9K_NUM_CHANNELS];
- 
-+	spinlock_t intr_lock;
- 	struct tasklet_struct intr_tq;
- 	struct tasklet_struct bcon_tasklet;
- 	struct ath_hw *sc_ah;
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -669,6 +669,7 @@ static int ath9k_init_softc(u16 devid, s
- 		common->bt_ant_diversity = 1;
- 
- 	spin_lock_init(&common->cc_lock);
-+	spin_lock_init(&sc->intr_lock);
- 	spin_lock_init(&sc->sc_serial_rw);
- 	spin_lock_init(&sc->sc_pm_lock);
- 	spin_lock_init(&sc->chan_lock);
---- a/drivers/net/wireless/ath/ath9k/mac.c
-+++ b/drivers/net/wireless/ath/ath9k/mac.c
-@@ -810,21 +810,12 @@ void ath9k_hw_disable_interrupts(struct
- }
- EXPORT_SYMBOL(ath9k_hw_disable_interrupts);
- 
--void ath9k_hw_enable_interrupts(struct ath_hw *ah)
-+static void __ath9k_hw_enable_interrupts(struct ath_hw *ah)
- {
- 	struct ath_common *common = ath9k_hw_common(ah);
- 	u32 sync_default = AR_INTR_SYNC_DEFAULT;
- 	u32 async_mask;
- 
--	if (!(ah->imask & ATH9K_INT_GLOBAL))
--		return;
--
--	if (!atomic_inc_and_test(&ah->intr_ref_cnt)) {
--		ath_dbg(common, INTERRUPT, "Do not enable IER ref count %d\n",
--			atomic_read(&ah->intr_ref_cnt));
--		return;
--	}
--
- 	if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah) ||
- 	    AR_SREV_9561(ah))
- 		sync_default &= ~AR_INTR_SYNC_HOST1_FATAL;
-@@ -846,6 +837,39 @@ void ath9k_hw_enable_interrupts(struct a
- 	ath_dbg(common, INTERRUPT, "AR_IMR 0x%x IER 0x%x\n",
- 		REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER));
- }
-+
-+void ath9k_hw_resume_interrupts(struct ath_hw *ah)
-+{
-+	struct ath_common *common = ath9k_hw_common(ah);
-+
-+	if (!(ah->imask & ATH9K_INT_GLOBAL))
-+		return;
-+
-+	if (atomic_read(&ah->intr_ref_cnt) != 0) {
-+		ath_dbg(common, INTERRUPT, "Do not enable IER ref count %d\n",
-+			atomic_read(&ah->intr_ref_cnt));
-+		return;
-+	}
-+
-+	__ath9k_hw_enable_interrupts(ah);
-+}
-+EXPORT_SYMBOL(ath9k_hw_resume_interrupts);
-+
-+void ath9k_hw_enable_interrupts(struct ath_hw *ah)
-+{
-+	struct ath_common *common = ath9k_hw_common(ah);
-+
-+	if (!(ah->imask & ATH9K_INT_GLOBAL))
-+		return;
-+
-+	if (!atomic_inc_and_test(&ah->intr_ref_cnt)) {
-+		ath_dbg(common, INTERRUPT, "Do not enable IER ref count %d\n",
-+			atomic_read(&ah->intr_ref_cnt));
-+		return;
-+	}
-+
-+	__ath9k_hw_enable_interrupts(ah);
-+}
- EXPORT_SYMBOL(ath9k_hw_enable_interrupts);
- 
- void ath9k_hw_set_interrupts(struct ath_hw *ah)
---- a/drivers/net/wireless/ath/ath9k/mac.h
-+++ b/drivers/net/wireless/ath/ath9k/mac.h
-@@ -744,6 +744,7 @@ void ath9k_hw_set_interrupts(struct ath_
- void ath9k_hw_enable_interrupts(struct ath_hw *ah);
- void ath9k_hw_disable_interrupts(struct ath_hw *ah);
- void ath9k_hw_kill_interrupts(struct ath_hw *ah);
-+void ath9k_hw_resume_interrupts(struct ath_hw *ah);
- 
- void ar9002_hw_attach_mac_ops(struct ath_hw *ah);
- 
---- a/drivers/net/wireless/ath/ath9k/main.c
-+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -374,21 +374,20 @@ void ath9k_tasklet(unsigned long data)
- 	struct ath_common *common = ath9k_hw_common(ah);
- 	enum ath_reset_type type;
- 	unsigned long flags;
--	u32 status = sc->intrstatus;
-+	u32 status;
- 	u32 rxmask;
- 
-+	spin_lock_irqsave(&sc->intr_lock, flags);
-+	status = sc->intrstatus;
-+	sc->intrstatus = 0;
-+	spin_unlock_irqrestore(&sc->intr_lock, flags);
-+
- 	ath9k_ps_wakeup(sc);
- 	spin_lock(&sc->sc_pcu_lock);
- 
- 	if (status & ATH9K_INT_FATAL) {
- 		type = RESET_TYPE_FATAL_INT;
- 		ath9k_queue_reset(sc, type);
--
--		/*
--		 * Increment the ref. counter here so that
--		 * interrupts are enabled in the reset routine.
--		 */
--		atomic_inc(&ah->intr_ref_cnt);
- 		ath_dbg(common, RESET, "FATAL: Skipping interrupts\n");
- 		goto out;
- 	}
-@@ -404,11 +403,6 @@ void ath9k_tasklet(unsigned long data)
- 			type = RESET_TYPE_BB_WATCHDOG;
- 			ath9k_queue_reset(sc, type);
- 
--			/*
--			 * Increment the ref. counter here so that
--			 * interrupts are enabled in the reset routine.
--			 */
--			atomic_inc(&ah->intr_ref_cnt);
- 			ath_dbg(common, RESET,
- 				"BB_WATCHDOG: Skipping interrupts\n");
- 			goto out;
-@@ -421,7 +415,6 @@ void ath9k_tasklet(unsigned long data)
- 		if ((sc->gtt_cnt >= MAX_GTT_CNT) && !ath9k_hw_check_alive(ah)) {
- 			type = RESET_TYPE_TX_GTT;
- 			ath9k_queue_reset(sc, type);
--			atomic_inc(&ah->intr_ref_cnt);
- 			ath_dbg(common, RESET,
- 				"GTT: Skipping interrupts\n");
- 			goto out;
-@@ -478,7 +471,7 @@ void ath9k_tasklet(unsigned long data)
- 	ath9k_btcoex_handle_interrupt(sc, status);
- 
- 	/* re-enable hardware interrupt */
--	ath9k_hw_enable_interrupts(ah);
-+	ath9k_hw_resume_interrupts(ah);
- out:
- 	spin_unlock(&sc->sc_pcu_lock);
- 	ath9k_ps_restore(sc);
-@@ -542,7 +535,9 @@ irqreturn_t ath_isr(int irq, void *dev)
- 		return IRQ_NONE;
- 
- 	/* Cache the status */
--	sc->intrstatus = status;
-+	spin_lock(&sc->intr_lock);
-+	sc->intrstatus |= status;
-+	spin_unlock(&sc->intr_lock);
- 
- 	if (status & SCHED_INTR)
- 		sched = true;
-@@ -588,7 +583,7 @@ chip_reset:
- 
- 	if (sched) {
- 		/* turn off every interrupt */
--		ath9k_hw_disable_interrupts(ah);
-+		ath9k_hw_kill_interrupts(ah);
- 		tasklet_schedule(&sc->intr_tq);
- 	}
- 
diff --git a/package/kernel/mac80211/patches/318-0001-brcmfmac-check-brcmf_bus_get_memdump-result-for-erro.patch b/package/kernel/mac80211/patches/318-0001-brcmfmac-check-brcmf_bus_get_memdump-result-for-erro.patch
deleted file mode 100644
index 4ae4c606c5..0000000000
--- a/package/kernel/mac80211/patches/318-0001-brcmfmac-check-brcmf_bus_get_memdump-result-for-erro.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Mon, 30 Jan 2017 16:09:51 +0100
-Subject: [PATCH] brcmfmac: check brcmf_bus_get_memdump result for error
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This method may be unsupported (see: USB bus) or may just fail (see:
-SDIO bus).
-While at it rework logic in brcmf_sdio_bus_get_memdump function to avoid
-too many conditional code nesting levels.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
-@@ -32,16 +32,25 @@ static int brcmf_debug_create_memdump(st
- {
- 	void *dump;
- 	size_t ramsize;
-+	int err;
- 
- 	ramsize = brcmf_bus_get_ramsize(bus);
--	if (ramsize) {
--		dump = vzalloc(len + ramsize);
--		if (!dump)
--			return -ENOMEM;
--		memcpy(dump, data, len);
--		brcmf_bus_get_memdump(bus, dump + len, ramsize);
--		dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
-+	if (!ramsize)
-+		return -ENOTSUPP;
-+
-+	dump = vzalloc(len + ramsize);
-+	if (!dump)
-+		return -ENOMEM;
-+
-+	memcpy(dump, data, len);
-+	err = brcmf_bus_get_memdump(bus, dump + len, ramsize);
-+	if (err) {
-+		vfree(dump);
-+		return err;
- 	}
-+
-+	dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
-+
- 	return 0;
- }
- 
diff --git a/package/kernel/mac80211/patches/319-0002-brcmfmac-be-more-verbose-when-PSM-s-watchdog-fires.patch b/package/kernel/mac80211/patches/319-0002-brcmfmac-be-more-verbose-when-PSM-s-watchdog-fires.patch
deleted file mode 100644
index 2a3b83864e..0000000000
--- a/package/kernel/mac80211/patches/319-0002-brcmfmac-be-more-verbose-when-PSM-s-watchdog-fires.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Mon, 30 Jan 2017 16:09:52 +0100
-Subject: [PATCH] brcmfmac: be more verbose when PSM's watchdog fires
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It's important to inform user so he knows things went wrong. He may also
-want to get memory dump for further debugging purposes.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
-@@ -58,10 +58,18 @@ static int brcmf_debug_psm_watchdog_noti
- 					   const struct brcmf_event_msg *evtmsg,
- 					   void *data)
- {
-+	int err;
-+
- 	brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
- 
--	return brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
--					  evtmsg->datalen);
-+	brcmf_err("PSM's watchdog has fired!\n");
-+
-+	err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
-+					 evtmsg->datalen);
-+	if (err)
-+		brcmf_err("Failed to get memory dump, %d\n", err);
-+
-+	return err;
- }
- 
- void brcmf_debugfs_init(void)
diff --git a/package/kernel/mac80211/patches/319-0003-brcmfmac-use-wiphy_read_of_freq_limits-to-respect-li.patch b/package/kernel/mac80211/patches/319-0003-brcmfmac-use-wiphy_read_of_freq_limits-to-respect-li.patch
deleted file mode 100644
index 6448bad5e9..0000000000
--- a/package/kernel/mac80211/patches/319-0003-brcmfmac-use-wiphy_read_of_freq_limits-to-respect-li.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 0f83ff69735651cc7a3d150466a5257ff829b62b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Tue, 17 Jan 2017 23:35:50 +0100
-Subject: [PATCH] brcmfmac: use wiphy_read_of_freq_limits to respect limits
- from DT
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This new helper reads extra frequency limits specified in DT and
-disables unavailable chanels. This is useful for devices (like home
-routers) with chipsets limited e.g. by board design.
-
-In order to respect info read from DT we simply need to check for
-IEEE80211_CHAN_DISABLED bit when constructing channel info.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -5908,6 +5908,9 @@ static int brcmf_construct_chaninfo(stru
- 			continue;
- 		}
- 
-+		if (channel->orig_flags & IEEE80211_CHAN_DISABLED)
-+			continue;
-+
- 		/* assuming the chanspecs order is HT20,
- 		 * HT40 upper, HT40 lower, and VHT80.
- 		 */
-@@ -6509,6 +6512,9 @@ static int brcmf_setup_wiphy(struct wiph
- 			wiphy->bands[NL80211_BAND_5GHZ] = band;
- 		}
- 	}
-+
-+	wiphy_read_of_freq_limits(wiphy);
-+
- 	return 0;
- }
- 
diff --git a/package/kernel/mac80211/patches/319-0004-brcmfmac-merge-two-brcmf_err-macros-into-one.patch b/package/kernel/mac80211/patches/319-0004-brcmfmac-merge-two-brcmf_err-macros-into-one.patch
deleted file mode 100644
index defd5792ea..0000000000
--- a/package/kernel/mac80211/patches/319-0004-brcmfmac-merge-two-brcmf_err-macros-into-one.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 9587a01a7ead9efc5032c16e0d9668de58be1186 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Thu, 2 Feb 2017 22:33:13 +0100
-Subject: [PATCH] brcmfmac: merge two brcmf_err macros into one
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This allows simplifying the code by adding a simple IS_ENABLED check for
-CONFIG_BRCMDB symbol.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 8 ++------
- 1 file changed, 2 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-@@ -45,20 +45,16 @@
- #undef pr_fmt
- #define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt
- 
-+#ifndef CPTCFG_BRCM_TRACING
- /* Macro for error messages. net_ratelimit() is used when driver
-  * debugging is not selected. When debugging the driver error
-  * messages are as important as other tracing or even more so.
-  */
--#ifndef CPTCFG_BRCM_TRACING
--#ifdef CPTCFG_BRCMDBG
--#define brcmf_err(fmt, ...)	pr_err("%s: " fmt, __func__, ##__VA_ARGS__)
--#else
- #define brcmf_err(fmt, ...)						\
- 	do {								\
--		if (net_ratelimit())					\
-+		if (IS_ENABLED(CPTCFG_BRCMDBG) || net_ratelimit())	\
- 			pr_err("%s: " fmt, __func__, ##__VA_ARGS__);	\
- 	} while (0)
--#endif
- #else
- __printf(2, 3)
- void __brcmf_err(const char *func, const char *fmt, ...);
diff --git a/package/kernel/mac80211/patches/319-0005-brcmfmac-switch-to-C-function-__brcmf_err-for-printi.patch b/package/kernel/mac80211/patches/319-0005-brcmfmac-switch-to-C-function-__brcmf_err-for-printi.patch
deleted file mode 100644
index 5baf6960ec..0000000000
--- a/package/kernel/mac80211/patches/319-0005-brcmfmac-switch-to-C-function-__brcmf_err-for-printi.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 087fa712a00685dac4bcc64b7c3dc8ae6bee8026 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Thu, 2 Feb 2017 22:33:14 +0100
-Subject: [PATCH] brcmfmac: switch to C function (__brcmf_err) for printing
- errors
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This will allow extending code and using more detailed messages e.g.
-with the help of dev_err.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../net/wireless/broadcom/brcm80211/brcmfmac/common.c    | 16 ++++++++++++++++
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h |  6 +++---
- 2 files changed, 19 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
-@@ -218,6 +218,22 @@ done:
- 	return err;
- }
- 
-+#ifndef CPTCFG_BRCM_TRACING
-+void __brcmf_err(const char *func, const char *fmt, ...)
-+{
-+	struct va_format vaf;
-+	va_list args;
-+
-+	va_start(args, fmt);
-+
-+	vaf.fmt = fmt;
-+	vaf.va = &args;
-+	pr_err("%s: %pV", func, &vaf);
-+
-+	va_end(args);
-+}
-+#endif
-+
- #if defined(CPTCFG_BRCM_TRACING) || defined(CPTCFG_BRCMDBG)
- void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...)
- {
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-@@ -45,6 +45,8 @@
- #undef pr_fmt
- #define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt
- 
-+__printf(2, 3)
-+void __brcmf_err(const char *func, const char *fmt, ...);
- #ifndef CPTCFG_BRCM_TRACING
- /* Macro for error messages. net_ratelimit() is used when driver
-  * debugging is not selected. When debugging the driver error
-@@ -53,11 +55,9 @@
- #define brcmf_err(fmt, ...)						\
- 	do {								\
- 		if (IS_ENABLED(CPTCFG_BRCMDBG) || net_ratelimit())	\
--			pr_err("%s: " fmt, __func__, ##__VA_ARGS__);	\
-+			__brcmf_err(__func__, fmt, ##__VA_ARGS__);	\
- 	} while (0)
- #else
--__printf(2, 3)
--void __brcmf_err(const char *func, const char *fmt, ...);
- #define brcmf_err(fmt, ...) \
- 	__brcmf_err(__func__, fmt, ##__VA_ARGS__)
- #endif
diff --git a/package/kernel/mac80211/patches/319-0006-brcmfmac-merge-two-remaining-brcmf_err-macros.patch b/package/kernel/mac80211/patches/319-0006-brcmfmac-merge-two-remaining-brcmf_err-macros.patch
deleted file mode 100644
index 3aaddb800d..0000000000
--- a/package/kernel/mac80211/patches/319-0006-brcmfmac-merge-two-remaining-brcmf_err-macros.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From d0630555650a394cf5743268820511f527a561a5 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Thu, 2 Feb 2017 22:33:15 +0100
-Subject: [PATCH] brcmfmac: merge two remaining brcmf_err macros
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Now we always have __brcmf_err function we can do perfectly fine with
-just one macro.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 14 +++++---------
- 1 file changed, 5 insertions(+), 9 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-@@ -47,20 +47,16 @@
- 
- __printf(2, 3)
- void __brcmf_err(const char *func, const char *fmt, ...);
--#ifndef CPTCFG_BRCM_TRACING
--/* Macro for error messages. net_ratelimit() is used when driver
-- * debugging is not selected. When debugging the driver error
-- * messages are as important as other tracing or even more so.
-+/* Macro for error messages. When debugging / tracing the driver all error
-+ * messages are important to us.
-  */
- #define brcmf_err(fmt, ...)						\
- 	do {								\
--		if (IS_ENABLED(CPTCFG_BRCMDBG) || net_ratelimit())	\
-+		if (IS_ENABLED(CPTCFG_BRCMDBG) ||			\
-+		    IS_ENABLED(CPTCFG_BRCM_TRACING) ||			\
-+		    net_ratelimit())					\
- 			__brcmf_err(__func__, fmt, ##__VA_ARGS__);	\
- 	} while (0)
--#else
--#define brcmf_err(fmt, ...) \
--	__brcmf_err(__func__, fmt, ##__VA_ARGS__)
--#endif
- 
- #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
- __printf(3, 4)
diff --git a/package/kernel/mac80211/patches/320-ath9k-clean-up-and-fix-ath_tx_count_airtime.patch b/package/kernel/mac80211/patches/320-ath9k-clean-up-and-fix-ath_tx_count_airtime.patch
deleted file mode 100644
index a6a3bfca6d..0000000000
--- a/package/kernel/mac80211/patches/320-ath9k-clean-up-and-fix-ath_tx_count_airtime.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-From: Felix Fietkau <nbd@nbd.name>
-Date: Sun, 12 Feb 2017 13:13:05 +0100
-Subject: [PATCH] ath9k: clean up and fix ath_tx_count_airtime
-
-ath_tx_count_airtime is doing a lot of unnecessary work:
-
-- Redundant station lookup
-- Redundant rcu_read_lock/unlock
-- Useless memcpy of bf->rates
-- Useless NULL check of bf->bf_mpdu
-- Redundant lookup of the skb tid
-
-Additionally, it tries to look up the mac80211 queue index from the txq,
-which fails if the frame was delivered via the power save queue.
-
-This patch fixes all of these issues by passing down the right set of
-pointers instead of doing extra work
-
-Cc: stable@vger.kernel.org
-Fixes: 63fefa050477 ("ath9k: Introduce airtime fairness scheduling between stations")
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -723,51 +723,31 @@ static bool bf_is_ampdu_not_probing(stru
-     return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
- }
- 
--static void ath_tx_count_airtime(struct ath_softc *sc, struct ath_txq *txq,
--				 struct ath_buf *bf, struct ath_tx_status *ts)
-+static void ath_tx_count_airtime(struct ath_softc *sc, struct ath_node *an,
-+				 struct ath_atx_tid *tid, struct ath_buf *bf,
-+				 struct ath_tx_status *ts)
- {
--	struct ath_node *an;
--	struct ath_acq *acq = &sc->cur_chan->acq[txq->mac80211_qnum];
--	struct sk_buff *skb;
--	struct ieee80211_hdr *hdr;
--	struct ieee80211_hw *hw = sc->hw;
--	struct ieee80211_tx_rate rates[4];
--	struct ieee80211_sta *sta;
--	int i;
-+	struct ath_txq *txq = tid->txq;
- 	u32 airtime = 0;
--
--	skb = bf->bf_mpdu;
--	if(!skb)
--		return;
--
--	hdr = (struct ieee80211_hdr *)skb->data;
--	memcpy(rates, bf->rates, sizeof(rates));
--
--	rcu_read_lock();
--
--	sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
--	if(!sta)
--		goto exit;
--
--
--	an = (struct ath_node *) sta->drv_priv;
-+	int i;
- 
- 	airtime += ts->duration * (ts->ts_longretry + 1);
-+	for(i = 0; i < ts->ts_rateindex; i++) {
-+		int rate_dur = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc, i);
-+		airtime += rate_dur * bf->rates[i].count;
-+	}
- 
--	for(i=0; i < ts->ts_rateindex; i++)
--		airtime += ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc, i) * rates[i].count;
-+	if (sc->airtime_flags & AIRTIME_USE_TX) {
-+		int q = txq->mac80211_qnum;
-+		struct ath_acq *acq = &sc->cur_chan->acq[q];
- 
--	if (!!(sc->airtime_flags & AIRTIME_USE_TX)) {
- 		spin_lock_bh(&acq->lock);
--		an->airtime_deficit[txq->mac80211_qnum] -= airtime;
--		if (an->airtime_deficit[txq->mac80211_qnum] <= 0)
--			__ath_tx_queue_tid(sc, ath_get_skb_tid(sc, an, skb));
-+		an->airtime_deficit[q] -= airtime;
-+		if (an->airtime_deficit[q] <= 0)
-+			__ath_tx_queue_tid(sc, tid);
- 		spin_unlock_bh(&acq->lock);
- 	}
- 	ath_debug_airtime(sc, an, 0, airtime);
--
--exit:
--	rcu_read_unlock();
- }
- 
- static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
-@@ -791,13 +771,13 @@ static void ath_tx_process_buffer(struct
- 
- 	ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc,
- 					     ts->ts_rateindex);
--	ath_tx_count_airtime(sc, txq, bf, ts);
- 
- 	hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
- 	sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
- 	if (sta) {
- 		struct ath_node *an = (struct ath_node *)sta->drv_priv;
- 		tid = ath_get_skb_tid(sc, an, bf->bf_mpdu);
-+		ath_tx_count_airtime(sc, an, tid, bf, ts);
- 		if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
- 			tid->clear_ps_filter = true;
- 	}
diff --git a/package/kernel/mac80211/patches/321-mac80211-fix-CSA-in-IBSS-mode.patch b/package/kernel/mac80211/patches/321-mac80211-fix-CSA-in-IBSS-mode.patch
deleted file mode 100644
index 13765b2900..0000000000
--- a/package/kernel/mac80211/patches/321-mac80211-fix-CSA-in-IBSS-mode.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From: Koen Vandeputte <koen.vandeputte@ncentric.com>
-Date: Wed, 8 Feb 2017 15:29:45 +0100
-Subject: [PATCH] mac80211: fix CSA in IBSS mode
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Add the missing IBSS capability flag during capability init as it needs
-to be inserted into the generated beacon in order for CSA to work.
-
-Signed-off-by: Piotr Gawlowicz <gawlowicz@tkn.tu-berlin.de>
-Signed-off-by: Mikołaj Chwalisz <chwalisz@tkn.tu-berlin.de>
-Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
----
-
---- a/net/mac80211/ibss.c
-+++ b/net/mac80211/ibss.c
-@@ -487,14 +487,14 @@ int ieee80211_ibss_csa_beacon(struct iee
- 	struct beacon_data *presp, *old_presp;
- 	struct cfg80211_bss *cbss;
- 	const struct cfg80211_bss_ies *ies;
--	u16 capability = 0;
-+	u16 capability = WLAN_CAPABILITY_IBSS;
- 	u64 tsf;
- 	int ret = 0;
- 
- 	sdata_assert_lock(sdata);
- 
- 	if (ifibss->privacy)
--		capability = WLAN_CAPABILITY_PRIVACY;
-+		capability |= WLAN_CAPABILITY_PRIVACY;
- 
- 	cbss = cfg80211_get_bss(sdata->local->hw.wiphy, ifibss->chandef.chan,
- 				ifibss->bssid, ifibss->ssid,
diff --git a/package/kernel/mac80211/patches/322-mac80211-don-t-handle-filtered-frames-within-a-BA-se.patch b/package/kernel/mac80211/patches/322-mac80211-don-t-handle-filtered-frames-within-a-BA-se.patch
deleted file mode 100644
index 66e1bfb4c1..0000000000
--- a/package/kernel/mac80211/patches/322-mac80211-don-t-handle-filtered-frames-within-a-BA-se.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From: Felix Fietkau <nbd@nbd.name>
-Date: Wed, 22 Feb 2017 16:13:17 +0100
-Subject: [PATCH] mac80211: don't handle filtered frames within a BA session
-
-When running a BA session, the driver (or the hardware) already takes
-care of retransmitting failed frames, since it has to keep the receiver
-reorder window in sync.
-
-Adding another layer of retransmit around that does not improve
-anything. In fact, it can only lead to some strong reordering with huge
-latency.
-
-Cc: stable@vger.kernel.org
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/status.c
-+++ b/net/mac80211/status.c
-@@ -51,7 +51,8 @@ static void ieee80211_handle_filtered_fr
- 	struct ieee80211_hdr *hdr = (void *)skb->data;
- 	int ac;
- 
--	if (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER) {
-+	if (info->flags & (IEEE80211_TX_CTL_NO_PS_BUFFER |
-+			   IEEE80211_TX_CTL_AMPDU)) {
- 		ieee80211_free_txskb(&local->hw, skb);
- 		return;
- 	}
diff --git a/package/kernel/mac80211/patches/323-0001-brcmfmac-Use-net_device_stats-from-struct-net_device.patch b/package/kernel/mac80211/patches/323-0001-brcmfmac-Use-net_device_stats-from-struct-net_device.patch
deleted file mode 100644
index 81567d8757..0000000000
--- a/package/kernel/mac80211/patches/323-0001-brcmfmac-Use-net_device_stats-from-struct-net_device.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-From 91b632803ee4e47c5a5c4dc3d8bf5abf9c16107a Mon Sep 17 00:00:00 2001
-From: Tobias Klauser <tklauser@distanz.ch>
-Date: Mon, 13 Feb 2017 11:14:09 +0100
-Subject: [PATCH] brcmfmac: Use net_device_stats from struct net_device
-
-Instead of using a private copy of struct net_device_stats in struct
-brcm_if, use stats from struct net_device.  Also remove the now
-unnecessary .ndo_get_stats function.
-
-Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../wireless/broadcom/brcm80211/brcmfmac/core.c    | 26 +++++++---------------
- .../wireless/broadcom/brcm80211/brcmfmac/core.h    |  2 --
- 2 files changed, 8 insertions(+), 20 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -249,10 +249,10 @@ static netdev_tx_t brcmf_netdev_start_xm
- 
- done:
- 	if (ret) {
--		ifp->stats.tx_dropped++;
-+		ndev->stats.tx_dropped++;
- 	} else {
--		ifp->stats.tx_packets++;
--		ifp->stats.tx_bytes += skb->len;
-+		ndev->stats.tx_packets++;
-+		ndev->stats.tx_bytes += skb->len;
- 	}
- 
- 	/* Return ok: we always eat the packet */
-@@ -296,15 +296,15 @@ void brcmf_txflowblock(struct device *de
- void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
- {
- 	if (skb->pkt_type == PACKET_MULTICAST)
--		ifp->stats.multicast++;
-+		ifp->ndev->stats.multicast++;
- 
- 	if (!(ifp->ndev->flags & IFF_UP)) {
- 		brcmu_pkt_buf_free_skb(skb);
- 		return;
- 	}
- 
--	ifp->stats.rx_bytes += skb->len;
--	ifp->stats.rx_packets++;
-+	ifp->ndev->stats.rx_bytes += skb->len;
-+	ifp->ndev->stats.rx_packets++;
- 
- 	brcmf_dbg(DATA, "rx proto=0x%X\n", ntohs(skb->protocol));
- 	if (in_interrupt())
-@@ -327,7 +327,7 @@ static int brcmf_rx_hdrpull(struct brcmf
- 
- 	if (ret || !(*ifp) || !(*ifp)->ndev) {
- 		if (ret != -ENODATA && *ifp)
--			(*ifp)->stats.rx_errors++;
-+			(*ifp)->ndev->stats.rx_errors++;
- 		brcmu_pkt_buf_free_skb(skb);
- 		return -ENODATA;
- 	}
-@@ -388,7 +388,7 @@ void brcmf_txfinalize(struct brcmf_if *i
- 	}
- 
- 	if (!success)
--		ifp->stats.tx_errors++;
-+		ifp->ndev->stats.tx_errors++;
- 
- 	brcmu_pkt_buf_free_skb(txp);
- }
-@@ -411,15 +411,6 @@ void brcmf_txcomplete(struct device *dev
- 	}
- }
- 
--static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev)
--{
--	struct brcmf_if *ifp = netdev_priv(ndev);
--
--	brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
--
--	return &ifp->stats;
--}
--
- static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
- 				    struct ethtool_drvinfo *info)
- {
-@@ -492,7 +483,6 @@ static int brcmf_netdev_open(struct net_
- static const struct net_device_ops brcmf_netdev_ops_pri = {
- 	.ndo_open = brcmf_netdev_open,
- 	.ndo_stop = brcmf_netdev_stop,
--	.ndo_get_stats = brcmf_netdev_get_stats,
- 	.ndo_start_xmit = brcmf_netdev_start_xmit,
- 	.ndo_set_mac_address = brcmf_netdev_set_mac_address,
- 	.ndo_set_rx_mode = brcmf_netdev_set_multicast_list
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
-@@ -171,7 +171,6 @@ enum brcmf_netif_stop_reason {
-  * @drvr: points to device related information.
-  * @vif: points to cfg80211 specific interface information.
-  * @ndev: associated network device.
-- * @stats: interface specific network statistics.
-  * @multicast_work: worker object for multicast provisioning.
-  * @ndoffload_work: worker object for neighbor discovery offload configuration.
-  * @fws_desc: interface specific firmware-signalling descriptor.
-@@ -187,7 +186,6 @@ struct brcmf_if {
- 	struct brcmf_pub *drvr;
- 	struct brcmf_cfg80211_vif *vif;
- 	struct net_device *ndev;
--	struct net_device_stats stats;
- 	struct work_struct multicast_work;
- 	struct work_struct ndoffload_work;
- 	struct brcmf_fws_mac_descriptor *fws_desc;
diff --git a/package/kernel/mac80211/patches/323-0002-brcmfmac-always-print-error-when-PSM-s-watchdog-fire.patch b/package/kernel/mac80211/patches/323-0002-brcmfmac-always-print-error-when-PSM-s-watchdog-fire.patch
deleted file mode 100644
index 7272b889c0..0000000000
--- a/package/kernel/mac80211/patches/323-0002-brcmfmac-always-print-error-when-PSM-s-watchdog-fire.patch
+++ /dev/null
@@ -1,148 +0,0 @@
-From f1ac3aa212af6dd0a36dc07a63f95f91be6f4935 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Fri, 24 Feb 2017 17:32:46 +0100
-Subject: [PATCH] brcmfmac: always print error when PSM's watchdog fires
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-So far we were attaching BRCMF_E_PSM_WATCHDOG event listener in
-brcmf_debug_attach which gets compiled only with CONFIG_BRCMDBG. This
-event means something went wrong and firmware / hardware usually can't
-be expected to work (reliably).
-
-Such a problem is significant for user experience so I believe we should
-print an error unconditionally (even with debugging disabled). What can
-be indeed optional is dumping bus memory as this is clearly part of
-debugging process.
-
-In the future we may also try to extend this listener by trying to
-recover from the error or at least signal it to the cfg80211.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../wireless/broadcom/brcm80211/brcmfmac/core.c    | 22 ++++++++++++++++++
- .../wireless/broadcom/brcm80211/brcmfmac/debug.c   | 26 +++-------------------
- .../wireless/broadcom/brcm80211/brcmfmac/debug.h   |  9 ++++++++
- 3 files changed, 34 insertions(+), 23 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -738,6 +738,24 @@ void brcmf_remove_interface(struct brcmf
- 	brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
- }
- 
-+static int brcmf_psm_watchdog_notify(struct brcmf_if *ifp,
-+				     const struct brcmf_event_msg *evtmsg,
-+				     void *data)
-+{
-+	int err;
-+
-+	brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
-+
-+	brcmf_err("PSM's watchdog has fired!\n");
-+
-+	err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
-+					 evtmsg->datalen);
-+	if (err)
-+		brcmf_err("Failed to get memory dump, %d\n", err);
-+
-+	return err;
-+}
-+
- #ifdef CONFIG_INET
- #define ARPOL_MAX_ENTRIES	8
- static int brcmf_inetaddr_changed(struct notifier_block *nb,
-@@ -917,6 +935,10 @@ int brcmf_attach(struct device *dev, str
- 		goto fail;
- 	}
- 
-+	/* Attach to events important for core code */
-+	brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG,
-+			    brcmf_psm_watchdog_notify);
-+
- 	/* attach firmware event handler */
- 	brcmf_fweh_attach(drvr);
- 
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
-@@ -27,8 +27,8 @@
- 
- static struct dentry *root_folder;
- 
--static int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
--				      size_t len)
-+int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
-+			       size_t len)
- {
- 	void *dump;
- 	size_t ramsize;
-@@ -54,24 +54,6 @@ static int brcmf_debug_create_memdump(st
- 	return 0;
- }
- 
--static int brcmf_debug_psm_watchdog_notify(struct brcmf_if *ifp,
--					   const struct brcmf_event_msg *evtmsg,
--					   void *data)
--{
--	int err;
--
--	brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
--
--	brcmf_err("PSM's watchdog has fired!\n");
--
--	err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
--					 evtmsg->datalen);
--	if (err)
--		brcmf_err("Failed to get memory dump, %d\n", err);
--
--	return err;
--}
--
- void brcmf_debugfs_init(void)
- {
- 	root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL);
-@@ -99,9 +81,7 @@ int brcmf_debug_attach(struct brcmf_pub
- 	if (IS_ERR(drvr->dbgfs_dir))
- 		return PTR_ERR(drvr->dbgfs_dir);
- 
--
--	return brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG,
--				   brcmf_debug_psm_watchdog_notify);
-+	return 0;
- }
- 
- void brcmf_debug_detach(struct brcmf_pub *drvr)
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-@@ -99,6 +99,7 @@ do {									\
- 
- extern int brcmf_msg_level;
- 
-+struct brcmf_bus;
- struct brcmf_pub;
- #ifdef DEBUG
- void brcmf_debugfs_init(void);
-@@ -108,6 +109,8 @@ void brcmf_debug_detach(struct brcmf_pub
- struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr);
- int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
- 			    int (*read_fn)(struct seq_file *seq, void *data));
-+int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
-+			       size_t len);
- #else
- static inline void brcmf_debugfs_init(void)
- {
-@@ -128,6 +131,12 @@ int brcmf_debugfs_add_entry(struct brcmf
- {
- 	return 0;
- }
-+static inline
-+int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
-+			       size_t len)
-+{
-+	return 0;
-+}
- #endif
- 
- #endif /* BRCMFMAC_DEBUG_H */
diff --git a/package/kernel/mac80211/patches/323-0003-brcmfmac-Do-not-print-the-firmware-version-as-an-err.patch b/package/kernel/mac80211/patches/323-0003-brcmfmac-Do-not-print-the-firmware-version-as-an-err.patch
deleted file mode 100644
index 3ab9b66e08..0000000000
--- a/package/kernel/mac80211/patches/323-0003-brcmfmac-Do-not-print-the-firmware-version-as-an-err.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From d79fe4cb70d8deab7b8dc1de547ed4b915574414 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Wed, 8 Mar 2017 14:50:15 +0100
-Subject: [PATCH] brcmfmac: Do not print the firmware version as an error
-
-Using pr_err for things which are not errors is a bad idea. E.g. it
-will cause the plymouth bootsplash screen to drop back to the text
-console so that the user can see the error, which is not what we
-normally want to happen.
-
-Instead add a new brcmf_info macro and use that.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +-
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h  | 9 +++++++++
- 2 files changed, 10 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
-@@ -161,7 +161,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
- 	strsep(&ptr, "\n");
- 
- 	/* Print fw version info */
--	brcmf_err("Firmware version = %s\n", buf);
-+	brcmf_info("Firmware version = %s\n", buf);
- 
- 	/* locate firmware version number for ethtool */
- 	ptr = strrchr(buf, ' ') + 1;
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-@@ -59,6 +59,10 @@ void __brcmf_err(const char *func, const
- 	} while (0)
- 
- #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
-+
-+/* For debug/tracing purposes treat info messages as errors */
-+#define brcmf_info brcmf_err
-+
- __printf(3, 4)
- void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...);
- #define brcmf_dbg(level, fmt, ...)				\
-@@ -77,6 +81,11 @@ do {								\
- 
- #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
- 
-+#define brcmf_info(fmt, ...)						\
-+	do {								\
-+		pr_info("%s: " fmt, __func__, ##__VA_ARGS__);		\
-+	} while (0)
-+
- #define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
- 
- #define BRCMF_DATA_ON()		0
diff --git a/package/kernel/mac80211/patches/323-0004-brcmfmac-Do-not-complain-about-country-code-00.patch b/package/kernel/mac80211/patches/323-0004-brcmfmac-Do-not-complain-about-country-code-00.patch
deleted file mode 100644
index f4570e71b1..0000000000
--- a/package/kernel/mac80211/patches/323-0004-brcmfmac-Do-not-complain-about-country-code-00.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 26e537884a8ef451f5c60f6949b1615069931ffa Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Wed, 8 Mar 2017 14:50:16 +0100
-Subject: [PATCH] brcmfmac: Do not complain about country code "00"
-
-The country code gets set to "00" by default at boot, ignore this
-rather then logging an error about it.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -6736,6 +6736,10 @@ static void brcmf_cfg80211_reg_notifier(
- 	s32 err;
- 	int i;
- 
-+	/* The country code gets set to "00" by default at boot, ignore */
-+	if (req->alpha2[0] == '0' && req->alpha2[1] == '0')
-+		return;
-+
- 	/* ignore non-ISO3166 country codes */
- 	for (i = 0; i < sizeof(req->alpha2); i++)
- 		if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
diff --git a/package/kernel/mac80211/patches/323-0005-brcmfmac-Handle-status-BRCMF_E_STATUS_ABORT-in-cfg80.patch b/package/kernel/mac80211/patches/323-0005-brcmfmac-Handle-status-BRCMF_E_STATUS_ABORT-in-cfg80.patch
deleted file mode 100644
index 0f2d54e1dd..0000000000
--- a/package/kernel/mac80211/patches/323-0005-brcmfmac-Handle-status-BRCMF_E_STATUS_ABORT-in-cfg80.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From b9472a2e3e452c414634b3ccb1ef6c4098878686 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Wed, 8 Mar 2017 14:50:17 +0100
-Subject: [PATCH] brcmfmac: Handle status == BRCMF_E_STATUS_ABORT in
- cfg80211_escan_handler
-
-If a scan gets aborted BRCMF_SCAN_STATUS_BUSY gets cleared in
-cfg->scan_status and when we receive an abort event from the firmware
-the BRCMF_SCAN_STATUS_BUSY check in the cfg80211_escan_handler will
-trigger resulting in multiple errors getting logged.
-
-Check for a status of BRCMF_E_STATUS_ABORT and in this case simply
-cleanly exit the cfg80211_escan_handler. This also avoids a
-BRCMF_E_STATUS_ABORT event arriving after a new scan has been started
-causing the new scan to complete prematurely without any data.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +++
- 1 file changed, 3 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -3097,6 +3097,9 @@ brcmf_cfg80211_escan_handler(struct brcm
- 
- 	status = e->status;
- 
-+	if (status == BRCMF_E_STATUS_ABORT)
-+		goto exit;
-+
- 	if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
- 		brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx);
- 		return -EPERM;
diff --git a/package/kernel/mac80211/patches/323-0006-brcmfmac-move-brcmf_txflowblock-to-bcdc-layer.patch b/package/kernel/mac80211/patches/323-0006-brcmfmac-move-brcmf_txflowblock-to-bcdc-layer.patch
deleted file mode 100644
index b947cd1de9..0000000000
--- a/package/kernel/mac80211/patches/323-0006-brcmfmac-move-brcmf_txflowblock-to-bcdc-layer.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From 20ec4f57498f8770c7a1a3e2a316fa752a424178 Mon Sep 17 00:00:00 2001
-From: Franky Lin <franky.lin@broadcom.com>
-Date: Fri, 10 Mar 2017 21:17:02 +0000
-Subject: [PATCH] brcmfmac: move brcmf_txflowblock to bcdc layer
-
-brcmf_txflowblock is invoked by sdio and usb bus module which are using
-bcdc protocol. This patch makes it a bcdc API instead of a core module
-function.
-
-Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Franky Lin <franky.lin@broadcom.com>
-Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 10 ++++++++++
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h |  1 +
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h  |  2 --
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 10 ----------
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |  5 +++--
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c  |  5 +++--
- 6 files changed, 17 insertions(+), 16 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-@@ -345,6 +345,16 @@ brcmf_proto_bcdc_txdata(struct brcmf_pub
- 	return brcmf_bus_txdata(drvr->bus_if, pktbuf);
- }
- 
-+void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state)
-+{
-+	struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-+	struct brcmf_pub *drvr = bus_if->drvr;
-+
-+	brcmf_dbg(TRACE, "Enter\n");
-+
-+	brcmf_fws_bus_blocked(drvr, state);
-+}
-+
- static void
- brcmf_proto_bcdc_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
- 				     enum proto_addr_mode addr_mode)
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
-@@ -19,6 +19,7 @@
- #ifdef CPTCFG_BRCMFMAC_PROTO_BCDC
- int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr);
- void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr);
-+void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state);
- #else
- static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; }
- static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {}
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-@@ -229,8 +229,6 @@ int brcmf_attach(struct device *dev, str
- void brcmf_detach(struct device *dev);
- /* Indication from bus module that dongle should be reset */
- void brcmf_dev_reset(struct device *dev);
--/* Indication from bus module to change flow-control state */
--void brcmf_txflowblock(struct device *dev, bool state);
- 
- /* Notify the bus has transferred the tx packet to firmware */
- void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -283,16 +283,6 @@ void brcmf_txflowblock_if(struct brcmf_i
- 	spin_unlock_irqrestore(&ifp->netif_stop_lock, flags);
- }
- 
--void brcmf_txflowblock(struct device *dev, bool state)
--{
--	struct brcmf_bus *bus_if = dev_get_drvdata(dev);
--	struct brcmf_pub *drvr = bus_if->drvr;
--
--	brcmf_dbg(TRACE, "Enter\n");
--
--	brcmf_fws_bus_blocked(drvr, state);
--}
--
- void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
- {
- 	if (skb->pkt_type == PACKET_MULTICAST)
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -44,6 +44,7 @@
- #include "firmware.h"
- #include "core.h"
- #include "common.h"
-+#include "bcdc.h"
- 
- #define DCMD_RESP_TIMEOUT	msecs_to_jiffies(2500)
- #define CTL_DONE_TIMEOUT	msecs_to_jiffies(2500)
-@@ -2328,7 +2329,7 @@ static uint brcmf_sdio_sendfromq(struct
- 	if ((bus->sdiodev->state == BRCMF_SDIOD_DATA) &&
- 	    bus->txoff && (pktq_len(&bus->txq) < TXLOW)) {
- 		bus->txoff = false;
--		brcmf_txflowblock(bus->sdiodev->dev, false);
-+		brcmf_proto_bcdc_txflowblock(bus->sdiodev->dev, false);
- 	}
- 
- 	return cnt;
-@@ -2753,7 +2754,7 @@ static int brcmf_sdio_bus_txdata(struct
- 
- 	if (pktq_len(&bus->txq) >= TXHI) {
- 		bus->txoff = true;
--		brcmf_txflowblock(dev, true);
-+		brcmf_proto_bcdc_txflowblock(dev, true);
- 	}
- 	spin_unlock_bh(&bus->txq_lock);
- 
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-@@ -29,6 +29,7 @@
- #include "usb.h"
- #include "core.h"
- #include "common.h"
-+#include "bcdc.h"
- 
- 
- #define IOCTL_RESP_TIMEOUT		msecs_to_jiffies(2000)
-@@ -488,7 +489,7 @@ static void brcmf_usb_tx_complete(struct
- 	spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags);
- 	if (devinfo->tx_freecount > devinfo->tx_high_watermark &&
- 		devinfo->tx_flowblock) {
--		brcmf_txflowblock(devinfo->dev, false);
-+		brcmf_proto_bcdc_txflowblock(devinfo->dev, false);
- 		devinfo->tx_flowblock = false;
- 	}
- 	spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags);
-@@ -635,7 +636,7 @@ static int brcmf_usb_tx(struct device *d
- 	spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags);
- 	if (devinfo->tx_freecount < devinfo->tx_low_watermark &&
- 	    !devinfo->tx_flowblock) {
--		brcmf_txflowblock(dev, true);
-+		brcmf_proto_bcdc_txflowblock(dev, true);
- 		devinfo->tx_flowblock = true;
- 	}
- 	spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags);
diff --git a/package/kernel/mac80211/patches/323-0007-brcmfmac-move-brcmf_txcomplete-to-bcdc-layer.patch b/package/kernel/mac80211/patches/323-0007-brcmfmac-move-brcmf_txcomplete-to-bcdc-layer.patch
deleted file mode 100644
index 9614e53e51..0000000000
--- a/package/kernel/mac80211/patches/323-0007-brcmfmac-move-brcmf_txcomplete-to-bcdc-layer.patch
+++ /dev/null
@@ -1,122 +0,0 @@
-From 7b584396b7a760bc77bbde4625f83ef173159d3e Mon Sep 17 00:00:00 2001
-From: Franky Lin <franky.lin@broadcom.com>
-Date: Fri, 10 Mar 2017 21:17:03 +0000
-Subject: [PATCH] brcmfmac: move brcmf_txcomplete to bcdc layer
-
-brcmf_txcomplete is invoked by sdio and usb bus module which are using
-bcdc protocol. So move it from core module into bcdc layer.
-
-Signed-off-by: Franky Lin <franky.lin@broadcom.com>
-Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c  | 20 ++++++++++++++++++++
- .../net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h  |  2 ++
- .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h   |  3 ---
- .../net/wireless/broadcom/brcm80211/brcmfmac/core.c  | 18 ------------------
- .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c  |  3 ++-
- .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c   |  2 +-
- 6 files changed, 25 insertions(+), 23 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-@@ -355,6 +355,26 @@ void brcmf_proto_bcdc_txflowblock(struct
- 	brcmf_fws_bus_blocked(drvr, state);
- }
- 
-+void
-+brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp,
-+			    bool success)
-+{
-+	struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-+	struct brcmf_pub *drvr = bus_if->drvr;
-+	struct brcmf_if *ifp;
-+
-+	/* await txstatus signal for firmware if active */
-+	if (brcmf_fws_fc_active(drvr->fws)) {
-+		if (!success)
-+			brcmf_fws_bustxfail(drvr->fws, txp);
-+	} else {
-+		if (brcmf_proto_bcdc_hdrpull(drvr, false, txp, &ifp))
-+			brcmu_pkt_buf_free_skb(txp);
-+		else
-+			brcmf_txfinalize(ifp, txp, success);
-+	}
-+}
-+
- static void
- brcmf_proto_bcdc_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
- 				     enum proto_addr_mode addr_mode)
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
-@@ -20,6 +20,8 @@
- int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr);
- void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr);
- void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state);
-+void brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp,
-+				 bool success);
- #else
- static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; }
- static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {}
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-@@ -230,9 +230,6 @@ void brcmf_detach(struct device *dev);
- /* Indication from bus module that dongle should be reset */
- void brcmf_dev_reset(struct device *dev);
- 
--/* Notify the bus has transferred the tx packet to firmware */
--void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
--
- /* Configure the "global" bus state used by upper layers */
- void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state);
- 
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -383,24 +383,6 @@ void brcmf_txfinalize(struct brcmf_if *i
- 	brcmu_pkt_buf_free_skb(txp);
- }
- 
--void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)
--{
--	struct brcmf_bus *bus_if = dev_get_drvdata(dev);
--	struct brcmf_pub *drvr = bus_if->drvr;
--	struct brcmf_if *ifp;
--
--	/* await txstatus signal for firmware if active */
--	if (brcmf_fws_fc_active(drvr->fws)) {
--		if (!success)
--			brcmf_fws_bustxfail(drvr->fws, txp);
--	} else {
--		if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
--			brcmu_pkt_buf_free_skb(txp);
--		else
--			brcmf_txfinalize(ifp, txp, success);
--	}
--}
--
- static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
- 				    struct ethtool_drvinfo *info)
- {
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -2266,7 +2266,8 @@ done:
- 		bus->tx_seq = (bus->tx_seq + pktq->qlen) % SDPCM_SEQ_WRAP;
- 	skb_queue_walk_safe(pktq, pkt_next, tmp) {
- 		__skb_unlink(pkt_next, pktq);
--		brcmf_txcomplete(bus->sdiodev->dev, pkt_next, ret == 0);
-+		brcmf_proto_bcdc_txcomplete(bus->sdiodev->dev, pkt_next,
-+					    ret == 0);
- 	}
- 	return ret;
- }
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-@@ -483,7 +483,7 @@ static void brcmf_usb_tx_complete(struct
- 		  req->skb);
- 	brcmf_usb_del_fromq(devinfo, req);
- 
--	brcmf_txcomplete(devinfo->dev, req->skb, urb->status == 0);
-+	brcmf_proto_bcdc_txcomplete(devinfo->dev, req->skb, urb->status == 0);
- 	req->skb = NULL;
- 	brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req, &devinfo->tx_freecount);
- 	spin_lock_irqsave(&devinfo->tx_flowblock_lock, flags);
diff --git a/package/kernel/mac80211/patches/323-0008-brcmfmac-wrap-brcmf_fws_add_interface-into-bcdc-laye.patch b/package/kernel/mac80211/patches/323-0008-brcmfmac-wrap-brcmf_fws_add_interface-into-bcdc-laye.patch
deleted file mode 100644
index a68c6ab0c3..0000000000
--- a/package/kernel/mac80211/patches/323-0008-brcmfmac-wrap-brcmf_fws_add_interface-into-bcdc-laye.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From 9fdc64bbdbe7bd546e0fbcedd2f1c03448c6df42 Mon Sep 17 00:00:00 2001
-From: Franky Lin <franky.lin@broadcom.com>
-Date: Fri, 10 Mar 2017 21:17:04 +0000
-Subject: [PATCH] brcmfmac: wrap brcmf_fws_add_interface into bcdc layer
-
-fwsignal is only used by bcdc. Create a new protocol interface function
-brcmf_proto_add_if for core module to notify protocol layer upon a new
-interface is created.
-
-Signed-off-by: Franky Lin <franky.lin@broadcom.com>
-Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c  | 7 +++++++
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c  | 2 +-
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c  | 3 ++-
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h | 9 +++++++++
- 4 files changed, 19 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-@@ -399,6 +399,12 @@ static void brcmf_proto_bcdc_rxreorder(s
- 	brcmf_fws_rxreorder(ifp, skb);
- }
- 
-+static void
-+brcmf_proto_bcdc_add_if(struct brcmf_if *ifp)
-+{
-+	brcmf_fws_add_interface(ifp);
-+}
-+
- int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
- {
- 	struct brcmf_bcdc *bcdc;
-@@ -422,6 +428,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
- 	drvr->proto->delete_peer = brcmf_proto_bcdc_delete_peer;
- 	drvr->proto->add_tdls_peer = brcmf_proto_bcdc_add_tdls_peer;
- 	drvr->proto->rxreorder = brcmf_proto_bcdc_rxreorder;
-+	drvr->proto->add_if = brcmf_proto_bcdc_add_if;
- 	drvr->proto->pd = bcdc;
- 
- 	drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES;
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -990,7 +990,7 @@ int brcmf_bus_started(struct device *dev
- 	if (ret < 0)
- 		goto fail;
- 
--	brcmf_fws_add_interface(ifp);
-+	brcmf_proto_add_if(drvr, ifp);
- 
- 	drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev,
- 					     drvr->settings->p2p_enable);
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
-@@ -25,6 +25,7 @@
- #include "fwsignal.h"
- #include "fweh.h"
- #include "fwil.h"
-+#include "proto.h"
- 
- /**
-  * struct brcmf_fweh_queue_item - event item on event queue.
-@@ -172,7 +173,7 @@ static void brcmf_fweh_handle_if_event(s
- 		if (IS_ERR(ifp))
- 			return;
- 		if (!is_p2pdev)
--			brcmf_fws_add_interface(ifp);
-+			brcmf_proto_add_if(drvr, ifp);
- 		if (!drvr->fweh.evt_handler[BRCMF_E_IF])
- 			if (brcmf_net_attach(ifp, false) < 0)
- 				return;
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
-@@ -44,6 +44,7 @@ struct brcmf_proto {
- 	void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx,
- 			      u8 peer[ETH_ALEN]);
- 	void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb);
-+	void (*add_if)(struct brcmf_if *ifp);
- 	void *pd;
- };
- 
-@@ -118,4 +119,12 @@ brcmf_proto_rxreorder(struct brcmf_if *i
- 	ifp->drvr->proto->rxreorder(ifp, skb);
- }
- 
-+static inline void
-+brcmf_proto_add_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
-+{
-+	if (!drvr->proto->add_if)
-+		return;
-+	drvr->proto->add_if(ifp);
-+}
-+
- #endif /* BRCMFMAC_PROTO_H */
diff --git a/package/kernel/mac80211/patches/323-0009-brcmfmac-wrap-brcmf_fws_del_interface-into-bcdc-laye.patch b/package/kernel/mac80211/patches/323-0009-brcmfmac-wrap-brcmf_fws_del_interface-into-bcdc-laye.patch
deleted file mode 100644
index ded8d7b944..0000000000
--- a/package/kernel/mac80211/patches/323-0009-brcmfmac-wrap-brcmf_fws_del_interface-into-bcdc-laye.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From c02a5eb82056f75615cb48aa540bfd245f489b99 Mon Sep 17 00:00:00 2001
-From: Franky Lin <franky.lin@broadcom.com>
-Date: Fri, 10 Mar 2017 21:17:05 +0000
-Subject: [PATCH] brcmfmac: wrap brcmf_fws_del_interface into bcdc layer
-
-Create a new protocol interface function brcmf_proto_del_if for core
-module to notify protocol layer upon interface deletion.
-
-Signed-off-by: Franky Lin <franky.lin@broadcom.com>
-Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c  | 7 +++++++
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c  | 4 ++--
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h | 9 +++++++++
- 3 files changed, 18 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-@@ -405,6 +405,12 @@ brcmf_proto_bcdc_add_if(struct brcmf_if
- 	brcmf_fws_add_interface(ifp);
- }
- 
-+static void
-+brcmf_proto_bcdc_del_if(struct brcmf_if *ifp)
-+{
-+	brcmf_fws_del_interface(ifp);
-+}
-+
- int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
- {
- 	struct brcmf_bcdc *bcdc;
-@@ -429,6 +435,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
- 	drvr->proto->add_tdls_peer = brcmf_proto_bcdc_add_tdls_peer;
- 	drvr->proto->rxreorder = brcmf_proto_bcdc_rxreorder;
- 	drvr->proto->add_if = brcmf_proto_bcdc_add_if;
-+	drvr->proto->del_if = brcmf_proto_bcdc_del_if;
- 	drvr->proto->pd = bcdc;
- 
- 	drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES;
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -706,7 +706,7 @@ void brcmf_remove_interface(struct brcmf
- 		return;
- 	brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
- 		  ifp->ifidx);
--	brcmf_fws_del_interface(ifp);
-+	brcmf_proto_del_if(ifp->drvr, ifp);
- 	brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
- }
- 
-@@ -1035,7 +1035,7 @@ fail:
- 		drvr->config = NULL;
- 	}
- 	if (drvr->fws) {
--		brcmf_fws_del_interface(ifp);
-+		brcmf_proto_del_if(ifp->drvr, ifp);
- 		brcmf_fws_deinit(drvr);
- 	}
- 	brcmf_net_detach(ifp->ndev, false);
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
-@@ -45,6 +45,7 @@ struct brcmf_proto {
- 			      u8 peer[ETH_ALEN]);
- 	void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb);
- 	void (*add_if)(struct brcmf_if *ifp);
-+	void (*del_if)(struct brcmf_if *ifp);
- 	void *pd;
- };
- 
-@@ -127,4 +128,12 @@ brcmf_proto_add_if(struct brcmf_pub *drv
- 	drvr->proto->add_if(ifp);
- }
- 
-+static inline void
-+brcmf_proto_del_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
-+{
-+	if (!drvr->proto->del_if)
-+		return;
-+	drvr->proto->del_if(ifp);
-+}
-+
- #endif /* BRCMFMAC_PROTO_H */
diff --git a/package/kernel/mac80211/patches/323-0010-brcmfmac-wrap-brcmf_fws_reset_interface-into-bcdc-la.patch b/package/kernel/mac80211/patches/323-0010-brcmfmac-wrap-brcmf_fws_reset_interface-into-bcdc-la.patch
deleted file mode 100644
index 34e71d8f5c..0000000000
--- a/package/kernel/mac80211/patches/323-0010-brcmfmac-wrap-brcmf_fws_reset_interface-into-bcdc-la.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From 66ded1f8b33cdd9d6d3e20f5f8dd23615a110e70 Mon Sep 17 00:00:00 2001
-From: Franky Lin <franky.lin@broadcom.com>
-Date: Fri, 10 Mar 2017 21:17:06 +0000
-Subject: [PATCH] brcmfmac: wrap brcmf_fws_reset_interface into bcdc layer
-
-Create a new protocol interface function brcmf_proto_reset_if for core
-module to notify protocol layer when interface role changes.
-
-Signed-off-by: Franky Lin <franky.lin@broadcom.com>
-Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c  | 7 +++++++
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c  | 3 +--
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h | 9 +++++++++
- 3 files changed, 17 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-@@ -411,6 +411,12 @@ brcmf_proto_bcdc_del_if(struct brcmf_if
- 	brcmf_fws_del_interface(ifp);
- }
- 
-+static void
-+brcmf_proto_bcdc_reset_if(struct brcmf_if *ifp)
-+{
-+	brcmf_fws_reset_interface(ifp);
-+}
-+
- int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
- {
- 	struct brcmf_bcdc *bcdc;
-@@ -436,6 +442,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
- 	drvr->proto->rxreorder = brcmf_proto_bcdc_rxreorder;
- 	drvr->proto->add_if = brcmf_proto_bcdc_add_if;
- 	drvr->proto->del_if = brcmf_proto_bcdc_del_if;
-+	drvr->proto->reset_if = brcmf_proto_bcdc_reset_if;
- 	drvr->proto->pd = bcdc;
- 
- 	drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES;
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
-@@ -22,7 +22,6 @@
- #include "core.h"
- #include "debug.h"
- #include "tracepoint.h"
--#include "fwsignal.h"
- #include "fweh.h"
- #include "fwil.h"
- #include "proto.h"
-@@ -180,7 +179,7 @@ static void brcmf_fweh_handle_if_event(s
- 	}
- 
- 	if (ifp && ifevent->action == BRCMF_E_IF_CHANGE)
--		brcmf_fws_reset_interface(ifp);
-+		brcmf_proto_reset_if(drvr, ifp);
- 
- 	err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
- 
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
-@@ -46,6 +46,7 @@ struct brcmf_proto {
- 	void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb);
- 	void (*add_if)(struct brcmf_if *ifp);
- 	void (*del_if)(struct brcmf_if *ifp);
-+	void (*reset_if)(struct brcmf_if *ifp);
- 	void *pd;
- };
- 
-@@ -136,4 +137,12 @@ brcmf_proto_del_if(struct brcmf_pub *drv
- 	drvr->proto->del_if(ifp);
- }
- 
-+static inline void
-+brcmf_proto_reset_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
-+{
-+	if (!drvr->proto->reset_if)
-+		return;
-+	drvr->proto->reset_if(ifp);
-+}
-+
- #endif /* BRCMFMAC_PROTO_H */
diff --git a/package/kernel/mac80211/patches/325-mac80211-unconditionally-start-new-netdev-queues-wit.patch b/package/kernel/mac80211/patches/325-mac80211-unconditionally-start-new-netdev-queues-wit.patch
deleted file mode 100644
index ff7bbcb645..0000000000
--- a/package/kernel/mac80211/patches/325-mac80211-unconditionally-start-new-netdev-queues-wit.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From: Johannes Berg <johannes.berg@intel.com>
-Date: Wed, 29 Mar 2017 14:15:24 +0200
-Subject: [PATCH] mac80211: unconditionally start new netdev queues with iTXQ
- support
-
-When internal mac80211 TXQs aren't supported, netdev queues must
-always started out started even when driver queues are stopped
-while the interface is added. This is necessary because with the
-internal TXQ support netdev queues are never stopped and packet
-scheduling/dropping is done in mac80211.
-
-Cc: stable@vger.kernel.org # 4.9+
-Fixes: 80a83cfc434b1 ("mac80211: skip netdev queue control with software queuing")
-Reported-and-tested-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -727,7 +727,8 @@ int ieee80211_do_open(struct wireless_de
- 	ieee80211_recalc_ps(local);
- 
- 	if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
--	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
-+	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
-+	    local->ops->wake_tx_queue) {
- 		/* XXX: for AP_VLAN, actually track AP queues */
- 		netif_tx_start_all_queues(dev);
- 	} else if (dev) {
diff --git a/package/kernel/mac80211/patches/326-ath9k-fix-ar934x-OTP-offsets.patch b/package/kernel/mac80211/patches/326-ath9k-fix-ar934x-OTP-offsets.patch
deleted file mode 100644
index 60de2b6d14..0000000000
--- a/package/kernel/mac80211/patches/326-ath9k-fix-ar934x-OTP-offsets.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From: Christian Lamparter <chunkeey@googlemail.com>
-Date: Tue, 14 Feb 2017 20:10:30 +0100
-Subject: ath9k: use correct OTP register offsets for the AR9340 and AR9550
-
-This patch fixes the OTP register definitions for the AR934x and AR9550
-WMAC SoC.
-
-Previously, the ath9k driver was unable to initialize the integrated
-WMAC on an Aerohive AP121:
-
-| ath: phy0: timeout (1000 us) on reg 0x30018: 0xbadc0ffe & 0x00000007 != 0x00000004
-| ath: phy0: timeout (1000 us) on reg 0x30018: 0xbadc0ffe & 0x00000007 != 0x00000004
-| ath: phy0: Unable to initialize hardware; initialization status: -5
-| ath9k ar934x_wmac: failed to initialize device
-| ath9k: probe of ar934x_wmac failed with error -5
-
-It turns out that the AR9300_OTP_STATUS and AR9300_OTP_DATA
-definitions contain a typo.
-
-Fixes: add295a4afbdf5852d0 "ath9k: use correct OTP register offsets for AR9550"
-Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
-Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
----
-
---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
-@@ -75,13 +75,13 @@
- #define AR9300_OTP_BASE \
- 		((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30000 : 0x14000)
- #define AR9300_OTP_STATUS \
--		((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30018 : 0x15f18)
-+		((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x31018 : 0x15f18)
- #define AR9300_OTP_STATUS_TYPE		0x7
- #define AR9300_OTP_STATUS_VALID		0x4
- #define AR9300_OTP_STATUS_ACCESS_BUSY	0x2
- #define AR9300_OTP_STATUS_SM_BUSY	0x1
- #define AR9300_OTP_READ_DATA \
--		((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x3001c : 0x15f1c)
-+		((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x3101c : 0x15f1c)
- 
- enum targetPowerHTRates {
- 	HT_TARGET_RATE_0_8_16,
diff --git a/package/kernel/mac80211/patches/327-ath10k-increase-BMI-timeout.patch b/package/kernel/mac80211/patches/327-ath10k-increase-BMI-timeout.patch
deleted file mode 100644
index c9f493bcd8..0000000000
--- a/package/kernel/mac80211/patches/327-ath10k-increase-BMI-timeout.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From: Ben Greear <greearb@candelatech.com>
-Date: Wed, 31 May 2017 14:21:19 +0300
-Subject: [PATCH] ath10k: increase BMI timeout
-
-When testing a 9888 chipset NIC, I notice it often takes
-almost 2 seconds, and then many times OTP fails, probably due
-to the two-second timeout.
-
-[ 2269.841842] ath10k_pci 0000:05:00.0: bmi cmd took: 1984 jiffies (HZ: 1000), rv: 0
-[ 2273.608185] ath10k_pci 0000:05:00.0: bmi cmd took: 1986 jiffies (HZ: 1000), rv: 0
-[ 2277.294732] ath10k_pci 0000:05:00.0: bmi cmd took: 1989 jiffies (HZ: 1000), rv: 0
-
-So, increase the BMI timeout to 3 seconds.
-
-Signed-off-by: Ben Greear <greearb@candelatech.com>
-Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
----
-
---- a/drivers/net/wireless/ath/ath10k/bmi.h
-+++ b/drivers/net/wireless/ath/ath10k/bmi.h
-@@ -187,8 +187,8 @@ struct bmi_target_info {
- 	u32 type;
- };
- 
--/* in msec */
--#define BMI_COMMUNICATION_TIMEOUT_HZ (2 * HZ)
-+/* in jiffies */
-+#define BMI_COMMUNICATION_TIMEOUT_HZ (3 * HZ)
- 
- #define BMI_CE_NUM_TO_TARG 0
- #define BMI_CE_NUM_TO_HOST 1
diff --git a/package/kernel/mac80211/patches/328-ath10k-log-when-longer-bmi-cmds-happen.patch b/package/kernel/mac80211/patches/328-ath10k-log-when-longer-bmi-cmds-happen.patch
deleted file mode 100644
index 500f72ff98..0000000000
--- a/package/kernel/mac80211/patches/328-ath10k-log-when-longer-bmi-cmds-happen.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From: Ben Greear <greearb@candelatech.com>
-Date: Wed, 31 May 2017 14:21:21 +0300
-Subject: [PATCH] ath10k: log when longer bmi cmds happen
-
-This lets one have a clue that maybe timeouts are happening
-when we just aren't waiting long enough.
-
-Signed-off-by: Ben Greear <greearb@candelatech.com>
-Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
----
-
---- a/drivers/net/wireless/ath/ath10k/pci.c
-+++ b/drivers/net/wireless/ath/ath10k/pci.c
-@@ -101,7 +101,8 @@ static int ath10k_pci_init_irq(struct at
- static int ath10k_pci_deinit_irq(struct ath10k *ar);
- static int ath10k_pci_request_irq(struct ath10k *ar);
- static void ath10k_pci_free_irq(struct ath10k *ar);
--static int ath10k_pci_bmi_wait(struct ath10k_ce_pipe *tx_pipe,
-+static int ath10k_pci_bmi_wait(struct ath10k *ar,
-+			       struct ath10k_ce_pipe *tx_pipe,
- 			       struct ath10k_ce_pipe *rx_pipe,
- 			       struct bmi_xfer *xfer);
- static int ath10k_pci_qca99x0_chip_reset(struct ath10k *ar);
-@@ -1843,7 +1844,7 @@ int ath10k_pci_hif_exchange_bmi_msg(stru
- 	if (ret)
- 		goto err_resp;
- 
--	ret = ath10k_pci_bmi_wait(ce_tx, ce_rx, &xfer);
-+	ret = ath10k_pci_bmi_wait(ar, ce_tx, ce_rx, &xfer);
- 	if (ret) {
- 		u32 unused_buffer;
- 		unsigned int unused_nbytes;
-@@ -1910,23 +1911,37 @@ static void ath10k_pci_bmi_recv_data(str
- 	xfer->rx_done = true;
- }
- 
--static int ath10k_pci_bmi_wait(struct ath10k_ce_pipe *tx_pipe,
-+static int ath10k_pci_bmi_wait(struct ath10k *ar,
-+			       struct ath10k_ce_pipe *tx_pipe,
- 			       struct ath10k_ce_pipe *rx_pipe,
- 			       struct bmi_xfer *xfer)
- {
- 	unsigned long timeout = jiffies + BMI_COMMUNICATION_TIMEOUT_HZ;
-+	unsigned long started = jiffies;
-+	unsigned long dur;
-+	int ret;
- 
- 	while (time_before_eq(jiffies, timeout)) {
- 		ath10k_pci_bmi_send_done(tx_pipe);
- 		ath10k_pci_bmi_recv_data(rx_pipe);
- 
--		if (xfer->tx_done && (xfer->rx_done == xfer->wait_for_resp))
--			return 0;
-+		if (xfer->tx_done && (xfer->rx_done == xfer->wait_for_resp)) {
-+			ret = 0;
-+			goto out;
-+		}
- 
- 		schedule();
- 	}
- 
--	return -ETIMEDOUT;
-+	ret = -ETIMEDOUT;
-+
-+out:
-+	dur = jiffies - started;
-+	if (dur > HZ)
-+		ath10k_dbg(ar, ATH10K_DBG_BMI,
-+			   "bmi cmd took %lu jiffies hz %d ret %d\n",
-+			   dur, HZ, ret);
-+	return ret;
- }
- 
- /*
diff --git a/package/kernel/mac80211/patches/329-ath10k-add-BMI-parameters-to-fix-calibration-from-DT.patch b/package/kernel/mac80211/patches/329-ath10k-add-BMI-parameters-to-fix-calibration-from-DT.patch
deleted file mode 100644
index 3fcf505e15..0000000000
--- a/package/kernel/mac80211/patches/329-ath10k-add-BMI-parameters-to-fix-calibration-from-DT.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From: Anilkumar Kolli <akolli@qti.qualcomm.com>
-Date: Wed, 31 May 2017 14:21:27 +0300
-Subject: [PATCH] ath10k: add BMI parameters to fix calibration from
- DT/pre-cal
-
-QCA99X0, QCA9888, QCA9984 supports calibration data in
-either OTP or DT/pre-cal file. Current ath10k supports
-Calibration data from OTP only.
-
-If caldata is loaded from DT/pre-cal file, fetching board id
-and applying calibration parameters like tx power gets failed.
-
-error log:
-[   15.733663] ath10k_pci 0000:01:00.0: failed to fetch board file: -2
-[   15.741474] ath10k_pci 0000:01:00.0: could not probe fw (-2)
-
-This patch adds calibration data support from DT/pre-cal
-file.  Below parameters are used to get board id and
-applying calibration parameters from cal data.
-
-		EEPROM[OTP]	FLASH[DT/pre-cal file]
-Cal param	0x700		0x10000
-Board id	0x10		0x8000
-
-Tested on QCA9888 with pre-cal file.
-
-Signed-off-by: Anilkumar Kolli <akolli@qti.qualcomm.com>
-Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
----
-
---- a/drivers/net/wireless/ath/ath10k/bmi.h
-+++ b/drivers/net/wireless/ath/ath10k/bmi.h
-@@ -83,6 +83,8 @@ enum bmi_cmd_id {
- #define BMI_NVRAM_SEG_NAME_SZ 16
- 
- #define BMI_PARAM_GET_EEPROM_BOARD_ID 0x10
-+#define BMI_PARAM_GET_FLASH_BOARD_ID 0x8000
-+#define BMI_PARAM_FLASH_SECTION_ALL 0x10000
- 
- #define ATH10K_BMI_BOARD_ID_FROM_OTP_MASK   0x7c00
- #define ATH10K_BMI_BOARD_ID_FROM_OTP_LSB    10
---- a/drivers/net/wireless/ath/ath10k/core.c
-+++ b/drivers/net/wireless/ath/ath10k/core.c
-@@ -657,7 +657,7 @@ static int ath10k_core_get_board_id_from
- {
- 	u32 result, address;
- 	u8 board_id, chip_id;
--	int ret;
-+	int ret, bmi_board_id_param;
- 
- 	address = ar->hw_params.patch_load_addr;
- 
-@@ -681,8 +681,13 @@ static int ath10k_core_get_board_id_from
- 		return ret;
- 	}
- 
--	ret = ath10k_bmi_execute(ar, address, BMI_PARAM_GET_EEPROM_BOARD_ID,
--				 &result);
-+	if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT ||
-+	    ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE)
-+		bmi_board_id_param = BMI_PARAM_GET_FLASH_BOARD_ID;
-+	else
-+		bmi_board_id_param = BMI_PARAM_GET_EEPROM_BOARD_ID;
-+
-+	ret = ath10k_bmi_execute(ar, address, bmi_board_id_param, &result);
- 	if (ret) {
- 		ath10k_err(ar, "could not execute otp for board id check: %d\n",
- 			   ret);
-@@ -810,6 +815,11 @@ static int ath10k_download_and_run_otp(s
- 		return ret;
- 	}
- 
-+	/* As of now pre-cal is valid for 10_4 variants */
-+	if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT ||
-+	    ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE)
-+		bmi_otp_exe_param = BMI_PARAM_FLASH_SECTION_ALL;
-+
- 	ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, &result);
- 	if (ret) {
- 		ath10k_err(ar, "could not execute otp (%d)\n", ret);
diff --git a/package/kernel/mac80211/patches/332-ath10k-Revert-disable-wake_tx_queue-for-older-devices.patch b/package/kernel/mac80211/patches/332-ath10k-Revert-disable-wake_tx_queue-for-older-devices.patch
index b4e7862264..f1bd131f3e 100644
--- a/package/kernel/mac80211/patches/332-ath10k-Revert-disable-wake_tx_queue-for-older-devices.patch
+++ b/package/kernel/mac80211/patches/332-ath10k-Revert-disable-wake_tx_queue-for-older-devices.patch
@@ -9,7 +9,7 @@ in the hope that we've fixed all the performance problems now.
 
 --- a/drivers/net/wireless/ath/ath10k/mac.c
 +++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -8219,15 +8219,6 @@ int ath10k_mac_register(struct ath10k *a
+@@ -8286,15 +8286,6 @@ int ath10k_mac_register(struct ath10k *a
  			ath10k_warn(ar, "failed to initialise DFS pattern detector\n");
  	}
  
diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
index c8ede7f583..fae9b55529 100644
--- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
+++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
@@ -27,7 +27,7 @@
  	if (!IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_REG_HINTS))
  		return false;
  	if (!dynamic_country_user_possible(reg))
-@@ -341,6 +347,9 @@ ath_reg_apply_beaconing_flags(struct wip
+@@ -345,6 +351,9 @@ ath_reg_apply_beaconing_flags(struct wip
  	struct ieee80211_channel *ch;
  	unsigned int i;
  
@@ -37,7 +37,7 @@
  	for (band = 0; band < NUM_NL80211_BANDS; band++) {
  		if (!wiphy->bands[band])
  			continue;
-@@ -374,6 +383,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
+@@ -378,6 +387,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  {
  	struct ieee80211_supported_band *sband;
  
@@ -47,7 +47,7 @@
  	sband = wiphy->bands[NL80211_BAND_2GHZ];
  	if (!sband)
  		return;
-@@ -402,6 +414,9 @@ static void ath_reg_apply_radar_flags(st
+@@ -407,6 +419,9 @@ static void ath_reg_apply_radar_flags(st
  	struct ieee80211_channel *ch;
  	unsigned int i;
  
@@ -57,7 +57,7 @@
  	if (!wiphy->bands[NL80211_BAND_5GHZ])
  		return;
  
-@@ -539,6 +554,11 @@ void ath_reg_notifier_apply(struct wiphy
+@@ -544,6 +559,11 @@ void ath_reg_notifier_apply(struct wiphy
  		ath_reg_dyn_country(wiphy, reg, request);
  		break;
  	}
@@ -69,7 +69,7 @@
  }
  EXPORT_SYMBOL(ath_reg_notifier_apply);
  
-@@ -634,6 +654,10 @@ ath_regd_init_wiphy(struct ath_regulator
+@@ -639,6 +659,10 @@ ath_regd_init_wiphy(struct ath_regulator
  	const struct ieee80211_regdomain *regd;
  
  	wiphy->reg_notifier = reg_notifier;
@@ -80,7 +80,7 @@
  	wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
  				   REGULATORY_CUSTOM_REG;
  
-@@ -762,10 +786,7 @@ ath_regd_init(struct ath_regulatory *reg
+@@ -767,10 +791,7 @@ ath_regd_init(struct ath_regulatory *reg
  	if (r)
  		return r;
  
@@ -104,9 +104,9 @@
  config ATH_DEBUG
  	bool "Atheros wireless debugging"
  	---help---
---- a/.local-symbols
-+++ b/.local-symbols
-@@ -130,6 +130,7 @@ ADM8211=
+--- a/local-symbols
++++ b/local-symbols
+@@ -82,6 +82,7 @@ ADM8211=
  ATH_COMMON=
  WLAN_VENDOR_ATH=
  ATH_DEBUG=
diff --git a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
index 469da90160..457c0cb28c 100644
--- a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
+++ b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
@@ -1,6 +1,6 @@
 --- a/net/wireless/reg.c
 +++ b/net/wireless/reg.c
-@@ -2398,6 +2398,8 @@ void regulatory_hint_country_ie(struct w
+@@ -2497,6 +2497,8 @@ void regulatory_hint_country_ie(struct w
  	enum environment_cap env = ENVIRON_ANY;
  	struct regulatory_request *request = NULL, *lr;
  
@@ -9,7 +9,7 @@
  	/* IE len must be evenly divisible by 2 */
  	if (country_ie_len & 0x01)
  		return;
-@@ -2604,6 +2606,7 @@ static void restore_regulatory_settings(
+@@ -2703,6 +2705,7 @@ static void restore_regulatory_settings(
  
  void regulatory_hint_disconnect(void)
  {
diff --git a/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch b/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch
index 35b0f2b76e..44e8f3281c 100644
--- a/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch
+++ b/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch
@@ -39,7 +39,7 @@
  bool ath_is_world_regd(struct ath_regulatory *reg)
  {
  	return is_wwr_sku(ath_regd_get_eepromRD(reg));
-@@ -658,6 +666,9 @@ ath_regd_init_wiphy(struct ath_regulator
+@@ -663,6 +671,9 @@ ath_regd_init_wiphy(struct ath_regulator
  	if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
  		return 0;
  
diff --git a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
index 1d249a9723..3ae01a5c35 100644
--- a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
+++ b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
@@ -109,7 +109,7 @@ drivers/net/wireless/ath/ath5k/debug.c |   86 ++++++++++++++++++++++++++++++++
  
  /* debugfs: queues etc */
  
-@@ -1009,6 +1100,9 @@ ath5k_debug_init_device(struct ath5k_hw
+@@ -1012,6 +1103,9 @@ ath5k_debug_init_device(struct ath5k_hw
  	debugfs_create_file("beacon", S_IWUSR | S_IRUSR, phydir, ah,
  			    &fops_beacon);
  
diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
index f21eed18c3..b6dc45cd96 100644
--- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
+++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -1315,6 +1315,53 @@ void ath9k_deinit_debug(struct ath_softc
+@@ -1374,6 +1374,53 @@ void ath9k_deinit_debug(struct ath_softc
  	ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
  }
  
@@ -54,7 +54,7 @@
  int ath9k_init_debug(struct ath_hw *ah)
  {
  	struct ath_common *common = ath9k_hw_common(ah);
-@@ -1334,6 +1381,8 @@ int ath9k_init_debug(struct ath_hw *ah)
+@@ -1393,6 +1440,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  	ath9k_tx99_init_debug(sc);
  	ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
  
diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
index d076e3c2eb..53225dbc36 100644
--- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
+++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -1086,23 +1086,23 @@ static int __init ath9k_init(void)
+@@ -1088,23 +1088,23 @@ static int __init ath9k_init(void)
  {
  	int error;
  
diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
index c98072bac9..2ebb73d689 100644
--- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
+++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -1362,6 +1362,52 @@ static const struct file_operations fops
+@@ -1421,6 +1421,52 @@ static const struct file_operations fops
  	.owner = THIS_MODULE
  };
  
@@ -53,7 +53,7 @@
  int ath9k_init_debug(struct ath_hw *ah)
  {
  	struct ath_common *common = ath9k_hw_common(ah);
-@@ -1383,6 +1429,8 @@ int ath9k_init_debug(struct ath_hw *ah)
+@@ -1442,6 +1488,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  
  	debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  			    &fops_eeprom);
@@ -74,7 +74,7 @@
  
 --- a/drivers/net/wireless/ath/ath9k/common.c
 +++ b/drivers/net/wireless/ath/ath9k/common.c
-@@ -296,11 +296,13 @@ EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_ke
+@@ -297,11 +297,13 @@ EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_ke
  /*
   * Update internal channel flags.
   */
@@ -89,7 +89,7 @@
  
  	ichan->channel = chan->center_freq;
  	ichan->chan = chan;
-@@ -308,7 +310,19 @@ static void ath9k_cmn_update_ichannel(st
+@@ -309,7 +311,19 @@ static void ath9k_cmn_update_ichannel(st
  	if (chan->band == NL80211_BAND_5GHZ)
  		flags |= CHANNEL_5GHZ;
  
@@ -110,7 +110,7 @@
  	case NL80211_CHAN_WIDTH_5:
  		flags |= CHANNEL_QUARTER;
  		break;
-@@ -341,10 +355,11 @@ struct ath9k_channel *ath9k_cmn_get_chan
+@@ -342,10 +356,11 @@ struct ath9k_channel *ath9k_cmn_get_chan
  					    struct cfg80211_chan_def *chandef)
  {
  	struct ieee80211_channel *curchan = chandef->chan;
diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
index 59daf4fe11..fdeaed05e8 100644
--- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
+++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
@@ -20,7 +20,7 @@
  #define AR9160_DEVID_PCI	0x0027
 --- a/drivers/net/wireless/ath/ath9k/pci.c
 +++ b/drivers/net/wireless/ath/ath9k/pci.c
-@@ -763,6 +763,7 @@ static const struct pci_device_id ath_pc
+@@ -773,6 +773,7 @@ static const struct pci_device_id ath_pc
  	  .driver_data = ATH9K_PCI_BT_ANT_DIV },
  #endif
  
diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
index 9a0f6f5dbd..01de325b92 100644
--- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
+++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
@@ -1,6 +1,6 @@
 --- a/include/net/cfg80211.h
 +++ b/include/net/cfg80211.h
-@@ -2660,6 +2660,7 @@ struct cfg80211_nan_func {
+@@ -2750,6 +2750,7 @@ struct cfg80211_pmk_conf {
   *	(as advertised by the nl80211 feature flag.)
   * @get_tx_power: store the current TX power into the dbm variable;
   *	return 0 if successful
@@ -8,7 +8,7 @@
   *
   * @set_wds_peer: set the WDS peer for a WDS interface
   *
-@@ -2940,6 +2941,7 @@ struct cfg80211_ops {
+@@ -3041,6 +3042,7 @@ struct cfg80211_ops {
  				enum nl80211_tx_power_setting type, int mbm);
  	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  				int *dbm);
@@ -18,7 +18,7 @@
  				const u8 *addr);
 --- a/include/net/mac80211.h
 +++ b/include/net/mac80211.h
-@@ -1325,6 +1325,7 @@ enum ieee80211_smps_mode {
+@@ -1338,6 +1338,7 @@ enum ieee80211_smps_mode {
   *
   * @power_level: requested transmit power (in dBm), backward compatibility
   *	value only that is set to the minimum of all interfaces
@@ -26,7 +26,7 @@
   *
   * @chandef: the channel definition to tune to
   * @radar_enabled: whether radar detection is enabled
-@@ -1345,6 +1346,7 @@ enum ieee80211_smps_mode {
+@@ -1358,6 +1359,7 @@ enum ieee80211_smps_mode {
  struct ieee80211_conf {
  	u32 flags;
  	int power_level, dynamic_ps_timeout;
@@ -36,9 +36,9 @@
  	u8 ps_dtim_period;
 --- a/include/uapi/linux/nl80211.h
 +++ b/include/uapi/linux/nl80211.h
-@@ -2002,6 +2002,9 @@ enum nl80211_commands {
-  *	u32 attribute with an &enum nl80211_timeout_reason value. This is used,
-  *	e.g., with %NL80211_CMD_CONNECT event.
+@@ -2139,6 +2139,9 @@ enum nl80211_commands {
+  *	the driver or is not needed (because roaming used the Fast Transition
+  *	protocol).
   *
 + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
 + *	transmit power to stay within regulatory limits. u32, dBi.
@@ -46,9 +46,9 @@
   * @NUM_NL80211_ATTR: total number of nl80211_attrs available
   * @NL80211_ATTR_MAX: highest attribute number currently defined
   * @__NL80211_ATTR_AFTER_LAST: internal use
-@@ -2413,6 +2416,8 @@ enum nl80211_attrs {
- 
- 	NL80211_ATTR_TIMEOUT_REASON,
+@@ -2565,6 +2568,8 @@ enum nl80211_attrs {
+ 	NL80211_ATTR_PMKR0_NAME,
+ 	NL80211_ATTR_PORT_AUTHORIZED,
  
 +	NL80211_ATTR_WIPHY_ANTENNA_GAIN,
 +
@@ -57,7 +57,7 @@
  	__NL80211_ATTR_AFTER_LAST,
 --- a/net/mac80211/cfg.c
 +++ b/net/mac80211/cfg.c
-@@ -2396,6 +2396,19 @@ static int ieee80211_get_tx_power(struct
+@@ -2444,6 +2444,19 @@ static int ieee80211_get_tx_power(struct
  	return 0;
  }
  
@@ -77,7 +77,7 @@
  static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  				  const u8 *addr)
  {
-@@ -3627,6 +3640,7 @@ const struct cfg80211_ops mac80211_confi
+@@ -3717,6 +3730,7 @@ const struct cfg80211_ops mac80211_confi
  	.set_wiphy_params = ieee80211_set_wiphy_params,
  	.set_tx_power = ieee80211_set_tx_power,
  	.get_tx_power = ieee80211_get_tx_power,
@@ -87,7 +87,7 @@
  	CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
 --- a/net/mac80211/ieee80211_i.h
 +++ b/net/mac80211/ieee80211_i.h
-@@ -1370,6 +1370,7 @@ struct ieee80211_local {
+@@ -1347,6 +1347,7 @@ struct ieee80211_local {
  	int dynamic_ps_forced_timeout;
  
  	int user_power_level; /* in dBm, for all interfaces */
@@ -119,7 +119,7 @@
  	if (local->hw.conf.power_level != power) {
  		changed |= IEEE80211_CONF_CHANGE_POWER;
  		local->hw.conf.power_level = power;
-@@ -589,6 +595,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
+@@ -592,6 +598,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  					 IEEE80211_RADIOTAP_MCS_HAVE_BW;
  	local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  					 IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
@@ -129,15 +129,15 @@
  	local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
 --- a/net/wireless/nl80211.c
 +++ b/net/wireless/nl80211.c
-@@ -424,6 +424,7 @@ static const struct nla_policy nl80211_p
- 		.len = sizeof(struct nl80211_bss_select_rssi_adjust)
- 	},
- 	[NL80211_ATTR_TIMEOUT_REASON] = { .type = NLA_U32 },
+@@ -420,6 +420,7 @@ static const struct nla_policy nl80211_p
+ 	[NL80211_ATTR_FILS_CACHE_ID] = { .len = 2 },
+ 	[NL80211_ATTR_PMK] = { .type = NLA_BINARY, .len = PMK_MAX_LEN },
+ 	[NL80211_ATTR_SCHED_SCAN_MULTI] = { .type = NLA_FLAG },
 +	[NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
  };
  
  /* policy for the key attributes */
-@@ -2385,6 +2386,20 @@ static int nl80211_set_wiphy(struct sk_b
+@@ -2378,6 +2379,20 @@ static int nl80211_set_wiphy(struct sk_b
  		if (result)
  			return result;
  	}
diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
index b3b51b4433..8ea2f79a20 100644
--- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
+++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
@@ -181,7 +181,7 @@
  
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -998,7 +998,7 @@ int ath9k_init_device(u16 devid, struct
+@@ -1000,7 +1000,7 @@ int ath9k_init_device(u16 devid, struct
  
  #ifdef CPTCFG_MAC80211_LEDS
  	/* must be initialized before ieee80211_register_hw */
@@ -192,7 +192,7 @@
  #endif
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -1407,6 +1407,61 @@ static const struct file_operations fops
+@@ -1466,6 +1466,61 @@ static const struct file_operations fops
  	.llseek = default_llseek,
  };
  
@@ -254,7 +254,7 @@
  
  int ath9k_init_debug(struct ath_hw *ah)
  {
-@@ -1431,6 +1486,10 @@ int ath9k_init_debug(struct ath_hw *ah)
+@@ -1490,6 +1545,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);
diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
index 3e687792da..7cf589485e 100644
--- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
+++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -1463,6 +1463,50 @@ static const struct file_operations fops
+@@ -1522,6 +1522,50 @@ static const struct file_operations fops
  #endif
  
  
@@ -51,7 +51,7 @@
  int ath9k_init_debug(struct ath_hw *ah)
  {
  	struct ath_common *common = ath9k_hw_common(ah);
-@@ -1490,6 +1534,8 @@ int ath9k_init_debug(struct ath_hw *ah)
+@@ -1549,6 +1593,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
@@ -75,16 +75,16 @@
  struct ath9k_hw_version {
  	u32 magic;
  	u16 devid;
-@@ -805,6 +811,8 @@ struct ath_hw {
- 	u32 rfkill_polarity;
+@@ -806,6 +812,8 @@ struct ath_hw {
  	u32 ah_flags;
+ 	s16 nf_override;
  
 +	unsigned long diag;
 +
  	bool reset_power_on;
  	bool htc_reset_init;
  
-@@ -1067,6 +1075,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
+@@ -1068,6 +1076,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);
diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
index 6f7370203b..f9d3251c22 100644
--- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
+++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
@@ -18,7 +18,7 @@
  	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
-@@ -1947,6 +1947,26 @@ void ar9003_hw_init_rate_txpower(struct
+@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct
  	}
  }
  
@@ -45,7 +45,7 @@
  void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  {
  	struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
-@@ -1983,6 +2003,7 @@ void ar9003_hw_attach_phy_ops(struct ath
+@@ -1981,6 +2001,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;
  
@@ -65,8 +65,8 @@
  }
  
  static const struct ieee80211_iface_limit if_limits[] = {
-@@ -958,6 +959,18 @@ static void ath9k_set_hw_capab(struct at
- 	SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
+@@ -960,6 +961,18 @@ static void ath9k_set_hw_capab(struct at
+ 	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
  }
  
 +static void ath_get_initial_entropy(struct ath_softc *sc)
@@ -84,7 +84,7 @@
  int ath9k_init_device(u16 devid, struct ath_softc *sc,
  		    const struct ath_bus_ops *bus_ops)
  {
-@@ -1003,6 +1016,8 @@ int ath9k_init_device(u16 devid, struct
+@@ -1005,6 +1018,8 @@ int ath9k_init_device(u16 devid, struct
  		ARRAY_SIZE(ath9k_tpt_blink));
  #endif
  
diff --git a/package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch
index bcb0026a69..6d541d6a57 100644
--- a/package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch
+++ b/package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch
@@ -384,9 +384,9 @@
  };
  
  #endif /* _LINUX_ATH9K_PLATFORM_H */
---- a/.local-symbols
-+++ b/.local-symbols
-@@ -157,6 +157,7 @@ ATH9K_WOW=
+--- a/local-symbols
++++ b/local-symbols
+@@ -109,6 +109,7 @@ ATH9K_WOW=
  ATH9K_RFKILL=
  ATH9K_CHANNEL_CONTEXT=
  ATH9K_PCOEM=
diff --git a/package/kernel/mac80211/patches/600-02-rt2x00-rt2800lib-enable-support-for-RT3883.patch b/package/kernel/mac80211/patches/600-02-rt2x00-rt2800lib-enable-support-for-RT3883.patch
index dc0f19490e..5127c5cfe4 100644
--- a/package/kernel/mac80211/patches/600-02-rt2x00-rt2800lib-enable-support-for-RT3883.patch
+++ b/package/kernel/mac80211/patches/600-02-rt2x00-rt2800lib-enable-support-for-RT3883.patch
@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -9397,6 +9397,7 @@ static int rt2800_probe_rt(struct rt2x00
+@@ -9403,6 +9403,7 @@ static int rt2800_probe_rt(struct rt2x00
  	case RT3390:
  	case RT3572:
  	case RT3593:
diff --git a/package/kernel/mac80211/patches/600-03-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch b/package/kernel/mac80211/patches/600-03-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
index 45fc964504..60e57c1bae 100644
--- a/package/kernel/mac80211/patches/600-03-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
+++ b/package/kernel/mac80211/patches/600-03-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
@@ -31,7 +31,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  #define RF5362				0x5362
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -8975,6 +8975,66 @@ static const struct rf_channel rf_vals_3
+@@ -8981,6 +8981,66 @@ static const struct rf_channel rf_vals_3
  	{14,   0xF0,	 2,  0x18},
  };
  
@@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  static const struct rf_channel rf_vals_5592_xtal20[] = {
  	/* Channel, N, K, mod, R */
  	{1, 482, 4, 10, 3},
-@@ -9238,6 +9298,11 @@ static int rt2800_probe_hw_mode(struct r
+@@ -9244,6 +9304,11 @@ static int rt2800_probe_hw_mode(struct r
  		spec->channels = rf_vals_3x;
  		break;
  
@@ -108,5 +108,5 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +		break;
 +
  	case RF5592:
- 		rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX, &reg);
+ 		reg = rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX);
  		if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) {
diff --git a/package/kernel/mac80211/patches/600-04-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch b/package/kernel/mac80211/patches/600-04-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
index fb32b75d0a..def2c397fd 100644
--- a/package/kernel/mac80211/patches/600-04-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
+++ b/package/kernel/mac80211/patches/600-04-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -4871,6 +4871,7 @@ void rt2800_vco_calibration(struct rt2x0
+@@ -4881,6 +4881,7 @@ void rt2800_vco_calibration(struct rt2x0
  	case RF3053:
  	case RF3070:
  	case RF3290:
@@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  	case RF5350:
  	case RF5360:
  	case RF5362:
-@@ -9420,6 +9421,7 @@ static int rt2800_probe_hw_mode(struct r
+@@ -9426,6 +9427,7 @@ static int rt2800_probe_hw_mode(struct r
  	case RF3053:
  	case RF3070:
  	case RF3290:
diff --git a/package/kernel/mac80211/patches/600-05-rt2x00-rt2800lib-add-channel-configuration-function-.patch b/package/kernel/mac80211/patches/600-05-rt2x00-rt2800lib-add-channel-configuration-function-.patch
index 266a3fba50..1d6e312037 100644
--- a/package/kernel/mac80211/patches/600-05-rt2x00-rt2800lib-add-channel-configuration-function-.patch
+++ b/package/kernel/mac80211/patches/600-05-rt2x00-rt2800lib-add-channel-configuration-function-.patch
@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -2709,6 +2709,211 @@ static void rt2800_config_channel_rf3053
+@@ -2713,6 +2713,211 @@ static void rt2800_config_channel_rf3053
  	}
  }
  
@@ -50,7 +50,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +
 +	rt2800_rfcsr_write(rt2x00dev, 13, 0x12);
 +
-+	rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 1);
 +	rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0);
 +	rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0);
 +	rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0);
@@ -87,7 +87,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +
 +	rt2800_freq_cal_mode1(rt2x00dev);
 +
-+	rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 30);
 +	if (!conf_is_ht40(conf))
 +		rfcsr &= ~(0x06);
 +	else
@@ -110,7 +110,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +		rt2800_rfcsr_write(rt2x00dev, 34, 0x20);
 +
 +	/* loopback RF_BS */
-+	rt2800_rfcsr_read(rt2x00dev, 36, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 36);
 +	if (rf->channel <= 14)
 +		rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 1);
 +	else
@@ -158,13 +158,13 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +
 +	rt2800_rfcsr_write(rt2x00dev, 50, 0x86);
 +
-+	rt2800_rfcsr_read(rt2x00dev, 51, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 51);
 +	if (rf->channel <= 14)
 +		rt2800_rfcsr_write(rt2x00dev, 51, 0x75);
 +	else
 +		rt2800_rfcsr_write(rt2x00dev, 51, 0x51);
 +
-+	rt2800_rfcsr_read(rt2x00dev, 52, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 52);
 +	if (rf->channel <= 14)
 +		rt2800_rfcsr_write(rt2x00dev, 52, 0x45);
 +	else
@@ -194,25 +194,25 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +	      ((info->default_power2 & 0xe0) >> 1);
 +	rt2800_bbp_write(rt2x00dev, 109, bbp);
 +
-+	rt2800_bbp_read(rt2x00dev, 110, &bbp);
++	bbp = rt2800_bbp_read(rt2x00dev, 110);
 +	bbp &= 0x0f;
 +	bbp |= (info->default_power3 & 0xe0) >> 1;
 +	rt2800_bbp_write(rt2x00dev, 110, bbp);
 +
-+	rt2800_rfcsr_read(rt2x00dev, 57, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 57);
 +	if (rf->channel <= 14)
 +		rt2800_rfcsr_write(rt2x00dev, 57, 0x6e);
 +	else
 +		rt2800_rfcsr_write(rt2x00dev, 57, 0x3e);
 +
 +	/* Enable RF tuning */
-+	rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 3);
 +	rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
 +	rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
 +
 +	udelay(2000);
 +
-+	rt2800_bbp_read(rt2x00dev, 49, &bbp);
++	bbp = rt2800_bbp_read(rt2x00dev, 49);
 +	/* clear update flag */
 +	rt2800_bbp_write(rt2x00dev, 49, bbp & 0xfe);
 +	rt2800_bbp_write(rt2x00dev, 49, bbp);
@@ -223,7 +223,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  #define POWER_BOUND		0x27
  #define POWER_BOUND_5G		0x2b
  
-@@ -3567,6 +3772,9 @@ static void rt2800_config_channel(struct
+@@ -3570,6 +3775,9 @@ static void rt2800_config_channel(struct
  	case RF3322:
  		rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
  		break;
diff --git a/package/kernel/mac80211/patches/600-06-rt2x00-rt2800lib-enable-RF3853-support.patch b/package/kernel/mac80211/patches/600-06-rt2x00-rt2800lib-enable-RF3853-support.patch
index 53e6bbb155..6476dc107b 100644
--- a/package/kernel/mac80211/patches/600-06-rt2x00-rt2800lib-enable-RF3853-support.patch
+++ b/package/kernel/mac80211/patches/600-06-rt2x00-rt2800lib-enable-RF3853-support.patch
@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -8900,6 +8900,7 @@ static int rt2800_init_eeprom(struct rt2
+@@ -8906,6 +8906,7 @@ static int rt2800_init_eeprom(struct rt2
  	case RF3290:
  	case RF3320:
  	case RF3322:
diff --git a/package/kernel/mac80211/patches/600-07-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch b/package/kernel/mac80211/patches/600-07-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
index cfa95e56bc..0a931e2026 100644
--- a/package/kernel/mac80211/patches/600-07-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
+++ b/package/kernel/mac80211/patches/600-07-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
@@ -35,7 +35,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  #define RX_FILTER_CFG			0x1400
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -5501,6 +5501,12 @@ static int rt2800_init_registers(struct
+@@ -5509,6 +5509,12 @@ static int rt2800_init_registers(struct
  			rt2800_register_write(rt2x00dev, TX_SW_CFG2,
  					      0x00000000);
  		}
@@ -48,7 +48,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  	} else if (rt2x00_rt(rt2x00dev, RT5390) ||
  		   rt2x00_rt(rt2x00dev, RT5392) ||
  		   rt2x00_rt(rt2x00dev, RT6352)) {
-@@ -5714,6 +5720,11 @@ static int rt2800_init_registers(struct
+@@ -5722,6 +5728,11 @@ static int rt2800_init_registers(struct
  	reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002;
  	rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);
  
@@ -57,6 +57,6 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +		rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_1, 0x16151413);
 +	}
 +
- 	rt2800_register_read(rt2x00dev, TX_RTS_CFG, &reg);
+ 	reg = rt2800_register_read(rt2x00dev, TX_RTS_CFG);
  	rt2x00_set_field32(&reg, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 7);
  	rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_THRES,
diff --git a/package/kernel/mac80211/patches/600-09-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch b/package/kernel/mac80211/patches/600-09-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
index 6adb9e1cd2..99f57bcd33 100644
--- a/package/kernel/mac80211/patches/600-09-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
+++ b/package/kernel/mac80211/patches/600-09-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -6341,6 +6341,47 @@ static void rt2800_init_bbp_3593(struct
+@@ -6349,6 +6349,47 @@ static void rt2800_init_bbp_3593(struct
  		rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  }
  
@@ -59,7 +59,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev)
  {
  	int ant, div_mode;
-@@ -6785,6 +6826,9 @@ static void rt2800_init_bbp(struct rt2x0
+@@ -6792,6 +6833,9 @@ static void rt2800_init_bbp(struct rt2x0
  	case RT3593:
  		rt2800_init_bbp_3593(rt2x00dev);
  		return;
diff --git a/package/kernel/mac80211/patches/600-10-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch b/package/kernel/mac80211/patches/600-10-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
index aa3ead6ee8..c0f1f5863b 100644
--- a/package/kernel/mac80211/patches/600-10-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
+++ b/package/kernel/mac80211/patches/600-10-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
@@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  #define RFCSR2_TX2_EN_MT7620		FIELD8(0x20)
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -7701,6 +7701,144 @@ static void rt2800_init_rfcsr_5350(struc
+@@ -7707,6 +7707,144 @@ static void rt2800_init_rfcsr_5350(struc
  	rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
  }
  
@@ -134,7 +134,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +		rt2800_rfcsr_write(rt2x00dev, 33, 0x32);
 +	}
 +
-+	rt2800_rfcsr_read(rt2x00dev, 2, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 2);
 +	rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_BP, 0);
 +	rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1);
 +	rt2800_rfcsr_write(rt2x00dev, 2, rfcsr);
@@ -142,23 +142,23 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +	rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 0);
 +	rt2800_rfcsr_write(rt2x00dev, 2, rfcsr);
 +
-+	rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 1);
 +	rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1);
 +	rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
 +
-+	rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 6);
 +	rfcsr |= 0xc0;
 +	rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
 +
-+	rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 22);
 +	rfcsr |= 0x20;
 +	rt2800_rfcsr_write(rt2x00dev, 22, rfcsr);
 +
-+	rt2800_rfcsr_read(rt2x00dev, 46, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 46);
 +	rfcsr |= 0x20;
 +	rt2800_rfcsr_write(rt2x00dev, 46, rfcsr);
 +
-+	rt2800_rfcsr_read(rt2x00dev, 20, &rfcsr);
++	rfcsr = rt2800_rfcsr_read(rt2x00dev, 20);
 +	rfcsr &= ~0xee;
 +	rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
 +}
@@ -166,7 +166,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  {
  	rt2800_rf_init_calibration(rt2x00dev, 2);
-@@ -8543,6 +8681,9 @@ static void rt2800_init_rfcsr(struct rt2
+@@ -8549,6 +8687,9 @@ static void rt2800_init_rfcsr(struct rt2
  	case RT3390:
  		rt2800_init_rfcsr_3390(rt2x00dev);
  		break;
diff --git a/package/kernel/mac80211/patches/600-11-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch b/package/kernel/mac80211/patches/600-11-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch
index 0e9496c056..e74f399e65 100644
--- a/package/kernel/mac80211/patches/600-11-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch
+++ b/package/kernel/mac80211/patches/600-11-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch
@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -376,7 +376,8 @@ static unsigned int rt2800_eeprom_word_i
+@@ -381,7 +381,8 @@ static unsigned int rt2800_eeprom_word_i
  		      wiphy_name(rt2x00dev->hw->wiphy), word))
  		return 0;
  
diff --git a/package/kernel/mac80211/patches/600-12-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch b/package/kernel/mac80211/patches/600-12-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
index 0ac7b040ec..2e917c8ebf 100644
--- a/package/kernel/mac80211/patches/600-12-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
+++ b/package/kernel/mac80211/patches/600-12-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
@@ -10,8 +10,8 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -9077,6 +9077,8 @@ static int rt2800_init_eeprom(struct rt2
- 		rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
+@@ -9083,6 +9083,8 @@ static int rt2800_init_eeprom(struct rt2
+ 		rf = rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID);
  	else if (rt2x00_rt(rt2x00dev, RT3352))
  		rf = RF3322;
 +	else if (rt2x00_rt(rt2x00dev, RT3883))
diff --git a/package/kernel/mac80211/patches/600-13-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch b/package/kernel/mac80211/patches/600-13-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
index dc34a96d99..0bb2d33577 100644
--- a/package/kernel/mac80211/patches/600-13-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
+++ b/package/kernel/mac80211/patches/600-13-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -3735,6 +3735,36 @@ static char rt2800_txpower_to_dev(struct
+@@ -3738,6 +3738,36 @@ static char rt2800_txpower_to_dev(struct
  		return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
  }
  
@@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
  				  struct ieee80211_conf *conf,
  				  struct rf_channel *rf,
-@@ -3753,6 +3783,12 @@ static void rt2800_config_channel(struct
+@@ -3756,6 +3786,12 @@ static void rt2800_config_channel(struct
  			rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  					      info->default_power3);
  
@@ -60,7 +60,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  	switch (rt2x00dev->chip.rf) {
  	case RF2020:
  	case RF3020:
-@@ -3857,6 +3893,15 @@ static void rt2800_config_channel(struct
+@@ -3860,6 +3896,15 @@ static void rt2800_config_channel(struct
  		rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  		rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
  		rt2800_bbp_write(rt2x00dev, 77, 0x98);
@@ -76,7 +76,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  	} else {
  		rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
  		rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
-@@ -3870,6 +3915,7 @@ static void rt2800_config_channel(struct
+@@ -3873,6 +3918,7 @@ static void rt2800_config_channel(struct
  		    !rt2x00_rt(rt2x00dev, RT6352)) {
  			if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
  				rt2800_bbp_write(rt2x00dev, 82, 0x62);
@@ -84,7 +84,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  				rt2800_bbp_write(rt2x00dev, 75, 0x46);
  			} else {
  				if (rt2x00_rt(rt2x00dev, RT3593))
-@@ -3878,19 +3924,22 @@ static void rt2800_config_channel(struct
+@@ -3881,19 +3927,22 @@ static void rt2800_config_channel(struct
  					rt2800_bbp_write(rt2x00dev, 82, 0x84);
  				rt2800_bbp_write(rt2x00dev, 75, 0x50);
  			}
@@ -110,7 +110,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  			rt2800_bbp_write(rt2x00dev, 83, 0x9a);
  
  		if (rt2x00_has_cap_external_lna_a(rt2x00dev))
-@@ -4013,6 +4062,23 @@ static void rt2800_config_channel(struct
+@@ -4019,6 +4068,23 @@ static void rt2800_config_channel(struct
  
  		rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
  
diff --git a/package/kernel/mac80211/patches/600-14-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch b/package/kernel/mac80211/patches/600-14-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
index e93d2dd96f..56157510eb 100644
--- a/package/kernel/mac80211/patches/600-14-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
+++ b/package/kernel/mac80211/patches/600-14-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -3722,13 +3722,15 @@ static char rt2800_txpower_to_dev(struct
+@@ -3725,13 +3725,15 @@ static char rt2800_txpower_to_dev(struct
  				  unsigned int channel,
  				  char txpower)
  {
diff --git a/package/kernel/mac80211/patches/600-15-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch b/package/kernel/mac80211/patches/600-15-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
index 463346eec4..c1409bcfa3 100644
--- a/package/kernel/mac80211/patches/600-15-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
+++ b/package/kernel/mac80211/patches/600-15-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -5101,7 +5101,8 @@ static void rt2800_config_txpower(struct
+@@ -5111,7 +5111,8 @@ static void rt2800_config_txpower(struct
  				  struct ieee80211_channel *chan,
  				  int power_level)
  {
diff --git a/package/kernel/mac80211/patches/600-16-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch b/package/kernel/mac80211/patches/600-16-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
index 3efac12246..a4ccb28518 100644
--- a/package/kernel/mac80211/patches/600-16-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
+++ b/package/kernel/mac80211/patches/600-16-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -8959,7 +8959,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
+@@ -8965,7 +8965,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  {
  	u16 word;
  
@@ -20,8 +20,8 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +	    rt2x00_rt(rt2x00dev, RT3883))
  		return 0;
  
- 	rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word);
-@@ -8973,7 +8974,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
+ 	word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG);
+@@ -8979,7 +8980,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  {
  	u16 word;
  
@@ -30,4 +30,4 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +	    rt2x00_rt(rt2x00dev, RT3883))
  		return 0;
  
- 	rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A, &word);
+ 	word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A);
diff --git a/package/kernel/mac80211/patches/600-17-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch b/package/kernel/mac80211/patches/600-17-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch
index 9d12c76255..197aabd7bc 100644
--- a/package/kernel/mac80211/patches/600-17-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch
+++ b/package/kernel/mac80211/patches/600-17-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch
@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -587,6 +587,7 @@ void rt2800_get_txwi_rxwi_size(struct rt
+@@ -591,6 +591,7 @@ void rt2800_get_txwi_rxwi_size(struct rt
  {
  	switch (rt2x00dev->chip.rt) {
  	case RT3593:
diff --git a/package/kernel/mac80211/patches/600-18-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch b/package/kernel/mac80211/patches/600-18-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
index cd212f9d8d..24c0ef91b0 100644
--- a/package/kernel/mac80211/patches/600-18-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
+++ b/package/kernel/mac80211/patches/600-18-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -2013,7 +2013,8 @@ void rt2800_config_ant(struct rt2x00_dev
+@@ -2017,7 +2017,8 @@ void rt2800_config_ant(struct rt2x00_dev
  	rt2800_bbp_write(rt2x00dev, 3, r3);
  	rt2800_bbp_write(rt2x00dev, 1, r1);
  
diff --git a/package/kernel/mac80211/patches/600-19-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch b/package/kernel/mac80211/patches/600-19-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
index 30ea12a5cd..52733ffeb9 100644
--- a/package/kernel/mac80211/patches/600-19-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
+++ b/package/kernel/mac80211/patches/600-19-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
@@ -10,23 +10,23 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -2036,7 +2036,8 @@ static void rt2800_config_lna_gain(struc
- 		rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
+@@ -2040,7 +2040,8 @@ static void rt2800_config_lna_gain(struc
+ 		eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_LNA);
  		lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0);
  	} else if (libconf->rf.channel <= 128) {
 -		if (rt2x00_rt(rt2x00dev, RT3593)) {
 +		if (rt2x00_rt(rt2x00dev, RT3593) ||
 +		    rt2x00_rt(rt2x00dev, RT3883)) {
- 			rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &eeprom);
+ 			eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2);
  			lna_gain = rt2x00_get_field16(eeprom,
  						      EEPROM_EXT_LNA2_A1);
-@@ -2046,7 +2047,8 @@ static void rt2800_config_lna_gain(struc
+@@ -2050,7 +2051,8 @@ static void rt2800_config_lna_gain(struc
  						      EEPROM_RSSI_BG2_LNA_A1);
  		}
  	} else {
 -		if (rt2x00_rt(rt2x00dev, RT3593)) {
 +		if (rt2x00_rt(rt2x00dev, RT3593) ||
 +		    rt2x00_rt(rt2x00dev, RT3883)) {
- 			rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &eeprom);
+ 			eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2);
  			lna_gain = rt2x00_get_field16(eeprom,
  						      EEPROM_EXT_LNA2_A2);
diff --git a/package/kernel/mac80211/patches/600-20-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch b/package/kernel/mac80211/patches/600-20-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
index 8c563b8938..301928d283 100644
--- a/package/kernel/mac80211/patches/600-20-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
+++ b/package/kernel/mac80211/patches/600-20-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -5354,7 +5354,8 @@ static u8 rt2800_get_default_vgc(struct
+@@ -5364,7 +5364,8 @@ static u8 rt2800_get_default_vgc(struct
  		else
  			vgc = 0x2e + rt2x00dev->lna_gain;
  	} else { /* 5GHZ band */
@@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  			vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3;
  		else if (rt2x00_rt(rt2x00dev, RT5592))
  			vgc = 0x24 + (2 * rt2x00dev->lna_gain);
-@@ -5374,7 +5375,8 @@ static inline void rt2800_set_vgc(struct
+@@ -5384,7 +5385,8 @@ static inline void rt2800_set_vgc(struct
  {
  	if (qual->vgc_level != vgc_level) {
  		if (rt2x00_rt(rt2x00dev, RT3572) ||
@@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  			rt2800_bbp_write_with_rx_chain(rt2x00dev, 66,
  						       vgc_level);
  		} else if (rt2x00_rt(rt2x00dev, RT5592)) {
-@@ -5421,6 +5423,11 @@ void rt2800_link_tuner(struct rt2x00_dev
+@@ -5431,6 +5433,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  		}
  		break;
  
diff --git a/package/kernel/mac80211/patches/600-21-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch b/package/kernel/mac80211/patches/600-21-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
index 6e9ef1071c..4bbc7ae44e 100644
--- a/package/kernel/mac80211/patches/600-21-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
+++ b/package/kernel/mac80211/patches/600-21-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
@@ -10,8 +10,8 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -9092,7 +9092,8 @@ static int rt2800_validate_eeprom(struct
- 	rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
+@@ -9098,7 +9098,8 @@ static int rt2800_validate_eeprom(struct
+ 	word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2);
  	if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
  		rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
 -	if (!rt2x00_rt(rt2x00dev, RT3593)) {
@@ -20,8 +20,8 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  		if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
  		    rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
  			rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
-@@ -9112,7 +9113,8 @@ static int rt2800_validate_eeprom(struct
- 	rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
+@@ -9118,7 +9119,8 @@ static int rt2800_validate_eeprom(struct
+ 	word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2);
  	if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
  		rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
 -	if (!rt2x00_rt(rt2x00dev, RT3593)) {
@@ -30,13 +30,13 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  		if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
  		    rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
  			rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
-@@ -9120,7 +9122,8 @@ static int rt2800_validate_eeprom(struct
+@@ -9126,7 +9128,8 @@ static int rt2800_validate_eeprom(struct
  	}
  	rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
  
 -	if (rt2x00_rt(rt2x00dev, RT3593)) {
 +	if (rt2x00_rt(rt2x00dev, RT3593) ||
 +	    rt2x00_rt(rt2x00dev, RT3883)) {
- 		rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &word);
+ 		word = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2);
  		if (rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0x00 ||
  		    rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0xff)
diff --git a/package/kernel/mac80211/patches/600-22-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch b/package/kernel/mac80211/patches/600-22-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
index 1a8ccbc9bd..e752efd0ea 100644
--- a/package/kernel/mac80211/patches/600-22-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
+++ b/package/kernel/mac80211/patches/600-22-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -4348,6 +4348,9 @@ static u8 rt2800_compensate_txpower(stru
+@@ -4354,6 +4354,9 @@ static u8 rt2800_compensate_txpower(stru
  	if (rt2x00_rt(rt2x00dev, RT3593))
  		return min_t(u8, txpower, 0xc);
  
diff --git a/package/kernel/mac80211/patches/600-23-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch b/package/kernel/mac80211/patches/600-23-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch
index 7d8d2f5e13..342174f8d5 100644
--- a/package/kernel/mac80211/patches/600-23-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch
+++ b/package/kernel/mac80211/patches/600-23-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch
@@ -12,7 +12,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
-@@ -415,9 +415,9 @@ void rt2800mmio_autowake_tasklet(unsigne
+@@ -424,9 +424,9 @@ void rt2800mmio_autowake_tasklet(unsigne
  }
  EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet);
  
@@ -24,12 +24,12 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  	int i;
  
  	/*
-@@ -438,29 +438,77 @@ static void rt2800mmio_txstatus_interrup
+@@ -447,29 +447,77 @@ static void rt2800mmio_txstatus_interrup
  	 * Since we have only one producer and one consumer we don't
  	 * need to lock the kfifo.
  	 */
 -	for (i = 0; i < rt2x00dev->tx->limit; i++) {
--		rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO, &status);
+-		status = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO);
 -
 -		if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID))
 -			break;
@@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +		if (++i >= rt2x00dev->tx->limit)
 +			break;
 +
-+ 		rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO, &status);
++		status = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO);
 +	} while (rt2x00_get_field32(status, TX_STA_FIFO_VALID));
  
  	/* Schedule the tasklet for processing the tx status. */
@@ -87,7 +87,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  
 -	/* Read status and ACK all interrupts */
 +	/* Read status */
- 	rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR, &reg);
+ 	reg = rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR);
 +
 +	if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) {
 +		/* Due to unknown reason the hardware generates a
@@ -96,7 +96,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 +		 * here to see if we have to process the actual
 +		 * request.
 +		 */
-+		rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO, &txstatus);
++		txstatus = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO);
 +		if (rt2800mmio_txstatus_is_spurious(rt2x00dev, txstatus)) {
 +			/* Remove the TX_FIFO_STATUS bit so it won't be
 +			 * processed in this turn. The hardware will
@@ -111,7 +111,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  	rt2x00mmio_register_write(rt2x00dev, INT_SOURCE_CSR, reg);
  
  	if (!reg)
-@@ -477,7 +525,7 @@ irqreturn_t rt2800mmio_interrupt(int irq
+@@ -486,7 +534,7 @@ irqreturn_t rt2800mmio_interrupt(int irq
  	mask = ~reg;
  
  	if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) {
diff --git a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch
index 435cc96fc5..5ad99995c2 100644
--- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch
+++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch
@@ -1,6 +1,6 @@
---- a/.local-symbols
-+++ b/.local-symbols
-@@ -336,6 +336,7 @@ RT2X00_LIB_FIRMWARE=
+--- a/local-symbols
++++ b/local-symbols
+@@ -291,6 +291,7 @@ RT2X00_LIB_FIRMWARE=
  RT2X00_LIB_CRYPTO=
  RT2X00_LIB_LEDS=
  RT2X00_LIB_DEBUGFS=
@@ -55,9 +55,9 @@
 +#include "rt2800.h"
 +
  struct rt2800_ops {
- 	void (*register_read)(struct rt2x00_dev *rt2x00dev,
- 			      const unsigned int offset, u32 *value);
-@@ -147,6 +149,15 @@ static inline int rt2800_read_eeprom(str
+ 	u32 (*register_read)(struct rt2x00_dev *rt2x00dev,
+ 			      const unsigned int offset);
+@@ -145,6 +147,15 @@ static inline int rt2800_read_eeprom(str
  {
  	const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
  
@@ -127,7 +127,7 @@
  	DECLARE_KFIFO_PTR(txstatus_fifo, u32);
 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1418,6 +1418,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
+@@ -1421,6 +1421,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  	INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  	INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  
@@ -138,7 +138,7 @@
  	/*
  	 * Let the driver probe the device to detect the capabilities.
  	 */
-@@ -1556,6 +1560,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
+@@ -1562,6 +1566,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  	 * Free the driver data.
  	 */
  	kfree(rt2x00dev->drv_data);
diff --git a/package/kernel/mac80211/patches/606-rt2x00-allow_disabling_bands_through_platform_data.patch b/package/kernel/mac80211/patches/606-rt2x00-allow_disabling_bands_through_platform_data.patch
index c3cd2f4341..202dfc0b89 100644
--- a/package/kernel/mac80211/patches/606-rt2x00-allow_disabling_bands_through_platform_data.patch
+++ b/package/kernel/mac80211/patches/606-rt2x00-allow_disabling_bands_through_platform_data.patch
@@ -12,7 +12,7 @@
  #endif /* _RT2X00_PLATFORM_H */
 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1023,6 +1023,22 @@ static int rt2x00lib_probe_hw_modes(stru
+@@ -1026,6 +1026,22 @@ static int rt2x00lib_probe_hw_modes(stru
  	unsigned int num_rates;
  	unsigned int i;
  
diff --git a/package/kernel/mac80211/patches/607-rt2x00-add_platform_data_mac_addr.patch b/package/kernel/mac80211/patches/607-rt2x00-add_platform_data_mac_addr.patch
index bca7be8533..b8b0188040 100644
--- a/package/kernel/mac80211/patches/607-rt2x00-add_platform_data_mac_addr.patch
+++ b/package/kernel/mac80211/patches/607-rt2x00-add_platform_data_mac_addr.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1001,8 +1001,13 @@ static void rt2x00lib_rate(struct ieee80
+@@ -1004,8 +1004,13 @@ static void rt2x00lib_rate(struct ieee80
  
  void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr)
  {
diff --git a/package/kernel/mac80211/patches/608-rt2x00-allow_disabling_bands_through_dts.patch b/package/kernel/mac80211/patches/608-rt2x00-allow_disabling_bands_through_dts.patch
index 724e626ca9..ca66aa8e3b 100644
--- a/package/kernel/mac80211/patches/608-rt2x00-allow_disabling_bands_through_dts.patch
+++ b/package/kernel/mac80211/patches/608-rt2x00-allow_disabling_bands_through_dts.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1027,6 +1027,16 @@ static int rt2x00lib_probe_hw_modes(stru
+@@ -1030,6 +1030,16 @@ static int rt2x00lib_probe_hw_modes(stru
  	struct ieee80211_rate *rates;
  	unsigned int num_rates;
  	unsigned int i;
diff --git a/package/kernel/mac80211/patches/610-rt2x00-change-led-polarity-from-OF.patch b/package/kernel/mac80211/patches/610-rt2x00-change-led-polarity-from-OF.patch
index 51890e0a3b..ad70aa7826 100644
--- a/package/kernel/mac80211/patches/610-rt2x00-change-led-polarity-from-OF.patch
+++ b/package/kernel/mac80211/patches/610-rt2x00-change-led-polarity-from-OF.patch
@@ -8,7 +8,7 @@
  
  #include "rt2x00.h"
  #include "rt2800lib.h"
-@@ -9279,6 +9280,17 @@ static int rt2800_init_eeprom(struct rt2
+@@ -9285,6 +9286,17 @@ static int rt2800_init_eeprom(struct rt2
  	rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
  	rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
  
diff --git a/package/kernel/mac80211/patches/611-rt2x00-add-AP+STA-support.patch b/package/kernel/mac80211/patches/611-rt2x00-add-AP+STA-support.patch
index 5ef5fc8def..062b18a63b 100644
--- a/package/kernel/mac80211/patches/611-rt2x00-add-AP+STA-support.patch
+++ b/package/kernel/mac80211/patches/611-rt2x00-add-AP+STA-support.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1358,7 +1358,7 @@ static inline void rt2x00lib_set_if_comb
+@@ -1361,7 +1361,7 @@ static inline void rt2x00lib_set_if_comb
  	 */
  	if_limit = &rt2x00dev->if_limits_ap;
  	if_limit->max = rt2x00dev->ops->max_ap_intf;
diff --git a/package/kernel/mac80211/patches/650-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/650-rt2x00-add-support-for-external-PA-on-MT7620.patch
index 64a62f4b07..9fad80b672 100644
--- a/package/kernel/mac80211/patches/650-rt2x00-add-support-for-external-PA-on-MT7620.patch
+++ b/package/kernel/mac80211/patches/650-rt2x00-add-support-for-external-PA-on-MT7620.patch
@@ -25,7 +25,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
   * EEPROM LNA
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -4114,6 +4114,61 @@ static void rt2800_config_channel(struct
+@@ -4120,6 +4120,61 @@ static void rt2800_config_channel(struct
  		rt2800_iq_calibrate(rt2x00dev, rf->channel);
  	}
  
@@ -34,11 +34,11 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 +			     &rt2x00dev->cap_flags)) {
 +			rt2x00_warn(rt2x00dev, "Using incomplete support for " \
 +					       "external PA\n");
-+			rt2800_register_read(rt2x00dev, RF_CONTROL3, &reg);
++			reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
 +			reg |= 0x00000101;
 +			rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
 +
-+			rt2800_register_read(rt2x00dev, RF_BYPASS3, &reg);
++			reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
 +			reg |= 0x00000101;
 +			rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
 +
@@ -84,12 +84,12 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 +		}
 +	}
 +
- 	rt2800_bbp_read(rt2x00dev, 4, &bbp);
+ 	bbp = rt2800_bbp_read(rt2x00dev, 4);
  	rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
  	rt2800_bbp_write(rt2x00dev, 4, bbp);
-@@ -9308,7 +9363,8 @@ static int rt2800_init_eeprom(struct rt2
+@@ -9314,7 +9369,8 @@ static int rt2800_init_eeprom(struct rt2
  	 */
- 	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
+ 	eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1);
  
 -	if (rt2x00_rt(rt2x00dev, RT3352)) {
 +	if (rt2x00_rt(rt2x00dev, RT3352) ||
@@ -97,11 +97,11 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  		if (rt2x00_get_field16(eeprom,
  		    EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352))
  		    __set_bit(CAPABILITY_EXTERNAL_PA_TX0,
-@@ -9319,6 +9375,18 @@ static int rt2800_init_eeprom(struct rt2
+@@ -9325,6 +9381,18 @@ static int rt2800_init_eeprom(struct rt2
  			      &rt2x00dev->cap_flags);
  	}
  
-+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2, &eeprom);
++	eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2);
 +
 +	if (rt2x00_rt(rt2x00dev, RT6352) && eeprom != 0 && eeprom != 0xffff) {
 +		if (rt2x00_get_field16(eeprom,
diff --git a/package/kernel/mac80211/patches/651-rt2x00-remove-unneccesary-code.patch b/package/kernel/mac80211/patches/651-rt2x00-remove-unneccesary-code.patch
index b65bd7a73e..475fcbc223 100644
--- a/package/kernel/mac80211/patches/651-rt2x00-remove-unneccesary-code.patch
+++ b/package/kernel/mac80211/patches/651-rt2x00-remove-unneccesary-code.patch
@@ -75,7 +75,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 
 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -4127,38 +4127,22 @@ static void rt2800_config_channel(struct
+@@ -4133,38 +4133,22 @@ static void rt2800_config_channel(struct
  			reg |= 0x00000101;
  			rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
  
diff --git a/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch b/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch
index f90ce492f0..71f93e9556 100644
--- a/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch
+++ b/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch
@@ -110,7 +110,7 @@ Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
  MODULE_FIRMWARE("rtlwifi/rtl8192cufw_A.bin");
  MODULE_FIRMWARE("rtlwifi/rtl8192cufw_B.bin");
  MODULE_FIRMWARE("rtlwifi/rtl8192cufw_TMSC.bin");
-@@ -6210,6 +6211,8 @@ static struct usb_device_id dev_table[]
+@@ -6212,6 +6213,8 @@ static const struct usb_device_id dev_ta
  {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0xb720, 0xff, 0xff, 0xff),
  	.driver_info = (unsigned long)&rtl8723bu_fops},
  #ifdef CPTCFG_RTL8XXXU_UNTESTED
diff --git a/package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch b/package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch
index 31c4b6535b..be5f72ff4d 100644
--- a/package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch
+++ b/package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch
@@ -13,7 +13,7 @@ Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
 
 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
-@@ -6324,6 +6324,9 @@ static struct usb_device_id dev_table[]
+@@ -6326,6 +6326,9 @@ static const struct usb_device_id dev_ta
  #ifdef CPTCFG_RTL8XXXU_UNTESTED
  {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8179, 0xff, 0xff, 0xff),
  	.driver_info = (unsigned long)&rtl8188eu_fops},
diff --git a/package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch b/package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch
index fa8ad28d97..b4898018f8 100644
--- a/package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch
+++ b/package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch
@@ -11,7 +11,7 @@ Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
 
 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
-@@ -6327,6 +6327,9 @@ static struct usb_device_id dev_table[]
+@@ -6329,6 +6329,9 @@ static const struct usb_device_id dev_ta
  /* Tested by Hans de Goede - rtl8188etv */
  {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x0179, 0xff, 0xff, 0xff),
  	.driver_info = (unsigned long)&rtl8188eu_fops},
diff --git a/package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch b/package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch
index 05c45ca24d..669fca6706 100644
--- a/package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch
+++ b/package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch
@@ -13,7 +13,7 @@ Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
 
 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
-@@ -6330,6 +6330,9 @@ static struct usb_device_id dev_table[]
+@@ -6332,6 +6332,9 @@ static const struct usb_device_id dev_ta
  /* Sitecom rtl8188eus */
  {USB_DEVICE_AND_INTERFACE_INFO(0x0df6, 0x0076, 0xff, 0xff, 0xff),
  	.driver_info = (unsigned long)&rtl8188eu_fops},
diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
index 106ef706b8..cfde08d4ea 100644
--- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
+++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
@@ -1,17 +1,17 @@
 --- a/drivers/net/wireless/marvell/libertas/cfg.c
 +++ b/drivers/net/wireless/marvell/libertas/cfg.c
-@@ -2127,6 +2127,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
+@@ -2043,6 +2043,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  		goto err_wiphy_new;
  	}
  
 +	set_wiphy_dev(wdev->wiphy, dev);
 +
- 	lbs_deb_leave(LBS_DEB_CFG80211);
  	return wdev;
  
+  err_wiphy_new:
 --- a/drivers/net/wireless/marvell/libertas/main.c
 +++ b/drivers/net/wireless/marvell/libertas/main.c
-@@ -986,6 +986,7 @@ struct lbs_private *lbs_add_card(void *c
+@@ -933,6 +933,7 @@ struct lbs_private *lbs_add_card(void *c
  		goto err_adapter;
  	}
  
diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
index 04b4954d29..b26505de21 100644
--- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
+++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/marvell/libertas/cfg.c
 +++ b/drivers/net/wireless/marvell/libertas/cfg.c
-@@ -2217,6 +2217,8 @@ int lbs_cfg_register(struct lbs_private
+@@ -2119,6 +2119,8 @@ int lbs_cfg_register(struct lbs_private
  	wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  	wdev->wiphy->reg_notifier = lbs_reg_notifier;
  
diff --git a/package/kernel/mac80211/patches/810-b43-gpio-mask-module-option.patch b/package/kernel/mac80211/patches/810-b43-gpio-mask-module-option.patch
index fd9e6fd974..5ce49d3a07 100644
--- a/package/kernel/mac80211/patches/810-b43-gpio-mask-module-option.patch
+++ b/package/kernel/mac80211/patches/810-b43-gpio-mask-module-option.patch
@@ -10,8 +10,8 @@
  	struct b43_phy phy;
 --- a/drivers/net/wireless/broadcom/b43/main.c
 +++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -75,6 +75,11 @@ MODULE_FIRMWARE("b43/ucode16_mimo.fw");
- MODULE_FIRMWARE("b43/ucode5.fw");
+@@ -85,6 +85,11 @@ MODULE_FIRMWARE("b43/ucode40.fw");
+ MODULE_FIRMWARE("b43/ucode42.fw");
  MODULE_FIRMWARE("b43/ucode9.fw");
  
 +static int modparam_gpiomask = 0x000F;
@@ -22,7 +22,7 @@
  static int modparam_bad_frames_preempt;
  module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444);
  MODULE_PARM_DESC(bad_frames_preempt,
-@@ -2882,10 +2887,10 @@ static int b43_gpio_init(struct b43_wlde
+@@ -2892,10 +2897,10 @@ static int b43_gpio_init(struct b43_wlde
  	u32 mask, set;
  
  	b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0);
diff --git a/package/kernel/mac80211/patches/811-b43_no_pio.patch b/package/kernel/mac80211/patches/811-b43_no_pio.patch
index 79428c2784..d23387c8cd 100644
--- a/package/kernel/mac80211/patches/811-b43_no_pio.patch
+++ b/package/kernel/mac80211/patches/811-b43_no_pio.patch
@@ -11,7 +11,7 @@
  b43-$(CPTCFG_B43_LEDS)		+= leds.o
 --- a/drivers/net/wireless/broadcom/b43/main.c
 +++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -2008,10 +2008,12 @@ static void b43_do_interrupt_thread(stru
+@@ -2018,10 +2018,12 @@ static void b43_do_interrupt_thread(stru
  			dma_reason[0], dma_reason[1],
  			dma_reason[2], dma_reason[3],
  			dma_reason[4], dma_reason[5]);
diff --git a/package/kernel/mac80211/patches/812-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/812-b43-add-antenna-control.patch
index 33c9402f18..932c83b48e 100644
--- a/package/kernel/mac80211/patches/812-b43-add-antenna-control.patch
+++ b/package/kernel/mac80211/patches/812-b43-add-antenna-control.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/broadcom/b43/main.c
 +++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -1648,7 +1648,7 @@ static void b43_write_beacon_template(st
+@@ -1658,7 +1658,7 @@ static void b43_write_beacon_template(st
  				  len, ram_offset, shm_size_offset, rate);
  
  	/* Write the PHY TX control parameters. */
@@ -9,7 +9,7 @@
  	antenna = b43_antenna_to_phyctl(antenna);
  	ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  	/* We can't send beacons with short preamble. Would get PHY errors. */
-@@ -3297,8 +3297,8 @@ static int b43_chip_init(struct b43_wlde
+@@ -3307,8 +3307,8 @@ static int b43_chip_init(struct b43_wlde
  
  	/* Select the antennae */
  	if (phy->ops->set_rx_antenna)
@@ -20,7 +20,7 @@
  
  	if (phy->type == B43_PHYTYPE_B) {
  		value16 = b43_read16(dev, 0x005E);
-@@ -3998,7 +3998,6 @@ static int b43_op_config(struct ieee8021
+@@ -4008,7 +4008,6 @@ static int b43_op_config(struct ieee8021
  	struct b43_wldev *dev = wl->current_dev;
  	struct b43_phy *phy = &dev->phy;
  	struct ieee80211_conf *conf = &hw->conf;
@@ -28,7 +28,7 @@
  	int err = 0;
  
  	mutex_lock(&wl->mutex);
-@@ -4041,11 +4040,9 @@ static int b43_op_config(struct ieee8021
+@@ -4051,11 +4050,9 @@ static int b43_op_config(struct ieee8021
  	}
  
  	/* Antennas for RX and management frame TX. */
@@ -42,7 +42,7 @@
  
  	if (wl->radio_enabled != phy->radio_on) {
  		if (wl->radio_enabled) {
-@@ -5189,6 +5186,47 @@ static int b43_op_get_survey(struct ieee
+@@ -5199,6 +5196,47 @@ static int b43_op_get_survey(struct ieee
  	return 0;
  }
  
@@ -90,7 +90,7 @@
  static const struct ieee80211_ops b43_hw_ops = {
  	.tx			= b43_op_tx,
  	.conf_tx		= b43_op_conf_tx,
-@@ -5210,6 +5248,8 @@ static const struct ieee80211_ops b43_hw
+@@ -5220,6 +5258,8 @@ static const struct ieee80211_ops b43_hw
  	.sw_scan_complete	= b43_op_sw_scan_complete_notifier,
  	.get_survey		= b43_op_get_survey,
  	.rfkill_poll		= b43_rfkill_poll,
@@ -99,7 +99,7 @@
  };
  
  /* Hard-reset the chip. Do not call this directly.
-@@ -5513,6 +5553,8 @@ static int b43_one_core_attach(struct b4
+@@ -5523,6 +5563,8 @@ static int b43_one_core_attach(struct b4
  	if (!wldev)
  		goto out;
  
@@ -108,9 +108,9 @@
  	wldev->use_pio = b43_modparam_pio;
  	wldev->dev = dev;
  	wldev->wl = wl;
-@@ -5605,6 +5647,9 @@ static struct b43_wl *b43_wireless_init(
+@@ -5617,6 +5659,9 @@ static struct b43_wl *b43_wireless_init(
  
- 	hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
+ 	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
  
 +	hw->wiphy->available_antennas_rx = 0x3;
 +	hw->wiphy->available_antennas_tx = 0x3;
diff --git a/package/kernel/mac80211/patches/814-b43-only-use-gpio-0-1-for-led.patch b/package/kernel/mac80211/patches/814-b43-only-use-gpio-0-1-for-led.patch
index 8d0c0412d2..03f4524c88 100644
--- a/package/kernel/mac80211/patches/814-b43-only-use-gpio-0-1-for-led.patch
+++ b/package/kernel/mac80211/patches/814-b43-only-use-gpio-0-1-for-led.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/broadcom/b43/main.c
 +++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -2899,6 +2899,14 @@ static int b43_gpio_init(struct b43_wlde
+@@ -2909,6 +2909,14 @@ static int b43_gpio_init(struct b43_wlde
  	} else if (dev->dev->chip_id == 0x5354) {
  		/* Don't allow overtaking buttons GPIOs */
  		set &= 0x2; /* 0x2 is LED GPIO on BCM5354 */
diff --git a/package/kernel/mac80211/patches/815-b43-always-take-overlapping-devs.patch b/package/kernel/mac80211/patches/815-b43-always-take-overlapping-devs.patch
index ef7f3c92d2..f07151aa4e 100644
--- a/package/kernel/mac80211/patches/815-b43-always-take-overlapping-devs.patch
+++ b/package/kernel/mac80211/patches/815-b43-always-take-overlapping-devs.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/broadcom/b43/main.c
 +++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -117,7 +117,7 @@ static int b43_modparam_pio = 0;
+@@ -127,7 +127,7 @@ static int b43_modparam_pio = 0;
  module_param_named(pio, b43_modparam_pio, int, 0644);
  MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
  
diff --git a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
index 91831188ac..cc29402c0b 100644
--- a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
+++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
@@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
 
 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1180,6 +1180,7 @@ int __init brcmf_core_init(void)
+@@ -1198,6 +1198,7 @@ int __init brcmf_core_init(void)
  {
  	if (!schedule_work(&brcmf_driver_work))
  		return -EBUSY;
@@ -25,7 +25,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
 @@ -444,6 +444,7 @@ struct brcmf_fw {
  	u16 bus_nr;
- 	void (*done)(struct device *dev, const struct firmware *fw,
+ 	void (*done)(struct device *dev, int err, const struct firmware *fw,
  		     void *nvram_image, u32 nvram_len);
 +	struct completion *completion;
  };
@@ -34,7 +34,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
 @@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  		goto fail;
  
- 	fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
+ 	fwctx->done(fwctx->dev, 0, fwctx->code, nvram, nvram_length);
 +	if (fwctx->completion)
 +		complete(fwctx->completion);
  	kfree(fwctx);
@@ -43,31 +43,22 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
 @@ -485,6 +488,8 @@ fail:
  	brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  	release_firmware(fwctx->code);
- 	device_release_driver(fwctx->dev);
+ 	fwctx->done(fwctx->dev, -ENOENT, NULL, NULL, 0);
 +	if (fwctx->completion)
 +		complete(fwctx->completion);
  	kfree(fwctx);
  }
  
-@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
- 	/* only requested code so done here */
- 	if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
- 		fwctx->done(fwctx->dev, fw, NULL, 0);
-+		if (fwctx->completion)
-+			complete(fwctx->completion);
- 		kfree(fwctx);
- 		return;
- 	}
-@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
- fail:
+@@ -516,6 +521,8 @@ fail:
  	brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
- 	device_release_driver(fwctx->dev);
+ done:
+ 	fwctx->done(fwctx->dev, ret, fw, NULL, 0);
 +	if (fwctx->completion)
 +		complete(fwctx->completion);
  	kfree(fwctx);
  }
  
-@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
+@@ -527,6 +534,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  				u16 domain_nr, u16 bus_nr)
  {
  	struct brcmf_fw *fwctx;
@@ -76,7 +67,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  
  	brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  	if (!fw_cb || !code)
-@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
+@@ -547,9 +556,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  	fwctx->domain_nr = domain_nr;
  	fwctx->bus_nr = bus_nr;
  
diff --git a/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
index 774b333402..7fc1e449d0 100644
--- a/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
+++ b/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
@@ -10,8 +10,8 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
 
 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -656,9 +656,37 @@ static struct wireless_dev *brcmf_cfg802
- 						     u32 *flags,
+@@ -655,9 +655,37 @@ static struct wireless_dev *brcmf_cfg802
+ 						     enum nl80211_iftype type,
  						     struct vif_params *params)
  {
 +	struct net_device *dev;
diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
index 1819cf3999..7c1841b770 100644
--- a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
+++ b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
@@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
 
 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -2775,6 +2775,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
+@@ -2849,6 +2849,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  	 * preference in cfg struct to apply this to
  	 * FW later while initializing the dongle
  	 */
diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
index b966516e57..94a25b680d 100644
--- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
+++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
@@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
 
 --- a/drivers/net/wireless/ath/ath10k/core.c
 +++ b/drivers/net/wireless/ath/ath10k/core.c
-@@ -2329,6 +2329,16 @@ int ath10k_core_register(struct ath10k *
+@@ -2445,6 +2445,16 @@ int ath10k_core_register(struct ath10k *
  	ar->chip_id = chip_id;
  	queue_work(ar->workqueue, &ar->register_work);
  
diff --git a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
index 6137a50bcf..e0ab671760 100644
--- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
+++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath10k/mac.c
 +++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -8007,6 +8007,21 @@ static int ath10k_mac_init_rd(struct ath
+@@ -8067,6 +8067,21 @@ static int ath10k_mac_init_rd(struct ath
  	return 0;
  }
  
@@ -22,9 +22,9 @@
  int ath10k_mac_register(struct ath10k *ar)
  {
  	static const u32 cipher_suites[] = {
-@@ -8244,6 +8259,12 @@ int ath10k_mac_register(struct ath10k *a
- 	ar->hw->wiphy->cipher_suites = cipher_suites;
- 	ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
+@@ -8308,6 +8323,12 @@ int ath10k_mac_register(struct ath10k *a
+ 
+ 	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
  
 +#ifdef CPTCFG_MAC80211_LEDS
 +	ieee80211_create_tpt_led_trigger(ar->hw,
diff --git a/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch b/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch
index d302a7d2a3..0af8025d96 100644
--- a/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch
+++ b/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath10k/core.c
 +++ b/drivers/net/wireless/ath/ath10k/core.c
-@@ -691,7 +691,7 @@ static int ath10k_core_get_board_id_from
+@@ -757,7 +757,7 @@ static int ath10k_core_get_board_id_from
  	if (ret) {
  		ath10k_err(ar, "could not execute otp for board id check: %d\n",
  			   ret);
diff --git a/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
index 357faee4bf..a958c78b43 100644
--- a/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
+++ b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/marvell/mwl8k.c
 +++ b/drivers/net/wireless/marvell/mwl8k.c
-@@ -6264,6 +6264,8 @@ static int mwl8k_probe(struct pci_dev *p
+@@ -6266,6 +6266,8 @@ static int mwl8k_probe(struct pci_dev *p
  
  	priv->running_bsses = 0;
  
@@ -9,7 +9,7 @@
  	return rc;
  
  err_stop_firmware:
-@@ -6297,8 +6299,6 @@ static void mwl8k_remove(struct pci_dev
+@@ -6299,8 +6301,6 @@ static void mwl8k_remove(struct pci_dev
  		return;
  	priv = hw->priv;
  
diff --git a/package/kernel/mac80211/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/mac80211/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch
index d49be4df70..914472aab9 100644
--- a/package/kernel/mac80211/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch
+++ b/package/kernel/mac80211/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath10k/htt.h
 +++ b/drivers/net/wireless/ath/ath10k/htt.h
-@@ -199,7 +199,7 @@ enum htt_rx_ring_flags {
+@@ -200,7 +200,7 @@ enum htt_rx_ring_flags {
  };
  
  #define HTT_RX_RING_SIZE_MIN 128
