aboutsummaryrefslogtreecommitdiffstats
path: root/package/mac80211
diff options
context:
space:
mode:
Diffstat (limited to 'package/mac80211')
-rw-r--r--package/mac80211/Makefile4
-rw-r--r--package/mac80211/patches/007-remove_unused_stuff.patch10
-rw-r--r--package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch24
-rw-r--r--package/mac80211/patches/301-rt2x00-Fix-Sparse-warning.patch25
-rw-r--r--package/mac80211/patches/302-rt2x00-Don-t-free-register-information-on-suspend.patch95
-rw-r--r--package/mac80211/patches/303-rt2x00-Add-rt73usb-USB-IDs.patch21
-rw-r--r--package/mac80211/patches/304-rt2x00-Implement-support-for-802.11n.patch (renamed from package/mac80211/patches/301-rt2x00-Implement-support-for-802.11n.patch)6
-rw-r--r--package/mac80211/patches/304-rt2x00-rt2x00-Move-Move-pci_dev-specific-access-to.patch25
-rw-r--r--package/mac80211/patches/305-rt2x00-Add-rt2x00soc-bus-module.patch247
-rw-r--r--package/mac80211/patches/305-rt2x00-rt2x00-Move-Move-pci_dev-specific-access-to.patch25
-rw-r--r--package/mac80211/patches/306-rt2x00-Add-calibration-fields-to-rt2x00dev-rt2x00h.patch25
-rw-r--r--package/mac80211/patches/306-rt2x00-Fix-module-loading-in-case-of-error-rt2800p.patch32
-rw-r--r--package/mac80211/patches/307-rt2x00-Add-PM-support-for-SoC-rt2800pci.patch80
-rw-r--r--package/mac80211/patches/307-rt2x00-Implement-support-for-rt2800pci.patch (renamed from package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch)548
-rw-r--r--package/mac80211/patches/308-rt2x00-DMA-fixes-new-chipset-support-rt2800pci.patch535
-rw-r--r--package/mac80211/patches/308-rt2x00-Implement-support-for-rt2800usb.patch (renamed from package/mac80211/patches/303-rt2x00-Implement-support-for-rt2800usb.patch)37
-rw-r--r--package/mac80211/patches/309-rt2x00-Fix-compile-errors-for-SoC.patch136
-rw-r--r--package/mac80211/patches/520-b43-autodepend-on-hwrandom.patch18
18 files changed, 864 insertions, 1029 deletions
diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile
index ce24dcacb5..42f3e9a5ff 100644
--- a/package/mac80211/Makefile
+++ b/package/mac80211/Makefile
@@ -17,12 +17,12 @@ ifneq ($(CONFIG_LINUX_2_6_21)$(CONFIG_LINUX_2_6_23)$(CONFIG_LINUX_2_6_24)$(CONFI
PKG_MD5SUM:=9563ceeed86bca0859ad5f010623277c
PATCH_DIR:=./patches-old
else
- PKG_VERSION:=2009-03-24
+ PKG_VERSION:=2009-03-31
PKG_RELEASE:=1
PKG_SOURCE_URL:= \
http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/03 \
http://wireless.kernel.org/download/compat-wireless-2.6
- PKG_MD5SUM:=9e0574d123b6d6827c56a7c0042173fb
+ PKG_MD5SUM:=b5b2159081c36dd6c318a28eddf7e646
endif
PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2
diff --git a/package/mac80211/patches/007-remove_unused_stuff.patch b/package/mac80211/patches/007-remove_unused_stuff.patch
index 64be86468a..dc93a7f1d5 100644
--- a/package/mac80211/patches/007-remove_unused_stuff.patch
+++ b/package/mac80211/patches/007-remove_unused_stuff.patch
@@ -163,7 +163,7 @@
# USB Drivers
ifneq ($(CONFIG_USB),)
-@@ -249,22 +249,22 @@ CONFIG_ZD1211RW=m
+@@ -249,21 +249,21 @@ CONFIG_ZD1211RW=m
# is only wireless RNDIS chip known to date.
# Note: this depends on CONFIG_USB_NET_RNDIS_HOST and CONFIG_USB_NET_CDCETHER
# it also requires new RNDIS_HOST and CDC_ETHER modules which we add
@@ -182,19 +182,17 @@
-CONFIG_AT76C50X_USB=m
+# CONFIG_AT76C50X_USB=m
- # Activate AR9170 support only on kernel >= 2.6.28.
+ # Activate AR9170 support only on kernel >= 2.6.29.
# The needed USB poison feature was added in this kernel release.
- ifeq ($(shell test $(KERNEL_SUBLEVEL) -ge 28 && echo yes),yes)
--CONFIG_AR9170_COMMON=m
+ ifeq ($(shell test $(KERNEL_SUBLEVEL) -ge 29 && echo yes),yes)
-CONFIG_AR9170_USB=m
-CONFIG_AR9170_LEDS=y
-+# CONFIG_AR9170_COMMON=m
+# CONFIG_AR9170_USB=m
+# CONFIG_AR9170_LEDS=y
endif
# RT2500USB does not require firmware
-@@ -302,20 +302,20 @@ CONFIG_P54_COMMON=m
+@@ -301,20 +301,20 @@ CONFIG_P54_COMMON=m
# Sonics Silicon Backplane
diff --git a/package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch b/package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch
index 91f5a2ad82..6ef7637b17 100644
--- a/package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch
+++ b/package/mac80211/patches/300-rt2x00-Move-Move-pci_dev-specific-access-to-rt2x00p.patch
@@ -1,7 +1,7 @@
-From 313314263fda19db8eed94a7d7259b595634212e Mon Sep 17 00:00:00 2001
+From 9ed8a41a30916a79529552872e8d1a6175d37398 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 14 Mar 2009 20:02:51 +0100
-Subject: [PATCH] rt2x00: Move Move pci_dev specific access to rt2x00pci
+Date: Sat, 28 Mar 2009 20:30:14 +0100
+Subject: [PATCH 1/9] rt2x00: Move Move pci_dev specific access to rt2x00pci
pci_dev->irq and pci_name(pci_dev) access should be limited
to rt2x00pci only. This is more generic and allows a rt2x00 pci
@@ -16,7 +16,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
drivers/net/wireless/rt2x00/rt2x00.h | 18 ++++++++++++++++++
drivers/net/wireless/rt2x00/rt2x00pci.c | 16 ++++++++++++----
drivers/net/wireless/rt2x00/rt61pci.c | 7 +------
- 5 files changed, 33 insertions(+), 12 deletions(-)
+ drivers/net/wireless/rt2x00/rt61pci.h | 6 ------
+ 6 files changed, 33 insertions(+), 18 deletions(-)
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -148,3 +149,18 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
if (!rt2x00_rf(&rt2x00dev->chip, RF5225) &&
!rt2x00_rf(&rt2x00dev->chip, RF5325) &&
+--- a/drivers/net/wireless/rt2x00/rt61pci.h
++++ b/drivers/net/wireless/rt2x00/rt61pci.h
+@@ -63,12 +63,6 @@
+ */
+
+ /*
+- * PCI Configuration Header
+- */
+-#define PCI_CONFIG_HEADER_VENDOR 0x0000
+-#define PCI_CONFIG_HEADER_DEVICE 0x0002
+-
+-/*
+ * HOST_CMD_CSR: For HOST to interrupt embedded processor
+ */
+ #define HOST_CMD_CSR 0x0008
diff --git a/package/mac80211/patches/301-rt2x00-Fix-Sparse-warning.patch b/package/mac80211/patches/301-rt2x00-Fix-Sparse-warning.patch
new file mode 100644
index 0000000000..caac9a4090
--- /dev/null
+++ b/package/mac80211/patches/301-rt2x00-Fix-Sparse-warning.patch
@@ -0,0 +1,25 @@
+From 0a807e9fbd915d2c0cc30870403a571478a9191b Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sat, 28 Mar 2009 20:31:25 +0100
+Subject: [PATCH 2/9] rt2x00: Fix Sparse warning
+
+rt2x00link_reset_qual() is not declared in a header,
+and is only internally used within rt2x00link.c.
+It should be declared as static.
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2x00link.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2x00link.c
++++ b/drivers/net/wireless/rt2x00/rt2x00link.c
+@@ -387,7 +387,7 @@ void rt2x00link_reset_tuner(struct rt2x0
+ rt2x00link_antenna_reset(rt2x00dev);
+ }
+
+-void rt2x00link_reset_qual(struct rt2x00_dev *rt2x00dev)
++static void rt2x00link_reset_qual(struct rt2x00_dev *rt2x00dev)
+ {
+ struct link_qual *qual = &rt2x00dev->link.qual;
+
diff --git a/package/mac80211/patches/302-rt2x00-Don-t-free-register-information-on-suspend.patch b/package/mac80211/patches/302-rt2x00-Don-t-free-register-information-on-suspend.patch
new file mode 100644
index 0000000000..11ad79d08c
--- /dev/null
+++ b/package/mac80211/patches/302-rt2x00-Don-t-free-register-information-on-suspend.patch
@@ -0,0 +1,95 @@
+From 76b0fa91af8ca33cd68f52f2d02a05c488777f58 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sat, 28 Mar 2009 20:32:07 +0100
+Subject: [PATCH 3/9] rt2x00: Don't free register information on suspend
+
+After suspend & resume the rt2x00 devices won't wakeup
+anymore due to a broken register information setup.
+The most important problem is the release of the EEPROM
+buffer which is completely cleared and never read again
+after the suspend.
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2x00pci.c | 18 +-----------------
+ drivers/net/wireless/rt2x00/rt2x00usb.c | 18 +-----------------
+ 2 files changed, 2 insertions(+), 34 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
++++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
+@@ -377,8 +377,6 @@ int rt2x00pci_suspend(struct pci_dev *pc
+ if (retval)
+ return retval;
+
+- rt2x00pci_free_reg(rt2x00dev);
+-
+ pci_save_state(pci_dev);
+ pci_disable_device(pci_dev);
+ return pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
+@@ -389,7 +387,6 @@ int rt2x00pci_resume(struct pci_dev *pci
+ {
+ struct ieee80211_hw *hw = pci_get_drvdata(pci_dev);
+ struct rt2x00_dev *rt2x00dev = hw->priv;
+- int retval;
+
+ if (pci_set_power_state(pci_dev, PCI_D0) ||
+ pci_enable_device(pci_dev) ||
+@@ -398,20 +395,7 @@ int rt2x00pci_resume(struct pci_dev *pci
+ return -EIO;
+ }
+
+- retval = rt2x00pci_alloc_reg(rt2x00dev);
+- if (retval)
+- return retval;
+-
+- retval = rt2x00lib_resume(rt2x00dev);
+- if (retval)
+- goto exit_free_reg;
+-
+- return 0;
+-
+-exit_free_reg:
+- rt2x00pci_free_reg(rt2x00dev);
+-
+- return retval;
++ return rt2x00lib_resume(rt2x00dev);
+ }
+ EXPORT_SYMBOL_GPL(rt2x00pci_resume);
+ #endif /* CONFIG_PM */
+--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
++++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
+@@ -702,8 +702,6 @@ int rt2x00usb_suspend(struct usb_interfa
+ if (retval)
+ return retval;
+
+- rt2x00usb_free_reg(rt2x00dev);
+-
+ /*
+ * Decrease usbdev refcount.
+ */
+@@ -717,24 +715,10 @@ int rt2x00usb_resume(struct usb_interfac
+ {
+ struct ieee80211_hw *hw = usb_get_intfdata(usb_intf);
+ struct rt2x00_dev *rt2x00dev = hw->priv;
+- int retval;
+
+ usb_get_dev(interface_to_usbdev(usb_intf));
+
+- retval = rt2x00usb_alloc_reg(rt2x00dev);
+- if (retval)
+- return retval;
+-
+- retval = rt2x00lib_resume(rt2x00dev);
+- if (retval)
+- goto exit_free_reg;
+-
+- return 0;
+-
+-exit_free_reg:
+- rt2x00usb_free_reg(rt2x00dev);
+-
+- return retval;
++ return rt2x00lib_resume(rt2x00dev);
+ }
+ EXPORT_SYMBOL_GPL(rt2x00usb_resume);
+ #endif /* CONFIG_PM */
diff --git a/package/mac80211/patches/303-rt2x00-Add-rt73usb-USB-IDs.patch b/package/mac80211/patches/303-rt2x00-Add-rt73usb-USB-IDs.patch
new file mode 100644
index 0000000000..7b66c6c258
--- /dev/null
+++ b/package/mac80211/patches/303-rt2x00-Add-rt73usb-USB-IDs.patch
@@ -0,0 +1,21 @@
+From b587a44d6cf038cac3ce194c49196f501fa4bb48 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sat, 28 Mar 2009 20:32:50 +0100
+Subject: [PATCH 4/9] rt2x00: Add rt73usb USB IDs
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt73usb.c | 2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt73usb.c
++++ b/drivers/net/wireless/rt2x00/rt73usb.c
+@@ -2369,6 +2369,8 @@ static struct usb_device_id rt73usb_devi
+ /* Buffalo */
+ { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) },
+ { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) },
++ { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) },
++ { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) },
+ /* CNet */
+ { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) },
+ { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) },
diff --git a/package/mac80211/patches/301-rt2x00-Implement-support-for-802.11n.patch b/package/mac80211/patches/304-rt2x00-Implement-support-for-802.11n.patch
index 6106789c3f..b1b75751bf 100644
--- a/package/mac80211/patches/301-rt2x00-Implement-support-for-802.11n.patch
+++ b/package/mac80211/patches/304-rt2x00-Implement-support-for-802.11n.patch
@@ -1,7 +1,7 @@
-From 827327792c4b0d4d4909ec27bd56cb3ba8f2b754 Mon Sep 17 00:00:00 2001
+From 0f4396e5a4351ccd48256407b4a606d6c33a94cb Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 14 Mar 2009 20:06:48 +0100
-Subject: [PATCH] rt2x00: Implement support for 802.11n
+Date: Sat, 28 Mar 2009 20:37:26 +0100
+Subject: [PATCH 5/9] rt2x00: Implement support for 802.11n
Extend rt2x00lib capabilities to support 802.11n,
it still lacks aggregation support, but that can
diff --git a/package/mac80211/patches/304-rt2x00-rt2x00-Move-Move-pci_dev-specific-access-to.patch b/package/mac80211/patches/304-rt2x00-rt2x00-Move-Move-pci_dev-specific-access-to.patch
deleted file mode 100644
index 2bd4eb295b..0000000000
--- a/package/mac80211/patches/304-rt2x00-rt2x00-Move-Move-pci_dev-specific-access-to.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 6bdf6a86854bdeab9557f0ce25c3f5401c18f629 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 14 Mar 2009 20:57:27 +0100
-Subject: [PATCH] rt2x00: rt2x00: Move Move pci_dev specific access to rt2x00pci - part 2
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt61pci.h | 6 ------
- 1 files changed, 0 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt61pci.h
-+++ b/drivers/net/wireless/rt2x00/rt61pci.h
-@@ -63,12 +63,6 @@
- */
-
- /*
-- * PCI Configuration Header
-- */
--#define PCI_CONFIG_HEADER_VENDOR 0x0000
--#define PCI_CONFIG_HEADER_DEVICE 0x0002
--
--/*
- * HOST_CMD_CSR: For HOST to interrupt embedded processor
- */
- #define HOST_CMD_CSR 0x0008
diff --git a/package/mac80211/patches/305-rt2x00-Add-rt2x00soc-bus-module.patch b/package/mac80211/patches/305-rt2x00-Add-rt2x00soc-bus-module.patch
new file mode 100644
index 0000000000..b09b0d6392
--- /dev/null
+++ b/package/mac80211/patches/305-rt2x00-Add-rt2x00soc-bus-module.patch
@@ -0,0 +1,247 @@
+From 18b2be31a35dc8bd216e60e3c9d8d8e7b2179aed Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sat, 28 Mar 2009 20:38:40 +0100
+Subject: [PATCH 6/9] rt2x00: Add rt2x00soc bus module
+
+Add new library module for SoC drivers.
+This is needed to fully support the platform
+driver part of rt2800pci.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/Kconfig | 4 +
+ drivers/net/wireless/rt2x00/Makefile | 1 +
+ drivers/net/wireless/rt2x00/rt2x00soc.c | 159 +++++++++++++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2x00soc.h | 52 ++++++++++
+ 4 files changed, 216 insertions(+), 0 deletions(-)
+ create mode 100644 drivers/net/wireless/rt2x00/rt2x00soc.c
+ create mode 100644 drivers/net/wireless/rt2x00/rt2x00soc.h
+
+--- a/drivers/net/wireless/rt2x00/Makefile
++++ b/drivers/net/wireless/rt2x00/Makefile
+@@ -12,6 +12,7 @@ rt2x00lib-$(CONFIG_RT2X00_LIB_HT) += rt2
+
+ obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o
+ obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o
++obj-$(CONFIG_RT2X00_LIB_SOC) += rt2x00soc.o
+ obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00usb.o
+ obj-$(CONFIG_RT2400PCI) += rt2400pci.o
+ obj-$(CONFIG_RT2500PCI) += rt2500pci.o
+--- /dev/null
++++ b/drivers/net/wireless/rt2x00/rt2x00soc.c
+@@ -0,0 +1,159 @@
++/*
++ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
++ <http://rt2x00.serialmonkey.com>
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the
++ Free Software Foundation, Inc.,
++ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++ */
++
++/*
++ Module: rt2x00soc
++ Abstract: rt2x00 generic soc device routines.
++ */
++
++#include <linux/bug.h>
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/platform_device.h>
++
++#include "rt2x00.h"
++#include "rt2x00soc.h"
++
++static void rt2x00soc_free_reg(struct rt2x00_dev *rt2x00dev)
++{
++ kfree(rt2x00dev->rf);
++ rt2x00dev->rf = NULL;
++
++ kfree(rt2x00dev->eeprom);
++ rt2x00dev->eeprom = NULL;
++}
++
++static int rt2x00soc_alloc_reg(struct rt2x00_dev *rt2x00dev)
++{
++ struct platform_device *pdev = to_platform_device(rt2x00dev->dev);
++ struct resource *res;
++
++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++ if (!res)
++ return -ENODEV;
++
++ rt2x00dev->csr.base = (void __iomem *)KSEG1ADDR(res->start);
++ if (!rt2x00dev->csr.base)
++ goto exit;
++
++ rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL);
++ if (!rt2x00dev->eeprom)
++ goto exit;
++
++ rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL);
++ if (!rt2x00dev->rf)
++ goto exit;
++
++ return 0;
++
++exit:
++ ERROR_PROBE("Failed to allocate registers.\n");
++ rt2x00soc_free_reg(rt2x00dev);
++
++ return -ENOMEM;
++}
++
++int rt2x00soc_probe(struct platform_device *pdev,
++ const unsigned short chipset,
++ const struct rt2x00_ops *ops)
++{
++ struct ieee80211_hw *hw;
++ struct rt2x00_dev *rt2x00dev;
++ int retval;
++
++ hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
++ if (!hw) {
++ ERROR_PROBE("Failed to allocate hardware.\n");
++ return -ENOMEM;
++ }
++
++ platform_set_drvdata(pdev, hw);
++
++ rt2x00dev = hw->priv;
++ rt2x00dev->dev = &pdev->dev;
++ rt2x00dev->ops = ops;
++ rt2x00dev->hw = hw;
++ rt2x00dev->irq = platform_get_irq(pdev, 0);
++ rt2x00dev->name = pdev->dev.driver->name;
++
++ rt2x00_set_chip_rt(rt2x00dev, chipset);
++
++ retval = rt2x00soc_alloc_reg(rt2x00dev);
++ if (retval)
++ goto exit_free_device;
++
++ retval = rt2x00lib_probe_dev(rt2x00dev);
++ if (retval)
++ goto exit_free_reg;
++
++ return 0;
++
++exit_free_reg:
++ rt2x00soc_free_reg(rt2x00dev);
++
++exit_free_device:
++ ieee80211_free_hw(hw);
++
++ return retval;
++}
++
++int rt2x00soc_remove(struct platform_device *pdev)
++{
++ struct ieee80211_hw *hw = platform_get_drvdata(pdev);
++ struct rt2x00_dev *rt2x00dev = hw->priv;
++
++ /*
++ * Free all allocated data.
++ */
++ rt2x00lib_remove_dev(rt2x00dev);
++ rt2x00soc_free_reg(rt2x00dev);
++ ieee80211_free_hw(hw);
++
++ return 0;
++}
++EXPORT_SYMBOL_GPL(rt2x00soc_remove);
++
++#ifdef CONFIG_PM
++int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state)
++{
++ struct ieee80211_hw *hw = platform_get_drvdata(pdev);
++ struct rt2x00_dev *rt2x00dev = hw->priv;
++
++ return rt2x00lib_suspend(rt2x00dev, state);
++}
++EXPORT_SYMBOL_GPL(rt2x00soc_suspend);
++
++int rt2x00soc_resume(struct platform_device *pdev)
++{
++ struct ieee80211_hw *hw = platform_get_drvdata(pdev);
++ struct rt2x00_dev *rt2x00dev = hw->priv;
++
++ return rt2x00lib_resume(rt2x00dev);
++}
++EXPORT_SYMBOL_GPL(rt2x00soc_resume);
++#endif /* CONFIG_PM */
++
++/*
++ * rt2x00soc module information.
++ */
++MODULE_AUTHOR(DRV_PROJECT);
++MODULE_VERSION(DRV_VERSION);
++MODULE_DESCRIPTION("rt2x00 soc library");
++MODULE_LICENSE("GPL");
+--- /dev/null
++++ b/drivers/net/wireless/rt2x00/rt2x00soc.h
+@@ -0,0 +1,52 @@
++/*
++ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
++ <http://rt2x00.serialmonkey.com>
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the
++ Free Software Foundation, Inc.,
++ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++ */
++
++/*
++ Module: rt2x00soc
++ Abstract: Data structures for the rt2x00soc module.
++ */
++
++#ifndef RT2X00SOC_H
++#define RT2X00SOC_H
++
++#define KSEG1ADDR(__ptr) __ptr
++
++#define __rt2x00soc_probe(__chipset, __ops) \
++static int __rt2x00soc_probe(struct platform_device *pdev) \
++{ \
++ return rt2x00soc_probe(pdev, (__chipset), (__ops)); \
++}
++
++/*
++ * SoC driver handlers.
++ */
++int rt2x00soc_probe(struct platform_device *pdev,
++ const unsigned short chipset,
++ const struct rt2x00_ops *ops);
++int rt2x00soc_remove(struct platform_device *pdev);
++#ifdef CONFIG_PM
++int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state);
++int rt2x00soc_resume(struct platform_device *pdev);
++#else
++#define rt2x00soc_suspend NULL
++#define rt2x00soc_resume NULL
++#endif /* CONFIG_PM */
++
++#endif /* RT2X00SOC_H */
diff --git a/package/mac80211/patches/305-rt2x00-rt2x00-Move-Move-pci_dev-specific-access-to.patch b/package/mac80211/patches/305-rt2x00-rt2x00-Move-Move-pci_dev-specific-access-to.patch
deleted file mode 100644
index 783a6d609e..0000000000
--- a/package/mac80211/patches/305-rt2x00-rt2x00-Move-Move-pci_dev-specific-access-to.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From a3334c89fbed644bb12ee27e2d9c1dc70b1512ab Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 14 Mar 2009 20:58:12 +0100
-Subject: [PATCH] rt2x00: rt2x00: Move Move pci_dev specific access to rt2x00pci - part 2 (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.h | 6 ------
- 1 files changed, 0 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.h
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -83,12 +83,6 @@
- */
-
- /*
-- * PCI Configuration Header
-- */
--#define PCI_CONFIG_HEADER_VENDOR 0x0000
--#define PCI_CONFIG_HEADER_DEVICE 0x0002
--
--/*
- * E2PROM_CSR: EEPROM control register.
- * RELOAD: Write 1 to reload eeprom content.
- * TYPE: 0: 93c46, 1:93c66.
diff --git a/package/mac80211/patches/306-rt2x00-Add-calibration-fields-to-rt2x00dev-rt2x00h.patch b/package/mac80211/patches/306-rt2x00-Add-calibration-fields-to-rt2x00dev-rt2x00h.patch
new file mode 100644
index 0000000000..533c96c9c6
--- /dev/null
+++ b/package/mac80211/patches/306-rt2x00-Add-calibration-fields-to-rt2x00dev-rt2x00h.patch
@@ -0,0 +1,25 @@
+From 7f759a5e56f64fed24e5eb487003ce455786bc31 Mon Sep 17 00:00:00 2001
+From: Ivo van Doorn <IvDoorn@gmail.com>
+Date: Sat, 28 Mar 2009 20:44:18 +0100
+Subject: [PATCH 7/9] rt2x00: Add calibration fields to rt2x00dev (rt2x00ht)
+
+Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+---
+ drivers/net/wireless/rt2x00/rt2x00.h | 6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2x00.h
++++ b/drivers/net/wireless/rt2x00/rt2x00.h
+@@ -782,6 +782,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/306-rt2x00-Fix-module-loading-in-case-of-error-rt2800p.patch b/package/mac80211/patches/306-rt2x00-Fix-module-loading-in-case-of-error-rt2800p.patch
deleted file mode 100644
index 4f832939c9..0000000000
--- a/package/mac80211/patches/306-rt2x00-Fix-module-loading-in-case-of-error-rt2800p.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 14f870b27b836acee5f04809287175016ca16b05 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sun, 15 Mar 2009 15:13:58 +0100
-Subject: [PATCH] rt2x00: Fix module loading in case of error (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c | 9 +++++++++
- 1 files changed, 9 insertions(+), 0 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -3014,10 +3014,19 @@ static int __init rt2800pci_init(void)
-
- #ifdef CONFIG_RT2800PCI_WISOC
- ret = platform_driver_register(&rt2800soc_driver);
-+ if (ret)
-+ return ret;
- #endif
- #ifdef CONFIG_RT2800PCI_PCI
- ret = pci_register_driver(&rt2800pci_driver);
-+ if (ret) {
-+#ifdef CONFIG_RT2800PCI_WISOC
-+ platform_driver_unregister(&rt2800soc_driver);
-+#endif
-+ return ret;
-+ }
- #endif
-+
- return ret;
- }
-
diff --git a/package/mac80211/patches/307-rt2x00-Add-PM-support-for-SoC-rt2800pci.patch b/package/mac80211/patches/307-rt2x00-Add-PM-support-for-SoC-rt2800pci.patch
deleted file mode 100644
index d08e5fecfd..0000000000
--- a/package/mac80211/patches/307-rt2x00-Add-PM-support-for-SoC-rt2800pci.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From aef81259a944186a120d51e4462a5f974de99fb8 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sun, 15 Mar 2009 15:37:29 +0100
-Subject: [PATCH] rt2x00: Add PM support for SoC (rt2800pci)
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c | 52 +++++++++++++++++++++++++++++--
- 1 files changed, 49 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -2934,7 +2934,7 @@ exit:
-
- static int rt2800soc_probe(struct platform_device *pdev)
- {
-- const struct rt2x00_ops *ops = &rt2800pci_ops;
-+ struct rt2x00_ops *ops = (struct rt2x00_ops *)pdev->driver->p;
- struct ieee80211_hw *hw;
- struct rt2x00_dev *rt2x00dev;
- int retval;
-@@ -2990,10 +2990,56 @@ static int rt2800soc_remove(struct platf
- return 0;
- }
-
-+#ifdef CONFIG_PM
-+int rt2x00soc_suspend(struct device *dev, pm_message_t state)
-+{
-+ struct ieee80211_hw *hw = dev_get_drvdata(dev);
-+ struct rt2x00_dev *rt2x00dev = hw->priv;
-+ int retval;
-+
-+ retval = rt2x00lib_suspend(rt2x00dev, state);
-+ if (retval)
-+ return retval;
-+
-+ rt2800soc_free_reg(rt2x00dev);
-+
-+ return 0;
-+}
-+
-+int rt2x00soc_resume(struct device *dev)
-+{
-+ struct ieee80211_hw *hw = dev_get_drvdata(dev);
-+ struct rt2x00_dev *rt2x00dev = hw->priv;
-+ int retval;
-+
-+ retval = rt2x00soc_alloc_reg(rt2x00dev);
-+ if (retval)
-+ return retval;
-+
-+ retval = rt2x00lib_resume(rt2x00dev);
-+ if (retval)
-+ goto exit_free_reg;
-+
-+ return 0;
-+
-+exit_free_reg:
-+ rt2x00pci_free_reg(rt2x00dev);
-+
-+ return retval;
-+}
-+#endif /* CONFIG_PM */
-+
- static struct platform_driver rt2800soc_driver = {
-- .driver.name = "rt2800_wmac",
-+ .driver = {
-+ .name = "rt2800_wmac",
-+ .owner = THIS_MODULE,
-+ .mod_name = KBUILD_MODNAME,
-+ .p = &rt2800pci_ops;
-+ }
- .probe = rt2800soc_probe,
-- .remove = rt2800soc_remove,
-+ .remove = __devexit_p(rt2800soc_remove),
-+ .suspend = rt2x00soc_suspend,
-+ .resume = rt2x00soc_resume,
- };
- #endif /* CONFIG_RT2800PCI_WISOC */
-
diff --git a/package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch b/package/mac80211/patches/307-rt2x00-Implement-support-for-rt2800pci.patch
index 9cd2289e06..6b66d85236 100644
--- a/package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch
+++ b/package/mac80211/patches/307-rt2x00-Implement-support-for-rt2800pci.patch
@@ -1,7 +1,7 @@
-From a34c288f7214637f214ec17fb2b35dd5d20b0634 Mon Sep 17 00:00:00 2001
+From b7dcb460c4c441ce52b3c5ce30d65e1ecfbb30ad Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 14 Mar 2009 20:41:58 +0100
-Subject: [PATCH] rt2x00: Implement support for rt2800pci
+Date: Sat, 28 Mar 2009 20:46:46 +0100
+Subject: [PATCH 8/9] rt2x00: Implement support for rt2800pci
Add support for the rt2800pci chipset.
@@ -13,18 +13,18 @@ Signed-off-by: Mark Asselstine <asselsm@gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
- drivers/net/wireless/rt2x00/Kconfig | 15 +
+ drivers/net/wireless/rt2x00/Kconfig | 26 +
drivers/net/wireless/rt2x00/Makefile | 1 +
- drivers/net/wireless/rt2x00/rt2800pci.c | 3035 +++++++++++++++++++++++++++++++
- drivers/net/wireless/rt2x00/rt2800pci.h | 1880 +++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800pci.c | 3244 +++++++++++++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800pci.h | 1927 ++++++++++++++++++
drivers/net/wireless/rt2x00/rt2x00.h | 6 +
- 5 files changed, 4937 insertions(+), 0 deletions(-)
+ 5 files changed, 5204 insertions(+), 0 deletions(-)
create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.c
create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.h
--- a/drivers/net/wireless/rt2x00/Makefile
+++ b/drivers/net/wireless/rt2x00/Makefile
-@@ -16,5 +16,6 @@ obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00u
+@@ -17,5 +17,6 @@ obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00u
obj-$(CONFIG_RT2400PCI) += rt2400pci.o
obj-$(CONFIG_RT2500PCI) += rt2500pci.o
obj-$(CONFIG_RT61PCI) += rt61pci.o
@@ -33,7 +33,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
obj-$(CONFIG_RT73USB) += rt73usb.o
--- /dev/null
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -0,0 +1,3035 @@
+@@ -0,0 +1,3244 @@
+/*
+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
+ <http://rt2x00.serialmonkey.com>
@@ -72,13 +72,14 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+#include "rt2x00.h"
+#include "rt2x00pci.h"
++#include "rt2x00soc.h"
+#include "rt2800pci.h"
+
-+/* FIXME: Make Kconfig dependent */
-+#ifdef CONFIG_PCI
++#ifdef CONFIG_RT2800PCI_PCI_MODULE
+#define CONFIG_RT2800PCI_PCI
+#endif
-+#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X)
++
++#ifdef CONFIG_RT2800PCI_WISOC_MODULE
+#define CONFIG_RT2800PCI_WISOC
+#endif
+
@@ -102,6 +103,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ */
+#define WAIT_FOR_BBP(__dev, __reg) \
+ rt2x00pci_regbusy_read((__dev), BBP_CSR_CFG, BBP_CSR_CFG_BUSY, (__reg))
++#define WAIT_FOR_RFCSR(__dev, __reg) \
++ rt2x00pci_regbusy_read((__dev), RF_CSR_CFG, RF_CSR_CFG_BUSY, (__reg))
+#define WAIT_FOR_RF(__dev, __reg) \
+ rt2x00pci_regbusy_read((__dev), RF_CSR_CFG0, RF_CSR_CFG0_BUSY, (__reg))
+#define WAIT_FOR_MCU(__dev, __reg) \
@@ -165,6 +168,61 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ mutex_unlock(&rt2x00dev->csr_mutex);
+}
+
++static void rt2800pci_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);
++
++ rt2x00pci_register_write(rt2x00dev, RF_CSR_CFG, reg);
++ }
++
++ mutex_unlock(&rt2x00dev->csr_mutex);
++}
++
++static void rt2800pci_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);
++
++ rt2x00pci_register_write(rt2x00dev, RF_CSR_CFG, reg);
++
++ WAIT_FOR_RFCSR(rt2x00dev, &reg);
++ }
++
++ *value = rt2x00_get_field32(reg, RF_CSR_CFG_DATA);
++
++ mutex_unlock(&rt2x00dev->csr_mutex);
++}
++
+static void rt2800pci_rf_write(struct rt2x00_dev *rt2x00dev,
+ const unsigned int word, const u32 value)
+{
@@ -196,6 +254,13 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+{
+ u32 reg;
+
++ /*
++ * RT2880 and RT3052 don't support MCU requests.
++ */
++ if (rt2x00_rt(&rt2x00dev->chip, RT2880) ||
++ rt2x00_rt(&rt2x00dev->chip, RT3052))
++ return;
++
+ mutex_lock(&rt2x00dev->csr_mutex);
+
+ /*
@@ -765,13 +830,11 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00dev->lna_gain = lna_gain;
+}
+
-+static void rt2800pci_config_channel(struct rt2x00_dev *rt2x00dev,
-+ struct ieee80211_conf *conf,
-+ struct rf_channel *rf,
-+ struct channel_info *info)
++static void rt2800pci_config_channel_rt2x(struct rt2x00_dev *rt2x00dev,
++ struct ieee80211_conf *conf,
++ struct rf_channel *rf,
++ struct channel_info *info)
+{
-+ u32 reg;
-+ unsigned int tx_pin;
+ u16 eeprom;
+
+ rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset);
@@ -781,9 +844,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ */
+ 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);
-+ }
+
+ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) == 1) {
+ rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX1, 1);
@@ -842,6 +904,62 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2800pci_rf_write(rt2x00dev, 2, rf->rf2);
+ rt2800pci_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004);
+ rt2800pci_rf_write(rt2x00dev, 4, rf->rf4);
++}
++
++static void rt2800pci_config_channel_rt3x(struct rt2x00_dev *rt2x00dev,
++ struct ieee80211_conf *conf,
++ struct rf_channel *rf,
++ struct channel_info *info)
++{
++ u8 rfcsr;
++
++ rt2800pci_rfcsr_write(rt2x00dev, 2, rf->rf1);
++ rt2800pci_rfcsr_write(rt2x00dev, 2, rf->rf3);
++
++ rt2800pci_rfcsr_read(rt2x00dev, 6, &rfcsr);
++ rt2x00_set_field8(&rfcsr, RFCSR6_R, rf->rf2);
++ rt2800pci_rfcsr_write(rt2x00dev, 6, rfcsr);
++
++ rt2800pci_rfcsr_read(rt2x00dev, 12, &rfcsr);
++ rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER,
++ TXPOWER_G_TO_DEV(info->tx_power1));
++ rt2800pci_rfcsr_write(rt2x00dev, 12, rfcsr);
++
++ rt2800pci_rfcsr_read(rt2x00dev, 23, &rfcsr);
++ rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
++ rt2800pci_rfcsr_write(rt2x00dev, 23, rfcsr);
++
++ if (conf_is_ht40(conf))
++ rt2800pci_rfcsr_write(rt2x00dev, 24,
++ rt2x00dev->calibration_bw40);
++ else
++ rt2800pci_rfcsr_write(rt2x00dev, 24,
++ rt2x00dev->calibration_bw20);
++
++ rt2800pci_rfcsr_read(rt2x00dev, 23, &rfcsr);
++ rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1);
++ rt2800pci_rfcsr_write(rt2x00dev, 23, rfcsr);
++}
++
++static void rt2800pci_config_channel(struct rt2x00_dev *rt2x00dev,
++ struct ieee80211_conf *conf,
++ struct rf_channel *rf,
++ struct channel_info *info)
++{
++ u32 reg;
++ unsigned int tx_pin;
++ u16 eeprom;
++ u8 bbp;
++
++ /*
++ * Determine antenna settings from EEPROM
++ */
++ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
++
++ if (rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION)
++ rt2800pci_config_channel_rt2x(rt2x00dev, conf, rf, info);
++ else
++ rt2800pci_config_channel_rt3x(rt2x00dev, conf, rf, info);
+
+ /*
+ * Change BBP settings
@@ -897,6 +1015,26 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+ rt2x00pci_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
+
++ rt2800pci_bbp_read(rt2x00dev, 4, &bbp);
++ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
++ rt2800pci_bbp_write(rt2x00dev, 4, bbp);
++
++ rt2800pci_bbp_read(rt2x00dev, 3, &bbp);
++ rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf));
++ rt2800pci_bbp_write(rt2x00dev, 3, bbp);
++
++ if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
++ if (conf_is_ht40(conf)) {
++ rt2800pci_bbp_write(rt2x00dev, 69, 0x1a);
++ rt2800pci_bbp_write(rt2x00dev, 70, 0x0a);
++ rt2800pci_bbp_write(rt2x00dev, 73, 0x16);
++ } else {
++ rt2800pci_bbp_write(rt2x00dev, 69, 0x16);
++ rt2800pci_bbp_write(rt2x00dev, 70, 0x08);
++ rt2800pci_bbp_write(rt2x00dev, 73, 0x11);
++ }
++ }
++
+ msleep(1);
+}
+
@@ -1301,7 +1439,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ entry_priv = rt2x00dev->rx->entries[0].priv_data;
+ rt2x00pci_register_write(rt2x00dev, RX_BASE_PTR, entry_priv->desc_dma);
+ rt2x00pci_register_write(rt2x00dev, RX_MAX_CNT, rt2x00dev->rx[0].limit);
-+ rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX, 0);
++ rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX, rt2x00dev->rx[0].limit - 1);
+ rt2x00pci_register_write(rt2x00dev, RX_DRX_IDX, 0);
+
+ /*
@@ -1659,6 +1797,12 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION)
+ rt2800pci_bbp_write(rt2x00dev, 84, 0x19);
+
++ if (rt2x00_rt(&rt2x00dev->chip, RT3052)) {
++ rt2800pci_bbp_write(rt2x00dev, 31, 0x08);
++ rt2800pci_bbp_write(rt2x00dev, 78, 0x0e);
++ rt2800pci_bbp_write(rt2x00dev, 80, 0x08);
++ }
++
+ for (i = 0; i < EEPROM_BBP_SIZE; i++) {
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom);
+
@@ -1672,6 +1816,144 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ return 0;
+}
+
++static u8 rt2800pci_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;
++
++ rt2800pci_rfcsr_write(rt2x00dev, 24, rfcsr24);
++
++ rt2800pci_bbp_read(rt2x00dev, 4, &bbp);
++ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * bw40);
++ rt2800pci_bbp_write(rt2x00dev, 4, bbp);
++
++ rt2800pci_rfcsr_read(rt2x00dev, 22, &rfcsr);
++ rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 1);
++ rt2800pci_rfcsr_write(rt2x00dev, 22, rfcsr);
++
++ /*
++ * Set power & frequency of passband test tone
++ */
++ rt2800pci_bbp_write(rt2x00dev, 24, 0);
++
++ for (i = 0; i < 100; i++) {
++ rt2800pci_bbp_write(rt2x00dev, 25, 0x90);
++ msleep(1);
++
++ rt2800pci_bbp_read(rt2x00dev, 55, &passband);
++ if (passband)
++ break;
++ }
++
++ /*
++ * Set power & frequency of stopband test tone
++ */
++ rt2800pci_bbp_write(rt2x00dev, 24, 0x06);
++
++ for (i = 0; i < 100; i++) {
++ rt2800pci_bbp_write(rt2x00dev, 25, 0x90);
++ msleep(1);
++
++ rt2800pci_bbp_read(rt2x00dev, 55, &stopband);
++
++ if ((passband - stopband) <= filter_target) {
++ rfcsr24++;
++ overtuned += ((passband - stopband) == filter_target);
++ } else
++ break;
++
++ rt2800pci_rfcsr_write(rt2x00dev, 24, rfcsr24);
++ }
++
++ rfcsr24 -= !!overtuned;
++
++ rt2800pci_rfcsr_write(rt2x00dev, 24, rfcsr24);
++ return rfcsr24;
++}
++
++static int rt2800pci_init_rfcsr(struct rt2x00_dev *rt2x00dev)
++{
++ u8 rfcsr;
++ u8 bbp;
++
++ if (!rt2x00_rf(&rt2x00dev->chip, RF3020) &&
++ !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
++ !rt2x00_rf(&rt2x00dev->chip, RF3022))
++ return 0;
++
++ /*
++ * Init RF calibration.
++ */
++ rt2800pci_rfcsr_read(rt2x00dev, 30, &rfcsr);
++ rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1);
++ rt2800pci_rfcsr_write(rt2x00dev, 30, rfcsr);
++ msleep(1);
++ rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
++ rt2800pci_rfcsr_write(rt2x00dev, 30, rfcsr);
++
++ rt2800pci_rfcsr_write(rt2x00dev, 0, 0x50);
++ rt2800pci_rfcsr_write(rt2x00dev, 1, 0x01);
++ rt2800pci_rfcsr_write(rt2x00dev, 2, 0xf7);
++ rt2800pci_rfcsr_write(rt2x00dev, 3, 0x75);
++ rt2800pci_rfcsr_write(rt2x00dev, 4, 0x40);
++ rt2800pci_rfcsr_write(rt2x00dev, 5, 0x03);
++ rt2800pci_rfcsr_write(rt2x00dev, 6, 0x02);
++ rt2800pci_rfcsr_write(rt2x00dev, 7, 0x50);
++ rt2800pci_rfcsr_write(rt2x00dev, 8, 0x39);
++ rt2800pci_rfcsr_write(rt2x00dev, 9, 0x0f);
++ rt2800pci_rfcsr_write(rt2x00dev, 10, 0x60);
++ rt2800pci_rfcsr_write(rt2x00dev, 11, 0x21);
++ rt2800pci_rfcsr_write(rt2x00dev, 12, 0x75);
++ rt2800pci_rfcsr_write(rt2x00dev, 13, 0x75);
++ rt2800pci_rfcsr_write(rt2x00dev, 14, 0x90);
++ rt2800pci_rfcsr_write(rt2x00dev, 15, 0x58);
++ rt2800pci_rfcsr_write(rt2x00dev, 16, 0xb3);
++ rt2800pci_rfcsr_write(rt2x00dev, 17, 0x92);
++ rt2800pci_rfcsr_write(rt2x00dev, 18, 0x2c);
++ rt2800pci_rfcsr_write(rt2x00dev, 19, 0x02);
++ rt2800pci_rfcsr_write(rt2x00dev, 20, 0xba);
++ rt2800pci_rfcsr_write(rt2x00dev, 21, 0xdb);
++ rt2800pci_rfcsr_write(rt2x00dev, 22, 0x00);
++ rt2800pci_rfcsr_write(rt2x00dev, 23, 0x31);
++ rt2800pci_rfcsr_write(rt2x00dev, 24, 0x08);
++ rt2800pci_rfcsr_write(rt2x00dev, 25, 0x01);
++ rt2800pci_rfcsr_write(rt2x00dev, 26, 0x25);
++ rt2800pci_rfcsr_write(rt2x00dev, 27, 0x23);
++ rt2800pci_rfcsr_write(rt2x00dev, 28, 0x13);
++ rt2800pci_rfcsr_write(rt2x00dev, 29, 0x83);
++
++ /*
++ * Set RX Filter calibration for 20MHz and 40MHz
++ */
++ rt2x00dev->calibration_bw20 =
++ rt2800pci_init_rx_filter(rt2x00dev, false, 0x07, 0x16);
++ rt2x00dev->calibration_bw40 =
++ rt2800pci_init_rx_filter(rt2x00dev, true, 0x27, 0x19);
++
++ /*
++ * Set back to initial state
++ */
++ rt2800pci_bbp_write(rt2x00dev, 24, 0);
++
++ rt2800pci_rfcsr_read(rt2x00dev, 22, &rfcsr);
++ rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0);
++ rt2800pci_rfcsr_write(rt2x00dev, 22, rfcsr);
++
++ /*
++ * set BBP back to BW20
++ */
++ rt2800pci_bbp_read(rt2x00dev, 4, &bbp);
++ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0);
++ rt2800pci_bbp_write(rt2x00dev, 4, bbp);
++
++ return 0;
++}
++
+/*
+ * Device state switch handlers.
+ */
@@ -1754,7 +2036,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2800pci_init_queues(rt2x00dev) ||
+ rt2800pci_init_registers(rt2x00dev) ||
+ rt2800pci_wait_wpdma_ready(rt2x00dev) ||
-+ rt2800pci_init_bbp(rt2x00dev)))
++ rt2800pci_init_bbp(rt2x00dev) ||
++ rt2800pci_init_rfcsr(rt2x00dev)))
+ return -EIO;
+
+ /*
@@ -2150,6 +2433,12 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
+
+ /*
++ * Set RX IDX in register to inform hardware that we have handled
++ * this entry and it is available for reuse again.
++ */
++ rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx);
++
++ /*
+ * Remove TXWI descriptor from start of buffer.
+ */
+ skb_pull(entry->skb, RXWI_DESC_SIZE);
@@ -2416,7 +2705,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
+ !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
-+ !rt2x00_rf(&rt2x00dev->chip, RF3052)) {
++ !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
++ !rt2x00_rf(&rt2x00dev->chip, RF3022)) {
+ ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
+ return -ENODEV;
+ }
@@ -2496,8 +2786,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ /* 802.11 HyperLan 2 */
+ { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
+ { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
-+ { 104, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed1a3 },
-+ { 108, 0x18402ecc, 0x184c0a32, 0x18578a55, 0x180ed193 },
++ { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
++ { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
+ { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
+ { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
+ { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
@@ -2564,7 +2854,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+ if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
+ rt2x00_rf(&rt2x00dev->chip, RF2720) ||
-+ rt2x00_rf(&rt2x00dev->chip, RF3052)) {
++ rt2x00_rf(&rt2x00dev->chip, RF3021) ||
++ rt2x00_rf(&rt2x00dev->chip, RF3022)) {
+ spec->num_channels = 14;
+ spec->channels = rf_vals;
+ } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
@@ -2660,7 +2951,9 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ /*
+ * This device requires firmware.
+ */
-+ __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
++ if (!rt2x00_rt(&rt2x00dev->chip, RT2880) &&
++ !rt2x00_rt(&rt2x00dev->chip, RT3052))
++ __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
+ if (!modparam_nohwcrypt)
+ __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
+
@@ -2898,7 +3191,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+/*
+ * RT2800pci module information.
+ */
-+#ifdef CONFIG_RT2800PCI_PCI
+static struct pci_device_id rt2800pci_device_table[] = {
+ { PCI_DEVICE(0x1814, 0x0601), PCI_DEVICE_DATA(&rt2800pci_ops) },
+ { PCI_DEVICE(0x1814, 0x0681), PCI_DEVICE_DATA(&rt2800pci_ops) },
@@ -2910,126 +3202,34 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ { PCI_DEVICE(0x1a3b, 0x1059), PCI_DEVICE_DATA(&rt2800pci_ops) },
+ { 0, }
+};
-+MODULE_DEVICE_TABLE(pci, rt2800pci_device_table);
-+#endif /* CONFIG_RT2800PCI_PCI */
+
+MODULE_AUTHOR(DRV_PROJECT);
+MODULE_VERSION(DRV_VERSION);
+MODULE_DESCRIPTION("Ralink RT2800 PCI & PCMCIA Wireless LAN driver.");
+MODULE_SUPPORTED_DEVICE("Ralink RT2860 PCI & PCMCIA chipset based cards");
++#ifdef CONFIG_RT2800PCI_PCI
+MODULE_FIRMWARE(FIRMWARE_RT2860);
++MODULE_DEVICE_TABLE(pci, rt2800pci_device_table);
++#endif /* CONFIG_RT2800PCI_PCI */
+MODULE_LICENSE("GPL");
+
+#ifdef CONFIG_RT2800PCI_WISOC
-+
-+#ifdef CONFIG_RALINK_RT288X
-+#define WSOC_RT_CHIPSET RT2880
-+#endif /* CONFIG_RALINK_RT288X */
-+
-+#ifdef CONFIG_RALINK_RT305X
-+#define WSOC_RT_CHIPSET RT3052
-+#endif /* CONFIG_RALINK_RT305X */
-+
-+static void rt2800soc_free_reg(struct rt2x00_dev *rt2x00dev)
-+{
-+ kfree(rt2x00dev->rf);
-+ rt2x00dev->rf = NULL;
-+
-+ kfree(rt2x00dev->eeprom);
-+ rt2x00dev->eeprom = NULL;
-+}
-+
-+static int rt2800soc_alloc_reg(struct rt2x00_dev *rt2x00dev)
-+{
-+ struct platform_device *pdev = to_platform_device(rt2x00dev->dev);
-+ struct resource *res;
-+
-+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+ if (!res) {
-+ ERROR_PROBE("Failed to get MMIO resource\n");
-+ return -ENODEV;
-+ }
-+
-+ rt2x00dev->csr.base = (void __iomem *) KSEG1ADDR(res->start);
-+ rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL);
-+ if (!rt2x00dev->eeprom)
-+ goto exit;
-+
-+ rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL);
-+ if (!rt2x00dev->rf)
-+ goto exit;
-+
-+ return 0;
-+
-+exit:
-+ ERROR_PROBE("Failed to allocate registers.\n");
-+ rt2800soc_free_reg(rt2x00dev);
-+
-+ return -ENOMEM;
-+}
-+
-+static int rt2800soc_probe(struct platform_device *pdev)
-+{
-+ const struct rt2x00_ops *ops = &rt2800pci_ops;
-+ struct ieee80211_hw *hw;
-+ struct rt2x00_dev *rt2x00dev;
-+ int retval;
-+
-+ hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
-+ if (!hw) {
-+ ERROR_PROBE("Failed to allocate hardware.\n");
-+ return -ENOMEM;
-+ }
-+
-+ platform_set_drvdata(pdev, hw);
-+
-+ rt2x00dev = hw->priv;
-+ rt2x00dev->dev = &pdev->dev;
-+ rt2x00dev->ops = ops;
-+ rt2x00dev->hw = hw;
-+ rt2x00dev->irq = platform_get_irq(pdev, 0);
-+ rt2x00dev->name = pdev->dev.driver->name;
-+
-+ rt2x00_set_chip_rt(rt2x00dev, WSOC_RT_CHIPSET);
-+
-+ retval = rt2800soc_alloc_reg(rt2x00dev);
-+ if (retval)
-+ goto exit_free_device;
-+
-+ retval = rt2x00lib_probe_dev(rt2x00dev);
-+ if (retval)
-+ goto exit_free_reg;
-+
-+ return 0;
-+
-+exit_free_reg:
-+ rt2800soc_free_reg(rt2x00dev);
-+
-+exit_free_device:
-+ ieee80211_free_hw(hw);
-+
-+ return retval;
-+}
-+
-+static int rt2800soc_remove(struct platform_device *pdev)
-+{
-+ struct ieee80211_hw *hw = platform_get_drvdata(pdev);
-+ struct rt2x00_dev *rt2x00dev = hw->priv;
-+
-+ /*
-+ * Free all allocated data.
-+ */
-+ rt2x00lib_remove_dev(rt2x00dev);
-+ rt2800soc_free_reg(rt2x00dev);
-+ ieee80211_free_hw(hw);
-+
-+ return 0;
-+}
++#if defined(CONFIG_RALINK_RT288X)
++__rt2x00soc_probe(RT2880, &rt2800pci_ops);
++#elif defined(CONFIG_RALINK_RT305X)
++__rt2x00soc_probe(RT3052, &rt2800pci_ops);
++#endif
+
+static struct platform_driver rt2800soc_driver = {
-+ .driver.name = "rt2800_wmac",
-+ .probe = rt2800soc_probe,
-+ .remove = rt2800soc_remove,
++ .driver = {
++ .name = "rt2800_wmac",
++ .owner = THIS_MODULE,
++ .mod_name = KBUILD_MODNAME,
++ },
++ .probe = __rt2x00soc_probe,
++ .remove = __devexit_p(rt2x00soc_remove),
++ .suspend = rt2x00soc_suspend,
++ .resume = rt2x00soc_resume,
+};
+#endif /* CONFIG_RT2800PCI_WISOC */
+
@@ -3050,10 +3250,19 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+#ifdef CONFIG_RT2800PCI_WISOC
+ ret = platform_driver_register(&rt2800soc_driver);
++ if (ret)
++ return ret;
+#endif
+#ifdef CONFIG_RT2800PCI_PCI
+ ret = pci_register_driver(&rt2800pci_driver);
++ if (ret) {
++#ifdef CONFIG_RT2800PCI_WISOC
++ platform_driver_unregister(&rt2800soc_driver);
++#endif
++ return ret;
++ }
+#endif
++
+ return ret;
+}
+
@@ -3071,7 +3280,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+module_exit(rt2800pci_exit);
--- /dev/null
+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -0,0 +1,1880 @@
+@@ -0,0 +1,1927 @@
+/*
+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
+ <http://rt2x00.serialmonkey.com>
@@ -3110,7 +3319,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * RF2750 2.4G/5G 1T2R
+ * RF3020 2.4G 1T1R
+ * RF2020 2.4G B/G
-+ * RF3052 2.4G 2T2R
++ * RF3021 2.4G 1T2R
++ * RF3022 2.4G 2T2R
+ */
+#define RF2820 0x0001
+#define RF2850 0x0002
@@ -3118,7 +3328,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#define RF2750 0x0004
+#define RF3020 0x0005
+#define RF2020 0x0006
-+#define RF3052 0x0008
++#define RF3021 0x0007
++#define RF3022 0x0008
+
+/*
+ * RT2860 version
@@ -3157,12 +3368,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ */
+
+/*
-+ * PCI Configuration Header
-+ */
-+#define PCI_CONFIG_HEADER_VENDOR 0x0000
-+#define PCI_CONFIG_HEADER_DEVICE 0x0002
-+
-+/*
+ * E2PROM_CSR: EEPROM control register.
+ * RELOAD: Write 1 to reload eeprom content.
+ * TYPE: 0: 93c46, 1:93c66.
@@ -3453,6 +3658,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.
+ */
@@ -4545,6 +4759,48 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * BBP 3: RX Antenna
+ */
+#define BBP3_RX_ANTENNA FIELD8(0x18)
++#define BBP3_HT40_PLUS FIELD8(0x20)
++
++/*
++ * BBP 4: Bandwidth
++ */
++#define BBP4_TX_BF FIELD8(0x01)
++#define BBP4_BANDWIDTH FIELD8(0x18)
++
++/*
++ * 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
diff --git a/package/mac80211/patches/308-rt2x00-DMA-fixes-new-chipset-support-rt2800pci.patch b/package/mac80211/patches/308-rt2x00-DMA-fixes-new-chipset-support-rt2800pci.patch
deleted file mode 100644
index 3bb5c2e0fb..0000000000
--- a/package/mac80211/patches/308-rt2x00-DMA-fixes-new-chipset-support-rt2800pci.patch
+++ /dev/null
@@ -1,535 +0,0 @@
-From bfa282e0f525b074ec9a21372ab906156ce0aa20 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Mon, 16 Mar 2009 20:16:59 +0100
-Subject: [PATCH] rt2x00: DMA fixes & new chipset support (rt2800pci)
-
-Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c | 320 +++++++++++++++++++++++++++++--
- drivers/net/wireless/rt2x00/rt2800pci.h | 57 ++++++-
- 2 files changed, 361 insertions(+), 16 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -66,6 +66,8 @@ MODULE_PARM_DESC(nohwcrypt, "Disable har
- */
- #define WAIT_FOR_BBP(__dev, __reg) \
- rt2x00pci_regbusy_read((__dev), BBP_CSR_CFG, BBP_CSR_CFG_BUSY, (__reg))
-+#define WAIT_FOR_RFCSR(__dev, __reg) \
-+ rt2x00pci_regbusy_read((__dev), RF_CSR_CFG, RF_CSR_CFG_BUSY, (__reg))
- #define WAIT_FOR_RF(__dev, __reg) \
- rt2x00pci_regbusy_read((__dev), RF_CSR_CFG0, RF_CSR_CFG0_BUSY, (__reg))
- #define WAIT_FOR_MCU(__dev, __reg) \
-@@ -129,6 +131,61 @@ static void rt2800pci_bbp_read(struct rt
- mutex_unlock(&rt2x00dev->csr_mutex);
- }
-
-+static void rt2800pci_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);
-+
-+ rt2x00pci_register_write(rt2x00dev, RF_CSR_CFG, reg);
-+ }
-+
-+ mutex_unlock(&rt2x00dev->csr_mutex);
-+}
-+
-+static void rt2800pci_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);
-+
-+ rt2x00pci_register_write(rt2x00dev, RF_CSR_CFG, reg);
-+
-+ WAIT_FOR_RFCSR(rt2x00dev, &reg);
-+ }
-+
-+ *value = rt2x00_get_field32(reg, RF_CSR_CFG_DATA);
-+
-+ mutex_unlock(&rt2x00dev->csr_mutex);
-+}
-+
- static void rt2800pci_rf_write(struct rt2x00_dev *rt2x00dev,
- const unsigned int word, const u32 value)
- {
-@@ -160,6 +217,13 @@ static void rt2800pci_mcu_request(struct
- {
- u32 reg;
-
-+ /*
-+ * RT2880 and RT3052 don't support MCU requests.
-+ */
-+ if (rt2x00_rt(&rt2x00dev->chip, RT2880) ||
-+ rt2x00_rt(&rt2x00dev->chip, RT3052))
-+ return;
-+
- mutex_lock(&rt2x00dev->csr_mutex);
-
- /*
-@@ -729,13 +793,11 @@ static void rt2800pci_config_lna_gain(st
- rt2x00dev->lna_gain = lna_gain;
- }
-
--static void rt2800pci_config_channel(struct rt2x00_dev *rt2x00dev,
-- struct ieee80211_conf *conf,
-- struct rf_channel *rf,
-- struct channel_info *info)
-+static void rt2800pci_config_channel_rt2x(struct rt2x00_dev *rt2x00dev,
-+ struct ieee80211_conf *conf,
-+ struct rf_channel *rf,
-+ struct channel_info *info)
- {
-- u32 reg;
-- unsigned int tx_pin;
- u16 eeprom;
-
- rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset);
-@@ -745,9 +807,8 @@ static void rt2800pci_config_channel(str
- */
- 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);
-- }
-
- if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) == 1) {
- rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX1, 1);
-@@ -806,6 +867,62 @@ static void rt2800pci_config_channel(str
- rt2800pci_rf_write(rt2x00dev, 2, rf->rf2);
- rt2800pci_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004);
- rt2800pci_rf_write(rt2x00dev, 4, rf->rf4);
-+}
-+
-+static void rt2800pci_config_channel_rt3x(struct rt2x00_dev *rt2x00dev,
-+ struct ieee80211_conf *conf,
-+ struct rf_channel *rf,
-+ struct channel_info *info)
-+{
-+ u8 rfcsr;
-+
-+ rt2800pci_rfcsr_write(rt2x00dev, 2, rf->rf1);
-+ rt2800pci_rfcsr_write(rt2x00dev, 2, rf->rf3);
-+
-+ rt2800pci_rfcsr_read(rt2x00dev, 6, &rfcsr);
-+ rt2x00_set_field8(&rfcsr, RFCSR6_R, rf->rf2);
-+ rt2800pci_rfcsr_write(rt2x00dev, 6, rfcsr);
-+
-+ rt2800pci_rfcsr_read(rt2x00dev, 12, &rfcsr);
-+ rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER,
-+ TXPOWER_G_TO_DEV(info->tx_power1));
-+ rt2800pci_rfcsr_write(rt2x00dev, 12, rfcsr);
-+
-+ rt2800pci_rfcsr_read(rt2x00dev, 23, &rfcsr);
-+ rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
-+ rt2800pci_rfcsr_write(rt2x00dev, 23, rfcsr);
-+
-+ if (conf_is_ht40(conf))
-+ rt2800pci_rfcsr_write(rt2x00dev, 24,
-+ rt2x00dev->calibration_bw40);
-+ else
-+ rt2800pci_rfcsr_write(rt2x00dev, 24,
-+ rt2x00dev->calibration_bw20);
-+
-+ rt2800pci_rfcsr_read(rt2x00dev, 23, &rfcsr);
-+ rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1);
-+ rt2800pci_rfcsr_write(rt2x00dev, 23, rfcsr);
-+}
-+
-+static void rt2800pci_config_channel(struct rt2x00_dev *rt2x00dev,
-+ struct ieee80211_conf *conf,
-+ struct rf_channel *rf,
-+ struct channel_info *info)
-+{
-+ u32 reg;
-+ unsigned int tx_pin;
-+ u16 eeprom;
-+ u8 bbp;
-+
-+ /*
-+ * Determine antenna settings from EEPROM
-+ */
-+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
-+
-+ if (rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION)
-+ rt2800pci_config_channel_rt2x(rt2x00dev, conf, rf, info);
-+ else
-+ rt2800pci_config_channel_rt3x(rt2x00dev, conf, rf, info);
-
- /*
- * Change BBP settings
-@@ -861,6 +978,26 @@ static void rt2800pci_config_channel(str
-
- rt2x00pci_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
-
-+ rt2800pci_bbp_read(rt2x00dev, 4, &bbp);
-+ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
-+ rt2800pci_bbp_write(rt2x00dev, 4, bbp);
-+
-+ rt2800pci_bbp_read(rt2x00dev, 3, &bbp);
-+ rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf));
-+ rt2800pci_bbp_write(rt2x00dev, 3, bbp);
-+
-+ if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
-+ if (conf_is_ht40(conf)) {
-+ rt2800pci_bbp_write(rt2x00dev, 69, 0x1a);
-+ rt2800pci_bbp_write(rt2x00dev, 70, 0x0a);
-+ rt2800pci_bbp_write(rt2x00dev, 73, 0x16);
-+ } else {
-+ rt2800pci_bbp_write(rt2x00dev, 69, 0x16);
-+ rt2800pci_bbp_write(rt2x00dev, 70, 0x08);
-+ rt2800pci_bbp_write(rt2x00dev, 73, 0x11);
-+ }
-+ }
-+
- msleep(1);
- }
-
-@@ -1265,7 +1402,7 @@ static int rt2800pci_init_queues(struct
- entry_priv = rt2x00dev->rx->entries[0].priv_data;
- rt2x00pci_register_write(rt2x00dev, RX_BASE_PTR, entry_priv->desc_dma);
- rt2x00pci_register_write(rt2x00dev, RX_MAX_CNT, rt2x00dev->rx[0].limit);
-- rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX, 0);
-+ rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX, rt2x00dev->rx[0].limit - 1);
- rt2x00pci_register_write(rt2x00dev, RX_DRX_IDX, 0);
-
- /*
-@@ -1613,7 +1750,7 @@ static int rt2800pci_init_bbp(struct rt2
- rt2800pci_bbp_write(rt2x00dev, 91, 0x04);
- rt2800pci_bbp_write(rt2x00dev, 92, 0x00);
- rt2800pci_bbp_write(rt2x00dev, 103, 0x00);
-- rt2800pci_bbp_write(rt2x00dev, 105, 0x05);
-+ rt2800pci_bbp_write(rt2x00dev, 105, 0x01);
-
- if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
- rt2800pci_bbp_write(rt2x00dev, 69, 0x16);
-@@ -1623,6 +1760,12 @@ static int rt2800pci_init_bbp(struct rt2
- if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION)
- rt2800pci_bbp_write(rt2x00dev, 84, 0x19);
-
-+ if (rt2x00_rt(&rt2x00dev->chip, RT3052)) {
-+ rt2800pci_bbp_write(rt2x00dev, 31, 0x08);
-+ rt2800pci_bbp_write(rt2x00dev, 78, 0x0e);
-+ rt2800pci_bbp_write(rt2x00dev, 80, 0x08);
-+ }
-+
- for (i = 0; i < EEPROM_BBP_SIZE; i++) {
- rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom);
-
-@@ -1636,6 +1779,144 @@ static int rt2800pci_init_bbp(struct rt2
- return 0;
- }
-
-+static u8 rt2800pci_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;
-+
-+ rt2800pci_rfcsr_write(rt2x00dev, 24, rfcsr24);
-+
-+ rt2800pci_bbp_read(rt2x00dev, 4, &bbp);
-+ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * bw40);
-+ rt2800pci_bbp_write(rt2x00dev, 4, bbp);
-+
-+ rt2800pci_rfcsr_read(rt2x00dev, 22, &rfcsr);
-+ rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 1);
-+ rt2800pci_rfcsr_write(rt2x00dev, 22, rfcsr);
-+
-+ /*
-+ * Set power & frequency of passband test tone
-+ */
-+ rt2800pci_bbp_write(rt2x00dev, 24, 0);
-+
-+ for (i = 0; i < 100; i++) {
-+ rt2800pci_bbp_write(rt2x00dev, 25, 0x90);
-+ msleep(1);
-+
-+ rt2800pci_bbp_read(rt2x00dev, 55, &passband);
-+ if (passband)
-+ break;
-+ }
-+
-+ /*
-+ * Set power & frequency of stopband test tone
-+ */
-+ rt2800pci_bbp_write(rt2x00dev, 24, 0x06);
-+
-+ for (i = 0; i < 100; i++) {
-+ rt2800pci_bbp_write(rt2x00dev, 25, 0x90);
-+ msleep(1);
-+
-+ rt2800pci_bbp_read(rt2x00dev, 55, &stopband);
-+
-+ if ((passband - stopband) <= filter_target) {
-+ rfcsr24++;
-+ overtuned += ((passband - stopband) == filter_target);
-+ } else
-+ break;
-+
-+ rt2800pci_rfcsr_write(rt2x00dev, 24, rfcsr24);
-+ }
-+
-+ rfcsr24 -= !!overtuned;
-+
-+ rt2800pci_rfcsr_write(rt2x00dev, 24, rfcsr24);
-+ return rfcsr24;
-+}
-+
-+static int rt2800pci_init_rfcsr(struct rt2x00_dev *rt2x00dev)
-+{
-+ u8 rfcsr;
-+ u8 bbp;
-+
-+ if (!rt2x00_rf(&rt2x00dev->chip, RF3020) &&
-+ !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
-+ !rt2x00_rf(&rt2x00dev->chip, RF3022))
-+ return 0;
-+
-+ /*
-+ * Init RF calibration.
-+ */
-+ rt2800pci_rfcsr_read(rt2x00dev, 30, &rfcsr);
-+ rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1);
-+ rt2800pci_rfcsr_write(rt2x00dev, 30, rfcsr);
-+ msleep(1);
-+ rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
-+ rt2800pci_rfcsr_write(rt2x00dev, 30, rfcsr);
-+
-+ rt2800pci_rfcsr_write(rt2x00dev, 0, 0x50);
-+ rt2800pci_rfcsr_write(rt2x00dev, 1, 0x01);
-+ rt2800pci_rfcsr_write(rt2x00dev, 2, 0xf7);
-+ rt2800pci_rfcsr_write(rt2x00dev, 3, 0x75);
-+ rt2800pci_rfcsr_write(rt2x00dev, 4, 0x40);
-+ rt2800pci_rfcsr_write(rt2x00dev, 5, 0x03);
-+ rt2800pci_rfcsr_write(rt2x00dev, 6, 0x02);
-+ rt2800pci_rfcsr_write(rt2x00dev, 7, 0x50);
-+ rt2800pci_rfcsr_write(rt2x00dev, 8, 0x39);
-+ rt2800pci_rfcsr_write(rt2x00dev, 9, 0x0f);
-+ rt2800pci_rfcsr_write(rt2x00dev, 10, 0x60);
-+ rt2800pci_rfcsr_write(rt2x00dev, 11, 0x21);
-+ rt2800pci_rfcsr_write(rt2x00dev, 12, 0x75);
-+ rt2800pci_rfcsr_write(rt2x00dev, 13, 0x75);
-+ rt2800pci_rfcsr_write(rt2x00dev, 14, 0x90);
-+ rt2800pci_rfcsr_write(rt2x00dev, 15, 0x58);
-+ rt2800pci_rfcsr_write(rt2x00dev, 16, 0xb3);
-+ rt2800pci_rfcsr_write(rt2x00dev, 17, 0x92);
-+ rt2800pci_rfcsr_write(rt2x00dev, 18, 0x2c);
-+ rt2800pci_rfcsr_write(rt2x00dev, 19, 0x02);
-+ rt2800pci_rfcsr_write(rt2x00dev, 20, 0xba);
-+ rt2800pci_rfcsr_write(rt2x00dev, 21, 0xdb);
-+ rt2800pci_rfcsr_write(rt2x00dev, 22, 0x00);
-+ rt2800pci_rfcsr_write(rt2x00dev, 23, 0x31);
-+ rt2800pci_rfcsr_write(rt2x00dev, 24, 0x08);
-+ rt2800pci_rfcsr_write(rt2x00dev, 25, 0x01);
-+ rt2800pci_rfcsr_write(rt2x00dev, 26, 0x25);
-+ rt2800pci_rfcsr_write(rt2x00dev, 27, 0x23);
-+ rt2800pci_rfcsr_write(rt2x00dev, 28, 0x13);
-+ rt2800pci_rfcsr_write(rt2x00dev, 29, 0x83);
-+
-+ /*
-+ * Set RX Filter calibration for 20MHz and 40MHz
-+ */
-+ rt2x00dev->calibration_bw20 =
-+ rt2800pci_init_rx_filter(rt2x00dev, false, 0x07, 0x16);
-+ rt2x00dev->calibration_bw40 =
-+ rt2800pci_init_rx_filter(rt2x00dev, true, 0x27, 0x19);
-+
-+ /*
-+ * Set back to initial state
-+ */
-+ rt2800pci_bbp_write(rt2x00dev, 24, 0);
-+
-+ rt2800pci_rfcsr_read(rt2x00dev, 22, &rfcsr);
-+ rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0);
-+ rt2800pci_rfcsr_write(rt2x00dev, 22, rfcsr);
-+
-+ /*
-+ * set BBP back to BW20
-+ */
-+ rt2800pci_bbp_read(rt2x00dev, 4, &bbp);
-+ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0);
-+ rt2800pci_bbp_write(rt2x00dev, 4, bbp);
-+
-+ return 0;
-+}
-+
- /*
- * Device state switch handlers.
- */
-@@ -1718,7 +1999,8 @@ static int rt2800pci_enable_radio(struct
- rt2800pci_init_queues(rt2x00dev) ||
- rt2800pci_init_registers(rt2x00dev) ||
- rt2800pci_wait_wpdma_ready(rt2x00dev) ||
-- rt2800pci_init_bbp(rt2x00dev)))
-+ rt2800pci_init_bbp(rt2x00dev) ||
-+ rt2800pci_init_rfcsr(rt2x00dev)))
- return -EIO;
-
- /*
-@@ -2114,6 +2396,12 @@ static void rt2800pci_fill_rxdone(struct
- rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
-
- /*
-+ * Set RX IDX in register to inform hardware that we have handled
-+ * this entry and it is available for reuse again.
-+ */
-+ rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx);
-+
-+ /*
- * Remove TXWI descriptor from start of buffer.
- */
- skb_pull(entry->skb, RXWI_DESC_SIZE);
-@@ -2380,7 +2668,8 @@ static int rt2800pci_init_eeprom(struct
- !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
- !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
- !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
-- !rt2x00_rf(&rt2x00dev->chip, RF3052)) {
-+ !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
-+ !rt2x00_rf(&rt2x00dev->chip, RF3022)) {
- ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
- return -ENODEV;
- }
-@@ -2528,7 +2817,8 @@ static int rt2800pci_probe_hw_mode(struc
-
- if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
- rt2x00_rf(&rt2x00dev->chip, RF2720) ||
-- rt2x00_rf(&rt2x00dev->chip, RF3052)) {
-+ rt2x00_rf(&rt2x00dev->chip, RF3021) ||
-+ rt2x00_rf(&rt2x00dev->chip, RF3022)) {
- spec->num_channels = 14;
- spec->channels = rf_vals;
- } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
-@@ -2624,7 +2914,9 @@ static int rt2800pci_probe_hw(struct rt2
- /*
- * This device requires firmware.
- */
-- __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
-+ if (!rt2x00_rt(&rt2x00dev->chip, RT2880) &&
-+ !rt2x00_rt(&rt2x00dev->chip, RT3052))
-+ __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
- if (!modparam_nohwcrypt)
- __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.h
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -36,7 +36,8 @@
- * RF2750 2.4G/5G 1T2R
- * RF3020 2.4G 1T1R
- * RF2020 2.4G B/G
-- * RF3052 2.4G 2T2R
-+ * RF3021 2.4G 1T2R
-+ * RF3022 2.4G 2T2R
- */
- #define RF2820 0x0001
- #define RF2850 0x0002
-@@ -44,7 +45,8 @@
- #define RF2750 0x0004
- #define RF3020 0x0005
- #define RF2020 0x0006
--#define RF3052 0x0008
-+#define RF3021 0x0007
-+#define RF3022 0x0008
-
- /*
- * RT2860 version
-@@ -373,6 +375,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.
- */
-@@ -1465,6 +1476,48 @@ struct mac_iveiv_entry {
- * BBP 3: RX Antenna
- */
- #define BBP3_RX_ANTENNA FIELD8(0x18)
-+#define BBP3_HT40_PLUS FIELD8(0x20)
-+
-+/*
-+ * BBP 4: Bandwidth
-+ */
-+#define BBP4_TX_BF FIELD8(0x01)
-+#define BBP4_BANDWIDTH FIELD8(0x18)
-+
-+/*
-+ * 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
diff --git a/package/mac80211/patches/303-rt2x00-Implement-support-for-rt2800usb.patch b/package/mac80211/patches/308-rt2x00-Implement-support-for-rt2800usb.patch
index c9152fd366..946dfa1e0b 100644
--- a/package/mac80211/patches/303-rt2x00-Implement-support-for-rt2800usb.patch
+++ b/package/mac80211/patches/308-rt2x00-Implement-support-for-rt2800usb.patch
@@ -1,7 +1,7 @@
-From 101b65d221593c1bdeacf0c6085d885ea5447c4c Mon Sep 17 00:00:00 2001
+From 3924d0442771e17c26ab10ad53a1807e800ab3f1 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sat, 14 Mar 2009 20:46:40 +0100
-Subject: [PATCH] rt2x00: Implement support for rt2800usb
+Date: Sat, 28 Mar 2009 20:48:56 +0100
+Subject: [PATCH 9/9] rt2x00: Implement support for rt2800usb
Add support for the rt2800usb chipset.
@@ -15,23 +15,23 @@ 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 | 3032 +++++++++++++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800usb.c | 3036 +++++++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2800usb.h | 1934 ++++++++++++++++++++
- drivers/net/wireless/rt2x00/rt2x00.h | 7 +
- 5 files changed, 4988 insertions(+), 0 deletions(-)
+ drivers/net/wireless/rt2x00/rt2x00.h | 1 +
+ 5 files changed, 4986 insertions(+), 0 deletions(-)
create mode 100644 drivers/net/wireless/rt2x00/rt2800usb.c
create mode 100644 drivers/net/wireless/rt2x00/rt2800usb.h
--- a/drivers/net/wireless/rt2x00/Makefile
+++ b/drivers/net/wireless/rt2x00/Makefile
-@@ -19,3 +19,4 @@ obj-$(CONFIG_RT61PCI) += rt61pci.o
+@@ -20,3 +20,4 @@ obj-$(CONFIG_RT61PCI) += rt61pci.o
obj-$(CONFIG_RT2800PCI) += rt2800pci.o
obj-$(CONFIG_RT2500USB) += rt2500usb.o
obj-$(CONFIG_RT73USB) += rt73usb.o
+obj-$(CONFIG_RT2800USB) += rt2800usb.o
--- /dev/null
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -0,0 +1,3032 @@
+@@ -0,0 +1,3036 @@
+/*
+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
+ <http://rt2x00.serialmonkey.com>
@@ -2472,8 +2472,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ /* 802.11 HyperLan 2 */
+ { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
+ { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
-+ { 104, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed1a3 },
-+ { 108, 0x18402ecc, 0x184c0a32, 0x18578a55, 0x180ed193 },
++ { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
++ { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
+ { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
+ { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
+ { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
@@ -2495,6 +2495,10 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
+ { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
+ { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
++ { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
++ { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
++ { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
++ { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
+
+ /* 802.11 Japan */
+ { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
@@ -5011,16 +5015,3 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
u16 rf;
u32 rev;
-@@ -788,6 +789,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/309-rt2x00-Fix-compile-errors-for-SoC.patch b/package/mac80211/patches/309-rt2x00-Fix-compile-errors-for-SoC.patch
deleted file mode 100644
index 25c07791f0..0000000000
--- a/package/mac80211/patches/309-rt2x00-Fix-compile-errors-for-SoC.patch
+++ /dev/null
@@ -1,136 +0,0 @@
-From e6cbd7e05f7c1fe0a737526d20f39b4a52e03ae8 Mon Sep 17 00:00:00 2001
-From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Tue, 17 Mar 2009 14:01:29 +0100
-Subject: [PATCH] rt2x00: Fix compile errors for SoC
-
-Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
----
- drivers/net/wireless/rt2x00/rt2800pci.c | 37 +++++++++++++++----------------
- 1 files changed, 18 insertions(+), 19 deletions(-)
-
---- a/drivers/net/wireless/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -3186,7 +3186,7 @@ MODULE_LICENSE("GPL");
- #define WSOC_RT_CHIPSET RT3052
- #endif /* CONFIG_RALINK_RT305X */
-
--static void rt2800soc_free_reg(struct rt2x00_dev *rt2x00dev)
-+static void rt2x00soc_free_reg(struct rt2x00_dev *rt2x00dev)
- {
- kfree(rt2x00dev->rf);
- rt2x00dev->rf = NULL;
-@@ -3195,7 +3195,7 @@ static void rt2800soc_free_reg(struct rt
- rt2x00dev->eeprom = NULL;
- }
-
--static int rt2800soc_alloc_reg(struct rt2x00_dev *rt2x00dev)
-+static int rt2x00soc_alloc_reg(struct rt2x00_dev *rt2x00dev)
- {
- struct platform_device *pdev = to_platform_device(rt2x00dev->dev);
- struct resource *res;
-@@ -3219,14 +3219,14 @@ static int rt2800soc_alloc_reg(struct rt
-
- exit:
- ERROR_PROBE("Failed to allocate registers.\n");
-- rt2800soc_free_reg(rt2x00dev);
-+ rt2x00soc_free_reg(rt2x00dev);
-
- return -ENOMEM;
- }
-
--static int rt2800soc_probe(struct platform_device *pdev)
-+static int rt2x00soc_probe(struct platform_device *pdev)
- {
-- struct rt2x00_ops *ops = (struct rt2x00_ops *)pdev->driver->p;
-+ const struct rt2x00_ops *ops = &rt2800pci_ops;
- struct ieee80211_hw *hw;
- struct rt2x00_dev *rt2x00dev;
- int retval;
-@@ -3248,7 +3248,7 @@ static int rt2800soc_probe(struct platfo
-
- rt2x00_set_chip_rt(rt2x00dev, WSOC_RT_CHIPSET);
-
-- retval = rt2800soc_alloc_reg(rt2x00dev);
-+ retval = rt2x00soc_alloc_reg(rt2x00dev);
- if (retval)
- goto exit_free_device;
-
-@@ -3259,7 +3259,7 @@ static int rt2800soc_probe(struct platfo
- return 0;
-
- exit_free_reg:
-- rt2800soc_free_reg(rt2x00dev);
-+ rt2x00soc_free_reg(rt2x00dev);
-
- exit_free_device:
- ieee80211_free_hw(hw);
-@@ -3267,7 +3267,7 @@ exit_free_device:
- return retval;
- }
-
--static int rt2800soc_remove(struct platform_device *pdev)
-+static int rt2x00soc_remove(struct platform_device *pdev)
- {
- struct ieee80211_hw *hw = platform_get_drvdata(pdev);
- struct rt2x00_dev *rt2x00dev = hw->priv;
-@@ -3276,16 +3276,16 @@ static int rt2800soc_remove(struct platf
- * Free all allocated data.
- */
- rt2x00lib_remove_dev(rt2x00dev);
-- rt2800soc_free_reg(rt2x00dev);
-+ rt2x00soc_free_reg(rt2x00dev);
- ieee80211_free_hw(hw);
-
- return 0;
- }
-
- #ifdef CONFIG_PM
--int rt2x00soc_suspend(struct device *dev, pm_message_t state)
-+int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state)
- {
-- struct ieee80211_hw *hw = dev_get_drvdata(dev);
-+ struct ieee80211_hw *hw = platform_get_drvdata(pdev);
- struct rt2x00_dev *rt2x00dev = hw->priv;
- int retval;
-
-@@ -3293,14 +3293,14 @@ int rt2x00soc_suspend(struct device *dev
- if (retval)
- return retval;
-
-- rt2800soc_free_reg(rt2x00dev);
-+ rt2x00soc_free_reg(rt2x00dev);
-
- return 0;
- }
-
--int rt2x00soc_resume(struct device *dev)
-+int rt2x00soc_resume(struct platform_device *pdev)
- {
-- struct ieee80211_hw *hw = dev_get_drvdata(dev);
-+ struct ieee80211_hw *hw = platform_get_drvdata(pdev);
- struct rt2x00_dev *rt2x00dev = hw->priv;
- int retval;
-
-@@ -3315,7 +3315,7 @@ int rt2x00soc_resume(struct device *dev)
- return 0;
-
- exit_free_reg:
-- rt2x00pci_free_reg(rt2x00dev);
-+ rt2x00soc_free_reg(rt2x00dev);
-
- return retval;
- }
-@@ -3326,10 +3326,9 @@ static struct platform_driver rt2800soc_
- .name = "rt2800_wmac",
- .owner = THIS_MODULE,
- .mod_name = KBUILD_MODNAME,
-- .p = &rt2800pci_ops;
-- }
-- .probe = rt2800soc_probe,
-- .remove = __devexit_p(rt2800soc_remove),
-+ },
-+ .probe = rt2x00soc_probe,
-+ .remove = __devexit_p(rt2x00soc_remove),
- .suspend = rt2x00soc_suspend,
- .resume = rt2x00soc_resume,
- };
diff --git a/package/mac80211/patches/520-b43-autodepend-on-hwrandom.patch b/package/mac80211/patches/520-b43-autodepend-on-hwrandom.patch
index c79f6573f5..9ffdadfd26 100644
--- a/package/mac80211/patches/520-b43-autodepend-on-hwrandom.patch
+++ b/package/mac80211/patches/520-b43-autodepend-on-hwrandom.patch
@@ -4,10 +4,8 @@ This patch is submitted upstream and can be removed when it hits compat-wireless
-Index: compat-wireless-2009-03-24/drivers/net/wireless/b43/b43.h
-===================================================================
---- compat-wireless-2009-03-24.orig/drivers/net/wireless/b43/b43.h 2009-03-29 13:27:05.000000000 +0200
-+++ compat-wireless-2009-03-24/drivers/net/wireless/b43/b43.h 2009-03-29 13:27:21.000000000 +0200
+--- a/drivers/net/wireless/b43/b43.h
++++ b/drivers/net/wireless/b43/b43.h
@@ -624,9 +624,11 @@ struct b43_wl {
/* Stats about the wireless interface */
struct ieee80211_low_level_stats ieee_stats;
@@ -21,10 +19,8 @@ Index: compat-wireless-2009-03-24/drivers/net/wireless/b43/b43.h
/* The RF-kill button */
struct b43_rfkill rfkill;
-Index: compat-wireless-2009-03-24/drivers/net/wireless/b43/main.c
-===================================================================
---- compat-wireless-2009-03-24.orig/drivers/net/wireless/b43/main.c 2009-03-29 13:27:05.000000000 +0200
-+++ compat-wireless-2009-03-24/drivers/net/wireless/b43/main.c 2009-03-29 13:27:21.000000000 +0200
+--- a/drivers/net/wireless/b43/main.c
++++ b/drivers/net/wireless/b43/main.c
@@ -2982,6 +2982,7 @@ static void b43_security_init(struct b43
b43_clear_keys(dev);
}
@@ -64,10 +60,8 @@ Index: compat-wireless-2009-03-24/drivers/net/wireless/b43/main.c
return err;
}
-Index: compat-wireless-2009-03-24/config.mk
-===================================================================
---- compat-wireless-2009-03-24.orig/config.mk 2009-03-29 13:28:03.000000000 +0200
-+++ compat-wireless-2009-03-24/config.mk 2009-03-29 13:28:32.000000000 +0200
+--- a/config.mk
++++ b/config.mk
@@ -148,6 +148,7 @@ CONFIG_ATH9K_DEBUG=y
# CONFIG_B43_PIO=y
# CONFIG_B43_LEDS=y