[package] mac80211: update compat-wireless to 2009-01-24 (patch by Hauke Mehrtens...
authorGabor Juhos <juhosg@openwrt.org>
Sun, 25 Jan 2009 13:33:34 +0000 (13:33 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sun, 25 Jan 2009 13:33:34 +0000 (13:33 +0000)
SVN-Revision: 14172

23 files changed:
package/mac80211/Makefile
package/mac80211/patches/301-rt2x00-Implement-support-for-802.11n.patch
package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch
package/mac80211/patches/303-rt2x00-Implement-support-for-rt2800usb.patch
package/mac80211/patches/305-rt2x00-Update-rt2x00ht.patch [deleted file]
package/mac80211/patches/306-rt2x00-Update-rt2800pci.patch [deleted file]
package/mac80211/patches/307-rt2x00-Update-rt2800usb.patch [deleted file]
package/mac80211/patches/308-rt2x00-Add-powersaving-support-rt2800pci.patch [deleted file]
package/mac80211/patches/309-rt2x00-Add-powersaving-support-rt2800usb.patch [deleted file]
package/mac80211/patches/310-rt2x00-Accept-beacons-in-normal-mode-rt2800pci.patch [deleted file]
package/mac80211/patches/311-rt2x00-Accept-beacons-in-normal-mode-rt2800usb.patch [deleted file]
package/mac80211/patches/312-rt2x00-Fix-TX-descriptor-usage-rt2800usb.patch [deleted file]
package/mac80211/patches/313-rt2x00-Add-TXWI-to-DMA-size-rt2800usb.patch [deleted file]
package/mac80211/patches/314-rt2x00-Wait-for-WPDMA-between-CRS-and-BBP-init-rt2.patch [deleted file]
package/mac80211/patches/316-rt2x00-Fix-register-initialization-rt2800pci.patch [deleted file]
package/mac80211/patches/317-rt2x00-Fix-register-initialization-rt2800usb.patch [deleted file]
package/mac80211/patches/319-rt2x00-More-register-fixes-rt2800pci.patch [deleted file]
package/mac80211/patches/320-rt2x00-More-register-fixes-rt2800usb.patch [deleted file]
package/mac80211/patches/324-rt2x00-Fix-preamble-detection-rt2x00ht.patch [deleted file]
package/mac80211/patches/325-rt2x00-rt2x00_rev-should-return-u32.patch [deleted file]
package/mac80211/patches/326-rt2x00-Update-chipset-ID-handling-rt2800pci.patch [deleted file]
package/mac80211/patches/327-rt2x00-Add-support-for-rt3070-rt2800usb.patch [deleted file]
package/mac80211/patches/329-rt2x00-Add-support-for-2-firmware-file-lengths-rt2.patch [deleted file]

index bb05123..dabceba 100644 (file)
@@ -12,11 +12,11 @@ PKG_NAME:=mac80211
 PKG_RELEASE:=1
 
 ifneq ($(CONFIG_LINUX_2_6_27)$(CONFIG_LINUX_2_6_28),)
-  PKG_VERSION:=2009-01-23
+  PKG_VERSION:=2009-01-24
   PKG_SOURCE_URL:= \
        http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/01 \
        http://wireless.kernel.org/download/compat-wireless-2.6
-  PKG_MD5SUM:=f4c8df5e077432d7018112849e36f438
+  PKG_MD5SUM:=5d5179b9bd2536b99dfc7e9aef34df91
 else
   PKG_VERSION:=2008-08-06
   PKG_SOURCE_URL:=http://www.orbit-lab.org/kernel/compat-wireless-2.6/2008/08
index a218846..c3c07a0 100644 (file)
@@ -1,6 +1,6 @@
-From 42d5399c2743dbd1ddaaadc8cb04adbfc65cc970 Mon Sep 17 00:00:00 2001
+From adf33d3a207846709e2a5fb006f17dbc9225f7a9 Mon Sep 17 00:00:00 2001
 From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 11:01:10 +0100
+Date: Fri, 23 Jan 2009 17:10:06 +0100
 Subject: [PATCH] rt2x00: Implement support for 802.11n
 
 Extend rt2x00lib capabilities to support 802.11n,
@@ -58,7 +58,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
  };
  
  /*
-@@ -604,6 +608,7 @@ enum rt2x00_flags {
+@@ -603,6 +607,7 @@ enum rt2x00_flags {
        CONFIG_EXTERNAL_LNA_BG,
        CONFIG_DOUBLE_ANTENNA,
        CONFIG_DISABLE_LINK_TUNING,
@@ -295,7 +295,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +++ b/drivers/net/wireless/rt2x00/rt2x00ht.c
 @@ -0,0 +1,69 @@
 +/*
-+      Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
++      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
 +      <http://rt2x00.serialmonkey.com>
 +
 +      This program is free software; you can redistribute it and/or modify
@@ -327,10 +327,10 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +
 +void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
 +                                 struct txentry_desc *txdesc,
-+                                 struct ieee80211_rate *rate)
++                                 const struct rt2x00_rate *hwrate)
 +{
 +      struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
-+      const struct rt2x00_rate *hwrate = rt2x00_get_rate(rate->hw_value);
++      struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
 +
 +      if (tx_info->control.sta)
 +              txdesc->mpdu_density =
@@ -342,7 +342,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      txdesc->stbc = 0;       /* FIXME: What value is needed? */
 +
 +      txdesc->mcs = rt2x00_get_rate_mcs(hwrate->mcs);
-+      if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
++      if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
 +              txdesc->mcs |= 0x08;
 +
 +      /*
@@ -354,13 +354,13 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      /*
 +       * Determine HT Mix/Greenfield rate mode
 +       */
-+      if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_MCS)
++      if (txrate->flags & IEEE80211_TX_RC_MCS)
 +              txdesc->rate_mode = RATE_MODE_HT_MIX;
-+      if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD)
++      if (txrate->flags & IEEE80211_TX_RC_GREEN_FIELD)
 +              txdesc->rate_mode = RATE_MODE_HT_GREENFIELD;
-+      if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
++      if (txrate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
 +              __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags);
-+      if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
++      if (txrate->flags & IEEE80211_TX_RC_SHORT_GI)
 +              __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags);
 +}
 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -397,11 +397,11 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +#ifdef CONFIG_RT2X00_LIB_HT
 +void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
 +                                 struct txentry_desc *txdesc,
-+                                 struct ieee80211_rate *rate);
++                                 const struct rt2x00_rate *hwrate);
 +#else
 +static inline void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
 +                                               struct txentry_desc *txdesc,
-+                                               struct ieee80211_rate *rate)
++                                               const struct rt2x00_rate *hwrate)
 +{
 +}
 +#endif /* CONFIG_RT2X00_LIB_HT */
@@ -416,7 +416,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
         * Apply TX descriptor handling by components
         */
        rt2x00crypto_create_tx_descriptor(entry, txdesc);
-+      rt2x00ht_create_tx_descriptor(entry, txdesc, rate);
++      rt2x00ht_create_tx_descriptor(entry, txdesc, hwrate);
        rt2x00queue_create_tx_descriptor_seq(entry, txdesc);
        rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
  }
index ed697bb..a37362c 100644 (file)
@@ -1,6 +1,6 @@
-From dda25991ee4dc0a2ebe2e3b50857971fe1d878c4 Mon Sep 17 00:00:00 2001
+From 659988a6bb83536c5d0a01b0b58378cc1856c975 Mon Sep 17 00:00:00 2001
 From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 11:03:23 +0100
+Date: Fri, 23 Jan 2009 17:13:03 +0100
 Subject: [PATCH] rt2x00: Implement support for rt2800pci
 
 Add support for the rt2800pci chipset.
@@ -14,10 +14,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 | 2707 +++++++++++++++++++++++++++++++
- drivers/net/wireless/rt2x00/rt2800pci.h | 1879 +++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800pci.c | 2763 +++++++++++++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800pci.h | 1881 +++++++++++++++++++++
  drivers/net/wireless/rt2x00/rt2x00.h    |    4 +
- 5 files changed, 4606 insertions(+), 0 deletions(-)
+ 5 files changed, 4664 insertions(+), 0 deletions(-)
  create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.c
  create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.h
 
@@ -32,9 +32,9 @@ 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,2707 @@
+@@ -0,0 +1,2763 @@
 +/*
-+      Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
++      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
 +      <http://rt2x00.serialmonkey.com>
 +
 +      This program is free software; you can redistribute it and/or modify
@@ -502,8 +502,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +                         !(filter_flags & FIF_PLCPFAIL));
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
 +                         !(filter_flags & FIF_PROMISC_IN_BSS));
-+      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD,
-+                         !(filter_flags & FIF_OTHER_BSS));
++      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
 +                         !(filter_flags & FIF_ALLMULTI));
@@ -638,9 +637,12 @@ 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);
++              break;
 +      case 3:
 +              /* Do nothing */
 +              break;
@@ -915,6 +917,36 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg);
 +}
 +
++static void rt2800pci_config_ps(struct rt2x00_dev *rt2x00dev,
++                              struct rt2x00lib_conf *libconf)
++{
++      enum dev_state state =
++          (libconf->conf->flags & IEEE80211_CONF_PS) ?
++              STATE_SLEEP : STATE_AWAKE;
++      u32 reg;
++
++      if (state == STATE_SLEEP) {
++              rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0);
++
++              rt2x00pci_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 5);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE,
++                                 libconf->conf->listen_interval - 1);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 1);
++              rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
++
++              rt2800pci_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 0);
++      } else {
++              rt2800pci_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0);
++
++              rt2x00pci_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 0);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE, 0);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 0);
++              rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
++      }
++}
++
 +static void rt2800pci_config(struct rt2x00_dev *rt2x00dev,
 +                           struct rt2x00lib_conf *libconf,
 +                           const unsigned int flags)
@@ -931,6 +963,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +              rt2800pci_config_retry_limit(rt2x00dev, libconf);
 +      if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
 +              rt2800pci_config_duration(rt2x00dev, libconf);
++      if (flags & IEEE80211_CONF_CHANGE_PS)
++              rt2800pci_config_ps(rt2x00dev, libconf);
 +}
 +
 +/*
@@ -985,7 +1019,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +static void rt2800pci_link_tuner(struct rt2x00_dev *rt2x00dev,
 +                               struct link_qual *qual, const u32 count)
 +{
-+      if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_C)
++      if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION)
 +              return;
 +
 +      /*
@@ -1035,6 +1069,11 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      unsigned int i;
 +      u32 reg;
 +
++      if (len != 8192) {
++              ERROR(rt2x00dev, "Invalid firmware file length (len=%zu)\n", len);
++              return -ENOENT;
++      }
++
 +      /*
 +       * Wait for stable hardware.
 +       */
@@ -1273,7 +1312,11 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +
 +      rt2x00pci_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
 +      rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
-+      rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
++      if (rt2x00_rev(&rt2x00dev->chip) >= RT2880E_VERSION &&
++          rt2x00_rev(&rt2x00dev->chip) < RT3070_VERSION)
++              rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
++      else
++              rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
 +      rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_PSDU, 0);
 +      rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_MPDU, 0);
 +      rt2x00pci_register_write(rt2x00dev, MAX_LEN_CFG, reg);
@@ -1375,7 +1418,7 @@ 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++) {
-+              u32 wcid[2] = { 0xffffffff, 0x0000ffff };
++              u32 wcid[2] = { 0xffffffff, 0x00ffffff };
 +              rt2x00pci_register_multiwrite(rt2x00dev, MAC_WCID_ENTRY(i),
 +                                            wcid, sizeof(wcid));
 +      }
@@ -1524,12 +1567,12 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2800pci_bbp_write(rt2x00dev, 103, 0x00);
 +      rt2800pci_bbp_write(rt2x00dev, 105, 0x05);
 +
-+      if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_C) {
++      if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
 +              rt2800pci_bbp_write(rt2x00dev, 69, 0x16);
 +              rt2800pci_bbp_write(rt2x00dev, 73, 0x12);
 +      }
 +
-+      if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_D)
++      if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION)
 +              rt2800pci_bbp_write(rt2x00dev, 84, 0x19);
 +
 +      for (i = 0; i < EEPROM_BBP_SIZE; i++) {
@@ -1626,6 +1669,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      if (unlikely(rt2800pci_wait_wpdma_ready(rt2x00dev) ||
 +                   rt2800pci_init_queues(rt2x00dev) ||
 +                   rt2800pci_init_registers(rt2x00dev) ||
++                   rt2800pci_wait_wpdma_ready(rt2x00dev) ||
 +                   rt2800pci_init_bbp(rt2x00dev)))
 +              return -EIO;
 +
@@ -1634,12 +1678,14 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +       */
 +      rt2800pci_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0);
 +
-+      /* Wait for DMA, ignore error */
-+      rt2800pci_wait_wpdma_ready(rt2x00dev);
-+
 +      /*
 +       * Enable RX.
 +       */
++      rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
++      rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_TX, 1);
++      rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0);
++      rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
++
 +      rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
 +      rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 1);
 +      rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 1);
@@ -2164,9 +2210,17 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      }
 +
 +      rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
-+      if (word != 0) {
-+              /* NIC configuration must always be 0. */
-+              word = 0;
++      if (word == 0xffff) {
++              rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
 +              rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
 +              EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
 +      }
@@ -2248,13 +2302,14 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +                           PCI_CONFIG_HEADER_DEVICE, &device);
 +      value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
 +      rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg);
-+      reg = rt2x00_get_field32(reg, MAC_CSR0_ASIC_REV);
 +      rt2x00_set_chip(rt2x00dev, device, value, reg);
 +
 +      if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
 +          !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
 +          !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
-+          !rt2x00_rf(&rt2x00dev->chip, RF2750)) {
++          !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
++          !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
++          !rt2x00_rf(&rt2x00dev->chip, RF2020)) {
 +              ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
 +              return -ENODEV;
 +      }
@@ -2381,7 +2436,9 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +       */
 +      rt2x00dev->hw->flags =
 +          IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-+          IEEE80211_HW_SIGNAL_DBM;
++          IEEE80211_HW_SIGNAL_DBM |
++          IEEE80211_HW_SUPPORTS_PS |
++          IEEE80211_HW_PS_NULLFUNC_STACK;
 +      rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
 +
 +      SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
