From 5c9fd3b2d26012f8b77d1f5c86bf0b9223460cf4 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Wed, 9 Jan 2013 12:45:28 +0000
Subject: [PATCH] mac80211: update to 2013-01-07, add several ath9k stability
 fixes

SVN-Revision: 35063
---
 package/mac80211/Makefile                     |    6 +-
 .../mac80211/patches/300-pending_work.patch   | 1171 +++--------------
 ...-fix-OTP-register-offsets-for-AR9340.patch |   73 -
 ...cated-debug-message-to-ath9k_hw_nvra.patch |   83 --
 ...k-add-EEPROM-offset-to-debug-message.patch |   26 -
 ...-ath_hw-as-the-first-argument-for-at.patch |  203 ---
 ...load-EEPROM-content-via-firmware-API.patch |  184 ---
 ...06-pending-rt2x00-zero-out-rx_status.patch |   65 -
 package/mac80211/patches/310-ap_scan.patch    |    2 +-
 .../patches/400-ath_move_debug_code.patch     |    2 +-
 .../patches/403-ath_regd_optional.patch       |   16 +-
 .../patches/405-regd_no_assoc_hints.patch     |   13 +-
 .../410-ath9k_allow_adhoc_and_ap.patch        |    2 +-
 .../411-ath5k_allow_adhoc_and_ap.patch        |    6 +-
 .../patches/501-ath9k-eeprom_endianess.patch  |    4 +-
 .../mac80211/patches/502-ath9k_ahb_init.patch |    2 +-
 .../510-ath9k_intr_mitigation_tweak.patch     |    2 +-
 .../patches/511-ath9k_reduce_rxbuf.patch      |    2 +-
 .../patches/512-ath9k_channelbw_debugfs.patch |    4 +-
 .../513-mac80211_reduce_txqueuelen.patch      |    2 +-
 .../patches/520-mac80211_cur_txpower.patch    |    2 +-
 .../522-ath9k_per_chain_signal_strength.patch |   12 +-
 .../523-mac80211_configure_antenna_gain.patch |    8 +-
 ...24-ath9k_use_configured_antenna_gain.patch |    2 +-
 .../patches/530-ath9k_extra_leds.patch        |    8 +-
 .../540-mac80211_optimize_mcs_rate_mask.patch |    8 +-
 ...42-mac80211_optimize_wireless_struct.patch |    4 +-
 .../patches/553-ath9k_debugfs_diag.patch      |   10 +-
 ...w-to-disable-bands-via-platform-data.patch |    6 +-
 .../603-rt2x00-introduce-rt2x00eeprom.patch   |   15 +-
 .../patches/605-rt2x00-pci-eeprom.patch       |   14 +-
 .../610-rt2x00-fix-rt3352-ext-pa.patch        |  166 +--
 .../611-rt2x00-rf_vals-rt3352-xtal20.patch    |   10 +-
 ...700-mwl8k-missing-pci-id-for-WNR854T.patch |    2 +-
 .../800-b43-gpio-mask-module-option.patch     |    4 +-
 .../patches/820-b43-add-antenna-control.patch |   16 +-
 .../830-b43-workaround-pcie-bcm4716.patch     |    2 +-
 ...ice-found-on-some-SoCs-like-the-bcm4.patch |   39 -
 ...tart-adding-support-for-core-rev-28.patch} |    4 +-
 ...51-brcmsmac-add-support-for-BCM43224.patch |   21 -
 .../patches/860-brcmsmac-wflush-objmem.patch  |   11 -
 41 files changed, 393 insertions(+), 1839 deletions(-)
 delete mode 100644 package/mac80211/patches/301-pending-ath9k-ar9003-fix-OTP-register-offsets-for-AR9340.patch
 delete mode 100644 package/mac80211/patches/302-pending-ath9k-move-duplicated-debug-message-to-ath9k_hw_nvra.patch
 delete mode 100644 package/mac80211/patches/303-pending-ath9k-add-EEPROM-offset-to-debug-message.patch
 delete mode 100644 package/mac80211/patches/304-pending-ath9k-use-struct-ath_hw-as-the-first-argument-for-at.patch
 delete mode 100644 package/mac80211/patches/305-pending-ath9k-allow-to-load-EEPROM-content-via-firmware-API.patch
 delete mode 100644 package/mac80211/patches/306-pending-rt2x00-zero-out-rx_status.patch
 delete mode 100644 package/mac80211/patches/850-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch
 rename package/mac80211/patches/{852-brcmsmac-start-adding-support-for-core-rev-28.patch => 850-brcmsmac-start-adding-support-for-core-rev-28.patch} (95%)
 delete mode 100644 package/mac80211/patches/851-brcmsmac-add-support-for-BCM43224.patch
 delete mode 100644 package/mac80211/patches/860-brcmsmac-wflush-objmem.patch

diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile
index ac601936240..fc76f9871df 100644
--- a/package/mac80211/Makefile
+++ b/package/mac80211/Makefile
@@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=mac80211
 
-PKG_VERSION:=2012-12-06
+PKG_VERSION:=2013-01-07
 PKG_RELEASE:=1
 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
-PKG_MD5SUM:=1b2cf615a72ea5f4839796afe43c47b7
+PKG_MD5SUM:=bc4924720ebd8f3fcd9588e3c0f4db1c
 
 PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2
 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
@@ -1233,6 +1233,7 @@ MAKE_OPTS:= \
 	CONFIG_B43_PHY_LCN=$(if $(CONFIG_PACKAGE_B43_PHY_LCN),y) \
 	CONFIG_B43_BCMA=y \
 	CONFIG_B43_SSB=y \
+	CONFIG_ATH_CARDS=$(if $(CONFIG_PACKAGE_kmod-ath),m) \
 	CONFIG_ATH_COMMON=$(if $(CONFIG_PACKAGE_kmod-ath),m) \
 	CONFIG_ATH_DEBUG=$(if $(CONFIG_PACKAGE_ATH_DEBUG),y) \
 	CONFIG_ATH9K_PKTLOG=$(if $(CONFIG_PACKAGE_ATH_DEBUG),y) \
@@ -1248,6 +1249,7 @@ MAKE_OPTS:= \
 	CONFIG_ATH9K_HW=$(if $(CONFIG_PACKAGE_kmod-ath9k-common),m) \
 	CONFIG_ATH9K_COMMON=$(if $(CONFIG_PACKAGE_kmod-ath9k-common),m) \
 	CONFIG_ATH9K_DEBUGFS=$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),y) \
+	CONFIG_AR5523= \
 	CONFIG_CARL9170=$(if $(CONFIG_PACKAGE_kmod-carl9170),m) \
 	CONFIG_CARL9170_DEBUGFS=$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),y) \
 	CONFIG_COMPAT_ZD1211RW=$(if $(CONFIG_PACKAGE_kmod-zd1211rw),m) \
