From 0a7eafa89e8252c6b56633445651888735ea73d3 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 16 Feb 2009 19:55:09 +0000
Subject: [PATCH] mac80211: add more patches from the rt2x00 git repository

SVN-Revision: 14534
---
 package/mac80211/Makefile                     |   2 +-
 ...860C-BBP-channel-init-values-rt2800u.patch |  31 ++++
 ...ve-invalid-RX-antenna-init-rt2800usb.patch |  20 +++
 ...16-rt2x00-Remove-check-for-rf-word-0.patch | 152 ++++++++++++++++++
 ...Remove-check-for-rf-word-0-rt2800pci.patch |  36 +++++
 ...Remove-check-for-rf-word-0-rt2800usb.patch |  36 +++++
 ...t-all-register-stats-through-debugfs.patch |  72 +++++++++
 .../320-rt2x00-Add-USB-id-rt2800usb.patch     |  20 +++
 ...-Add-various-new-USB-IDs-for-rt73usb.patch |  39 +++++
 ...t-get_tkip_seq-fix-TX-streams-rt2800.patch |  79 +++++++++
 ...t-get_tkip_seq-fix-TX-streams-rt2800.patch |  79 +++++++++
 ...2x00-Add-support-for-MCS32-rt2800usb.patch |  46 ++++++
 ...2x00-Add-support-for-MCS32-rt2800pci.patch |  20 +++
 13 files changed, 631 insertions(+), 1 deletion(-)
 create mode 100644 package/mac80211/patches/314-rt2x00-Add-RT2860C-BBP-channel-init-values-rt2800u.patch
 create mode 100644 package/mac80211/patches/315-rt2x00-Remove-invalid-RX-antenna-init-rt2800usb.patch
 create mode 100644 package/mac80211/patches/316-rt2x00-Remove-check-for-rf-word-0.patch
 create mode 100644 package/mac80211/patches/317-rt2x00-Remove-check-for-rf-word-0-rt2800pci.patch
 create mode 100644 package/mac80211/patches/318-rt2x00-Remove-check-for-rf-word-0-rt2800usb.patch
 create mode 100644 package/mac80211/patches/319-rt2x00-Export-all-register-stats-through-debugfs.patch
 create mode 100644 package/mac80211/patches/320-rt2x00-Add-USB-id-rt2800usb.patch
 create mode 100644 package/mac80211/patches/321-rt2x00-Add-various-new-USB-IDs-for-rt73usb.patch
 create mode 100644 package/mac80211/patches/322-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
 create mode 100644 package/mac80211/patches/323-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
 create mode 100644 package/mac80211/patches/324-rt2x00-Add-support-for-MCS32-rt2800usb.patch
 create mode 100644 package/mac80211/patches/325-rt2x00-Add-support-for-MCS32-rt2800pci.patch

diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile
index d04b7b3669..76e67fad0b 100644
--- a/package/mac80211/Makefile
+++ b/package/mac80211/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=mac80211
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 ifneq ($(CONFIG_LINUX_2_6_27)$(CONFIG_LINUX_2_6_28),)
   PKG_VERSION:=2009-02-15