@@ -2499,33 +2556,34 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +{
 +      struct rt2x00_dev *rt2x00dev = hw->priv;
 +      u32 reg;
++      bool enabled = (value < IEEE80211_MAX_RTS_THRESHOLD);
 +
 +      rt2x00pci_register_read(rt2x00dev, TX_RTS_CFG, &reg);
 +      rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_THRES, value);
 +      rt2x00pci_register_write(rt2x00dev, TX_RTS_CFG, reg);
 +
 +      rt2x00pci_register_read(rt2x00dev, CCK_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, CCK_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, CCK_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00pci_register_write(rt2x00dev, CCK_PROT_CFG, reg);
 +
 +      rt2x00pci_register_read(rt2x00dev, OFDM_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, OFDM_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, OFDM_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00pci_register_write(rt2x00dev, OFDM_PROT_CFG, reg);
 +
 +      rt2x00pci_register_read(rt2x00dev, MM20_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, MM20_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, MM20_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00pci_register_write(rt2x00dev, MM20_PROT_CFG, reg);
 +
 +      rt2x00pci_register_read(rt2x00dev, MM40_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, MM40_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, MM40_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00pci_register_write(rt2x00dev, MM40_PROT_CFG, reg);
 +
 +      rt2x00pci_register_read(rt2x00dev, GF20_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, GF20_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, GF20_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00pci_register_write(rt2x00dev, GF20_PROT_CFG, reg);
 +
 +      rt2x00pci_register_read(rt2x00dev, GF40_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, GF40_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, GF40_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00pci_register_write(rt2x00dev, GF40_PROT_CFG, reg);
 +
 +      return 0;
@@ -2551,24 +2609,23 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      if (retval)
 +              return retval;
 +
++      /*
++       * We only need to perform additional register initialization
++       * for WMM queues/
++       */
++      if (queue_idx >= 4)
++              return 0;
++
 +      queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
 +
 +      /* Update WMM TXOP register */
-+      if (queue_idx < 2) {
-+              field.bit_offset = queue_idx * 16;
-+              field.bit_mask = 0xffff << field.bit_offset;
-+
-+              rt2x00pci_register_read(rt2x00dev, WMM_TXOP0_CFG, &reg);
-+              rt2x00_set_field32(&reg, field, queue->txop);
-+              rt2x00pci_register_write(rt2x00dev, WMM_TXOP0_CFG, reg);
-+      } else if (queue_idx < 4) {
-+              field.bit_offset = (queue_idx - 2) * 16;
-+              field.bit_mask = 0xffff << field.bit_offset;
-+
-+              rt2x00pci_register_read(rt2x00dev, WMM_TXOP1_CFG, &reg);
-+              rt2x00_set_field32(&reg, field, queue->txop);
-+              rt2x00pci_register_write(rt2x00dev, WMM_TXOP1_CFG, reg);
-+      }
++      offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2)));
++      field.bit_offset = (queue_idx & 1) * 16;
++      field.bit_mask = 0xffff << field.bit_offset;
++
++      rt2x00pci_register_read(rt2x00dev, offset, &reg);
++      rt2x00_set_field32(&reg, field, queue->txop);
++      rt2x00pci_register_write(rt2x00dev, offset, reg);
 +
 +      /* Update WMM registers */
 +      field.bit_offset = queue_idx * 4;
@@ -2587,15 +2644,14 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00pci_register_write(rt2x00dev, WMM_CWMAX_CFG, reg);
 +
 +      /* Update EDCA registers */
-+      if (queue_idx < 4) {
-+              offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx);
-+
-+              rt2x00pci_register_read(rt2x00dev, offset, &reg);
-+              rt2x00_set_field32(&reg, EDCA_AC0_CFG_AIFSN, queue->aifs);
-+              rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMIN, queue->cw_min);
-+              rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMAX, queue->cw_max);
-+              rt2x00pci_register_write(rt2x00dev, offset, reg);
-+      }
++      offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx);
++
++      rt2x00pci_register_read(rt2x00dev, offset, &reg);
++      rt2x00_set_field32(&reg, EDCA_AC0_CFG_TX_OP, queue->txop);
++      rt2x00_set_field32(&reg, EDCA_AC0_CFG_AIFSN, queue->aifs);
++      rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMIN, queue->cw_min);
++      rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMAX, queue->cw_max);
++      rt2x00pci_register_write(rt2x00dev, offset, reg);
 +
 +      return 0;
 +}
@@ -2742,9 +2798,9 @@ 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,1879 @@
+@@ -0,0 +1,1881 @@
 +/*
-+      Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
++      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
 +      <http://rt2x00.serialmonkey.com>
 +
 +      This program is free software; you can redistribute it and/or modify
@@ -2792,9 +2848,11 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +/*
 + * RT2860 version
 + */
-+#define RT2860_VERSION_C              0x0100
-+#define RT2860_VERSION_D              0x0101
-+#define RT2860_VERSION_E              0x0200
++#define RT2860C_VERSION                       0x28600100
++#define RT2860D_VERSION                       0x28600101
++#define RT2880E_VERSION                       0x28720200
++#define RT2883_VERSION                        0x28830300
++#define RT3070_VERSION                        0x30700200
 +
 +/*
 + * Signal information.
@@ -3412,7 +3470,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 + * EDCA_AC0_CFG:
 + */
 +#define EDCA_AC0_CFG                  0x1300
-+#define EDCA_AC0_CFG_AC_TX_OP         FIELD32(0x000000ff)
++#define EDCA_AC0_CFG_TX_OP            FIELD32(0x000000ff)
 +#define EDCA_AC0_CFG_AIFSN            FIELD32(0x00000f00)
 +#define EDCA_AC0_CFG_CWMIN            FIELD32(0x0000f000)
 +#define EDCA_AC0_CFG_CWMAX            FIELD32(0x000f0000)
@@ -3421,7 +3479,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 + * EDCA_AC1_CFG:
 + */
 +#define EDCA_AC1_CFG                  0x1304
-+#define EDCA_AC1_CFG_AC_TX_OP         FIELD32(0x000000ff)
++#define EDCA_AC1_CFG_TX_OP            FIELD32(0x000000ff)
 +#define EDCA_AC1_CFG_AIFSN            FIELD32(0x00000f00)
 +#define EDCA_AC1_CFG_CWMIN            FIELD32(0x0000f000)
 +#define EDCA_AC1_CFG_CWMAX            FIELD32(0x000f0000)
@@ -3430,7 +3488,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 + * EDCA_AC2_CFG:
 + */
 +#define EDCA_AC2_CFG                  0x1308
-+#define EDCA_AC2_CFG_AC_TX_OP         FIELD32(0x000000ff)
++#define EDCA_AC2_CFG_TX_OP            FIELD32(0x000000ff)
 +#define EDCA_AC2_CFG_AIFSN            FIELD32(0x00000f00)
 +#define EDCA_AC2_CFG_CWMIN            FIELD32(0x0000f000)
 +#define EDCA_AC2_CFG_CWMAX            FIELD32(0x000f0000)
@@ -3439,7 +3497,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 + * EDCA_AC3_CFG:
 + */
 +#define EDCA_AC3_CFG                  0x130c
-+#define EDCA_AC3_CFG_AC_TX_OP         FIELD32(0x000000ff)
++#define EDCA_AC3_CFG_TX_OP            FIELD32(0x000000ff)
 +#define EDCA_AC3_CFG_AIFSN            FIELD32(0x00000f00)
 +#define EDCA_AC3_CFG_CWMIN            FIELD32(0x0000f000)
 +#define EDCA_AC3_CFG_CWMAX            FIELD32(0x000f0000)
index 5b878ab..1da4725 100644 (file)
@@ -1,6 +1,6 @@
-From 22592b5df5bef2754f56e165ee0828777a95fdfd Mon Sep 17 00:00:00 2001
+From e380f1fa260d81cba1ebb1b6c333ef8c31f2a8c5 Mon Sep 17 00:00:00 2001
 From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 11:05:41 +0100
+Date: Fri, 23 Jan 2009 17:16:11 +0100
 Subject: [PATCH] rt2x00: Implement support for rt2800usb
 
 Add support for the rt2800usb chipset.
@@ -13,10 +13,10 @@ 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 | 2540 +++++++++++++++++++++++++++++++
- drivers/net/wireless/rt2x00/rt2800usb.h | 1892 +++++++++++++++++++++++
- drivers/net/wireless/rt2x00/rt2x00.h    |    1 +
- 5 files changed, 4448 insertions(+), 0 deletions(-)
+ drivers/net/wireless/rt2x00/rt2800usb.c | 2905 +++++++++++++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800usb.h | 1944 +++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2x00.h    |    7 +
+ 5 files changed, 4871 insertions(+), 0 deletions(-)
  create mode 100644 drivers/net/wireless/rt2x00/rt2800usb.c
  create mode 100644 drivers/net/wireless/rt2x00/rt2800usb.h
 
@@ -29,9 +29,9 @@ 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,2540 @@
+@@ -0,0 +1,2905 @@
 +/*
-+      Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
++      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
 +      <http://rt2x00.serialmonkey.com>
 +
 +      This program is free software; you can redistribute it and/or modify
@@ -91,6 +91,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 + */
 +#define WAIT_FOR_BBP(__dev, __reg) \
 +      rt2x00usb_regbusy_read((__dev), BBP_CSR_CFG, BBP_CSR_CFG_BUSY, (__reg))
++#define WAIT_FOR_RFCSR(__dev, __reg) \
++      rt2x00usb_regbusy_read((__dev), RF_CSR_CFG, RF_CSR_CFG_BUSY, (__reg))
 +#define WAIT_FOR_RF(__dev, __reg) \
 +      rt2x00usb_regbusy_read((__dev), RF_CSR_CFG0, RF_CSR_CFG0_BUSY, (__reg))
 +#define WAIT_FOR_MCU(__dev, __reg) \
@@ -152,6 +154,61 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      mutex_unlock(&rt2x00dev->csr_mutex);
 +}
 +
++static void rt2800usb_rfcsr_write(struct rt2x00_dev *rt2x00dev,
++                                const unsigned int word, const u8 value)
++{
++      u32 reg;
++
++      mutex_lock(&rt2x00dev->csr_mutex);
++
++      /*
++       * Wait until the RFCSR becomes available, afterwards we
++       * can safely write the new data into the register.
++       */
++      if (WAIT_FOR_RFCSR(rt2x00dev, &reg)) {
++              reg = 0;
++              rt2x00_set_field32(&reg, RF_CSR_CFG_DATA, value);
++              rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
++              rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 1);
++              rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
++
++              rt2x00usb_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
++      }
++
++      mutex_unlock(&rt2x00dev->csr_mutex);
++}
++
++static void rt2800usb_rfcsr_read(struct rt2x00_dev *rt2x00dev,
++                               const unsigned int word, u8 *value)
++{
++      u32 reg;
++
++      mutex_lock(&rt2x00dev->csr_mutex);
++
++      /*
++       * Wait until the RFCSR becomes available, afterwards we
++       * can safely write the read request into the register.
++       * After the data has been written, we wait until hardware
++       * returns the correct value, if at any time the register
++       * doesn't become available in time, reg will be 0xffffffff
++       * which means we return 0xff to the caller.
++       */
++      if (WAIT_FOR_RFCSR(rt2x00dev, &reg)) {
++              reg = 0;
++              rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
++              rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 0);
++              rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
++
++              rt2x00usb_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg);
++
++              WAIT_FOR_RFCSR(rt2x00dev, &reg);
++      }
++
++      *value = rt2x00_get_field32(reg, RF_CSR_CFG_DATA);
++
++      mutex_unlock(&rt2x00dev->csr_mutex);
++}
++
 +static void rt2800usb_rf_write(struct rt2x00_dev *rt2x00dev,
 +                             const unsigned int word, const u32 value)
 +{
@@ -479,8 +536,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +                         !(filter_flags & FIF_PLCPFAIL));
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
 +                         !(filter_flags & FIF_PROMISC_IN_BSS));
-+      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD,
-+                         !(filter_flags & FIF_OTHER_BSS));
++      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
 +                         !(filter_flags & FIF_ALLMULTI));
@@ -615,9 +671,12 @@ 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);
++              break;
 +      case 3:
 +              /* Do nothing */
 +              break;
@@ -665,42 +724,24 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00dev->lna_gain = lna_gain;
 +}
 +
-+static void rt2800usb_config_channel(struct rt2x00_dev *rt2x00dev,
-+                                   struct rf_channel *rf,
-+                                   struct channel_info *info)
++static void rt2800usb_config_channel_rt2x(struct rt2x00_dev *rt2x00dev,
++                                        struct rf_channel *rf,
++                                        struct channel_info *info)
 +{
-+      u32 reg;
-+      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) {
++      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);
 +
@@ -728,15 +769,11 @@ 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,
@@ -760,6 +797,81 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2800usb_rf_write(rt2x00dev, 2, rf->rf2);
 +      rt2800usb_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004);
 +      rt2800usb_rf_write(rt2x00dev, 4, rf->rf4);