diff --git a/package/mac80211/patches/300-pending_work.patch b/package/mac80211/patches/300-pending_work.patch
index 38732dc9a47..94a35545ced 100644
--- a/package/mac80211/patches/300-pending_work.patch
+++ b/package/mac80211/patches/300-pending_work.patch
@@ -1,79 +1,3 @@
---- a/drivers/net/wireless/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
-@@ -5090,7 +5090,8 @@ static int rt2800_probe_hw_mode(struct r
- 	    IEEE80211_HW_SUPPORTS_PS |
- 	    IEEE80211_HW_PS_NULLFUNC_STACK |
- 	    IEEE80211_HW_AMPDU_AGGREGATION |
--	    IEEE80211_HW_REPORTS_TX_ACK_STATUS;
-+	    IEEE80211_HW_REPORTS_TX_ACK_STATUS |
-+	    IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL;
- 
- 	/*
- 	 * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices
---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
-+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
-@@ -392,10 +392,9 @@ void rt2x00lib_txdone(struct queue_entry
- 		tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
- 		tx_info->status.ampdu_len = 1;
- 		tx_info->status.ampdu_ack_len = success ? 1 : 0;
--		/*
--		 * TODO: Need to tear down BA session here
--		 * if not successful.
--		 */
-+
-+		if (!success)
-+			tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
- 	}
- 
- 	if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -173,7 +173,7 @@ struct ieee80211_chanctx_conf {
- 
- 	u8 rx_chains_static, rx_chains_dynamic;
- 
--	u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
-+	u8 drv_priv[0] __aligned(sizeof(void *));
- };
- 
- /**
-@@ -1059,7 +1059,7 @@ struct ieee80211_vif {
- 	u32 driver_flags;
- 
- 	/* must be last */
--	u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
-+	u8 drv_priv[0] __aligned(sizeof(void *));
- };
- 
- static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
-@@ -1209,7 +1209,7 @@ struct ieee80211_sta {
- 	u8 max_sp;
- 
- 	/* must be last */
--	u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
-+	u8 drv_priv[0] __aligned(sizeof(void *));
- };
- 
- /**
-@@ -1369,6 +1369,10 @@ struct ieee80211_tx_control {
-  * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
-  *	P2P Interface. This will be honoured even if more than one interface
-  *	is supported.
-+ *
-+ * @IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL: On this hardware TX BA session
-+ *	should be tear down once BAR frame will not be acked.
-+ *
-  */
- enum ieee80211_hw_flags {
- 	IEEE80211_HW_HAS_RATE_CONTROL			= 1<<0,
-@@ -1397,6 +1401,7 @@ enum ieee80211_hw_flags {
- 	IEEE80211_HW_TX_AMPDU_SETUP_IN_HW		= 1<<23,
- 	IEEE80211_HW_SCAN_WHILE_IDLE			= 1<<24,
- 	IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF		= 1<<25,
-+	IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL		= 1<<26,
- };
- 
- /**
 --- a/net/mac80211/agg-rx.c
 +++ b/net/mac80211/agg-rx.c
 @@ -203,6 +203,8 @@ static void ieee80211_send_addba_resp(st
@@ -97,7 +21,7 @@
  		memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
  	else if (sdata->vif.type == NL80211_IFTYPE_STATION)
  		memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
-@@ -460,6 +461,7 @@ int ieee80211_start_tx_ba_session(struct
+@@ -520,6 +521,7 @@ int ieee80211_start_tx_ba_session(struct
  	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
  	    sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
  	    sdata->vif.type != NL80211_IFTYPE_AP &&
@@ -121,61 +45,17 @@
  			    TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
  			    TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
  			    TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
---- a/net/mac80211/ibss.c
-+++ b/net/mac80211/ibss.c
-@@ -201,6 +201,20 @@ static void __ieee80211_sta_join_ibss(st
- 	bss_change |= BSS_CHANGED_BASIC_RATES;
- 	bss_change |= BSS_CHANGED_HT;
- 	bss_change |= BSS_CHANGED_IBSS;
-+
-+	/*
-+	 * In 5 GHz/802.11a, we can always use short slot time.
-+	 * (IEEE 802.11-2012 18.3.8.7)
-+	 *
-+	 * In 2.4GHz, we must always use long slots in IBSS for compatibility
-+	 * reasons.
-+	 * (IEEE 802.11-2012 19.4.5)
-+	 *
-+	 * HT follows these specifications (IEEE 802.11-2012 20.3.18)
-+	 */
-+	sdata->vif.bss_conf.use_short_slot = chan->band == IEEE80211_BAND_5GHZ;
-+	bss_change |= BSS_CHANGED_ERP_SLOT;
-+
- 	sdata->vif.bss_conf.ibss_joined = true;
- 	sdata->vif.bss_conf.ibss_creator = creator;
- 	ieee80211_bss_info_change_notify(sdata, bss_change);
 --- a/net/mac80211/iface.c
 +++ b/net/mac80211/iface.c
-@@ -508,9 +508,9 @@ static void ieee80211_del_virtual_monito
- int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
- {
+@@ -501,7 +501,6 @@ int ieee80211_do_open(struct wireless_de
  	struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
-+	struct ieee80211_sub_if_data *ap_sdata;
  	struct net_device *dev = wdev->netdev;
  	struct ieee80211_local *local = sdata->local;
 -	struct sta_info *sta;
  	u32 changed = 0;
  	int res;
  	u32 hw_reconf_flags = 0;
-@@ -587,10 +587,14 @@ int ieee80211_do_open(struct wireless_de
- 	switch (sdata->vif.type) {
- 	case NL80211_IFTYPE_AP_VLAN:
- 		/* no need to tell driver, but set carrier */
--		if (rtnl_dereference(sdata->bss->beacon))
--			netif_carrier_on(dev);
--		else
-+		if (!rtnl_dereference(sdata->bss->beacon)) {
- 			netif_carrier_off(dev);
-+			break;
-+		}
-+
-+		ap_sdata = get_bss_sdata(sdata);
-+		ieee80211_vif_copy_channel(sdata, ap_sdata);
-+		netif_carrier_on(dev);
- 		break;
- 	case NL80211_IFTYPE_MONITOR:
- 		if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) {
-@@ -665,30 +669,8 @@ int ieee80211_do_open(struct wireless_de
+@@ -658,30 +657,8 @@ int ieee80211_do_open(struct wireless_de
  
  	set_bit(SDATA_STATE_RUNNING, &sdata->state);
  
@@ -207,16 +87,7 @@
  
  	/*
  	 * set_multicast_list will be invoked by the networking core
-@@ -844,6 +826,8 @@ static void ieee80211_do_stop(struct iee
- 	switch (sdata->vif.type) {
- 	case NL80211_IFTYPE_AP_VLAN:
- 		list_del(&sdata->u.vlan.list);
-+		netif_carrier_off(sdata->dev);
-+		ieee80211_vif_release_channel(sdata);
- 		/* no need to tell driver */
- 		break;
- 	case NL80211_IFTYPE_MONITOR:
-@@ -1072,6 +1056,72 @@ static void ieee80211_if_setup(struct ne
+@@ -1066,6 +1043,72 @@ static void ieee80211_if_setup(struct ne
  	dev->destructor = free_netdev;
  }
  
@@ -289,7 +160,7 @@
  static void ieee80211_iface_work(struct work_struct *work)
  {
  	struct ieee80211_sub_if_data *sdata =
-@@ -1176,6 +1226,9 @@ static void ieee80211_iface_work(struct 
+@@ -1170,6 +1213,9 @@ static void ieee80211_iface_work(struct 
  				break;
  			ieee80211_mesh_rx_queued_mgmt(sdata, skb);
  			break;
@@ -301,37 +172,7 @@
  			break;
 --- a/net/mac80211/rx.c
 +++ b/net/mac80211/rx.c
-@@ -378,9 +378,6 @@ ieee80211_rx_monitor(struct ieee80211_lo
- 	 * the SKB because it has a bad FCS/PLCP checksum.
- 	 */
- 
--	/* room for the radiotap header based on driver features */
--	needed_headroom = ieee80211_rx_radiotap_space(local, status);
--
- 	if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
- 		present_fcs_len = FCS_LEN;
- 
-@@ -399,6 +396,9 @@ ieee80211_rx_monitor(struct ieee80211_lo
- 		return remove_monitor_info(local, origskb);
- 	}
- 
-+	/* room for the radiotap header based on driver features */
-+	needed_headroom = ieee80211_rx_radiotap_space(local, status);
-+
- 	if (should_drop_frame(origskb, present_fcs_len)) {
- 		/* only need to expand headroom if necessary */
- 		skb = origskb;
-@@ -2333,7 +2333,8 @@ ieee80211_rx_h_action(struct ieee80211_r
- 	if (len < IEEE80211_MIN_ACTION_SIZE)
- 		return RX_DROP_UNUSABLE;
- 
--	if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC)
-+	if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC &&
-+	    mgmt->u.action.category != WLAN_CATEGORY_SELF_PROTECTED)
- 		return RX_DROP_UNUSABLE;
- 
- 	if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
-@@ -2349,6 +2350,7 @@ ieee80211_rx_h_action(struct ieee80211_r
+@@ -2350,6 +2350,7 @@ ieee80211_rx_h_action(struct ieee80211_r
  		    sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
  		    sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
  		    sdata->vif.type != NL80211_IFTYPE_AP &&
@@ -339,7 +180,7 @@
  		    sdata->vif.type != NL80211_IFTYPE_ADHOC)
  			break;
  
-@@ -2625,14 +2627,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
+@@ -2655,14 +2656,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
  
  	if (!ieee80211_vif_is_mesh(&sdata->vif) &&
  	    sdata->vif.type != NL80211_IFTYPE_ADHOC &&
@@ -357,7 +198,7 @@
  		break;
  	case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
  	case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
-@@ -2957,10 +2960,16 @@ static int prepare_for_handlers(struct i
+@@ -2987,10 +2989,16 @@ static int prepare_for_handlers(struct i
  		}
  		break;
  	case NL80211_IFTYPE_WDS:
@@ -394,824 +235,234 @@
  	WLAN_STA_CLEAR_PS_FILT,
  	WLAN_STA_MFP,
  	WLAN_STA_BLOCK_BA,
---- a/net/mac80211/status.c
-+++ b/net/mac80211/status.c
-@@ -502,7 +502,11 @@ void ieee80211_tx_status(struct ieee8021
- 				       IEEE80211_BAR_CTRL_TID_INFO_MASK) >>
- 				      IEEE80211_BAR_CTRL_TID_INFO_SHIFT;
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -324,7 +324,6 @@ struct ath_rx {
  
--				ieee80211_set_bar_pending(sta, tid, ssn);
-+				if (local->hw.flags &
-+				    IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL)
-+					ieee80211_stop_tx_ba_session(&sta->sta, tid);
-+				else
-+					ieee80211_set_bar_pending(sta, tid, ssn);
- 			}
- 		}
+ int ath_startrecv(struct ath_softc *sc);
+ bool ath_stoprecv(struct ath_softc *sc);
+-void ath_flushrecv(struct ath_softc *sc);
+ u32 ath_calcrxfilter(struct ath_softc *sc);
+ int ath_rx_init(struct ath_softc *sc, int nbufs);
+ void ath_rx_cleanup(struct ath_softc *sc);
+@@ -641,7 +640,6 @@ void ath_ant_comb_update(struct ath_soft
+ enum sc_op_flags {
+ 	SC_OP_INVALID,
+ 	SC_OP_BEACONS,
+-	SC_OP_RXFLUSH,
+ 	SC_OP_ANI_RUN,
+ 	SC_OP_PRIM_STA_VIF,
+ 	SC_OP_HW_RESET,
+--- a/drivers/net/wireless/ath/ath9k/beacon.c
++++ b/drivers/net/wireless/ath/ath9k/beacon.c
+@@ -147,6 +147,7 @@ static struct ath_buf *ath9k_beacon_gene
+ 				 skb->len, DMA_TO_DEVICE);
+ 		dev_kfree_skb_any(skb);
+ 		bf->bf_buf_addr = 0;
++		bf->bf_mpdu = NULL;
+ 	}
  
---- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
-@@ -534,98 +534,98 @@ static const u32 ar9300_2p2_baseband_cor
+ 	skb = ieee80211_beacon_get(hw, vif);
+@@ -359,7 +360,6 @@ void ath9k_beacon_tasklet(unsigned long 
+ 		return;
  
- static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
- 	/* Addr      5G_HT20     5G_HT40     2G_HT40     2G_HT20   */
--	{0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
--	{0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
--	{0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
-+	{0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352},
-+	{0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584},
-+	{0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800},
- 	{0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
--	{0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
--	{0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
--	{0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
--	{0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
--	{0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
--	{0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
--	{0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
--	{0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402},
--	{0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404},
--	{0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
--	{0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
--	{0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
--	{0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
--	{0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
--	{0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
--	{0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
--	{0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
--	{0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
--	{0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861},
--	{0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81},
--	{0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83},
--	{0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84},
--	{0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3},
--	{0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5},
--	{0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9},
--	{0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb},
--	{0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
--	{0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
--	{0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
--	{0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
--	{0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
--	{0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
--	{0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
--	{0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
--	{0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
--	{0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
--	{0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
--	{0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
--	{0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
--	{0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402},
--	{0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404},
--	{0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
--	{0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
--	{0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
--	{0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
--	{0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
--	{0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
--	{0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
--	{0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
--	{0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
--	{0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861},
--	{0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81},
--	{0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83},
--	{0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84},
--	{0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3},
--	{0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5},
--	{0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9},
--	{0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb},
--	{0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
--	{0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
--	{0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
--	{0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
--	{0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
--	{0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
--	{0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
-+	{0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9},
-+	{0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
-+	{0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002},
-+	{0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004},
-+	{0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200},
-+	{0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202},
-+	{0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400},
-+	{0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402},
-+	{0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404},
-+	{0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603},
-+	{0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02},
-+	{0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04},
-+	{0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20},
-+	{0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20},
-+	{0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22},
-+	{0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24},
-+	{0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640},
-+	{0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660},
-+	{0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861},
-+	{0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81},
-+	{0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83},
-+	{0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84},
-+	{0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3},
-+	{0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5},
-+	{0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9},
-+	{0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb},
-+	{0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
-+	{0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
-+	{0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
-+	{0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
-+	{0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
-+	{0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
-+	{0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
-+	{0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
-+	{0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002},
-+	{0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004},
-+	{0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200},
-+	{0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202},
-+	{0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400},
-+	{0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402},
-+	{0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404},
-+	{0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603},
-+	{0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02},
-+	{0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04},
-+	{0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20},
-+	{0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20},
-+	{0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22},
-+	{0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24},
-+	{0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640},
-+	{0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660},
-+	{0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861},
-+	{0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81},
-+	{0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83},
-+	{0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84},
-+	{0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3},
-+	{0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5},
-+	{0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9},
-+	{0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb},
-+	{0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
-+	{0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
-+	{0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
-+	{0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
-+	{0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
-+	{0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
-+	{0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
- 	{0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
- 	{0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
- 	{0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
- 	{0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
--	{0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
--	{0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000},
--	{0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501},
--	{0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501},
--	{0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03},
--	{0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04},
--	{0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04},
--	{0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
--	{0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
--	{0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
--	{0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
--	{0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
--	{0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
--	{0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
--	{0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
-+	{0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000},
-+	{0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000},
-+	{0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501},
-+	{0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501},
-+	{0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03},
-+	{0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04},
-+	{0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04},
-+	{0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
-+	{0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
-+	{0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
-+	{0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
-+	{0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
-+	{0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352},
-+	{0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584},
-+	{0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800},
- 	{0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
--	{0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
--	{0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
--	{0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
-+	{0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352},
-+	{0x0000c2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584},
-+	{0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800},
- 	{0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
- 	{0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
- 	{0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
+ 	bf = ath9k_beacon_generate(sc->hw, vif);
+-	WARN_ON(!bf);
+ 
+ 	if (sc->beacon.bmisscnt != 0) {
+ 		ath_dbg(common, BSTUCK, "resume beacon xmit after %u misses\n",
+--- a/drivers/net/wireless/ath/ath9k/debug.c
++++ b/drivers/net/wireless/ath/ath9k/debug.c
+@@ -861,7 +861,6 @@ static ssize_t read_file_recv(struct fil
+ 	RXS_ERR("RX-LENGTH-ERR", rx_len_err);
+ 	RXS_ERR("RX-OOM-ERR", rx_oom_err);
+ 	RXS_ERR("RX-RATE-ERR", rx_rate_err);
+-	RXS_ERR("RX-DROP-RXFLUSH", rx_drop_rxflush);
+ 	RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err);
+ 
+ 	PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN);
 --- a/drivers/net/wireless/ath/ath9k/debug.h
 +++ b/drivers/net/wireless/ath/ath9k/debug.h
-@@ -242,7 +242,7 @@ struct ath_rx_stats {
- 
- struct ath_stats {
- 	struct ath_interrupt_stats istats;
--	struct ath_tx_stats txstats[IEEE80211_NUM_ACS];
-+	struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES];
- 	struct ath_rx_stats rxstats;
- 	struct ath_dfs_stats dfs_stats;
- 	u32 reset[__RESET_TYPE_MAX];
---- a/drivers/net/wireless/ath/carl9170/rx.c
-+++ b/drivers/net/wireless/ath/carl9170/rx.c
-@@ -684,7 +684,7 @@ static int carl9170_handle_mpdu(struct a
- 	if (!skb)
- 		return -ENOMEM;
- 
--	memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
-+	memcpy(IEEE80211_SKB_RXCB(skb), status, sizeof(*status));
- 	ieee80211_rx(ar->hw, skb);
- 	return 0;
- }
---- a/drivers/net/wireless/ath/ath9k/calib.c
-+++ b/drivers/net/wireless/ath/ath9k/calib.c
-@@ -69,6 +69,7 @@ s16 ath9k_hw_getchan_noise(struct ath_hw
- 
- 	if (chan && chan->noisefloor) {
- 		s8 delta = chan->noisefloor -
-+			   ATH9K_NF_CAL_NOISE_THRESH -
- 			   ath9k_hw_get_default_nf(ah, chan);
- 		if (delta > 0)
- 			noise += delta;
---- a/drivers/net/wireless/ath/ath9k/calib.h
-+++ b/drivers/net/wireless/ath/ath9k/calib.h
-@@ -21,6 +21,9 @@
- 
- #define AR_PHY_CCA_FILTERWINDOW_LENGTH          5
- 
-+/* Internal noise floor can vary by about 6db depending on the frequency */
-+#define ATH9K_NF_CAL_NOISE_THRESH		6
-+
- #define NUM_NF_READINGS       6
- #define ATH9K_NF_CAL_HIST_MAX 5
- 
---- a/drivers/net/wireless/ath/ath5k/base.c
-+++ b/drivers/net/wireless/ath/ath5k/base.c
-@@ -851,7 +851,7 @@ ath5k_txbuf_free_skb(struct ath5k_hw *ah
- 		return;
- 	dma_unmap_single(ah->dev, bf->skbaddr, bf->skb->len,
- 			DMA_TO_DEVICE);
--	dev_kfree_skb_any(bf->skb);
-+	ieee80211_free_txskb(ah->hw, bf->skb);
- 	bf->skb = NULL;
- 	bf->skbaddr = 0;
- 	bf->desc->ds_data = 0;
-@@ -1578,7 +1578,7 @@ ath5k_tx_queue(struct ieee80211_hw *hw, 
- 	return;
- 
- drop_packet:
--	dev_kfree_skb_any(skb);
-+	ieee80211_free_txskb(hw, skb);
+@@ -216,7 +216,6 @@ struct ath_tx_stats {
+  * @rx_oom_err:  No. of frames dropped due to OOM issues.
+  * @rx_rate_err:  No. of frames dropped due to rate errors.
+  * @rx_too_many_frags_err:  Frames dropped due to too-many-frags received.
+- * @rx_drop_rxflush: No. of frames dropped due to RX-FLUSH.
+  * @rx_beacons:  No. of beacons received.
+  * @rx_frags:  No. of rx-fragements received.
+  */
+@@ -235,7 +234,6 @@ struct ath_rx_stats {
+ 	u32 rx_oom_err;
+ 	u32 rx_rate_err;
+ 	u32 rx_too_many_frags_err;
+-	u32 rx_drop_rxflush;
+ 	u32 rx_beacons;
+ 	u32 rx_frags;
+ };
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -182,7 +182,7 @@ static void ath_restart_work(struct ath_
+ 	ath_start_ani(sc);
  }
  
- static void
---- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
-+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
-@@ -65,7 +65,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct
- 	u16 qnum = skb_get_queue_mapping(skb);
- 
- 	if (WARN_ON(qnum >= ah->ah_capabilities.cap_queues.q_tx_num)) {
--		dev_kfree_skb_any(skb);
-+		ieee80211_free_txskb(hw, skb);
- 		return;
- 	}
- 
---- a/drivers/net/wireless/b43/dma.c
-+++ b/drivers/net/wireless/b43/dma.c
-@@ -409,7 +409,10 @@ static inline
- 				struct b43_dmadesc_meta *meta)
+-static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush)
++static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx)
  {
- 	if (meta->skb) {
--		dev_kfree_skb_any(meta->skb);
-+		if (ring->tx)
-+			ieee80211_free_txskb(ring->dev->wl->hw, meta->skb);
-+		else
-+			dev_kfree_skb_any(meta->skb);
- 		meta->skb = NULL;
- 	}
+ 	struct ath_hw *ah = sc->sc_ah;
+ 	bool ret = true;
+@@ -196,19 +196,15 @@ static bool ath_prepare_reset(struct ath
+ 	ath9k_debug_samp_bb_mac(sc);
+ 	ath9k_hw_disable_interrupts(ah);
+ 
++	tasklet_disable(&sc->intr_tq);
++
+ 	if (!ath_stoprecv(sc))
+ 		ret = false;
+ 
+ 	if (!ath_drain_all_txq(sc, retry_tx))
+ 		ret = false;
+ 
+-	if (!flush) {
+-		if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
+-			ath_rx_tasklet(sc, 1, true);
+-		ath_rx_tasklet(sc, 1, false);
+-	} else {
+-		ath_flushrecv(sc);
+-	}
++	tasklet_enable(&sc->intr_tq);
+ 
+ 	return ret;
  }
-@@ -1454,7 +1457,7 @@ int b43_dma_tx(struct b43_wldev *dev, st
- 	if (unlikely(err == -ENOKEY)) {
- 		/* Drop this packet, as we don't have the encryption key
- 		 * anymore and must not transmit it unencrypted. */
--		dev_kfree_skb_any(skb);
-+		ieee80211_free_txskb(dev->wl->hw, skb);
- 		err = 0;
- 		goto out;
- 	}
---- a/drivers/net/wireless/b43/main.c
-+++ b/drivers/net/wireless/b43/main.c
-@@ -3397,7 +3397,7 @@ static void b43_tx_work(struct work_stru
- 				break;
- 			}
- 			if (unlikely(err))
--				dev_kfree_skb(skb); /* Drop it */
-+				ieee80211_free_txskb(wl->hw, skb);
- 			err = 0;
- 		}
+@@ -262,7 +258,6 @@ static int ath_reset_internal(struct ath
+ 	struct ath_common *common = ath9k_hw_common(ah);
+ 	struct ath9k_hw_cal_data *caldata = NULL;
+ 	bool fastcc = true;
+-	bool flush = false;
+ 	int r;
  
-@@ -3419,7 +3419,7 @@ static void b43_op_tx(struct ieee80211_h
+ 	__ath_cancel_work(sc);
+@@ -276,11 +271,10 @@ static int ath_reset_internal(struct ath
  
- 	if (unlikely(skb->len < 2 + 2 + 6)) {
- 		/* Too short, this can't be a valid frame. */
--		dev_kfree_skb_any(skb);
-+		ieee80211_free_txskb(hw, skb);
- 		return;
- 	}
- 	B43_WARN_ON(skb_shinfo(skb)->nr_frags);
-@@ -4234,8 +4234,12 @@ redo:
- 
- 	/* Drain all TX queues. */
- 	for (queue_num = 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) {
--		while (skb_queue_len(&wl->tx_queue[queue_num]))
--			dev_kfree_skb(skb_dequeue(&wl->tx_queue[queue_num]));
-+		while (skb_queue_len(&wl->tx_queue[queue_num])) {
-+			struct sk_buff *skb;
-+
-+			skb = skb_dequeue(&wl->tx_queue[queue_num]);
-+			ieee80211_free_txskb(wl->hw, skb);
-+		}
+ 	if (!hchan) {
+ 		fastcc = false;
+-		flush = true;
+ 		hchan = ah->curchan;
  	}
  
- 	b43_mac_suspend(dev);
---- a/drivers/net/wireless/b43/pio.c
-+++ b/drivers/net/wireless/b43/pio.c
-@@ -196,7 +196,7 @@ static void b43_pio_cancel_tx_packets(st
- 	for (i = 0; i < ARRAY_SIZE(q->packets); i++) {
- 		pack = &(q->packets[i]);
- 		if (pack->skb) {
--			dev_kfree_skb_any(pack->skb);
-+			ieee80211_free_txskb(q->dev->wl->hw, pack->skb);
- 			pack->skb = NULL;
- 		}
+-	if (!ath_prepare_reset(sc, retry_tx, flush))
++	if (!ath_prepare_reset(sc, retry_tx))
+ 		fastcc = false;
+ 
+ 	ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n",
+@@ -804,7 +798,7 @@ static void ath9k_stop(struct ieee80211_
+ 		ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
  	}
-@@ -552,7 +552,7 @@ int b43_pio_tx(struct b43_wldev *dev, st
- 	if (unlikely(err == -ENOKEY)) {
- 		/* Drop this packet, as we don't have the encryption key
- 		 * anymore and must not transmit it unencrypted. */
--		dev_kfree_skb_any(skb);
-+		ieee80211_free_txskb(dev->wl->hw, skb);
- 		err = 0;
- 		goto out;
- 	}
---- a/net/mac80211/cfg.c
-+++ b/net/mac80211/cfg.c
-@@ -915,6 +915,12 @@ static int ieee80211_start_ap(struct wip
- 	if (err)
- 		return err;
  
-+	list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
-+		err = ieee80211_vif_copy_channel(vlan, sdata);
-+		if (err)
-+			return err;
-+	}
-+
- 	/*
- 	 * Apply control port protocol, this allows us to
- 	 * not encrypt dynamic WEP control frames.
-@@ -998,8 +1004,11 @@ static int ieee80211_stop_ap(struct wiph
- 	old_probe_resp = rtnl_dereference(sdata->u.ap.probe_resp);
+-	ath_prepare_reset(sc, false, true);
++	ath_prepare_reset(sc, false);
  
- 	/* turn off carrier for this interface and dependent VLANs */
--	list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
-+	list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
-+		sta_info_flush(local, vlan);
- 		netif_carrier_off(vlan->dev);
-+		ieee80211_vif_release_channel(vlan);
-+	}
- 	netif_carrier_off(dev);
+ 	if (sc->rx.frag) {
+ 		dev_kfree_skb_any(sc->rx.frag);
+--- a/drivers/net/wireless/ath/ath9k/recv.c
++++ b/drivers/net/wireless/ath/ath9k/recv.c
+@@ -280,7 +280,6 @@ int ath_rx_init(struct ath_softc *sc, in
  
- 	/* remove beacon and probe response */
---- a/net/mac80211/chan.c
-+++ b/net/mac80211/chan.c
-@@ -119,14 +119,17 @@ static int ieee80211_assign_vif_chanctx(
- 
- 	lockdep_assert_held(&local->chanctx_mtx);
- 
--	ret = drv_assign_vif_chanctx(local, sdata, ctx);
--	if (ret)
--		return ret;
-+	if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN) {
-+		ret = drv_assign_vif_chanctx(local, sdata, ctx);
-+		if (ret)
-+			return ret;
-+	}
- 
- 	rcu_assign_pointer(sdata->vif.chanctx_conf, &ctx->conf);
- 	ctx->refcount++;
- 
--	ieee80211_recalc_txpower(sdata);
-+	if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
-+		ieee80211_recalc_txpower(sdata);
+ 	spin_lock_init(&sc->sc_pcu_lock);
+ 	spin_lock_init(&sc->rx.rxbuflock);
+-	clear_bit(SC_OP_RXFLUSH, &sc->sc_flags);
  
+ 	common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 +
+ 			     sc->sc_ah->caps.rx_status_len;
+@@ -464,6 +463,13 @@ start_recv:
  	return 0;
  }
-@@ -174,7 +177,8 @@ static void ieee80211_unassign_vif_chanc
- 	ctx->refcount--;
- 	rcu_assign_pointer(sdata->vif.chanctx_conf, NULL);
  
--	drv_unassign_vif_chanctx(local, sdata, ctx);
-+	if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
-+		drv_unassign_vif_chanctx(local, sdata, ctx);
- 
- 	if (ctx->refcount > 0) {
- 		ieee80211_recalc_chanctx_chantype(sdata->local, ctx);
-@@ -285,6 +289,30 @@ void ieee80211_recalc_smps_chanctx(struc
- 	drv_change_chanctx(local, chanctx, IEEE80211_CHANCTX_CHANGE_RX_CHAINS);
- }
- 
-+int ieee80211_vif_copy_channel(struct ieee80211_sub_if_data *sdata,
-+			       struct ieee80211_sub_if_data *parent)
++static void ath_flushrecv(struct ath_softc *sc)
 +{
-+	struct ieee80211_local *local = sdata->local;
-+	struct ieee80211_chanctx_conf *conf;
-+	struct ieee80211_chanctx *ctx;
-+
-+	int ret;
-+
-+	mutex_lock(&local->chanctx_mtx);
-+	conf = rcu_dereference_protected(parent->vif.chanctx_conf,
-+					 lockdep_is_held(&local->chanctx_mtx));
-+	if (!conf) {
-+		ret = -ENOENT;
-+		goto out;
-+	}
-+
-+	ctx = container_of(conf, struct ieee80211_chanctx, conf);
-+	ret = ieee80211_assign_vif_chanctx(sdata, ctx);
-+out:
-+	mutex_unlock(&local->chanctx_mtx);
-+	return ret;
++	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
++		ath_rx_tasklet(sc, 1, true);
++	ath_rx_tasklet(sc, 1, false);
 +}
 +
- int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
- 			      const struct cfg80211_chan_def *chandef,
- 			      enum ieee80211_chanctx_mode mode)
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -1633,6 +1633,8 @@ ieee80211_vif_use_channel(struct ieee802
- 			  const struct cfg80211_chan_def *chandef,
- 			  enum ieee80211_chanctx_mode mode);
- void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
-+int ieee80211_vif_copy_channel(struct ieee80211_sub_if_data *sdata,
-+			       struct ieee80211_sub_if_data *parent);
+ bool ath_stoprecv(struct ath_softc *sc)
+ {
+ 	struct ath_hw *ah = sc->sc_ah;
+@@ -474,6 +480,8 @@ bool ath_stoprecv(struct ath_softc *sc)
+ 	ath9k_hw_setrxfilter(ah, 0);
+ 	stopped = ath9k_hw_stopdmarecv(ah, &reset);
  
- void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
- 				   struct ieee80211_chanctx *chanctx);
---- a/include/linux/ieee80211.h
-+++ b/include/linux/ieee80211.h
-@@ -180,7 +180,7 @@ struct ieee80211_hdr {
- 	u8 addr3[6];
- 	__le16 seq_ctrl;
- 	u8 addr4[6];
--} __attribute__ ((packed));
-+} __packed;
++	ath_flushrecv(sc);
++
+ 	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
+ 		ath_edma_stop_recv(sc);
+ 	else
+@@ -490,15 +498,6 @@ bool ath_stoprecv(struct ath_softc *sc)
+ 	return stopped && !reset;
+ }
  
- struct ieee80211_hdr_3addr {
- 	__le16 frame_control;
-@@ -189,7 +189,7 @@ struct ieee80211_hdr_3addr {
- 	u8 addr2[6];
- 	u8 addr3[6];
- 	__le16 seq_ctrl;
--} __attribute__ ((packed));
-+} __packed;
- 
- struct ieee80211_qos_hdr {
- 	__le16 frame_control;
-@@ -199,7 +199,7 @@ struct ieee80211_qos_hdr {
- 	u8 addr3[6];
- 	__le16 seq_ctrl;
- 	__le16 qos_ctrl;
--} __attribute__ ((packed));
-+} __packed;
- 
- /**
-  * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
-@@ -576,7 +576,7 @@ struct ieee80211s_hdr {
- 	__le32 seqnum;
- 	u8 eaddr1[6];
- 	u8 eaddr2[6];
--} __attribute__ ((packed));
-+} __packed;
- 
- /* Mesh flags */
- #define MESH_FLAGS_AE_A4 	0x1
-@@ -614,7 +614,7 @@ struct ieee80211_quiet_ie {
- 	u8 period;
- 	__le16 duration;
- 	__le16 offset;
--} __attribute__ ((packed));
-+} __packed;
- 
- /**
-  * struct ieee80211_msrment_ie
-@@ -626,7 +626,7 @@ struct ieee80211_msrment_ie {
- 	u8 mode;
- 	u8 type;
- 	u8 request[0];
--} __attribute__ ((packed));
-+} __packed;
- 
- /**
-  * struct ieee80211_channel_sw_ie
-@@ -637,7 +637,7 @@ struct ieee80211_channel_sw_ie {
- 	u8 mode;
- 	u8 new_ch_num;
- 	u8 count;
--} __attribute__ ((packed));
-+} __packed;
- 
- /**
-  * struct ieee80211_tim
-@@ -650,7 +650,7 @@ struct ieee80211_tim_ie {
- 	u8 bitmap_ctrl;
- 	/* variable size: 1 - 251 bytes */
- 	u8 virtual_map[1];
--} __attribute__ ((packed));
-+} __packed;
- 
- /**
-  * struct ieee80211_meshconf_ie
-@@ -665,7 +665,7 @@ struct ieee80211_meshconf_ie {
- 	u8 meshconf_auth;
- 	u8 meshconf_form;
- 	u8 meshconf_cap;
--} __attribute__ ((packed));
-+} __packed;
- 
- /**
-  * enum mesh_config_capab_flags - Mesh Configuration IE capability field flags
-@@ -695,7 +695,7 @@ struct ieee80211_rann_ie {
- 	__le32 rann_seq;
- 	__le32 rann_interval;
- 	__le32 rann_metric;
--} __attribute__ ((packed));
-+} __packed;
- 
- enum ieee80211_rann_flags {
- 	RANN_FLAG_IS_GATE = 1 << 0,
-@@ -717,33 +717,33 @@ struct ieee80211_mgmt {
- 			__le16 status_code;
- 			/* possibly followed by Challenge text */
- 			u8 variable[0];
--		} __attribute__ ((packed)) auth;
-+		} __packed auth;
- 		struct {
- 			__le16 reason_code;
--		} __attribute__ ((packed)) deauth;
-+		} __packed deauth;
- 		struct {
- 			__le16 capab_info;
- 			__le16 listen_interval;
- 			/* followed by SSID and Supported rates */
- 			u8 variable[0];
--		} __attribute__ ((packed)) assoc_req;
-+		} __packed assoc_req;
- 		struct {
- 			__le16 capab_info;
- 			__le16 status_code;
- 			__le16 aid;
- 			/* followed by Supported rates */
- 			u8 variable[0];
--		} __attribute__ ((packed)) assoc_resp, reassoc_resp;
-+		} __packed assoc_resp, reassoc_resp;
- 		struct {
- 			__le16 capab_info;
- 			__le16 listen_interval;
- 			u8 current_ap[6];
- 			/* followed by SSID and Supported rates */
- 			u8 variable[0];
--		} __attribute__ ((packed)) reassoc_req;
-+		} __packed reassoc_req;
- 		struct {
- 			__le16 reason_code;
--		} __attribute__ ((packed)) disassoc;
-+		} __packed disassoc;
- 		struct {
- 			__le64 timestamp;
- 			__le16 beacon_int;
-@@ -751,11 +751,11 @@ struct ieee80211_mgmt {
- 			/* followed by some of SSID, Supported rates,
- 			 * FH Params, DS Params, CF Params, IBSS Params, TIM */
- 			u8 variable[0];
--		} __attribute__ ((packed)) beacon;
-+		} __packed beacon;
- 		struct {
- 			/* only variable items: SSID, Supported rates */
- 			u8 variable[0];
--		} __attribute__ ((packed)) probe_req;
-+		} __packed probe_req;
- 		struct {
- 			__le64 timestamp;
- 			__le16 beacon_int;
-@@ -763,7 +763,7 @@ struct ieee80211_mgmt {
- 			/* followed by some of SSID, Supported rates,
- 			 * FH Params, DS Params, CF Params, IBSS Params */
- 			u8 variable[0];
--		} __attribute__ ((packed)) probe_resp;
-+		} __packed probe_resp;
- 		struct {
- 			u8 category;
- 			union {
-@@ -772,55 +772,55 @@ struct ieee80211_mgmt {
- 					u8 dialog_token;
- 					u8 status_code;
- 					u8 variable[0];
--				} __attribute__ ((packed)) wme_action;
-+				} __packed wme_action;
- 				struct{
- 					u8 action_code;
- 					u8 element_id;
- 					u8 length;
- 					struct ieee80211_channel_sw_ie sw_elem;
--				} __attribute__((packed)) chan_switch;
-+				} __packed chan_switch;
- 				struct{
- 					u8 action_code;
- 					u8 dialog_token;
- 					u8 element_id;
- 					u8 length;
- 					struct ieee80211_msrment_ie msr_elem;
--				} __attribute__((packed)) measurement;
-+				} __packed measurement;
- 				struct{
- 					u8 action_code;
- 					u8 dialog_token;
- 					__le16 capab;
- 					__le16 timeout;
- 					__le16 start_seq_num;
--				} __attribute__((packed)) addba_req;
-+				} __packed addba_req;
- 				struct{
- 					u8 action_code;
- 					u8 dialog_token;
- 					__le16 status;
- 					__le16 capab;
- 					__le16 timeout;
--				} __attribute__((packed)) addba_resp;
-+				} __packed addba_resp;
- 				struct{
- 					u8 action_code;
- 					__le16 params;
- 					__le16 reason_code;
--				} __attribute__((packed)) delba;
-+				} __packed delba;
- 				struct {
- 					u8 action_code;
- 					u8 variable[0];
--				} __attribute__((packed)) self_prot;
-+				} __packed self_prot;
- 				struct{
- 					u8 action_code;
- 					u8 variable[0];
--				} __attribute__((packed)) mesh_action;
-+				} __packed mesh_action;
- 				struct {
- 					u8 action;
- 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
--				} __attribute__ ((packed)) sa_query;
-+				} __packed sa_query;
- 				struct {
- 					u8 action;
- 					u8 smps_control;
--				} __attribute__ ((packed)) ht_smps;
-+				} __packed ht_smps;
- 				struct {
- 					u8 action_code;
- 					u8 dialog_token;
-@@ -828,9 +828,9 @@ struct ieee80211_mgmt {
- 					u8 variable[0];
- 				} __packed tdls_discover_resp;
- 			} u;
--		} __attribute__ ((packed)) action;
-+		} __packed action;
- 	} u;
--} __attribute__ ((packed));
-+} __packed;
- 
- /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
- #define BSS_MEMBERSHIP_SELECTOR_HT_PHY	127
-@@ -846,7 +846,7 @@ struct ieee80211_mmie {
- 	__le16 key_id;
- 	u8 sequence_number[6];
- 	u8 mic[8];
--} __attribute__ ((packed));
-+} __packed;
- 
- struct ieee80211_vendor_ie {
- 	u8 element_id;
-@@ -861,20 +861,20 @@ struct ieee80211_rts {
- 	__le16 duration;
- 	u8 ra[6];
- 	u8 ta[6];
--} __attribute__ ((packed));
-+} __packed;
- 
- struct ieee80211_cts {
- 	__le16 frame_control;
- 	__le16 duration;
- 	u8 ra[6];
--} __attribute__ ((packed));
-+} __packed;
- 
- struct ieee80211_pspoll {
- 	__le16 frame_control;
- 	__le16 aid;
- 	u8 bssid[6];
- 	u8 ta[6];
--} __attribute__ ((packed));
-+} __packed;
- 
- /* TDLS */
- 
-@@ -967,7 +967,7 @@ struct ieee80211_bar {
- 	__u8 ta[6];
- 	__le16 control;
- 	__le16 start_seq_num;
--} __attribute__((packed));
-+} __packed;
- 
- /* 802.11 BAR control masks */
- #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL	0x0000
-@@ -992,7 +992,7 @@ struct ieee80211_mcs_info {
- 	__le16 rx_highest;
- 	u8 tx_params;
- 	u8 reserved[3];
--} __attribute__((packed));
-+} __packed;
- 
- /* 802.11n HT capability MSC set */
- #define IEEE80211_HT_MCS_RX_HIGHEST_MASK	0x3ff
-@@ -1031,7 +1031,7 @@ struct ieee80211_ht_cap {
- 	__le16 extended_ht_cap_info;
- 	__le32 tx_BF_cap_info;
- 	u8 antenna_selection_info;
--} __attribute__ ((packed));
-+} __packed;
- 
- /* 802.11n HT capabilities masks (for cap_info) */
- #define IEEE80211_HT_CAP_LDPC_CODING		0x0001
-@@ -1102,7 +1102,7 @@ struct ieee80211_ht_operation {
- 	__le16 operation_mode;
- 	__le16 stbc_param;
- 	u8 basic_set[16];
--} __attribute__ ((packed));
-+} __packed;
- 
- /* for ht_param */
- #define IEEE80211_HT_PARAM_CHA_SEC_OFFSET		0x03
-@@ -1832,14 +1832,14 @@ struct ieee80211_country_ie_triplet {
- 			u8 first_channel;
- 			u8 num_channels;
- 			s8 max_power;
--		} __attribute__ ((packed)) chans;
-+		} __packed chans;
- 		struct {
- 			u8 reg_extension_id;
- 			u8 reg_class;
- 			u8 coverage_class;
--		} __attribute__ ((packed)) ext;
-+		} __packed ext;
- 	};
--} __attribute__ ((packed));
-+} __packed;
- 
- enum ieee80211_timeout_interval_type {
- 	WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */,
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -1256,7 +1256,7 @@ struct cfg80211_bss {
- 
- 	u8 bssid[ETH_ALEN];
- 
--	u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
-+	u8 priv[0] __aligned(sizeof(void *));
- };
- 
- /**
-@@ -2395,7 +2395,7 @@ struct wiphy {
- 	const struct iw_handler_def *wext;
- #endif
- 
--	char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
-+	char priv[0] __aligned(NETDEV_ALIGN);
- };
- 
- static inline struct net *wiphy_net(struct wiphy *wiphy)
---- a/net/wireless/core.h
-+++ b/net/wireless/core.h
-@@ -86,7 +86,7 @@ struct cfg80211_registered_device {
- 
- 	/* must be last because of the way we do wiphy_priv(),
- 	 * and it should at least be aligned to NETDEV_ALIGN */
--	struct wiphy wiphy __attribute__((__aligned__(NETDEV_ALIGN)));
-+	struct wiphy wiphy __aligned(NETDEV_ALIGN);
- };
- 
- static inline
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -2578,7 +2578,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw
- 
- 	if (AR_SREV_9300_20_OR_LATER(ah)) {
- 		ah->enabled_cals |= TX_IQ_CAL;
--		if (AR_SREV_9485_OR_LATER(ah))
-+		if (AR_SREV_9485_OR_LATER(ah) && !AR_SREV_9340(ah))
- 			ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
+-void ath_flushrecv(struct ath_softc *sc)
+-{
+-	set_bit(SC_OP_RXFLUSH, &sc->sc_flags);
+-	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
+-		ath_rx_tasklet(sc, 1, true);
+-	ath_rx_tasklet(sc, 1, false);
+-	clear_bit(SC_OP_RXFLUSH, &sc->sc_flags);
+-}
+-
+ static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb)
+ {
+ 	/* Check whether the Beacon frame has DTIM indicating buffered bc/mc */
+@@ -735,6 +734,7 @@ static struct ath_buf *ath_get_next_rx_b
+ 			return NULL;
  	}
  
++	list_del(&bf->list);
+ 	if (!bf->bf_mpdu)
+ 		return bf;
+ 
+@@ -1057,9 +1057,6 @@ int ath_rx_tasklet(struct ath_softc *sc,
+ 
+ 	do {
+ 		bool decrypt_error = false;
+-		/* If handling rx interrupt and flush is in progress => exit */
+-		if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags) && (flush == 0))
+-			break;
+ 
+ 		memset(&rs, 0, sizeof(rs));
+ 		if (edma)
+@@ -1102,15 +1099,6 @@ int ath_rx_tasklet(struct ath_softc *sc,
+ 
+ 		ath_debug_stat_rx(sc, &rs);
+ 
+-		/*
+-		 * If we're asked to flush receive queue, directly
+-		 * chain it back at the queue without processing it.
+-		 */
+-		if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags)) {
+-			RX_STAT_INC(rx_drop_rxflush);
+-			goto requeue_drop_frag;
+-		}
+-
+ 		memset(rxs, 0, sizeof(struct ieee80211_rx_status));
+ 
+ 		rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp;
+@@ -1245,14 +1233,15 @@ requeue_drop_frag:
+ 			sc->rx.frag = NULL;
+ 		}
+ requeue:
++		list_add_tail(&bf->list, &sc->rx.rxbuf);
++		if (!flush)
++			continue;
++
+ 		if (edma) {
+-			list_add_tail(&bf->list, &sc->rx.rxbuf);
+ 			ath_rx_edma_buf_link(sc, qtype);
+ 		} else {
+-			list_move_tail(&bf->list, &sc->rx.rxbuf);
+ 			ath_rx_buf_link(sc, bf);
+-			if (!flush)
+-				ath9k_hw_rxena(ah);
++			ath9k_hw_rxena(ah);
+ 		}
+ 	} while (1);
+ 
diff --git a/package/mac80211/patches/301-pending-ath9k-ar9003-fix-OTP-register-offsets-for-AR9340.patch b/package/mac80211/patches/301-pending-ath9k-ar9003-fix-OTP-register-offsets-for-AR9340.patch
deleted file mode 100644
index 0519705b1c6..00000000000
--- a/package/mac80211/patches/301-pending-ath9k-ar9003-fix-OTP-register-offsets-for-AR9340.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From b4d6c33df61d95fa1e223101ca345f4c797e8823 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Sun, 9 Dec 2012 23:37:13 +0100
-Subject: [PATCH] ath9k: ar9003: fix OTP register offsets for AR9340
-
-Trying to access the OTP memory on the AR9340
-causes a data bus error like this:
-
-  Data bus error, epc == 86e84164, ra == 86e84164
-  Oops[#1]:
-  Cpu 0
-  $ 0   : 00000000 00000061 deadc0de 00000000
-  $ 4   : b8115f18 00015f18 00000007 00000004
-  $ 8   : 00000001 7c7c3c7c 7c7c7c7c 7c7c7c7c
-  $12   : 7c7c3c7c 001f0041 00000000 7c7c7c3c
-  $16   : 86ee0000 00015f18 00000000 00000007
-  $20   : 00000004 00000064 00000004 86d71c44
-  $24   : 00000000 86e6ca00
-  $28   : 86d70000 86d71b20 86ece0c0 86e84164
-  Hi    : 00000000
-  Lo    : 00000064
-  epc   : 86e84164 ath9k_hw_wait+0x58/0xb0 [ath9k_hw]
-      Tainted: G           O
-  ra    : 86e84164 ath9k_hw_wait+0x58/0xb0 [ath9k_hw]
-  Status: 1100d403    KERNEL EXL IE
-  Cause : 4080801c
-  PrId  : 0001974c (MIPS 74Kc)
-  Modules linked in: ath9k(O+) ath9k_common(O) ath9k_hw(O) ath(O) ar934x_nfc
-  mac80211(O) usbcore usb_common scsi_mod nls_base nand nand_ecc nand_ids
-  crc_ccitt cfg80211(O) compat(O) arc4 aes_generic crypto_blkcipher cryptomgr
-  aead crypto_hash crypto_algapi ledtrig_timer ledtrig_default_on leds_gpio
-  Process insmod (pid: 459, threadinfo=86d70000, task=87942140, tls=779ac440)
-  Stack : 802fb500 000200da 804db150 804e0000 87816130 86ee0000 00010000 86d71b88
-          86d71bc0 00000004 00000003 86e9fcd0 80305300 0002c0d0 86e74c50 800b4c20
-          000003e8 00000001 00000000 86ee0000 000003ff 86e9fd64 80305300 80123938
-          fffffffc 00000004 000058bc 00000000 86ea0000 86ee0000 000001ff 878d6000
-          99999999 86e9fdc0 86ee0fcc 86e9e664 0000c0d0 86ee0000 0000700000007000
-          ...
-  Call Trace:
-  [<86e84164>] ath9k_hw_wait+0x58/0xb0 [ath9k_hw]
-  [<86e9fcd0>] ath9k_hw_setup_statusring+0x16b8/0x1c7c [ath9k_hw]
-
-  Code: 0000a812  0040f809  00000000 <00531024> 1054000b  24020001  0c05b5dc  2404000a  26520001
-
-The cause of the error is that the OTP register
-offsets are different on the AR9340 than the
-actually used values.
-
-Cc: <stable@vger.kernel.org> # 3.0+
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
----
- drivers/net/wireless/ath/ath9k/ar9003_eeprom.h |    6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
-@@ -68,13 +68,13 @@
- #define AR9300_BASE_ADDR 0x3ff
- #define AR9300_BASE_ADDR_512 0x1ff
- 
--#define AR9300_OTP_BASE			0x14000
--#define AR9300_OTP_STATUS		0x15f18
-+#define AR9300_OTP_BASE			(AR_SREV_9340(ah) ? 0x30000 : 0x14000)
-+#define AR9300_OTP_STATUS		(AR_SREV_9340(ah) ? 0x30018 : 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		0x15f1c
-+#define AR9300_OTP_READ_DATA		(AR_SREV_9340(ah) ? 0x3001c : 0x15f1c)
- 
- enum targetPowerHTRates {
- 	HT_TARGET_RATE_0_8_16,
diff --git a/package/mac80211/patches/302-pending-ath9k-move-duplicated-debug-message-to-ath9k_hw_nvra.patch b/package/mac80211/patches/302-pending-ath9k-move-duplicated-debug-message-to-ath9k_hw_nvra.patch
deleted file mode 100644
index 8f3e04eddde..00000000000
--- a/package/mac80211/patches/302-pending-ath9k-move-duplicated-debug-message-to-ath9k_hw_nvra.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From cd3d888d569f5908c4345f7c99018f574c80a32b Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Sun, 9 Dec 2012 14:58:56 +0100
-Subject: [PATCH 1/4] ath9k: move duplicated debug message to
- 'ath9k_hw_nvram_read'
-
-The fill_eeprom functions are printing the same
-debug message in case the 'ath9k_hw_nvram_read'
-function fails. Remove the duplicated code from
-fill_eeprom functions and add the ath_dbg call
-directly into 'ath9k_hw_nvram_read'.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
----
- drivers/net/wireless/ath/ath9k/eeprom.c      |    8 +++++++-
- drivers/net/wireless/ath/ath9k/eeprom_4k.c   |    6 ++----
- drivers/net/wireless/ath/ath9k/eeprom_9287.c |    5 +----
- drivers/net/wireless/ath/ath9k/eeprom_def.c  |    5 +----
- 4 files changed, 11 insertions(+), 13 deletions(-)
-
---- a/drivers/net/wireless/ath/ath9k/eeprom.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
-@@ -115,7 +115,13 @@ void ath9k_hw_usb_gen_fill_eeprom(struct
- 
- bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data)
- {
--	return common->bus_ops->eeprom_read(common, off, data);
-+	bool ret;
-+
-+	ret = common->bus_ops->eeprom_read(common, off, data);
-+	if (!ret)
-+		ath_dbg(common, EEPROM, "Unable to read eeprom region\n");
-+
-+	return ret;
- }
- 
- void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
-@@ -37,11 +37,9 @@ static bool __ath9k_hw_4k_fill_eeprom(st
- 	int addr, eep_start_loc = 64;
- 
- 	for (addr = 0; addr < SIZE_EEPROM_4K; addr++) {
--		if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, eep_data)) {
--			ath_dbg(common, EEPROM,
--				"Unable to read eeprom region\n");
-+		if (!ath9k_hw_nvram_read(common, addr + eep_start_loc,
-+					 eep_data))
- 			return false;
--		}
- 		eep_data++;
- 	}
- 
---- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
-@@ -40,11 +40,8 @@ static bool __ath9k_hw_ar9287_fill_eepro
- 
- 	for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) {
- 		if (!ath9k_hw_nvram_read(common, addr + eep_start_loc,
--					 eep_data)) {
--			ath_dbg(common, EEPROM,
--				"Unable to read eeprom region\n");
-+					 eep_data))
- 			return false;
--		}
- 		eep_data++;
- 	}
- 
---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
-@@ -97,11 +97,8 @@ static bool __ath9k_hw_def_fill_eeprom(s
- 
- 	for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) {
- 		if (!ath9k_hw_nvram_read(common, addr + ar5416_eep_start_loc,
--					 eep_data)) {
--			ath_err(ath9k_hw_common(ah),
--				"Unable to read eeprom region\n");
-+					 eep_data))
- 			return false;
--		}
- 		eep_data++;
- 	}
- 	return true;
diff --git a/package/mac80211/patches/303-pending-ath9k-add-EEPROM-offset-to-debug-message.patch b/package/mac80211/patches/303-pending-ath9k-add-EEPROM-offset-to-debug-message.patch
deleted file mode 100644
index d0561938e81..00000000000
--- a/package/mac80211/patches/303-pending-ath9k-add-EEPROM-offset-to-debug-message.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 910b74fb0e0369b18aa689ab02c9413235c18f98 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Sun, 9 Dec 2012 16:47:35 +0100
-Subject: [PATCH 2/4] ath9k: add EEPROM offset to debug message
-
-Show the EEPROM offset of the failed read operation
-in 'ath9k_hw_nvram_read'. The debug message is more
-informative this way.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
----
- drivers/net/wireless/ath/ath9k/eeprom.c |    3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath9k/eeprom.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
-@@ -119,7 +119,8 @@ bool ath9k_hw_nvram_read(struct ath_comm
- 
- 	ret = common->bus_ops->eeprom_read(common, off, data);
- 	if (!ret)
--		ath_dbg(common, EEPROM, "Unable to read eeprom region\n");
-+		ath_dbg(common, EEPROM,
-+			"unable to read eeprom region at offset %u\n", off);
- 
- 	return ret;
- }
diff --git a/package/mac80211/patches/304-pending-ath9k-use-struct-ath_hw-as-the-first-argument-for-at.patch b/package/mac80211/patches/304-pending-ath9k-use-struct-ath_hw-as-the-first-argument-for-at.patch
deleted file mode 100644
index 9076522a8b7..00000000000
--- a/package/mac80211/patches/304-pending-ath9k-use-struct-ath_hw-as-the-first-argument-for-at.patch
+++ /dev/null
@@ -1,203 +0,0 @@
-From 26c22324cca2db37fa294156fd875100d95438f4 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Sun, 9 Dec 2012 15:19:01 +0100
-Subject: [PATCH 3/4] ath9k: use 'struct ath_hw *' as the first argument for
- 'ath9k_hw_nvram_read'
-
-The 'ath9k_hw_nvram_read' function takes a
-'struct ath_common *' as its first argument.
-Almost each of its caller has a 'struct ath_hw *'
-parameter in their argument list, and that is
-dereferenced in order to get the 'struct ath_common'
-pointer.
-
-Change the first argument of 'ath9k_hw_nvram_read'
-to be a 'struct ath_hw *', and remove the dereference
-calls from the callers.
-
-Also change the type of the first argument of the
-ar9300_eeprom_read_{byte,word} functions.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
----
- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |   17 ++++++++---------
- drivers/net/wireless/ath/ath9k/eeprom.c        |    3 ++-
- drivers/net/wireless/ath/ath9k/eeprom.h        |    2 +-
- drivers/net/wireless/ath/ath9k/eeprom_4k.c     |    6 ++----
- drivers/net/wireless/ath/ath9k/eeprom_9287.c   |    6 ++----
- drivers/net/wireless/ath/ath9k/eeprom_def.c    |    5 ++---
- 6 files changed, 17 insertions(+), 22 deletions(-)
-
---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
-@@ -3005,24 +3005,24 @@ static u32 ath9k_hw_ar9300_get_eeprom(st
- 	}
- }
- 
--static bool ar9300_eeprom_read_byte(struct ath_common *common, int address,
-+static bool ar9300_eeprom_read_byte(struct ath_hw *ah, int address,
- 				    u8 *buffer)
- {
- 	u16 val;
- 
--	if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val)))
-+	if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val)))
- 		return false;
- 
- 	*buffer = (val >> (8 * (address % 2))) & 0xff;
- 	return true;
- }
- 
--static bool ar9300_eeprom_read_word(struct ath_common *common, int address,
-+static bool ar9300_eeprom_read_word(struct ath_hw *ah, int address,
- 				    u8 *buffer)
- {
- 	u16 val;
- 
--	if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val)))
-+	if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val)))
- 		return false;
- 
- 	buffer[0] = val >> 8;
-@@ -3048,14 +3048,14 @@ static bool ar9300_read_eeprom(struct at
- 	 * the 16-bit word at that address
- 	 */
- 	if (address % 2 == 0) {
--		if (!ar9300_eeprom_read_byte(common, address--, buffer++))
-+		if (!ar9300_eeprom_read_byte(ah, address--, buffer++))
- 			goto error;
- 
- 		count--;
- 	}
- 
- 	for (i = 0; i < count / 2; i++) {
--		if (!ar9300_eeprom_read_word(common, address, buffer))
-+		if (!ar9300_eeprom_read_word(ah, address, buffer))
- 			goto error;
- 
- 		address -= 2;
-@@ -3063,7 +3063,7 @@ static bool ar9300_read_eeprom(struct at
- 	}
- 
- 	if (count % 2)
--		if (!ar9300_eeprom_read_byte(common, address, buffer))
-+		if (!ar9300_eeprom_read_byte(ah, address, buffer))
- 			goto error;
- 
- 	return true;
-@@ -3240,12 +3240,11 @@ static bool ar9300_check_eeprom_header(s
- static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
- 				       int mdata_size)
- {
--	struct ath_common *common = ath9k_hw_common(ah);
- 	u16 *data = (u16 *) mptr;
- 	int i;
- 
- 	for (i = 0; i < mdata_size / 2; i++, data++)
--		ath9k_hw_nvram_read(common, i, data);
-+		ath9k_hw_nvram_read(ah, i, data);
- 
- 	return 0;
- }
---- a/drivers/net/wireless/ath/ath9k/eeprom.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
-@@ -113,8 +113,9 @@ void ath9k_hw_usb_gen_fill_eeprom(struct
- 	}
- }
- 
--bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data)
-+bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data)
- {
-+	struct ath_common *common = ath9k_hw_common(ah);
- 	bool ret;
- 
- 	ret = common->bus_ops->eeprom_read(common, off, data);
---- a/drivers/net/wireless/ath/ath9k/eeprom.h
-+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
-@@ -663,7 +663,7 @@ int16_t ath9k_hw_interpolate(u16 target,
- 			     int16_t targetRight);
- bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize,
- 				    u16 *indexL, u16 *indexR);
--bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data);
-+bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data);
- void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data,
- 				  int eep_start_loc, int size);
- void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
-@@ -32,13 +32,11 @@ static int ath9k_hw_4k_get_eeprom_rev(st
- 
- static bool __ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
- {
--	struct ath_common *common = ath9k_hw_common(ah);
- 	u16 *eep_data = (u16 *)&ah->eeprom.map4k;
- 	int addr, eep_start_loc = 64;
- 
- 	for (addr = 0; addr < SIZE_EEPROM_4K; addr++) {
--		if (!ath9k_hw_nvram_read(common, addr + eep_start_loc,
--					 eep_data))
-+		if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data))
- 			return false;
- 		eep_data++;
- 	}
-@@ -194,7 +192,7 @@ static int ath9k_hw_4k_check_eeprom(stru
- 
- 
- 	if (!ath9k_hw_use_flash(ah)) {
--		if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET,
-+		if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
- 					 &magic)) {
- 			ath_err(common, "Reading Magic # failed\n");
- 			return false;
---- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
-@@ -33,14 +33,12 @@ static int ath9k_hw_ar9287_get_eeprom_re
- static bool __ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah)
- {
- 	struct ar9287_eeprom *eep = &ah->eeprom.map9287;
--	struct ath_common *common = ath9k_hw_common(ah);
- 	u16 *eep_data;
- 	int addr, eep_start_loc = AR9287_EEP_START_LOC;
- 	eep_data = (u16 *)eep;
- 
- 	for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) {
--		if (!ath9k_hw_nvram_read(common, addr + eep_start_loc,
--					 eep_data))
-+		if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data))
- 			return false;
- 		eep_data++;
- 	}
-@@ -187,7 +185,7 @@ static int ath9k_hw_ar9287_check_eeprom(
- 	struct ath_common *common = ath9k_hw_common(ah);
- 
- 	if (!ath9k_hw_use_flash(ah)) {
--		if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET,
-+		if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
- 					 &magic)) {
- 			ath_err(common, "Reading Magic # failed\n");
- 			return false;
---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
-@@ -91,12 +91,11 @@ static int ath9k_hw_def_get_eeprom_rev(s
- 
- static bool __ath9k_hw_def_fill_eeprom(struct ath_hw *ah)
- {
--	struct ath_common *common = ath9k_hw_common(ah);
- 	u16 *eep_data = (u16 *)&ah->eeprom.def;
- 	int addr, ar5416_eep_start_loc = 0x100;
- 
- 	for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) {
--		if (!ath9k_hw_nvram_read(common, addr + ar5416_eep_start_loc,
-+		if (!ath9k_hw_nvram_read(ah, addr + ar5416_eep_start_loc,
- 					 eep_data))
- 			return false;
- 		eep_data++;
-@@ -268,7 +267,7 @@ static int ath9k_hw_def_check_eeprom(str
- 	bool need_swap = false;
- 	int i, addr, size;
- 
--	if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
-+	if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
- 		ath_err(common, "Reading Magic # failed\n");
- 		return false;
- 	}
diff --git a/package/mac80211/patches/305-pending-ath9k-allow-to-load-EEPROM-content-via-firmware-API.patch b/package/mac80211/patches/305-pending-ath9k-allow-to-load-EEPROM-content-via-firmware-API.patch
deleted file mode 100644
index d710d099ef3..00000000000
--- a/package/mac80211/patches/305-pending-ath9k-allow-to-load-EEPROM-content-via-firmware-API.patch
+++ /dev/null
@@ -1,184 +0,0 @@
-From ee4581f2f024c601a5e247ec6acab3e7df538f88 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Sun, 9 Dec 2012 17:31:54 +0100
-Subject: [PATCH 4/4] ath9k: allow to load EEPROM content via firmware API
-
-The calibration data for devices w/o a separate
-EEPROM chip can be specified via the 'eeprom_data'
-field of 'ath9k_platform_data'. The 'eeprom_data'
-is usually filled from board specific setup
-functions. It is easy if the EEPROM data is mapped
-to the memory, but it can be complicated if it is
-stored elsewhere.
-
-The patch adds support for loading of the EEPROM
-data via the firmware API to avoid this limitation.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
----
- drivers/net/wireless/ath/ath9k/eeprom.c |   19 +++++++++-
- drivers/net/wireless/ath/ath9k/hw.h     |    3 ++
- drivers/net/wireless/ath/ath9k/init.c   |   60 ++++++++++++++++++++++++++++++-
- include/linux/ath9k_platform.h          |    2 ++
- 4 files changed, 82 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/ath/ath9k/eeprom.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
-@@ -113,12 +113,29 @@ void ath9k_hw_usb_gen_fill_eeprom(struct
- 	}
- }
- 
-+static bool ath9k_hw_nvram_read_blob(struct ath_hw *ah, u32 off,
-+				     u16 *data)
-+{
-+	u16 *blob_data;
-+
-+	if (off * sizeof(u16) > ah->eeprom_blob->size)
-+		return false;
-+
-+	blob_data = (u16 *)ah->eeprom_blob->data;
-+	*data =  blob_data[off];
-+	return true;
-+}
-+
- bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data)
- {
- 	struct ath_common *common = ath9k_hw_common(ah);
- 	bool ret;
- 
--	ret = common->bus_ops->eeprom_read(common, off, data);
-+	if (ah->eeprom_blob)
-+		ret = ath9k_hw_nvram_read_blob(ah, off, data);
-+	else
-+		ret = common->bus_ops->eeprom_read(common, off, data);
-+
- 	if (!ret)
- 		ath_dbg(common, EEPROM,
- 			"unable to read eeprom region at offset %u\n", off);
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -20,6 +20,7 @@
- #include <linux/if_ether.h>
- #include <linux/delay.h>
- #include <linux/io.h>
-+#include <linux/firmware.h>
- 
- #include "mac.h"
- #include "ani.h"
-@@ -920,6 +921,8 @@ struct ath_hw {
- 	bool is_clk_25mhz;
- 	int (*get_mac_revision)(void);
- 	int (*external_reset)(void);
-+
-+	const struct firmware *eeprom_blob;
- };
- 
- struct ath_bus_ops {
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -25,6 +25,11 @@
- 
- #include "ath9k.h"
- 
-+struct ath9k_eeprom_ctx {
-+	struct completion complete;
-+	struct ath_hw *ah;
-+};
-+
- static char *dev_info = "ath9k";
- 
- MODULE_AUTHOR("Atheros Communications");
-@@ -508,6 +513,51 @@ static void ath9k_init_misc(struct ath_s
- 		sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT;
- }
- 
-+static void ath9k_eeprom_request_cb(const struct firmware *eeprom_blob,
-+				    void *ctx)
-+{
-+	struct ath9k_eeprom_ctx *ec = ctx;
-+
-+	if (eeprom_blob)
-+		ec->ah->eeprom_blob = eeprom_blob;
-+
-+	complete(&ec->complete);
-+}
-+
-+static int ath9k_eeprom_request(struct ath_softc *sc, const char *name)
-+{
-+	struct ath9k_eeprom_ctx ec;
-+	struct ath_hw *ah = ah = sc->sc_ah;
-+	int err;
-+
-+	/* try to load the EEPROM content asynchronously */
-+	init_completion(&ec.complete);
-+	ec.ah = sc->sc_ah;
-+
-+	err = request_firmware_nowait(THIS_MODULE, 1, name, sc->dev, GFP_KERNEL,
-+				      &ec, ath9k_eeprom_request_cb);
-+	if (err < 0) {
-+		ath_err(ath9k_hw_common(ah),
-+			"EEPROM request failed\n");
-+		return err;
-+	}
-+
-+	wait_for_completion(&ec.complete);
-+
-+	if (!ah->eeprom_blob) {
-+		ath_err(ath9k_hw_common(ah),
-+			"Unable to load EEPROM file %s\n", name);
-+		return -EINVAL;
-+	}
-+
-+	return 0;
-+}
-+
-+static void ath9k_eeprom_release(struct ath_softc *sc)
-+{
-+	release_firmware(sc->sc_ah->eeprom_blob);
-+}
-+
- static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
- 			    const struct ath_bus_ops *bus_ops)
- {
-@@ -585,6 +635,12 @@ static int ath9k_init_softc(u16 devid, s
- 	ath_read_cachesize(common, &csz);
- 	common->cachelsz = csz << 2; /* convert to bytes */
- 
-+	if (pdata && pdata->eeprom_name) {
-+		ret = ath9k_eeprom_request(sc, pdata->eeprom_name);
-+		if (ret)
-+			goto err_eeprom;
-+	}
-+
- 	/* Initializes the hardware for all supported chipsets */
- 	ret = ath9k_hw_init(ah);
- 	if (ret)
-@@ -621,7 +677,8 @@ err_btcoex:
- err_queues:
- 	ath9k_hw_deinit(ah);
- err_hw:
--
-+	ath9k_eeprom_release(sc);
-+err_eeprom:
- 	kfree(ah);
- 	sc->sc_ah = NULL;
- 
-@@ -884,6 +941,7 @@ static void ath9k_deinit_softc(struct at
- 	if (sc->dfs_detector != NULL)
- 		sc->dfs_detector->exit(sc->dfs_detector);
- 
-+	ath9k_eeprom_release(sc);
- 	kfree(sc->sc_ah);
- 	sc->sc_ah = NULL;
- }
---- a/include/linux/ath9k_platform.h
-+++ b/include/linux/ath9k_platform.h
-@@ -22,6 +22,8 @@
- #define ATH9K_PLAT_EEP_MAX_WORDS	2048
- 
- struct ath9k_platform_data {
-+	const char *eeprom_name;
-+
- 	u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
- 	u8 *macaddr;
- 
diff --git a/package/mac80211/patches/306-pending-rt2x00-zero-out-rx_status.patch b/package/mac80211/patches/306-pending-rt2x00-zero-out-rx_status.patch
deleted file mode 100644
index 884b9428020..00000000000
--- a/package/mac80211/patches/306-pending-rt2x00-zero-out-rx_status.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From e922d683ca8001ce9a6272d6ab12d74e72c36521 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Tue, 11 Dec 2012 14:15:53 +0100
-Subject: [PATCH v2] rt2x00: zero-out rx_status
-
-In commit 'mac80211: support radiotap vendor namespace RX data'
-new fields were added to 'struct ieee80211_rx_status' and those
-fileds must be zeroed. However the rt2x00 driver stores driver
-specific data in the cb array of the rx skbs, so the fields
-might contain garbage and this can cause unexpected behaviour.
-
-The rt2x00 driver from the compat-wireless-2012-12-01
-tarball caused the following warning:
-
-  WARNING: at
-  /devel/ramips/build_dir/target-mipsel_r2_uClibc-0.9.33.2/linux-ramips_rt305x/
-  compat-wireless-2012-12-01/net/mac80211/rx.c:115 ieee80211_rx_irqsafe+0x274/0xbcc
-  [mac80211]()
-  Modules linked in: dwc_otg ledtrig_usbdev nf_nat_irc
-  nf_nat_ftp nf_conntrack_irc nf_conntrack_ftp ipt_MASQUERADE
-  iptable_nat nf_nat pppoe xt_conntrack xt_CT xt_NOTRACK iptable_raw
-  xt_state nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack pppox
-  ipt_REJECT xt_TCPMSS xt_comment xt_multiport xt_mac xt_limit
-  iptable_mangle iptable_filter ip_tables xt_tcpudp x_tables ppp_async
-  ppp_generic slhc rt2800pci(O) rt2800lib(O) rt2x00soc(O) rt2x00pci(O)
-  rt2x00lib(O) mac80211(O) usbcore usb_common nls_base crc_itu_t
-  crc_ccitt eeprom_93cx6 cfg80211(O) compat(O) arc4 aes_generic
-  crypto_blkcipher cryptomgr aead crypto_hash crypto_algapi leds_gpio
-  button_hotplug(O) gpio_keys_polled input_polldev input_core
-  Call Trace:
-  [<801e96b4>] dump_stack+0x8/0x34
-  [<80010a9c>] warn_slowpath_common+0x78/0xa4
-  [<80010ae0>] warn_slowpath_null+0x18/0x24
-  [<80a9710c>] ieee80211_rx_irqsafe+0x274/0xbcc [mac80211]
-
-The patch ensures that each field gets initialized with
-zeroes.
-
-Cc: <users@rt2x00.serialmonkey.com>
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
----
-v2:
-  - update the commit message and add a comment to the code
-  - drop the ath5k and p54 patches
----
- drivers/net/wireless/rt2x00/rt2x00dev.c |    8 ++++++++
- 1 file changed, 8 insertions(+)
-
---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
-+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
-@@ -685,6 +685,14 @@ void rt2x00lib_rxdone(struct queue_entry
- 	 * to mac80211.
- 	 */
- 	rx_status = IEEE80211_SKB_RXCB(entry->skb);
-+
-+	/* Ensure that all fields of rx_status are initialized
-+	 * properly. The skb->cb array was used for driver
-+	 * specific informations, so rx_status might contain
-+	 * garbage.
-+	 */
-+	memset(rx_status, 0, sizeof(*rx_status));
-+
- 	rx_status->mactime = rxdesc.timestamp;
- 	rx_status->band = rt2x00dev->curr_band;
- 	rx_status->freq = rt2x00dev->curr_freq;
diff --git a/package/mac80211/patches/310-ap_scan.patch b/package/mac80211/patches/310-ap_scan.patch
index 81773105648..35a525581d1 100644
--- a/package/mac80211/patches/310-ap_scan.patch
+++ b/package/mac80211/patches/310-ap_scan.patch
@@ -1,6 +1,6 @@
 --- a/net/mac80211/cfg.c
 +++ b/net/mac80211/cfg.c
-@@ -1925,7 +1925,7 @@ static int ieee80211_scan(struct wiphy *
+@@ -1953,7 +1953,7 @@ static int ieee80211_scan(struct wiphy *
  		 * the  frames sent while scanning on other channel will be
  		 * lost)
  		 */
diff --git a/package/mac80211/patches/400-ath_move_debug_code.patch b/package/mac80211/patches/400-ath_move_debug_code.patch
index 690d67b82f1..c91128db61d 100644
--- a/package/mac80211/patches/400-ath_move_debug_code.patch
+++ b/package/mac80211/patches/400-ath_move_debug_code.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/Makefile
 +++ b/drivers/net/wireless/ath/Makefile
-@@ -9,7 +9,7 @@ obj-$(CONFIG_ATH_COMMON)	+= ath.o
+@@ -10,7 +10,7 @@ obj-$(CONFIG_ATH_COMMON)	+= ath.o
  ath-objs :=	main.o \
  		regd.o \
  		hw.o \
diff --git a/package/mac80211/patches/403-ath_regd_optional.patch b/package/mac80211/patches/403-ath_regd_optional.patch
index 1854c271e52..40163e9ad73 100644
--- a/package/mac80211/patches/403-ath_regd_optional.patch
+++ b/package/mac80211/patches/403-ath_regd_optional.patch
@@ -1,8 +1,8 @@
 --- a/drivers/net/wireless/ath/regd.c
 +++ b/drivers/net/wireless/ath/regd.c
-@@ -200,6 +200,10 @@ ath_reg_apply_beaconing_flags(struct wip
- 	u32 bandwidth = 0;
- 	int r;
+@@ -198,6 +198,10 @@ ath_reg_apply_beaconing_flags(struct wip
+ 	struct ieee80211_channel *ch;
+ 	unsigned int i;
  
 +#ifdef ATH_USER_REGD
 +	return;
@@ -11,9 +11,9 @@
  	for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  
  		if (!wiphy->bands[band])
-@@ -259,6 +263,10 @@ ath_reg_apply_active_scan_flags(struct w
- 	u32 bandwidth = 0;
- 	int r;
+@@ -252,6 +256,10 @@ ath_reg_apply_active_scan_flags(struct w
+ 	struct ieee80211_channel *ch;
+ 	const struct ieee80211_reg_rule *reg_rule;
  
 +#ifdef ATH_USER_REGD
 +	return;
@@ -22,7 +22,7 @@
  	sband = wiphy->bands[IEEE80211_BAND_2GHZ];
  	if (!sband)
  		return;
-@@ -308,6 +316,10 @@ static void ath_reg_apply_radar_flags(st
+@@ -301,6 +309,10 @@ static void ath_reg_apply_radar_flags(st
  	struct ieee80211_channel *ch;
  	unsigned int i;
  
@@ -33,7 +33,7 @@
  	if (!wiphy->bands[IEEE80211_BAND_5GHZ])
  		return;
  
-@@ -514,6 +526,10 @@ ath_regd_init_wiphy(struct ath_regulator
+@@ -507,6 +519,10 @@ ath_regd_init_wiphy(struct ath_regulator
  {
  	const struct ieee80211_regdomain *regd;
  
diff --git a/package/mac80211/patches/405-regd_no_assoc_hints.patch b/package/mac80211/patches/405-regd_no_assoc_hints.patch
index f3fef927eaa..170bc31886d 100644
--- a/package/mac80211/patches/405-regd_no_assoc_hints.patch
+++ b/package/mac80211/patches/405-regd_no_assoc_hints.patch
@@ -1,20 +1,19 @@
 --- a/net/wireless/reg.c
 +++ b/net/wireless/reg.c
-@@ -1805,6 +1805,8 @@ void regulatory_hint_11d(struct wiphy *w
+@@ -1717,6 +1717,8 @@ void regulatory_hint_11d(struct wiphy *w
  	enum environment_cap env = ENVIRON_ANY;
- 	struct regulatory_request *request;
+ 	struct regulatory_request *request, *lr;
  
 +	return;
 +
  	mutex_lock(&reg_mutex);
+ 	lr = get_last_request();
  
- 	if (unlikely(!last_request))
-@@ -2039,6 +2041,8 @@ static void restore_regulatory_settings(
+@@ -1913,6 +1915,7 @@ static void restore_regulatory_settings(
  
  void regulatory_hint_disconnect(void)
  {
 +	return;
-+
- 	REG_DBG_PRINT("All devices are disconnected, going to "
- 		      "restore regulatory settings\n");
+ 	REG_DBG_PRINT("All devices are disconnected, going to restore regulatory settings\n");
  	restore_regulatory_settings(false);
+ }
diff --git a/package/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch b/package/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
index 8f82da5e3e4..0d7f2526786 100644
--- a/package/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
+++ b/package/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -735,6 +735,7 @@ static const struct ieee80211_iface_limi
+@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  #endif
  				 BIT(NL80211_IFTYPE_AP) |
  				 BIT(NL80211_IFTYPE_P2P_GO) },
diff --git a/package/mac80211/patches/411-ath5k_allow_adhoc_and_ap.patch b/package/mac80211/patches/411-ath5k_allow_adhoc_and_ap.patch
index 4f66aca7363..6ddf1a8d045 100644
--- a/package/mac80211/patches/411-ath5k_allow_adhoc_and_ap.patch
+++ b/package/mac80211/patches/411-ath5k_allow_adhoc_and_ap.patch
@@ -18,7 +18,7 @@
  		goto end;
 --- a/drivers/net/wireless/ath/ath5k/base.c
 +++ b/drivers/net/wireless/ath/ath5k/base.c
-@@ -1878,7 +1878,7 @@ ath5k_beacon_send(struct ath5k_hw *ah)
+@@ -1867,7 +1867,7 @@ ath5k_beacon_send(struct ath5k_hw *ah)
  	}
  
  	if ((ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs +
@@ -27,7 +27,7 @@
  			ah->opmode == NL80211_IFTYPE_MESH_POINT) {
  		u64 tsf = ath5k_hw_get_tsf64(ah);
  		u32 tsftu = TSF_TO_TU(tsf);
-@@ -1964,7 +1964,7 @@ ath5k_beacon_update_timers(struct ath5k_
+@@ -1953,7 +1953,7 @@ ath5k_beacon_update_timers(struct ath5k_
  
  	intval = ah->bintval & AR5K_BEACON_PERIOD;
  	if (ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs
@@ -36,7 +36,7 @@
  		intval /= ATH_BCBUF;	/* staggered multi-bss beacons */
  		if (intval < 15)
  			ATH5K_WARN(ah, "intval %u is too low, min 15\n",
-@@ -2428,6 +2428,7 @@ static const struct ieee80211_iface_limi
+@@ -2417,6 +2417,7 @@ static const struct ieee80211_iface_limi
  				 BIT(NL80211_IFTYPE_MESH_POINT) |
  #endif
  				 BIT(NL80211_IFTYPE_AP) },
diff --git a/package/mac80211/patches/501-ath9k-eeprom_endianess.patch b/package/mac80211/patches/501-ath9k-eeprom_endianess.patch
index 20282573f8f..210bb6693d4 100644
--- a/package/mac80211/patches/501-ath9k-eeprom_endianess.patch
+++ b/package/mac80211/patches/501-ath9k-eeprom_endianess.patch
@@ -71,7 +71,7 @@
  
 --- a/drivers/net/wireless/ath/ath9k/hw.h
 +++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -705,6 +705,7 @@ enum ath_cal_list {
+@@ -702,6 +702,7 @@ enum ath_cal_list {
  #define AH_USE_EEPROM   0x1
  #define AH_UNPLUGGED    0x2 /* The card has been physically removed. */
  #define AH_FASTCC       0x4
@@ -81,7 +81,7 @@
  	struct ath_ops reg_ops;
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -591,6 +591,8 @@ static int ath9k_init_softc(u16 devid, s
+@@ -582,6 +582,8 @@ static int ath9k_init_softc(u16 devid, s
  		ah->is_clk_25mhz = pdata->is_clk_25mhz;
  		ah->get_mac_revision = pdata->get_mac_revision;
  		ah->external_reset = pdata->external_reset;
diff --git a/package/mac80211/patches/502-ath9k_ahb_init.patch b/package/mac80211/patches/502-ath9k_ahb_init.patch
index 21461b57db1..c435b0b1b2c 100644
--- a/package/mac80211/patches/502-ath9k_ahb_init.patch
+++ b/package/mac80211/patches/502-ath9k_ahb_init.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -994,23 +994,23 @@ static int __init ath9k_init(void)
+@@ -955,23 +955,23 @@ static int __init ath9k_init(void)
  		goto err_out;
  	}
  
diff --git a/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
index 96c9a3175f7..a3d322f6f27 100644
--- a/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
+++ b/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/hw.c
 +++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1962,8 +1962,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -1954,8 +1954,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  		REG_WRITE(ah, AR_OBS, 8);
  
  	if (ah->config.rx_intr_mitigation) {
diff --git a/package/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/mac80211/patches/511-ath9k_reduce_rxbuf.patch
index db13fea1bc1..8d8c5fd7fe6 100644
--- a/package/mac80211/patches/511-ath9k_reduce_rxbuf.patch
+++ b/package/mac80211/patches/511-ath9k_reduce_rxbuf.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -122,7 +122,7 @@ void ath_descdma_cleanup(struct ath_soft
+@@ -119,7 +119,7 @@ int ath_descdma_setup(struct ath_softc *
  /* RX / TX */
  /***********/
  
diff --git a/package/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/mac80211/patches/512-ath9k_channelbw_debugfs.patch
index ff3a38eb589..2dfed5915cd 100644
--- a/package/mac80211/patches/512-ath9k_channelbw_debugfs.patch
+++ b/package/mac80211/patches/512-ath9k_channelbw_debugfs.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -679,6 +679,7 @@ struct ath_softc {
+@@ -674,6 +674,7 @@ struct ath_softc {
  	struct ieee80211_hw *hw;
  	struct device *dev;
  
@@ -8,7 +8,7 @@
  	struct survey_info *cur_survey;
  	struct survey_info survey[ATH9K_NUM_CHANNELS];
  
-@@ -751,6 +752,7 @@ struct ath_softc {
+@@ -746,6 +747,7 @@ struct ath_softc {
  #endif
  };
  
diff --git a/package/mac80211/patches/513-mac80211_reduce_txqueuelen.patch b/package/mac80211/patches/513-mac80211_reduce_txqueuelen.patch
index bb72e8e2d49..498b4a7aad8 100644
--- a/package/mac80211/patches/513-mac80211_reduce_txqueuelen.patch
+++ b/package/mac80211/patches/513-mac80211_reduce_txqueuelen.patch
@@ -1,6 +1,6 @@
 --- a/net/mac80211/iface.c
 +++ b/net/mac80211/iface.c
-@@ -1046,6 +1046,7 @@ static const struct net_device_ops ieee8
+@@ -1033,6 +1033,7 @@ static const struct net_device_ops ieee8
  static void ieee80211_if_setup(struct net_device *dev)
  {
  	ether_setup(dev);
diff --git a/package/mac80211/patches/520-mac80211_cur_txpower.patch b/package/mac80211/patches/520-mac80211_cur_txpower.patch
index cc049f7c992..4dac65c776b 100644
--- a/package/mac80211/patches/520-mac80211_cur_txpower.patch
+++ b/package/mac80211/patches/520-mac80211_cur_txpower.patch
@@ -10,7 +10,7 @@
  };
 --- a/net/mac80211/cfg.c
 +++ b/net/mac80211/cfg.c
-@@ -2105,7 +2105,9 @@ static int ieee80211_get_tx_power(struct
+@@ -2133,7 +2133,9 @@ static int ieee80211_get_tx_power(struct
  	struct ieee80211_local *local = wiphy_priv(wiphy);
  	struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
  
diff --git a/package/mac80211/patches/522-ath9k_per_chain_signal_strength.patch b/package/mac80211/patches/522-ath9k_per_chain_signal_strength.patch
index ee31e8f5969..544ae80035a 100644
--- a/package/mac80211/patches/522-ath9k_per_chain_signal_strength.patch
+++ b/package/mac80211/patches/522-ath9k_per_chain_signal_strength.patch
@@ -21,7 +21,7 @@
  	u8 vendor_radiotap_oui[3];
 --- a/net/mac80211/sta_info.h
 +++ b/net/mac80211/sta_info.h
-@@ -329,6 +329,11 @@ struct sta_info {
+@@ -335,6 +335,11 @@ struct sta_info {
  	int last_signal;
  	struct ewma avg_signal;
  	int last_ack_signal;
@@ -65,7 +65,7 @@
  	 * exchange sequence.
 --- a/net/mac80211/sta_info.c
 +++ b/net/mac80211/sta_info.c
-@@ -324,6 +324,8 @@ struct sta_info *sta_info_alloc(struct i
+@@ -356,6 +356,8 @@ struct sta_info *sta_info_alloc(struct i
  	do_posix_clock_monotonic_gettime(&uptime);
  	sta->last_connected = uptime.tv_sec;
  	ewma_init(&sta->avg_signal, 1024, 8);
@@ -135,7 +135,7 @@
  	u8 rs_num_delims;
 --- a/drivers/net/wireless/ath/ath9k/recv.c
 +++ b/drivers/net/wireless/ath/ath9k/recv.c
-@@ -955,6 +955,7 @@ static int ath9k_rx_skb_preprocess(struc
+@@ -946,6 +946,7 @@ static int ath9k_rx_skb_preprocess(struc
  				   bool *decrypt_error)
  {
  	struct ath_hw *ah = common->ah;
@@ -143,7 +143,7 @@
  
  	/*
  	 * everything but the rate is checked here, the rate check is done
-@@ -980,6 +981,20 @@ static int ath9k_rx_skb_preprocess(struc
+@@ -971,6 +972,20 @@ static int ath9k_rx_skb_preprocess(struc
  	if (rx_stats->rs_moreaggr)
  		rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
  
@@ -248,7 +248,7 @@
  	RX_SAMP_DBG(rate) = rs->rs_rate;
 --- a/include/uapi/linux/nl80211.h
 +++ b/include/uapi/linux/nl80211.h
-@@ -1834,6 +1834,8 @@ enum nl80211_sta_bss_param {
+@@ -1838,6 +1838,8 @@ enum nl80211_sta_bss_param {
   * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
   * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
   * @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64)
@@ -257,7 +257,7 @@
   * @__NL80211_STA_INFO_AFTER_LAST: internal
   * @NL80211_STA_INFO_MAX: highest possible station info attribute
   */
-@@ -1858,6 +1860,8 @@ enum nl80211_sta_info {
+@@ -1862,6 +1864,8 @@ enum nl80211_sta_info {
  	NL80211_STA_INFO_STA_FLAGS,
  	NL80211_STA_INFO_BEACON_LOSS,
  	NL80211_STA_INFO_T_OFFSET,
diff --git a/package/mac80211/patches/523-mac80211_configure_antenna_gain.patch b/package/mac80211/patches/523-mac80211_configure_antenna_gain.patch
index 844d4537b4b..ddf35000316 100644
--- a/package/mac80211/patches/523-mac80211_configure_antenna_gain.patch
+++ b/package/mac80211/patches/523-mac80211_configure_antenna_gain.patch
@@ -18,7 +18,7 @@
  	u8 ps_dtim_period;
 --- a/net/mac80211/ieee80211_i.h
 +++ b/net/mac80211/ieee80211_i.h
-@@ -1132,6 +1132,7 @@ struct ieee80211_local {
+@@ -1144,6 +1144,7 @@ struct ieee80211_local {
  	bool disable_dynamic_ps;
  
  	int user_power_level; /* in dBm, for all interfaces */
@@ -72,7 +72,7 @@
  		u32 tx_ant, rx_ant;
 --- a/net/mac80211/cfg.c
 +++ b/net/mac80211/cfg.c
-@@ -2127,6 +2127,19 @@ static int ieee80211_get_tx_power(struct
+@@ -2155,6 +2155,19 @@ static int ieee80211_get_tx_power(struct
  	return 0;
  }
  
@@ -92,7 +92,7 @@
  static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  				  const u8 *addr)
  {
-@@ -3250,6 +3263,7 @@ struct cfg80211_ops mac80211_config_ops 
+@@ -3278,6 +3291,7 @@ struct cfg80211_ops mac80211_config_ops 
  	.set_wiphy_params = ieee80211_set_wiphy_params,
  	.set_tx_power = ieee80211_set_tx_power,
  	.get_tx_power = ieee80211_get_tx_power,
@@ -152,7 +152,7 @@
  		local->hw.cur_power_level = power;
  		local->hw.conf.power_level = power;
  	}
-@@ -646,6 +659,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(
+@@ -582,6 +595,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;
diff --git a/package/mac80211/patches/524-ath9k_use_configured_antenna_gain.patch b/package/mac80211/patches/524-ath9k_use_configured_antenna_gain.patch
index 1315c7100d8..32467471da5 100644
--- a/package/mac80211/patches/524-ath9k_use_configured_antenna_gain.patch
+++ b/package/mac80211/patches/524-ath9k_use_configured_antenna_gain.patch
@@ -10,7 +10,7 @@
  
 --- a/drivers/net/wireless/ath/ath9k/hw.c
 +++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -2836,7 +2836,7 @@ void ath9k_hw_apply_txpower(struct ath_h
+@@ -2825,7 +2825,7 @@ 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/mac80211/patches/530-ath9k_extra_leds.patch b/package/mac80211/patches/530-ath9k_extra_leds.patch
index 9435122484f..7e982c44590 100644
--- a/package/mac80211/patches/530-ath9k_extra_leds.patch
+++ b/package/mac80211/patches/530-ath9k_extra_leds.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -556,6 +556,9 @@ struct ath9k_wow_pattern {
+@@ -551,6 +551,9 @@ struct ath9k_wow_pattern {
  void ath_init_leds(struct ath_softc *sc);
  void ath_deinit_leds(struct ath_softc *sc);
  void ath_fill_led_pin(struct ath_softc *sc);
@@ -10,7 +10,7 @@
  #else
  static inline void ath_init_leds(struct ath_softc *sc)
  {
-@@ -675,6 +678,13 @@ struct ath9k_vif_iter_data {
+@@ -670,6 +673,13 @@ struct ath9k_vif_iter_data {
  	int nadhocs;   /* number of adhoc vifs */
  };
  
@@ -24,7 +24,7 @@
  struct ath_softc {
  	struct ieee80211_hw *hw;
  	struct device *dev;
-@@ -716,9 +726,8 @@ struct ath_softc {
+@@ -711,9 +721,8 @@ struct ath_softc {
  	struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
  
  #ifdef CONFIG_MAC80211_LEDS
@@ -162,7 +162,7 @@
  void ath_fill_led_pin(struct ath_softc *sc)
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -878,7 +878,7 @@ int ath9k_init_device(u16 devid, struct 
+@@ -865,7 +865,7 @@ int ath9k_init_device(u16 devid, struct 
  
  #ifdef CONFIG_MAC80211_LEDS
  	/* must be initialized before ieee80211_register_hw */
diff --git a/package/mac80211/patches/540-mac80211_optimize_mcs_rate_mask.patch b/package/mac80211/patches/540-mac80211_optimize_mcs_rate_mask.patch
index adf8e1b7217..08be8ce30e5 100644
--- a/package/mac80211/patches/540-mac80211_optimize_mcs_rate_mask.patch
+++ b/package/mac80211/patches/540-mac80211_optimize_mcs_rate_mask.patch
@@ -1,6 +1,6 @@
 --- a/net/mac80211/ieee80211_i.h
 +++ b/net/mac80211/ieee80211_i.h
-@@ -761,6 +761,8 @@ struct ieee80211_sub_if_data {
+@@ -764,6 +764,8 @@ struct ieee80211_sub_if_data {
  
  	/* bitmap of allowed (non-MCS) rate indexes for rate control */
  	u32 rc_rateidx_mask[IEEE80211_NUM_BANDS];
@@ -11,7 +11,7 @@
  	union {
 --- a/net/mac80211/cfg.c
 +++ b/net/mac80211/cfg.c
-@@ -2300,9 +2300,20 @@ static int ieee80211_set_bitrate_mask(st
+@@ -2328,9 +2328,20 @@ static int ieee80211_set_bitrate_mask(st
  	}
  
  	for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
@@ -34,7 +34,7 @@
  	return 0;
 --- a/include/net/mac80211.h
 +++ b/include/net/mac80211.h
-@@ -3968,7 +3968,7 @@ void ieee80211_send_bar(struct ieee80211
+@@ -3985,7 +3985,7 @@ void ieee80211_send_bar(struct ieee80211
   *	(deprecated; this will be removed once drivers get updated to use
   *	rate_idx_mask)
   * @rate_idx_mask: user-requested (legacy) rate mask
@@ -43,7 +43,7 @@
   * @bss: whether this frame is sent out in AP or IBSS mode
   */
  struct ieee80211_tx_rate_control {
-@@ -3980,7 +3980,7 @@ struct ieee80211_tx_rate_control {
+@@ -3997,7 +3997,7 @@ struct ieee80211_tx_rate_control {
  	bool rts, short_preamble;
  	u8 max_rate_idx;
  	u32 rate_idx_mask;
diff --git a/package/mac80211/patches/542-mac80211_optimize_wireless_struct.patch b/package/mac80211/patches/542-mac80211_optimize_wireless_struct.patch
index 6b62d12b426..4080fd0b906 100644
--- a/package/mac80211/patches/542-mac80211_optimize_wireless_struct.patch
+++ b/package/mac80211/patches/542-mac80211_optimize_wireless_struct.patch
@@ -36,7 +36,7 @@
  
  /* Mesh flags */
  #define MESH_FLAGS_AE_A4 	0x1
-@@ -830,7 +830,7 @@ struct ieee80211_mgmt {
+@@ -839,7 +839,7 @@ struct ieee80211_mgmt {
  			} u;
  		} __packed action;
  	} u;
@@ -45,7 +45,7 @@
  
  /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
  #define BSS_MEMBERSHIP_SELECTOR_HT_PHY	127
-@@ -861,20 +861,20 @@ struct ieee80211_rts {
+@@ -870,20 +870,20 @@ struct ieee80211_rts {
  	__le16 duration;
  	u8 ra[6];
  	u8 ta[6];
diff --git a/package/mac80211/patches/553-ath9k_debugfs_diag.patch b/package/mac80211/patches/553-ath9k_debugfs_diag.patch
index 2590d92f428..986b6be1af7 100644
--- a/package/mac80211/patches/553-ath9k_debugfs_diag.patch
+++ b/package/mac80211/patches/553-ath9k_debugfs_diag.patch
@@ -62,7 +62,7 @@
  	debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
 --- a/drivers/net/wireless/ath/ath9k/hw.h
 +++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -498,6 +498,12 @@ enum {
+@@ -499,6 +499,12 @@ enum {
  	ATH9K_RESET_COLD,
  };
  
@@ -75,7 +75,7 @@
  struct ath9k_hw_version {
  	u32 magic;
  	u16 devid;
-@@ -742,6 +748,8 @@ struct ath_hw {
+@@ -740,6 +746,8 @@ struct ath_hw {
  	u32 rfkill_polarity;
  	u32 ah_flags;
  
@@ -84,7 +84,7 @@
  	bool reset_power_on;
  	bool htc_reset_init;
  
-@@ -1010,6 +1018,7 @@ void ath9k_hw_set_sta_beacon_timers(stru
+@@ -1007,6 +1015,7 @@ void ath9k_hw_set_sta_beacon_timers(stru
  bool ath9k_hw_check_alive(struct ath_hw *ah);
  
  bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
@@ -94,7 +94,7 @@
  void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause);
 --- a/drivers/net/wireless/ath/ath9k/hw.c
 +++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1762,6 +1762,20 @@ fail:
+@@ -1754,6 +1754,20 @@ fail:
  	return -EINVAL;
  }
  
@@ -115,7 +115,7 @@
  int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  		   struct ath9k_hw_cal_data *caldata, bool fastcc)
  {
-@@ -2039,6 +2053,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -2031,6 +2045,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  	}
  
  	ath9k_hw_apply_gpio_override(ah);
diff --git a/package/mac80211/patches/555-ath9k-allow-to-disable-bands-via-platform-data.patch b/package/mac80211/patches/555-ath9k-allow-to-disable-bands-via-platform-data.patch
index 37a09b25aa0..ff0d8ec63a5 100644
--- a/package/mac80211/patches/555-ath9k-allow-to-disable-bands-via-platform-data.patch
+++ b/package/mac80211/patches/555-ath9k-allow-to-disable-bands-via-platform-data.patch
@@ -12,7 +12,7 @@
  
 --- a/drivers/net/wireless/ath/ath9k/hw.c
 +++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -2429,17 +2429,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
+@@ -2421,17 +2421,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
  	}
  
  	eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
@@ -48,7 +48,7 @@
  	    AR_SREV_9285(ah) ||
 --- a/drivers/net/wireless/ath/ath9k/hw.h
 +++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -930,6 +930,8 @@ struct ath_hw {
+@@ -927,6 +927,8 @@ struct ath_hw {
  	bool is_clk_25mhz;
  	int (*get_mac_revision)(void);
  	int (*external_reset)(void);
@@ -59,7 +59,7 @@
  };
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -591,6 +591,8 @@ static int ath9k_init_softc(u16 devid, s
+@@ -582,6 +582,8 @@ static int ath9k_init_softc(u16 devid, s
  		ah->is_clk_25mhz = pdata->is_clk_25mhz;
  		ah->get_mac_revision = pdata->get_mac_revision;
  		ah->external_reset = pdata->external_reset;
diff --git a/package/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
index 9897291322d..ba82930676c 100644
--- a/package/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
+++ b/package/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
@@ -186,29 +186,34 @@
  obj-$(CONFIG_RT2X00_LIB_PCI)		+= rt2x00pci.o
 --- a/drivers/net/wireless/rt2x00/rt2800pci.c
 +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -89,20 +89,10 @@ static void rt2800pci_mcu_status(struct 
+@@ -89,25 +89,11 @@ static void rt2800pci_mcu_status(struct 
  	rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
  }
  
 -#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X)
- static void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
+ static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
  {
 -	void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE);
 -
+-	if (!base_addr)
+-		return -ENOMEM;
+-
 -	memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE);
 -
 -	iounmap(base_addr);
 +	memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data, EEPROM_SIZE);
+ 	return 0;
  }
 -#else
--static inline void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
+-static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
 -{
+-	return -ENOMEM;
 -}
 -#endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */
  
  #ifdef CONFIG_PCI
  static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom)
-@@ -322,6 +312,20 @@ static int rt2800pci_write_firmware(stru
+@@ -331,6 +317,20 @@ static int rt2800pci_write_firmware(stru
  }
  
  /*
@@ -229,7 +234,7 @@
   * Initialization functions.
   */
  static bool rt2800pci_get_entry_state(struct queue_entry *entry)
-@@ -1033,6 +1037,7 @@ static const struct rt2x00lib_ops rt2800
+@@ -1046,6 +1046,7 @@ static const struct rt2x00lib_ops rt2800
  	.get_firmware_name	= rt2800pci_get_firmware_name,
  	.check_firmware		= rt2800_check_firmware,
  	.load_firmware		= rt2800_load_firmware,
diff --git a/package/mac80211/patches/605-rt2x00-pci-eeprom.patch b/package/mac80211/patches/605-rt2x00-pci-eeprom.patch
index fbc86199a4b..8001789aa86 100644
--- a/package/mac80211/patches/605-rt2x00-pci-eeprom.patch
+++ b/package/mac80211/patches/605-rt2x00-pci-eeprom.patch
@@ -4,22 +4,22 @@
  	rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
  }
  
--static void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
+-static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
 +static void rt2800pci_read_eeprom_file(struct rt2x00_dev *rt2x00dev)
  {
  	memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data, EEPROM_SIZE);
- }
-@@ -976,8 +976,9 @@ static irqreturn_t rt2800pci_interrupt(i
-  */
- static void rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev)
+ 	return 0;
+@@ -983,8 +983,9 @@ static int rt2800pci_read_eeprom(struct 
  {
+ 	int retval;
+ 
 -	if (rt2x00_is_soc(rt2x00dev))
--		rt2800pci_read_eeprom_soc(rt2x00dev);
+-		retval = rt2800pci_read_eeprom_soc(rt2x00dev);
 +	if (rt2x00_is_soc(rt2x00dev) ||
 +	    test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags))
 +		rt2800pci_read_eeprom_file(rt2x00dev);
  	else if (rt2800pci_efuse_detect(rt2x00dev))
- 		rt2800pci_read_eeprom_efuse(rt2x00dev);
+ 		retval = rt2800pci_read_eeprom_efuse(rt2x00dev);
  	else
 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c
 +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
diff --git a/package/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch b/package/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
index 590b95374a0..2581686614c 100644
--- a/package/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
+++ b/package/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
@@ -22,90 +22,92 @@
  		rt2800_bbp_write(rt2x00dev, 86, 0);
  	}
  
-@@ -3890,6 +3893,7 @@ static int rt2800_init_rfcsr(struct rt2x
- 	 * Init RF calibration.
- 	 */
+@@ -3671,6 +3674,7 @@ static int rt2800_init_bbp(struct rt2x00
+ 		rt2800_bbp_write(rt2x00dev, 120, 0x50);
+ 
  	if (rt2x00_rt(rt2x00dev, RT3290) ||
 +	    rt2x00_rt(rt2x00dev, RT3352) ||
  	    rt2x00_rt(rt2x00dev, RT5390) ||
- 	    rt2x00_rt(rt2x00dev, RT5392)) {
- 		rt2800_rfcsr_read(rt2x00dev, 2, &rfcsr);
-@@ -4076,6 +4080,10 @@ static int rt2800_init_rfcsr(struct rt2x
- 		rt2800_rfcsr_write(rt2x00dev, 31, 0x00);
- 		return 0;
- 	} else if (rt2x00_rt(rt2x00dev, RT3352)) {
-+		int tx0_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX0,
-+					  &rt2x00dev->cap_flags);
-+		int tx1_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX1,
-+					  &rt2x00dev->cap_flags);
- 		rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
- 		rt2800_rfcsr_write(rt2x00dev, 1, 0x23);
- 		rt2800_rfcsr_write(rt2x00dev, 2, 0x50);
-@@ -4109,15 +4117,30 @@ static int rt2800_init_rfcsr(struct rt2x
- 		rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
- 		rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
- 		rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
--		rt2800_rfcsr_write(rt2x00dev, 34, 0x01);
-+		rfcsr =  0x01;
-+		if (!tx0_int_pa)
-+			rt2x00_set_field8(&rfcsr, RFCSR34_TX0_EXT_PA, 1);
-+		if (!tx1_int_pa)
-+			rt2x00_set_field8(&rfcsr, RFCSR34_TX1_EXT_PA, 1);
-+		rt2800_rfcsr_write(rt2x00dev, 34, rfcsr );
- 		rt2800_rfcsr_write(rt2x00dev, 35, 0x03);
- 		rt2800_rfcsr_write(rt2x00dev, 36, 0xbd);
- 		rt2800_rfcsr_write(rt2x00dev, 37, 0x3c);
- 		rt2800_rfcsr_write(rt2x00dev, 38, 0x5f);
- 		rt2800_rfcsr_write(rt2x00dev, 39, 0xc5);
- 		rt2800_rfcsr_write(rt2x00dev, 40, 0x33);
--		rt2800_rfcsr_write(rt2x00dev, 41, 0x5b);
--		rt2800_rfcsr_write(rt2x00dev, 42, 0x5b);
-+		rfcsr = 0x52;
-+		if (tx0_int_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) {
-+			rt2x00_set_field8(&rfcsr, RFCSR42_BIT1, 1);
-+			rt2x00_set_field8(&rfcsr, RFCSR42_BIT4, 1);
-+		}
-+		rt2800_rfcsr_write(rt2x00dev, 42, rfcsr);
- 		rt2800_rfcsr_write(rt2x00dev, 43, 0xdb);
- 		rt2800_rfcsr_write(rt2x00dev, 44, 0xdb);
- 		rt2800_rfcsr_write(rt2x00dev, 45, 0xdb);
-@@ -4125,15 +4148,20 @@ static int rt2800_init_rfcsr(struct rt2x
- 		rt2800_rfcsr_write(rt2x00dev, 47, 0x0d);
- 		rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
- 		rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
--		rt2800_rfcsr_write(rt2x00dev, 50, 0x2d);
--		rt2800_rfcsr_write(rt2x00dev, 51, 0x7f);
--		rt2800_rfcsr_write(rt2x00dev, 52, 0x00);
--		rt2800_rfcsr_write(rt2x00dev, 53, 0x52);
--		rt2800_rfcsr_write(rt2x00dev, 54, 0x1b);
--		rt2800_rfcsr_write(rt2x00dev, 55, 0x7f);
--		rt2800_rfcsr_write(rt2x00dev, 56, 0x00);
--		rt2800_rfcsr_write(rt2x00dev, 57, 0x52);
--		rt2800_rfcsr_write(rt2x00dev, 58, 0x1b);
-+		rfcsr =  0x2d;
-+		if (!tx0_int_pa)
-+			rt2x00_set_field8(&rfcsr, RFCSR50_TX0_EXT_PA, 1);
-+		if (!tx1_int_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, 59, 0x00);
- 		rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
- 		rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
-@@ -4894,7 +4922,8 @@ static int rt2800_init_eeprom(struct rt2
+ 	    rt2x00_rt(rt2x00dev, RT5392))
+ 		rt2800_bbp_write(rt2x00dev, 128, 0x12);
+@@ -3977,6 +3981,12 @@ 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,
++				  &rt2x00dev->cap_flags);
++	int tx1_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX1,
++				  &rt2x00dev->cap_flags);
++	u8 rfcsr;
++
+ 	rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
+ 	rt2800_rfcsr_write(rt2x00dev, 1, 0x23);
+ 	rt2800_rfcsr_write(rt2x00dev, 2, 0x50);
+@@ -4010,15 +4020,30 @@ static void rt2800_init_rfcsr_3352(struc
+ 	rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
+ 	rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
+ 	rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
+-	rt2800_rfcsr_write(rt2x00dev, 34, 0x01);
++	rfcsr = 0x01;
++	if (!tx0_int_pa)
++		rt2x00_set_field8(&rfcsr, RFCSR34_TX0_EXT_PA, 1);
++	if (!tx1_int_pa)
++		rt2x00_set_field8(&rfcsr, RFCSR34_TX1_EXT_PA, 1);
++	rt2800_rfcsr_write(rt2x00dev, 34, rfcsr );
+ 	rt2800_rfcsr_write(rt2x00dev, 35, 0x03);
+ 	rt2800_rfcsr_write(rt2x00dev, 36, 0xbd);
+ 	rt2800_rfcsr_write(rt2x00dev, 37, 0x3c);
+ 	rt2800_rfcsr_write(rt2x00dev, 38, 0x5f);
+ 	rt2800_rfcsr_write(rt2x00dev, 39, 0xc5);
+ 	rt2800_rfcsr_write(rt2x00dev, 40, 0x33);
+-	rt2800_rfcsr_write(rt2x00dev, 41, 0x5b);
+-	rt2800_rfcsr_write(rt2x00dev, 42, 0x5b);
++	rfcsr = 0x52;
++	if (tx0_int_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) {
++		rt2x00_set_field8(&rfcsr, RFCSR42_BIT1, 1);
++		rt2x00_set_field8(&rfcsr, RFCSR42_BIT4, 1);
++	}
++	rt2800_rfcsr_write(rt2x00dev, 42, rfcsr);
+ 	rt2800_rfcsr_write(rt2x00dev, 43, 0xdb);
+ 	rt2800_rfcsr_write(rt2x00dev, 44, 0xdb);
+ 	rt2800_rfcsr_write(rt2x00dev, 45, 0xdb);
+@@ -4026,15 +4051,20 @@ static void rt2800_init_rfcsr_3352(struc
+ 	rt2800_rfcsr_write(rt2x00dev, 47, 0x0d);
+ 	rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
+ 	rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
+-	rt2800_rfcsr_write(rt2x00dev, 50, 0x2d);
+-	rt2800_rfcsr_write(rt2x00dev, 51, 0x7f);
+-	rt2800_rfcsr_write(rt2x00dev, 52, 0x00);
+-	rt2800_rfcsr_write(rt2x00dev, 53, 0x52);
+-	rt2800_rfcsr_write(rt2x00dev, 54, 0x1b);
+-	rt2800_rfcsr_write(rt2x00dev, 55, 0x7f);
+-	rt2800_rfcsr_write(rt2x00dev, 56, 0x00);
+-	rt2800_rfcsr_write(rt2x00dev, 57, 0x52);
+-	rt2800_rfcsr_write(rt2x00dev, 58, 0x1b);
++	rfcsr = 0x2d;
++	if (!tx0_int_pa)
++		rt2x00_set_field8(&rfcsr, RFCSR50_TX0_EXT_PA, 1);
++	if (!tx1_int_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, 59, 0x00);
+ 	rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
+ 	rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
+@@ -4950,7 +4980,8 @@ static int rt2800_init_eeprom(struct rt2
  	/*
  	 * Detect if this device has Bluetooth co-existence.
  	 */
@@ -115,7 +117,7 @@
  		__set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags);
  
  	/*
-@@ -4923,6 +4952,22 @@ static int rt2800_init_eeprom(struct rt2
+@@ -4979,6 +5010,22 @@ static int rt2800_init_eeprom(struct rt2
  					EIRP_MAX_TX_POWER_LIMIT)
  		__set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
  
diff --git a/package/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch b/package/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
index 81270e6b490..145a4f9c229 100644
--- a/package/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
+++ b/package/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
-@@ -5112,6 +5112,27 @@ static const struct rf_channel rf_vals_3
+@@ -5170,6 +5170,27 @@ static const struct rf_channel rf_vals_3
  	{173, 0x61, 0, 9},
  };
  
@@ -28,7 +28,7 @@
  static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  {
  	struct hw_mode_spec *spec = &rt2x00dev->spec;
-@@ -5190,7 +5211,6 @@ static int rt2800_probe_hw_mode(struct r
+@@ -5248,7 +5269,6 @@ static int rt2800_probe_hw_mode(struct r
  		   rt2x00_rf(rt2x00dev, RF3022) ||
  		   rt2x00_rf(rt2x00dev, RF3290) ||
  		   rt2x00_rf(rt2x00dev, RF3320) ||
@@ -36,7 +36,7 @@
  		   rt2x00_rf(rt2x00dev, RF5360) ||
  		   rt2x00_rf(rt2x00dev, RF5370) ||
  		   rt2x00_rf(rt2x00dev, RF5372) ||
-@@ -5198,6 +5218,12 @@ static int rt2800_probe_hw_mode(struct r
+@@ -5256,6 +5276,12 @@ static int rt2800_probe_hw_mode(struct r
  		   rt2x00_rf(rt2x00dev, RF5392)) {
  		spec->num_channels = 14;
  		spec->channels = rf_vals_3x;
@@ -49,7 +49,7 @@
  	} else if (rt2x00_rf(rt2x00dev, RF3052)) {
  		spec->supported_bands |= SUPPORT_BAND_5GHZ;
  		spec->num_channels = ARRAY_SIZE(rf_vals_3x);
-@@ -5291,6 +5317,19 @@ static int rt2800_probe_hw_mode(struct r
+@@ -5349,6 +5375,19 @@ static int rt2800_probe_hw_mode(struct r
  	return 0;
  }
  
@@ -69,7 +69,7 @@
  int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  {
  	int retval;
-@@ -5316,6 +5355,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
+@@ -5374,6 +5413,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  	rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  
  	/*
diff --git a/package/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch b/package/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch
index f44ff459ead..cb4a4958d6c 100644
--- a/package/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch
+++ b/package/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/mwl8k.c
 +++ b/drivers/net/wireless/mwl8k.c
-@@ -5320,6 +5320,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
+@@ -5389,6 +5389,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
  MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API));
  
  static DEFINE_PCI_DEVICE_TABLE(mwl8k_pci_id_table) = {
diff --git a/package/mac80211/patches/800-b43-gpio-mask-module-option.patch b/package/mac80211/patches/800-b43-gpio-mask-module-option.patch
index cc1bde4c053..d8fb06de57b 100644
--- a/package/mac80211/patches/800-b43-gpio-mask-module-option.patch
+++ b/package/mac80211/patches/800-b43-gpio-mask-module-option.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/b43/b43.h
 +++ b/drivers/net/wireless/b43/b43.h
-@@ -807,6 +807,7 @@ struct b43_wldev {
+@@ -812,6 +812,7 @@ struct b43_wldev {
  	bool qos_enabled;		/* TRUE, if QoS is used. */
  	bool hwcrypto_enabled;		/* TRUE, if HW crypto acceleration is enabled. */
  	bool use_pio;			/* TRUE if next init should use PIO */
@@ -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,
-@@ -2712,10 +2717,10 @@ static int b43_gpio_init(struct b43_wlde
+@@ -2740,10 +2745,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/mac80211/patches/820-b43-add-antenna-control.patch b/package/mac80211/patches/820-b43-add-antenna-control.patch
index a2a3873fc5a..8b6255f2c03 100644
--- a/package/mac80211/patches/820-b43-add-antenna-control.patch
+++ b/package/mac80211/patches/820-b43-add-antenna-control.patch
@@ -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. */
-@@ -3073,8 +3073,8 @@ static int b43_chip_init(struct b43_wlde
+@@ -3101,8 +3101,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);
-@@ -3818,7 +3818,6 @@ static int b43_op_config(struct ieee8021
+@@ -3846,7 +3846,6 @@ static int b43_op_config(struct ieee8021
  	struct b43_wldev *dev;
  	struct b43_phy *phy;
  	struct ieee80211_conf *conf = &hw->conf;
@@ -28,7 +28,7 @@
  	int err = 0;
  	bool reload_bss = false;
  
-@@ -3872,11 +3871,9 @@ static int b43_op_config(struct ieee8021
+@@ -3900,11 +3899,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) {
-@@ -5002,6 +4999,47 @@ static int b43_op_get_survey(struct ieee
+@@ -5030,6 +5027,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,
-@@ -5023,6 +5061,8 @@ static const struct ieee80211_ops b43_hw
+@@ -5051,6 +5089,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.
-@@ -5269,6 +5309,8 @@ static int b43_one_core_attach(struct b4
+@@ -5297,6 +5337,8 @@ static int b43_one_core_attach(struct b4
  	if (!wldev)
  		goto out;
  
@@ -108,7 +108,7 @@
  	wldev->use_pio = b43_modparam_pio;
  	wldev->dev = dev;
  	wldev->wl = wl;
-@@ -5359,6 +5401,9 @@ static struct b43_wl *b43_wireless_init(
+@@ -5387,6 +5429,9 @@ static struct b43_wl *b43_wireless_init(
  
  	hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  
@@ -120,7 +120,7 @@
  	SET_IEEE80211_DEV(hw, dev->dev);
 --- a/drivers/net/wireless/b43/b43.h
 +++ b/drivers/net/wireless/b43/b43.h
-@@ -808,6 +808,8 @@ struct b43_wldev {
+@@ -813,6 +813,8 @@ struct b43_wldev {
  	bool hwcrypto_enabled;		/* TRUE, if HW crypto acceleration is enabled. */
  	bool use_pio;			/* TRUE if next init should use PIO */
  	int gpiomask;			/* GPIO LED mask as a module parameter */
diff --git a/package/mac80211/patches/830-b43-workaround-pcie-bcm4716.patch b/package/mac80211/patches/830-b43-workaround-pcie-bcm4716.patch
index ce9ad7d5c48..bd10f996c20 100644
--- a/package/mac80211/patches/830-b43-workaround-pcie-bcm4716.patch
+++ b/package/mac80211/patches/830-b43-workaround-pcie-bcm4716.patch
@@ -19,7 +19,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 
 --- a/drivers/net/wireless/b43/b43.h
 +++ b/drivers/net/wireless/b43/b43.h
-@@ -1048,6 +1048,32 @@ static inline bool b43_using_pio_transfe
+@@ -1053,6 +1053,32 @@ static inline bool b43_using_pio_transfe
  	return dev->__using_pio_transfers;
  }
  
diff --git a/package/mac80211/patches/850-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch b/package/mac80211/patches/850-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch
deleted file mode 100644
index 23bdf828125..00000000000
--- a/package/mac80211/patches/850-brcmsmac-add-device-found-on-some-SoCs-like-the-bcm4.patch
+++ /dev/null
@@ -1,39 +0,0 @@
---- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
-+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
-@@ -95,6 +95,7 @@ MODULE_FIRMWARE("brcm/bcm43xx_hdr-0.fw")
- 
- /* recognized BCMA Core IDs */
- static struct bcma_device_id brcms_coreid_table[] = {
-+	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 17, BCMA_ANY_CLASS),
- 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 23, BCMA_ANY_CLASS),
- 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 24, BCMA_ANY_CLASS),
- 	BCMA_CORETABLE_END
---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
-+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
-@@ -719,7 +719,7 @@ static void brcms_c_ucode_bsinit(struct 
- 	brcms_c_write_mhf(wlc_hw, wlc_hw->band->mhfs);
- 
- 	/* do band-specific ucode IHR, SHM, and SCR inits */
--	if (D11REV_IS(wlc_hw->corerev, 23)) {
-+	if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) {
- 		if (BRCMS_ISNPHY(wlc_hw->band))
- 			brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16);
- 		else
-@@ -2266,7 +2266,7 @@ static void brcms_ucode_download(struct 
- 	if (wlc_hw->ucode_loaded)
- 		return;
- 
--	if (D11REV_IS(wlc_hw->corerev, 23)) {
-+	if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) {
- 		if (BRCMS_ISNPHY(wlc_hw->band)) {
- 			brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo,
- 					  ucode->bcm43xx_16_mimosz);
-@@ -3218,7 +3218,7 @@ static void brcms_b_coreinit(struct brcm
- 
- 	sflags = bcma_aread32(core, BCMA_IOST);
- 
--	if (D11REV_IS(wlc_hw->corerev, 23)) {
-+	if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) {
- 		if (BRCMS_ISNPHY(wlc_hw->band))
- 			brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16);
- 		else
diff --git a/package/mac80211/patches/852-brcmsmac-start-adding-support-for-core-rev-28.patch b/package/mac80211/patches/850-brcmsmac-start-adding-support-for-core-rev-28.patch
similarity index 95%
rename from package/mac80211/patches/852-brcmsmac-start-adding-support-for-core-rev-28.patch
rename to package/mac80211/patches/850-brcmsmac-start-adding-support-for-core-rev-28.patch
index bb0f2e56d2e..ddaf28e536c 100644
--- a/package/mac80211/patches/852-brcmsmac-start-adding-support-for-core-rev-28.patch
+++ b/package/mac80211/patches/850-brcmsmac-start-adding-support-for-core-rev-28.patch
@@ -28,7 +28,7 @@
  		if (BRCMS_ISNPHY(wlc_hw->band)) {
  			brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo,
  					  ucode->bcm43xx_16_mimosz);
-@@ -3218,7 +3218,7 @@ static void brcms_b_coreinit(struct brcm
+@@ -3217,7 +3217,7 @@ static void brcms_b_coreinit(struct brcm
  
  	sflags = bcma_aread32(core, BCMA_IOST);
  
@@ -37,7 +37,7 @@
  		if (BRCMS_ISNPHY(wlc_hw->band))
  			brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16);
  		else
-@@ -5675,6 +5675,8 @@ static bool brcms_c_chipmatch_soc(struct
+@@ -5674,6 +5674,8 @@ static bool brcms_c_chipmatch_soc(struct
  
  	if (chipinfo->id == BCMA_CHIP_ID_BCM4716)
  		return true;
diff --git a/package/mac80211/patches/851-brcmsmac-add-support-for-BCM43224.patch b/package/mac80211/patches/851-brcmsmac-add-support-for-BCM43224.patch
deleted file mode 100644
index a0f894e95ca..00000000000
--- a/package/mac80211/patches/851-brcmsmac-add-support-for-BCM43224.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
-+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
-@@ -4502,7 +4502,8 @@ static int brcms_b_attach(struct brcms_c
- 
- 	/* check device id(srom, nvram etc.) to set bands */
- 	if (wlc_hw->deviceid == BCM43224_D11N_ID ||
--	    wlc_hw->deviceid == BCM43224_D11N_ID_VEN1)
-+	    wlc_hw->deviceid == BCM43224_D11N_ID_VEN1 ||
-+	    wlc_hw->deviceid == BCM43224_CHIP_ID)
- 		/* Dualband boards */
- 		wlc_hw->_nbands = 2;
- 	else
-@@ -5655,7 +5656,7 @@ static bool brcms_c_chipmatch_pci(struct
- 		return false;
- 	}
- 
--	if (device == BCM43224_D11N_ID_VEN1)
-+	if (device == BCM43224_D11N_ID_VEN1 || device == BCM43224_CHIP_ID)
- 		return true;
- 	if ((device == BCM43224_D11N_ID) || (device == BCM43225_D11N2G_ID))
- 		return true;
diff --git a/package/mac80211/patches/860-brcmsmac-wflush-objmem.patch b/package/mac80211/patches/860-brcmsmac-wflush-objmem.patch
deleted file mode 100644
index a2ab24dcb78..00000000000
--- a/package/mac80211/patches/860-brcmsmac-wflush-objmem.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
-+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
-@@ -2922,7 +2922,7 @@ brcms_b_write_objmem(struct brcms_hardwa
- 	if (offset & 2)
- 		objoff += 2;
- 
--	bcma_write16(core, objoff, v);
-+	bcma_wflush16(core, objoff, v);
- }
- 
- /*