diff --git a/package/mac80211/patches/314-rt2x00-Add-RT2860C-BBP-channel-init-values-rt2800u.patch b/package/mac80211/patches/314-rt2x00-Add-RT2860C-BBP-channel-init-values-rt2800u.patch
new file mode 100644
index 0000000000..2bfaa50331
--- /dev/null
+++ b/package/mac80211/patches/314-rt2x00-Add-RT2860C-BBP-channel-init-values-rt2800u.patch
@@ -0,0 +1,31 @@
+From c223b72884576ffcbe17cef32cfa6edfe6b32e7e Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sun, 8 Feb 2009 12:11:14 +0100
+Subject: [PATCH] rt2x00: Add RT2860C BBP channel init values (rt2800usb)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800usb.c |   12 ++++++++++++
+ 1 files changed, 12 insertions(+), 0 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c
+@@ -883,6 +883,18 @@ static void rt2800usb_config_channel(str
+ 	rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf));
+ 	rt2800usb_bbp_write(rt2x00dev, 3, bbp);
+ 
++	if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
++		if (conf_is_ht40(conf)) {
++			rt2800usb_bbp_write(rt2x00dev, 69, 0x1a);
++			rt2800usb_bbp_write(rt2x00dev, 70, 0x0a);
++			rt2800usb_bbp_write(rt2x00dev, 73, 0x16);
++		} else {
++			rt2800usb_bbp_write(rt2x00dev, 69, 0x16);
++			rt2800usb_bbp_write(rt2x00dev, 70, 0x08);
++			rt2800usb_bbp_write(rt2x00dev, 73, 0x11);
++		}
++	}
++
+ 	msleep(1);
+ }
+ 
diff --git a/package/mac80211/patches/315-rt2x00-Remove-invalid-RX-antenna-init-rt2800usb.patch b/package/mac80211/patches/315-rt2x00-Remove-invalid-RX-antenna-init-rt2800usb.patch
new file mode 100644
index 0000000000..3160cf5402
--- /dev/null
+++ b/package/mac80211/patches/315-rt2x00-Remove-invalid-RX-antenna-init-rt2800usb.patch
@@ -0,0 +1,20 @@
+From baa4f570de0978ba12be3b8596f063232c54538d Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sun, 8 Feb 2009 12:32:51 +0100
+Subject: [PATCH] rt2x00: Remove invalid RX antenna init (rt2800usb)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800usb.c |    1 -
+ 1 files changed, 0 insertions(+), 1 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c
+@@ -638,7 +638,6 @@ static void rt2800usb_config_ant(struct 
+ 	switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH)) {
+ 	case 1:
+ 		rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 0);
+-		rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0);
+ 		break;
+ 	case 2:
+ 		rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 2);
diff --git a/package/mac80211/patches/316-rt2x00-Remove-check-for-rf-word-0.patch b/package/mac80211/patches/316-rt2x00-Remove-check-for-rf-word-0.patch
new file mode 100644
index 0000000000..f5d8c4e0fe
--- /dev/null
+++ b/package/mac80211/patches/316-rt2x00-Remove-check-for-rf-word-0.patch
@@ -0,0 +1,152 @@
+From 14aaed532a6d18af35466d8f440e96597a8d203a Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sun, 8 Feb 2009 17:05:01 +0100
+Subject: [PATCH] rt2x00: Remove check for rf word 0
+
+The only way rf_write() can be called with word 0 is
+when the user sends the wrong word index through debugfs.
+However the values which are send through debugfs are
+validated using the RF_BASE and RF_SIZE macro values,
+the most logical solution is to increase RF_BASE with 4
+and decrease RF_SIZE with 4 (RF_SIZE has always been
+1 word too big)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2400pci.c |    3 ---
+ drivers/net/wireless/rt2x00/rt2400pci.h |    4 ++--
+ drivers/net/wireless/rt2x00/rt2500pci.c |    3 ---
+ drivers/net/wireless/rt2x00/rt2500pci.h |    4 ++--
+ drivers/net/wireless/rt2x00/rt2500usb.c |    3 ---
+ drivers/net/wireless/rt2x00/rt2500usb.h |    4 ++--
+ drivers/net/wireless/rt2x00/rt61pci.c   |    3 ---
+ drivers/net/wireless/rt2x00/rt61pci.h   |    4 ++--
+ drivers/net/wireless/rt2x00/rt73usb.c   |    3 ---
+ drivers/net/wireless/rt2x00/rt73usb.h   |    4 ++--
+ 10 files changed, 10 insertions(+), 25 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2400pci.c
++++ b/drivers/net/wireless/rt2x00/rt2400pci.c
+@@ -114,9 +114,6 @@ static void rt2400pci_rf_write(struct rt
+ {
+ 	u32 reg;
+ 
+-	if (!word)
+-		return;
+-
+ 	mutex_lock(&rt2x00dev->csr_mutex);
+ 
+ 	/*
+--- a/drivers/net/wireless/rt2x00/rt2400pci.h
++++ b/drivers/net/wireless/rt2x00/rt2400pci.h
+@@ -48,8 +48,8 @@
+ #define EEPROM_SIZE			0x0100
+ #define BBP_BASE			0x0000
+ #define BBP_SIZE			0x0020
+-#define RF_BASE				0x0000
+-#define RF_SIZE				0x0010
++#define RF_BASE				0x0004
++#define RF_SIZE				0x000c
+ 
+ /*
+  * Number of TX queues.
+--- a/drivers/net/wireless/rt2x00/rt2500pci.c
++++ b/drivers/net/wireless/rt2x00/rt2500pci.c
+@@ -114,9 +114,6 @@ static void rt2500pci_rf_write(struct rt
+ {
+ 	u32 reg;
+ 
+-	if (!word)
+-		return;
+-
+ 	mutex_lock(&rt2x00dev->csr_mutex);
+ 
+ 	/*
+--- a/drivers/net/wireless/rt2x00/rt2500pci.h
++++ b/drivers/net/wireless/rt2x00/rt2500pci.h
+@@ -59,8 +59,8 @@
+ #define EEPROM_SIZE			0x0200
+ #define BBP_BASE			0x0000
+ #define BBP_SIZE			0x0040
+-#define RF_BASE				0x0000
+-#define RF_SIZE				0x0014
++#define RF_BASE				0x0004
++#define RF_SIZE				0x0010
+ 
+ /*
+  * Number of TX queues.
+--- a/drivers/net/wireless/rt2x00/rt2500usb.c
++++ b/drivers/net/wireless/rt2x00/rt2500usb.c
+@@ -204,9 +204,6 @@ static void rt2500usb_rf_write(struct rt
+ {
+ 	u16 reg;
+ 
+-	if (!word)
+-		return;
+-
+ 	mutex_lock(&rt2x00dev->csr_mutex);
+ 
+ 	/*
+--- a/drivers/net/wireless/rt2x00/rt2500usb.h
++++ b/drivers/net/wireless/rt2x00/rt2500usb.h
+@@ -59,8 +59,8 @@
+ #define EEPROM_SIZE			0x006a
+ #define BBP_BASE			0x0000
+ #define BBP_SIZE			0x0060
+-#define RF_BASE				0x0000
+-#define RF_SIZE				0x0014
++#define RF_BASE				0x0004
++#define RF_SIZE				0x0010
+ 
+ /*
+  * Number of TX queues.
+--- a/drivers/net/wireless/rt2x00/rt61pci.c
++++ b/drivers/net/wireless/rt2x00/rt61pci.c
+@@ -123,9 +123,6 @@ static void rt61pci_rf_write(struct rt2x
+ {
+ 	u32 reg;
+ 
+-	if (!word)
+-		return;
+-
+ 	mutex_lock(&rt2x00dev->csr_mutex);
+ 
+ 	/*
+--- a/drivers/net/wireless/rt2x00/rt61pci.h
++++ b/drivers/net/wireless/rt2x00/rt61pci.h
+@@ -50,8 +50,8 @@
+ #define EEPROM_SIZE			0x0100
+ #define BBP_BASE			0x0000
+ #define BBP_SIZE			0x0080
+-#define RF_BASE				0x0000
+-#define RF_SIZE				0x0014
++#define RF_BASE				0x0004
++#define RF_SIZE				0x0010
+ 
+ /*
+  * Number of TX queues.
+--- a/drivers/net/wireless/rt2x00/rt73usb.c
++++ b/drivers/net/wireless/rt2x00/rt73usb.c
+@@ -122,9 +122,6 @@ static void rt73usb_rf_write(struct rt2x
+ {
+ 	u32 reg;
+ 
+-	if (!word)
+-		return;
+-
+ 	mutex_lock(&rt2x00dev->csr_mutex);
+ 
+ 	/*
+--- a/drivers/net/wireless/rt2x00/rt73usb.h
++++ b/drivers/net/wireless/rt2x00/rt73usb.h
+@@ -50,8 +50,8 @@
+ #define EEPROM_SIZE			0x0100
+ #define BBP_BASE			0x0000
+ #define BBP_SIZE			0x0080
+-#define RF_BASE				0x0000
+-#define RF_SIZE				0x0014
++#define RF_BASE				0x0004
++#define RF_SIZE				0x0010
+ 
+ /*
+  * Number of TX queues.
diff --git a/package/mac80211/patches/317-rt2x00-Remove-check-for-rf-word-0-rt2800pci.patch b/package/mac80211/patches/317-rt2x00-Remove-check-for-rf-word-0-rt2800pci.patch
new file mode 100644
index 0000000000..62b2e1759b
--- /dev/null
+++ b/package/mac80211/patches/317-rt2x00-Remove-check-for-rf-word-0-rt2800pci.patch
@@ -0,0 +1,36 @@
+From 0ae19587caba638b15ca8ea735a21d148459bd47 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sun, 8 Feb 2009 17:08:28 +0100
+Subject: [PATCH] rt2x00: Remove check for rf word 0 (rt2800pci)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800pci.c |    3 ---
+ drivers/net/wireless/rt2x00/rt2800pci.h |    4 ++--
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800pci.c
++++ b/drivers/net/wireless/rt2x00/rt2800pci.c
+@@ -125,9 +125,6 @@ static void rt2800pci_rf_write(struct rt
+ {
+ 	u32 reg;
+ 
+-	if (!word)
+-		return;
+-
+ 	mutex_lock(&rt2x00dev->csr_mutex);
+ 
+ 	/*
+--- a/drivers/net/wireless/rt2x00/rt2800pci.h
++++ b/drivers/net/wireless/rt2x00/rt2800pci.h
+@@ -68,8 +68,8 @@
+ #define EEPROM_SIZE			0x0110
+ #define BBP_BASE			0x0000
+ #define BBP_SIZE			0x0080
+-#define RF_BASE				0x0000
+-#define RF_SIZE				0x0014
++#define RF_BASE				0x0004
++#define RF_SIZE				0x0010
+ 
+ /*
+  * Number of TX queues.
diff --git a/package/mac80211/patches/318-rt2x00-Remove-check-for-rf-word-0-rt2800usb.patch b/package/mac80211/patches/318-rt2x00-Remove-check-for-rf-word-0-rt2800usb.patch
new file mode 100644
index 0000000000..dcc90c7066
--- /dev/null
+++ b/package/mac80211/patches/318-rt2x00-Remove-check-for-rf-word-0-rt2800usb.patch
@@ -0,0 +1,36 @@
+From ff7c5c649466a5cf887eb5ee4eb9fd3fb9598069 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sun, 8 Feb 2009 17:08:54 +0100
+Subject: [PATCH] rt2x00: Remove check for rf word 0 (rt2800usb)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800usb.c |    3 ---
+ drivers/net/wireless/rt2x00/rt2800usb.h |    4 ++--
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c
+@@ -182,9 +182,6 @@ static void rt2800usb_rf_write(struct rt
+ {
+ 	u32 reg;
+ 
+-	if (!word)
+-		return;
+-
+ 	mutex_lock(&rt2x00dev->csr_mutex);
+ 
+ 	/*
+--- a/drivers/net/wireless/rt2x00/rt2800usb.h
++++ b/drivers/net/wireless/rt2x00/rt2800usb.h
+@@ -68,8 +68,8 @@
+ #define EEPROM_SIZE			0x0110
+ #define BBP_BASE			0x0000
+ #define BBP_SIZE			0x0080
+-#define RF_BASE				0x0000
+-#define RF_SIZE				0x0014
++#define RF_BASE				0x0004
++#define RF_SIZE				0x0010
+ 
+ /*
+  * Number of TX queues.
diff --git a/package/mac80211/patches/319-rt2x00-Export-all-register-stats-through-debugfs.patch b/package/mac80211/patches/319-rt2x00-Export-all-register-stats-through-debugfs.patch
new file mode 100644
index 0000000000..63c726f6d8
--- /dev/null
+++ b/package/mac80211/patches/319-rt2x00-Export-all-register-stats-through-debugfs.patch
@@ -0,0 +1,72 @@
+From d64551dfc4c7fba6a94f7245393d173199ac9e07 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sun, 8 Feb 2009 17:39:35 +0100
+Subject: [PATCH] rt2x00: Export all register stats through debugfs
+
+By exporting the register base, and word size to userspace
+through debugfs it will be easier to create scripts which
+parse the register information. This makes debugging and
+register dumps information easier.
+This will unfortunately not be backward compatible with
+the previous approach, but that is not important in this case
+since manually fixing the layout of the dumpfile to match the
+new style then interpreting the data without a script.
+
+Also be more consistent with using tabs to seperate different
+fields.
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2x00debug.c |   33 ++++++++++++++++++++--------
+ 1 files changed, 23 insertions(+), 10 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2x00debug.c
++++ b/drivers/net/wireless/rt2x00/rt2x00debug.c
+@@ -545,9 +545,9 @@ static struct dentry *rt2x00debug_create
+ 		return NULL;
+ 
+ 	blob->data = data;
+-	data += sprintf(data, "driver: %s\n", intf->rt2x00dev->ops->name);
+-	data += sprintf(data, "version: %s\n", DRV_VERSION);
+-	data += sprintf(data, "compiled: %s %s\n", __DATE__, __TIME__);
++	data += sprintf(data, "driver:\t%s\n", intf->rt2x00dev->ops->name);
++	data += sprintf(data, "version:\t%s\n", DRV_VERSION);
++	data += sprintf(data, "compiled:\t%s %s\n", __DATE__, __TIME__);
+ 	blob->size = strlen(blob->data);
+ 
+ 	return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob);
+@@ -568,14 +568,27 @@ static struct dentry *rt2x00debug_create
+ 		return NULL;
+ 
+ 	blob->data = data;
+-	data += sprintf(data, "rt chip: %04x\n", intf->rt2x00dev->chip.rt);
+-	data += sprintf(data, "rf chip: %04x\n", intf->rt2x00dev->chip.rf);
+-	data += sprintf(data, "revision:%08x\n", intf->rt2x00dev->chip.rev);
++	data += sprintf(data, "rt chip:\t%04x\n", intf->rt2x00dev->chip.rt);
++	data += sprintf(data, "rf chip:\t%04x\n", intf->rt2x00dev->chip.rf);
++	data += sprintf(data, "revision:\t%08x\n", intf->rt2x00dev->chip.rev);
+ 	data += sprintf(data, "\n");
+-	data += sprintf(data, "csr length: %d\n", debug->csr.word_count);
+-	data += sprintf(data, "eeprom length: %d\n", debug->eeprom.word_count);
+-	data += sprintf(data, "bbp length: %d\n", debug->bbp.word_count);
+-	data += sprintf(data, "rf length: %d\n", debug->rf.word_count);
++	data += sprintf(data, "register\tbase\twords\twordsize\n");
++	data += sprintf(data, "csr\t%d\t%d\t%d\n",
++			debug->csr.word_base,
++			debug->csr.word_count,
++			debug->csr.word_size);
++	data += sprintf(data, "eeprom\t%d\t%d\t%d\n",
++			debug->eeprom.word_base,
++			debug->eeprom.word_count,
++			debug->eeprom.word_size);
++	data += sprintf(data, "bbp\t%d\t%d\t%d\n",
++			debug->bbp.word_base,
++			debug->bbp.word_count,
++			debug->bbp.word_size);
++	data += sprintf(data, "rf\t%d\t%d\t%d\n",
++			debug->rf.word_base,
++			debug->rf.word_count,
++			debug->rf.word_size);
+ 	blob->size = strlen(blob->data);
+ 
+ 	return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob);
diff --git a/package/mac80211/patches/320-rt2x00-Add-USB-id-rt2800usb.patch b/package/mac80211/patches/320-rt2x00-Add-USB-id-rt2800usb.patch
new file mode 100644
index 0000000000..18666b4b8b
--- /dev/null
+++ b/package/mac80211/patches/320-rt2x00-Add-USB-id-rt2800usb.patch
@@ -0,0 +1,20 @@
+From fdff1254d77eee9ef1cd50ec77e3e29d09e5c552 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Thu, 12 Feb 2009 19:02:59 +0100
+Subject: [PATCH] rt2x00: Add USB id (rt2800usb)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800usb.c |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c
+@@ -2900,6 +2900,7 @@ static struct usb_device_id rt2800usb_de
+ 	{ USB_DEVICE(0x0df6, 0x002b), USB_DEVICE_DATA(&rt2800usb_ops) },
+ 	{ USB_DEVICE(0x0df6, 0x002c), USB_DEVICE_DATA(&rt2800usb_ops) },
+ 	{ USB_DEVICE(0x0df6, 0x002d), USB_DEVICE_DATA(&rt2800usb_ops) },
++	{ USB_DEVICE(0x0df6, 0x003f), USB_DEVICE_DATA(&rt2800usb_ops) },
+ 	/* SMC */
+ 	{ USB_DEVICE(0x083a, 0x6618), USB_DEVICE_DATA(&rt2800usb_ops) },
+ 	{ USB_DEVICE(0x083a, 0x7522), USB_DEVICE_DATA(&rt2800usb_ops) },
diff --git a/package/mac80211/patches/321-rt2x00-Add-various-new-USB-IDs-for-rt73usb.patch b/package/mac80211/patches/321-rt2x00-Add-various-new-USB-IDs-for-rt73usb.patch
new file mode 100644
index 0000000000..70fe65e3bf
--- /dev/null
+++ b/package/mac80211/patches/321-rt2x00-Add-various-new-USB-IDs-for-rt73usb.patch
@@ -0,0 +1,39 @@
+From fe9ab0125accc1c16bd3f9f394787656332fc467 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sat, 14 Feb 2009 13:39:14 +0100
+Subject: [PATCH] rt2x00: Add various new USB IDs for rt73usb
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt73usb.c |    6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt73usb.c
++++ b/drivers/net/wireless/rt2x00/rt73usb.c
+@@ -2342,6 +2342,9 @@ static const struct rt2x00_ops rt73usb_o
+ static struct usb_device_id rt73usb_device_table[] = {
+ 	/* AboCom */
+ 	{ USB_DEVICE(0x07b8, 0xb21d), USB_DEVICE_DATA(&rt73usb_ops) },
++	/* Amigo */
++	{ USB_DEVICE(0x148f, 0x9021), USB_DEVICE_DATA(&rt73usb_ops) },
++	{ USB_DEVICE(0x0eb0, 0x9021), USB_DEVICE_DATA(&rt73usb_ops) },
+ 	/* Askey */
+ 	{ USB_DEVICE(0x1690, 0x0722), USB_DEVICE_DATA(&rt73usb_ops) },
+ 	/* ASUS */
+@@ -2389,6 +2392,7 @@ static struct usb_device_id rt73usb_devi
+ 	{ USB_DEVICE(0x0db0, 0xa861), USB_DEVICE_DATA(&rt73usb_ops) },
+ 	{ USB_DEVICE(0x0db0, 0xa874), USB_DEVICE_DATA(&rt73usb_ops) },
+ 	/* Ralink */
++	{ USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) },
+ 	{ USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) },
+ 	{ USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) },
+ 	/* Qcom */
+@@ -2405,6 +2409,8 @@ static struct usb_device_id rt73usb_devi
+ 	/* Planex */
+ 	{ USB_DEVICE(0x2019, 0xab01), USB_DEVICE_DATA(&rt73usb_ops) },
+ 	{ USB_DEVICE(0x2019, 0xab50), USB_DEVICE_DATA(&rt73usb_ops) },
++	/* ZyXEL */
++	{ USB_DEVICE(0x0586, 0x3415), USB_DEVICE_DATA(&rt73usb_ops) },
+ 	{ 0, }
+ };
+ 
diff --git a/package/mac80211/patches/322-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch b/package/mac80211/patches/322-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
new file mode 100644
index 0000000000..636fb795aa
--- /dev/null
+++ b/package/mac80211/patches/322-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
@@ -0,0 +1,79 @@
+From 524c4b25e496c7af6cbe5b16ea5c258880669509 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sat, 14 Feb 2009 19:55:36 +0100
+Subject: [PATCH] rt2x00: support get_tkip_seq, fix TX streams (rt2800pci)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800pci.c |   23 ++++++++++++++++++++++-
+ drivers/net/wireless/rt2x00/rt2800pci.h |    6 ------
+ 2 files changed, 22 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800pci.c
++++ b/drivers/net/wireless/rt2x00/rt2800pci.c
+@@ -1374,6 +1374,8 @@ static int rt2800pci_init_registers(stru
+ 
+ 	rt2x00pci_register_read(rt2x00dev, TX_RTS_CFG, &reg);
+ 	rt2x00_set_field32(&reg, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 32);
++	rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_THRES,
++			   IEEE80211_MAX_RTS_THRESHOLD);
+ 	rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_FBK_EN, 0);
+ 	rt2x00pci_register_write(rt2x00dev, TX_RTS_CFG, reg);
+ 
+@@ -2470,7 +2472,10 @@ static int rt2800pci_probe_hw_mode(struc
+ 	spec->ht.ampdu_factor = 3;
+ 	spec->ht.ampdu_density = 4;
+ 	spec->ht.mcs.tx_params =
+-	    IEEE80211_HT_MCS_TX_DEFINED;
++	    IEEE80211_HT_MCS_TX_DEFINED |
++	    IEEE80211_HT_MCS_TX_RX_DIFF |
++	    ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
++		IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
+ 
+ 	switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
+ 	case 3:
+@@ -2552,6 +2557,21 @@ static int rt2800pci_probe_hw(struct rt2
+ /*
+  * IEEE80211 stack callback functions.
+  */
++static void rt2800pci_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx,
++				   u32 *iv32, u16 *iv16)
++{
++	struct rt2x00_dev *rt2x00dev = hw->priv;
++	struct mac_iveiv_entry iveiv_entry;
++	u32 offset;
++
++	offset = MAC_IVEIV_ENTRY(hw_key_idx);
++	rt2x00pci_register_multiread(rt2x00dev, offset,
++				      &iveiv_entry, sizeof(iveiv_entry));
++
++	memcpy(&iveiv_entry.iv[0], iv16, sizeof(iv16));
++	memcpy(&iveiv_entry.iv[4], iv32, sizeof(iv32));
++}
++
+ static int rt2800pci_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+ {
+ 	struct rt2x00_dev *rt2x00dev = hw->priv;
+@@ -2681,6 +2701,7 @@ static const struct ieee80211_ops rt2800
+ 	.configure_filter	= rt2x00mac_configure_filter,
+ 	.set_key		= rt2x00mac_set_key,
+ 	.get_stats		= rt2x00mac_get_stats,
++	.get_tkip_seq		= rt2800pci_get_tkip_seq,
+ 	.set_rts_threshold	= rt2800pci_set_rts_threshold,
+ 	.bss_info_changed	= rt2x00mac_bss_info_changed,
+ 	.conf_tx		= rt2800pci_conf_tx,
+--- a/drivers/net/wireless/rt2x00/rt2800pci.h
++++ b/drivers/net/wireless/rt2x00/rt2800pci.h
+@@ -1327,12 +1327,6 @@ struct mac_iveiv_entry {
+ } __attribute__ ((packed));
+ 
+ /*
+- * MAC_IVEIV:
+- */
+-#define MAC_IVEIV_EIV			FIELD32(0x20000000)
+-#define MAC_IVEIV_KEYIDX		FIELD32(0xc0000000)
+-
+-/*
+  * MAC_WCID_ATTRIBUTE:
+  */
+ #define MAC_WCID_ATTRIBUTE_KEYTAB	FIELD32(0x00000001)
diff --git a/package/mac80211/patches/323-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch b/package/mac80211/patches/323-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
new file mode 100644
index 0000000000..c2cb53994e
--- /dev/null
+++ b/package/mac80211/patches/323-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
@@ -0,0 +1,79 @@
+From 0479f29b2d4d8e95eece75e9bfda9a6a5e7bc77e Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sat, 14 Feb 2009 19:56:24 +0100
+Subject: [PATCH] rt2x00: support get_tkip_seq, fix TX streams (rt2800usb)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800usb.c |   23 ++++++++++++++++++++++-
+ drivers/net/wireless/rt2x00/rt2800usb.h |    6 ------
+ 2 files changed, 22 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c
+@@ -1465,6 +1465,8 @@ static int rt2800usb_init_registers(stru
+ 
+ 	rt2x00usb_register_read(rt2x00dev, TX_RTS_CFG, &reg);
+ 	rt2x00_set_field32(&reg, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 32);
++	rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_THRES,
++			   IEEE80211_MAX_RTS_THRESHOLD);
+ 	rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_FBK_EN, 0);
+ 	rt2x00usb_register_write(rt2x00dev, TX_RTS_CFG, reg);
+ 
+@@ -2521,7 +2523,10 @@ static int rt2800usb_probe_hw_mode(struc
+ 	spec->ht.ampdu_factor = 3;
+ 	spec->ht.ampdu_density = 4;
+ 	spec->ht.mcs.tx_params =
+-	    IEEE80211_HT_MCS_TX_DEFINED;
++	    IEEE80211_HT_MCS_TX_DEFINED |
++	    IEEE80211_HT_MCS_TX_RX_DIFF |
++	    ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
++		IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
+ 
+ 	switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
+ 	case 3:
+@@ -2625,6 +2630,21 @@ static int rt2800usb_probe_hw(struct rt2
+ /*
+  * IEEE80211 stack callback functions.
+  */
++static void rt2800usb_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx,
++				   u32 *iv32, u16 *iv16)
++{
++	struct rt2x00_dev *rt2x00dev = hw->priv;
++	struct mac_iveiv_entry iveiv_entry;
++	u32 offset;
++
++	offset = MAC_IVEIV_ENTRY(hw_key_idx);
++	rt2x00usb_register_multiread(rt2x00dev, offset,
++				      &iveiv_entry, sizeof(iveiv_entry));
++
++	memcpy(&iveiv_entry.iv[0], iv16, sizeof(iv16));
++	memcpy(&iveiv_entry.iv[4], iv32, sizeof(iv32));
++}
++
+ static int rt2800usb_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+ {
+ 	struct rt2x00_dev *rt2x00dev = hw->priv;
+@@ -2754,6 +2774,7 @@ static const struct ieee80211_ops rt2800
+ 	.configure_filter	= rt2x00mac_configure_filter,
+ 	.set_key		= rt2x00mac_set_key,
+ 	.get_stats		= rt2x00mac_get_stats,
++	.get_tkip_seq		= rt2800usb_get_tkip_seq,
+ 	.set_rts_threshold	= rt2800usb_set_rts_threshold,
+ 	.bss_info_changed	= rt2x00mac_bss_info_changed,
+ 	.conf_tx		= rt2800usb_conf_tx,
+--- a/drivers/net/wireless/rt2x00/rt2800usb.h
++++ b/drivers/net/wireless/rt2x00/rt2800usb.h
+@@ -1339,12 +1339,6 @@ struct mac_iveiv_entry {
+ } __attribute__ ((packed));
+ 
+ /*
+- * MAC_IVEIV:
+- */
+-#define MAC_IVEIV_EIV			FIELD32(0x20000000)
+-#define MAC_IVEIV_KEYIDX		FIELD32(0xc0000000)
+-
+-/*
+  * MAC_WCID_ATTRIBUTE:
+  */
+ #define MAC_WCID_ATTRIBUTE_KEYTAB	FIELD32(0x00000001)
diff --git a/package/mac80211/patches/324-rt2x00-Add-support-for-MCS32-rt2800usb.patch b/package/mac80211/patches/324-rt2x00-Add-support-for-MCS32-rt2800usb.patch
new file mode 100644
index 0000000000..2adf983ea0
--- /dev/null
+++ b/package/mac80211/patches/324-rt2x00-Add-support-for-MCS32-rt2800usb.patch
@@ -0,0 +1,46 @@
+From a0b61da562624d3a5c11309c8742ae115290a418 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sun, 15 Feb 2009 20:58:57 +0100
+Subject: [PATCH] rt2x00: Add support for MCS32 (rt2800usb)
+
+Signed-off-by: Ivo van Doorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800usb.c |   13 ++++++++-----
+ 1 files changed, 8 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c
+@@ -1627,6 +1627,10 @@ static int rt2800usb_init_bbp(struct rt2
+ 		rt2800usb_bbp_write(rt2x00dev, 73, 0x12);
+ 	}
+ 
++	if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION) {
++		rt2800usb_bbp_write(rt2x00dev, 84, 0x19);
++	}
++
+ 	if (rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION) {
+ 		rt2800usb_bbp_write(rt2x00dev, 70, 0x0a);
+ 		rt2800usb_bbp_write(rt2x00dev, 84, 0x99);
+@@ -1658,11 +1662,9 @@ static u8 rt2800usb_init_rx_filter(struc
+ 
+ 	rt2800usb_rfcsr_write(rt2x00dev, 24, rfcsr24);
+ 
+-	if (bw40) {
+-		rt2800usb_bbp_read(rt2x00dev, 4, &bbp);
+-		rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2);
+-		rt2800usb_bbp_write(rt2x00dev, 4, bbp);
+-	}
++	rt2800usb_bbp_read(rt2x00dev, 4, &bbp);
++	rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * bw40);
++	rt2800usb_bbp_write(rt2x00dev, 4, bbp);
+ 
+ 	rt2800usb_rfcsr_read(rt2x00dev, 22, &rfcsr);
+ 	rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 1);
+@@ -2535,6 +2537,7 @@ static int rt2800usb_probe_hw_mode(struc
+ 		spec->ht.mcs.rx_mask[1] = 0xff;
+ 	case 1:
+ 		spec->ht.mcs.rx_mask[0] = 0xff;
++		spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
+ 		break;
+ 	}
+ 
diff --git a/package/mac80211/patches/325-rt2x00-Add-support-for-MCS32-rt2800pci.patch b/package/mac80211/patches/325-rt2x00-Add-support-for-MCS32-rt2800pci.patch
new file mode 100644
index 0000000000..db2f256f3d
--- /dev/null
+++ b/package/mac80211/patches/325-rt2x00-Add-support-for-MCS32-rt2800pci.patch
@@ -0,0 +1,20 @@
+From 8a82217f8847eb908bd7fa04d29f263da5d94e16 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sun, 15 Feb 2009 20:59:48 +0100
+Subject: [PATCH] rt2x00: Add support for MCS32 (rt2800pci)
+
+Signed-off-by: Ivo van Doorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800pci.c |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800pci.c
++++ b/drivers/net/wireless/rt2x00/rt2800pci.c
+@@ -2484,6 +2484,7 @@ static int rt2800pci_probe_hw_mode(struc
+ 		spec->ht.mcs.rx_mask[1] = 0xff;
+ 	case 1:
+ 		spec->ht.mcs.rx_mask[0] = 0xff;
++		spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
+ 		break;
+ 	}
+ 
-- 
2.30.2