++}
++
++static void rt2800usb_config_channel_rt3x(struct rt2x00_dev *rt2x00dev,
++                                        struct rf_channel *rf,
++                                        struct channel_info *info)
++{
++      u8 rfcsr;
++
++      rt2800usb_rfcsr_write(rt2x00dev, 2, rf->rf1);
++      rt2800usb_rfcsr_write(rt2x00dev, 2, rf->rf3);
++
++      rt2800usb_rfcsr_read(rt2x00dev, 6, &rfcsr);
++      rt2x00_set_field8(&rfcsr, RFCSR6_R, rf->rf2);
++      rt2800usb_rfcsr_write(rt2x00dev, 6, rfcsr);
++
++      rt2800usb_rfcsr_read(rt2x00dev, 12, &rfcsr);
++      rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER,
++                        TXPOWER_G_TO_DEV(info->tx_power1));
++      rt2800usb_rfcsr_write(rt2x00dev, 12, rfcsr);
++
++      rt2800usb_rfcsr_read(rt2x00dev, 23, &rfcsr);
++      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);
++      else
++              rt2800usb_rfcsr_write(rt2x00dev, 24, rt2x00dev->calibration_bw20);
++
++      rt2800usb_rfcsr_read(rt2x00dev, 23, &rfcsr);
++      rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1);
++      rt2800usb_rfcsr_write(rt2x00dev, 23, rfcsr);
++}
++
++static void rt2800usb_config_channel(struct rt2x00_dev *rt2x00dev,
++                                   struct rf_channel *rf,
++                                   struct channel_info *info)
++{
++      u32 reg;
++      unsigned int tx_pin;
++      u16 eeprom;
++
++      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);
++
++      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);
++      else
++              rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
 +
 +      /*
 +       * Change BBP settings
@@ -892,6 +1004,36 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
 +}
 +
++static void rt2800usb_config_ps(struct rt2x00_dev *rt2x00dev,
++                              struct rt2x00lib_conf *libconf)
++{
++      enum dev_state state =
++          (libconf->conf->flags & IEEE80211_CONF_PS) ?
++              STATE_SLEEP : STATE_AWAKE;
++      u32 reg;
++
++      if (state == STATE_SLEEP) {
++              rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0);
++
++              rt2x00usb_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 5);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE,
++                                 libconf->conf->listen_interval - 1);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 1);
++              rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
++
++              rt2800usb_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 0);
++      } else {
++              rt2800usb_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0);
++
++              rt2x00usb_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 0);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE, 0);
++              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 0);
++              rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
++      }
++}
++
 +static void rt2800usb_config(struct rt2x00_dev *rt2x00dev,
 +                           struct rt2x00lib_conf *libconf,
 +                           const unsigned int flags)
@@ -908,6 +1050,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +              rt2800usb_config_retry_limit(rt2x00dev, libconf);
 +      if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
 +              rt2800usb_config_duration(rt2x00dev, libconf);
++      if (flags & IEEE80211_CONF_CHANGE_PS)
++              rt2800usb_config_ps(rt2x00dev, libconf);
 +}
 +
 +/*
@@ -933,8 +1077,12 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +
 +static u8 rt2800usb_get_default_vgc(struct rt2x00_dev *rt2x00dev)
 +{
-+      if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ)
-+              return 0x2e + rt2x00dev->lna_gain;
++      if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
++              if (rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION)
++                      return 0x1c + (2 * rt2x00dev->lna_gain);
++              else
++                      return 0x2e + rt2x00dev->lna_gain;
++      }
 +
 +      if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags))
 +              return 0x32 + (rt2x00dev->lna_gain * 5) / 3;
@@ -962,7 +1110,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +static void rt2800usb_link_tuner(struct rt2x00_dev *rt2x00dev,
 +                               struct link_qual *qual, const u32 count)
 +{
-+      if (rt2x00_rev(&rt2x00dev->chip) == RT2870_VERSION_C)
++      if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION)
 +              return;
 +
 +      /*
@@ -1012,6 +1160,38 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      unsigned int i;
 +      int status;
 +      u32 reg;
++      u32 offset;
++      u32 length;
++      u16 chipset = (rt2x00_rev(&rt2x00dev->chip) >> 16) & 0xffff;
++
++      /*
++       * Firmware files:
++       * There are 2 variations of the rt2870 firmware.
++       * a) size: 4kb
++       * b) size: 8kb
++       * Note that (b) contains 2 seperate firmware blobs of 4k
++       * within the file. The first blob is the same firmware as (a),
++       * but the second blob is for the additional chipsets.
++       */
++      if (len != 4096 && len != 8192) {
++              ERROR(rt2x00dev, "Invalid firmware file length (len=%zu)\n", len);
++              return -ENOENT;
++      }
++
++      if ((chipset == 0x2860) || (chipset == 0x2872) || (chipset == 0x3070)) {
++              offset = 0;
++              length = 4096;
++      } else if (len == 8192) {
++              offset = 4096;
++              length = 4096;
++      } else {
++              ERROR(rt2x00dev,
++                    "Current firmware does not support detected chipset %04x.\n",
++                    chipset);
++              ERROR(rt2x00dev,
++                    "Please upgrade to a more recent firmware version.\n");
++              return -ENOENT;
++      }
 +
 +      /*
 +       * Wait for stable hardware.
@@ -1034,8 +1214,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
 +                                          USB_VENDOR_REQUEST_OUT,
 +                                          FIRMWARE_IMAGE_BASE,
-+                                          data, len,
-+                                          REGISTER_TIMEOUT32(len));
++                                          data + offset, length,
++                                          REGISTER_TIMEOUT32(length));
 +
 +      rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
 +      rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);
@@ -1143,8 +1323,14 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00_set_field32(&reg, BCN_TIME_CFG_TX_TIME_COMPENSATE, 0);
 +      rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
 +
-+      rt2x00usb_register_write(rt2x00dev, TX_SW_CFG0, 0x00040a06);
-+      rt2x00usb_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
++      if (rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION) {
++              rt2x00usb_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400);
++              rt2x00usb_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
++              rt2x00usb_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
++      } else {
++              rt2x00usb_register_write(rt2x00dev, TX_SW_CFG0, 0x00040a06);
++              rt2x00usb_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
++      }
 +
 +      rt2x00usb_register_read(rt2x00dev, TX_LINK_CFG, &reg);
 +      rt2x00_set_field32(&reg, TX_LINK_CFG_REMOTE_MFB_LIFETIME, 32);
@@ -1164,7 +1350,11 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +
 +      rt2x00usb_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
 +      rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
-+      rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
++      if (rt2x00_rev(&rt2x00dev->chip) >= RT2880E_VERSION &&
++          rt2x00_rev(&rt2x00dev->chip) < RT3070_VERSION)
++              rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
++      else
++              rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
 +      rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_PSDU, 0);
 +      rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_MPDU, 0);
 +      rt2x00usb_register_write(rt2x00dev, MAX_LEN_CFG, reg);
@@ -1280,7 +1470,7 @@ 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++) {
-+              u32 wcid[2] = { 0xffffffff, 0x0000ffff };
++              u32 wcid[2] = { 0xffffffff, 0x00ffffff };
 +              rt2x00usb_register_multiwrite(rt2x00dev, MAC_WCID_ENTRY(i),
 +                                            wcid, sizeof(wcid));
 +      }
@@ -1422,15 +1612,19 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2800usb_bbp_write(rt2x00dev, 86, 0x00);
 +      rt2800usb_bbp_write(rt2x00dev, 91, 0x04);
 +      rt2800usb_bbp_write(rt2x00dev, 92, 0x00);
++      rt2800usb_bbp_write(rt2x00dev, 103, 0x00);
 +      rt2800usb_bbp_write(rt2x00dev, 105, 0x05);
 +
-+      if (rt2x00_rev(&rt2x00dev->chip) == RT2870_VERSION_C) {
++      if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
 +              rt2800usb_bbp_write(rt2x00dev, 69, 0x16);
 +              rt2800usb_bbp_write(rt2x00dev, 73, 0x12);
 +      }
 +
-+      if (rt2x00_rev(&rt2x00dev->chip) != RT2870_VERSION_D)
-+              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);
++              rt2800usb_bbp_write(rt2x00dev, 105, 0x05);
++      }
 +
 +      for (i = 0; i < EEPROM_BBP_SIZE; i++) {
 +              rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom);
@@ -1445,6 +1639,134 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      return 0;
 +}
 +
++static u8 rt2800usb_init_rx_filter(struct rt2x00_dev *rt2x00dev,
++                                 bool bw40, u8 rfcsr24, u8 filter_target)
++{
++      unsigned int i;
++      u8 bbp;
++      u8 rfcsr;
++      u8 passband;
++      u8 stopband;
++      u8 overtuned = 0;
++
++      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_rfcsr_read(rt2x00dev, 22, &rfcsr);
++      rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 1);
++      rt2800usb_rfcsr_write(rt2x00dev, 22, rfcsr);
++
++      /*
++       * Set power & frequency of passband test tone
++       */
++      rt2800usb_bbp_write(rt2x00dev, 24, 0);
++
++      for (i = 0; i < 100; i++) {
++              rt2800usb_bbp_write(rt2x00dev, 25, 0x90);
++              msleep(1);
++
++              rt2800usb_bbp_read(rt2x00dev, 55, &passband);
++              if (passband)
++                      break;
++      }
++
++      /*
++       * Set power & frequency of stopband test tone
++       */
++      rt2800usb_bbp_write(rt2x00dev, 24, 0x06);
++
++      for (i = 0; i < 100; i++) {
++              rt2800usb_bbp_write(rt2x00dev, 25, 0x90);
++              msleep(1);
++
++              rt2800usb_bbp_read(rt2x00dev, 55, &stopband);
++
++              if ((passband - stopband) <= filter_target) {
++                      rfcsr24++;
++                      overtuned += ((passband - stopband) == filter_target);
++              } else
++                      break;
++
++              rt2800usb_rfcsr_write(rt2x00dev, 24, rfcsr24);
++      }
++
++      rfcsr24 -= !!overtuned;
++
++      rt2800usb_rfcsr_write(rt2x00dev, 24, rfcsr24);
++      return rfcsr24;
++}
++
++static int rt2800usb_init_rfcsr(struct rt2x00_dev *rt2x00dev)
++{
++      u8 rfcsr;
++      u8 bbp;
++
++      if (rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION)
++              return 0;
++
++      /*
++       * Init RF calibration.
++       */
++      rt2800usb_rfcsr_read(rt2x00dev, 30, &rfcsr);
++      rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1);
++      rt2800usb_rfcsr_write(rt2x00dev, 30, rfcsr);
++      msleep(1);
++      rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
++      rt2800usb_rfcsr_write(rt2x00dev, 30, rfcsr);
++
++      rt2800usb_rfcsr_write(rt2x00dev, 4, 0x40);
++      rt2800usb_rfcsr_write(rt2x00dev, 5, 0x03);
++      rt2800usb_rfcsr_write(rt2x00dev, 6, 0x02);
++      rt2800usb_rfcsr_write(rt2x00dev, 7, 0x70);
++      rt2800usb_rfcsr_write(rt2x00dev, 9, 0x0f);
++      rt2800usb_rfcsr_write(rt2x00dev, 10, 0x71);
++      rt2800usb_rfcsr_write(rt2x00dev, 11, 0x21);
++      rt2800usb_rfcsr_write(rt2x00dev, 12, 0x7b);
++      rt2800usb_rfcsr_write(rt2x00dev, 14, 0x90);
++      rt2800usb_rfcsr_write(rt2x00dev, 15, 0x58);
++      rt2800usb_rfcsr_write(rt2x00dev, 16, 0xb3);
++      rt2800usb_rfcsr_write(rt2x00dev, 17, 0x92);
++      rt2800usb_rfcsr_write(rt2x00dev, 18, 0x2c);
++      rt2800usb_rfcsr_write(rt2x00dev, 19, 0x02);
++      rt2800usb_rfcsr_write(rt2x00dev, 20, 0xba);
++      rt2800usb_rfcsr_write(rt2x00dev, 21, 0xdb);
++      rt2800usb_rfcsr_write(rt2x00dev, 24, 0x16);
++      rt2800usb_rfcsr_write(rt2x00dev, 25, 0x01);
++      rt2800usb_rfcsr_write(rt2x00dev, 27, 0x03);
++      rt2800usb_rfcsr_write(rt2x00dev, 29, 0x1f);
++
++      /*
++       * Set RX Filter calibration for 20MHz and 40MHz
++       */
++      rt2x00dev->calibration_bw20 =
++          rt2800usb_init_rx_filter(rt2x00dev, false, 0x07, 0x16);
++      rt2x00dev->calibration_bw40 =
++          rt2800usb_init_rx_filter(rt2x00dev, true, 0x27, 0x19);
++
++      /*
++       * Set back to initial state
++       */
++      rt2800usb_bbp_write(rt2x00dev, 24, 0);
++
++      rt2800usb_rfcsr_read(rt2x00dev, 22, &rfcsr);
++      rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0);
++      rt2800usb_rfcsr_write(rt2x00dev, 22, rfcsr);
++
++      /*
++       * set BBP back to BW20
++       */
++      rt2800usb_bbp_read(rt2x00dev, 4, &bbp);
++      rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0);
++      rt2800usb_bbp_write(rt2x00dev, 4, bbp);
++
++      return 0;
++}
++
 +/*
 + * Device state switch handlers.
 + */
@@ -1488,7 +1810,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +       */
 +      if (unlikely(rt2800usb_wait_wpdma_ready(rt2x00dev) ||
 +                   rt2800usb_init_registers(rt2x00dev) ||
-+                   rt2800usb_init_bbp(rt2x00dev)))
++                   rt2800usb_init_bbp(rt2x00dev) ||
++                   rt2800usb_init_rfcsr(rt2x00dev)))
 +              return -EIO;
 +
 +      rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
@@ -1636,8 +1959,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +                                  struct txentry_desc *txdesc)
 +{
 +      struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
-+      __le32 *txd = skbdesc->desc;
-+      __le32 *txwi = txd + TXD_DESC_SIZE;
++      __le32 *txi = skbdesc->desc;
++      __le32 *txwi = txi + TXINFO_DESC_SIZE;
 +      u32 word;
 +
 +      /*
@@ -1684,31 +2007,16 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      /*
 +       * Initialize TX descriptor
 +       */
-+      rt2x00_desc_read(txd, 0, &word);
-+      rt2x00_set_field32(&word, TXD_W0_SD_PTR0, skbdesc->skb_dma);
-+      rt2x00_desc_write(txd, 0, word);
-+
-+      rt2x00_desc_read(txd, 1, &word);
-+      rt2x00_set_field32(&word, TXD_W1_SD_LEN1, skb->len);
-+      rt2x00_set_field32(&word, TXD_W1_LAST_SEC1, 1);
-+      rt2x00_set_field32(&word, TXD_W1_BURST,
++      rt2x00_desc_read(txi, 0, &word);
++      rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
++                         roundup(skb->len + TXWI_DESC_SIZE, 4));
++      rt2x00_set_field32(&word, TXINFO_W0_WIV, 1);
++      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);
++      rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_BURST,
 +                         test_bit(ENTRY_TXD_BURST, &txdesc->flags));
-+      rt2x00_set_field32(&word, TXD_W1_SD_LEN0,
-+                         rt2x00dev->hw->extra_tx_headroom);
-+      rt2x00_set_field32(&word, TXD_W1_LAST_SEC0,
-+                         !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags));
-+      rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 0);
-+      rt2x00_desc_write(txd, 1, word);
-+
-+      rt2x00_desc_read(txd, 2, &word);
-+      rt2x00_set_field32(&word, TXD_W2_SD_PTR1,
-+                         skbdesc->skb_dma + rt2x00dev->hw->extra_tx_headroom);
-+      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_QSEL, 2);
-+      rt2x00_desc_write(txd, 3, word);
++      rt2x00_desc_write(txi, 0, word);
 +}
 +
 +/*
@@ -1882,9 +2190,9 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
 +
 +      /*
-+       * Remove TXWI descriptor from start of buffer.
++       * Remove RXWI descriptor from start of buffer.
 +       */
-+      skb_pull(entry->skb, TXWI_DESC_SIZE + skbdesc->desc_len);
++      skb_pull(entry->skb, RXWI_DESC_SIZE + skbdesc->desc_len);
 +      skb_trim(entry->skb, rxdesc->size);
 +}
 +
@@ -1920,9 +2228,17 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      }
 +
 +      rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
-+      if (word != 0) {
-+              /* NIC configuration must always be 0. */
-+              word = 0;
++      if (word == 0xffff) {
++              rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
++              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
 +              rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
 +              EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
 +      }
@@ -1986,7 +2302,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
 +{
 +      u32 reg;
-+      u16 rev;
 +      u16 value;
 +      u16 eeprom;
 +
@@ -2000,8 +2315,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +       */
 +      value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
 +      rt2x00usb_register_read(rt2x00dev, MAC_CSR0, &reg);
-+      rev = rt2x00_get_field32(reg, MAC_CSR0_ASIC_REV);
-+      rt2x00_set_chip(rt2x00dev, RT2870, value, rev);
++      rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
 +
 +      /*
 +       * The check for rt2860 is not a typo, some rt2870 hardware
@@ -2016,7 +2330,9 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
 +          !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
 +          !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
-+          !rt2x00_rf(&rt2x00dev->chip, RF2750)) {
++          !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
++          !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
++          !rt2x00_rf(&rt2x00dev->chip, RF2020)) {
 +              ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
 +              return -ENODEV;
 +      }
@@ -2131,6 +2447,27 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
 +};
 +
++/*
++ * RF value list for rt3070
++ * Supports: 2.4 GHz
++ */
++static const struct rf_channel rf_vals_3070[] = {
++      {1,  241, 2, 2 },
++      {2,  241, 2, 7 },
++      {3,  242, 2, 2 },
++      {4,  242, 2, 7 },
++      {5,  243, 2, 2 },
++      {6,  243, 2, 7 },
++      {7,  244, 2, 2 },
++      {8,  244, 2, 7 },
++      {9,  245, 2, 2 },
++      {10, 245, 2, 7 },
++      {11, 246, 2, 2 },
++      {12, 246, 2, 7 },
++      {13, 247, 2, 2 },
++      {14, 248, 2, 4 },
++};
++
 +static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 +{
 +      struct hw_mode_spec *spec = &rt2x00dev->spec;
@@ -2144,8 +2481,10 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +       */
 +      rt2x00dev->hw->flags =
 +          IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-+          IEEE80211_HW_SIGNAL_DBM;
-+      rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE + TXINFO_DESC_SIZE;
++          IEEE80211_HW_SIGNAL_DBM |
++          IEEE80211_HW_SUPPORTS_PS |
++          IEEE80211_HW_PS_NULLFUNC_STACK;
++      rt2x00dev->hw->extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
 +
 +      SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
 +      SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -2186,6 +2525,10 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +              spec->supported_bands |= SUPPORT_BAND_5GHZ;
 +              spec->num_channels = ARRAY_SIZE(rf_vals);
 +              spec->channels = rf_vals;
++      } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
++                 rt2x00_rf(&rt2x00dev->chip, RF2020)) {
++              spec->num_channels = ARRAY_SIZE(rf_vals_3070);
++              spec->channels = rf_vals_3070;
 +      }
 +
 +      /*
@@ -2263,33 +2606,34 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +{
 +      struct rt2x00_dev *rt2x00dev = hw->priv;
 +      u32 reg;
++      bool enabled = (value < IEEE80211_MAX_RTS_THRESHOLD);
 +
 +      rt2x00usb_register_read(rt2x00dev, TX_RTS_CFG, &reg);
 +      rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_THRES, value);
 +      rt2x00usb_register_write(rt2x00dev, TX_RTS_CFG, reg);
 +
 +      rt2x00usb_register_read(rt2x00dev, CCK_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, CCK_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, CCK_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00usb_register_write(rt2x00dev, CCK_PROT_CFG, reg);
 +
 +      rt2x00usb_register_read(rt2x00dev, OFDM_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, OFDM_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, OFDM_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00usb_register_write(rt2x00dev, OFDM_PROT_CFG, reg);
 +
 +      rt2x00usb_register_read(rt2x00dev, MM20_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, MM20_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, MM20_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00usb_register_write(rt2x00dev, MM20_PROT_CFG, reg);
 +
 +      rt2x00usb_register_read(rt2x00dev, MM40_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, MM40_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, MM40_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00usb_register_write(rt2x00dev, MM40_PROT_CFG, reg);
 +
 +      rt2x00usb_register_read(rt2x00dev, GF20_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, GF20_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, GF20_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00usb_register_write(rt2x00dev, GF20_PROT_CFG, reg);
 +
 +      rt2x00usb_register_read(rt2x00dev, GF40_PROT_CFG, &reg);
-+      rt2x00_set_field32(&reg, GF40_PROT_CFG_RTS_TH_EN, 1);
++      rt2x00_set_field32(&reg, GF40_PROT_CFG_RTS_TH_EN, enabled);
 +      rt2x00usb_register_write(rt2x00dev, GF40_PROT_CFG, reg);
 +
 +      return 0;
@@ -2315,24 +2659,23 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      if (retval)
 +              return retval;
 +
++      /*
++       * We only need to perform additional register initialization
++       * for WMM queues/
++       */
++      if (queue_idx >= 4)
++              return 0;
++
 +      queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
 +
 +      /* Update WMM TXOP register */
-+      if (queue_idx < 2) {
-+              field.bit_offset = queue_idx * 16;
-+              field.bit_mask = 0xffff << field.bit_offset;
-+
-+              rt2x00usb_register_read(rt2x00dev, WMM_TXOP0_CFG, &reg);
-+              rt2x00_set_field32(&reg, field, queue->txop);
-+              rt2x00usb_register_write(rt2x00dev, WMM_TXOP0_CFG, reg);
-+      } else if (queue_idx < 4) {
-+              field.bit_offset = (queue_idx - 2) * 16;
-+              field.bit_mask = 0xffff << field.bit_offset;
-+
-+              rt2x00usb_register_read(rt2x00dev, WMM_TXOP1_CFG, &reg);
-+              rt2x00_set_field32(&reg, field, queue->txop);
-+              rt2x00usb_register_write(rt2x00dev, WMM_TXOP1_CFG, reg);
-+      }
++      offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2)));
++      field.bit_offset = (queue_idx & 1) * 16;
++      field.bit_mask = 0xffff << field.bit_offset;
++
++      rt2x00usb_register_read(rt2x00dev, offset, &reg);
++      rt2x00_set_field32(&reg, field, queue->txop);
++      rt2x00usb_register_write(rt2x00dev, offset, reg);
 +
 +      /* Update WMM registers */
 +      field.bit_offset = queue_idx * 4;
