aboutsummaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-03-05 12:49:25 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-03-05 12:49:25 +0000
commit22e7d6af634fc7bbee1c173f538e0a8cffb56c1e (patch)
treee1cdbea1f9888296f3e92f2391dbaff232bb16e1 /package/mac80211/patches
parent97f9e2b24b46863d9134c1baac9932bfac15f4c5 (diff)
downloadupstream-22e7d6af634fc7bbee1c173f538e0a8cffb56c1e.tar.gz
upstream-22e7d6af634fc7bbee1c173f538e0a8cffb56c1e.tar.bz2
upstream-22e7d6af634fc7bbee1c173f538e0a8cffb56c1e.zip
[package] mac80211: update compat-wireless to 2009-03-04, and refresh patches
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@14749 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/mac80211/patches')
-rw-r--r--package/mac80211/patches/301-rt2x00-Implement-support-for-802.11n.patch4
-rw-r--r--package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch201
-rw-r--r--package/mac80211/patches/303-rt2x00-Implement-support-for-rt2800usb.patch329
-rw-r--r--package/mac80211/patches/304-rt2x00-Detect-cypher-type-during-RX-rt2800pci.patch35
-rw-r--r--package/mac80211/patches/304-rt2x00-Remove-unused-define-rt2800pci.patch24
-rw-r--r--package/mac80211/patches/305-rt2x00-Detect-cypher-type-during-RX-rt2800usb.patch40
-rw-r--r--package/mac80211/patches/305-rt2x00-Remove-unused-define-rt2800usb.patch24
-rw-r--r--package/mac80211/patches/306-rt2x00-Clean-header-rt2800pci.patch39
-rw-r--r--package/mac80211/patches/306-rt2x00-Fix-HW-crypto-offset-calculation-rt2800pci.patch36
-rw-r--r--package/mac80211/patches/307-rt2x00-Clean-header-rt2800usb.patch30
-rw-r--r--package/mac80211/patches/307-rt2x00-Fix-HW-crypto-offset-calculation-rt2800usb.patch35
-rw-r--r--package/mac80211/patches/308-rt2x00-Uncomment-get_tsf-rt2800usb.patch36
-rw-r--r--package/mac80211/patches/309-rt2x00-Fix-MCS-rx_mask-rt2800pci.patch65
-rw-r--r--package/mac80211/patches/310-rt2x00-Fix-MCS-rx_mask-rt2800usb.patch65
-rw-r--r--package/mac80211/patches/311-rt2x00-Channel-HT40-fixes-rt2800pci.patch186
-rw-r--r--package/mac80211/patches/312-rt2x00-Channel-HT40-fixes-rt2800usb.patch258
-rw-r--r--package/mac80211/patches/313-rt2x00-Add-RT2860C-BBP-channel-init-values-rt2800u.patch31
-rw-r--r--package/mac80211/patches/314-rt2x00-Remove-invalid-RX-antenna-init-rt2800usb.patch20
-rw-r--r--package/mac80211/patches/315-rt2x00-Remove-check-for-rf-word-0-rt2800pci.patch36
-rw-r--r--package/mac80211/patches/316-rt2x00-Remove-check-for-rf-word-0-rt2800usb.patch36
-rw-r--r--package/mac80211/patches/317-rt2x00-Export-all-register-stats-through-debugfs.patch72
-rw-r--r--package/mac80211/patches/318-rt2x00-Add-USB-id-rt2800usb.patch20
-rw-r--r--package/mac80211/patches/319-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch79
-rw-r--r--package/mac80211/patches/320-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch79
-rw-r--r--package/mac80211/patches/321-rt2x00-Add-support-for-MCS32-rt2800usb.patch46
-rw-r--r--package/mac80211/patches/322-rt2x00-Add-support-for-MCS32-rt2800pci.patch20
-rw-r--r--package/mac80211/patches/323-rt2x00-Add-RT3070-detection.patch22
-rw-r--r--package/mac80211/patches/324-rt2x00-Correctly-initialize-TXINFO-for-crypto-rt28.patch83
-rw-r--r--package/mac80211/patches/325-rt2x00-Correctly-initialize-TXINFO-for-crypto-rt28.patch84
-rw-r--r--package/mac80211/patches/401-ath9k-dont-register-leds-on-ar9100.patch4
-rw-r--r--package/mac80211/patches/404-ath9k-fix-AR_TXCFG_DMASZ_MASK-value.patch29
-rw-r--r--package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch21
32 files changed, 491 insertions, 1598 deletions
diff --git a/package/mac80211/patches/301-rt2x00-Implement-support-for-802.11n.patch b/package/mac80211/patches/301-rt2x00-Implement-support-for-802.11n.patch
index 804d19e857..54361a97a2 100644
--- a/package/mac80211/patches/301-rt2x00-Implement-support-for-802.11n.patch
+++ b/package/mac80211/patches/301-rt2x00-Implement-support-for-802.11n.patch
@@ -1,6 +1,6 @@
-From a9a853248786f3582a0f82de65075d215b0c7027 Mon Sep 17 00:00:00 2001
+From 48eba0e802443d417a4b011202f956b9e5a74bfb Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Wed, 4 Feb 2009 20:10:23 +0100
+Date: Tue, 3 Mar 2009 19:14:51 +0100
Subject: [PATCH] rt2x00: Implement support for 802.11n
Extend rt2x00lib capabilities to support 802.11n,
diff --git a/package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch b/package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch
index 26baa49ce1..cfb8a97e54 100644
--- a/package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch
+++ b/package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch
@@ -1,12 +1,13 @@
-From cdd4310f4631d5a41c2c6ab09bbddb558c26587f Mon Sep 17 00:00:00 2001
+From b11cae133872a0ff531a1d2646f1e46378510fe0 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Wed, 4 Feb 2009 20:43:00 +0100
+Date: Tue, 3 Mar 2009 19:18:56 +0100
Subject: [PATCH] rt2x00: Implement support for rt2800pci
Add support for the rt2800pci chipset.
-Includes various patches from Mattias, Mark and Felix.
+Includes various patches from Mattias, Mark, Felix and Xose.
+Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
Signed-off-by: Mark Asselstine <asselsm@gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
@@ -14,10 +15,10 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/Kconfig | 15 +
drivers/net/wireless/rt2x00/Makefile | 1 +
- drivers/net/wireless/rt2x00/rt2800pci.c | 2785 +++++++++++++++++++++++++++++++
- drivers/net/wireless/rt2x00/rt2800pci.h | 1877 +++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800pci.c | 2831 +++++++++++++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800pci.h | 1867 ++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2x00.h | 4 +
- 5 files changed, 4682 insertions(+), 0 deletions(-)
+ 5 files changed, 4718 insertions(+), 0 deletions(-)
create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.c
create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.h
@@ -32,7 +33,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
obj-$(CONFIG_RT73USB) += rt73usb.o
--- /dev/null
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -0,0 +1,2785 @@
+@@ -0,0 +1,2831 @@
+/*
+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
+ <http://rt2x00.serialmonkey.com>
@@ -160,9 +161,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+{
+ u32 reg;
+
-+ if (!word)
-+ return;
-+
+ mutex_lock(&rt2x00dev->csr_mutex);
+
+ /*
@@ -369,7 +367,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ u32 offset;
+ u32 reg;
+
-+ offset = MAC_WCID_ATTR_ENTRY(crypto->aid);
++ offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx);
+
+ rt2x00pci_register_read(rt2x00dev, offset, &reg);
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_KEYTAB,
@@ -380,7 +378,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, 0);
+ rt2x00pci_register_write(rt2x00dev, offset, reg);
+
-+ offset = MAC_IVEIV_ENTRY(crypto->aid);
++ offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
+
+ memset(&iveiv_entry, 0, sizeof(iveiv_entry));
+ if ((crypto->cipher == CIPHER_TKIP) ||
@@ -391,7 +389,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00pci_register_multiwrite(rt2x00dev, offset,
+ &iveiv_entry, sizeof(iveiv_entry));
+
-+ offset = MAC_WCID_ENTRY(crypto->aid);
++ offset = MAC_WCID_ENTRY(key->hw_key_idx);
+
+ memset(&wcid_entry, 0, sizeof(wcid_entry));
+ if (crypto->cmd == SET_KEY)
@@ -431,10 +429,10 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * Using the correct defines correctly will cause overhead,
+ * so just calculate the correct offset.
+ */
-+ field.bit_offset = (4 * key->keyidx);
++ field.bit_offset = (4 * key->keyidx) + (16 * (crypto->bssidx & 1));
+ field.bit_mask = 0x7 << field.bit_offset;
+
-+ offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8);
++ offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 2);
+ rt2x00pci_register_read(rt2x00dev, offset, &reg);
+ rt2x00_set_field32(&reg, field,
+ (crypto->cmd == SET_KEY) * crypto->cipher);
@@ -638,7 +636,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0);
+ break;
+ case 2:
-+ rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 16);
++ rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 2);
+ break;
+ case 3:
+ /* Do nothing */
@@ -688,6 +686,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+}
+
+static void rt2800pci_config_channel(struct rt2x00_dev *rt2x00dev,
++ struct ieee80211_conf *conf,
+ struct rf_channel *rf,
+ struct channel_info *info)
+{
@@ -695,34 +694,20 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ unsigned int tx_pin;
+ u16 eeprom;
+
-+ tx_pin = 0;
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
-+
+ rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset);
+
+ /*
+ * Determine antenna settings from EEPROM
+ */
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
++
+ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) == 1) {
+ rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_TX1, 1);
-+ /* Turn off unused PA or LNA when only 1T or 1R */
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 0);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 0);
+ }
+
+ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) == 1) {
+ rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX1, 1);
+ rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX2, 1);
-+ /* Turn off unused PA or LNA when only 1T or 1R */
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 0);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 0);
+ } else if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) == 2)
+ rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX2, 1);
+
@@ -750,19 +735,14 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+ rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A,
+ TXPOWER_A_TO_DEV(info->tx_power2));
-+
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, 1);
+ } else {
+ rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G,
+ TXPOWER_G_TO_DEV(info->tx_power1));
+ rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G,
+ TXPOWER_G_TO_DEV(info->tx_power2));
-+
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
+ }
+
-+ rt2x00_set_field32(&rf->rf4, RF4_BW40,
-+ test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags));
++ rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf));
+
+ rt2800pci_rf_write(rt2x00dev, 1, rf->rf1);
+ rt2800pci_rf_write(rt2x00dev, 2, rf->rf2);
@@ -799,11 +779,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2800pci_bbp_write(rt2x00dev, 82, 0x84);
+ rt2800pci_bbp_write(rt2x00dev, 75, 0x50);
+ }
-+
-+ rt2x00pci_register_read(rt2x00dev, TX_BAND_CFG, &reg);
-+ rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_A, 0);
-+ rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_BG, 1);
-+ rt2x00pci_register_write(rt2x00dev, TX_BAND_CFG, reg);
+ } else {
+ rt2800pci_bbp_write(rt2x00dev, 82, 0xf2);
+
@@ -811,13 +786,35 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2800pci_bbp_write(rt2x00dev, 75, 0x46);
+ else
+ rt2800pci_bbp_write(rt2x00dev, 75, 0x50);
++ }
++
++ rt2x00pci_register_read(rt2x00dev, TX_BAND_CFG, &reg);
++ rt2x00_set_field32(&reg, TX_BAND_CFG_HT40_PLUS, conf_is_ht40_plus(conf));
++ rt2x00_set_field32(&reg, TX_BAND_CFG_A, rf->channel > 14);
++ rt2x00_set_field32(&reg, TX_BAND_CFG_BG, rf->channel <= 14);
++ rt2x00pci_register_write(rt2x00dev, TX_BAND_CFG, reg);
+
-+ rt2x00pci_register_read(rt2x00dev, TX_BAND_CFG, &reg);
-+ rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_A, 1);
-+ rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_BG, 0);
-+ rt2x00pci_register_write(rt2x00dev, TX_BAND_CFG, reg);
++ tx_pin = 0;
++
++ /* Turn on unused PA or LNA when not using 1T or 1R */
++ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) != 1) {
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1);
++ }
++
++ /* Turn on unused PA or LNA when not using 1T or 1R */
++ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) != 1) {
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
+ }
+
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, rf->channel <= 14);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, rf->channel > 14);
++
+ rt2x00pci_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
+
+ msleep(1);
@@ -952,8 +949,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2800pci_config_lna_gain(rt2x00dev, libconf);
+
+ if (flags & IEEE80211_CONF_CHANGE_CHANNEL)
-+ rt2800pci_config_channel(rt2x00dev, &libconf->rf,
-+ &libconf->channel);
++ rt2800pci_config_channel(rt2x00dev, libconf->conf,
++ &libconf->rf, &libconf->channel);
+ if (flags & IEEE80211_CONF_CHANGE_POWER)
+ rt2800pci_config_txpower(rt2x00dev, libconf->conf->power_level);
+ if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
@@ -1413,6 +1410,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+ 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);
+
@@ -1422,19 +1421,19 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ /*
+ * ASIC will keep garbage value after boot, clear encryption keys.
+ */
-+ for (i = 0; i < 254; i++) {
++ for (i = 0; i < 256; i++) {
+ u32 wcid[2] = { 0xffffffff, 0x00ffffff };
+ rt2x00pci_register_multiwrite(rt2x00dev, MAC_WCID_ENTRY(i),
+ wcid, sizeof(wcid));
++
++ rt2x00pci_register_write(rt2x00dev, MAC_WCID_ATTR_ENTRY(i), 1);
++ rt2x00pci_register_write(rt2x00dev, MAC_IVEIV_ENTRY(i), 0);
+ }
+
-+ for (i = 0; i < 4; i++)
++ for (i = 0; i < 16; i++)
+ rt2x00pci_register_write(rt2x00dev,
+ SHARED_KEY_MODE_ENTRY(i), 0);
+
-+ for (i = 0; i < 256; i++)
-+ rt2x00pci_register_write(rt2x00dev, MAC_WCID_ATTR_ENTRY(i), 1);
-+
+ /*
+ * Clear all beacons
+ * For the Beacon base registers we only need to clear
@@ -1850,16 +1849,22 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
+ rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
+ rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
-+ skbdesc->entry->entry_idx);
++ test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
++ txdesc->key_idx : 0xff);
+ rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, skb->len);
+ rt2x00_set_field32(&word, TXWI_W1_PACKETID,
+ skbdesc->entry->queue->qid);
+ rt2x00_desc_write(txwi, 1, word);
+
-+ if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) {
-+ _rt2x00_desc_write(txwi, 2, skbdesc->iv[0]);
-+ _rt2x00_desc_write(txwi, 3, skbdesc->iv[1]);
-+ }
++ /*
++ * Always write 0 to IV/EIV fields, hardware will insert the IV
++ * from the IVEIV register when ENTRY_TXD_ENCRYPT_IV is set to 0.
++ * When ENTRY_TXD_ENCRYPT_IV is set to 1 it will use the IV data
++ * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which
++ * crypto entry in the registers should be used to encrypt the frame.
++ */
++ _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
++ _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
+
+ /*
+ * Initialize TX descriptor
@@ -1886,7 +1891,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_desc_write(txd, 2, word);
+
+ rt2x00_desc_read(txd, 3, &word);
-+ rt2x00_set_field32(&word, TXD_W3_WIV, 1);
++ rt2x00_set_field32(&word, TXD_W3_WIV,
++ !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
+ rt2x00_set_field32(&word, TXD_W3_QSEL, 2);
+ rt2x00_desc_write(txd, 3, word);
+}
@@ -2228,6 +2234,13 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
+ EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
++ } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
++ /*
++ * There is a max of 2 RX streams for RT2860 series
++ */
++ if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
++ rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
++ rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
+ }
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
@@ -2451,6 +2464,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ char *tx_power1;
+ char *tx_power2;
+ unsigned int i;
++ u16 eeprom;
+
+ /*
+ * Initialize all hw fields.
@@ -2467,6 +2481,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_eeprom_addr(rt2x00dev,
+ EEPROM_MAC_ADDR_0));
+
++ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
++
+ /*
+ * Initialize hw_mode information.
+ */
@@ -2498,10 +2514,22 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ IEEE80211_HT_CAP_PSMP_SUPPORT;
+ spec->ht.ampdu_factor = 3;
+ spec->ht.ampdu_density = 4;
-+ spec->ht.mcs.rx_mask[0] = 0xff;
-+ spec->ht.mcs.rx_mask[1] = 0xff;
+ 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:
++ spec->ht.mcs.rx_mask[2] = 0xff;
++ case 2:
++ 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;
++ }
+
+ /*
+ * Create channel information array
@@ -2573,6 +2601,21 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+/*
+ * 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;
@@ -2702,6 +2745,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ .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,
@@ -2741,14 +2785,14 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+static const struct data_queue_desc rt2800pci_queue_rx = {
+ .entry_num = RX_ENTRIES,
-+ .data_size = DATA_FRAME_SIZE,
++ .data_size = AGGREGATION_SIZE,
+ .desc_size = RXD_DESC_SIZE,
+ .priv_size = sizeof(struct queue_entry_priv_pci),
+};
+
+static const struct data_queue_desc rt2800pci_queue_tx = {
+ .entry_num = TX_ENTRIES,
-+ .data_size = DATA_FRAME_SIZE,
++ .data_size = AGGREGATION_SIZE,
+ .desc_size = TXD_DESC_SIZE,
+ .priv_size = sizeof(struct queue_entry_priv_pci),
+};
@@ -2785,6 +2829,9 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ { PCI_DEVICE(0x1814, 0x0681), PCI_DEVICE_DATA(&rt2800pci_ops) },
+ { PCI_DEVICE(0x1814, 0x0701), PCI_DEVICE_DATA(&rt2800pci_ops) },
+ { PCI_DEVICE(0x1814, 0x0781), PCI_DEVICE_DATA(&rt2800pci_ops) },
++ { PCI_DEVICE(0x1814, 0x3090), PCI_DEVICE_DATA(&rt2800pci_ops) },
++ { PCI_DEVICE(0x1814, 0x3091), PCI_DEVICE_DATA(&rt2800pci_ops) },
++ { PCI_DEVICE(0x1814, 0x3092), PCI_DEVICE_DATA(&rt2800pci_ops) },
+ { PCI_DEVICE(0x1a3b, 0x1059), PCI_DEVICE_DATA(&rt2800pci_ops) },
+ { 0, }
+};
@@ -2820,7 +2867,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+module_exit(rt2800pci_exit);
--- /dev/null
+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -0,0 +1,1877 @@
+@@ -0,0 +1,1867 @@
+/*
+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
+ <http://rt2x00.serialmonkey.com>
@@ -2891,8 +2938,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#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.
@@ -3073,11 +3120,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000)
+
+/*
-+ * RINGREG_DIFF
-+ */
-+#define RINGREG_DIFF 0x0010
-+
-+/*
+ * GPIO_CTRL_CFG:
+ */
+#define GPIO_CTRL_CFG 0x0228
@@ -3170,7 +3212,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#define PBF_SYS_CTRL_HOST_RAM_WRITE FIELD32(0x00010000)
+
+/*
-+ * PBF registers
++ * PBF registers
+ * Most are for debug. Driver doesn't touch PBF register.
+ */
+#define PBF_CFG 0x0408
@@ -3198,7 +3240,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#define BCN_OFFSET1_BCN7 FIELD32(0xff000000)
+
+/*
-+ * PBF registers
++ * PBF registers
+ * Most are for debug. Driver doesn't touch PBF register.
+ */
+#define TXRXQ_PCNT 0x0438
@@ -3619,6 +3661,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * TX_BAND_CFG: 0x1 use upper 20MHz, 0x0 use lower 20MHz
+ */
+#define TX_BAND_CFG 0x132c
++#define TX_BAND_CFG_HT40_PLUS FIELD32(0x00000001)
+#define TX_BAND_CFG_A FIELD32(0x00000002)
+#define TX_BAND_CFG_BG FIELD32(0x00000004)
+
@@ -4154,12 +4197,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+} __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)
@@ -4324,7 +4361,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#define RF4_TXPOWER_A_7DBM_BOOST FIELD32(0x00000040)
+#define RF4_TXPOWER_A FIELD32(0x00000780)
+#define RF4_FREQ_OFFSET FIELD32(0x001f8000)
-+#define RF4_BW40 FIELD32(0x00200000)
++#define RF4_HT40 FIELD32(0x00200000)
+
+/*
+ * EEPROM content.
@@ -4458,7 +4495,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#define EEPROM_TXPOWER_DELTA_TXPOWER FIELD16(0x0080)
+
+/*
-+ * EEPROM TXPOWER 802.11G
++ * EEPROM TXPOWER 802.11BG
+ */
+#define EEPROM_TXPOWER_BG1 0x0029
+#define EEPROM_TXPOWER_BG2 0x0030
diff --git a/package/mac80211/patches/303-rt2x00-Implement-support-for-rt2800usb.patch b/package/mac80211/patches/303-rt2x00-Implement-support-for-rt2800usb.patch
index 51da6a26de..27b4f5a057 100644
--- a/package/mac80211/patches/303-rt2x00-Implement-support-for-rt2800usb.patch
+++ b/package/mac80211/patches/303-rt2x00-Implement-support-for-rt2800usb.patch
@@ -1,25 +1,30 @@
-From 1d21decc7ccd8b7c2a280a4d15bda08883a03b2c Mon Sep 17 00:00:00 2001
+From b249bc450f982cd2491448c91faf797ed37b69b8 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Wed, 4 Feb 2009 20:45:56 +0100
+Date: Tue, 3 Mar 2009 19:25:49 +0100
Subject: [PATCH] rt2x00: Implement support for rt2800usb
Add support for the rt2800usb chipset.
-Includes various patches from Mattias and Felix.
+Includes various patches from Mattias, Felix, Xose and Axel.
Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
+Signed-off-by: Axel Kollhofer <rain_maker@root-forum.org>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/Kconfig | 14 +
drivers/net/wireless/rt2x00/Makefile | 1 +
- drivers/net/wireless/rt2x00/rt2800usb.c | 2928 +++++++++++++++++++++++++++++++
- drivers/net/wireless/rt2x00/rt2800usb.h | 1940 ++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800usb.c | 3032 +++++++++++++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800usb.h | 1932 ++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2x00.h | 7 +
- 5 files changed, 4890 insertions(+), 0 deletions(-)
+ 5 files changed, 4986 insertions(+), 0 deletions(-)
create mode 100644 drivers/net/wireless/rt2x00/rt2800usb.c
create mode 100644 drivers/net/wireless/rt2x00/rt2800usb.h
+ config RT2X00_LIB_PCI
+ tristate
+ select RT2X00_LIB
--- a/drivers/net/wireless/rt2x00/Makefile
+++ b/drivers/net/wireless/rt2x00/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_RT61PCI) += rt61pci.o
@@ -29,7 +34,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+obj-$(CONFIG_RT2800USB) += rt2800usb.o
--- /dev/null
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -0,0 +1,2928 @@
+@@ -0,0 +1,3032 @@
+/*
+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
+ <http://rt2x00.serialmonkey.com>
@@ -214,9 +219,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+{
+ u32 reg;
+
-+ if (!word)
-+ return;
-+
+ mutex_lock(&rt2x00dev->csr_mutex);
+
+ /*
@@ -393,7 +395,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ u32 offset;
+ u32 reg;
+
-+ offset = MAC_WCID_ATTR_ENTRY(crypto->aid);
++ offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx);
+
+ rt2x00usb_register_read(rt2x00dev, offset, &reg);
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_KEYTAB,
@@ -404,7 +406,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, 0);
+ rt2x00usb_register_write(rt2x00dev, offset, reg);
+
-+ offset = MAC_IVEIV_ENTRY(crypto->aid);
++ offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
+
+ memset(&iveiv_entry, 0, sizeof(iveiv_entry));
+ if ((crypto->cipher == CIPHER_TKIP) ||
@@ -415,7 +417,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00usb_register_multiwrite(rt2x00dev, offset,
+ &iveiv_entry, sizeof(iveiv_entry));
+
-+ offset = MAC_WCID_ENTRY(crypto->aid);
++ offset = MAC_WCID_ENTRY(key->hw_key_idx);
+
+ memset(&wcid_entry, 0, sizeof(wcid_entry));
+ if (crypto->cmd == SET_KEY)
@@ -460,10 +462,10 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * Using the correct defines correctly will cause overhead,
+ * so just calculate the correct offset.
+ */
-+ field.bit_offset = (4 * key->keyidx);
++ field.bit_offset = (4 * key->keyidx) + (16 * (crypto->bssidx & 1));
+ field.bit_mask = 0x7 << field.bit_offset;
+
-+ offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8);
++ offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 2);
+
+ rt2x00usb_register_read(rt2x00dev, offset, &reg);
+ rt2x00_set_field32(&reg, field,
@@ -670,10 +672,9 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ 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, 16);
++ rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 2);
+ break;
+ case 3:
+ /* Do nothing */
@@ -723,6 +724,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+}
+
+static void rt2800usb_config_channel_rt2x(struct rt2x00_dev *rt2x00dev,
++ struct ieee80211_conf *conf,
+ struct rf_channel *rf,
+ struct channel_info *info)
+{
@@ -734,6 +736,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * Determine antenna settings from EEPROM
+ */
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
++
+ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) == 1)
+ rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_TX1, 1);
+
@@ -774,8 +777,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ TXPOWER_G_TO_DEV(info->tx_power2));
+ }
+
-+ rt2x00_set_field32(&rf->rf4, RF4_BW40,
-+ test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags));
++ rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf));
+
+ rt2800usb_rf_write(rt2x00dev, 1, rf->rf1);
+ rt2800usb_rf_write(rt2x00dev, 2, rf->rf2);
@@ -798,6 +800,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+}
+
+static void rt2800usb_config_channel_rt3x(struct rt2x00_dev *rt2x00dev,
++ struct ieee80211_conf *conf,
+ struct rf_channel *rf,
+ struct channel_info *info)
+{
@@ -819,10 +822,12 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
+ rt2800usb_rfcsr_write(rt2x00dev, 23, rfcsr);
+
-+ if (test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags))
-+ rt2800usb_rfcsr_write(rt2x00dev, 24, rt2x00dev->calibration_bw40);
++ if (conf_is_ht40(conf))
++ rt2800usb_rfcsr_write(rt2x00dev, 24,
++ rt2x00dev->calibration_bw40);
+ else
-+ rt2800usb_rfcsr_write(rt2x00dev, 24, rt2x00dev->calibration_bw20);
++ rt2800usb_rfcsr_write(rt2x00dev, 24,
++ rt2x00dev->calibration_bw20);
+
+ rt2800usb_rfcsr_read(rt2x00dev, 23, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1);
@@ -830,46 +835,24 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+}
+
+static void rt2800usb_config_channel(struct rt2x00_dev *rt2x00dev,
++ struct ieee80211_conf *conf,
+ struct rf_channel *rf,
+ struct channel_info *info)
+{
+ u32 reg;
+ unsigned int tx_pin;
+ u16 eeprom;
++ u8 bbp;
+
-+ if (rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION)
-+ rt2800usb_config_channel_rt2x(rt2x00dev, rf, info);
-+ else
-+ rt2800usb_config_channel_rt3x(rt2x00dev, rf, info);
-+
-+ tx_pin = 0;
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
-+
++ /*
++ * Determine antenna settings from EEPROM
++ */
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
+
-+ /* Turn off unused PA or LNA when only 1T or 1R */
-+ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) == 1) {
-+
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 0);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 0);
-+ }
-+
-+ /* Turn off unused PA or LNA when only 1T or 1R */
-+ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) == 1) {
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 0);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 0);
-+ }
-+
-+ if (rf->channel > 14)
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, 1);
++ if (rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION)
++ rt2800usb_config_channel_rt2x(rt2x00dev, conf, rf, info);
+ else
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
++ rt2800usb_config_channel_rt3x(rt2x00dev, conf, rf, info);
+
+ /*
+ * Change BBP settings
@@ -887,11 +870,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2800usb_bbp_write(rt2x00dev, 82, 0x84);
+ rt2800usb_bbp_write(rt2x00dev, 75, 0x50);
+ }
-+
-+ rt2x00usb_register_read(rt2x00dev, TX_BAND_CFG, &reg);
-+ rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_A, 0);
-+ rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_BG, 1);
-+ rt2x00usb_register_write(rt2x00dev, TX_BAND_CFG, reg);
+ } else {
+ rt2800usb_bbp_write(rt2x00dev, 82, 0xf2);
+
@@ -899,15 +877,57 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2800usb_bbp_write(rt2x00dev, 75, 0x46);
+ else
+ rt2800usb_bbp_write(rt2x00dev, 75, 0x50);
++ }
++
++ rt2x00usb_register_read(rt2x00dev, TX_BAND_CFG, &reg);
++ rt2x00_set_field32(&reg, TX_BAND_CFG_HT40_PLUS, conf_is_ht40_plus(conf));
++ rt2x00_set_field32(&reg, TX_BAND_CFG_A, rf->channel > 14);
++ rt2x00_set_field32(&reg, TX_BAND_CFG_BG, rf->channel <= 14);
++ rt2x00usb_register_write(rt2x00dev, TX_BAND_CFG, reg);
++
++ tx_pin = 0;
++
++ /* Turn on unused PA or LNA when not using 1T or 1R */
++ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) != 1) {
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1);
++ }
+
-+ rt2x00usb_register_read(rt2x00dev, TX_BAND_CFG, &reg);
-+ rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_A, 1);
-+ rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_BG, 0);
-+ rt2x00usb_register_write(rt2x00dev, TX_BAND_CFG, reg);
++ /* Turn on unused PA or LNA when not using 1T or 1R */
++ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) != 1) {
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
+ }
+
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, rf->channel <= 14);
++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, rf->channel > 14);
++
+ rt2x00usb_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
+
++ rt2800usb_bbp_read(rt2x00dev, 4, &bbp);
++ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
++ rt2800usb_bbp_write(rt2x00dev, 4, bbp);
++
++ rt2800usb_bbp_read(rt2x00dev, 3, &bbp);
++ 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);
+}
+
@@ -1040,8 +1060,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2800usb_config_lna_gain(rt2x00dev, libconf);
+
+ if (flags & IEEE80211_CONF_CHANGE_CHANNEL)
-+ rt2800usb_config_channel(rt2x00dev, &libconf->rf,
-+ &libconf->channel);
++ rt2800usb_config_channel(rt2x00dev, libconf->conf,
++ &libconf->rf, &libconf->channel);
+ if (flags & IEEE80211_CONF_CHANGE_POWER)
+ rt2800usb_config_txpower(rt2x00dev, libconf->conf->power_level);
+ if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
@@ -1482,6 +1502,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+ 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);
+
@@ -1491,19 +1513,19 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ /*
+ * ASIC will keep garbage value after boot, clear encryption keys.
+ */
-+ for (i = 0; i < 254; i++) {
++ for (i = 0; i < 256; i++) {
+ u32 wcid[2] = { 0xffffffff, 0x00ffffff };
+ rt2x00usb_register_multiwrite(rt2x00dev, MAC_WCID_ENTRY(i),
+ wcid, sizeof(wcid));
++
++ rt2x00usb_register_write(rt2x00dev, MAC_WCID_ATTR_ENTRY(i), 1);
++ rt2x00usb_register_write(rt2x00dev, MAC_IVEIV_ENTRY(i), 0);
+ }
+
-+ for (i = 0; i < 4; i++)
++ for (i = 0; i < 16; i++)
+ rt2x00usb_register_write(rt2x00dev,
+ SHARED_KEY_MODE_ENTRY(i), 0);
+
-+ for (i = 0; i < 256; i++)
-+ rt2x00usb_register_write(rt2x00dev, MAC_WCID_ATTR_ENTRY(i), 1);
-+
+ /*
+ * Clear all beacons
+ * For the Beacon base registers we only need to clear
@@ -1642,6 +1664,10 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ 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);
@@ -1673,11 +1699,9 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+ rt2800usb_rfcsr_write(rt2x00dev, 24, rfcsr24);
+
-+ if (bw40) {
-+ rt2800usb_bbp_read(rt2x00dev, 4, &bbp);
-+ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0x10);
-+ 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);
@@ -2014,16 +2038,23 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_set_field32(&word, TXWI_W1_NSEQ,
+ test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
+ rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
-+ rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, 0xff);
++ rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
++ test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
++ txdesc->key_idx : 0xff);
+ rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, skb->len);
+ rt2x00_set_field32(&word, TXWI_W1_PACKETID,
+ skbdesc->entry->entry_idx);
+ rt2x00_desc_write(txwi, 1, word);
+
-+ if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) {
-+ _rt2x00_desc_write(txwi, 2, skbdesc->iv[0]);
-+ _rt2x00_desc_write(txwi, 3, skbdesc->iv[1]);
-+ }
++ /*
++ * Always write 0 to IV/EIV fields, hardware will insert the IV
++ * from the IVEIV register when TXINFO_W0_WIV is set to 0.
++ * When TXINFO_W0_WIV is set to 1 it will use the IV data
++ * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which
++ * crypto entry in the registers should be used to encrypt the frame.
++ */
++ _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
++ _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
+
+ /*
+ * Initialize TX descriptor
@@ -2031,7 +2062,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_desc_read(txi, 0, &word);
+ rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
+ skb->len + TXWI_DESC_SIZE);
-+ rt2x00_set_field32(&word, TXINFO_W0_WIV, 1);
++ rt2x00_set_field32(&word, TXINFO_W0_WIV,
++ !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
+ rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);
+ rt2x00_set_field32(&word, TXINFO_W0_SW_USE_LAST_ROUND, 0);
+ rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_NEXT_VALID, 0);
@@ -2247,6 +2279,13 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
+ rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
+ EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
++ } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
++ /*
++ * There is a max of 2 RX streams for RT2860 series
++ */
++ if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
++ rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
++ rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
+ }
+
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
@@ -2344,7 +2383,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * identifies itself as rt2860 in the CSR register.
+ */
+ if ((rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x2860) &&
-+ (rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x2870)) {
++ (rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x2870) &&
++ (rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x3070)) {
+ ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
+ return -ENODEV;
+ }
@@ -2497,6 +2537,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ char *tx_power1;
+ char *tx_power2;
+ unsigned int i;
++ u16 eeprom;
+
+ /*
+ * Initialize all hw fields.
@@ -2513,6 +2554,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_eeprom_addr(rt2x00dev,
+ EEPROM_MAC_ADDR_0));
+
++ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
++
+ /*
+ * Initialize HT information.
+ */
@@ -2527,10 +2570,22 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ IEEE80211_HT_CAP_PSMP_SUPPORT;
+ spec->ht.ampdu_factor = 3;
+ spec->ht.ampdu_density = 4;
-+ spec->ht.mcs.rx_mask[0] = 0xff;
-+ spec->ht.mcs.rx_mask[1] = 0xff;
+ 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:
++ spec->ht.mcs.rx_mask[2] = 0xff;
++ case 2:
++ 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;
++ }
+
+ /*
+ * Initialize hw_mode information.
@@ -2624,6 +2679,21 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+/*
+ * 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;
@@ -2728,13 +2798,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ return 0;
+}
+
-+#if 0
-+/*
-+ * Mac80211 demands get_tsf must be atomic.
-+ * This is not possible for rt2800usb since all register access
-+ * functions require sleeping. Untill mac80211 no longer needs
-+ * get_tsf to be atomic, this function should be disabled.
-+ */
+static u64 rt2800usb_get_tsf(struct ieee80211_hw *hw)
+{
+ struct rt2x00_dev *rt2x00dev = hw->priv;
@@ -2748,9 +2811,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+ return tsf;
+}
-+#else
-+#define rt2800usb_get_tsf NULL
-+#endif
+
+static const struct ieee80211_ops rt2800usb_mac80211_ops = {
+ .tx = rt2x00mac_tx,
@@ -2763,6 +2823,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ .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,
@@ -2801,14 +2862,14 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+static const struct data_queue_desc rt2800usb_queue_rx = {
+ .entry_num = RX_ENTRIES,
-+ .data_size = DATA_FRAME_SIZE,
++ .data_size = AGGREGATION_SIZE,
+ .desc_size = RXD_DESC_SIZE + RXWI_DESC_SIZE,
+ .priv_size = sizeof(struct queue_entry_priv_usb),
+};
+
+static const struct data_queue_desc rt2800usb_queue_tx = {
+ .entry_num = TX_ENTRIES,
-+ .data_size = DATA_FRAME_SIZE,
++ .data_size = AGGREGATION_SIZE,
+ .desc_size = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
+ .priv_size = sizeof(struct queue_entry_priv_usb),
+};
@@ -2842,22 +2903,35 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ */
+static struct usb_device_id rt2800usb_device_table[] = {
+ /* Abocom */
-+ { USB_DEVICE(0x07b8, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) },
-+ { USB_DEVICE(0x07b8, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x07b8, 0x2870), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x07b8, 0x2770), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x07b8, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x07b8, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x07b8, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x1482, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
++ /* AirTies */
++ { USB_DEVICE(0x1eda, 0x2310), USB_DEVICE_DATA(&rt2800usb_ops) },
++ /* Amigo */
++ { USB_DEVICE(0x0e0b, 0x9031), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x0e0b, 0x9041), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Amit */
+ { USB_DEVICE(0x15c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* ASUS */
+ { USB_DEVICE(0x0b05, 0x1731), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x0b05, 0x1732), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x0b05, 0x1742), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x0b05, 0x1760), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x0b05, 0x1761), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* AzureWave */
+ { USB_DEVICE(0x13d3, 0x3247), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x13d3, 0x3262), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x13d3, 0x3273), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Belkin */
+ { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x050d, 0x815c), USB_DEVICE_DATA(&rt2800usb_ops) },
++ /* Buffalo */
++ { USB_DEVICE(0x0411, 0x012e), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Conceptronic */
+ { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -2871,35 +2945,61 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ { USB_DEVICE(0x07aa, 0x002f), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x07aa, 0x003c), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x07aa, 0x003f), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x18c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x18c5, 0x0012), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* D-Link */
+ { USB_DEVICE(0x07d1, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x07d1, 0x3c11), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x07d1, 0x3c13), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x2001, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x2001, 0x3c0a), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Edimax */
+ { USB_DEVICE(0x7392, 0x7711), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x7392, 0x7717), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x7392, 0x7718), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* EnGenius */
+ { USB_DEVICE(0X1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x1740, 0x9703), USB_DEVICE_DATA(&rt2800usb_ops) },
++ /* Gemtek */
++ { USB_DEVICE(0x15a9, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Gigabyte */
+ { USB_DEVICE(0x1044, 0x800b), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x1044, 0x800c), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x1044, 0x800d), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Hawking */
+ { USB_DEVICE(0x0e66, 0x0001), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x0e66, 0x0003), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x0e66, 0x0009), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x0e66, 0x000b), USB_DEVICE_DATA(&rt2800usb_ops) },
++ /* LevelOne */
++ { USB_DEVICE(0x1740, 0x0605), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x1740, 0x0615), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Linksys */
+ { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Logitec */
+ { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x0789, 0x0164), USB_DEVICE_DATA(&rt2800usb_ops) },
++ /* Pegatron */
++ { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Philips */
+ { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Planex */
+ { USB_DEVICE(0x2019, 0xed06), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x2019, 0xab25), USB_DEVICE_DATA(&rt2800usb_ops) },
++ /* Qcom */
++ { USB_DEVICE(0x18e8, 0x6259), USB_DEVICE_DATA(&rt2800usb_ops) },
++ /* Quanta */
++ { USB_DEVICE(0x1a32, 0x0304), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Ralink */
++ { USB_DEVICE(0x148f, 0x2070), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x148f, 0x2770), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x148f, 0x2870), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x148f, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x148f, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x148f, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Samsung */
+ { USB_DEVICE(0x04e8, 0x2018), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Siemens */
@@ -2909,9 +3009,18 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ { 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, 0x0039), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x0df6, 0x003b), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x0df6, 0x003c), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x0df6, 0x003d), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x0df6, 0x003e), 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, 0x7511), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x083a, 0x7512), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x083a, 0x7522), USB_DEVICE_DATA(&rt2800usb_ops) },
++ { USB_DEVICE(0x083a, 0x8522), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x083a, 0xb522), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x083a, 0xa618), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Sparklan */
@@ -2960,7 +3069,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+module_exit(rt2800usb_exit);
--- /dev/null
+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
-@@ -0,0 +1,1940 @@
+@@ -0,0 +1,1932 @@
+/*
+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
+ <http://rt2x00.serialmonkey.com>
@@ -3031,8 +3140,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#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.
@@ -3192,11 +3301,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000)
+
+/*
-+ * RINGREG_DIFF
-+ */
-+#define RINGREG_DIFF 0x0010
-+
-+/*
+ * GPIO_CTRL_CFG:
+ */
+#define GPIO_CTRL_CFG 0x0228
@@ -3771,6 +3875,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * TX_BAND_CFG: 0x1 use upper 20MHz, 0x0 use lower 20MHz
+ */
+#define TX_BAND_CFG 0x132c
++#define TX_BAND_CFG_HT40_PLUS FIELD32(0x00000001)
+#define TX_BAND_CFG_A FIELD32(0x00000002)
+#define TX_BAND_CFG_BG FIELD32(0x00000004)
+
@@ -4181,7 +4286,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * TX_STA_FIFO: TX Result for specific PID status fifo register
+ */
+#define TX_STA_FIFO 0x1718
-+#define TX_STA_FIFO_B_VALID FIELD32(0x00000001)
++#define TX_STA_FIFO_VALID FIELD32(0x00000001)
+#define TX_STA_FIFO_PID_TYPE FIELD32(0x0000001e)
+#define TX_STA_FIFO_TX_SUCCESS FIELD32(0x00000020)
+#define TX_STA_FIFO_TX_AGGRE FIELD32(0x00000040)
@@ -4306,12 +4411,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+} __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)
@@ -4404,7 +4503,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+/*
+ * HW_BEACON_BASE
+ * In order to support maximum 8 MBSS and its maximum length
-+ * is 512 bytes for each beacon
++ * is 512 bytes for each beacon
+ * Three section discontinue memory segments will be used.
+ * 1. The original region for BCN 0~3
+ * 2. Extract memory from FCE table for BCN 4~5
@@ -4450,10 +4549,12 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * BBP 3: RX Antenna
+ */
+#define BBP3_RX_ANTENNA FIELD8(0x18)
++#define BBP3_HT40_PLUS FIELD8(0x20)
+
+/*
+ * BBP 4: Bandwidth
+ */
++#define BBP4_TX_BF FIELD8(0x01)
+#define BBP4_BANDWIDTH FIELD8(0x18)
+
+/*
@@ -4516,7 +4617,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#define RF4_TXPOWER_A_7DBM_BOOST FIELD32(0x00000040)
+#define RF4_TXPOWER_A FIELD32(0x00000780)
+#define RF4_FREQ_OFFSET FIELD32(0x001f8000)
-+#define RF4_BW40 FIELD32(0x00200000)
++#define RF4_HT40 FIELD32(0x00200000)
+
+/*
+ * EEPROM content.
diff --git a/package/mac80211/patches/304-rt2x00-Detect-cypher-type-during-RX-rt2800pci.patch b/package/mac80211/patches/304-rt2x00-Detect-cypher-type-during-RX-rt2800pci.patch
new file mode 100644
index 0000000000..898a209504
--- /dev/null
+++ b/package/mac80211/patches/304-rt2x00-Detect-cypher-type-during-RX-rt2800pci.patch
@@ -0,0 +1,35 @@
+From f23c3d3175e55ebac81d6e29f1c1415491a78d60 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Tue, 3 Mar 2009 20:12:44 +0100
+Subject: [PATCH] rt2x00: Detect cypher type during RX (rt2800pci)
+
+Use UDF field in WCID entry to pass the cipher type
+to the RXWI fields. This will allow keeping track of
+the number of frames received with a particular cipher type
+which is exported through debugfs.
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800pci.c | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800pci.c
++++ b/drivers/net/wireless/rt2x00/rt2800pci.c
+@@ -339,7 +339,7 @@ static void rt2800pci_config_wcid_attr(s
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_CIPHER, crypto->cipher);
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_BSS_IDX,
+ (crypto->cmd == SET_KEY) * crypto->bssidx);
+- rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, 0);
++ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, crypto->cipher);
+ rt2x00pci_register_write(rt2x00dev, offset, reg);
+
+ offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
+@@ -1980,7 +1980,7 @@ static void rt2800pci_fill_rxdone(struct
+ * decryption. This prevents us from correct providing
+ * correct statistics through debugfs.
+ */
+- rxdesc->cipher = CIPHER_NONE;
++ rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF);
+ rxdesc->cipher_status =
+ rt2x00_get_field32(rxd3, RXD_W3_CIPHER_ERROR);
+ }
diff --git a/package/mac80211/patches/304-rt2x00-Remove-unused-define-rt2800pci.patch b/package/mac80211/patches/304-rt2x00-Remove-unused-define-rt2800pci.patch
deleted file mode 100644
index e5c4243feb..0000000000
--- a/package/mac80211/patches/304-rt2x00-Remove-unused-define-rt2800pci.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From f1ae9ab8a6572227dba5cab7d87f9ddcffc511f1 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Wed, 4 Feb 2009 22:58:52 +0100
-Subject: [PATCH] rt2x00: Remove unused define (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.h | 5 -----
- 1 files changed, 0 insertions(+), 5 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.h
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -250,11 +250,6 @@
- #define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000)
-
- /*
-- * RINGREG_DIFF
-- */
--#define RINGREG_DIFF 0x0010
--
--/*
- * GPIO_CTRL_CFG:
- */
- #define GPIO_CTRL_CFG 0x0228
diff --git a/package/mac80211/patches/305-rt2x00-Detect-cypher-type-during-RX-rt2800usb.patch b/package/mac80211/patches/305-rt2x00-Detect-cypher-type-during-RX-rt2800usb.patch
new file mode 100644
index 0000000000..831dda0015
--- /dev/null
+++ b/package/mac80211/patches/305-rt2x00-Detect-cypher-type-during-RX-rt2800usb.patch
@@ -0,0 +1,40 @@
+From 35c7358f5f7ba03daeecdf1fdceabd48ebcd029a Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Tue, 3 Mar 2009 20:15:17 +0100
+Subject: [PATCH] rt2x00: Detect cypher type during RX (rt2800usb)
+
+Use UDF field in WCID entry to pass the cipher type
+to the RXWI fields. This will allow keeping track of
+the number of frames received with a particular cipher type
+which is exported through debugfs.
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800usb.c | 9 ++-------
+ 1 files changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c
+@@ -366,7 +366,7 @@ static void rt2800usb_config_wcid_attr(s
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_CIPHER, crypto->cipher);
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_BSS_IDX,
+ (crypto->cmd == SET_KEY) * crypto->bssidx);
+- rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, 0);
++ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, crypto->cipher);
+ rt2x00usb_register_write(rt2x00dev, offset, reg);
+
+ offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
+@@ -2149,12 +2149,7 @@ static void rt2800usb_fill_rxdone(struct
+ rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
+
+ if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) {
+- /*
+- * Unfortunately we don't know the cipher type used during
+- * decryption. This prevents us from correct providing
+- * correct statistics through debugfs.
+- */
+- rxdesc->cipher = CIPHER_NONE;
++ rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF);
+ rxdesc->cipher_status =
+ rt2x00_get_field32(rxd0, RXD_W0_CIPHER_ERROR);
+ }
diff --git a/package/mac80211/patches/305-rt2x00-Remove-unused-define-rt2800usb.patch b/package/mac80211/patches/305-rt2x00-Remove-unused-define-rt2800usb.patch
deleted file mode 100644
index e80b7afb18..0000000000
--- a/package/mac80211/patches/305-rt2x00-Remove-unused-define-rt2800usb.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 73987de79371688cf9df939252b8989a60b98a19 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Wed, 4 Feb 2009 22:59:27 +0100
-Subject: [PATCH] rt2x00: Remove unused define (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.h | 5 -----
- 1 files changed, 0 insertions(+), 5 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.h
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
-@@ -229,11 +229,6 @@
- #define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000)
-
- /*
-- * RINGREG_DIFF
-- */
--#define RINGREG_DIFF 0x0010
--
--/*
- * GPIO_CTRL_CFG:
- */
- #define GPIO_CTRL_CFG 0x0228
diff --git a/package/mac80211/patches/306-rt2x00-Clean-header-rt2800pci.patch b/package/mac80211/patches/306-rt2x00-Clean-header-rt2800pci.patch
deleted file mode 100644
index f8dfc5d4cf..0000000000
--- a/package/mac80211/patches/306-rt2x00-Clean-header-rt2800pci.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 968e0cb7a8971d624cec720f11908789552bbf30 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Thu, 5 Feb 2009 22:43:50 +0100
-Subject: [PATCH] rt2x00: Clean header (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.h | 6 +++---
- 1 files changed, 3 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.h
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -342,7 +342,7 @@
- #define PBF_SYS_CTRL_HOST_RAM_WRITE FIELD32(0x00010000)
-
- /*
-- * PBF registers
-+ * PBF registers
- * Most are for debug. Driver doesn't touch PBF register.
- */
- #define PBF_CFG 0x0408
-@@ -370,7 +370,7 @@
- #define BCN_OFFSET1_BCN7 FIELD32(0xff000000)
-
- /*
-- * PBF registers
-+ * PBF registers
- * Most are for debug. Driver doesn't touch PBF register.
- */
- #define TXRXQ_PCNT 0x0438
-@@ -1630,7 +1630,7 @@ struct mac_iveiv_entry {
- #define EEPROM_TXPOWER_DELTA_TXPOWER FIELD16(0x0080)
-
- /*
-- * EEPROM TXPOWER 802.11G
-+ * EEPROM TXPOWER 802.11BG
- */
- #define EEPROM_TXPOWER_BG1 0x0029
- #define EEPROM_TXPOWER_BG2 0x0030
diff --git a/package/mac80211/patches/306-rt2x00-Fix-HW-crypto-offset-calculation-rt2800pci.patch b/package/mac80211/patches/306-rt2x00-Fix-HW-crypto-offset-calculation-rt2800pci.patch
new file mode 100644
index 0000000000..1fbef6c434
--- /dev/null
+++ b/package/mac80211/patches/306-rt2x00-Fix-HW-crypto-offset-calculation-rt2800pci.patch
@@ -0,0 +1,36 @@
+From e63585e28192e854707c549547645c669e6daa2a Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Wed, 4 Mar 2009 20:25:43 +0100
+Subject: [PATCH] rt2x00: Fix HW crypto offset calculation (rt2800pci)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800pci.c | 8 +++++---
+ 1 files changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800pci.c
++++ b/drivers/net/wireless/rt2x00/rt2800pci.c
+@@ -336,7 +336,8 @@ static void rt2800pci_config_wcid_attr(s
+ rt2x00pci_register_read(rt2x00dev, offset, &reg);
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_KEYTAB,
+ !!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE));
+- rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_CIPHER, crypto->cipher);
++ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_CIPHER,
++ (crypto->cmd == SET_KEY) * crypto->cipher);
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_BSS_IDX,
+ (crypto->cmd == SET_KEY) * crypto->bssidx);
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, crypto->cipher);
+@@ -393,10 +394,11 @@ static int rt2800pci_config_shared_key(s
+ * Using the correct defines correctly will cause overhead,
+ * so just calculate the correct offset.
+ */
+- field.bit_offset = (4 * key->keyidx) + (16 * (crypto->bssidx & 1));
++ field.bit_offset = 4 * (key->hw_key_idx % 8);
+ field.bit_mask = 0x7 << field.bit_offset;
+
+- offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 2);
++ offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8);
++
+ rt2x00pci_register_read(rt2x00dev, offset, &reg);
+ rt2x00_set_field32(&reg, field,
+ (crypto->cmd == SET_KEY) * crypto->cipher);
diff --git a/package/mac80211/patches/307-rt2x00-Clean-header-rt2800usb.patch b/package/mac80211/patches/307-rt2x00-Clean-header-rt2800usb.patch
deleted file mode 100644
index a84d2e68a7..0000000000
--- a/package/mac80211/patches/307-rt2x00-Clean-header-rt2800usb.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 402663d0e41c5039b2f4afe6f0c4dbb9e2d1e10d Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Thu, 5 Feb 2009 22:44:30 +0100
-Subject: [PATCH] rt2x00: Clean header (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.h | 4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.h
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
-@@ -1213,7 +1213,7 @@
- * TX_STA_FIFO: TX Result for specific PID status fifo register
- */
- #define TX_STA_FIFO 0x1718
--#define TX_STA_FIFO_B_VALID FIELD32(0x00000001)
-+#define TX_STA_FIFO_VALID FIELD32(0x00000001)
- #define TX_STA_FIFO_PID_TYPE FIELD32(0x0000001e)
- #define TX_STA_FIFO_TX_SUCCESS FIELD32(0x00000020)
- #define TX_STA_FIFO_TX_AGGRE FIELD32(0x00000040)
-@@ -1436,7 +1436,7 @@ struct mac_iveiv_entry {
- /*
- * HW_BEACON_BASE
- * In order to support maximum 8 MBSS and its maximum length
-- * is 512 bytes for each beacon
-+ * is 512 bytes for each beacon
- * Three section discontinue memory segments will be used.
- * 1. The original region for BCN 0~3
- * 2. Extract memory from FCE table for BCN 4~5
diff --git a/package/mac80211/patches/307-rt2x00-Fix-HW-crypto-offset-calculation-rt2800usb.patch b/package/mac80211/patches/307-rt2x00-Fix-HW-crypto-offset-calculation-rt2800usb.patch
new file mode 100644
index 0000000000..11a915e6b6
--- /dev/null
+++ b/package/mac80211/patches/307-rt2x00-Fix-HW-crypto-offset-calculation-rt2800usb.patch
@@ -0,0 +1,35 @@
+From d6368d8b77bb8568aa0c92adf1e507fb4198ff41 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Wed, 4 Mar 2009 20:26:27 +0100
+Subject: [PATCH] rt2x00: Fix HW crypto offset calculation (rt2800usb)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2800usb.c | 7 ++++---
+ 1 files changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c
+@@ -363,7 +363,8 @@ static void rt2800usb_config_wcid_attr(s
+ rt2x00usb_register_read(rt2x00dev, offset, &reg);
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_KEYTAB,
+ !!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE));
+- rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_CIPHER, crypto->cipher);
++ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_CIPHER,
++ (crypto->cmd == SET_KEY) * crypto->cipher);
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_BSS_IDX,
+ (crypto->cmd == SET_KEY) * crypto->bssidx);
+ rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, crypto->cipher);
+@@ -425,10 +426,10 @@ static int rt2800usb_config_shared_key(s
+ * Using the correct defines correctly will cause overhead,
+ * so just calculate the correct offset.
+ */
+- field.bit_offset = (4 * key->keyidx) + (16 * (crypto->bssidx & 1));
++ field.bit_offset = 4 * (key->hw_key_idx % 8);
+ field.bit_mask = 0x7 << field.bit_offset;
+
+- offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 2);
++ offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8);
+
+ rt2x00usb_register_read(rt2x00dev, offset, &reg);
+ rt2x00_set_field32(&reg, field,
diff --git a/package/mac80211/patches/308-rt2x00-Uncomment-get_tsf-rt2800usb.patch b/package/mac80211/patches/308-rt2x00-Uncomment-get_tsf-rt2800usb.patch
deleted file mode 100644
index 78e209c09c..0000000000
--- a/package/mac80211/patches/308-rt2x00-Uncomment-get_tsf-rt2800usb.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From b44184b2fd4075f85193b9e61a885b8c057dd4bc Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 7 Feb 2009 15:22:52 +0100
-Subject: [PATCH] rt2x00: Uncomment get_tsf (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c | 10 ----------
- 1 files changed, 0 insertions(+), 10 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -2696,13 +2696,6 @@ static int rt2800usb_conf_tx(struct ieee
- return 0;
- }
-
--#if 0
--/*
-- * Mac80211 demands get_tsf must be atomic.
-- * This is not possible for rt2800usb since all register access
-- * functions require sleeping. Untill mac80211 no longer needs
-- * get_tsf to be atomic, this function should be disabled.
-- */
- static u64 rt2800usb_get_tsf(struct ieee80211_hw *hw)
- {
- struct rt2x00_dev *rt2x00dev = hw->priv;
-@@ -2716,9 +2709,6 @@ static u64 rt2800usb_get_tsf(struct ieee
-
- return tsf;
- }
--#else
--#define rt2800usb_get_tsf NULL
--#endif
-
- static const struct ieee80211_ops rt2800usb_mac80211_ops = {
- .tx = rt2x00mac_tx,
diff --git a/package/mac80211/patches/309-rt2x00-Fix-MCS-rx_mask-rt2800pci.patch b/package/mac80211/patches/309-rt2x00-Fix-MCS-rx_mask-rt2800pci.patch
deleted file mode 100644
index 78f3019571..0000000000
--- a/package/mac80211/patches/309-rt2x00-Fix-MCS-rx_mask-rt2800pci.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From e53f1806ad975dce4888ec16398735e4c6ad6cde Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 7 Feb 2009 17:18:03 +0100
-Subject: [PATCH] rt2x00: Fix MCS rx_mask (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c | 22 ++++++++++++++++++++--
- 1 files changed, 20 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -2193,6 +2193,13 @@ static int rt2800pci_validate_eeprom(str
- rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
- EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
-+ } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
-+ /*
-+ * There is a max of 2 RX streams for RT2860 series
-+ */
-+ if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
-+ rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
-+ rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
- }
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
-@@ -2416,6 +2423,7 @@ static int rt2800pci_probe_hw_mode(struc
- char *tx_power1;
- char *tx_power2;
- unsigned int i;
-+ u16 eeprom;
-
- /*
- * Initialize all hw fields.
-@@ -2432,6 +2440,8 @@ static int rt2800pci_probe_hw_mode(struc
- rt2x00_eeprom_addr(rt2x00dev,
- EEPROM_MAC_ADDR_0));
-
-+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
-+
- /*
- * Initialize hw_mode information.
- */
-@@ -2463,11 +2473,19 @@ static int rt2800pci_probe_hw_mode(struc
- IEEE80211_HT_CAP_PSMP_SUPPORT;
- spec->ht.ampdu_factor = 3;
- spec->ht.ampdu_density = 4;
-- spec->ht.mcs.rx_mask[0] = 0xff;
-- spec->ht.mcs.rx_mask[1] = 0xff;
- spec->ht.mcs.tx_params =
- IEEE80211_HT_MCS_TX_DEFINED;
-
-+ switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
-+ case 3:
-+ spec->ht.mcs.rx_mask[2] = 0xff;
-+ case 2:
-+ spec->ht.mcs.rx_mask[1] = 0xff;
-+ case 1:
-+ spec->ht.mcs.rx_mask[0] = 0xff;
-+ break;
-+ }
-+
- /*
- * Create channel information array
- */
diff --git a/package/mac80211/patches/310-rt2x00-Fix-MCS-rx_mask-rt2800usb.patch b/package/mac80211/patches/310-rt2x00-Fix-MCS-rx_mask-rt2800usb.patch
deleted file mode 100644
index 87e0ca2554..0000000000
--- a/package/mac80211/patches/310-rt2x00-Fix-MCS-rx_mask-rt2800usb.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From d91bfd139f98e60222e7556b696b8caa66f658bb Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 7 Feb 2009 17:18:34 +0100
-Subject: [PATCH] rt2x00: Fix MCS rx_mask (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c | 22 ++++++++++++++++++++--
- 1 files changed, 20 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -2215,6 +2215,13 @@ static int rt2800usb_validate_eeprom(str
- rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
- rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
- EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
-+ } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
-+ /*
-+ * There is a max of 2 RX streams for RT2860 series
-+ */
-+ if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
-+ rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
-+ rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
- }
-
- rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
-@@ -2465,6 +2472,7 @@ static int rt2800usb_probe_hw_mode(struc
- char *tx_power1;
- char *tx_power2;
- unsigned int i;
-+ u16 eeprom;
-
- /*
- * Initialize all hw fields.
-@@ -2481,6 +2489,8 @@ static int rt2800usb_probe_hw_mode(struc
- rt2x00_eeprom_addr(rt2x00dev,
- EEPROM_MAC_ADDR_0));
-
-+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
-+
- /*
- * Initialize HT information.
- */
-@@ -2495,11 +2505,19 @@ static int rt2800usb_probe_hw_mode(struc
- IEEE80211_HT_CAP_PSMP_SUPPORT;
- spec->ht.ampdu_factor = 3;
- spec->ht.ampdu_density = 4;
-- spec->ht.mcs.rx_mask[0] = 0xff;
-- spec->ht.mcs.rx_mask[1] = 0xff;
- spec->ht.mcs.tx_params =
- IEEE80211_HT_MCS_TX_DEFINED;
-
-+ switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
-+ case 3:
-+ spec->ht.mcs.rx_mask[2] = 0xff;
-+ case 2:
-+ spec->ht.mcs.rx_mask[1] = 0xff;
-+ case 1:
-+ spec->ht.mcs.rx_mask[0] = 0xff;
-+ break;
-+ }
-+
- /*
- * Initialize hw_mode information.
- */
diff --git a/package/mac80211/patches/311-rt2x00-Channel-HT40-fixes-rt2800pci.patch b/package/mac80211/patches/311-rt2x00-Channel-HT40-fixes-rt2800pci.patch
deleted file mode 100644
index 310e22f048..0000000000
--- a/package/mac80211/patches/311-rt2x00-Channel-HT40-fixes-rt2800pci.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-From 1c042f183a52db009c2c0940ecff04ae954318e2 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sun, 8 Feb 2009 00:08:37 +0100
-Subject: [PATCH] rt2x00: Channel HT40+/- fixes (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c | 69 +++++++++++++++----------------
- drivers/net/wireless/rt2x00/rt2800pci.h | 3 +-
- 2 files changed, 36 insertions(+), 36 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -603,7 +603,7 @@ static void rt2800pci_config_ant(struct
- rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0);
- break;
- case 2:
-- rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 16);
-+ rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 2);
- break;
- case 3:
- /* Do nothing */
-@@ -653,6 +653,7 @@ static void rt2800pci_config_lna_gain(st
- }
-
- static void rt2800pci_config_channel(struct rt2x00_dev *rt2x00dev,
-+ struct ieee80211_conf *conf,
- struct rf_channel *rf,
- struct channel_info *info)
- {
-@@ -660,34 +661,20 @@ static void rt2800pci_config_channel(str
- unsigned int tx_pin;
- u16 eeprom;
-
-- tx_pin = 0;
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
--
- rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset);
-
- /*
- * Determine antenna settings from EEPROM
- */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
-+
- if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) == 1) {
- rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_TX1, 1);
-- /* Turn off unused PA or LNA when only 1T or 1R */
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 0);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 0);
- }
-
- if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) == 1) {
- rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX1, 1);
- rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX2, 1);
-- /* Turn off unused PA or LNA when only 1T or 1R */
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 0);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 0);
- } else if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) == 2)
- rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX2, 1);
-
-@@ -715,19 +702,14 @@ static void rt2800pci_config_channel(str
-
- rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A,
- TXPOWER_A_TO_DEV(info->tx_power2));
--
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, 1);
- } else {
- rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G,
- TXPOWER_G_TO_DEV(info->tx_power1));
- rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G,
- TXPOWER_G_TO_DEV(info->tx_power2));
--
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
- }
-
-- rt2x00_set_field32(&rf->rf4, RF4_BW40,
-- test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags));
-+ rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf));
-
- rt2800pci_rf_write(rt2x00dev, 1, rf->rf1);
- rt2800pci_rf_write(rt2x00dev, 2, rf->rf2);
-@@ -764,11 +746,6 @@ static void rt2800pci_config_channel(str
- rt2800pci_bbp_write(rt2x00dev, 82, 0x84);
- rt2800pci_bbp_write(rt2x00dev, 75, 0x50);
- }
--
-- rt2x00pci_register_read(rt2x00dev, TX_BAND_CFG, &reg);
-- rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_A, 0);
-- rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_BG, 1);
-- rt2x00pci_register_write(rt2x00dev, TX_BAND_CFG, reg);
- } else {
- rt2800pci_bbp_write(rt2x00dev, 82, 0xf2);
-
-@@ -776,13 +753,35 @@ static void rt2800pci_config_channel(str
- rt2800pci_bbp_write(rt2x00dev, 75, 0x46);
- else
- rt2800pci_bbp_write(rt2x00dev, 75, 0x50);
-+ }
-
-- rt2x00pci_register_read(rt2x00dev, TX_BAND_CFG, &reg);
-- rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_A, 1);
-- rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_BG, 0);
-- rt2x00pci_register_write(rt2x00dev, TX_BAND_CFG, reg);
-+ rt2x00pci_register_read(rt2x00dev, TX_BAND_CFG, &reg);
-+ rt2x00_set_field32(&reg, TX_BAND_CFG_HT40_PLUS, conf_is_ht40_plus(conf));
-+ rt2x00_set_field32(&reg, TX_BAND_CFG_A, rf->channel > 14);
-+ rt2x00_set_field32(&reg, TX_BAND_CFG_BG, rf->channel <= 14);
-+ rt2x00pci_register_write(rt2x00dev, TX_BAND_CFG, reg);
-+
-+ tx_pin = 0;
-+
-+ /* Turn on unused PA or LNA when not using 1T or 1R */
-+ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) != 1) {
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1);
-+ }
-+
-+ /* Turn on unused PA or LNA when not using 1T or 1R */
-+ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) != 1) {
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
- }
-
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, rf->channel <= 14);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, rf->channel > 14);
-+
- rt2x00pci_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
-
- msleep(1);
-@@ -917,8 +916,8 @@ static void rt2800pci_config(struct rt2x
- rt2800pci_config_lna_gain(rt2x00dev, libconf);
-
- if (flags & IEEE80211_CONF_CHANGE_CHANNEL)
-- rt2800pci_config_channel(rt2x00dev, &libconf->rf,
-- &libconf->channel);
-+ rt2800pci_config_channel(rt2x00dev, libconf->conf,
-+ &libconf->rf, &libconf->channel);
- if (flags & IEEE80211_CONF_CHANGE_POWER)
- rt2800pci_config_txpower(rt2x00dev, libconf->conf->power_level);
- if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
-@@ -2724,14 +2723,14 @@ static const struct rt2x00lib_ops rt2800
-
- static const struct data_queue_desc rt2800pci_queue_rx = {
- .entry_num = RX_ENTRIES,
-- .data_size = DATA_FRAME_SIZE,
-+ .data_size = AGGREGATION_SIZE,
- .desc_size = RXD_DESC_SIZE,
- .priv_size = sizeof(struct queue_entry_priv_pci),
- };
-
- static const struct data_queue_desc rt2800pci_queue_tx = {
- .entry_num = TX_ENTRIES,
-- .data_size = DATA_FRAME_SIZE,
-+ .data_size = AGGREGATION_SIZE,
- .desc_size = TXD_DESC_SIZE,
- .priv_size = sizeof(struct queue_entry_priv_pci),
- };
---- a/drivers/net/wireless/rt2x00/rt2800pci.h
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -791,6 +791,7 @@
- * TX_BAND_CFG: 0x1 use upper 20MHz, 0x0 use lower 20MHz
- */
- #define TX_BAND_CFG 0x132c
-+#define TX_BAND_CFG_HT40_PLUS FIELD32(0x00000001)
- #define TX_BAND_CFG_A FIELD32(0x00000002)
- #define TX_BAND_CFG_BG FIELD32(0x00000004)
-
-@@ -1496,7 +1497,7 @@ struct mac_iveiv_entry {
- #define RF4_TXPOWER_A_7DBM_BOOST FIELD32(0x00000040)
- #define RF4_TXPOWER_A FIELD32(0x00000780)
- #define RF4_FREQ_OFFSET FIELD32(0x001f8000)
--#define RF4_BW40 FIELD32(0x00200000)
-+#define RF4_HT40 FIELD32(0x00200000)
-
- /*
- * EEPROM content.
diff --git a/package/mac80211/patches/312-rt2x00-Channel-HT40-fixes-rt2800usb.patch b/package/mac80211/patches/312-rt2x00-Channel-HT40-fixes-rt2800usb.patch
deleted file mode 100644
index 471eae56a8..0000000000
--- a/package/mac80211/patches/312-rt2x00-Channel-HT40-fixes-rt2800usb.patch
+++ /dev/null
@@ -1,258 +0,0 @@
-From 1ef7772f766c72f9b767d32cc0b26d457a34ace2 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sun, 8 Feb 2009 00:09:22 +0100
-Subject: [PATCH] rt2x00: Channel HT40+/- fixes (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c | 107 ++++++++++++++++--------------
- drivers/net/wireless/rt2x00/rt2800usb.h | 5 +-
- 2 files changed, 61 insertions(+), 51 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -641,7 +641,7 @@ static void rt2800usb_config_ant(struct
- rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0);
- break;
- case 2:
-- rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 16);
-+ rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 2);
- break;
- case 3:
- /* Do nothing */
-@@ -691,6 +691,7 @@ static void rt2800usb_config_lna_gain(st
- }
-
- static void rt2800usb_config_channel_rt2x(struct rt2x00_dev *rt2x00dev,
-+ struct ieee80211_conf *conf,
- struct rf_channel *rf,
- struct channel_info *info)
- {
-@@ -702,6 +703,7 @@ static void rt2800usb_config_channel_rt2
- * Determine antenna settings from EEPROM
- */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
-+
- if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) == 1)
- rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_TX1, 1);
-
-@@ -742,8 +744,7 @@ static void rt2800usb_config_channel_rt2
- TXPOWER_G_TO_DEV(info->tx_power2));
- }
-
-- rt2x00_set_field32(&rf->rf4, RF4_BW40,
-- test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags));
-+ rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf));
-
- rt2800usb_rf_write(rt2x00dev, 1, rf->rf1);
- rt2800usb_rf_write(rt2x00dev, 2, rf->rf2);
-@@ -766,6 +767,7 @@ static void rt2800usb_config_channel_rt2
- }
-
- static void rt2800usb_config_channel_rt3x(struct rt2x00_dev *rt2x00dev,
-+ struct ieee80211_conf *conf,
- struct rf_channel *rf,
- struct channel_info *info)
- {
-@@ -787,10 +789,12 @@ static void rt2800usb_config_channel_rt3
- rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
- rt2800usb_rfcsr_write(rt2x00dev, 23, rfcsr);
-
-- if (test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags))
-- rt2800usb_rfcsr_write(rt2x00dev, 24, rt2x00dev->calibration_bw40);
-+ if (conf_is_ht40(conf))
-+ rt2800usb_rfcsr_write(rt2x00dev, 24,
-+ rt2x00dev->calibration_bw40);
- else
-- rt2800usb_rfcsr_write(rt2x00dev, 24, rt2x00dev->calibration_bw20);
-+ rt2800usb_rfcsr_write(rt2x00dev, 24,
-+ rt2x00dev->calibration_bw20);
-
- rt2800usb_rfcsr_read(rt2x00dev, 23, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1);
-@@ -798,46 +802,24 @@ static void rt2800usb_config_channel_rt3
- }
-
- static void rt2800usb_config_channel(struct rt2x00_dev *rt2x00dev,
-+ struct ieee80211_conf *conf,
- struct rf_channel *rf,
- struct channel_info *info)
- {
- u32 reg;
- unsigned int tx_pin;
- u16 eeprom;
-+ u8 bbp;
-
-- if (rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION)
-- rt2800usb_config_channel_rt2x(rt2x00dev, rf, info);
-- else
-- rt2800usb_config_channel_rt3x(rt2x00dev, rf, info);
--
-- tx_pin = 0;
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
--
-+ /*
-+ * Determine antenna settings from EEPROM
-+ */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
-
-- /* Turn off unused PA or LNA when only 1T or 1R */
-- if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) == 1) {
--
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 0);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 0);
-- }
--
-- /* Turn off unused PA or LNA when only 1T or 1R */
-- if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) == 1) {
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 0);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 0);
-- }
--
-- if (rf->channel > 14)
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, 1);
-+ if (rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION)
-+ rt2800usb_config_channel_rt2x(rt2x00dev, conf, rf, info);
- else
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
-+ rt2800usb_config_channel_rt3x(rt2x00dev, conf, rf, info);
-
- /*
- * Change BBP settings
-@@ -855,11 +837,6 @@ static void rt2800usb_config_channel(str
- rt2800usb_bbp_write(rt2x00dev, 82, 0x84);
- rt2800usb_bbp_write(rt2x00dev, 75, 0x50);
- }
--
-- rt2x00usb_register_read(rt2x00dev, TX_BAND_CFG, &reg);
-- rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_A, 0);
-- rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_BG, 1);
-- rt2x00usb_register_write(rt2x00dev, TX_BAND_CFG, reg);
- } else {
- rt2800usb_bbp_write(rt2x00dev, 82, 0xf2);
-
-@@ -867,15 +844,45 @@ static void rt2800usb_config_channel(str
- rt2800usb_bbp_write(rt2x00dev, 75, 0x46);
- else
- rt2800usb_bbp_write(rt2x00dev, 75, 0x50);
-+ }
-+
-+ rt2x00usb_register_read(rt2x00dev, TX_BAND_CFG, &reg);
-+ rt2x00_set_field32(&reg, TX_BAND_CFG_HT40_PLUS, conf_is_ht40_plus(conf));
-+ rt2x00_set_field32(&reg, TX_BAND_CFG_A, rf->channel > 14);
-+ rt2x00_set_field32(&reg, TX_BAND_CFG_BG, rf->channel <= 14);
-+ rt2x00usb_register_write(rt2x00dev, TX_BAND_CFG, reg);
-+
-+ tx_pin = 0;
-+
-+ /* Turn on unused PA or LNA when not using 1T or 1R */
-+ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) != 1) {
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1);
-+ }
-
-- rt2x00usb_register_read(rt2x00dev, TX_BAND_CFG, &reg);
-- rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_A, 1);
-- rt2x00_set_field32(&rf->rf3, TX_BAND_CFG_BG, 0);
-- rt2x00usb_register_write(rt2x00dev, TX_BAND_CFG, reg);
-+ /* Turn on unused PA or LNA when not using 1T or 1R */
-+ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) != 1) {
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
- }
-
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, rf->channel <= 14);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, rf->channel > 14);
-+
- rt2x00usb_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
-
-+ rt2800usb_bbp_read(rt2x00dev, 4, &bbp);
-+ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
-+ rt2800usb_bbp_write(rt2x00dev, 4, bbp);
-+
-+ rt2800usb_bbp_read(rt2x00dev, 3, &bbp);
-+ rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf));
-+ rt2800usb_bbp_write(rt2x00dev, 3, bbp);
-+
- msleep(1);
- }
-
-@@ -1008,8 +1015,8 @@ static void rt2800usb_config(struct rt2x
- rt2800usb_config_lna_gain(rt2x00dev, libconf);
-
- if (flags & IEEE80211_CONF_CHANGE_CHANNEL)
-- rt2800usb_config_channel(rt2x00dev, &libconf->rf,
-- &libconf->channel);
-+ rt2800usb_config_channel(rt2x00dev, libconf->conf,
-+ &libconf->rf, &libconf->channel);
- if (flags & IEEE80211_CONF_CHANGE_POWER)
- rt2800usb_config_txpower(rt2x00dev, libconf->conf->power_level);
- if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
-@@ -1643,7 +1650,7 @@ static u8 rt2800usb_init_rx_filter(struc
-
- if (bw40) {
- rt2800usb_bbp_read(rt2x00dev, 4, &bbp);
-- rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0x10);
-+ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2);
- rt2800usb_bbp_write(rt2x00dev, 4, bbp);
- }
-
-@@ -2777,14 +2784,14 @@ static const struct rt2x00lib_ops rt2800
-
- static const struct data_queue_desc rt2800usb_queue_rx = {
- .entry_num = RX_ENTRIES,
-- .data_size = DATA_FRAME_SIZE,
-+ .data_size = AGGREGATION_SIZE,
- .desc_size = RXD_DESC_SIZE + RXWI_DESC_SIZE,
- .priv_size = sizeof(struct queue_entry_priv_usb),
- };
-
- static const struct data_queue_desc rt2800usb_queue_tx = {
- .entry_num = TX_ENTRIES,
-- .data_size = DATA_FRAME_SIZE,
-+ .data_size = AGGREGATION_SIZE,
- .desc_size = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
- .priv_size = sizeof(struct queue_entry_priv_usb),
- };
---- a/drivers/net/wireless/rt2x00/rt2800usb.h
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
-@@ -803,6 +803,7 @@
- * TX_BAND_CFG: 0x1 use upper 20MHz, 0x0 use lower 20MHz
- */
- #define TX_BAND_CFG 0x132c
-+#define TX_BAND_CFG_HT40_PLUS FIELD32(0x00000001)
- #define TX_BAND_CFG_A FIELD32(0x00000002)
- #define TX_BAND_CFG_BG FIELD32(0x00000004)
-
-@@ -1482,10 +1483,12 @@ struct mac_iveiv_entry {
- * BBP 3: RX Antenna
- */
- #define BBP3_RX_ANTENNA FIELD8(0x18)
-+#define BBP3_HT40_PLUS FIELD8(0x20)
-
- /*
- * BBP 4: Bandwidth
- */
-+#define BBP4_TX_BF FIELD8(0x01)
- #define BBP4_BANDWIDTH FIELD8(0x18)
-
- /*
-@@ -1548,7 +1551,7 @@ struct mac_iveiv_entry {
- #define RF4_TXPOWER_A_7DBM_BOOST FIELD32(0x00000040)
- #define RF4_TXPOWER_A FIELD32(0x00000780)
- #define RF4_FREQ_OFFSET FIELD32(0x001f8000)
--#define RF4_BW40 FIELD32(0x00200000)
-+#define RF4_HT40 FIELD32(0x00200000)
-
- /*
- * EEPROM content.
diff --git a/package/mac80211/patches/313-rt2x00-Add-RT2860C-BBP-channel-init-values-rt2800u.patch b/package/mac80211/patches/313-rt2x00-Add-RT2860C-BBP-channel-init-values-rt2800u.patch
deleted file mode 100644
index ce3a967041..0000000000
--- a/package/mac80211/patches/313-rt2x00-Add-RT2860C-BBP-channel-init-values-rt2800u.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From fbccaabad6a109972a36bfe812d67f3678eb1187 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/314-rt2x00-Remove-invalid-RX-antenna-init-rt2800usb.patch b/package/mac80211/patches/314-rt2x00-Remove-invalid-RX-antenna-init-rt2800usb.patch
deleted file mode 100644
index 857f0e0dd5..0000000000
--- a/package/mac80211/patches/314-rt2x00-Remove-invalid-RX-antenna-init-rt2800usb.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-From 9a8e2f3909f43e4541ffa63985812aaa6b4c03be 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/315-rt2x00-Remove-check-for-rf-word-0-rt2800pci.patch b/package/mac80211/patches/315-rt2x00-Remove-check-for-rf-word-0-rt2800pci.patch
deleted file mode 100644
index e5cf1e89f1..0000000000
--- a/package/mac80211/patches/315-rt2x00-Remove-check-for-rf-word-0-rt2800pci.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 7519f0a01c65f7b34eeff9411aa90373e082e501 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/316-rt2x00-Remove-check-for-rf-word-0-rt2800usb.patch b/package/mac80211/patches/316-rt2x00-Remove-check-for-rf-word-0-rt2800usb.patch
deleted file mode 100644
index bff0f9547a..0000000000
--- a/package/mac80211/patches/316-rt2x00-Remove-check-for-rf-word-0-rt2800usb.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 192a3f0a429de8e892f80f02eae26855f96fb1b9 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/317-rt2x00-Export-all-register-stats-through-debugfs.patch b/package/mac80211/patches/317-rt2x00-Export-all-register-stats-through-debugfs.patch
deleted file mode 100644
index 1e525c091c..0000000000
--- a/package/mac80211/patches/317-rt2x00-Export-all-register-stats-through-debugfs.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 208d46bb33a37ef16b4044d15d58c21ebc89552f 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
-@@ -547,9 +547,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);
-@@ -570,14 +570,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/318-rt2x00-Add-USB-id-rt2800usb.patch b/package/mac80211/patches/318-rt2x00-Add-USB-id-rt2800usb.patch
deleted file mode 100644
index eab59297cb..0000000000
--- a/package/mac80211/patches/318-rt2x00-Add-USB-id-rt2800usb.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-From 683197e1819e1893d210a54e2470478377c8725d 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/319-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch b/package/mac80211/patches/319-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
deleted file mode 100644
index b80c461b0c..0000000000
--- a/package/mac80211/patches/319-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 6b12c7bb631dd47cff8b0bad6d47c4b2439c6a59 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/320-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch b/package/mac80211/patches/320-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
deleted file mode 100644
index e276df2131..0000000000
--- a/package/mac80211/patches/320-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From e65441d3066e5a37b480e6fc8f0e9fbc43e86ba4 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/321-rt2x00-Add-support-for-MCS32-rt2800usb.patch b/package/mac80211/patches/321-rt2x00-Add-support-for-MCS32-rt2800usb.patch
deleted file mode 100644
index c8c54a4011..0000000000
--- a/package/mac80211/patches/321-rt2x00-Add-support-for-MCS32-rt2800usb.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 96bb01c0363ca6a33a1071d88bfd77bc2654b051 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/322-rt2x00-Add-support-for-MCS32-rt2800pci.patch b/package/mac80211/patches/322-rt2x00-Add-support-for-MCS32-rt2800pci.patch
deleted file mode 100644
index ced722589d..0000000000
--- a/package/mac80211/patches/322-rt2x00-Add-support-for-MCS32-rt2800pci.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-From 393ae935075d0d253e1855e5fed6db92b1766a91 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;
- }
-
diff --git a/package/mac80211/patches/323-rt2x00-Add-RT3070-detection.patch b/package/mac80211/patches/323-rt2x00-Add-RT3070-detection.patch
deleted file mode 100644
index 9c186fffc3..0000000000
--- a/package/mac80211/patches/323-rt2x00-Add-RT3070-detection.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From 4fd4f7fd1db857b86fa3e6a1165f1ff051a71a7d Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 21 Feb 2009 10:57:03 +0100
-Subject: [PATCH] rt2x00: Add RT3070 detection
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c | 3 ++-
- 1 files changed, 2 insertions(+), 1 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -2338,7 +2338,8 @@ static int rt2800usb_init_eeprom(struct
- * identifies itself as rt2860 in the CSR register.
- */
- if ((rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x2860) &&
-- (rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x2870)) {
-+ (rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x2870) &&
-+ (rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x3070)) {
- ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
- return -ENODEV;
- }
diff --git a/package/mac80211/patches/324-rt2x00-Correctly-initialize-TXINFO-for-crypto-rt28.patch b/package/mac80211/patches/324-rt2x00-Correctly-initialize-TXINFO-for-crypto-rt28.patch
deleted file mode 100644
index 929cdbe42a..0000000000
--- a/package/mac80211/patches/324-rt2x00-Correctly-initialize-TXINFO-for-crypto-rt28.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From dde442877db96055110a9c7c55fa1cb95cc1d87e Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 21 Feb 2009 20:40:23 +0100
-Subject: [PATCH] rt2x00: Correctly initialize TXINFO for crypto (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c | 22 +++++++++++-----------
- 1 files changed, 11 insertions(+), 11 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -331,7 +331,7 @@ static void rt2800pci_config_wcid_attr(s
- u32 offset;
- u32 reg;
-
-- offset = MAC_WCID_ATTR_ENTRY(crypto->aid);
-+ offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx);
-
- rt2x00pci_register_read(rt2x00dev, offset, &reg);
- rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_KEYTAB,
-@@ -342,7 +342,7 @@ static void rt2800pci_config_wcid_attr(s
- rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, 0);
- rt2x00pci_register_write(rt2x00dev, offset, reg);
-
-- offset = MAC_IVEIV_ENTRY(crypto->aid);
-+ offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
-
- memset(&iveiv_entry, 0, sizeof(iveiv_entry));
- if ((crypto->cipher == CIPHER_TKIP) ||
-@@ -353,7 +353,7 @@ static void rt2800pci_config_wcid_attr(s
- rt2x00pci_register_multiwrite(rt2x00dev, offset,
- &iveiv_entry, sizeof(iveiv_entry));
-
-- offset = MAC_WCID_ENTRY(crypto->aid);
-+ offset = MAC_WCID_ENTRY(key->hw_key_idx);
-
- memset(&wcid_entry, 0, sizeof(wcid_entry));
- if (crypto->cmd == SET_KEY)
-@@ -393,10 +393,10 @@ static int rt2800pci_config_shared_key(s
- * Using the correct defines correctly will cause overhead,
- * so just calculate the correct offset.
- */
-- field.bit_offset = (4 * key->keyidx);
-+ field.bit_offset = (4 * key->keyidx) + (16 * (crypto->bssidx & 1));
- field.bit_mask = 0x7 << field.bit_offset;
-
-- offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8);
-+ offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 2);
- rt2x00pci_register_read(rt2x00dev, offset, &reg);
- rt2x00_set_field32(&reg, field,
- (crypto->cmd == SET_KEY) * crypto->cipher);
-@@ -1813,16 +1813,15 @@ static void rt2800pci_write_tx_desc(stru
- test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
- rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
- rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
-- skbdesc->entry->entry_idx);
-+ test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
-+ txdesc->key_idx : 0xff);
- rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, skb->len);
- rt2x00_set_field32(&word, TXWI_W1_PACKETID,
- skbdesc->entry->queue->qid);
- rt2x00_desc_write(txwi, 1, word);
-
-- if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) {
-- _rt2x00_desc_write(txwi, 2, skbdesc->iv[0]);
-- _rt2x00_desc_write(txwi, 3, skbdesc->iv[1]);
-- }
-+ _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
-+ _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
-
- /*
- * Initialize TX descriptor
-@@ -1849,7 +1848,8 @@ static void rt2800pci_write_tx_desc(stru
- rt2x00_desc_write(txd, 2, word);
-
- rt2x00_desc_read(txd, 3, &word);
-- rt2x00_set_field32(&word, TXD_W3_WIV, 1);
-+ rt2x00_set_field32(&word, TXD_W3_WIV,
-+ !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
- rt2x00_set_field32(&word, TXD_W3_QSEL, 2);
- rt2x00_desc_write(txd, 3, word);
- }
diff --git a/package/mac80211/patches/325-rt2x00-Correctly-initialize-TXINFO-for-crypto-rt28.patch b/package/mac80211/patches/325-rt2x00-Correctly-initialize-TXINFO-for-crypto-rt28.patch
deleted file mode 100644
index bde32c63e7..0000000000
--- a/package/mac80211/patches/325-rt2x00-Correctly-initialize-TXINFO-for-crypto-rt28.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From 3bb9fb0141f276cd330e3eaee5c5e75b7f8bdb6a Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 21 Feb 2009 20:41:06 +0100
-Subject: [PATCH] rt2x00: Correctly initialize TXINFO for crypto (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c | 23 ++++++++++++-----------
- 1 files changed, 12 insertions(+), 11 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -358,7 +358,7 @@ static void rt2800usb_config_wcid_attr(s
- u32 offset;
- u32 reg;
-
-- offset = MAC_WCID_ATTR_ENTRY(crypto->aid);
-+ offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx);
-
- rt2x00usb_register_read(rt2x00dev, offset, &reg);
- rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_KEYTAB,
-@@ -369,7 +369,7 @@ static void rt2800usb_config_wcid_attr(s
- rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, 0);
- rt2x00usb_register_write(rt2x00dev, offset, reg);
-
-- offset = MAC_IVEIV_ENTRY(crypto->aid);
-+ offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
-
- memset(&iveiv_entry, 0, sizeof(iveiv_entry));
- if ((crypto->cipher == CIPHER_TKIP) ||
-@@ -380,7 +380,7 @@ static void rt2800usb_config_wcid_attr(s
- rt2x00usb_register_multiwrite(rt2x00dev, offset,
- &iveiv_entry, sizeof(iveiv_entry));
-
-- offset = MAC_WCID_ENTRY(crypto->aid);
-+ offset = MAC_WCID_ENTRY(key->hw_key_idx);
-
- memset(&wcid_entry, 0, sizeof(wcid_entry));
- if (crypto->cmd == SET_KEY)
-@@ -425,10 +425,10 @@ static int rt2800usb_config_shared_key(s
- * Using the correct defines correctly will cause overhead,
- * so just calculate the correct offset.
- */
-- field.bit_offset = (4 * key->keyidx);
-+ field.bit_offset = (4 * key->keyidx) + (16 * (crypto->bssidx & 1));
- field.bit_mask = 0x7 << field.bit_offset;
-
-- offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8);
-+ offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 2);
-
- rt2x00usb_register_read(rt2x00dev, offset, &reg);
- rt2x00_set_field32(&reg, field,
-@@ -2001,16 +2001,16 @@ static void rt2800usb_write_tx_desc(stru
- rt2x00_set_field32(&word, TXWI_W1_NSEQ,
- test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
- rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
-- rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, 0xff);
-+ rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
-+ test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
-+ txdesc->key_idx : 0xff);
- rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, skb->len);
- rt2x00_set_field32(&word, TXWI_W1_PACKETID,
- skbdesc->entry->entry_idx);
- rt2x00_desc_write(txwi, 1, word);
-
-- if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) {
-- _rt2x00_desc_write(txwi, 2, skbdesc->iv[0]);
-- _rt2x00_desc_write(txwi, 3, skbdesc->iv[1]);
-- }
-+ _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
-+ _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
-
- /*
- * Initialize TX descriptor
-@@ -2018,7 +2018,8 @@ static void rt2800usb_write_tx_desc(stru
- rt2x00_desc_read(txi, 0, &word);
- rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
- skb->len + TXWI_DESC_SIZE);
-- rt2x00_set_field32(&word, TXINFO_W0_WIV, 1);
-+ rt2x00_set_field32(&word, TXINFO_W0_WIV,
-+ !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
- rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);
- rt2x00_set_field32(&word, TXINFO_W0_SW_USE_LAST_ROUND, 0);
- rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_NEXT_VALID, 0);
diff --git a/package/mac80211/patches/401-ath9k-dont-register-leds-on-ar9100.patch b/package/mac80211/patches/401-ath9k-dont-register-leds-on-ar9100.patch
index a5292b0b95..ea8e2da17f 100644
--- a/package/mac80211/patches/401-ath9k-dont-register-leds-on-ar9100.patch
+++ b/package/mac80211/patches/401-ath9k-dont-register-leds-on-ar9100.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
-@@ -1036,6 +1036,9 @@ static void ath_unregister_led(struct at
+@@ -1027,6 +1027,9 @@ static void ath_unregister_led(struct at
static void ath_deinit_leds(struct ath_softc *sc)
{
@@ -10,7 +10,7 @@
cancel_delayed_work_sync(&sc->ath_led_blink_work);
ath_unregister_led(&sc->assoc_led);
sc->sc_flags &= ~SC_OP_LED_ASSOCIATED;
-@@ -1050,6 +1053,9 @@ static void ath_init_leds(struct ath_sof
+@@ -1041,6 +1044,9 @@ static void ath_init_leds(struct ath_sof
char *trigger;
int ret;
diff --git a/package/mac80211/patches/404-ath9k-fix-AR_TXCFG_DMASZ_MASK-value.patch b/package/mac80211/patches/404-ath9k-fix-AR_TXCFG_DMASZ_MASK-value.patch
deleted file mode 100644
index 44b237bc02..0000000000
--- a/package/mac80211/patches/404-ath9k-fix-AR_TXCFG_DMASZ_MASK-value.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 65f2e0de53bdb745149c8d9b4e6867f8394a789b Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Sat, 10 Jan 2009 14:27:29 +0100
-Subject: [PATCH] ath9k: fix AR_TXCFG_DMASZ_MASK value
-
-The current bitmask is invalid, because the tx dma size is a 3 bit wide
-value.
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
----
- drivers/net/wireless/ath9k/reg.h | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/net/wireless/ath9k/reg.h b/drivers/net/wireless/ath9k/reg.h
-index 8d85106..91442da 100644
---- a/drivers/net/wireless/ath9k/reg.h
-+++ b/drivers/net/wireless/ath9k/reg.h
-@@ -67,7 +67,7 @@
- #define AR_DMASIZE_512B 0x00000007
-
- #define AR_TXCFG 0x0030
--#define AR_TXCFG_DMASZ_MASK 0x00000003
-+#define AR_TXCFG_DMASZ_MASK 0x00000007
- #define AR_TXCFG_DMASZ_4B 0
- #define AR_TXCFG_DMASZ_8B 1
- #define AR_TXCFG_DMASZ_16B 2
---
-1.5.3.2
-
diff --git a/package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch b/package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch
index a208e1cda0..d58aa309ae 100644
--- a/package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch
+++ b/package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch
@@ -47,8 +47,6 @@ cause problems on them.
Regards,
Gabor
-diff --git a/drivers/net/wireless/ath9k/initvals.h b/drivers/net/wireless/ath9k/initvals.h
-index d492363..4eb8b59 100644
--- a/drivers/net/wireless/ath9k/initvals.h
+++ b/drivers/net/wireless/ath9k/initvals.h
@@ -14,7 +14,7 @@
@@ -60,7 +58,7 @@ index d492363..4eb8b59 100644
{ 0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160, 0x000001e0 },
{ 0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c, 0x000001e0 },
{ 0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38, 0x00001180 },
-@@ -78,7 +78,7 @@ static const u32 ar5416Modes_9100[][6] = {
+@@ -78,7 +78,7 @@ static const u32 ar5416Modes_9100[][6] =
{ 0x0000a334, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
};
@@ -69,7 +67,7 @@ index d492363..4eb8b59 100644
{ 0x0000000c, 0x00000000 },
{ 0x00000030, 0x00020015 },
{ 0x00000034, 0x00000005 },
-@@ -456,12 +456,12 @@ static const u32 ar5416Common_9100[][2] = {
+@@ -456,12 +456,12 @@ static const u32 ar5416Common_9100[][2]
{ 0x0000a3e0, 0x000001ce },
};
@@ -84,7 +82,7 @@ index d492363..4eb8b59 100644
{ 0x00009a00, 0x00000000, 0x00000000 },
{ 0x00009a04, 0x00000040, 0x00000040 },
{ 0x00009a08, 0x00000080, 0x00000080 },
-@@ -528,21 +528,21 @@ static const u32 ar5416BB_RfGain_9100[][3] = {
+@@ -528,21 +528,21 @@ static const u32 ar5416BB_RfGain_9100[][
{ 0x00009afc, 0x000000f9, 0x000000f9 },
};
@@ -110,7 +108,7 @@ index d492363..4eb8b59 100644
{ 0x0000989c, 0x00000000, 0x00000000 },
{ 0x0000989c, 0x00000000, 0x00000000 },
-@@ -579,7 +579,7 @@ static const u32 ar5416Bank6_9100[][3] = {
+@@ -579,7 +579,7 @@ static const u32 ar5416Bank6_9100[][3] =
{ 0x000098d0, 0x0000000f, 0x0010000f },
};
@@ -119,7 +117,7 @@ index d492363..4eb8b59 100644
{ 0x0000989c, 0x00000000, 0x00000000 },
{ 0x0000989c, 0x00000000, 0x00000000 },
{ 0x0000989c, 0x00000000, 0x00000000 },
-@@ -615,13 +615,13 @@ static const u32 ar5416Bank6TPC_9100[][3] = {
+@@ -615,13 +615,13 @@ static const u32 ar5416Bank6TPC_9100[][3
{ 0x000098d0, 0x0000000f, 0x0010000f },
};
@@ -135,7 +133,7 @@ index d492363..4eb8b59 100644
{0x0000989c, 0x00000000 },
{0x0000989c, 0x00000003 },
{0x0000989c, 0x00000000 },
-@@ -661,7 +661,7 @@ static const u32 ar5416Addac_9100[][2] = {
+@@ -661,7 +661,7 @@ static const u32 ar5416Addac_9100[][2] =
{0x000098cc, 0x00000000 },
};
@@ -168,7 +166,7 @@ index d492363..4eb8b59 100644
{ 0x00009a00, 0x00000000, 0x00000000 },
{ 0x00009a04, 0x00000040, 0x00000040 },
{ 0x00009a08, 0x00000080, 0x00000080 },
-@@ -1181,21 +1181,21 @@ static const u32 ar5416BB_RfGain[][3] = {
+@@ -1181,21 +1181,21 @@ static const u32 ar5416BB_RfGain[][3] =
{ 0x00009afc, 0x000000f9, 0x000000f9 },
};
@@ -219,8 +217,6 @@ index d492363..4eb8b59 100644
{0x0000989c, 0x00000000 },
{0x0000989c, 0x00000000 },
{0x0000989c, 0x00000000 },
-diff --git a/drivers/net/wireless/ath9k/reg.h b/drivers/net/wireless/ath9k/reg.h
-index 8d85106..22a14a4 100644
--- a/drivers/net/wireless/ath9k/reg.h
+++ b/drivers/net/wireless/ath9k/reg.h
@@ -158,14 +158,6 @@
@@ -277,6 +273,3 @@ index 8d85106..22a14a4 100644
#define AR_SREV_9160(_ah) \
(((_ah)->hw_version.macVersion == AR_SREV_VERSION_9160))
#define AR_SREV_9160_10_OR_LATER(_ah) \
---
-1.5.3.2
-