@@ -2351,15 +2694,14 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00usb_register_write(rt2x00dev, WMM_CWMAX_CFG, reg);
 +
 +      /* Update EDCA registers */
-+      if (queue_idx < 4) {
-+              offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx);
-+
-+              rt2x00usb_register_read(rt2x00dev, offset, &reg);
-+              rt2x00_set_field32(&reg, EDCA_AC0_CFG_AIFSN, queue->aifs);
-+              rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMIN, queue->cw_min);
-+              rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMAX, queue->cw_max);
-+              rt2x00usb_register_write(rt2x00dev, offset, reg);
-+      }
++      offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx);
++
++      rt2x00usb_register_read(rt2x00dev, offset, &reg);
++      rt2x00_set_field32(&reg, EDCA_AC0_CFG_TX_OP, queue->txop);
++      rt2x00_set_field32(&reg, EDCA_AC0_CFG_AIFSN, queue->aifs);
++      rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMIN, queue->cw_min);
++      rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMAX, queue->cw_max);
++      rt2x00usb_register_write(rt2x00dev, offset, reg);
 +
 +      return 0;
 +}
@@ -2444,14 +2786,14 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +static const struct data_queue_desc rt2800usb_queue_tx = {
 +      .entry_num              = TX_ENTRIES,
 +      .data_size              = DATA_FRAME_SIZE,
-+      .desc_size              = TXD_DESC_SIZE,
++      .desc_size              = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
 +      .priv_size              = sizeof(struct queue_entry_priv_usb),
 +};
 +
 +static const struct data_queue_desc rt2800usb_queue_bcn = {
 +      .entry_num              = 8 * BEACON_ENTRIES,
 +      .data_size              = MGMT_FRAME_SIZE,
-+      .desc_size              = TXWI_DESC_SIZE,
++      .desc_size              = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
 +      .priv_size              = sizeof(struct queue_entry_priv_usb),
 +};
 +
@@ -2476,6 +2818,12 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 + * rt2800usb module information.
 + */
 +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(0x1482, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      /* Amit */
 +      { USB_DEVICE(0x15c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      /* ASUS */
@@ -2486,9 +2834,12 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      { USB_DEVICE(0x13d3, 0x3247), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      /* Belkin */
 +      { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) },
++      { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      /* Conceptronic */
 +      { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) },
++      { USB_DEVICE(0x14b2, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
++      { USB_DEVICE(0x14b2, 0x3c12), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      { USB_DEVICE(0x14b2, 0x3c23), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      { USB_DEVICE(0x14b2, 0x3c25), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      { USB_DEVICE(0x14b2, 0x3c27), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -2497,9 +2848,12 @@ 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, 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) },
++      /* Edimax */
++      { USB_DEVICE(0x7392, 0x7711), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      /* EnGenius */
 +      { USB_DEVICE(0X1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -2510,13 +2864,21 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      { USB_DEVICE(0x0e66, 0x0003), 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) },
 +      /* Philips */
 +      { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      /* Planex */
 +      { USB_DEVICE(0x2019, 0xed06), USB_DEVICE_DATA(&rt2800usb_ops) },
++      { USB_DEVICE(0x2019, 0xab25), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      /* Ralink */
 +      { 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) },
++      /* Samsung */
++      { USB_DEVICE(0x04e8, 0x2018), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      /* Siemens */
 +      { USB_DEVICE(0x129b, 0x1828), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      /* Sitecom */
@@ -2536,6 +2898,9 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      /* ZCOM */
 +      { USB_DEVICE(0x0cde, 0x0022), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      { USB_DEVICE(0x0cde, 0x0025), USB_DEVICE_DATA(&rt2800usb_ops) },
++      /* Zinwell */
++      { USB_DEVICE(0x5a57, 0x0280), USB_DEVICE_DATA(&rt2800usb_ops) },
++      { USB_DEVICE(0x5a57, 0x0282), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      /* Zyxel */
 +      { USB_DEVICE(0x0586, 0x3416), USB_DEVICE_DATA(&rt2800usb_ops) },
 +      { 0, }
@@ -2572,9 +2937,9 @@ 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,1892 @@
+@@ -0,0 +1,1944 @@
 +/*
-+      Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
++      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
 +      <http://rt2x00.serialmonkey.com>
 +
 +      This program is free software; you can redistribute it and/or modify
@@ -2622,9 +2987,11 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +/*
 + * RT2870 version
 + */
-+#define RT2870_VERSION_C              0x0100
-+#define RT2870_VERSION_D              0x0101
-+#define RT2870_VERSION_E              0x0200
++#define RT2860C_VERSION                       0x28600100
++#define RT2860D_VERSION                       0x28600101
++#define RT2880E_VERSION                       0x28720200
++#define RT2883_VERSION                        0x28830300
++#define RT3070_VERSION                        0x30700200
 +
 +/*
 + * Signal information.
@@ -2958,6 +3325,15 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +#define PBF_DBG                               0x043c
 +
 +/*
++ * RF registers
++ */
++#define       RF_CSR_CFG                      0x0500
++#define RF_CSR_CFG_DATA                       FIELD32(0x000000ff)
++#define RF_CSR_CFG_REGNUM             FIELD32(0x00001f00)
++#define RF_CSR_CFG_WRITE              FIELD32(0x00010000)
++#define RF_CSR_CFG_BUSY                       FIELD32(0x00020000)
++
++/*
 + * MAC Control/Status Registers(CSR).
 + * Some values are set in TU, whereas 1 TU == 1024 us.
 + */
@@ -3245,7 +3621,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 + * EDCA_AC0_CFG:
 + */
 +#define EDCA_AC0_CFG                  0x1300
-+#define EDCA_AC0_CFG_AC_TX_OP         FIELD32(0x000000ff)
++#define EDCA_AC0_CFG_TX_OP            FIELD32(0x000000ff)
 +#define EDCA_AC0_CFG_AIFSN            FIELD32(0x00000f00)
 +#define EDCA_AC0_CFG_CWMIN            FIELD32(0x0000f000)
 +#define EDCA_AC0_CFG_CWMAX            FIELD32(0x000f0000)
@@ -3254,7 +3630,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 + * EDCA_AC1_CFG:
 + */
 +#define EDCA_AC1_CFG                  0x1304
-+#define EDCA_AC1_CFG_AC_TX_OP         FIELD32(0x000000ff)
++#define EDCA_AC1_CFG_TX_OP            FIELD32(0x000000ff)
 +#define EDCA_AC1_CFG_AIFSN            FIELD32(0x00000f00)
 +#define EDCA_AC1_CFG_CWMIN            FIELD32(0x0000f000)
 +#define EDCA_AC1_CFG_CWMAX            FIELD32(0x000f0000)
@@ -3263,7 +3639,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 + * EDCA_AC2_CFG:
 + */
 +#define EDCA_AC2_CFG                  0x1308
-+#define EDCA_AC2_CFG_AC_TX_OP         FIELD32(0x000000ff)
++#define EDCA_AC2_CFG_TX_OP            FIELD32(0x000000ff)
 +#define EDCA_AC2_CFG_AIFSN            FIELD32(0x00000f00)
 +#define EDCA_AC2_CFG_CWMIN            FIELD32(0x0000f000)
 +#define EDCA_AC2_CFG_CWMAX            FIELD32(0x000f0000)
@@ -3272,7 +3648,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 + * EDCA_AC3_CFG:
 + */
 +#define EDCA_AC3_CFG                  0x130c
-+#define EDCA_AC3_CFG_AC_TX_OP         FIELD32(0x000000ff)
++#define EDCA_AC3_CFG_TX_OP            FIELD32(0x000000ff)
 +#define EDCA_AC3_CFG_AIFSN            FIELD32(0x00000f00)
 +#define EDCA_AC3_CFG_CWMIN            FIELD32(0x0000f000)
 +#define EDCA_AC3_CFG_CWMAX            FIELD32(0x000f0000)
@@ -4057,6 +4433,46 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +#define BBP3_RX_ANTENNA                       FIELD8(0x18)
 +
 +/*
++ * BBP 4: Bandwidth
++ */
++#define BBP4_BANDWIDTH                        FIELD8(0x18)
++
++/*
++ * RFCSR registers
++ * The wordsize of the RFCSR is 8 bits.
++ */
++
++/*
++ * RFCSR 6:
++ */
++#define RFCSR6_R                      FIELD8(0x03)
++
++/*
++ * RFCSR 7:
++ */
++#define RFCSR7_RF_TUNING              FIELD8(0x01)
++
++/*
++ * RFCSR 12:
++ */
++#define RFCSR12_TX_POWER              FIELD8(0x1f)
++
++/*
++ * RFCSR 22:
++ */
++#define RFCSR22_BASEBAND_LOOPBACK     FIELD8(0x01)
++
++/*
++ * RFCSR 23:
++ */
++#define RFCSR23_FREQ_OFFSET           FIELD8(0x7f)
++
++/*
++ * RFCSR 30:
++ */
++#define RFCSR30_RF_CALIBRATION                FIELD8(0x80)
++
++/*
 + * RF registers
 + */
 +
@@ -4319,6 +4735,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +#define TXINFO_W0_USB_DMA_TX_PKT_LEN  FIELD32(0x0000ffff)
 +#define TXINFO_W0_WIV                 FIELD32(0x01000000)
 +#define TXINFO_W0_QSEL                        FIELD32(0x06000000)
++#define TXINFO_W0_SW_USE_LAST_ROUND   FIELD32(0x08000000)
 +#define TXINFO_W0_USB_DMA_NEXT_VALID  FIELD32(0x40000000)
 +#define TXINFO_W0_USB_DMA_TX_BURST    FIELD32(0x80000000)
 +
@@ -4475,3 +4892,16 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
  
        u16 rf;
        u32 rev;
+@@ -778,6 +779,12 @@ struct rt2x00_dev {
+       u8 freq_offset;
+       /*
++       * Calibration information (for rt2800usb).
++       */
++      u8 calibration_bw20;
++      u8 calibration_bw40;
++
++      /*
+        * Low level statistics which will have
+        * to be kept up to date while device is running.
+        */
diff --git a/package/mac80211/patches/305-rt2x00-Update-rt2x00ht.patch b/package/mac80211/patches/305-rt2x00-Update-rt2x00ht.patch
deleted file mode 100644 (file)
index 24a5572..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-From 8447ae720ac565d9c521e0c295705179d8876959 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 14:04:34 +0100
-Subject: [PATCH] rt2x00: Update rt2x00ht
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2x00ht.c |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2x00ht.c
-+++ b/drivers/net/wireless/rt2x00/rt2x00ht.c
-@@ -1,5 +1,5 @@
- /*
--      Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
-+      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
-       <http://rt2x00.serialmonkey.com>
-       This program is free software; you can redistribute it and/or modify
diff --git a/package/mac80211/patches/306-rt2x00-Update-rt2800pci.patch b/package/mac80211/patches/306-rt2x00-Update-rt2800pci.patch
deleted file mode 100644 (file)
index 00a65bc..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-From eb419a370a4c87fae945950442e4f7609aea952c Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 14:05:01 +0100
-Subject: [PATCH] rt2x00: Update rt2800pci
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c |    2 +-
- drivers/net/wireless/rt2x00/rt2800pci.h |    2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -1,5 +1,5 @@
- /*
--      Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
-+      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
-       <http://rt2x00.serialmonkey.com>
-       This program is free software; you can redistribute it and/or modify
---- a/drivers/net/wireless/rt2x00/rt2800pci.h
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -1,5 +1,5 @@
- /*
--      Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
-+      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
-       <http://rt2x00.serialmonkey.com>
-       This program is free software; you can redistribute it and/or modify
diff --git a/package/mac80211/patches/307-rt2x00-Update-rt2800usb.patch b/package/mac80211/patches/307-rt2x00-Update-rt2800usb.patch
deleted file mode 100644 (file)
index 73db364..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-From 1d5b075d27b109fc7a6b6a67e60754e2862b2d6b Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 14:05:21 +0100
-Subject: [PATCH] rt2x00: Update rt2800usb
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c |    2 +-
- drivers/net/wireless/rt2x00/rt2800usb.h |    2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -1,5 +1,5 @@
- /*
--      Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
-+      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
-       <http://rt2x00.serialmonkey.com>
-       This program is free software; you can redistribute it and/or modify
---- a/drivers/net/wireless/rt2x00/rt2800usb.h
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
-@@ -1,5 +1,5 @@
- /*
--      Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
-+      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
-       <http://rt2x00.serialmonkey.com>
-       This program is free software; you can redistribute it and/or modify
diff --git a/package/mac80211/patches/308-rt2x00-Add-powersaving-support-rt2800pci.patch b/package/mac80211/patches/308-rt2x00-Add-powersaving-support-rt2800pci.patch
deleted file mode 100644 (file)
index 583c2d9..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-From 059fef55f609bded8e83ec8b54729a2f500db938 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 14:29:21 +0100
-Subject: [PATCH] rt2x00: Add powersaving support (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c |   36 ++++++++++++++++++++++++++++++-
- 1 files changed, 35 insertions(+), 1 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -880,6 +880,36 @@ static void rt2800pci_config_duration(st
-       rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg);
- }
-+static void rt2800pci_config_ps(struct rt2x00_dev *rt2x00dev,
-+                              struct rt2x00lib_conf *libconf)
-+{
-+      enum dev_state state =
-+          (libconf->conf->flags & IEEE80211_CONF_PS) ?
-+              STATE_SLEEP : STATE_AWAKE;
-+      u32 reg;
-+
-+      if (state == STATE_SLEEP) {
-+              rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0);
-+
-+              rt2x00pci_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 5);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE,
-+                                 libconf->conf->listen_interval - 1);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 1);
-+              rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
-+
-+              rt2800pci_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 0);
-+      } else {
-+              rt2800pci_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0);
-+
-+              rt2x00pci_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 0);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE, 0);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 0);
-+              rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
-+      }
-+}
-+
- static void rt2800pci_config(struct rt2x00_dev *rt2x00dev,
-                            struct rt2x00lib_conf *libconf,
-                            const unsigned int flags)
-@@ -896,6 +926,8 @@ static void rt2800pci_config(struct rt2x
-               rt2800pci_config_retry_limit(rt2x00dev, libconf);
-       if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
-               rt2800pci_config_duration(rt2x00dev, libconf);
-+      if (flags & IEEE80211_CONF_CHANGE_PS)
-+              rt2800pci_config_ps(rt2x00dev, libconf);
- }
- /*
-@@ -2346,7 +2378,9 @@ static int rt2800pci_probe_hw_mode(struc
-        */
-       rt2x00dev->hw->flags =
-           IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
--          IEEE80211_HW_SIGNAL_DBM;
-+          IEEE80211_HW_SIGNAL_DBM |
-+          IEEE80211_HW_SUPPORTS_PS |
-+          IEEE80211_HW_PS_NULLFUNC_STACK;
-       rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
-       SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
diff --git a/package/mac80211/patches/309-rt2x00-Add-powersaving-support-rt2800usb.patch b/package/mac80211/patches/309-rt2x00-Add-powersaving-support-rt2800usb.patch
deleted file mode 100644 (file)
index 2b7dcc7..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-From fa9b7fc2e662e086a7c0e045e541f773bf34c555 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 14:31:00 +0100
-Subject: [PATCH] rt2x00: Add powersaving support (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c |   36 ++++++++++++++++++++++++++++++-
- 1 files changed, 35 insertions(+), 1 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -860,6 +860,36 @@ static void rt2800usb_config_duration(st
-       rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
- }
-+static void rt2800usb_config_ps(struct rt2x00_dev *rt2x00dev,
-+                              struct rt2x00lib_conf *libconf)
-+{
-+      enum dev_state state =
-+          (libconf->conf->flags & IEEE80211_CONF_PS) ?
-+              STATE_SLEEP : STATE_AWAKE;
-+      u32 reg;
-+
-+      if (state == STATE_SLEEP) {
-+              rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0);
-+
-+              rt2x00usb_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 5);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE,
-+                                 libconf->conf->listen_interval - 1);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 1);
-+              rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
-+
-+              rt2800usb_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 0);
-+      } else {
-+              rt2800usb_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0);
-+
-+              rt2x00usb_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 0);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE, 0);
-+              rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 0);
-+              rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
-+      }
-+}
-+
- static void rt2800usb_config(struct rt2x00_dev *rt2x00dev,
-                            struct rt2x00lib_conf *libconf,
-                            const unsigned int flags)
-@@ -876,6 +906,8 @@ static void rt2800usb_config(struct rt2x
-               rt2800usb_config_retry_limit(rt2x00dev, libconf);
-       if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
-               rt2800usb_config_duration(rt2x00dev, libconf);
-+      if (flags & IEEE80211_CONF_CHANGE_PS)
-+              rt2800usb_config_ps(rt2x00dev, libconf);
- }
- /*
-@@ -2112,7 +2144,9 @@ static int rt2800usb_probe_hw_mode(struc
-        */
-       rt2x00dev->hw->flags =
-           IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
--          IEEE80211_HW_SIGNAL_DBM;
-+          IEEE80211_HW_SIGNAL_DBM |
-+          IEEE80211_HW_SUPPORTS_PS |
-+          IEEE80211_HW_PS_NULLFUNC_STACK;
-       rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE + TXINFO_DESC_SIZE;
-       SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
diff --git a/package/mac80211/patches/310-rt2x00-Accept-beacons-in-normal-mode-rt2800pci.patch b/package/mac80211/patches/310-rt2x00-Accept-beacons-in-normal-mode-rt2800pci.patch
deleted file mode 100644 (file)
index 06d242a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-From 7191a5e338105009714415358773c828bbe90bb9 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 14:50:44 +0100
-Subject: [PATCH] rt2x00: Accept beacons in normal mode (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c |    3 +--
- 1 files changed, 1 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -467,8 +467,7 @@ static void rt2800pci_config_filter(stru
-                          !(filter_flags & FIF_PLCPFAIL));
-       rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
-                          !(filter_flags & FIF_PROMISC_IN_BSS));
--      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD,
--                         !(filter_flags & FIF_OTHER_BSS));
-+      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
-       rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
-       rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
-                          !(filter_flags & FIF_ALLMULTI));
diff --git a/package/mac80211/patches/311-rt2x00-Accept-beacons-in-normal-mode-rt2800usb.patch b/package/mac80211/patches/311-rt2x00-Accept-beacons-in-normal-mode-rt2800usb.patch
deleted file mode 100644 (file)
index 674ee00..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-From 6a27df44711605e730a92b1029fe54d6c988ed13 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 14:51:24 +0100
-Subject: [PATCH] rt2x00: Accept beacons in normal mode (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c |    3 +--
- 1 files changed, 1 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -447,8 +447,7 @@ static void rt2800usb_config_filter(stru
-                          !(filter_flags & FIF_PLCPFAIL));
-       rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
-                          !(filter_flags & FIF_PROMISC_IN_BSS));
--      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD,
--                         !(filter_flags & FIF_OTHER_BSS));
-+      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
-       rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
-       rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
-                          !(filter_flags & FIF_ALLMULTI));
diff --git a/package/mac80211/patches/312-rt2x00-Fix-TX-descriptor-usage-rt2800usb.patch b/package/mac80211/patches/312-rt2x00-Fix-TX-descriptor-usage-rt2800usb.patch
deleted file mode 100644 (file)
index 897a62e..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-From e9a3a3b9744f0204ec4beec8f9bea3c11ce6f54b Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 19:21:46 +0100
-Subject: [PATCH] rt2x00: Fix TX descriptor usage (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c |   46 ++++++++++---------------------
- drivers/net/wireless/rt2x00/rt2800usb.h |    1 +
- 2 files changed, 16 insertions(+), 31 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -1635,8 +1635,8 @@ static void rt2800usb_write_tx_desc(stru
-                                   struct txentry_desc *txdesc)
- {
-       struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
--      __le32 *txd = skbdesc->desc;
--      __le32 *txwi = txd + TXD_DESC_SIZE;
-+      __le32 *txi = skbdesc->desc;
-+      __le32 *txwi = txi + TXINFO_DESC_SIZE;
-       u32 word;
-       /*
-@@ -1683,31 +1683,15 @@ static void rt2800usb_write_tx_desc(stru
-       /*
-        * Initialize TX descriptor
-        */
--      rt2x00_desc_read(txd, 0, &word);
--      rt2x00_set_field32(&word, TXD_W0_SD_PTR0, skbdesc->skb_dma);
--      rt2x00_desc_write(txd, 0, word);
--
--      rt2x00_desc_read(txd, 1, &word);
--      rt2x00_set_field32(&word, TXD_W1_SD_LEN1, skb->len);
--      rt2x00_set_field32(&word, TXD_W1_LAST_SEC1, 1);
--      rt2x00_set_field32(&word, TXD_W1_BURST,
-+      rt2x00_desc_read(txi, 0, &word);
-+      rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, skb->len);
-+      rt2x00_set_field32(&word, TXINFO_W0_WIV, 1);
-+      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);
-+      rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_BURST,
-                          test_bit(ENTRY_TXD_BURST, &txdesc->flags));
--      rt2x00_set_field32(&word, TXD_W1_SD_LEN0,
--                         rt2x00dev->hw->extra_tx_headroom);
--      rt2x00_set_field32(&word, TXD_W1_LAST_SEC0,
--                         !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags));
--      rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 0);
--      rt2x00_desc_write(txd, 1, word);
--
--      rt2x00_desc_read(txd, 2, &word);
--      rt2x00_set_field32(&word, TXD_W2_SD_PTR1,
--                         skbdesc->skb_dma + rt2x00dev->hw->extra_tx_headroom);
--      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_QSEL, 2);
--      rt2x00_desc_write(txd, 3, word);
-+      rt2x00_desc_write(txi, 0, word);
- }
- /*
-@@ -1881,9 +1865,9 @@ static void rt2800usb_fill_rxdone(struct
-       rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
-       /*
--       * Remove TXWI descriptor from start of buffer.
-+       * Remove RXWI descriptor from start of buffer.
-        */
--      skb_pull(entry->skb, TXWI_DESC_SIZE + skbdesc->desc_len);
-+      skb_pull(entry->skb, RXWI_DESC_SIZE + skbdesc->desc_len);
-       skb_trim(entry->skb, rxdesc->size);
- }
-@@ -2146,7 +2130,7 @@ static int rt2800usb_probe_hw_mode(struc
-           IEEE80211_HW_SIGNAL_DBM |
-           IEEE80211_HW_SUPPORTS_PS |
-           IEEE80211_HW_PS_NULLFUNC_STACK;
--      rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE + TXINFO_DESC_SIZE;
-+      rt2x00dev->hw->extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
-       SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
-       SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
-@@ -2445,14 +2429,14 @@ static const struct data_queue_desc rt28
- static const struct data_queue_desc rt2800usb_queue_tx = {
-       .entry_num              = TX_ENTRIES,
-       .data_size              = DATA_FRAME_SIZE,
--      .desc_size              = TXD_DESC_SIZE,
-+      .desc_size              = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
-       .priv_size              = sizeof(struct queue_entry_priv_usb),
- };
- static const struct data_queue_desc rt2800usb_queue_bcn = {
-       .entry_num              = 8 * BEACON_ENTRIES,
-       .data_size              = MGMT_FRAME_SIZE,
--      .desc_size              = TXWI_DESC_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
-@@ -1744,6 +1744,7 @@ struct hw_key_entry {
- #define TXINFO_W0_USB_DMA_TX_PKT_LEN  FIELD32(0x0000ffff)
- #define TXINFO_W0_WIV                 FIELD32(0x01000000)
- #define TXINFO_W0_QSEL                        FIELD32(0x06000000)
-+#define TXINFO_W0_SW_USE_LAST_ROUND   FIELD32(0x08000000)
- #define TXINFO_W0_USB_DMA_NEXT_VALID  FIELD32(0x40000000)
- #define TXINFO_W0_USB_DMA_TX_BURST    FIELD32(0x80000000)
diff --git a/package/mac80211/patches/313-rt2x00-Add-TXWI-to-DMA-size-rt2800usb.patch b/package/mac80211/patches/313-rt2x00-Add-TXWI-to-DMA-size-rt2800usb.patch
deleted file mode 100644 (file)
index 1ccae4d..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-From fa9b5f135ba5e7877d1e3e970d39fcfa07f4004b Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 10 Jan 2009 20:07:13 +0100
-Subject: [PATCH] rt2x00: Add TXWI to DMA size (rt2800usb)
-
-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
-@@ -1684,7 +1684,8 @@ static void rt2800usb_write_tx_desc(stru
-        * Initialize TX descriptor
-        */
-       rt2x00_desc_read(txi, 0, &word);
--      rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, skb->len);
-+      rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
-+                         roundup(skb->len + TXWI_DESC_SIZE, 4));
-       rt2x00_set_field32(&word, TXINFO_W0_WIV, 1);
-       rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);
-       rt2x00_set_field32(&word, TXINFO_W0_SW_USE_LAST_ROUND, 0);
diff --git a/package/mac80211/patches/314-rt2x00-Wait-for-WPDMA-between-CRS-and-BBP-init-rt2.patch b/package/mac80211/patches/314-rt2x00-Wait-for-WPDMA-between-CRS-and-BBP-init-rt2.patch
deleted file mode 100644 (file)
index 43ed0c2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-From 827feb9f680fff5a4f1e04740357ea2c92e10b06 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Tue, 13 Jan 2009 21:29:37 +0100
-Subject: [PATCH] rt2x00: Wait for WPDMA between CRS and BBP init (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c |    4 +---
- 1 files changed, 1 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -1622,6 +1622,7 @@ static int rt2800pci_enable_radio(struct
-       if (unlikely(rt2800pci_wait_wpdma_ready(rt2x00dev) ||
-                    rt2800pci_init_queues(rt2x00dev) ||
-                    rt2800pci_init_registers(rt2x00dev) ||
-+                   rt2800pci_wait_wpdma_ready(rt2x00dev) ||
-                    rt2800pci_init_bbp(rt2x00dev)))
-               return -EIO;
-@@ -1630,9 +1631,6 @@ static int rt2800pci_enable_radio(struct
-        */
-       rt2800pci_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0);
--      /* Wait for DMA, ignore error */
--      rt2800pci_wait_wpdma_ready(rt2x00dev);
--
-       /*
-        * Enable RX.
-        */
diff --git a/package/mac80211/patches/316-rt2x00-Fix-register-initialization-rt2800pci.patch b/package/mac80211/patches/316-rt2x00-Fix-register-initialization-rt2800pci.patch
deleted file mode 100644 (file)
index 0f45cf9..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-From c3a42af4455fd75735c218ffac392ef86a3a250f Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 17 Jan 2009 19:18:38 +0100
-Subject: [PATCH] rt2x00: Fix register initialization (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c |   19 +++++++++++++++----
- 1 files changed, 15 insertions(+), 4 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -602,9 +602,12 @@ static void rt2800pci_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, 16);
-+              break;
-       case 3:
-               /* Do nothing */
-               break;
-@@ -1371,7 +1374,7 @@ static int rt2800pci_init_registers(stru
-        * ASIC will keep garbage value after boot, clear encryption keys.
-        */
-       for (i = 0; i < 254; i++) {
--              u32 wcid[2] = { 0xffffffff, 0x0000ffff };
-+              u32 wcid[2] = { 0xffffffff, 0x00ffffff };
-               rt2x00pci_register_multiwrite(rt2x00dev, MAC_WCID_ENTRY(i),
-                                             wcid, sizeof(wcid));
-       }
-@@ -2158,9 +2161,17 @@ static int rt2800pci_validate_eeprom(str
-       }
-       rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
--      if (word != 0) {
--              /* NIC configuration must always be 0. */
--              word = 0;
-+      if (word == 0xffff) {
-+              rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
-               rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
-               EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
-       }
diff --git a/package/mac80211/patches/317-rt2x00-Fix-register-initialization-rt2800usb.patch b/package/mac80211/patches/317-rt2x00-Fix-register-initialization-rt2800usb.patch
deleted file mode 100644 (file)
index de54242..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-From d97bb9291c59852989a86667ba317613fa2b77c5 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 17 Jan 2009 19:19:16 +0100
-Subject: [PATCH] rt2x00: Fix register initialization (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c |   20 ++++++++++++++++----
- 1 files changed, 16 insertions(+), 4 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -582,9 +582,12 @@ 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, 16);
-+              break;
-       case 3:
-               /* Do nothing */
-               break;
-@@ -1279,7 +1282,7 @@ static int rt2800usb_init_registers(stru
-        * ASIC will keep garbage value after boot, clear encryption keys.
-        */
-       for (i = 0; i < 254; i++) {
--              u32 wcid[2] = { 0xffffffff, 0x0000ffff };
-+              u32 wcid[2] = { 0xffffffff, 0x00ffffff };
-               rt2x00usb_register_multiwrite(rt2x00dev, MAC_WCID_ENTRY(i),
-                                             wcid, sizeof(wcid));
-       }
-@@ -1421,6 +1424,7 @@ static int rt2800usb_init_bbp(struct rt2
-       rt2800usb_bbp_write(rt2x00dev, 86, 0x00);
-       rt2800usb_bbp_write(rt2x00dev, 91, 0x04);
-       rt2800usb_bbp_write(rt2x00dev, 92, 0x00);
-+      rt2800usb_bbp_write(rt2x00dev, 103, 0x00);
-       rt2800usb_bbp_write(rt2x00dev, 105, 0x05);
-       if (rt2x00_rev(&rt2x00dev->chip) == RT2870_VERSION_C) {
-@@ -1904,9 +1908,17 @@ static int rt2800usb_validate_eeprom(str
-       }
-       rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
--      if (word != 0) {
--              /* NIC configuration must always be 0. */
--              word = 0;
-+      if (word == 0xffff) {
-+              rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
-+              rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
-               rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
-               EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
-       }
diff --git a/package/mac80211/patches/319-rt2x00-More-register-fixes-rt2800pci.patch b/package/mac80211/patches/319-rt2x00-More-register-fixes-rt2800pci.patch
deleted file mode 100644 (file)
index 0d0162d..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-From de75c463ca06352ac36c4a28440d10d5523bd6d9 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 17 Jan 2009 20:27:10 +0100
-Subject: [PATCH] rt2x00: More register fixes (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c |   59 +++++++++++++++----------------
- drivers/net/wireless/rt2x00/rt2800pci.h |    8 ++--
- 2 files changed, 33 insertions(+), 34 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -2506,33 +2506,34 @@ static int rt2800pci_set_rts_threshold(s
- {
-       struct rt2x00_dev *rt2x00dev = hw->priv;
-       u32 reg;
-+      bool enabled = (value < IEEE80211_MAX_RTS_THRESHOLD);
-       rt2x00pci_register_read(rt2x00dev, TX_RTS_CFG, &reg);
-       rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_THRES, value);
-       rt2x00pci_register_write(rt2x00dev, TX_RTS_CFG, reg);
-       rt2x00pci_register_read(rt2x00dev, CCK_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, CCK_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, CCK_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00pci_register_write(rt2x00dev, CCK_PROT_CFG, reg);
-       rt2x00pci_register_read(rt2x00dev, OFDM_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, OFDM_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, OFDM_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00pci_register_write(rt2x00dev, OFDM_PROT_CFG, reg);
-       rt2x00pci_register_read(rt2x00dev, MM20_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, MM20_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, MM20_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00pci_register_write(rt2x00dev, MM20_PROT_CFG, reg);
-       rt2x00pci_register_read(rt2x00dev, MM40_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, MM40_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, MM40_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00pci_register_write(rt2x00dev, MM40_PROT_CFG, reg);
-       rt2x00pci_register_read(rt2x00dev, GF20_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, GF20_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, GF20_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00pci_register_write(rt2x00dev, GF20_PROT_CFG, reg);
-       rt2x00pci_register_read(rt2x00dev, GF40_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, GF40_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, GF40_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00pci_register_write(rt2x00dev, GF40_PROT_CFG, reg);
-       return 0;
-@@ -2558,24 +2559,23 @@ static int rt2800pci_conf_tx(struct ieee
-       if (retval)
-               return retval;
-+      /*
-+       * We only need to perform additional register initialization
-+       * for WMM queues/
-+       */
-+      if (queue_idx >= 4)
-+              return 0;
-+
-       queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
-       /* Update WMM TXOP register */
--      if (queue_idx < 2) {
--              field.bit_offset = queue_idx * 16;
--              field.bit_mask = 0xffff << field.bit_offset;
--
--              rt2x00pci_register_read(rt2x00dev, WMM_TXOP0_CFG, &reg);
--              rt2x00_set_field32(&reg, field, queue->txop);
--              rt2x00pci_register_write(rt2x00dev, WMM_TXOP0_CFG, reg);
--      } else if (queue_idx < 4) {
--              field.bit_offset = (queue_idx - 2) * 16;
--              field.bit_mask = 0xffff << field.bit_offset;
--
--              rt2x00pci_register_read(rt2x00dev, WMM_TXOP1_CFG, &reg);
--              rt2x00_set_field32(&reg, field, queue->txop);
--              rt2x00pci_register_write(rt2x00dev, WMM_TXOP1_CFG, reg);
--      }
-+      offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2)));
-+      field.bit_offset = (queue_idx & 1) * 16;
-+      field.bit_mask = 0xffff << field.bit_offset;
-+
-+      rt2x00pci_register_read(rt2x00dev, offset, &reg);
-+      rt2x00_set_field32(&reg, field, queue->txop);
-+      rt2x00pci_register_write(rt2x00dev, offset, reg);
-       /* Update WMM registers */
-       field.bit_offset = queue_idx * 4;
-@@ -2594,15 +2594,14 @@ static int rt2800pci_conf_tx(struct ieee
-       rt2x00pci_register_write(rt2x00dev, WMM_CWMAX_CFG, reg);
-       /* Update EDCA registers */
--      if (queue_idx < 4) {
--              offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx);
-+      offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx);
--              rt2x00pci_register_read(rt2x00dev, offset, &reg);
--              rt2x00_set_field32(&reg, EDCA_AC0_CFG_AIFSN, queue->aifs);
--              rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMIN, queue->cw_min);
--              rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMAX, queue->cw_max);
--              rt2x00pci_register_write(rt2x00dev, offset, reg);
--      }
-+      rt2x00pci_register_read(rt2x00dev, offset, &reg);
-+      rt2x00_set_field32(&reg, EDCA_AC0_CFG_TX_OP, queue->txop);
-+      rt2x00_set_field32(&reg, EDCA_AC0_CFG_AIFSN, queue->aifs);
-+      rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMIN, queue->cw_min);
-+      rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMAX, queue->cw_max);
-+      rt2x00pci_register_write(rt2x00dev, offset, reg);
-       return 0;
- }
---- a/drivers/net/wireless/rt2x00/rt2800pci.h
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -667,7 +667,7 @@
-  * EDCA_AC0_CFG:
-  */
- #define EDCA_AC0_CFG                  0x1300
--#define EDCA_AC0_CFG_AC_TX_OP         FIELD32(0x000000ff)
-+#define EDCA_AC0_CFG_TX_OP            FIELD32(0x000000ff)
- #define EDCA_AC0_CFG_AIFSN            FIELD32(0x00000f00)
- #define EDCA_AC0_CFG_CWMIN            FIELD32(0x0000f000)
- #define EDCA_AC0_CFG_CWMAX            FIELD32(0x000f0000)
-@@ -676,7 +676,7 @@
-  * EDCA_AC1_CFG:
-  */
- #define EDCA_AC1_CFG                  0x1304
--#define EDCA_AC1_CFG_AC_TX_OP         FIELD32(0x000000ff)
-+#define EDCA_AC1_CFG_TX_OP            FIELD32(0x000000ff)
- #define EDCA_AC1_CFG_AIFSN            FIELD32(0x00000f00)
- #define EDCA_AC1_CFG_CWMIN            FIELD32(0x0000f000)
- #define EDCA_AC1_CFG_CWMAX            FIELD32(0x000f0000)
-@@ -685,7 +685,7 @@
-  * EDCA_AC2_CFG:
-  */
- #define EDCA_AC2_CFG                  0x1308
--#define EDCA_AC2_CFG_AC_TX_OP         FIELD32(0x000000ff)
-+#define EDCA_AC2_CFG_TX_OP            FIELD32(0x000000ff)
- #define EDCA_AC2_CFG_AIFSN            FIELD32(0x00000f00)
- #define EDCA_AC2_CFG_CWMIN            FIELD32(0x0000f000)
- #define EDCA_AC2_CFG_CWMAX            FIELD32(0x000f0000)
-@@ -694,7 +694,7 @@
-  * EDCA_AC3_CFG:
-  */
- #define EDCA_AC3_CFG                  0x130c
--#define EDCA_AC3_CFG_AC_TX_OP         FIELD32(0x000000ff)
-+#define EDCA_AC3_CFG_TX_OP            FIELD32(0x000000ff)
- #define EDCA_AC3_CFG_AIFSN            FIELD32(0x00000f00)
- #define EDCA_AC3_CFG_CWMIN            FIELD32(0x0000f000)
- #define EDCA_AC3_CFG_CWMAX            FIELD32(0x000f0000)
diff --git a/package/mac80211/patches/320-rt2x00-More-register-fixes-rt2800usb.patch b/package/mac80211/patches/320-rt2x00-More-register-fixes-rt2800usb.patch
deleted file mode 100644 (file)
index 2e7c496..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-From 6d9ef2042aff47309dbe973da5723c4972ed95bb Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 17 Jan 2009 20:27:40 +0100
-Subject: [PATCH] rt2x00: More register fixes (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c |   59 +++++++++++++++----------------
- drivers/net/wireless/rt2x00/rt2800usb.h |    8 ++--
- 2 files changed, 33 insertions(+), 34 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -2261,33 +2261,34 @@ static int rt2800usb_set_rts_threshold(s
- {
-       struct rt2x00_dev *rt2x00dev = hw->priv;
-       u32 reg;
-+      bool enabled = (value < IEEE80211_MAX_RTS_THRESHOLD);
-       rt2x00usb_register_read(rt2x00dev, TX_RTS_CFG, &reg);
-       rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_THRES, value);
-       rt2x00usb_register_write(rt2x00dev, TX_RTS_CFG, reg);
-       rt2x00usb_register_read(rt2x00dev, CCK_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, CCK_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, CCK_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00usb_register_write(rt2x00dev, CCK_PROT_CFG, reg);
-       rt2x00usb_register_read(rt2x00dev, OFDM_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, OFDM_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, OFDM_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00usb_register_write(rt2x00dev, OFDM_PROT_CFG, reg);
-       rt2x00usb_register_read(rt2x00dev, MM20_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, MM20_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, MM20_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00usb_register_write(rt2x00dev, MM20_PROT_CFG, reg);
-       rt2x00usb_register_read(rt2x00dev, MM40_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, MM40_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, MM40_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00usb_register_write(rt2x00dev, MM40_PROT_CFG, reg);
-       rt2x00usb_register_read(rt2x00dev, GF20_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, GF20_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, GF20_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00usb_register_write(rt2x00dev, GF20_PROT_CFG, reg);
-       rt2x00usb_register_read(rt2x00dev, GF40_PROT_CFG, &reg);
--      rt2x00_set_field32(&reg, GF40_PROT_CFG_RTS_TH_EN, 1);
-+      rt2x00_set_field32(&reg, GF40_PROT_CFG_RTS_TH_EN, enabled);
-       rt2x00usb_register_write(rt2x00dev, GF40_PROT_CFG, reg);
-       return 0;
-@@ -2313,24 +2314,23 @@ static int rt2800usb_conf_tx(struct ieee
-       if (retval)
-               return retval;
-+      /*
-+       * We only need to perform additional register initialization
-+       * for WMM queues/
-+       */
-+      if (queue_idx >= 4)
-+              return 0;
-+
-       queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
-       /* Update WMM TXOP register */
--      if (queue_idx < 2) {
--              field.bit_offset = queue_idx * 16;
--              field.bit_mask = 0xffff << field.bit_offset;
--
--              rt2x00usb_register_read(rt2x00dev, WMM_TXOP0_CFG, &reg);
--              rt2x00_set_field32(&reg, field, queue->txop);
--              rt2x00usb_register_write(rt2x00dev, WMM_TXOP0_CFG, reg);
--      } else if (queue_idx < 4) {
--              field.bit_offset = (queue_idx - 2) * 16;
--              field.bit_mask = 0xffff << field.bit_offset;
--
--              rt2x00usb_register_read(rt2x00dev, WMM_TXOP1_CFG, &reg);
--              rt2x00_set_field32(&reg, field, queue->txop);
--              rt2x00usb_register_write(rt2x00dev, WMM_TXOP1_CFG, reg);
--      }
-+      offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2)));
-+      field.bit_offset = (queue_idx & 1) * 16;
-+      field.bit_mask = 0xffff << field.bit_offset;
-+
-+      rt2x00usb_register_read(rt2x00dev, offset, &reg);
-+      rt2x00_set_field32(&reg, field, queue->txop);
-+      rt2x00usb_register_write(rt2x00dev, offset, reg);
-       /* Update WMM registers */
-       field.bit_offset = queue_idx * 4;
-@@ -2349,15 +2349,14 @@ static int rt2800usb_conf_tx(struct ieee
-       rt2x00usb_register_write(rt2x00dev, WMM_CWMAX_CFG, reg);
-       /* Update EDCA registers */
--      if (queue_idx < 4) {
--              offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx);
-+      offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx);
--              rt2x00usb_register_read(rt2x00dev, offset, &reg);
--              rt2x00_set_field32(&reg, EDCA_AC0_CFG_AIFSN, queue->aifs);
--              rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMIN, queue->cw_min);
--              rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMAX, queue->cw_max);
--              rt2x00usb_register_write(rt2x00dev, offset, reg);
--      }
-+      rt2x00usb_register_read(rt2x00dev, offset, &reg);
-+      rt2x00_set_field32(&reg, EDCA_AC0_CFG_TX_OP, queue->txop);
-+      rt2x00_set_field32(&reg, EDCA_AC0_CFG_AIFSN, queue->aifs);
-+      rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMIN, queue->cw_min);
-+      rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMAX, queue->cw_max);
-+      rt2x00usb_register_write(rt2x00dev, offset, reg);
-       return 0;
- }
---- a/drivers/net/wireless/rt2x00/rt2800usb.h
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
-@@ -670,7 +670,7 @@
-  * EDCA_AC0_CFG:
-  */
- #define EDCA_AC0_CFG                  0x1300
--#define EDCA_AC0_CFG_AC_TX_OP         FIELD32(0x000000ff)
-+#define EDCA_AC0_CFG_TX_OP            FIELD32(0x000000ff)
- #define EDCA_AC0_CFG_AIFSN            FIELD32(0x00000f00)
- #define EDCA_AC0_CFG_CWMIN            FIELD32(0x0000f000)
- #define EDCA_AC0_CFG_CWMAX            FIELD32(0x000f0000)
-@@ -679,7 +679,7 @@
-  * EDCA_AC1_CFG:
-  */
- #define EDCA_AC1_CFG                  0x1304
--#define EDCA_AC1_CFG_AC_TX_OP         FIELD32(0x000000ff)
-+#define EDCA_AC1_CFG_TX_OP            FIELD32(0x000000ff)
- #define EDCA_AC1_CFG_AIFSN            FIELD32(0x00000f00)
- #define EDCA_AC1_CFG_CWMIN            FIELD32(0x0000f000)
- #define EDCA_AC1_CFG_CWMAX            FIELD32(0x000f0000)
-@@ -688,7 +688,7 @@
-  * EDCA_AC2_CFG:
-  */
- #define EDCA_AC2_CFG                  0x1308
--#define EDCA_AC2_CFG_AC_TX_OP         FIELD32(0x000000ff)
-+#define EDCA_AC2_CFG_TX_OP            FIELD32(0x000000ff)
- #define EDCA_AC2_CFG_AIFSN            FIELD32(0x00000f00)
- #define EDCA_AC2_CFG_CWMIN            FIELD32(0x0000f000)
- #define EDCA_AC2_CFG_CWMAX            FIELD32(0x000f0000)
-@@ -697,7 +697,7 @@
-  * EDCA_AC3_CFG:
-  */
- #define EDCA_AC3_CFG                  0x130c
--#define EDCA_AC3_CFG_AC_TX_OP         FIELD32(0x000000ff)
-+#define EDCA_AC3_CFG_TX_OP            FIELD32(0x000000ff)
- #define EDCA_AC3_CFG_AIFSN            FIELD32(0x00000f00)
- #define EDCA_AC3_CFG_CWMIN            FIELD32(0x0000f000)
- #define EDCA_AC3_CFG_CWMAX            FIELD32(0x000f0000)
diff --git a/package/mac80211/patches/324-rt2x00-Fix-preamble-detection-rt2x00ht.patch b/package/mac80211/patches/324-rt2x00-Fix-preamble-detection-rt2x00ht.patch
deleted file mode 100644 (file)
index 1321232..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-From ecce227dab27aaf2d1c81a605d3e6e6f6d55908a Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sun, 18 Jan 2009 20:20:08 +0100
-Subject: [PATCH] rt2x00: Fix preamble detection (rt2x00ht)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2x00ht.c    |   14 +++++++-------
- drivers/net/wireless/rt2x00/rt2x00lib.h   |    4 ++--
- drivers/net/wireless/rt2x00/rt2x00queue.c |    2 +-
- 3 files changed, 10 insertions(+), 10 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2x00ht.c
-+++ b/drivers/net/wireless/rt2x00/rt2x00ht.c
-@@ -31,10 +31,10 @@
- void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
-                                  struct txentry_desc *txdesc,
--                                 struct ieee80211_rate *rate)
-+                                 const struct rt2x00_rate *hwrate)
- {
-       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
--      const struct rt2x00_rate *hwrate = rt2x00_get_rate(rate->hw_value);
-+      struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
-       if (tx_info->control.sta)
-               txdesc->mpdu_density =
-@@ -46,7 +46,7 @@ void rt2x00ht_create_tx_descriptor(struc
-       txdesc->stbc = 0;       /* FIXME: What value is needed? */
-       txdesc->mcs = rt2x00_get_rate_mcs(hwrate->mcs);
--      if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
-+      if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
-               txdesc->mcs |= 0x08;
-       /*
-@@ -58,12 +58,12 @@ void rt2x00ht_create_tx_descriptor(struc
-       /*
-        * Determine HT Mix/Greenfield rate mode
-        */
--      if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_MCS)
-+      if (txrate->flags & IEEE80211_TX_RC_MCS)
-               txdesc->rate_mode = RATE_MODE_HT_MIX;
--      if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD)
-+      if (txrate->flags & IEEE80211_TX_RC_GREEN_FIELD)
-               txdesc->rate_mode = RATE_MODE_HT_GREENFIELD;
--      if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
-+      if (txrate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
-               __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags);
--      if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
-+      if (txrate->flags & IEEE80211_TX_RC_SHORT_GI)
-               __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags);
- }
---- a/drivers/net/wireless/rt2x00/rt2x00lib.h
-+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
-@@ -344,11 +344,11 @@ static inline void rt2x00crypto_rx_inser
- #ifdef CONFIG_RT2X00_LIB_HT
- void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
-                                  struct txentry_desc *txdesc,
--                                 struct ieee80211_rate *rate);
-+                                 const struct rt2x00_rate *hwrate);
- #else
- static inline void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
-                                                struct txentry_desc *txdesc,
--                                               struct ieee80211_rate *rate)
-+                                               const struct rt2x00_rate *hwrate)
- {
- }
- #endif /* CONFIG_RT2X00_LIB_HT */
---- a/drivers/net/wireless/rt2x00/rt2x00queue.c
-+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
-@@ -326,7 +326,7 @@ static void rt2x00queue_create_tx_descri
-        * Apply TX descriptor handling by components
-        */
-       rt2x00crypto_create_tx_descriptor(entry, txdesc);
--      rt2x00ht_create_tx_descriptor(entry, txdesc, rate);
-+      rt2x00ht_create_tx_descriptor(entry, txdesc, hwrate);
-       rt2x00queue_create_tx_descriptor_seq(entry, txdesc);
-       rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
- }
diff --git a/package/mac80211/patches/325-rt2x00-rt2x00_rev-should-return-u32.patch b/package/mac80211/patches/325-rt2x00-rt2x00_rev-should-return-u32.patch
deleted file mode 100644 (file)
index 0a14d9f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-From 3dc31edfe4bad6048f097cd4a088499500db9a2e Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Thu, 22 Jan 2009 21:01:56 +0100
-Subject: [PATCH] rt2x00: rt2x00_rev() should return u32
-
-The "rev" field in chipset definition is an u32,
-which means that rt2x00_rev() which returns that field
-should be of the same type.
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2x00.h |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2x00.h
-+++ b/drivers/net/wireless/rt2x00/rt2x00.h
-@@ -878,7 +878,7 @@ static inline char rt2x00_rf(const struc
-       return (chipset->rf == chip);
- }
--static inline u16 rt2x00_rev(const struct rt2x00_chip *chipset)
-+static inline u32 rt2x00_rev(const struct rt2x00_chip *chipset)
- {
-       return chipset->rev;
- }
diff --git a/package/mac80211/patches/326-rt2x00-Update-chipset-ID-handling-rt2800pci.patch b/package/mac80211/patches/326-rt2x00-Update-chipset-ID-handling-rt2800pci.patch
deleted file mode 100644 (file)
index 284ba04..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-From d2216933a12c38ab23ee1170c1c143002a825046 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Thu, 22 Jan 2009 21:16:08 +0100
-Subject: [PATCH] rt2x00: Update chipset ID handling (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c |   22 ++++++++++++++++------
- drivers/net/wireless/rt2x00/rt2800pci.h |    8 +++++---
- 2 files changed, 21 insertions(+), 9 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -984,7 +984,7 @@ static void rt2800pci_reset_tuner(struct
- static void rt2800pci_link_tuner(struct rt2x00_dev *rt2x00dev,
-                                struct link_qual *qual, const u32 count)
- {
--      if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_C)
-+      if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION)
-               return;
-       /*
-@@ -1272,7 +1272,11 @@ static int rt2800pci_init_registers(stru
-       rt2x00pci_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
-       rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
--      rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
-+      if (rt2x00_rev(&rt2x00dev->chip) >= RT2880E_VERSION &&
-+          rt2x00_rev(&rt2x00dev->chip) < RT3070_VERSION)
-+              rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
-+      else
-+              rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
-       rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_PSDU, 0);
-       rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_MPDU, 0);
-       rt2x00pci_register_write(rt2x00dev, MAX_LEN_CFG, reg);
-@@ -1523,12 +1527,12 @@ static int rt2800pci_init_bbp(struct rt2
-       rt2800pci_bbp_write(rt2x00dev, 103, 0x00);
-       rt2800pci_bbp_write(rt2x00dev, 105, 0x05);
--      if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_C) {
-+      if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
-               rt2800pci_bbp_write(rt2x00dev, 69, 0x16);
-               rt2800pci_bbp_write(rt2x00dev, 73, 0x12);
-       }
--      if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_D)
-+      if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION)
-               rt2800pci_bbp_write(rt2x00dev, 84, 0x19);
-       for (i = 0; i < EEPROM_BBP_SIZE; i++) {
-@@ -1637,6 +1641,11 @@ static int rt2800pci_enable_radio(struct
-       /*
-        * Enable RX.
-        */
-+      rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
-+      rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_TX, 1);
-+      rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0);
-+      rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
-+
-       rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
-       rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 1);
-       rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 1);
-@@ -2253,13 +2262,14 @@ static int rt2800pci_init_eeprom(struct 
-                            PCI_CONFIG_HEADER_DEVICE, &device);
-       value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
-       rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg);
--      reg = rt2x00_get_field32(reg, MAC_CSR0_ASIC_REV);
-       rt2x00_set_chip(rt2x00dev, device, value, reg);
-       if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
-           !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
-           !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
--          !rt2x00_rf(&rt2x00dev->chip, RF2750)) {
-+          !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
-+          !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
-+          !rt2x00_rf(&rt2x00dev->chip, RF2020)) {
-               ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
-               return -ENODEV;
-       }
---- a/drivers/net/wireless/rt2x00/rt2800pci.h
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -47,9 +47,11 @@
- /*
-  * RT2860 version
-  */
--#define RT2860_VERSION_C              0x0100
--#define RT2860_VERSION_D              0x0101
--#define RT2860_VERSION_E              0x0200
-+#define RT2860C_VERSION                       0x28600100
-+#define RT2860D_VERSION                       0x28600101
-+#define RT2880E_VERSION                       0x28720200
-+#define RT2883_VERSION                        0x28830300
-+#define RT3070_VERSION                        0x30700200
- /*
-  * Signal information.
diff --git a/package/mac80211/patches/327-rt2x00-Add-support-for-rt3070-rt2800usb.patch b/package/mac80211/patches/327-rt2x00-Add-support-for-rt3070-rt2800usb.patch
deleted file mode 100644 (file)
index e92bcd2..0000000
+++ /dev/null
@@ -1,683 +0,0 @@
-From 84706fce3026650c49c6290e0e6525b45795027c Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Thu, 22 Jan 2009 21:16:46 +0100
-Subject: [PATCH] rt2x00: Add support for rt3070 (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c |  384 +++++++++++++++++++++++++++----
- drivers/net/wireless/rt2x00/rt2800usb.h |   57 +++++-
- drivers/net/wireless/rt2x00/rt2x00.h    |    6 +
- 3 files changed, 404 insertions(+), 43 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -59,6 +59,8 @@ MODULE_PARM_DESC(nohwcrypt, "Disable har
-  */
- #define WAIT_FOR_BBP(__dev, __reg) \
-       rt2x00usb_regbusy_read((__dev), BBP_CSR_CFG, BBP_CSR_CFG_BUSY, (__reg))
-+#define WAIT_FOR_RFCSR(__dev, __reg) \
-+      rt2x00usb_regbusy_read((__dev), RF_CSR_CFG, RF_CSR_CFG_BUSY, (__reg))
- #define WAIT_FOR_RF(__dev, __reg) \
-       rt2x00usb_regbusy_read((__dev), RF_CSR_CFG0, RF_CSR_CFG0_BUSY, (__reg))
- #define WAIT_FOR_MCU(__dev, __reg) \
-@@ -120,6 +122,61 @@ static void rt2800usb_bbp_read(struct rt
-       mutex_unlock(&rt2x00dev->csr_mutex);
- }
-+static void rt2800usb_rfcsr_write(struct rt2x00_dev *rt2x00dev,
-+                                const unsigned int word, const u8 value)
-+{
-+      u32 reg;
-+
-+      mutex_lock(&rt2x00dev->csr_mutex);
-+
-+      /*
-+       * Wait until the RFCSR becomes available, afterwards we
-+       * can safely write the new data into the register.
-+       */
-+      if (WAIT_FOR_RFCSR(rt2x00dev, &reg)) {
-+              reg = 0;
-+              rt2x00_set_field32(&reg, RF_CSR_CFG_DATA, value);
-+              rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
-+              rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 1);
-+              rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
-+
-+              rt2x00usb_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
-+      }
-+
-+      mutex_unlock(&rt2x00dev->csr_mutex);
-+}
-+
-+static void rt2800usb_rfcsr_read(struct rt2x00_dev *rt2x00dev,
-+                               const unsigned int word, u8 *value)
-+{
-+      u32 reg;
-+
-+      mutex_lock(&rt2x00dev->csr_mutex);
-+
-+      /*
-+       * Wait until the RFCSR becomes available, afterwards we
-+       * can safely write the read request into the register.
-+       * After the data has been written, we wait until hardware
-+       * returns the correct value, if at any time the register
-+       * doesn't become available in time, reg will be 0xffffffff
-+       * which means we return 0xff to the caller.
-+       */
-+      if (WAIT_FOR_RFCSR(rt2x00dev, &reg)) {
-+              reg = 0;
-+              rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
-+              rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 0);
-+              rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
-+
-+              rt2x00usb_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg);
-+
-+              WAIT_FOR_RFCSR(rt2x00dev, &reg);
-+      }
-+
-+      *value = rt2x00_get_field32(reg, RF_CSR_CFG_DATA);
-+
-+      mutex_unlock(&rt2x00dev->csr_mutex);
-+}
-+
- static void rt2800usb_rf_write(struct rt2x00_dev *rt2x00dev,
-                              const unsigned int word, const u32 value)
- {
-@@ -635,42 +692,24 @@ static void rt2800usb_config_lna_gain(st
-       rt2x00dev->lna_gain = lna_gain;
- }
--static void rt2800usb_config_channel(struct rt2x00_dev *rt2x00dev,
--                                   struct rf_channel *rf,
--                                   struct channel_info *info)
-+static void rt2800usb_config_channel_rt2x(struct rt2x00_dev *rt2x00dev,
-+                                        struct rf_channel *rf,
-+                                        struct channel_info *info)
- {
--      u32 reg;
--      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) {
-+      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);
-@@ -698,15 +737,11 @@ static void rt2800usb_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,
-@@ -730,6 +765,81 @@ static void rt2800usb_config_channel(str
-       rt2800usb_rf_write(rt2x00dev, 2, rf->rf2);
-       rt2800usb_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004);
-       rt2800usb_rf_write(rt2x00dev, 4, rf->rf4);
-+}
-+
-+static void rt2800usb_config_channel_rt3x(struct rt2x00_dev *rt2x00dev,
-+                                        struct rf_channel *rf,
-+                                        struct channel_info *info)
-+{
-+      u8 rfcsr;
-+
-+      rt2800usb_rfcsr_write(rt2x00dev, 2, rf->rf1);
-+      rt2800usb_rfcsr_write(rt2x00dev, 2, rf->rf3);
-+
-+      rt2800usb_rfcsr_read(rt2x00dev, 6, &rfcsr);
-+      rt2x00_set_field8(&rfcsr, RFCSR6_R, rf->rf2);
-+      rt2800usb_rfcsr_write(rt2x00dev, 6, rfcsr);
-+
-+      rt2800usb_rfcsr_read(rt2x00dev, 12, &rfcsr);
-+      rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER,
-+                        TXPOWER_G_TO_DEV(info->tx_power1));
-+      rt2800usb_rfcsr_write(rt2x00dev, 12, rfcsr);
-+
-+      rt2800usb_rfcsr_read(rt2x00dev, 23, &rfcsr);
-+      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);
-+      else
-+              rt2800usb_rfcsr_write(rt2x00dev, 24, rt2x00dev->calibration_bw20);
-+
-+      rt2800usb_rfcsr_read(rt2x00dev, 23, &rfcsr);
-+      rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1);
-+      rt2800usb_rfcsr_write(rt2x00dev, 23, rfcsr);
-+}
-+
-+static void rt2800usb_config_channel(struct rt2x00_dev *rt2x00dev,
-+                                   struct rf_channel *rf,
-+                                   struct channel_info *info)
-+{
-+      u32 reg;
-+      unsigned int tx_pin;
-+      u16 eeprom;
-+
-+      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);
-+
-+      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);
-+      else
-+              rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
-       /*
-        * Change BBP settings
-@@ -935,8 +1045,12 @@ static void rt2800usb_link_stats(struct 
- static u8 rt2800usb_get_default_vgc(struct rt2x00_dev *rt2x00dev)
- {
--      if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ)
--              return 0x2e + rt2x00dev->lna_gain;
-+      if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
-+              if (rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION)
-+                      return 0x1c + (2 * rt2x00dev->lna_gain);
-+              else
-+                      return 0x2e + rt2x00dev->lna_gain;
-+      }
-       if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags))
-               return 0x32 + (rt2x00dev->lna_gain * 5) / 3;
-@@ -964,7 +1078,7 @@ static void rt2800usb_reset_tuner(struct
- static void rt2800usb_link_tuner(struct rt2x00_dev *rt2x00dev,
-                                struct link_qual *qual, const u32 count)
- {
--      if (rt2x00_rev(&rt2x00dev->chip) == RT2870_VERSION_C)
-+      if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION)
-               return;
-       /*
-@@ -1145,8 +1259,14 @@ static int rt2800usb_init_registers(stru
-       rt2x00_set_field32(&reg, BCN_TIME_CFG_TX_TIME_COMPENSATE, 0);
-       rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
--      rt2x00usb_register_write(rt2x00dev, TX_SW_CFG0, 0x00040a06);
--      rt2x00usb_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
-+      if (rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION) {
-+              rt2x00usb_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400);
-+              rt2x00usb_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
-+              rt2x00usb_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
-+      } else {
-+              rt2x00usb_register_write(rt2x00dev, TX_SW_CFG0, 0x00040a06);
-+              rt2x00usb_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
-+      }
-       rt2x00usb_register_read(rt2x00dev, TX_LINK_CFG, &reg);
-       rt2x00_set_field32(&reg, TX_LINK_CFG_REMOTE_MFB_LIFETIME, 32);
-@@ -1166,7 +1286,11 @@ static int rt2800usb_init_registers(stru
-       rt2x00usb_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
-       rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
--      rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
-+      if (rt2x00_rev(&rt2x00dev->chip) >= RT2880E_VERSION &&
-+          rt2x00_rev(&rt2x00dev->chip) < RT3070_VERSION)
-+              rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
-+      else
-+              rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
-       rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_PSDU, 0);
-       rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_MPDU, 0);
-       rt2x00usb_register_write(rt2x00dev, MAX_LEN_CFG, reg);
-@@ -1427,13 +1551,16 @@ static int rt2800usb_init_bbp(struct rt2
-       rt2800usb_bbp_write(rt2x00dev, 103, 0x00);
-       rt2800usb_bbp_write(rt2x00dev, 105, 0x05);
--      if (rt2x00_rev(&rt2x00dev->chip) == RT2870_VERSION_C) {
-+      if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
-               rt2800usb_bbp_write(rt2x00dev, 69, 0x16);
-               rt2800usb_bbp_write(rt2x00dev, 73, 0x12);
-       }
--      if (rt2x00_rev(&rt2x00dev->chip) != RT2870_VERSION_D)
--              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);
-+              rt2800usb_bbp_write(rt2x00dev, 105, 0x05);
-+      }
-       for (i = 0; i < EEPROM_BBP_SIZE; i++) {
-               rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom);
-@@ -1448,6 +1575,134 @@ static int rt2800usb_init_bbp(struct rt2
-       return 0;
- }
-+static u8 rt2800usb_init_rx_filter(struct rt2x00_dev *rt2x00dev,
-+                                 bool bw40, u8 rfcsr24, u8 filter_target)
-+{
-+      unsigned int i;
-+      u8 bbp;
-+      u8 rfcsr;
-+      u8 passband;
-+      u8 stopband;
-+      u8 overtuned = 0;
-+
-+      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_rfcsr_read(rt2x00dev, 22, &rfcsr);
-+      rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 1);
-+      rt2800usb_rfcsr_write(rt2x00dev, 22, rfcsr);
-+
-+      /*
-+       * Set power & frequency of passband test tone
-+       */
-+      rt2800usb_bbp_write(rt2x00dev, 24, 0);
-+
-+      for (i = 0; i < 100; i++) {
-+              rt2800usb_bbp_write(rt2x00dev, 25, 0x90);
-+              msleep(1);
-+
-+              rt2800usb_bbp_read(rt2x00dev, 55, &passband);
-+              if (passband)
-+                      break;
-+      }
-+
-+      /*
-+       * Set power & frequency of stopband test tone
-+       */
-+      rt2800usb_bbp_write(rt2x00dev, 24, 0x06);
-+
-+      for (i = 0; i < 100; i++) {
-+              rt2800usb_bbp_write(rt2x00dev, 25, 0x90);
-+              msleep(1);
-+
-+              rt2800usb_bbp_read(rt2x00dev, 55, &stopband);
-+
-+              if ((passband - stopband) <= filter_target) {
-+                      rfcsr24++;
-+                      overtuned += ((passband - stopband) == filter_target);
-+              } else
-+                      break;
-+
-+              rt2800usb_rfcsr_write(rt2x00dev, 24, rfcsr24);
-+      }
-+
-+      rfcsr24 -= !!overtuned;
-+
-+      rt2800usb_rfcsr_write(rt2x00dev, 24, rfcsr24);
-+      return rfcsr24;
-+}
-+
-+static int rt2800usb_init_rfcsr(struct rt2x00_dev *rt2x00dev)
-+{
-+      u8 rfcsr;
-+      u8 bbp;
-+
-+      if (rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION)
-+              return 0;
-+
-+      /*
-+       * Init RF calibration.
-+       */
-+      rt2800usb_rfcsr_read(rt2x00dev, 30, &rfcsr);
-+      rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1);
-+      rt2800usb_rfcsr_write(rt2x00dev, 30, rfcsr);
-+      msleep(1);
-+      rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
-+      rt2800usb_rfcsr_write(rt2x00dev, 30, rfcsr);
-+
-+      rt2800usb_rfcsr_write(rt2x00dev, 4, 0x40);
-+      rt2800usb_rfcsr_write(rt2x00dev, 5, 0x03);
-+      rt2800usb_rfcsr_write(rt2x00dev, 6, 0x02);
-+      rt2800usb_rfcsr_write(rt2x00dev, 7, 0x70);
-+      rt2800usb_rfcsr_write(rt2x00dev, 9, 0x0f);
-+      rt2800usb_rfcsr_write(rt2x00dev, 10, 0x71);
-+      rt2800usb_rfcsr_write(rt2x00dev, 11, 0x21);
-+      rt2800usb_rfcsr_write(rt2x00dev, 12, 0x7b);
-+      rt2800usb_rfcsr_write(rt2x00dev, 14, 0x90);
-+      rt2800usb_rfcsr_write(rt2x00dev, 15, 0x58);
-+      rt2800usb_rfcsr_write(rt2x00dev, 16, 0xb3);
-+      rt2800usb_rfcsr_write(rt2x00dev, 17, 0x92);
-+      rt2800usb_rfcsr_write(rt2x00dev, 18, 0x2c);
-+      rt2800usb_rfcsr_write(rt2x00dev, 19, 0x02);
-+      rt2800usb_rfcsr_write(rt2x00dev, 20, 0xba);
-+      rt2800usb_rfcsr_write(rt2x00dev, 21, 0xdb);
-+      rt2800usb_rfcsr_write(rt2x00dev, 24, 0x16);
-+      rt2800usb_rfcsr_write(rt2x00dev, 25, 0x01);
-+      rt2800usb_rfcsr_write(rt2x00dev, 27, 0x03);
-+      rt2800usb_rfcsr_write(rt2x00dev, 29, 0x1f);
-+
-+      /*
-+       * Set RX Filter calibration for 20MHz and 40MHz
-+       */
-+      rt2x00dev->calibration_bw20 =
-+          rt2800usb_init_rx_filter(rt2x00dev, false, 0x07, 0x16);
-+      rt2x00dev->calibration_bw40 =
-+          rt2800usb_init_rx_filter(rt2x00dev, true, 0x27, 0x19);
-+
-+      /*
-+       * Set back to initial state
-+       */
-+      rt2800usb_bbp_write(rt2x00dev, 24, 0);
-+
-+      rt2800usb_rfcsr_read(rt2x00dev, 22, &rfcsr);
-+      rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0);
-+      rt2800usb_rfcsr_write(rt2x00dev, 22, rfcsr);
-+
-+      /*
-+       * set BBP back to BW20
-+       */
-+      rt2800usb_bbp_read(rt2x00dev, 4, &bbp);
-+      rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0);
-+      rt2800usb_bbp_write(rt2x00dev, 4, bbp);
-+
-+      return 0;
-+}
-+
- /*
-  * Device state switch handlers.
-  */
-@@ -1491,7 +1746,8 @@ static int rt2800usb_enable_radio(struct
-        */
-       if (unlikely(rt2800usb_wait_wpdma_ready(rt2x00dev) ||
-                    rt2800usb_init_registers(rt2x00dev) ||
--                   rt2800usb_init_bbp(rt2x00dev)))
-+                   rt2800usb_init_bbp(rt2x00dev) ||
-+                   rt2800usb_init_rfcsr(rt2x00dev)))
-               return -EIO;
-       rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
-@@ -1982,7 +2238,6 @@ static int rt2800usb_validate_eeprom(str
- static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
- {
-       u32 reg;
--      u16 rev;
-       u16 value;
-       u16 eeprom;
-@@ -1996,8 +2251,7 @@ static int rt2800usb_init_eeprom(struct 
-        */
-       value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
-       rt2x00usb_register_read(rt2x00dev, MAC_CSR0, &reg);
--      rev = rt2x00_get_field32(reg, MAC_CSR0_ASIC_REV);
--      rt2x00_set_chip(rt2x00dev, RT2870, value, rev);
-+      rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
-       /*
-        * The check for rt2860 is not a typo, some rt2870 hardware
-@@ -2012,7 +2266,9 @@ static int rt2800usb_init_eeprom(struct 
-       if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
-           !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
-           !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
--          !rt2x00_rf(&rt2x00dev->chip, RF2750)) {
-+          !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
-+          !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
-+          !rt2x00_rf(&rt2x00dev->chip, RF2020)) {
-               ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
-               return -ENODEV;
-       }
-@@ -2127,6 +2383,27 @@ static const struct rf_channel rf_vals[]
-       { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
- };
-+/*
-+ * RF value list for rt3070
-+ * Supports: 2.4 GHz
-+ */
-+static const struct rf_channel rf_vals_3070[] = {
-+      {1,  241, 2, 2 },
-+      {2,  241, 2, 7 },
-+      {3,  242, 2, 2 },
-+      {4,  242, 2, 7 },
-+      {5,  243, 2, 2 },
-+      {6,  243, 2, 7 },
-+      {7,  244, 2, 2 },
-+      {8,  244, 2, 7 },
-+      {9,  245, 2, 2 },
-+      {10, 245, 2, 7 },
-+      {11, 246, 2, 2 },
-+      {12, 246, 2, 7 },
-+      {13, 247, 2, 2 },
-+      {14, 248, 2, 4 },
-+};
-+
- static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
- {
-       struct hw_mode_spec *spec = &rt2x00dev->spec;
-@@ -2184,6 +2461,10 @@ static int rt2800usb_probe_hw_mode(struc
-               spec->supported_bands |= SUPPORT_BAND_5GHZ;
-               spec->num_channels = ARRAY_SIZE(rf_vals);
-               spec->channels = rf_vals;
-+      } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
-+                 rt2x00_rf(&rt2x00dev->chip, RF2020)) {
-+              spec->num_channels = ARRAY_SIZE(rf_vals_3070);
-+              spec->channels = rf_vals_3070;
-       }
-       /*
-@@ -2473,6 +2754,12 @@ static const struct rt2x00_ops rt2800usb
-  * rt2800usb module information.
-  */
- 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(0x1482, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
-       /* Amit */
-       { USB_DEVICE(0x15c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) },
-       /* ASUS */
-@@ -2483,9 +2770,12 @@ static struct usb_device_id rt2800usb_de
-       { USB_DEVICE(0x13d3, 0x3247), USB_DEVICE_DATA(&rt2800usb_ops) },
-       /* Belkin */
-       { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) },
-+      { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) },
-       /* Conceptronic */
-       { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) },
-       { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) },
-+      { USB_DEVICE(0x14b2, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
-+      { USB_DEVICE(0x14b2, 0x3c12), USB_DEVICE_DATA(&rt2800usb_ops) },
-       { USB_DEVICE(0x14b2, 0x3c23), USB_DEVICE_DATA(&rt2800usb_ops) },
-       { USB_DEVICE(0x14b2, 0x3c25), USB_DEVICE_DATA(&rt2800usb_ops) },
-       { USB_DEVICE(0x14b2, 0x3c27), USB_DEVICE_DATA(&rt2800usb_ops) },
-@@ -2494,9 +2784,12 @@ static struct usb_device_id rt2800usb_de
-       { 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, 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) },
-+      /* Edimax */
-+      { USB_DEVICE(0x7392, 0x7711), USB_DEVICE_DATA(&rt2800usb_ops) },
-       /* EnGenius */
-       { USB_DEVICE(0X1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) },
-       { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) },
-@@ -2507,13 +2800,21 @@ static struct usb_device_id rt2800usb_de
-       { USB_DEVICE(0x0e66, 0x0003), 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) },
-       /* Philips */
-       { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) },
-       /* Planex */
-       { USB_DEVICE(0x2019, 0xed06), USB_DEVICE_DATA(&rt2800usb_ops) },
-+      { USB_DEVICE(0x2019, 0xab25), USB_DEVICE_DATA(&rt2800usb_ops) },
-       /* Ralink */
-       { 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) },
-+      /* Samsung */
-+      { USB_DEVICE(0x04e8, 0x2018), USB_DEVICE_DATA(&rt2800usb_ops) },
-       /* Siemens */
-       { USB_DEVICE(0x129b, 0x1828), USB_DEVICE_DATA(&rt2800usb_ops) },
-       /* Sitecom */
-@@ -2533,6 +2834,9 @@ static struct usb_device_id rt2800usb_de
-       /* ZCOM */
-       { USB_DEVICE(0x0cde, 0x0022), USB_DEVICE_DATA(&rt2800usb_ops) },
-       { USB_DEVICE(0x0cde, 0x0025), USB_DEVICE_DATA(&rt2800usb_ops) },
-+      /* Zinwell */
-+      { USB_DEVICE(0x5a57, 0x0280), USB_DEVICE_DATA(&rt2800usb_ops) },
-+      { USB_DEVICE(0x5a57, 0x0282), USB_DEVICE_DATA(&rt2800usb_ops) },
-       /* Zyxel */
-       { USB_DEVICE(0x0586, 0x3416), USB_DEVICE_DATA(&rt2800usb_ops) },
-       { 0, }
---- a/drivers/net/wireless/rt2x00/rt2800usb.h
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
-@@ -47,9 +47,11 @@
- /*
-  * RT2870 version
-  */
--#define RT2870_VERSION_C              0x0100
--#define RT2870_VERSION_D              0x0101
--#define RT2870_VERSION_E              0x0200
-+#define RT2860C_VERSION                       0x28600100
-+#define RT2860D_VERSION                       0x28600101
-+#define RT2880E_VERSION                       0x28720200
-+#define RT2883_VERSION                        0x28830300
-+#define RT3070_VERSION                        0x30700200
- /*
-  * Signal information.
-@@ -383,6 +385,15 @@
- #define PBF_DBG                               0x043c
- /*
-+ * RF registers
-+ */
-+#define       RF_CSR_CFG                      0x0500
-+#define RF_CSR_CFG_DATA                       FIELD32(0x000000ff)
-+#define RF_CSR_CFG_REGNUM             FIELD32(0x00001f00)
-+#define RF_CSR_CFG_WRITE              FIELD32(0x00010000)
-+#define RF_CSR_CFG_BUSY                       FIELD32(0x00020000)
-+
-+/*
-  * MAC Control/Status Registers(CSR).
-  * Some values are set in TU, whereas 1 TU == 1024 us.
-  */
-@@ -1482,6 +1493,46 @@ struct hw_key_entry {
- #define BBP3_RX_ANTENNA                       FIELD8(0x18)
- /*
-+ * BBP 4: Bandwidth
-+ */
-+#define BBP4_BANDWIDTH                        FIELD8(0x18)
-+
-+/*
-+ * RFCSR registers
-+ * The wordsize of the RFCSR is 8 bits.
-+ */
-+
-+/*
-+ * RFCSR 6:
-+ */
-+#define RFCSR6_R                      FIELD8(0x03)
-+
-+/*
-+ * RFCSR 7:
-+ */
-+#define RFCSR7_RF_TUNING              FIELD8(0x01)
-+
-+/*
-+ * RFCSR 12:
-+ */
-+#define RFCSR12_TX_POWER              FIELD8(0x1f)
-+
-+/*
-+ * RFCSR 22:
-+ */
-+#define RFCSR22_BASEBAND_LOOPBACK     FIELD8(0x01)
-+
-+/*
-+ * RFCSR 23:
-+ */
-+#define RFCSR23_FREQ_OFFSET           FIELD8(0x7f)
-+
-+/*
-+ * RFCSR 30:
-+ */
-+#define RFCSR30_RF_CALIBRATION                FIELD8(0x80)
-+
-+/*
-  * RF registers
-  */
---- a/drivers/net/wireless/rt2x00/rt2x00.h
-+++ b/drivers/net/wireless/rt2x00/rt2x00.h
-@@ -780,6 +780,12 @@ struct rt2x00_dev {
-       u8 freq_offset;
-       /*
-+       * Calibration information (for rt2800usb).
-+       */
-+      u8 calibration_bw20;
-+      u8 calibration_bw40;
-+
-+      /*
-        * Low level statistics which will have
-        * to be kept up to date while device is running.
-        */
diff --git a/package/mac80211/patches/329-rt2x00-Add-support-for-2-firmware-file-lengths-rt2.patch b/package/mac80211/patches/329-rt2x00-Add-support-for-2-firmware-file-lengths-rt2.patch
deleted file mode 100644 (file)
index b05843d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-From cac151e6e6aa50ecb5d965aa5e2840d0e69f8efa Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Thu, 22 Jan 2009 22:02:32 +0100
-Subject: [PATCH] rt2x00: Add support for 2 firmware file lengths (rt2800usb)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800usb.c |   32 +++++++++++++++++++++++++++++-
- 1 files changed, 30 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -1128,6 +1128,34 @@ static int rt2800usb_load_firmware(struc
-       unsigned int i;
-       int status;
-       u32 reg;
-+      u32 offset;
-+      u32 length;
-+      u16 chipset = (rt2x00_rev(&rt2x00dev->chip) >> 16) & 0xffff;
-+
-+      /*
-+       * Firmware files:
-+       * There are 2 variations of the rt2870 firmware.
-+       * a) size: 4kb
-+       * b) size: 8kb
-+       * Note that (b) contains 2 seperate firmware blobs of 4k
-+       * within the file. The first blob is the same firmware as (a),
-+       * but the second blob is for the additional chipsets.
-+       */
-+      if (len < 4096) {
-+              ERROR(rt2x00dev, "Unsupported firmware file (len=%zu)\n", len);
-+              return -ENOENT;
-+      }
-+
-+      if ((chipset == 0x2860) || (chipset == 0x2872) || (chipset == 0x3070)) {
-+              offset = 0;
-+              length = 4096;
-+      } else if (len == 8192) {
-+              offset = 4096;
-+              length = 4096;
-+      } else {
-+              ERROR(rt2x00dev, "Unsupported firmware file (len=%zu)\n", len);
-+              return -ENOENT;
-+      }
-       /*
-        * Wait for stable hardware.
-@@ -1150,8 +1178,8 @@ static int rt2800usb_load_firmware(struc
-       rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
-                                           USB_VENDOR_REQUEST_OUT,
-                                           FIRMWARE_IMAGE_BASE,
--                                          data, len,
--                                          REGISTER_TIMEOUT32(len));
-+                                          data + offset, length,
-+                                          REGISTER_TIMEOUT32(length));
-       rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
-       rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);