aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2011-04-25 14:34:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-25 14:34:25 -0400
commitcfef6047c4027a8448ec8dafeaf2bb362cc882e4 (patch)
treec254bd25aa8b4b0696b5b5cc45d8e30c7c1bb9dd /drivers/net/wireless/rt2x00
parentb71d1d426d263b0b6cb5760322efebbfc89d4463 (diff)
parent73b48099cc265f88fa1255f3f43e52fe6a94fd5c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts: drivers/net/wireless/iwlwifi/iwl-core.c drivers/net/wireless/rt2x00/rt2x00queue.c drivers/net/wireless/rt2x00/rt2x00queue.h
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r--drivers/net/wireless/rt2x00/Kconfig26
-rw-r--r--drivers/net/wireless/rt2x00/Makefile1
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c29
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c28
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c85
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c135
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c244
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c621
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h97
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c77
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00crypto.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00debug.c42
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c23
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00firmware.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00ht.c136
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h34
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00link.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c95
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.h12
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c159
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h33
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c126
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.h31
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c64
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c189
26 files changed, 1361 insertions, 956 deletions
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig
index f630552427b7..c45773108283 100644
--- a/drivers/net/wireless/rt2x00/Kconfig
+++ b/drivers/net/wireless/rt2x00/Kconfig
@@ -59,7 +59,6 @@ config RT2800PCI
59 select RT2800_LIB 59 select RT2800_LIB
60 select RT2X00_LIB_PCI if PCI 60 select RT2X00_LIB_PCI if PCI
61 select RT2X00_LIB_SOC if RALINK_RT288X || RALINK_RT305X 61 select RT2X00_LIB_SOC if RALINK_RT288X || RALINK_RT305X
62 select RT2X00_LIB_HT
63 select RT2X00_LIB_FIRMWARE 62 select RT2X00_LIB_FIRMWARE
64 select RT2X00_LIB_CRYPTO 63 select RT2X00_LIB_CRYPTO
65 select CRC_CCITT 64 select CRC_CCITT
@@ -74,17 +73,13 @@ config RT2800PCI
74if RT2800PCI 73if RT2800PCI
75 74
76config RT2800PCI_RT33XX 75config RT2800PCI_RT33XX
77 bool "rt2800pci - Include support for rt33xx devices (EXPERIMENTAL)" 76 bool "rt2800pci - Include support for rt33xx devices"
78 depends on EXPERIMENTAL 77 default y
79 default n
80 ---help--- 78 ---help---
81 This adds support for rt33xx wireless chipset family to the 79 This adds support for rt33xx wireless chipset family to the
82 rt2800pci driver. 80 rt2800pci driver.
83 Supported chips: RT3390 81 Supported chips: RT3390
84 82
85 Support for these devices is non-functional at the moment and is
86 intended for testers and developers.
87
88config RT2800PCI_RT35XX 83config RT2800PCI_RT35XX
89 bool "rt2800pci - Include support for rt35xx devices (EXPERIMENTAL)" 84 bool "rt2800pci - Include support for rt35xx devices (EXPERIMENTAL)"
90 depends on EXPERIMENTAL 85 depends on EXPERIMENTAL
@@ -100,15 +95,12 @@ config RT2800PCI_RT35XX
100config RT2800PCI_RT53XX 95config RT2800PCI_RT53XX
101 bool "rt2800-pci - Include support for rt53xx devices (EXPERIMENTAL)" 96 bool "rt2800-pci - Include support for rt53xx devices (EXPERIMENTAL)"
102 depends on EXPERIMENTAL 97 depends on EXPERIMENTAL
103 default n 98 default y
104 ---help--- 99 ---help---
105 This adds support for rt53xx wireless chipset family to the 100 This adds support for rt53xx wireless chipset family to the
106 rt2800pci driver. 101 rt2800pci driver.
107 Supported chips: RT5390 102 Supported chips: RT5390
108 103
109 Support for these devices is non-functional at the moment and is
110 intended for testers and developers.
111
112endif 104endif
113 105
114config RT2500USB 106config RT2500USB
@@ -140,7 +132,6 @@ config RT2800USB
140 depends on USB 132 depends on USB
141 select RT2800_LIB 133 select RT2800_LIB
142 select RT2X00_LIB_USB 134 select RT2X00_LIB_USB
143 select RT2X00_LIB_HT
144 select RT2X00_LIB_FIRMWARE 135 select RT2X00_LIB_FIRMWARE
145 select RT2X00_LIB_CRYPTO 136 select RT2X00_LIB_CRYPTO
146 select CRC_CCITT 137 select CRC_CCITT
@@ -153,17 +144,13 @@ config RT2800USB
153if RT2800USB 144if RT2800USB
154 145
155config RT2800USB_RT33XX 146config RT2800USB_RT33XX
156 bool "rt2800usb - Include support for rt33xx devices (EXPERIMENTAL)" 147 bool "rt2800usb - Include support for rt33xx devices"
157 depends on EXPERIMENTAL 148 default y
158 default n
159 ---help--- 149 ---help---
160 This adds support for rt33xx wireless chipset family to the 150 This adds support for rt33xx wireless chipset family to the
161 rt2800usb driver. 151 rt2800usb driver.
162 Supported chips: RT3370 152 Supported chips: RT3370
163 153
164 Support for these devices is non-functional at the moment and is
165 intended for testers and developers.
166
167config RT2800USB_RT35XX 154config RT2800USB_RT35XX
168 bool "rt2800usb - Include support for rt35xx devices (EXPERIMENTAL)" 155 bool "rt2800usb - Include support for rt35xx devices (EXPERIMENTAL)"
169 depends on EXPERIMENTAL 156 depends on EXPERIMENTAL
@@ -207,9 +194,6 @@ config RT2X00_LIB_USB
207config RT2X00_LIB 194config RT2X00_LIB
208 tristate 195 tristate
209 196
210config RT2X00_LIB_HT
211 boolean
212
213config RT2X00_LIB_FIRMWARE 197config RT2X00_LIB_FIRMWARE
214 boolean 198 boolean
215 select FW_LOADER 199 select FW_LOADER
diff --git a/drivers/net/wireless/rt2x00/Makefile b/drivers/net/wireless/rt2x00/Makefile
index 971339858297..349d5b8284a4 100644
--- a/drivers/net/wireless/rt2x00/Makefile
+++ b/drivers/net/wireless/rt2x00/Makefile
@@ -7,7 +7,6 @@ rt2x00lib-$(CONFIG_RT2X00_LIB_DEBUGFS) += rt2x00debug.o
7rt2x00lib-$(CONFIG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o 7rt2x00lib-$(CONFIG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o
8rt2x00lib-$(CONFIG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o 8rt2x00lib-$(CONFIG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o
9rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o 9rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o
10rt2x00lib-$(CONFIG_RT2X00_LIB_HT) += rt2x00ht.o
11 10
12obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o 11obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o
13obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o 12obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 137a24e520da..937f9e8bf05f 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1314,8 +1314,8 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev,
1314 } 1314 }
1315} 1315}
1316 1316
1317static void rt2400pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, 1317static inline void rt2400pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,
1318 struct rt2x00_field32 irq_field) 1318 struct rt2x00_field32 irq_field)
1319{ 1319{
1320 u32 reg; 1320 u32 reg;
1321 1321
@@ -1536,13 +1536,13 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
1536 * Detect if this device has an hardware controlled radio. 1536 * Detect if this device has an hardware controlled radio.
1537 */ 1537 */
1538 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) 1538 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
1539 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); 1539 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
1540 1540
1541 /* 1541 /*
1542 * Check if the BBP tuning should be enabled. 1542 * Check if the BBP tuning should be enabled.
1543 */ 1543 */
1544 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_AGCVGC_TUNING)) 1544 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_AGCVGC_TUNING))
1545 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); 1545 __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
1546 1546
1547 return 0; 1547 return 0;
1548} 1548}
@@ -1640,9 +1640,9 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1640 /* 1640 /*
1641 * This device requires the atim queue and DMA-mapped skbs. 1641 * This device requires the atim queue and DMA-mapped skbs.
1642 */ 1642 */
1643 __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); 1643 __set_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags);
1644 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); 1644 __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags);
1645 __set_bit(DRIVER_REQUIRE_SW_SEQNO, &rt2x00dev->flags); 1645 __set_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags);
1646 1646
1647 /* 1647 /*
1648 * Set the rssi offset. 1648 * Set the rssi offset.
@@ -1720,6 +1720,9 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = {
1720 .tx_last_beacon = rt2400pci_tx_last_beacon, 1720 .tx_last_beacon = rt2400pci_tx_last_beacon,
1721 .rfkill_poll = rt2x00mac_rfkill_poll, 1721 .rfkill_poll = rt2x00mac_rfkill_poll,
1722 .flush = rt2x00mac_flush, 1722 .flush = rt2x00mac_flush,
1723 .set_antenna = rt2x00mac_set_antenna,
1724 .get_antenna = rt2x00mac_get_antenna,
1725 .get_ringparam = rt2x00mac_get_ringparam,
1723}; 1726};
1724 1727
1725static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { 1728static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
@@ -1740,6 +1743,7 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
1740 .start_queue = rt2400pci_start_queue, 1743 .start_queue = rt2400pci_start_queue,
1741 .kick_queue = rt2400pci_kick_queue, 1744 .kick_queue = rt2400pci_kick_queue,
1742 .stop_queue = rt2400pci_stop_queue, 1745 .stop_queue = rt2400pci_stop_queue,
1746 .flush_queue = rt2x00pci_flush_queue,
1743 .write_tx_desc = rt2400pci_write_tx_desc, 1747 .write_tx_desc = rt2400pci_write_tx_desc,
1744 .write_beacon = rt2400pci_write_beacon, 1748 .write_beacon = rt2400pci_write_beacon,
1745 .fill_rxdone = rt2400pci_fill_rxdone, 1749 .fill_rxdone = rt2400pci_fill_rxdone,
@@ -1801,10 +1805,11 @@ static const struct rt2x00_ops rt2400pci_ops = {
1801 * RT2400pci module information. 1805 * RT2400pci module information.
1802 */ 1806 */
1803static DEFINE_PCI_DEVICE_TABLE(rt2400pci_device_table) = { 1807static DEFINE_PCI_DEVICE_TABLE(rt2400pci_device_table) = {
1804 { PCI_DEVICE(0x1814, 0x0101), PCI_DEVICE_DATA(&rt2400pci_ops) }, 1808 { PCI_DEVICE(0x1814, 0x0101) },
1805 { 0, } 1809 { 0, }
1806}; 1810};
1807 1811
1812
1808MODULE_AUTHOR(DRV_PROJECT); 1813MODULE_AUTHOR(DRV_PROJECT);
1809MODULE_VERSION(DRV_VERSION); 1814MODULE_VERSION(DRV_VERSION);
1810MODULE_DESCRIPTION("Ralink RT2400 PCI & PCMCIA Wireless LAN driver."); 1815MODULE_DESCRIPTION("Ralink RT2400 PCI & PCMCIA Wireless LAN driver.");
@@ -1812,10 +1817,16 @@ MODULE_SUPPORTED_DEVICE("Ralink RT2460 PCI & PCMCIA chipset based cards");
1812MODULE_DEVICE_TABLE(pci, rt2400pci_device_table); 1817MODULE_DEVICE_TABLE(pci, rt2400pci_device_table);
1813MODULE_LICENSE("GPL"); 1818MODULE_LICENSE("GPL");
1814 1819
1820static int rt2400pci_probe(struct pci_dev *pci_dev,
1821 const struct pci_device_id *id)
1822{
1823 return rt2x00pci_probe(pci_dev, &rt2400pci_ops);
1824}
1825
1815static struct pci_driver rt2400pci_driver = { 1826static struct pci_driver rt2400pci_driver = {
1816 .name = KBUILD_MODNAME, 1827 .name = KBUILD_MODNAME,
1817 .id_table = rt2400pci_device_table, 1828 .id_table = rt2400pci_device_table,
1818 .probe = rt2x00pci_probe, 1829 .probe = rt2400pci_probe,
1819 .remove = __devexit_p(rt2x00pci_remove), 1830 .remove = __devexit_p(rt2x00pci_remove),
1820 .suspend = rt2x00pci_suspend, 1831 .suspend = rt2x00pci_suspend,
1821 .resume = rt2x00pci_resume, 1832 .resume = rt2x00pci_resume,
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 198fc0a0d77c..d27d7b8ba3b6 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1446,8 +1446,8 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev,
1446 } 1446 }
1447} 1447}
1448 1448
1449static void rt2500pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, 1449static inline void rt2500pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,
1450 struct rt2x00_field32 irq_field) 1450 struct rt2x00_field32 irq_field)
1451{ 1451{
1452 u32 reg; 1452 u32 reg;
1453 1453
@@ -1687,14 +1687,14 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
1687 * Detect if this device has an hardware controlled radio. 1687 * Detect if this device has an hardware controlled radio.
1688 */ 1688 */
1689 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) 1689 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
1690 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); 1690 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
1691 1691
1692 /* 1692 /*
1693 * Check if the BBP tuning should be enabled. 1693 * Check if the BBP tuning should be enabled.
1694 */ 1694 */
1695 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); 1695 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
1696 if (!rt2x00_get_field16(eeprom, EEPROM_NIC_DYN_BBP_TUNE)) 1696 if (!rt2x00_get_field16(eeprom, EEPROM_NIC_DYN_BBP_TUNE))
1697 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); 1697 __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
1698 1698
1699 /* 1699 /*
1700 * Read the RSSI <-> dBm offset information. 1700 * Read the RSSI <-> dBm offset information.
@@ -1958,9 +1958,9 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1958 /* 1958 /*
1959 * This device requires the atim queue and DMA-mapped skbs. 1959 * This device requires the atim queue and DMA-mapped skbs.
1960 */ 1960 */
1961 __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); 1961 __set_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags);
1962 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); 1962 __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags);
1963 __set_bit(DRIVER_REQUIRE_SW_SEQNO, &rt2x00dev->flags); 1963 __set_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags);
1964 1964
1965 /* 1965 /*
1966 * Set the rssi offset. 1966 * Set the rssi offset.
@@ -2013,6 +2013,9 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = {
2013 .tx_last_beacon = rt2500pci_tx_last_beacon, 2013 .tx_last_beacon = rt2500pci_tx_last_beacon,
2014 .rfkill_poll = rt2x00mac_rfkill_poll, 2014 .rfkill_poll = rt2x00mac_rfkill_poll,
2015 .flush = rt2x00mac_flush, 2015 .flush = rt2x00mac_flush,
2016 .set_antenna = rt2x00mac_set_antenna,
2017 .get_antenna = rt2x00mac_get_antenna,
2018 .get_ringparam = rt2x00mac_get_ringparam,
2016}; 2019};
2017 2020
2018static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { 2021static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
@@ -2033,6 +2036,7 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
2033 .start_queue = rt2500pci_start_queue, 2036 .start_queue = rt2500pci_start_queue,
2034 .kick_queue = rt2500pci_kick_queue, 2037 .kick_queue = rt2500pci_kick_queue,
2035 .stop_queue = rt2500pci_stop_queue, 2038 .stop_queue = rt2500pci_stop_queue,
2039 .flush_queue = rt2x00pci_flush_queue,
2036 .write_tx_desc = rt2500pci_write_tx_desc, 2040 .write_tx_desc = rt2500pci_write_tx_desc,
2037 .write_beacon = rt2500pci_write_beacon, 2041 .write_beacon = rt2500pci_write_beacon,
2038 .fill_rxdone = rt2500pci_fill_rxdone, 2042 .fill_rxdone = rt2500pci_fill_rxdone,
@@ -2094,7 +2098,7 @@ static const struct rt2x00_ops rt2500pci_ops = {
2094 * RT2500pci module information. 2098 * RT2500pci module information.
2095 */ 2099 */
2096static DEFINE_PCI_DEVICE_TABLE(rt2500pci_device_table) = { 2100static DEFINE_PCI_DEVICE_TABLE(rt2500pci_device_table) = {
2097 { PCI_DEVICE(0x1814, 0x0201), PCI_DEVICE_DATA(&rt2500pci_ops) }, 2101 { PCI_DEVICE(0x1814, 0x0201) },
2098 { 0, } 2102 { 0, }
2099}; 2103};
2100 2104
@@ -2105,10 +2109,16 @@ MODULE_SUPPORTED_DEVICE("Ralink RT2560 PCI & PCMCIA chipset based cards");
2105MODULE_DEVICE_TABLE(pci, rt2500pci_device_table); 2109MODULE_DEVICE_TABLE(pci, rt2500pci_device_table);
2106MODULE_LICENSE("GPL"); 2110MODULE_LICENSE("GPL");
2107 2111
2112static int rt2500pci_probe(struct pci_dev *pci_dev,
2113 const struct pci_device_id *id)
2114{
2115 return rt2x00pci_probe(pci_dev, &rt2500pci_ops);
2116}
2117
2108static struct pci_driver rt2500pci_driver = { 2118static struct pci_driver rt2500pci_driver = {
2109 .name = KBUILD_MODNAME, 2119 .name = KBUILD_MODNAME,
2110 .id_table = rt2500pci_device_table, 2120 .id_table = rt2500pci_device_table,
2111 .probe = rt2x00pci_probe, 2121 .probe = rt2500pci_probe,
2112 .remove = __devexit_p(rt2x00pci_remove), 2122 .remove = __devexit_p(rt2x00pci_remove),
2113 .suspend = rt2x00pci_suspend, 2123 .suspend = rt2x00pci_suspend,
2114 .resume = rt2x00pci_resume, 2124 .resume = rt2x00pci_resume,
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index eac788160f55..b21f81231a09 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1519,7 +1519,7 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1519 * Detect if this device has an hardware controlled radio. 1519 * Detect if this device has an hardware controlled radio.
1520 */ 1520 */
1521 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) 1521 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
1522 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); 1522 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
1523 1523
1524 /* 1524 /*
1525 * Read the RSSI <-> dBm offset information. 1525 * Read the RSSI <-> dBm offset information.
@@ -1790,13 +1790,13 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
1790 /* 1790 /*
1791 * This device requires the atim queue 1791 * This device requires the atim queue
1792 */ 1792 */
1793 __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); 1793 __set_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags);
1794 __set_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags); 1794 __set_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags);
1795 if (!modparam_nohwcrypt) { 1795 if (!modparam_nohwcrypt) {
1796 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); 1796 __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
1797 __set_bit(DRIVER_REQUIRE_COPY_IV, &rt2x00dev->flags); 1797 __set_bit(REQUIRE_COPY_IV, &rt2x00dev->cap_flags);
1798 } 1798 }
1799 __set_bit(DRIVER_REQUIRE_SW_SEQNO, &rt2x00dev->flags); 1799 __set_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags);
1800 1800
1801 /* 1801 /*
1802 * Set the rssi offset. 1802 * Set the rssi offset.
@@ -1823,6 +1823,9 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = {
1823 .conf_tx = rt2x00mac_conf_tx, 1823 .conf_tx = rt2x00mac_conf_tx,
1824 .rfkill_poll = rt2x00mac_rfkill_poll, 1824 .rfkill_poll = rt2x00mac_rfkill_poll,
1825 .flush = rt2x00mac_flush, 1825 .flush = rt2x00mac_flush,
1826 .set_antenna = rt2x00mac_set_antenna,
1827 .get_antenna = rt2x00mac_get_antenna,
1828 .get_ringparam = rt2x00mac_get_ringparam,
1826}; 1829};
1827 1830
1828static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { 1831static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
@@ -1904,54 +1907,54 @@ static const struct rt2x00_ops rt2500usb_ops = {
1904 */ 1907 */
1905static struct usb_device_id rt2500usb_device_table[] = { 1908static struct usb_device_id rt2500usb_device_table[] = {
1906 /* ASUS */ 1909 /* ASUS */
1907 { USB_DEVICE(0x0b05, 0x1706), USB_DEVICE_DATA(&rt2500usb_ops) }, 1910 { USB_DEVICE(0x0b05, 0x1706) },
1908 { USB_DEVICE(0x0b05, 0x1707), USB_DEVICE_DATA(&rt2500usb_ops) }, 1911 { USB_DEVICE(0x0b05, 0x1707) },
1909 /* Belkin */ 1912 /* Belkin */
1910 { USB_DEVICE(0x050d, 0x7050), USB_DEVICE_DATA(&rt2500usb_ops) }, 1913 { USB_DEVICE(0x050d, 0x7050) },
1911 { USB_DEVICE(0x050d, 0x7051), USB_DEVICE_DATA(&rt2500usb_ops) }, 1914 { USB_DEVICE(0x050d, 0x7051) },
1912 /* Cisco Systems */ 1915 /* Cisco Systems */
1913 { USB_DEVICE(0x13b1, 0x000d), USB_DEVICE_DATA(&rt2500usb_ops) }, 1916 { USB_DEVICE(0x13b1, 0x000d) },
1914 { USB_DEVICE(0x13b1, 0x0011), USB_DEVICE_DATA(&rt2500usb_ops) }, 1917 { USB_DEVICE(0x13b1, 0x0011) },
1915 { USB_DEVICE(0x13b1, 0x001a), USB_DEVICE_DATA(&rt2500usb_ops) }, 1918 { USB_DEVICE(0x13b1, 0x001a) },
1916 /* Conceptronic */ 1919 /* Conceptronic */
1917 { USB_DEVICE(0x14b2, 0x3c02), USB_DEVICE_DATA(&rt2500usb_ops) }, 1920 { USB_DEVICE(0x14b2, 0x3c02) },
1918 /* D-LINK */ 1921 /* D-LINK */
1919 { USB_DEVICE(0x2001, 0x3c00), USB_DEVICE_DATA(&rt2500usb_ops) }, 1922 { USB_DEVICE(0x2001, 0x3c00) },
1920 /* Gigabyte */ 1923 /* Gigabyte */
1921 { USB_DEVICE(0x1044, 0x8001), USB_DEVICE_DATA(&rt2500usb_ops) }, 1924 { USB_DEVICE(0x1044, 0x8001) },
1922 { USB_DEVICE(0x1044, 0x8007), USB_DEVICE_DATA(&rt2500usb_ops) }, 1925 { USB_DEVICE(0x1044, 0x8007) },
1923 /* Hercules */ 1926 /* Hercules */
1924 { USB_DEVICE(0x06f8, 0xe000), USB_DEVICE_DATA(&rt2500usb_ops) }, 1927 { USB_DEVICE(0x06f8, 0xe000) },
1925 /* Melco */ 1928 /* Melco */
1926 { USB_DEVICE(0x0411, 0x005e), USB_DEVICE_DATA(&rt2500usb_ops) }, 1929 { USB_DEVICE(0x0411, 0x005e) },
1927 { USB_DEVICE(0x0411, 0x0066), USB_DEVICE_DATA(&rt2500usb_ops) }, 1930 { USB_DEVICE(0x0411, 0x0066) },
1928 { USB_DEVICE(0x0411, 0x0067), USB_DEVICE_DATA(&rt2500usb_ops) }, 1931 { USB_DEVICE(0x0411, 0x0067) },
1929 { USB_DEVICE(0x0411, 0x008b), USB_DEVICE_DATA(&rt2500usb_ops) }, 1932 { USB_DEVICE(0x0411, 0x008b) },
1930 { USB_DEVICE(0x0411, 0x0097), USB_DEVICE_DATA(&rt2500usb_ops) }, 1933 { USB_DEVICE(0x0411, 0x0097) },
1931 /* MSI */ 1934 /* MSI */
1932 { USB_DEVICE(0x0db0, 0x6861), USB_DEVICE_DATA(&rt2500usb_ops) }, 1935 { USB_DEVICE(0x0db0, 0x6861) },
1933 { USB_DEVICE(0x0db0, 0x6865), USB_DEVICE_DATA(&rt2500usb_ops) }, 1936 { USB_DEVICE(0x0db0, 0x6865) },
1934 { USB_DEVICE(0x0db0, 0x6869), USB_DEVICE_DATA(&rt2500usb_ops) }, 1937 { USB_DEVICE(0x0db0, 0x6869) },
1935 /* Ralink */ 1938 /* Ralink */
1936 { USB_DEVICE(0x148f, 0x1706), USB_DEVICE_DATA(&rt2500usb_ops) }, 1939 { USB_DEVICE(0x148f, 0x1706) },
1937 { USB_DEVICE(0x148f, 0x2570), USB_DEVICE_DATA(&rt2500usb_ops) }, 1940 { USB_DEVICE(0x148f, 0x2570) },
1938 { USB_DEVICE(0x148f, 0x9020), USB_DEVICE_DATA(&rt2500usb_ops) }, 1941 { USB_DEVICE(0x148f, 0x9020) },
1939 /* Sagem */ 1942 /* Sagem */
1940 { USB_DEVICE(0x079b, 0x004b), USB_DEVICE_DATA(&rt2500usb_ops) }, 1943 { USB_DEVICE(0x079b, 0x004b) },
1941 /* Siemens */ 1944 /* Siemens */
1942 { USB_DEVICE(0x0681, 0x3c06), USB_DEVICE_DATA(&rt2500usb_ops) }, 1945 { USB_DEVICE(0x0681, 0x3c06) },
1943 /* SMC */ 1946 /* SMC */
1944 { USB_DEVICE(0x0707, 0xee13), USB_DEVICE_DATA(&rt2500usb_ops) }, 1947 { USB_DEVICE(0x0707, 0xee13) },
1945 /* Spairon */ 1948 /* Spairon */
1946 { USB_DEVICE(0x114b, 0x0110), USB_DEVICE_DATA(&rt2500usb_ops) }, 1949 { USB_DEVICE(0x114b, 0x0110) },
1947 /* SURECOM */ 1950 /* SURECOM */
1948 { USB_DEVICE(0x0769, 0x11f3), USB_DEVICE_DATA(&rt2500usb_ops) }, 1951 { USB_DEVICE(0x0769, 0x11f3) },
1949 /* Trust */ 1952 /* Trust */
1950 { USB_DEVICE(0x0eb0, 0x9020), USB_DEVICE_DATA(&rt2500usb_ops) }, 1953 { USB_DEVICE(0x0eb0, 0x9020) },
1951 /* VTech */ 1954 /* VTech */
1952 { USB_DEVICE(0x0f88, 0x3012), USB_DEVICE_DATA(&rt2500usb_ops) }, 1955 { USB_DEVICE(0x0f88, 0x3012) },
1953 /* Zinwell */ 1956 /* Zinwell */
1954 { USB_DEVICE(0x5a57, 0x0260), USB_DEVICE_DATA(&rt2500usb_ops) }, 1957 { USB_DEVICE(0x5a57, 0x0260) },
1955 { 0, } 1958 { 0, }
1956}; 1959};
1957 1960
@@ -1962,10 +1965,16 @@ MODULE_SUPPORTED_DEVICE("Ralink RT2570 USB chipset based cards");
1962MODULE_DEVICE_TABLE(usb, rt2500usb_device_table); 1965MODULE_DEVICE_TABLE(usb, rt2500usb_device_table);
1963MODULE_LICENSE("GPL"); 1966MODULE_LICENSE("GPL");
1964 1967
1968static int rt2500usb_probe(struct usb_interface *usb_intf,
1969 const struct usb_device_id *id)
1970{
1971 return rt2x00usb_probe(usb_intf, &rt2500usb_ops);
1972}
1973
1965static struct usb_driver rt2500usb_driver = { 1974static struct usb_driver rt2500usb_driver = {
1966 .name = KBUILD_MODNAME, 1975 .name = KBUILD_MODNAME,
1967 .id_table = rt2500usb_device_table, 1976 .id_table = rt2500usb_device_table,
1968 .probe = rt2x00usb_probe, 1977 .probe = rt2500usb_probe,
1969 .disconnect = rt2x00usb_disconnect, 1978 .disconnect = rt2x00usb_disconnect,
1970 .suspend = rt2x00usb_suspend, 1979 .suspend = rt2x00usb_suspend,
1971 .resume = rt2x00usb_resume, 1980 .resume = rt2x00usb_resume,
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 6331c61957a3..5cd096e2ae36 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -730,34 +730,20 @@ void rt2800_txdone(struct rt2x00_dev *rt2x00dev)
730 struct data_queue *queue; 730 struct data_queue *queue;
731 struct queue_entry *entry; 731 struct queue_entry *entry;
732 u32 reg; 732 u32 reg;
733 u8 pid; 733 u8 qid;
734 int i;
735 734
736 /* 735 while (kfifo_get(&rt2x00dev->txstatus_fifo, &reg)) {
737 * TX_STA_FIFO is a stack of X entries, hence read TX_STA_FIFO
738 * at most X times and also stop processing once the TX_STA_FIFO_VALID
739 * flag is not set anymore.
740 *
741 * The legacy drivers use X=TX_RING_SIZE but state in a comment
742 * that the TX_STA_FIFO stack has a size of 16. We stick to our
743 * tx ring size for now.
744 */
745 for (i = 0; i < rt2x00dev->ops->tx->entry_num; i++) {
746 rt2800_register_read(rt2x00dev, TX_STA_FIFO, &reg);
747 if (!rt2x00_get_field32(reg, TX_STA_FIFO_VALID))
748 break;
749 736
750 /* 737 /* TX_STA_FIFO_PID_QUEUE is a 2-bit field, thus
751 * Skip this entry when it contains an invalid 738 * qid is guaranteed to be one of the TX QIDs
752 * queue identication number.
753 */ 739 */
754 pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_QUEUE); 740 qid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_QUEUE);
755 if (pid >= QID_RX) 741 queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);
756 continue; 742 if (unlikely(!queue)) {
757 743 WARNING(rt2x00dev, "Got TX status for an unavailable "
758 queue = rt2x00queue_get_tx_queue(rt2x00dev, pid); 744 "queue %u, dropping\n", qid);
759 if (unlikely(!queue))
760 continue; 745 continue;
746 }
761 747
762 /* 748 /*
763 * Inside each queue, we process each entry in a chronological 749 * Inside each queue, we process each entry in a chronological
@@ -949,25 +935,49 @@ static void rt2800_brightness_set(struct led_classdev *led_cdev,
949 unsigned int ledmode = 935 unsigned int ledmode =
950 rt2x00_get_field16(led->rt2x00dev->led_mcu_reg, 936 rt2x00_get_field16(led->rt2x00dev->led_mcu_reg,
951 EEPROM_FREQ_LED_MODE); 937 EEPROM_FREQ_LED_MODE);
938 u32 reg;
952 939
953 if (led->type == LED_TYPE_RADIO) { 940 /* Check for SoC (SOC devices don't support MCU requests) */
954 rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode, 941 if (rt2x00_is_soc(led->rt2x00dev)) {
955 enabled ? 0x20 : 0); 942 rt2800_register_read(led->rt2x00dev, LED_CFG, &reg);
956 } else if (led->type == LED_TYPE_ASSOC) { 943
957 rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode, 944 /* Set LED Polarity */
958 enabled ? (bg_mode ? 0x60 : 0xa0) : 0x20); 945 rt2x00_set_field32(&reg, LED_CFG_LED_POLAR, polarity);
959 } else if (led->type == LED_TYPE_QUALITY) { 946
960 /* 947 /* Set LED Mode */
961 * The brightness is divided into 6 levels (0 - 5), 948 if (led->type == LED_TYPE_RADIO) {
962 * The specs tell us the following levels: 949 rt2x00_set_field32(&reg, LED_CFG_G_LED_MODE,
963 * 0, 1 ,3, 7, 15, 31 950 enabled ? 3 : 0);
964 * to determine the level in a simple way we can simply 951 } else if (led->type == LED_TYPE_ASSOC) {
965 * work with bitshifting: 952 rt2x00_set_field32(&reg, LED_CFG_Y_LED_MODE,
966 * (1 << level) - 1 953 enabled ? 3 : 0);
967 */ 954 } else if (led->type == LED_TYPE_QUALITY) {
968 rt2800_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff, 955 rt2x00_set_field32(&reg, LED_CFG_R_LED_MODE,
969 (1 << brightness / (LED_FULL / 6)) - 1, 956 enabled ? 3 : 0);
970 polarity); 957 }
958
959 rt2800_register_write(led->rt2x00dev, LED_CFG, reg);
960
961 } else {
962 if (led->type == LED_TYPE_RADIO) {
963 rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode,
964 enabled ? 0x20 : 0);
965 } else if (led->type == LED_TYPE_ASSOC) {
966 rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode,
967 enabled ? (bg_mode ? 0x60 : 0xa0) : 0x20);
968 } else if (led->type == LED_TYPE_QUALITY) {
969 /*
970 * The brightness is divided into 6 levels (0 - 5),
971 * The specs tell us the following levels:
972 * 0, 1 ,3, 7, 15, 31
973 * to determine the level in a simple way we can simply
974 * work with bitshifting:
975 * (1 << level) - 1
976 */
977 rt2800_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff,
978 (1 << brightness / (LED_FULL / 6)) - 1,
979 polarity);
980 }
971 } 981 }
972} 982}
973 983
@@ -1221,6 +1231,25 @@ void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf,
1221 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg); 1231 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
1222 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_SYNC, conf->sync); 1232 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_SYNC, conf->sync);
1223 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); 1233 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
1234
1235 if (conf->sync == TSF_SYNC_AP_NONE) {
1236 /*
1237 * Tune beacon queue transmit parameters for AP mode
1238 */
1239 rt2800_register_read(rt2x00dev, TBTT_SYNC_CFG, &reg);
1240 rt2x00_set_field32(&reg, TBTT_SYNC_CFG_BCN_CWMIN, 0);
1241 rt2x00_set_field32(&reg, TBTT_SYNC_CFG_BCN_AIFSN, 1);
1242 rt2x00_set_field32(&reg, TBTT_SYNC_CFG_BCN_EXP_WIN, 32);
1243 rt2x00_set_field32(&reg, TBTT_SYNC_CFG_TBTT_ADJUST, 0);
1244 rt2800_register_write(rt2x00dev, TBTT_SYNC_CFG, reg);
1245 } else {
1246 rt2800_register_read(rt2x00dev, TBTT_SYNC_CFG, &reg);
1247 rt2x00_set_field32(&reg, TBTT_SYNC_CFG_BCN_CWMIN, 4);
1248 rt2x00_set_field32(&reg, TBTT_SYNC_CFG_BCN_AIFSN, 2);
1249 rt2x00_set_field32(&reg, TBTT_SYNC_CFG_BCN_EXP_WIN, 32);
1250 rt2x00_set_field32(&reg, TBTT_SYNC_CFG_TBTT_ADJUST, 16);
1251 rt2800_register_write(rt2x00dev, TBTT_SYNC_CFG, reg);
1252 }
1224 } 1253 }
1225 1254
1226 if (flags & CONFIG_UPDATE_MAC) { 1255 if (flags & CONFIG_UPDATE_MAC) {
@@ -1739,8 +1768,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
1739 1768
1740 if (rf->channel <= 14) { 1769 if (rf->channel <= 14) {
1741 if (!rt2x00_rt(rt2x00dev, RT5390)) { 1770 if (!rt2x00_rt(rt2x00dev, RT5390)) {
1742 if (test_bit(CONFIG_EXTERNAL_LNA_BG, 1771 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG,
1743 &rt2x00dev->flags)) { 1772 &rt2x00dev->cap_flags)) {
1744 rt2800_bbp_write(rt2x00dev, 82, 0x62); 1773 rt2800_bbp_write(rt2x00dev, 82, 0x62);
1745 rt2800_bbp_write(rt2x00dev, 75, 0x46); 1774 rt2800_bbp_write(rt2x00dev, 75, 0x46);
1746 } else { 1775 } else {
@@ -1751,7 +1780,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
1751 } else { 1780 } else {
1752 rt2800_bbp_write(rt2x00dev, 82, 0xf2); 1781 rt2800_bbp_write(rt2x00dev, 82, 0xf2);
1753 1782
1754 if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) 1783 if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags))
1755 rt2800_bbp_write(rt2x00dev, 75, 0x46); 1784 rt2800_bbp_write(rt2x00dev, 75, 0x46);
1756 else 1785 else
1757 rt2800_bbp_write(rt2x00dev, 75, 0x50); 1786 rt2800_bbp_write(rt2x00dev, 75, 0x50);
@@ -1984,7 +2013,7 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
1984 if (!((band == IEEE80211_BAND_5GHZ) && is_rate_b)) 2013 if (!((band == IEEE80211_BAND_5GHZ) && is_rate_b))
1985 return txpower; 2014 return txpower;
1986 2015
1987 if (test_bit(CONFIG_SUPPORT_POWER_LIMIT, &rt2x00dev->flags)) { 2016 if (test_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags)) {
1988 /* 2017 /*
1989 * Check if eirp txpower exceed txpower_limit. 2018 * Check if eirp txpower exceed txpower_limit.
1990 * We use OFDM 6M as criterion and its eirp txpower 2019 * We use OFDM 6M as criterion and its eirp txpower
@@ -2384,7 +2413,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
2384 } else if (rt2800_is_305x_soc(rt2x00dev)) { 2413 } else if (rt2800_is_305x_soc(rt2x00dev)) {
2385 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); 2414 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400);
2386 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); 2415 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
2387 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x0000001f); 2416 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000030);
2388 } else if (rt2x00_rt(rt2x00dev, RT5390)) { 2417 } else if (rt2x00_rt(rt2x00dev, RT5390)) {
2389 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); 2418 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
2390 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); 2419 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
@@ -3285,8 +3314,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
3285 rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || 3314 rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
3286 rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || 3315 rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
3287 rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { 3316 rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) {
3288 if (!test_bit(CONFIG_EXTERNAL_LNA_BG, 3317 if (!test_bit(CAPABILITY_EXTERNAL_LNA_BG,
3289 &rt2x00dev->flags)) 3318 &rt2x00dev->cap_flags))
3290 rt2x00_set_field8(&rfcsr, RFCSR17_R, 1); 3319 rt2x00_set_field8(&rfcsr, RFCSR17_R, 1);
3291 } 3320 }
3292 rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &eeprom); 3321 rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &eeprom);
@@ -3709,15 +3738,15 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
3709 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); 3738 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
3710 3739
3711 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G)) 3740 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G))
3712 __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); 3741 __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
3713 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G)) 3742 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G))
3714 __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); 3743 __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
3715 3744
3716 /* 3745 /*
3717 * Detect if this device has an hardware controlled radio. 3746 * Detect if this device has an hardware controlled radio.
3718 */ 3747 */
3719 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_HW_RADIO)) 3748 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_HW_RADIO))
3720 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); 3749 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
3721 3750
3722 /* 3751 /*
3723 * Store led settings, for correct led behaviour. 3752 * Store led settings, for correct led behaviour.
@@ -3737,7 +3766,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
3737 3766
3738 if (rt2x00_get_field16(eeprom, EEPROM_EIRP_MAX_TX_POWER_2GHZ) < 3767 if (rt2x00_get_field16(eeprom, EEPROM_EIRP_MAX_TX_POWER_2GHZ) <
3739 EIRP_MAX_TX_POWER_LIMIT) 3768 EIRP_MAX_TX_POWER_LIMIT)
3740 __set_bit(CONFIG_SUPPORT_POWER_LIMIT, &rt2x00dev->flags); 3769 __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
3741 3770
3742 return 0; 3771 return 0;
3743} 3772}
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index adc3534254df..08d3947fcb26 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -66,7 +66,7 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)
66 return; 66 return;
67 67
68 for (i = 0; i < 200; i++) { 68 for (i = 0; i < 200; i++) {
69 rt2800_register_read(rt2x00dev, H2M_MAILBOX_CID, &reg); 69 rt2x00pci_register_read(rt2x00dev, H2M_MAILBOX_CID, &reg);
70 70
71 if ((rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD0) == token) || 71 if ((rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD0) == token) ||
72 (rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD1) == token) || 72 (rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD1) == token) ||
@@ -80,8 +80,8 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)
80 if (i == 200) 80 if (i == 200)
81 ERROR(rt2x00dev, "MCU request failed, no response from hardware\n"); 81 ERROR(rt2x00dev, "MCU request failed, no response from hardware\n");
82 82
83 rt2800_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); 83 rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);
84 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); 84 rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
85} 85}
86 86
87#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) 87#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X)
@@ -105,7 +105,7 @@ static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom)
105 struct rt2x00_dev *rt2x00dev = eeprom->data; 105 struct rt2x00_dev *rt2x00dev = eeprom->data;
106 u32 reg; 106 u32 reg;
107 107
108 rt2800_register_read(rt2x00dev, E2PROM_CSR, &reg); 108 rt2x00pci_register_read(rt2x00dev, E2PROM_CSR, &reg);
109 109
110 eeprom->reg_data_in = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_IN); 110 eeprom->reg_data_in = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_IN);
111 eeprom->reg_data_out = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_OUT); 111 eeprom->reg_data_out = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_OUT);
@@ -127,7 +127,7 @@ static void rt2800pci_eepromregister_write(struct eeprom_93cx6 *eeprom)
127 rt2x00_set_field32(&reg, E2PROM_CSR_CHIP_SELECT, 127 rt2x00_set_field32(&reg, E2PROM_CSR_CHIP_SELECT,
128 !!eeprom->reg_chip_select); 128 !!eeprom->reg_chip_select);
129 129
130 rt2800_register_write(rt2x00dev, E2PROM_CSR, reg); 130 rt2x00pci_register_write(rt2x00dev, E2PROM_CSR, reg);
131} 131}
132 132
133static void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) 133static void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
@@ -135,7 +135,7 @@ static void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
135 struct eeprom_93cx6 eeprom; 135 struct eeprom_93cx6 eeprom;
136 u32 reg; 136 u32 reg;
137 137
138 rt2800_register_read(rt2x00dev, E2PROM_CSR, &reg); 138 rt2x00pci_register_read(rt2x00dev, E2PROM_CSR, &reg);
139 139
140 eeprom.data = rt2x00dev; 140 eeprom.data = rt2x00dev;
141 eeprom.register_read = rt2800pci_eepromregister_read; 141 eeprom.register_read = rt2800pci_eepromregister_read;
@@ -195,9 +195,9 @@ static void rt2800pci_start_queue(struct data_queue *queue)
195 195
196 switch (queue->qid) { 196 switch (queue->qid) {
197 case QID_RX: 197 case QID_RX:
198 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); 198 rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
199 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 1); 199 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 1);
200 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 200 rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
201 break; 201 break;
202 case QID_BEACON: 202 case QID_BEACON:
203 /* 203 /*
@@ -207,15 +207,15 @@ static void rt2800pci_start_queue(struct data_queue *queue)
207 tasklet_enable(&rt2x00dev->tbtt_tasklet); 207 tasklet_enable(&rt2x00dev->tbtt_tasklet);
208 tasklet_enable(&rt2x00dev->pretbtt_tasklet); 208 tasklet_enable(&rt2x00dev->pretbtt_tasklet);
209 209
210 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg); 210 rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
211 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 1); 211 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 1);
212 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 1); 212 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 1);
213 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1); 213 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1);
214 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); 214 rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg);
215 215
216 rt2800_register_read(rt2x00dev, INT_TIMER_EN, &reg); 216 rt2x00pci_register_read(rt2x00dev, INT_TIMER_EN, &reg);
217 rt2x00_set_field32(&reg, INT_TIMER_EN_PRE_TBTT_TIMER, 1); 217 rt2x00_set_field32(&reg, INT_TIMER_EN_PRE_TBTT_TIMER, 1);
218 rt2800_register_write(rt2x00dev, INT_TIMER_EN, reg); 218 rt2x00pci_register_write(rt2x00dev, INT_TIMER_EN, reg);
219 break; 219 break;
220 default: 220 default:
221 break; 221 break;
@@ -233,11 +233,13 @@ static void rt2800pci_kick_queue(struct data_queue *queue)
233 case QID_AC_BE: 233 case QID_AC_BE:
234 case QID_AC_BK: 234 case QID_AC_BK:
235 entry = rt2x00queue_get_entry(queue, Q_INDEX); 235 entry = rt2x00queue_get_entry(queue, Q_INDEX);
236 rt2800_register_write(rt2x00dev, TX_CTX_IDX(queue->qid), entry->entry_idx); 236 rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX(queue->qid),
237 entry->entry_idx);
237 break; 238 break;
238 case QID_MGMT: 239 case QID_MGMT:
239 entry = rt2x00queue_get_entry(queue, Q_INDEX); 240 entry = rt2x00queue_get_entry(queue, Q_INDEX);
240 rt2800_register_write(rt2x00dev, TX_CTX_IDX(5), entry->entry_idx); 241 rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX(5),
242 entry->entry_idx);
241 break; 243 break;
242 default: 244 default:
243 break; 245 break;
@@ -251,20 +253,20 @@ static void rt2800pci_stop_queue(struct data_queue *queue)
251 253
252 switch (queue->qid) { 254 switch (queue->qid) {
253 case QID_RX: 255 case QID_RX:
254 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); 256 rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
255 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0); 257 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0);
256 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 258 rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
257 break; 259 break;
258 case QID_BEACON: 260 case QID_BEACON:
259 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg); 261 rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
260 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 0); 262 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 0);
261 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 0); 263 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 0);
262 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0); 264 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
263 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); 265 rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg);
264 266
265 rt2800_register_read(rt2x00dev, INT_TIMER_EN, &reg); 267 rt2x00pci_register_read(rt2x00dev, INT_TIMER_EN, &reg);
266 rt2x00_set_field32(&reg, INT_TIMER_EN_PRE_TBTT_TIMER, 0); 268 rt2x00_set_field32(&reg, INT_TIMER_EN_PRE_TBTT_TIMER, 0);
267 rt2800_register_write(rt2x00dev, INT_TIMER_EN, reg); 269 rt2x00pci_register_write(rt2x00dev, INT_TIMER_EN, reg);
268 270
269 /* 271 /*
270 * Wait for tbtt tasklets to finish. 272 * Wait for tbtt tasklets to finish.
@@ -295,7 +297,7 @@ static int rt2800pci_write_firmware(struct rt2x00_dev *rt2x00dev,
295 */ 297 */
296 reg = 0; 298 reg = 0;
297 rt2x00_set_field32(&reg, PBF_SYS_CTRL_HOST_RAM_WRITE, 1); 299 rt2x00_set_field32(&reg, PBF_SYS_CTRL_HOST_RAM_WRITE, 1);
298 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, reg); 300 rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, reg);
299 301
300 /* 302 /*
301 * Write firmware to device. 303 * Write firmware to device.
@@ -303,11 +305,11 @@ static int rt2800pci_write_firmware(struct rt2x00_dev *rt2x00dev,
303 rt2800_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, 305 rt2800_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
304 data, len); 306 data, len);
305 307
306 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000); 308 rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000);
307 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001); 309 rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001);
308 310
309 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); 311 rt2x00pci_register_write(rt2x00dev, H2M_BBP_AGENT, 0);
310 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); 312 rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
311 313
312 return 0; 314 return 0;
313} 315}
@@ -351,7 +353,7 @@ static void rt2800pci_clear_entry(struct queue_entry *entry)
351 * Set RX IDX in register to inform hardware that we have 353 * Set RX IDX in register to inform hardware that we have
352 * handled this entry and it is available for reuse again. 354 * handled this entry and it is available for reuse again.
353 */ 355 */
354 rt2800_register_write(rt2x00dev, RX_CRX_IDX, 356 rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX,
355 entry->entry_idx); 357 entry->entry_idx);
356 } else { 358 } else {
357 rt2x00_desc_read(entry_priv->desc, 1, &word); 359 rt2x00_desc_read(entry_priv->desc, 1, &word);
@@ -369,45 +371,51 @@ static int rt2800pci_init_queues(struct rt2x00_dev *rt2x00dev)
369 * Initialize registers. 371 * Initialize registers.
370 */ 372 */
371 entry_priv = rt2x00dev->tx[0].entries[0].priv_data; 373 entry_priv = rt2x00dev->tx[0].entries[0].priv_data;
372 rt2800_register_write(rt2x00dev, TX_BASE_PTR0, entry_priv->desc_dma); 374 rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR0, entry_priv->desc_dma);
373 rt2800_register_write(rt2x00dev, TX_MAX_CNT0, rt2x00dev->tx[0].limit); 375 rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT0,
374 rt2800_register_write(rt2x00dev, TX_CTX_IDX0, 0); 376 rt2x00dev->tx[0].limit);
375 rt2800_register_write(rt2x00dev, TX_DTX_IDX0, 0); 377 rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX0, 0);
378 rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX0, 0);
376 379
377 entry_priv = rt2x00dev->tx[1].entries[0].priv_data; 380 entry_priv = rt2x00dev->tx[1].entries[0].priv_data;
378 rt2800_register_write(rt2x00dev, TX_BASE_PTR1, entry_priv->desc_dma); 381 rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR1, entry_priv->desc_dma);
379 rt2800_register_write(rt2x00dev, TX_MAX_CNT1, rt2x00dev->tx[1].limit); 382 rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT1,
380 rt2800_register_write(rt2x00dev, TX_CTX_IDX1, 0); 383 rt2x00dev->tx[1].limit);
381 rt2800_register_write(rt2x00dev, TX_DTX_IDX1, 0); 384 rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX1, 0);
385 rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX1, 0);
382 386
383 entry_priv = rt2x00dev->tx[2].entries[0].priv_data; 387 entry_priv = rt2x00dev->tx[2].entries[0].priv_data;
384 rt2800_register_write(rt2x00dev, TX_BASE_PTR2, entry_priv->desc_dma); 388 rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR2, entry_priv->desc_dma);
385 rt2800_register_write(rt2x00dev, TX_MAX_CNT2, rt2x00dev->tx[2].limit); 389 rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT2,
386 rt2800_register_write(rt2x00dev, TX_CTX_IDX2, 0); 390 rt2x00dev->tx[2].limit);
387 rt2800_register_write(rt2x00dev, TX_DTX_IDX2, 0); 391 rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX2, 0);
392 rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX2, 0);
388 393
389 entry_priv = rt2x00dev->tx[3].entries[0].priv_data; 394 entry_priv = rt2x00dev->tx[3].entries[0].priv_data;
390 rt2800_register_write(rt2x00dev, TX_BASE_PTR3, entry_priv->desc_dma); 395 rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR3, entry_priv->desc_dma);
391 rt2800_register_write(rt2x00dev, TX_MAX_CNT3, rt2x00dev->tx[3].limit); 396 rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT3,
392 rt2800_register_write(rt2x00dev, TX_CTX_IDX3, 0); 397 rt2x00dev->tx[3].limit);
393 rt2800_register_write(rt2x00dev, TX_DTX_IDX3, 0); 398 rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX3, 0);
399 rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX3, 0);
394 400
395 entry_priv = rt2x00dev->rx->entries[0].priv_data; 401 entry_priv = rt2x00dev->rx->entries[0].priv_data;
396 rt2800_register_write(rt2x00dev, RX_BASE_PTR, entry_priv->desc_dma); 402 rt2x00pci_register_write(rt2x00dev, RX_BASE_PTR, entry_priv->desc_dma);
397 rt2800_register_write(rt2x00dev, RX_MAX_CNT, rt2x00dev->rx[0].limit); 403 rt2x00pci_register_write(rt2x00dev, RX_MAX_CNT,
398 rt2800_register_write(rt2x00dev, RX_CRX_IDX, rt2x00dev->rx[0].limit - 1); 404 rt2x00dev->rx[0].limit);
399 rt2800_register_write(rt2x00dev, RX_DRX_IDX, 0); 405 rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX,
406 rt2x00dev->rx[0].limit - 1);
407 rt2x00pci_register_write(rt2x00dev, RX_DRX_IDX, 0);
400 408
401 /* 409 /*
402 * Enable global DMA configuration 410 * Enable global DMA configuration
403 */ 411 */
404 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg); 412 rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
405 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0); 413 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
406 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0); 414 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
407 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); 415 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
408 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); 416 rt2x00pci_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
409 417
410 rt2800_register_write(rt2x00dev, DELAY_INT_CFG, 0); 418 rt2x00pci_register_write(rt2x00dev, DELAY_INT_CFG, 0);
411 419
412 return 0; 420 return 0;
413} 421}
@@ -427,8 +435,8 @@ static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev,
427 * should clear the register to assure a clean state. 435 * should clear the register to assure a clean state.
428 */ 436 */
429 if (state == STATE_RADIO_IRQ_ON) { 437 if (state == STATE_RADIO_IRQ_ON) {
430 rt2800_register_read(rt2x00dev, INT_SOURCE_CSR, &reg); 438 rt2x00pci_register_read(rt2x00dev, INT_SOURCE_CSR, &reg);
431 rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, reg); 439 rt2x00pci_register_write(rt2x00dev, INT_SOURCE_CSR, reg);
432 440
433 /* 441 /*
434 * Enable tasklets. The beacon related tasklets are 442 * Enable tasklets. The beacon related tasklets are
@@ -440,7 +448,7 @@ static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev,
440 } 448 }
441 449
442 spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); 450 spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags);
443 rt2800_register_read(rt2x00dev, INT_MASK_CSR, &reg); 451 rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, &reg);
444 rt2x00_set_field32(&reg, INT_MASK_CSR_RXDELAYINT, 0); 452 rt2x00_set_field32(&reg, INT_MASK_CSR_RXDELAYINT, 0);
445 rt2x00_set_field32(&reg, INT_MASK_CSR_TXDELAYINT, 0); 453 rt2x00_set_field32(&reg, INT_MASK_CSR_TXDELAYINT, 0);
446 rt2x00_set_field32(&reg, INT_MASK_CSR_RX_DONE, mask); 454 rt2x00_set_field32(&reg, INT_MASK_CSR_RX_DONE, mask);
@@ -459,7 +467,7 @@ static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev,
459 rt2x00_set_field32(&reg, INT_MASK_CSR_GPTIMER, 0); 467 rt2x00_set_field32(&reg, INT_MASK_CSR_GPTIMER, 0);
460 rt2x00_set_field32(&reg, INT_MASK_CSR_RX_COHERENT, 0); 468 rt2x00_set_field32(&reg, INT_MASK_CSR_RX_COHERENT, 0);
461 rt2x00_set_field32(&reg, INT_MASK_CSR_TX_COHERENT, 0); 469 rt2x00_set_field32(&reg, INT_MASK_CSR_TX_COHERENT, 0);
462 rt2800_register_write(rt2x00dev, INT_MASK_CSR, reg); 470 rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg);
463 spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); 471 spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags);
464 472
465 if (state == STATE_RADIO_IRQ_OFF) { 473 if (state == STATE_RADIO_IRQ_OFF) {
@@ -480,7 +488,7 @@ static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev)
480 /* 488 /*
481 * Reset DMA indexes 489 * Reset DMA indexes
482 */ 490 */
483 rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, &reg); 491 rt2x00pci_register_read(rt2x00dev, WPDMA_RST_IDX, &reg);
484 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX0, 1); 492 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX0, 1);
485 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX1, 1); 493 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX1, 1);
486 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX2, 1); 494 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX2, 1);
@@ -488,26 +496,26 @@ static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev)
488 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX4, 1); 496 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX4, 1);
489 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX5, 1); 497 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX5, 1);
490 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DRX_IDX0, 1); 498 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DRX_IDX0, 1);
491 rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg); 499 rt2x00pci_register_write(rt2x00dev, WPDMA_RST_IDX, reg);
492 500
493 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f); 501 rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f);
494 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00); 502 rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00);
495 503
496 if (rt2x00_rt(rt2x00dev, RT5390)) { 504 if (rt2x00_rt(rt2x00dev, RT5390)) {
497 rt2800_register_read(rt2x00dev, AUX_CTRL, &reg); 505 rt2x00pci_register_read(rt2x00dev, AUX_CTRL, &reg);
498 rt2x00_set_field32(&reg, AUX_CTRL_FORCE_PCIE_CLK, 1); 506 rt2x00_set_field32(&reg, AUX_CTRL_FORCE_PCIE_CLK, 1);
499 rt2x00_set_field32(&reg, AUX_CTRL_WAKE_PCIE_EN, 1); 507 rt2x00_set_field32(&reg, AUX_CTRL_WAKE_PCIE_EN, 1);
500 rt2800_register_write(rt2x00dev, AUX_CTRL, reg); 508 rt2x00pci_register_write(rt2x00dev, AUX_CTRL, reg);
501 } 509 }
502 510
503 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); 511 rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
504 512
505 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); 513 rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
506 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1); 514 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
507 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1); 515 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
508 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 516 rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
509 517
510 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000); 518 rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000);
511 519
512 return 0; 520 return 0;
513} 521}
@@ -525,8 +533,8 @@ static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev)
525{ 533{
526 if (rt2x00_is_soc(rt2x00dev)) { 534 if (rt2x00_is_soc(rt2x00dev)) {
527 rt2800_disable_radio(rt2x00dev); 535 rt2800_disable_radio(rt2x00dev);
528 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0); 536 rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0);
529 rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0); 537 rt2x00pci_register_write(rt2x00dev, TX_PIN_CFG, 0);
530 } 538 }
531} 539}
532 540
@@ -537,8 +545,10 @@ static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev,
537 rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKUP, 0, 0x02); 545 rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKUP, 0, 0x02);
538 rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKUP); 546 rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKUP);
539 } else if (state == STATE_SLEEP) { 547 } else if (state == STATE_SLEEP) {
540 rt2800_register_write(rt2x00dev, H2M_MAILBOX_STATUS, 0xffffffff); 548 rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_STATUS,
541 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, 0xffffffff); 549 0xffffffff);
550 rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID,
551 0xffffffff);
542 rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0x01, 0xff, 0x01); 552 rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0x01, 0xff, 0x01);
543 } 553 }
544 554
@@ -768,8 +778,8 @@ static bool rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
768 return !max_tx_done; 778 return !max_tx_done;
769} 779}
770 780
771static void rt2800pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, 781static inline void rt2800pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,
772 struct rt2x00_field32 irq_field) 782 struct rt2x00_field32 irq_field)
773{ 783{
774 u32 reg; 784 u32 reg;
775 785
@@ -778,9 +788,9 @@ static void rt2800pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,
778 * access needs locking. 788 * access needs locking.
779 */ 789 */
780 spin_lock_irq(&rt2x00dev->irqmask_lock); 790 spin_lock_irq(&rt2x00dev->irqmask_lock);
781 rt2800_register_read(rt2x00dev, INT_MASK_CSR, &reg); 791 rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, &reg);
782 rt2x00_set_field32(&reg, irq_field, 1); 792 rt2x00_set_field32(&reg, irq_field, 1);
783 rt2800_register_write(rt2x00dev, INT_MASK_CSR, reg); 793 rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg);
784 spin_unlock_irq(&rt2x00dev->irqmask_lock); 794 spin_unlock_irq(&rt2x00dev->irqmask_lock);
785} 795}
786 796
@@ -851,7 +861,7 @@ static void rt2800pci_txstatus_interrupt(struct rt2x00_dev *rt2x00dev)
851 * need to lock the kfifo. 861 * need to lock the kfifo.
852 */ 862 */
853 for (i = 0; i < rt2x00dev->ops->tx->entry_num; i++) { 863 for (i = 0; i < rt2x00dev->ops->tx->entry_num; i++) {
854 rt2800_register_read(rt2x00dev, TX_STA_FIFO, &status); 864 rt2x00pci_register_read(rt2x00dev, TX_STA_FIFO, &status);
855 865
856 if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID)) 866 if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID))
857 break; 867 break;
@@ -873,8 +883,8 @@ static irqreturn_t rt2800pci_interrupt(int irq, void *dev_instance)
873 u32 reg, mask; 883 u32 reg, mask;
874 884
875 /* Read status and ACK all interrupts */ 885 /* Read status and ACK all interrupts */
876 rt2800_register_read(rt2x00dev, INT_SOURCE_CSR, &reg); 886 rt2x00pci_register_read(rt2x00dev, INT_SOURCE_CSR, &reg);
877 rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, reg); 887 rt2x00pci_register_write(rt2x00dev, INT_SOURCE_CSR, reg);
878 888
879 if (!reg) 889 if (!reg)
880 return IRQ_NONE; 890 return IRQ_NONE;
@@ -914,9 +924,9 @@ static irqreturn_t rt2800pci_interrupt(int irq, void *dev_instance)
914 * the tasklet will reenable the appropriate interrupts. 924 * the tasklet will reenable the appropriate interrupts.
915 */ 925 */
916 spin_lock(&rt2x00dev->irqmask_lock); 926 spin_lock(&rt2x00dev->irqmask_lock);
917 rt2800_register_read(rt2x00dev, INT_MASK_CSR, &reg); 927 rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, &reg);
918 reg &= mask; 928 reg &= mask;
919 rt2800_register_write(rt2x00dev, INT_MASK_CSR, reg); 929 rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg);
920 spin_unlock(&rt2x00dev->irqmask_lock); 930 spin_unlock(&rt2x00dev->irqmask_lock);
921 931
922 return IRQ_HANDLED; 932 return IRQ_HANDLED;
@@ -966,28 +976,28 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
966 * This device has multiple filters for control frames 976 * This device has multiple filters for control frames
967 * and has a separate filter for PS Poll frames. 977 * and has a separate filter for PS Poll frames.
968 */ 978 */
969 __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags); 979 __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
970 __set_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags); 980 __set_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags);
971 981
972 /* 982 /*
973 * This device has a pre tbtt interrupt and thus fetches 983 * This device has a pre tbtt interrupt and thus fetches
974 * a new beacon directly prior to transmission. 984 * a new beacon directly prior to transmission.
975 */ 985 */
976 __set_bit(DRIVER_SUPPORT_PRE_TBTT_INTERRUPT, &rt2x00dev->flags); 986 __set_bit(CAPABILITY_PRE_TBTT_INTERRUPT, &rt2x00dev->cap_flags);
977 987
978 /* 988 /*
979 * This device requires firmware. 989 * This device requires firmware.
980 */ 990 */
981 if (!rt2x00_is_soc(rt2x00dev)) 991 if (!rt2x00_is_soc(rt2x00dev))
982 __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); 992 __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
983 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); 993 __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags);
984 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); 994 __set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
985 __set_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags); 995 __set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags);
986 __set_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags); 996 __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags);
987 if (!modparam_nohwcrypt) 997 if (!modparam_nohwcrypt)
988 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); 998 __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
989 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); 999 __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
990 __set_bit(DRIVER_REQUIRE_HT_TX_DESC, &rt2x00dev->flags); 1000 __set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);
991 1001
992 /* 1002 /*
993 * Set the rssi offset. 1003 * Set the rssi offset.
@@ -1018,6 +1028,7 @@ static const struct ieee80211_ops rt2800pci_mac80211_ops = {
1018 .ampdu_action = rt2800_ampdu_action, 1028 .ampdu_action = rt2800_ampdu_action,
1019 .flush = rt2x00mac_flush, 1029 .flush = rt2x00mac_flush,
1020 .get_survey = rt2800_get_survey, 1030 .get_survey = rt2800_get_survey,
1031 .get_ringparam = rt2x00mac_get_ringparam,
1021}; 1032};
1022 1033
1023static const struct rt2800_ops rt2800pci_rt2800_ops = { 1034static const struct rt2800_ops rt2800pci_rt2800_ops = {
@@ -1057,6 +1068,7 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
1057 .start_queue = rt2800pci_start_queue, 1068 .start_queue = rt2800pci_start_queue,
1058 .kick_queue = rt2800pci_kick_queue, 1069 .kick_queue = rt2800pci_kick_queue,
1059 .stop_queue = rt2800pci_stop_queue, 1070 .stop_queue = rt2800pci_stop_queue,
1071 .flush_queue = rt2x00pci_flush_queue,
1060 .write_tx_desc = rt2800pci_write_tx_desc, 1072 .write_tx_desc = rt2800pci_write_tx_desc,
1061 .write_tx_data = rt2800_write_tx_data, 1073 .write_tx_data = rt2800_write_tx_data,
1062 .write_beacon = rt2800_write_beacon, 1074 .write_beacon = rt2800_write_beacon,
@@ -1116,36 +1128,36 @@ static const struct rt2x00_ops rt2800pci_ops = {
1116 */ 1128 */
1117#ifdef CONFIG_PCI 1129#ifdef CONFIG_PCI
1118static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table) = { 1130static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table) = {
1119 { PCI_DEVICE(0x1814, 0x0601), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1131 { PCI_DEVICE(0x1814, 0x0601) },
1120 { PCI_DEVICE(0x1814, 0x0681), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1132 { PCI_DEVICE(0x1814, 0x0681) },
1121 { PCI_DEVICE(0x1814, 0x0701), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1133 { PCI_DEVICE(0x1814, 0x0701) },
1122 { PCI_DEVICE(0x1814, 0x0781), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1134 { PCI_DEVICE(0x1814, 0x0781) },
1123 { PCI_DEVICE(0x1814, 0x3090), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1135 { PCI_DEVICE(0x1814, 0x3090) },
1124 { PCI_DEVICE(0x1814, 0x3091), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1136 { PCI_DEVICE(0x1814, 0x3091) },
1125 { PCI_DEVICE(0x1814, 0x3092), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1137 { PCI_DEVICE(0x1814, 0x3092) },
1126 { PCI_DEVICE(0x1432, 0x7708), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1138 { PCI_DEVICE(0x1432, 0x7708) },
1127 { PCI_DEVICE(0x1432, 0x7727), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1139 { PCI_DEVICE(0x1432, 0x7727) },
1128 { PCI_DEVICE(0x1432, 0x7728), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1140 { PCI_DEVICE(0x1432, 0x7728) },
1129 { PCI_DEVICE(0x1432, 0x7738), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1141 { PCI_DEVICE(0x1432, 0x7738) },
1130 { PCI_DEVICE(0x1432, 0x7748), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1142 { PCI_DEVICE(0x1432, 0x7748) },
1131 { PCI_DEVICE(0x1432, 0x7758), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1143 { PCI_DEVICE(0x1432, 0x7758) },
1132 { PCI_DEVICE(0x1432, 0x7768), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1144 { PCI_DEVICE(0x1432, 0x7768) },
1133 { PCI_DEVICE(0x1462, 0x891a), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1145 { PCI_DEVICE(0x1462, 0x891a) },
1134 { PCI_DEVICE(0x1a3b, 0x1059), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1146 { PCI_DEVICE(0x1a3b, 0x1059) },
1135#ifdef CONFIG_RT2800PCI_RT33XX 1147#ifdef CONFIG_RT2800PCI_RT33XX
1136 { PCI_DEVICE(0x1814, 0x3390), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1148 { PCI_DEVICE(0x1814, 0x3390) },
1137#endif 1149#endif
1138#ifdef CONFIG_RT2800PCI_RT35XX 1150#ifdef CONFIG_RT2800PCI_RT35XX
1139 { PCI_DEVICE(0x1432, 0x7711), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1151 { PCI_DEVICE(0x1432, 0x7711) },
1140 { PCI_DEVICE(0x1432, 0x7722), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1152 { PCI_DEVICE(0x1432, 0x7722) },
1141 { PCI_DEVICE(0x1814, 0x3060), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1153 { PCI_DEVICE(0x1814, 0x3060) },
1142 { PCI_DEVICE(0x1814, 0x3062), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1154 { PCI_DEVICE(0x1814, 0x3062) },
1143 { PCI_DEVICE(0x1814, 0x3562), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1155 { PCI_DEVICE(0x1814, 0x3562) },
1144 { PCI_DEVICE(0x1814, 0x3592), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1156 { PCI_DEVICE(0x1814, 0x3592) },
1145 { PCI_DEVICE(0x1814, 0x3593), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1157 { PCI_DEVICE(0x1814, 0x3593) },
1146#endif 1158#endif
1147#ifdef CONFIG_RT2800PCI_RT53XX 1159#ifdef CONFIG_RT2800PCI_RT53XX
1148 { PCI_DEVICE(0x1814, 0x5390), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1160 { PCI_DEVICE(0x1814, 0x5390) },
1149#endif 1161#endif
1150 { 0, } 1162 { 0, }
1151}; 1163};
@@ -1181,10 +1193,16 @@ static struct platform_driver rt2800soc_driver = {
1181#endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ 1193#endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */
1182 1194
1183#ifdef CONFIG_PCI 1195#ifdef CONFIG_PCI
1196static int rt2800pci_probe(struct pci_dev *pci_dev,
1197 const struct pci_device_id *id)
1198{
1199 return rt2x00pci_probe(pci_dev, &rt2800pci_ops);
1200}
1201
1184static struct pci_driver rt2800pci_driver = { 1202static struct pci_driver rt2800pci_driver = {
1185 .name = KBUILD_MODNAME, 1203 .name = KBUILD_MODNAME,
1186 .id_table = rt2800pci_device_table, 1204 .id_table = rt2800pci_device_table,
1187 .probe = rt2x00pci_probe, 1205 .probe = rt2800pci_probe,
1188 .remove = __devexit_p(rt2x00pci_remove), 1206 .remove = __devexit_p(rt2x00pci_remove),
1189 .suspend = rt2x00pci_suspend, 1207 .suspend = rt2x00pci_suspend,
1190 .resume = rt2x00pci_resume, 1208 .resume = rt2x00pci_resume,
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 6ba31a0e8f78..0d4e8fa3e1f8 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -59,16 +59,16 @@ static void rt2800usb_start_queue(struct data_queue *queue)
59 59
60 switch (queue->qid) { 60 switch (queue->qid) {
61 case QID_RX: 61 case QID_RX:
62 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); 62 rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
63 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 1); 63 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 1);
64 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 64 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
65 break; 65 break;
66 case QID_BEACON: 66 case QID_BEACON:
67 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg); 67 rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
68 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 1); 68 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 1);
69 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 1); 69 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 1);
70 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1); 70 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1);
71 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); 71 rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
72 break; 72 break;
73 default: 73 default:
74 break; 74 break;
@@ -82,16 +82,16 @@ static void rt2800usb_stop_queue(struct data_queue *queue)
82 82
83 switch (queue->qid) { 83 switch (queue->qid) {
84 case QID_RX: 84 case QID_RX:
85 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); 85 rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
86 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0); 86 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0);
87 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 87 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
88 break; 88 break;
89 case QID_BEACON: 89 case QID_BEACON:
90 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg); 90 rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
91 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 0); 91 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 0);
92 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 0); 92 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 0);
93 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0); 93 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
94 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); 94 rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
95 break; 95 break;
96 default: 96 default:
97 break; 97 break;
@@ -99,6 +99,62 @@ static void rt2800usb_stop_queue(struct data_queue *queue)
99} 99}
100 100
101/* 101/*
102 * test if there is an entry in any TX queue for which DMA is done
103 * but the TX status has not been returned yet
104 */
105static bool rt2800usb_txstatus_pending(struct rt2x00_dev *rt2x00dev)
106{
107 struct data_queue *queue;
108
109 tx_queue_for_each(rt2x00dev, queue) {
110 if (rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE) !=
111 rt2x00queue_get_entry(queue, Q_INDEX_DONE))
112 return true;
113 }
114 return false;
115}
116
117static void rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
118 int urb_status, u32 tx_status)
119{
120 if (urb_status) {
121 WARNING(rt2x00dev, "rt2x00usb_register_read_async failed: %d\n", urb_status);
122 return;
123 }
124
125 /* try to read all TX_STA_FIFO entries before scheduling txdone_work */
126 if (rt2x00_get_field32(tx_status, TX_STA_FIFO_VALID)) {
127 if (!kfifo_put(&rt2x00dev->txstatus_fifo, &tx_status)) {
128 WARNING(rt2x00dev, "TX status FIFO overrun, "
129 "drop tx status report.\n");
130 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
131 } else
132 rt2x00usb_register_read_async(rt2x00dev, TX_STA_FIFO,
133 rt2800usb_tx_sta_fifo_read_completed);
134 } else if (!kfifo_is_empty(&rt2x00dev->txstatus_fifo)) {
135 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
136 } else if (rt2800usb_txstatus_pending(rt2x00dev)) {
137 mod_timer(&rt2x00dev->txstatus_timer, jiffies + msecs_to_jiffies(20));
138 }
139}
140
141static void rt2800usb_tx_dma_done(struct queue_entry *entry)
142{
143 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
144
145 rt2x00usb_register_read_async(rt2x00dev, TX_STA_FIFO,
146 rt2800usb_tx_sta_fifo_read_completed);
147}
148
149static void rt2800usb_tx_sta_fifo_timeout(unsigned long data)
150{
151 struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;
152
153 rt2x00usb_register_read_async(rt2x00dev, TX_STA_FIFO,
154 rt2800usb_tx_sta_fifo_read_completed);
155}
156
157/*
102 * Firmware functions 158 * Firmware functions
103 */ 159 */
104static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) 160static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev)
@@ -129,11 +185,11 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
129 /* 185 /*
130 * Write firmware to device. 186 * Write firmware to device.
131 */ 187 */
132 rt2800_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, 188 rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
133 data + offset, length); 189 data + offset, length);
134 190
135 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); 191 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
136 rt2800_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); 192 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);
137 193
138 /* 194 /*
139 * Send firmware request to device to load firmware, 195 * Send firmware request to device to load firmware,
@@ -148,7 +204,7 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
148 } 204 }
149 205
150 msleep(10); 206 msleep(10);
151 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); 207 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
152 208
153 return 0; 209 return 0;
154} 210}
@@ -166,22 +222,22 @@ static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev)
166 if (rt2800_wait_csr_ready(rt2x00dev)) 222 if (rt2800_wait_csr_ready(rt2x00dev))
167 return -EBUSY; 223 return -EBUSY;
168 224
169 rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, &reg); 225 rt2x00usb_register_read(rt2x00dev, PBF_SYS_CTRL, &reg);
170 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000); 226 rt2x00usb_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000);
171 227
172 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); 228 rt2x00usb_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
173 229
174 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); 230 rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
175 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1); 231 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
176 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1); 232 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
177 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 233 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
178 234
179 rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); 235 rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000);
180 236
181 rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, 237 rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0,
182 USB_MODE_RESET, REGISTER_TIMEOUT); 238 USB_MODE_RESET, REGISTER_TIMEOUT);
183 239
184 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000); 240 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000);
185 241
186 return 0; 242 return 0;
187} 243}
@@ -193,7 +249,7 @@ static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev)
193 if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev))) 249 if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev)))
194 return -EIO; 250 return -EIO;
195 251
196 rt2800_register_read(rt2x00dev, USB_DMA_CFG, &reg); 252 rt2x00usb_register_read(rt2x00dev, USB_DMA_CFG, &reg);
197 rt2x00_set_field32(&reg, USB_DMA_CFG_PHY_CLEAR, 0); 253 rt2x00_set_field32(&reg, USB_DMA_CFG_PHY_CLEAR, 0);
198 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_EN, 0); 254 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_EN, 0);
199 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_TIMEOUT, 128); 255 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_TIMEOUT, 128);
@@ -206,7 +262,7 @@ static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev)
206 / 1024) - 3); 262 / 1024) - 3);
207 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_EN, 1); 263 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_EN, 1);
208 rt2x00_set_field32(&reg, USB_DMA_CFG_TX_BULK_EN, 1); 264 rt2x00_set_field32(&reg, USB_DMA_CFG_TX_BULK_EN, 1);
209 rt2800_register_write(rt2x00dev, USB_DMA_CFG, reg); 265 rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, reg);
210 266
211 return rt2800_enable_radio(rt2x00dev); 267 return rt2800_enable_radio(rt2x00dev);
212} 268}
@@ -282,12 +338,12 @@ static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev)
282 unsigned int i; 338 unsigned int i;
283 u32 reg; 339 u32 reg;
284 340
285 rt2800_register_read(rt2x00dev, TXRXQ_PCNT, &reg); 341 rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, &reg);
286 if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) { 342 if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) {
287 WARNING(rt2x00dev, "TX HW queue 0 timed out," 343 WARNING(rt2x00dev, "TX HW queue 0 timed out,"
288 " invoke forced kick\n"); 344 " invoke forced kick\n");
289 345
290 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40012); 346 rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40012);
291 347
292 for (i = 0; i < 10; i++) { 348 for (i = 0; i < 10; i++) {
293 udelay(10); 349 udelay(10);
@@ -295,15 +351,15 @@ static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev)
295 break; 351 break;
296 } 352 }
297 353
298 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40006); 354 rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40006);
299 } 355 }
300 356
301 rt2800_register_read(rt2x00dev, TXRXQ_PCNT, &reg); 357 rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, &reg);
302 if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) { 358 if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) {
303 WARNING(rt2x00dev, "TX HW queue 1 timed out," 359 WARNING(rt2x00dev, "TX HW queue 1 timed out,"
304 " invoke forced kick\n"); 360 " invoke forced kick\n");
305 361
306 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf4000a); 362 rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf4000a);
307 363
308 for (i = 0; i < 10; i++) { 364 for (i = 0; i < 10; i++) {
309 udelay(10); 365 udelay(10);
@@ -311,7 +367,7 @@ static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev)
311 break; 367 break;
312 } 368 }
313 369
314 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40006); 370 rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40006);
315 } 371 }
316 372
317 rt2x00usb_watchdog(rt2x00dev); 373 rt2x00usb_watchdog(rt2x00dev);
@@ -420,13 +476,24 @@ static void rt2800usb_work_txdone(struct work_struct *work)
420 while (!rt2x00queue_empty(queue)) { 476 while (!rt2x00queue_empty(queue)) {
421 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); 477 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
422 478
423 if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || 479 if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
424 !test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) 480 break;
481 if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags))
482 rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE);
483 else if (rt2x00queue_status_timeout(entry))
484 rt2x00lib_txdone_noinfo(entry, TXDONE_UNKNOWN);
485 else
425 break; 486 break;
426
427 rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE);
428 } 487 }
429 } 488 }
489
490 /*
491 * The hw may delay sending the packet after DMA complete
492 * if the medium is busy, thus the TX_STA_FIFO entry is
493 * also delayed -> use a timer to retrieve it.
494 */
495 if (rt2800usb_txstatus_pending(rt2x00dev))
496 mod_timer(&rt2x00dev->txstatus_timer, jiffies + msecs_to_jiffies(20));
430} 497}
431 498
432/* 499/*
@@ -553,18 +620,23 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
553 * This device has multiple filters for control frames 620 * This device has multiple filters for control frames
554 * and has a separate filter for PS Poll frames. 621 * and has a separate filter for PS Poll frames.
555 */ 622 */
556 __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags); 623 __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
557 __set_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags); 624 __set_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags);
558 625
559 /* 626 /*
560 * This device requires firmware. 627 * This device requires firmware.
561 */ 628 */
562 __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); 629 __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
563 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); 630 __set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
564 if (!modparam_nohwcrypt) 631 if (!modparam_nohwcrypt)
565 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); 632 __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
566 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); 633 __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
567 __set_bit(DRIVER_REQUIRE_HT_TX_DESC, &rt2x00dev->flags); 634 __set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);
635 __set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags);
636
637 setup_timer(&rt2x00dev->txstatus_timer,
638 rt2800usb_tx_sta_fifo_timeout,
639 (unsigned long) rt2x00dev);
568 640
569 /* 641 /*
570 * Set the rssi offset. 642 * Set the rssi offset.
@@ -601,6 +673,7 @@ static const struct ieee80211_ops rt2800usb_mac80211_ops = {
601 .ampdu_action = rt2800_ampdu_action, 673 .ampdu_action = rt2800_ampdu_action,
602 .flush = rt2x00mac_flush, 674 .flush = rt2x00mac_flush,
603 .get_survey = rt2800_get_survey, 675 .get_survey = rt2800_get_survey,
676 .get_ringparam = rt2x00mac_get_ringparam,
604}; 677};
605 678
606static const struct rt2800_ops rt2800usb_rt2800_ops = { 679static const struct rt2800_ops rt2800usb_rt2800_ops = {
@@ -635,6 +708,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
635 .kick_queue = rt2x00usb_kick_queue, 708 .kick_queue = rt2x00usb_kick_queue,
636 .stop_queue = rt2800usb_stop_queue, 709 .stop_queue = rt2800usb_stop_queue,
637 .flush_queue = rt2x00usb_flush_queue, 710 .flush_queue = rt2x00usb_flush_queue,
711 .tx_dma_done = rt2800usb_tx_dma_done,
638 .write_tx_desc = rt2800usb_write_tx_desc, 712 .write_tx_desc = rt2800usb_write_tx_desc,
639 .write_tx_data = rt2800usb_write_tx_data, 713 .write_tx_data = rt2800usb_write_tx_data,
640 .write_beacon = rt2800_write_beacon, 714 .write_beacon = rt2800_write_beacon,
@@ -695,295 +769,332 @@ static const struct rt2x00_ops rt2800usb_ops = {
695 */ 769 */
696static struct usb_device_id rt2800usb_device_table[] = { 770static struct usb_device_id rt2800usb_device_table[] = {
697 /* Abocom */ 771 /* Abocom */
698 { USB_DEVICE(0x07b8, 0x2870), USB_DEVICE_DATA(&rt2800usb_ops) }, 772 { USB_DEVICE(0x07b8, 0x2870) },
699 { USB_DEVICE(0x07b8, 0x2770), USB_DEVICE_DATA(&rt2800usb_ops) }, 773 { USB_DEVICE(0x07b8, 0x2770) },
700 { USB_DEVICE(0x07b8, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) }, 774 { USB_DEVICE(0x07b8, 0x3070) },
701 { USB_DEVICE(0x07b8, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) }, 775 { USB_DEVICE(0x07b8, 0x3071) },
702 { USB_DEVICE(0x07b8, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 776 { USB_DEVICE(0x07b8, 0x3072) },
703 { USB_DEVICE(0x1482, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) }, 777 { USB_DEVICE(0x1482, 0x3c09) },
704 /* AirTies */ 778 /* AirTies */
705 { USB_DEVICE(0x1eda, 0x2310), USB_DEVICE_DATA(&rt2800usb_ops) }, 779 { USB_DEVICE(0x1eda, 0x2012) },
780 { USB_DEVICE(0x1eda, 0x2310) },
706 /* Allwin */ 781 /* Allwin */
707 { USB_DEVICE(0x8516, 0x2070), USB_DEVICE_DATA(&rt2800usb_ops) }, 782 { USB_DEVICE(0x8516, 0x2070) },
708 { USB_DEVICE(0x8516, 0x2770), USB_DEVICE_DATA(&rt2800usb_ops) }, 783 { USB_DEVICE(0x8516, 0x2770) },
709 { USB_DEVICE(0x8516, 0x2870), USB_DEVICE_DATA(&rt2800usb_ops) }, 784 { USB_DEVICE(0x8516, 0x2870) },
710 { USB_DEVICE(0x8516, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) }, 785 { USB_DEVICE(0x8516, 0x3070) },
711 { USB_DEVICE(0x8516, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) }, 786 { USB_DEVICE(0x8516, 0x3071) },
712 { USB_DEVICE(0x8516, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 787 { USB_DEVICE(0x8516, 0x3072) },
788 /* Alpha Networks */
789 { USB_DEVICE(0x14b2, 0x3c06) },
790 { USB_DEVICE(0x14b2, 0x3c07) },
791 { USB_DEVICE(0x14b2, 0x3c09) },
792 { USB_DEVICE(0x14b2, 0x3c12) },
793 { USB_DEVICE(0x14b2, 0x3c23) },
794 { USB_DEVICE(0x14b2, 0x3c25) },
795 { USB_DEVICE(0x14b2, 0x3c27) },
796 { USB_DEVICE(0x14b2, 0x3c28) },
797 { USB_DEVICE(0x14b2, 0x3c2c) },
713 /* Amit */ 798 /* Amit */
714 { USB_DEVICE(0x15c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) }, 799 { USB_DEVICE(0x15c5, 0x0008) },
715 /* Askey */ 800 /* Askey */
716 { USB_DEVICE(0x1690, 0x0740), USB_DEVICE_DATA(&rt2800usb_ops) }, 801 { USB_DEVICE(0x1690, 0x0740) },
717 /* ASUS */ 802 /* ASUS */
718 { USB_DEVICE(0x0b05, 0x1731), USB_DEVICE_DATA(&rt2800usb_ops) }, 803 { USB_DEVICE(0x0b05, 0x1731) },
719 { USB_DEVICE(0x0b05, 0x1732), USB_DEVICE_DATA(&rt2800usb_ops) }, 804 { USB_DEVICE(0x0b05, 0x1732) },
720 { USB_DEVICE(0x0b05, 0x1742), USB_DEVICE_DATA(&rt2800usb_ops) }, 805 { USB_DEVICE(0x0b05, 0x1742) },
721 { USB_DEVICE(0x0b05, 0x1784), USB_DEVICE_DATA(&rt2800usb_ops) }, 806 { USB_DEVICE(0x0b05, 0x1784) },
722 { USB_DEVICE(0x1761, 0x0b05), USB_DEVICE_DATA(&rt2800usb_ops) }, 807 { USB_DEVICE(0x1761, 0x0b05) },
723 /* AzureWave */ 808 /* AzureWave */
724 { USB_DEVICE(0x13d3, 0x3247), USB_DEVICE_DATA(&rt2800usb_ops) }, 809 { USB_DEVICE(0x13d3, 0x3247) },
725 { USB_DEVICE(0x13d3, 0x3273), USB_DEVICE_DATA(&rt2800usb_ops) }, 810 { USB_DEVICE(0x13d3, 0x3273) },
726 { USB_DEVICE(0x13d3, 0x3305), USB_DEVICE_DATA(&rt2800usb_ops) }, 811 { USB_DEVICE(0x13d3, 0x3305) },
727 { USB_DEVICE(0x13d3, 0x3307), USB_DEVICE_DATA(&rt2800usb_ops) }, 812 { USB_DEVICE(0x13d3, 0x3307) },
728 { USB_DEVICE(0x13d3, 0x3321), USB_DEVICE_DATA(&rt2800usb_ops) }, 813 { USB_DEVICE(0x13d3, 0x3321) },
729 /* Belkin */ 814 /* Belkin */
730 { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) }, 815 { USB_DEVICE(0x050d, 0x8053) },
731 { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) }, 816 { USB_DEVICE(0x050d, 0x805c) },
732 { USB_DEVICE(0x050d, 0x815c), USB_DEVICE_DATA(&rt2800usb_ops) }, 817 { USB_DEVICE(0x050d, 0x815c) },
733 { USB_DEVICE(0x050d, 0x825b), USB_DEVICE_DATA(&rt2800usb_ops) }, 818 { USB_DEVICE(0x050d, 0x825b) },
734 { USB_DEVICE(0x050d, 0x935a), USB_DEVICE_DATA(&rt2800usb_ops) }, 819 { USB_DEVICE(0x050d, 0x935a) },
735 { USB_DEVICE(0x050d, 0x935b), USB_DEVICE_DATA(&rt2800usb_ops) }, 820 { USB_DEVICE(0x050d, 0x935b) },
736 /* Buffalo */ 821 /* Buffalo */
737 { USB_DEVICE(0x0411, 0x00e8), USB_DEVICE_DATA(&rt2800usb_ops) }, 822 { USB_DEVICE(0x0411, 0x00e8) },
738 { USB_DEVICE(0x0411, 0x016f), USB_DEVICE_DATA(&rt2800usb_ops) }, 823 { USB_DEVICE(0x0411, 0x016f) },
739 /* Conceptronic */ 824 { USB_DEVICE(0x0411, 0x01a2) },
740 { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) },
741 { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) },
742 { USB_DEVICE(0x14b2, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
743 { USB_DEVICE(0x14b2, 0x3c12), USB_DEVICE_DATA(&rt2800usb_ops) },
744 { USB_DEVICE(0x14b2, 0x3c23), USB_DEVICE_DATA(&rt2800usb_ops) },
745 { USB_DEVICE(0x14b2, 0x3c25), USB_DEVICE_DATA(&rt2800usb_ops) },
746 { USB_DEVICE(0x14b2, 0x3c27), USB_DEVICE_DATA(&rt2800usb_ops) },
747 { USB_DEVICE(0x14b2, 0x3c28), USB_DEVICE_DATA(&rt2800usb_ops) },
748 /* Corega */ 825 /* Corega */
749 { USB_DEVICE(0x07aa, 0x002f), USB_DEVICE_DATA(&rt2800usb_ops) }, 826 { USB_DEVICE(0x07aa, 0x002f) },
750 { USB_DEVICE(0x07aa, 0x003c), USB_DEVICE_DATA(&rt2800usb_ops) }, 827 { USB_DEVICE(0x07aa, 0x003c) },
751 { USB_DEVICE(0x07aa, 0x003f), USB_DEVICE_DATA(&rt2800usb_ops) }, 828 { USB_DEVICE(0x07aa, 0x003f) },
752 { USB_DEVICE(0x18c5, 0x0012), USB_DEVICE_DATA(&rt2800usb_ops) }, 829 { USB_DEVICE(0x18c5, 0x0012) },
753 /* D-Link */ 830 /* D-Link */
754 { USB_DEVICE(0x07d1, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) }, 831 { USB_DEVICE(0x07d1, 0x3c09) },
755 { USB_DEVICE(0x07d1, 0x3c0a), USB_DEVICE_DATA(&rt2800usb_ops) }, 832 { USB_DEVICE(0x07d1, 0x3c0a) },
756 { USB_DEVICE(0x07d1, 0x3c0d), USB_DEVICE_DATA(&rt2800usb_ops) }, 833 { USB_DEVICE(0x07d1, 0x3c0d) },
757 { USB_DEVICE(0x07d1, 0x3c0e), USB_DEVICE_DATA(&rt2800usb_ops) }, 834 { USB_DEVICE(0x07d1, 0x3c0e) },
758 { USB_DEVICE(0x07d1, 0x3c0f), USB_DEVICE_DATA(&rt2800usb_ops) }, 835 { USB_DEVICE(0x07d1, 0x3c0f) },
759 { USB_DEVICE(0x07d1, 0x3c11), USB_DEVICE_DATA(&rt2800usb_ops) }, 836 { USB_DEVICE(0x07d1, 0x3c11) },
760 { USB_DEVICE(0x07d1, 0x3c16), USB_DEVICE_DATA(&rt2800usb_ops) }, 837 { USB_DEVICE(0x07d1, 0x3c16) },
761 /* Draytek */ 838 /* Draytek */
762 { USB_DEVICE(0x07fa, 0x7712), USB_DEVICE_DATA(&rt2800usb_ops) }, 839 { USB_DEVICE(0x07fa, 0x7712) },
763 /* Edimax */ 840 /* Edimax */
764 { USB_DEVICE(0x7392, 0x7711), USB_DEVICE_DATA(&rt2800usb_ops) }, 841 { USB_DEVICE(0x7392, 0x7711) },
765 { USB_DEVICE(0x7392, 0x7717), USB_DEVICE_DATA(&rt2800usb_ops) }, 842 { USB_DEVICE(0x7392, 0x7717) },
766 { USB_DEVICE(0x7392, 0x7718), USB_DEVICE_DATA(&rt2800usb_ops) }, 843 { USB_DEVICE(0x7392, 0x7718) },
767 /* Encore */ 844 /* Encore */
768 { USB_DEVICE(0x203d, 0x1480), USB_DEVICE_DATA(&rt2800usb_ops) }, 845 { USB_DEVICE(0x203d, 0x1480) },
769 { USB_DEVICE(0x203d, 0x14a9), USB_DEVICE_DATA(&rt2800usb_ops) }, 846 { USB_DEVICE(0x203d, 0x14a9) },
770 /* EnGenius */ 847 /* EnGenius */
771 { USB_DEVICE(0x1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) }, 848 { USB_DEVICE(0x1740, 0x9701) },
772 { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) }, 849 { USB_DEVICE(0x1740, 0x9702) },
773 { USB_DEVICE(0x1740, 0x9703), USB_DEVICE_DATA(&rt2800usb_ops) }, 850 { USB_DEVICE(0x1740, 0x9703) },
774 { USB_DEVICE(0x1740, 0x9705), USB_DEVICE_DATA(&rt2800usb_ops) }, 851 { USB_DEVICE(0x1740, 0x9705) },
775 { USB_DEVICE(0x1740, 0x9706), USB_DEVICE_DATA(&rt2800usb_ops) }, 852 { USB_DEVICE(0x1740, 0x9706) },
776 { USB_DEVICE(0x1740, 0x9707), USB_DEVICE_DATA(&rt2800usb_ops) }, 853 { USB_DEVICE(0x1740, 0x9707) },
777 { USB_DEVICE(0x1740, 0x9708), USB_DEVICE_DATA(&rt2800usb_ops) }, 854 { USB_DEVICE(0x1740, 0x9708) },
778 { USB_DEVICE(0x1740, 0x9709), USB_DEVICE_DATA(&rt2800usb_ops) }, 855 { USB_DEVICE(0x1740, 0x9709) },
856 /* Gemtek */
857 { USB_DEVICE(0x15a9, 0x0012) },
779 /* Gigabyte */ 858 /* Gigabyte */
780 { USB_DEVICE(0x1044, 0x800b), USB_DEVICE_DATA(&rt2800usb_ops) }, 859 { USB_DEVICE(0x1044, 0x800b) },
781 { USB_DEVICE(0x1044, 0x800d), USB_DEVICE_DATA(&rt2800usb_ops) }, 860 { USB_DEVICE(0x1044, 0x800d) },
782 /* Hawking */ 861 /* Hawking */
783 { USB_DEVICE(0x0e66, 0x0001), USB_DEVICE_DATA(&rt2800usb_ops) }, 862 { USB_DEVICE(0x0e66, 0x0001) },
784 { USB_DEVICE(0x0e66, 0x0003), USB_DEVICE_DATA(&rt2800usb_ops) }, 863 { USB_DEVICE(0x0e66, 0x0003) },
785 { USB_DEVICE(0x0e66, 0x0009), USB_DEVICE_DATA(&rt2800usb_ops) }, 864 { USB_DEVICE(0x0e66, 0x0009) },
786 { USB_DEVICE(0x0e66, 0x000b), USB_DEVICE_DATA(&rt2800usb_ops) }, 865 { USB_DEVICE(0x0e66, 0x000b) },
787 { USB_DEVICE(0x0e66, 0x0013), USB_DEVICE_DATA(&rt2800usb_ops) }, 866 { USB_DEVICE(0x0e66, 0x0013) },
788 { USB_DEVICE(0x0e66, 0x0017), USB_DEVICE_DATA(&rt2800usb_ops) }, 867 { USB_DEVICE(0x0e66, 0x0017) },
789 { USB_DEVICE(0x0e66, 0x0018), USB_DEVICE_DATA(&rt2800usb_ops) }, 868 { USB_DEVICE(0x0e66, 0x0018) },
790 /* I-O DATA */ 869 /* I-O DATA */
791 { USB_DEVICE(0x04bb, 0x0945), USB_DEVICE_DATA(&rt2800usb_ops) }, 870 { USB_DEVICE(0x04bb, 0x0945) },
792 { USB_DEVICE(0x04bb, 0x0947), USB_DEVICE_DATA(&rt2800usb_ops) }, 871 { USB_DEVICE(0x04bb, 0x0947) },
793 { USB_DEVICE(0x04bb, 0x0948), USB_DEVICE_DATA(&rt2800usb_ops) }, 872 { USB_DEVICE(0x04bb, 0x0948) },
794 /* Linksys */ 873 /* Linksys */
795 { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) }, 874 { USB_DEVICE(0x13b1, 0x0031) },
796 { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) }, 875 { USB_DEVICE(0x1737, 0x0070) },
876 { USB_DEVICE(0x1737, 0x0071) },
797 /* Logitec */ 877 /* Logitec */
798 { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) }, 878 { USB_DEVICE(0x0789, 0x0162) },
799 { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) }, 879 { USB_DEVICE(0x0789, 0x0163) },
800 { USB_DEVICE(0x0789, 0x0164), USB_DEVICE_DATA(&rt2800usb_ops) }, 880 { USB_DEVICE(0x0789, 0x0164) },
801 { USB_DEVICE(0x0789, 0x0166), USB_DEVICE_DATA(&rt2800usb_ops) }, 881 { USB_DEVICE(0x0789, 0x0166) },
802 /* Motorola */ 882 /* Motorola */
803 { USB_DEVICE(0x100d, 0x9031), USB_DEVICE_DATA(&rt2800usb_ops) }, 883 { USB_DEVICE(0x100d, 0x9031) },
804 /* MSI */ 884 /* MSI */
805 { USB_DEVICE(0x0db0, 0x3820), USB_DEVICE_DATA(&rt2800usb_ops) }, 885 { USB_DEVICE(0x0db0, 0x3820) },
806 { USB_DEVICE(0x0db0, 0x3821), USB_DEVICE_DATA(&rt2800usb_ops) }, 886 { USB_DEVICE(0x0db0, 0x3821) },
807 { USB_DEVICE(0x0db0, 0x3822), USB_DEVICE_DATA(&rt2800usb_ops) }, 887 { USB_DEVICE(0x0db0, 0x3822) },
808 { USB_DEVICE(0x0db0, 0x3870), USB_DEVICE_DATA(&rt2800usb_ops) }, 888 { USB_DEVICE(0x0db0, 0x3870) },
809 { USB_DEVICE(0x0db0, 0x3871), USB_DEVICE_DATA(&rt2800usb_ops) }, 889 { USB_DEVICE(0x0db0, 0x3871) },
810 { USB_DEVICE(0x0db0, 0x6899), USB_DEVICE_DATA(&rt2800usb_ops) }, 890 { USB_DEVICE(0x0db0, 0x6899) },
811 { USB_DEVICE(0x0db0, 0x821a), USB_DEVICE_DATA(&rt2800usb_ops) }, 891 { USB_DEVICE(0x0db0, 0x821a) },
812 { USB_DEVICE(0x0db0, 0x822a), USB_DEVICE_DATA(&rt2800usb_ops) }, 892 { USB_DEVICE(0x0db0, 0x822a) },
813 { USB_DEVICE(0x0db0, 0x822b), USB_DEVICE_DATA(&rt2800usb_ops) }, 893 { USB_DEVICE(0x0db0, 0x822b) },
814 { USB_DEVICE(0x0db0, 0x822c), USB_DEVICE_DATA(&rt2800usb_ops) }, 894 { USB_DEVICE(0x0db0, 0x822c) },
815 { USB_DEVICE(0x0db0, 0x870a), USB_DEVICE_DATA(&rt2800usb_ops) }, 895 { USB_DEVICE(0x0db0, 0x870a) },
816 { USB_DEVICE(0x0db0, 0x871a), USB_DEVICE_DATA(&rt2800usb_ops) }, 896 { USB_DEVICE(0x0db0, 0x871a) },
817 { USB_DEVICE(0x0db0, 0x871b), USB_DEVICE_DATA(&rt2800usb_ops) }, 897 { USB_DEVICE(0x0db0, 0x871b) },
818 { USB_DEVICE(0x0db0, 0x871c), USB_DEVICE_DATA(&rt2800usb_ops) }, 898 { USB_DEVICE(0x0db0, 0x871c) },
819 { USB_DEVICE(0x0db0, 0x899a), USB_DEVICE_DATA(&rt2800usb_ops) }, 899 { USB_DEVICE(0x0db0, 0x899a) },
820 /* Para */ 900 /* Para */
821 { USB_DEVICE(0x20b8, 0x8888), USB_DEVICE_DATA(&rt2800usb_ops) }, 901 { USB_DEVICE(0x20b8, 0x8888) },
822 /* Pegatron */ 902 /* Pegatron */
823 { USB_DEVICE(0x1d4d, 0x000c), USB_DEVICE_DATA(&rt2800usb_ops) }, 903 { USB_DEVICE(0x1d4d, 0x000c) },
824 { USB_DEVICE(0x1d4d, 0x000e), USB_DEVICE_DATA(&rt2800usb_ops) }, 904 { USB_DEVICE(0x1d4d, 0x000e) },
825 { USB_DEVICE(0x1d4d, 0x0011), USB_DEVICE_DATA(&rt2800usb_ops) }, 905 { USB_DEVICE(0x1d4d, 0x0011) },
826 /* Philips */ 906 /* Philips */
827 { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) }, 907 { USB_DEVICE(0x0471, 0x200f) },
828 /* Planex */ 908 /* Planex */
829 { USB_DEVICE(0x2019, 0xab25), USB_DEVICE_DATA(&rt2800usb_ops) }, 909 { USB_DEVICE(0x2019, 0xab25) },
830 { USB_DEVICE(0x2019, 0xed06), USB_DEVICE_DATA(&rt2800usb_ops) }, 910 { USB_DEVICE(0x2019, 0xed06) },
831 /* Quanta */ 911 /* Quanta */
832 { USB_DEVICE(0x1a32, 0x0304), USB_DEVICE_DATA(&rt2800usb_ops) }, 912 { USB_DEVICE(0x1a32, 0x0304) },
833 /* Ralink */ 913 /* Ralink */
834 { USB_DEVICE(0x148f, 0x2070), USB_DEVICE_DATA(&rt2800usb_ops) }, 914 { USB_DEVICE(0x148f, 0x2070) },
835 { USB_DEVICE(0x148f, 0x2770), USB_DEVICE_DATA(&rt2800usb_ops) }, 915 { USB_DEVICE(0x148f, 0x2770) },
836 { USB_DEVICE(0x148f, 0x2870), USB_DEVICE_DATA(&rt2800usb_ops) }, 916 { USB_DEVICE(0x148f, 0x2870) },
837 { USB_DEVICE(0x148f, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) }, 917 { USB_DEVICE(0x148f, 0x3070) },
838 { USB_DEVICE(0x148f, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) }, 918 { USB_DEVICE(0x148f, 0x3071) },
839 { USB_DEVICE(0x148f, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 919 { USB_DEVICE(0x148f, 0x3072) },
840 /* Samsung */ 920 /* Samsung */
841 { USB_DEVICE(0x04e8, 0x2018), USB_DEVICE_DATA(&rt2800usb_ops) }, 921 { USB_DEVICE(0x04e8, 0x2018) },
842 /* Siemens */ 922 /* Siemens */
843 { USB_DEVICE(0x129b, 0x1828), USB_DEVICE_DATA(&rt2800usb_ops) }, 923 { USB_DEVICE(0x129b, 0x1828) },
844 /* Sitecom */ 924 /* Sitecom */
845 { USB_DEVICE(0x0df6, 0x0017), USB_DEVICE_DATA(&rt2800usb_ops) }, 925 { USB_DEVICE(0x0df6, 0x0017) },
846 { USB_DEVICE(0x0df6, 0x002b), USB_DEVICE_DATA(&rt2800usb_ops) }, 926 { USB_DEVICE(0x0df6, 0x002b) },
847 { USB_DEVICE(0x0df6, 0x002c), USB_DEVICE_DATA(&rt2800usb_ops) }, 927 { USB_DEVICE(0x0df6, 0x002c) },
848 { USB_DEVICE(0x0df6, 0x002d), USB_DEVICE_DATA(&rt2800usb_ops) }, 928 { USB_DEVICE(0x0df6, 0x002d) },
849 { USB_DEVICE(0x0df6, 0x0039), USB_DEVICE_DATA(&rt2800usb_ops) }, 929 { USB_DEVICE(0x0df6, 0x0039) },
850 { USB_DEVICE(0x0df6, 0x003b), USB_DEVICE_DATA(&rt2800usb_ops) }, 930 { USB_DEVICE(0x0df6, 0x003b) },
851 { USB_DEVICE(0x0df6, 0x003d), USB_DEVICE_DATA(&rt2800usb_ops) }, 931 { USB_DEVICE(0x0df6, 0x003d) },
852 { USB_DEVICE(0x0df6, 0x003e), USB_DEVICE_DATA(&rt2800usb_ops) }, 932 { USB_DEVICE(0x0df6, 0x003e) },
853 { USB_DEVICE(0x0df6, 0x003f), USB_DEVICE_DATA(&rt2800usb_ops) }, 933 { USB_DEVICE(0x0df6, 0x003f) },
854 { USB_DEVICE(0x0df6, 0x0040), USB_DEVICE_DATA(&rt2800usb_ops) }, 934 { USB_DEVICE(0x0df6, 0x0040) },
855 { USB_DEVICE(0x0df6, 0x0042), USB_DEVICE_DATA(&rt2800usb_ops) }, 935 { USB_DEVICE(0x0df6, 0x0042) },
856 { USB_DEVICE(0x0df6, 0x0047), USB_DEVICE_DATA(&rt2800usb_ops) }, 936 { USB_DEVICE(0x0df6, 0x0047) },
857 { USB_DEVICE(0x0df6, 0x0048), USB_DEVICE_DATA(&rt2800usb_ops) }, 937 { USB_DEVICE(0x0df6, 0x0048) },
938 { USB_DEVICE(0x0df6, 0x0051) },
939 { USB_DEVICE(0x0df6, 0x005f) },
858 /* SMC */ 940 /* SMC */
859 { USB_DEVICE(0x083a, 0x6618), USB_DEVICE_DATA(&rt2800usb_ops) }, 941 { USB_DEVICE(0x083a, 0x6618) },
860 { USB_DEVICE(0x083a, 0x7511), USB_DEVICE_DATA(&rt2800usb_ops) }, 942 { USB_DEVICE(0x083a, 0x7511) },
861 { USB_DEVICE(0x083a, 0x7512), USB_DEVICE_DATA(&rt2800usb_ops) }, 943 { USB_DEVICE(0x083a, 0x7512) },
862 { USB_DEVICE(0x083a, 0x7522), USB_DEVICE_DATA(&rt2800usb_ops) }, 944 { USB_DEVICE(0x083a, 0x7522) },
863 { USB_DEVICE(0x083a, 0x8522), USB_DEVICE_DATA(&rt2800usb_ops) }, 945 { USB_DEVICE(0x083a, 0x8522) },
864 { USB_DEVICE(0x083a, 0xa618), USB_DEVICE_DATA(&rt2800usb_ops) }, 946 { USB_DEVICE(0x083a, 0xa618) },
865 { USB_DEVICE(0x083a, 0xa701), USB_DEVICE_DATA(&rt2800usb_ops) }, 947 { USB_DEVICE(0x083a, 0xa701) },
866 { USB_DEVICE(0x083a, 0xa702), USB_DEVICE_DATA(&rt2800usb_ops) }, 948 { USB_DEVICE(0x083a, 0xa702) },
867 { USB_DEVICE(0x083a, 0xa703), USB_DEVICE_DATA(&rt2800usb_ops) }, 949 { USB_DEVICE(0x083a, 0xa703) },
868 { USB_DEVICE(0x083a, 0xb522), USB_DEVICE_DATA(&rt2800usb_ops) }, 950 { USB_DEVICE(0x083a, 0xb522) },
869 /* Sparklan */ 951 /* Sparklan */
870 { USB_DEVICE(0x15a9, 0x0006), USB_DEVICE_DATA(&rt2800usb_ops) }, 952 { USB_DEVICE(0x15a9, 0x0006) },
871 /* Sweex */ 953 /* Sweex */
872 { USB_DEVICE(0x177f, 0x0302), USB_DEVICE_DATA(&rt2800usb_ops) }, 954 { USB_DEVICE(0x177f, 0x0302) },
873 /* U-Media*/ 955 /* U-Media */
874 { USB_DEVICE(0x157e, 0x300e), USB_DEVICE_DATA(&rt2800usb_ops) }, 956 { USB_DEVICE(0x157e, 0x300e) },
957 { USB_DEVICE(0x157e, 0x3013) },
875 /* ZCOM */ 958 /* ZCOM */
876 { USB_DEVICE(0x0cde, 0x0022), USB_DEVICE_DATA(&rt2800usb_ops) }, 959 { USB_DEVICE(0x0cde, 0x0022) },
877 { USB_DEVICE(0x0cde, 0x0025), USB_DEVICE_DATA(&rt2800usb_ops) }, 960 { USB_DEVICE(0x0cde, 0x0025) },
878 /* Zinwell */ 961 /* Zinwell */
879 { USB_DEVICE(0x5a57, 0x0280), USB_DEVICE_DATA(&rt2800usb_ops) }, 962 { USB_DEVICE(0x5a57, 0x0280) },
880 { USB_DEVICE(0x5a57, 0x0282), USB_DEVICE_DATA(&rt2800usb_ops) }, 963 { USB_DEVICE(0x5a57, 0x0282) },
881 { USB_DEVICE(0x5a57, 0x0283), USB_DEVICE_DATA(&rt2800usb_ops) }, 964 { USB_DEVICE(0x5a57, 0x0283) },
882 { USB_DEVICE(0x5a57, 0x5257), USB_DEVICE_DATA(&rt2800usb_ops) }, 965 { USB_DEVICE(0x5a57, 0x5257) },
883 /* Zyxel */ 966 /* Zyxel */
884 { USB_DEVICE(0x0586, 0x3416), USB_DEVICE_DATA(&rt2800usb_ops) }, 967 { USB_DEVICE(0x0586, 0x3416) },
885 { USB_DEVICE(0x0586, 0x3418), USB_DEVICE_DATA(&rt2800usb_ops) }, 968 { USB_DEVICE(0x0586, 0x3418) },
969 { USB_DEVICE(0x0586, 0x341e) },
970 { USB_DEVICE(0x0586, 0x343e) },
886#ifdef CONFIG_RT2800USB_RT33XX 971#ifdef CONFIG_RT2800USB_RT33XX
887 /* Ralink */ 972 /* Ralink */
888 { USB_DEVICE(0x148f, 0x3370), USB_DEVICE_DATA(&rt2800usb_ops) }, 973 { USB_DEVICE(0x148f, 0x3370) },
889 { USB_DEVICE(0x148f, 0x8070), USB_DEVICE_DATA(&rt2800usb_ops) }, 974 { USB_DEVICE(0x148f, 0x8070) },
890 /* Sitecom */ 975 /* Sitecom */
891 { USB_DEVICE(0x0df6, 0x0050), USB_DEVICE_DATA(&rt2800usb_ops) }, 976 { USB_DEVICE(0x0df6, 0x0050) },
892#endif 977#endif
893#ifdef CONFIG_RT2800USB_RT35XX 978#ifdef CONFIG_RT2800USB_RT35XX
894 /* Allwin */ 979 /* Allwin */
895 { USB_DEVICE(0x8516, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) }, 980 { USB_DEVICE(0x8516, 0x3572) },
896 /* Askey */ 981 /* Askey */
897 { USB_DEVICE(0x1690, 0x0744), USB_DEVICE_DATA(&rt2800usb_ops) }, 982 { USB_DEVICE(0x1690, 0x0744) },
898 /* Cisco */ 983 /* Cisco */
899 { USB_DEVICE(0x167b, 0x4001), USB_DEVICE_DATA(&rt2800usb_ops) }, 984 { USB_DEVICE(0x167b, 0x4001) },
900 /* EnGenius */ 985 /* EnGenius */
901 { USB_DEVICE(0x1740, 0x9801), USB_DEVICE_DATA(&rt2800usb_ops) }, 986 { USB_DEVICE(0x1740, 0x9801) },
902 /* I-O DATA */ 987 /* I-O DATA */
903 { USB_DEVICE(0x04bb, 0x0944), USB_DEVICE_DATA(&rt2800usb_ops) }, 988 { USB_DEVICE(0x04bb, 0x0944) },
989 /* Linksys */
990 { USB_DEVICE(0x13b1, 0x002f) },
991 { USB_DEVICE(0x1737, 0x0079) },
904 /* Ralink */ 992 /* Ralink */
905 { USB_DEVICE(0x148f, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) }, 993 { USB_DEVICE(0x148f, 0x3572) },
906 /* Sitecom */ 994 /* Sitecom */
907 { USB_DEVICE(0x0df6, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) }, 995 { USB_DEVICE(0x0df6, 0x0041) },
908 /* Toshiba */ 996 /* Toshiba */
909 { USB_DEVICE(0x0930, 0x0a07), USB_DEVICE_DATA(&rt2800usb_ops) }, 997 { USB_DEVICE(0x0930, 0x0a07) },
910 /* Zinwell */ 998 /* Zinwell */
911 { USB_DEVICE(0x5a57, 0x0284), USB_DEVICE_DATA(&rt2800usb_ops) }, 999 { USB_DEVICE(0x5a57, 0x0284) },
912#endif 1000#endif
913#ifdef CONFIG_RT2800USB_UNKNOWN 1001#ifdef CONFIG_RT2800USB_UNKNOWN
914 /* 1002 /*
915 * Unclear what kind of devices these are (they aren't supported by the 1003 * Unclear what kind of devices these are (they aren't supported by the
916 * vendor linux driver). 1004 * vendor linux driver).
917 */ 1005 */
1006 /* Abocom */
1007 { USB_DEVICE(0x07b8, 0x3073) },
1008 { USB_DEVICE(0x07b8, 0x3074) },
1009 /* Alpha Networks */
1010 { USB_DEVICE(0x14b2, 0x3c08) },
1011 { USB_DEVICE(0x14b2, 0x3c11) },
918 /* Amigo */ 1012 /* Amigo */
919 { USB_DEVICE(0x0e0b, 0x9031), USB_DEVICE_DATA(&rt2800usb_ops) }, 1013 { USB_DEVICE(0x0e0b, 0x9031) },
920 { USB_DEVICE(0x0e0b, 0x9041), USB_DEVICE_DATA(&rt2800usb_ops) }, 1014 { USB_DEVICE(0x0e0b, 0x9041) },
921 /* ASUS */ 1015 /* ASUS */
922 { USB_DEVICE(0x0b05, 0x1760), USB_DEVICE_DATA(&rt2800usb_ops) }, 1016 { USB_DEVICE(0x0b05, 0x166a) },
923 { USB_DEVICE(0x0b05, 0x1761), USB_DEVICE_DATA(&rt2800usb_ops) }, 1017 { USB_DEVICE(0x0b05, 0x1760) },
924 { USB_DEVICE(0x0b05, 0x1790), USB_DEVICE_DATA(&rt2800usb_ops) }, 1018 { USB_DEVICE(0x0b05, 0x1761) },
1019 { USB_DEVICE(0x0b05, 0x1790) },
1020 { USB_DEVICE(0x0b05, 0x179d) },
925 /* AzureWave */ 1021 /* AzureWave */
926 { USB_DEVICE(0x13d3, 0x3262), USB_DEVICE_DATA(&rt2800usb_ops) }, 1022 { USB_DEVICE(0x13d3, 0x3262) },
927 { USB_DEVICE(0x13d3, 0x3284), USB_DEVICE_DATA(&rt2800usb_ops) }, 1023 { USB_DEVICE(0x13d3, 0x3284) },
928 { USB_DEVICE(0x13d3, 0x3322), USB_DEVICE_DATA(&rt2800usb_ops) }, 1024 { USB_DEVICE(0x13d3, 0x3322) },
929 /* Belkin */ 1025 /* Belkin */
930 { USB_DEVICE(0x050d, 0x825a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1026 { USB_DEVICE(0x050d, 0x1003) },
1027 { USB_DEVICE(0x050d, 0x825a) },
931 /* Buffalo */ 1028 /* Buffalo */
932 { USB_DEVICE(0x0411, 0x012e), USB_DEVICE_DATA(&rt2800usb_ops) }, 1029 { USB_DEVICE(0x0411, 0x012e) },
933 { USB_DEVICE(0x0411, 0x0148), USB_DEVICE_DATA(&rt2800usb_ops) }, 1030 { USB_DEVICE(0x0411, 0x0148) },
934 { USB_DEVICE(0x0411, 0x0150), USB_DEVICE_DATA(&rt2800usb_ops) }, 1031 { USB_DEVICE(0x0411, 0x0150) },
935 { USB_DEVICE(0x0411, 0x015d), USB_DEVICE_DATA(&rt2800usb_ops) }, 1032 { USB_DEVICE(0x0411, 0x015d) },
936 /* Conceptronic */
937 { USB_DEVICE(0x14b2, 0x3c08), USB_DEVICE_DATA(&rt2800usb_ops) },
938 { USB_DEVICE(0x14b2, 0x3c11), USB_DEVICE_DATA(&rt2800usb_ops) },
939 /* Corega */ 1033 /* Corega */
940 { USB_DEVICE(0x07aa, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) }, 1034 { USB_DEVICE(0x07aa, 0x0041) },
941 { USB_DEVICE(0x07aa, 0x0042), USB_DEVICE_DATA(&rt2800usb_ops) }, 1035 { USB_DEVICE(0x07aa, 0x0042) },
942 { USB_DEVICE(0x18c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) }, 1036 { USB_DEVICE(0x18c5, 0x0008) },
943 /* D-Link */ 1037 /* D-Link */
944 { USB_DEVICE(0x07d1, 0x3c0b), USB_DEVICE_DATA(&rt2800usb_ops) }, 1038 { USB_DEVICE(0x07d1, 0x3c0b) },
945 { USB_DEVICE(0x07d1, 0x3c13), USB_DEVICE_DATA(&rt2800usb_ops) }, 1039 { USB_DEVICE(0x07d1, 0x3c13) },
946 { USB_DEVICE(0x07d1, 0x3c15), USB_DEVICE_DATA(&rt2800usb_ops) }, 1040 { USB_DEVICE(0x07d1, 0x3c15) },
947 { USB_DEVICE(0x07d1, 0x3c17), USB_DEVICE_DATA(&rt2800usb_ops) }, 1041 { USB_DEVICE(0x07d1, 0x3c17) },
1042 { USB_DEVICE(0x2001, 0x3c17) },
948 /* Edimax */ 1043 /* Edimax */
949 { USB_DEVICE(0x7392, 0x4085), USB_DEVICE_DATA(&rt2800usb_ops) }, 1044 { USB_DEVICE(0x7392, 0x4085) },
1045 { USB_DEVICE(0x7392, 0x7722) },
950 /* Encore */ 1046 /* Encore */
951 { USB_DEVICE(0x203d, 0x14a1), USB_DEVICE_DATA(&rt2800usb_ops) }, 1047 { USB_DEVICE(0x203d, 0x14a1) },
952 /* Gemtek */ 1048 /* Gemtek */
953 { USB_DEVICE(0x15a9, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) }, 1049 { USB_DEVICE(0x15a9, 0x0010) },
954 /* Gigabyte */ 1050 /* Gigabyte */
955 { USB_DEVICE(0x1044, 0x800c), USB_DEVICE_DATA(&rt2800usb_ops) }, 1051 { USB_DEVICE(0x1044, 0x800c) },
1052 /* Huawei */
1053 { USB_DEVICE(0x148f, 0xf101) },
1054 /* I-O DATA */
1055 { USB_DEVICE(0x04bb, 0x094b) },
956 /* LevelOne */ 1056 /* LevelOne */
957 { USB_DEVICE(0x1740, 0x0605), USB_DEVICE_DATA(&rt2800usb_ops) }, 1057 { USB_DEVICE(0x1740, 0x0605) },
958 { USB_DEVICE(0x1740, 0x0615), USB_DEVICE_DATA(&rt2800usb_ops) }, 1058 { USB_DEVICE(0x1740, 0x0615) },
959 /* Linksys */ 1059 /* Linksys */
960 { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, 1060 { USB_DEVICE(0x1737, 0x0077) },
961 { USB_DEVICE(0x1737, 0x0078), USB_DEVICE_DATA(&rt2800usb_ops) }, 1061 { USB_DEVICE(0x1737, 0x0078) },
962 { USB_DEVICE(0x1737, 0x0079), USB_DEVICE_DATA(&rt2800usb_ops) }, 1062 /* Logitec */
1063 { USB_DEVICE(0x0789, 0x0168) },
1064 { USB_DEVICE(0x0789, 0x0169) },
963 /* Motorola */ 1065 /* Motorola */
964 { USB_DEVICE(0x100d, 0x9032), USB_DEVICE_DATA(&rt2800usb_ops) }, 1066 { USB_DEVICE(0x100d, 0x9032) },
965 /* Ovislink */ 1067 /* Ovislink */
966 { USB_DEVICE(0x1b75, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) }, 1068 { USB_DEVICE(0x1b75, 0x3071) },
967 { USB_DEVICE(0x1b75, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 1069 { USB_DEVICE(0x1b75, 0x3072) },
968 /* Pegatron */ 1070 /* Pegatron */
969 { USB_DEVICE(0x05a6, 0x0101), USB_DEVICE_DATA(&rt2800usb_ops) }, 1071 { USB_DEVICE(0x05a6, 0x0101) },
970 { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) }, 1072 { USB_DEVICE(0x1d4d, 0x0002) },
971 { USB_DEVICE(0x1d4d, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) }, 1073 { USB_DEVICE(0x1d4d, 0x0010) },
972 /* Planex */ 1074 /* Planex */
973 { USB_DEVICE(0x2019, 0x5201), USB_DEVICE_DATA(&rt2800usb_ops) }, 1075 { USB_DEVICE(0x2019, 0x5201) },
974 { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) }, 1076 { USB_DEVICE(0x2019, 0xab24) },
975 /* Qcom */ 1077 /* Qcom */
976 { USB_DEVICE(0x18e8, 0x6259), USB_DEVICE_DATA(&rt2800usb_ops) }, 1078 { USB_DEVICE(0x18e8, 0x6259) },
1079 /* RadioShack */
1080 { USB_DEVICE(0x08b9, 0x1197) },
1081 /* Sitecom */
1082 { USB_DEVICE(0x0df6, 0x003c) },
1083 { USB_DEVICE(0x0df6, 0x004a) },
1084 { USB_DEVICE(0x0df6, 0x004d) },
1085 { USB_DEVICE(0x0df6, 0x0053) },
1086 { USB_DEVICE(0x0df6, 0x0060) },
1087 { USB_DEVICE(0x0df6, 0x0062) },
977 /* SMC */ 1088 /* SMC */
978 { USB_DEVICE(0x083a, 0xa512), USB_DEVICE_DATA(&rt2800usb_ops) }, 1089 { USB_DEVICE(0x083a, 0xa512) },
979 { USB_DEVICE(0x083a, 0xc522), USB_DEVICE_DATA(&rt2800usb_ops) }, 1090 { USB_DEVICE(0x083a, 0xc522) },
980 { USB_DEVICE(0x083a, 0xd522), USB_DEVICE_DATA(&rt2800usb_ops) }, 1091 { USB_DEVICE(0x083a, 0xd522) },
981 { USB_DEVICE(0x083a, 0xf511), USB_DEVICE_DATA(&rt2800usb_ops) }, 1092 { USB_DEVICE(0x083a, 0xf511) },
982 /* Sweex */ 1093 /* Sweex */
983 { USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) }, 1094 { USB_DEVICE(0x177f, 0x0153) },
984 { USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) }, 1095 { USB_DEVICE(0x177f, 0x0313) },
985 /* Zyxel */ 1096 /* Zyxel */
986 { USB_DEVICE(0x0586, 0x341a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1097 { USB_DEVICE(0x0586, 0x341a) },
987#endif 1098#endif
988 { 0, } 1099 { 0, }
989}; 1100};
@@ -996,10 +1107,16 @@ MODULE_DEVICE_TABLE(usb, rt2800usb_device_table);
996MODULE_FIRMWARE(FIRMWARE_RT2870); 1107MODULE_FIRMWARE(FIRMWARE_RT2870);
997MODULE_LICENSE("GPL"); 1108MODULE_LICENSE("GPL");
998 1109
1110static int rt2800usb_probe(struct usb_interface *usb_intf,
1111 const struct usb_device_id *id)
1112{
1113 return rt2x00usb_probe(usb_intf, &rt2800usb_ops);
1114}
1115
999static struct usb_driver rt2800usb_driver = { 1116static struct usb_driver rt2800usb_driver = {
1000 .name = KBUILD_MODNAME, 1117 .name = KBUILD_MODNAME,
1001 .id_table = rt2800usb_device_table, 1118 .id_table = rt2800usb_device_table,
1002 .probe = rt2x00usb_probe, 1119 .probe = rt2800usb_probe,
1003 .disconnect = rt2x00usb_disconnect, 1120 .disconnect = rt2x00usb_disconnect,
1004 .suspend = rt2x00usb_suspend, 1121 .suspend = rt2x00usb_suspend,
1005 .resume = rt2x00usb_resume, 1122 .resume = rt2x00usb_resume,
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index a2bd5feb9d5c..9d1a158e2c33 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -37,6 +37,7 @@
37#include <linux/etherdevice.h> 37#include <linux/etherdevice.h>
38#include <linux/input-polldev.h> 38#include <linux/input-polldev.h>
39#include <linux/kfifo.h> 39#include <linux/kfifo.h>
40#include <linux/timer.h>
40 41
41#include <net/mac80211.h> 42#include <net/mac80211.h>
42 43
@@ -570,7 +571,8 @@ struct rt2x00lib_ops {
570 void (*start_queue) (struct data_queue *queue); 571 void (*start_queue) (struct data_queue *queue);
571 void (*kick_queue) (struct data_queue *queue); 572 void (*kick_queue) (struct data_queue *queue);
572 void (*stop_queue) (struct data_queue *queue); 573 void (*stop_queue) (struct data_queue *queue);
573 void (*flush_queue) (struct data_queue *queue); 574 void (*flush_queue) (struct data_queue *queue, bool drop);
575 void (*tx_dma_done) (struct queue_entry *entry);
574 576
575 /* 577 /*
576 * TX control handlers 578 * TX control handlers
@@ -643,11 +645,11 @@ struct rt2x00_ops {
643}; 645};
644 646
645/* 647/*
646 * rt2x00 device flags 648 * rt2x00 state flags
647 */ 649 */
648enum rt2x00_flags { 650enum rt2x00_state_flags {
649 /* 651 /*
650 * Device state flags 652 * Device flags
651 */ 653 */
652 DEVICE_STATE_PRESENT, 654 DEVICE_STATE_PRESENT,
653 DEVICE_STATE_REGISTERED_HW, 655 DEVICE_STATE_REGISTERED_HW,
@@ -657,42 +659,47 @@ enum rt2x00_flags {
657 DEVICE_STATE_SCANNING, 659 DEVICE_STATE_SCANNING,
658 660
659 /* 661 /*
660 * Driver requirements
661 */
662 DRIVER_REQUIRE_FIRMWARE,
663 DRIVER_REQUIRE_BEACON_GUARD,
664 DRIVER_REQUIRE_ATIM_QUEUE,
665 DRIVER_REQUIRE_DMA,
666 DRIVER_REQUIRE_COPY_IV,
667 DRIVER_REQUIRE_L2PAD,
668 DRIVER_REQUIRE_TXSTATUS_FIFO,
669 DRIVER_REQUIRE_TASKLET_CONTEXT,
670 DRIVER_REQUIRE_SW_SEQNO,
671 DRIVER_REQUIRE_HT_TX_DESC,
672
673 /*
674 * Driver features
675 */
676 CONFIG_SUPPORT_HW_BUTTON,
677 CONFIG_SUPPORT_HW_CRYPTO,
678 CONFIG_SUPPORT_POWER_LIMIT,
679 DRIVER_SUPPORT_CONTROL_FILTERS,
680 DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL,
681 DRIVER_SUPPORT_PRE_TBTT_INTERRUPT,
682 DRIVER_SUPPORT_LINK_TUNING,
683
684 /*
685 * Driver configuration 662 * Driver configuration
686 */ 663 */
687 CONFIG_FRAME_TYPE,
688 CONFIG_RF_SEQUENCE,
689 CONFIG_EXTERNAL_LNA_A,
690 CONFIG_EXTERNAL_LNA_BG,
691 CONFIG_DOUBLE_ANTENNA,
692 CONFIG_CHANNEL_HT40, 664 CONFIG_CHANNEL_HT40,
693}; 665};
694 666
695/* 667/*
668 * rt2x00 capability flags
669 */
670enum rt2x00_capability_flags {
671 /*
672 * Requirements
673 */
674 REQUIRE_FIRMWARE,
675 REQUIRE_BEACON_GUARD,
676 REQUIRE_ATIM_QUEUE,
677 REQUIRE_DMA,
678 REQUIRE_COPY_IV,
679 REQUIRE_L2PAD,
680 REQUIRE_TXSTATUS_FIFO,
681 REQUIRE_TASKLET_CONTEXT,
682 REQUIRE_SW_SEQNO,
683 REQUIRE_HT_TX_DESC,
684
685 /*
686 * Capabilities
687 */
688 CAPABILITY_HW_BUTTON,
689 CAPABILITY_HW_CRYPTO,
690 CAPABILITY_POWER_LIMIT,
691 CAPABILITY_CONTROL_FILTERS,
692 CAPABILITY_CONTROL_FILTER_PSPOLL,
693 CAPABILITY_PRE_TBTT_INTERRUPT,
694 CAPABILITY_LINK_TUNING,
695 CAPABILITY_FRAME_TYPE,
696 CAPABILITY_RF_SEQUENCE,
697 CAPABILITY_EXTERNAL_LNA_A,
698 CAPABILITY_EXTERNAL_LNA_BG,
699 CAPABILITY_DOUBLE_ANTENNA,
700};
701
702/*
696 * rt2x00 device structure. 703 * rt2x00 device structure.
697 */ 704 */
698struct rt2x00_dev { 705struct rt2x00_dev {
@@ -738,13 +745,20 @@ struct rt2x00_dev {
738#endif /* CONFIG_RT2X00_LIB_LEDS */ 745#endif /* CONFIG_RT2X00_LIB_LEDS */
739 746
740 /* 747 /*
741 * Device flags. 748 * Device state flags.
742 * In these flags the current status and some 749 * In these flags the current status is stored.
743 * of the device capabilities are stored. 750 * Access to these flags should occur atomically.
744 */ 751 */
745 unsigned long flags; 752 unsigned long flags;
746 753
747 /* 754 /*
755 * Device capabiltiy flags.
756 * In these flags the device/driver capabilities are stored.
757 * Access to these flags should occur non-atomically.
758 */
759 unsigned long cap_flags;
760
761 /*
748 * Device information, Bus IRQ and name (PCI, SoC) 762 * Device information, Bus IRQ and name (PCI, SoC)
749 */ 763 */
750 int irq; 764 int irq;
@@ -911,6 +925,11 @@ struct rt2x00_dev {
911 DECLARE_KFIFO_PTR(txstatus_fifo, u32); 925 DECLARE_KFIFO_PTR(txstatus_fifo, u32);
912 926
913 /* 927 /*
928 * Timer to ensure tx status reports are read (rt2800usb).
929 */
930 struct timer_list txstatus_timer;
931
932 /*
914 * Tasklet for processing tx status reports (rt2800pci). 933 * Tasklet for processing tx status reports (rt2800pci).
915 */ 934 */
916 struct tasklet_struct txstatus_tasklet; 935 struct tasklet_struct txstatus_tasklet;
@@ -1235,6 +1254,10 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
1235 const struct ieee80211_tx_queue_params *params); 1254 const struct ieee80211_tx_queue_params *params);
1236void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); 1255void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw);
1237void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop); 1256void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop);
1257int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
1258int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
1259void rt2x00mac_get_ringparam(struct ieee80211_hw *hw,
1260 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
1238 1261
1239/* 1262/*
1240 * Driver allocation handlers. 1263 * Driver allocation handlers.
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 9416e36de29e..f78726404592 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -109,15 +109,6 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
109 rt2x00dev->ops->lib->config_erp(rt2x00dev, &erp, changed); 109 rt2x00dev->ops->lib->config_erp(rt2x00dev, &erp, changed);
110} 110}
111 111
112static inline
113enum antenna rt2x00lib_config_antenna_check(enum antenna current_ant,
114 enum antenna default_ant)
115{
116 if (current_ant != ANTENNA_SW_DIVERSITY)
117 return current_ant;
118 return (default_ant != ANTENNA_SW_DIVERSITY) ? default_ant : ANTENNA_B;
119}
120
121void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, 112void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
122 struct antenna_setup config) 113 struct antenna_setup config)
123{ 114{
@@ -126,19 +117,35 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
126 struct antenna_setup *active = &rt2x00dev->link.ant.active; 117 struct antenna_setup *active = &rt2x00dev->link.ant.active;
127 118
128 /* 119 /*
129 * Failsafe: Make sure we are not sending the 120 * When the caller tries to send the SW diversity,
130 * ANTENNA_SW_DIVERSITY state to the driver. 121 * we must update the ANTENNA_RX_DIVERSITY flag to
131 * If that happens, fallback to hardware defaults, 122 * enable the antenna diversity in the link tuner.
132 * or our own default. 123 *
124 * Secondly, we must guarentee we never send the
125 * software antenna diversity command to the driver.
133 */ 126 */
134 if (!(ant->flags & ANTENNA_RX_DIVERSITY)) 127 if (!(ant->flags & ANTENNA_RX_DIVERSITY)) {
135 config.rx = rt2x00lib_config_antenna_check(config.rx, def->rx); 128 if (config.rx == ANTENNA_SW_DIVERSITY) {
136 else if (config.rx == ANTENNA_SW_DIVERSITY) 129 ant->flags |= ANTENNA_RX_DIVERSITY;
130
131 if (def->rx == ANTENNA_SW_DIVERSITY)
132 config.rx = ANTENNA_B;
133 else
134 config.rx = def->rx;
135 }
136 } else if (config.rx == ANTENNA_SW_DIVERSITY)
137 config.rx = active->rx; 137 config.rx = active->rx;
138 138
139 if (!(ant->flags & ANTENNA_TX_DIVERSITY)) 139 if (!(ant->flags & ANTENNA_TX_DIVERSITY)) {
140 config.tx = rt2x00lib_config_antenna_check(config.tx, def->tx); 140 if (config.tx == ANTENNA_SW_DIVERSITY) {
141 else if (config.tx == ANTENNA_SW_DIVERSITY) 141 ant->flags |= ANTENNA_TX_DIVERSITY;
142
143 if (def->tx == ANTENNA_SW_DIVERSITY)
144 config.tx = ANTENNA_B;
145 else
146 config.tx = def->tx;
147 }
148 } else if (config.tx == ANTENNA_SW_DIVERSITY)
142 config.tx = active->tx; 149 config.tx = active->tx;
143 150
144 /* 151 /*
@@ -163,6 +170,34 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
163 rt2x00queue_start_queue(rt2x00dev->rx); 170 rt2x00queue_start_queue(rt2x00dev->rx);
164} 171}
165 172
173static u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
174 struct ieee80211_conf *conf)
175{
176 struct hw_mode_spec *spec = &rt2x00dev->spec;
177 int center_channel;
178 u16 i;
179
180 /*
181 * Initialize center channel to current channel.
182 */
183 center_channel = spec->channels[conf->channel->hw_value].channel;
184
185 /*
186 * Adjust center channel to HT40+ and HT40- operation.
187 */
188 if (conf_is_ht40_plus(conf))
189 center_channel += 2;
190 else if (conf_is_ht40_minus(conf))
191 center_channel -= (center_channel == 14) ? 1 : 2;
192
193 for (i = 0; i < spec->num_channels; i++)
194 if (spec->channels[i].channel == center_channel)
195 return i;
196
197 WARN_ON(1);
198 return conf->channel->hw_value;
199}
200
166void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, 201void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
167 struct ieee80211_conf *conf, 202 struct ieee80211_conf *conf,
168 unsigned int ieee80211_flags) 203 unsigned int ieee80211_flags)
@@ -176,10 +211,10 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
176 211
177 if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) { 212 if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) {
178 if (conf_is_ht40(conf)) { 213 if (conf_is_ht40(conf)) {
179 __set_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags); 214 set_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
180 hw_value = rt2x00ht_center_channel(rt2x00dev, conf); 215 hw_value = rt2x00ht_center_channel(rt2x00dev, conf);
181 } else { 216 } else {
182 __clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags); 217 clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
183 hw_value = conf->channel->hw_value; 218 hw_value = conf->channel->hw_value;
184 } 219 }
185 220
diff --git a/drivers/net/wireless/rt2x00/rt2x00crypto.c b/drivers/net/wireless/rt2x00/rt2x00crypto.c
index 3f5688fbf3f7..1bb9d46077ff 100644
--- a/drivers/net/wireless/rt2x00/rt2x00crypto.c
+++ b/drivers/net/wireless/rt2x00/rt2x00crypto.c
@@ -52,7 +52,7 @@ void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry,
52 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); 52 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
53 struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; 53 struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
54 54
55 if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) || !hw_key) 55 if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) || !hw_key)
56 return; 56 return;
57 57
58 __set_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags); 58 __set_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags);
@@ -80,7 +80,7 @@ unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
80 struct ieee80211_key_conf *key = tx_info->control.hw_key; 80 struct ieee80211_key_conf *key = tx_info->control.hw_key;
81 unsigned int overhead = 0; 81 unsigned int overhead = 0;
82 82
83 if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) || !key) 83 if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) || !key)
84 return overhead; 84 return overhead;
85 85
86 /* 86 /*
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c
index 66166ef037f5..78787fcc919e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00debug.c
+++ b/drivers/net/wireless/rt2x00/rt2x00debug.c
@@ -63,7 +63,8 @@ struct rt2x00debug_intf {
63 * - driver folder 63 * - driver folder
64 * - driver file 64 * - driver file
65 * - chipset file 65 * - chipset file
66 * - device flags file 66 * - device state flags file
67 * - device capability flags file
67 * - register folder 68 * - register folder
68 * - csr offset/value files 69 * - csr offset/value files
69 * - eeprom offset/value files 70 * - eeprom offset/value files
@@ -78,6 +79,7 @@ struct rt2x00debug_intf {
78 struct dentry *driver_entry; 79 struct dentry *driver_entry;
79 struct dentry *chipset_entry; 80 struct dentry *chipset_entry;
80 struct dentry *dev_flags; 81 struct dentry *dev_flags;
82 struct dentry *cap_flags;
81 struct dentry *register_folder; 83 struct dentry *register_folder;
82 struct dentry *csr_off_entry; 84 struct dentry *csr_off_entry;
83 struct dentry *csr_val_entry; 85 struct dentry *csr_val_entry;
@@ -553,6 +555,35 @@ static const struct file_operations rt2x00debug_fop_dev_flags = {
553 .llseek = default_llseek, 555 .llseek = default_llseek,
554}; 556};
555 557
558static ssize_t rt2x00debug_read_cap_flags(struct file *file,
559 char __user *buf,
560 size_t length,
561 loff_t *offset)
562{
563 struct rt2x00debug_intf *intf = file->private_data;
564 char line[16];
565 size_t size;
566
567 if (*offset)
568 return 0;
569
570 size = sprintf(line, "0x%.8x\n", (unsigned int)intf->rt2x00dev->cap_flags);
571
572 if (copy_to_user(buf, line, size))
573 return -EFAULT;
574
575 *offset += size;
576 return size;
577}
578
579static const struct file_operations rt2x00debug_fop_cap_flags = {
580 .owner = THIS_MODULE,
581 .read = rt2x00debug_read_cap_flags,
582 .open = rt2x00debug_file_open,
583 .release = rt2x00debug_file_release,
584 .llseek = default_llseek,
585};
586
556static struct dentry *rt2x00debug_create_file_driver(const char *name, 587static struct dentry *rt2x00debug_create_file_driver(const char *name,
557 struct rt2x00debug_intf 588 struct rt2x00debug_intf
558 *intf, 589 *intf,
@@ -652,6 +683,12 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
652 if (IS_ERR(intf->dev_flags) || !intf->dev_flags) 683 if (IS_ERR(intf->dev_flags) || !intf->dev_flags)
653 goto exit; 684 goto exit;
654 685
686 intf->cap_flags = debugfs_create_file("cap_flags", S_IRUSR,
687 intf->driver_folder, intf,
688 &rt2x00debug_fop_cap_flags);
689 if (IS_ERR(intf->cap_flags) || !intf->cap_flags)
690 goto exit;
691
655 intf->register_folder = 692 intf->register_folder =
656 debugfs_create_dir("register", intf->driver_folder); 693 debugfs_create_dir("register", intf->driver_folder);
657 if (IS_ERR(intf->register_folder) || !intf->register_folder) 694 if (IS_ERR(intf->register_folder) || !intf->register_folder)
@@ -705,7 +742,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
705 intf, &rt2x00debug_fop_queue_stats); 742 intf, &rt2x00debug_fop_queue_stats);
706 743
707#ifdef CONFIG_RT2X00_LIB_CRYPTO 744#ifdef CONFIG_RT2X00_LIB_CRYPTO
708 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) 745 if (test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags))
709 intf->crypto_stats_entry = 746 intf->crypto_stats_entry =
710 debugfs_create_file("crypto", S_IRUGO, intf->queue_folder, 747 debugfs_create_file("crypto", S_IRUGO, intf->queue_folder,
711 intf, &rt2x00debug_fop_crypto_stats); 748 intf, &rt2x00debug_fop_crypto_stats);
@@ -743,6 +780,7 @@ void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
743 debugfs_remove(intf->csr_off_entry); 780 debugfs_remove(intf->csr_off_entry);
744 debugfs_remove(intf->register_folder); 781 debugfs_remove(intf->register_folder);
745 debugfs_remove(intf->dev_flags); 782 debugfs_remove(intf->dev_flags);
783 debugfs_remove(intf->cap_flags);
746 debugfs_remove(intf->chipset_entry); 784 debugfs_remove(intf->chipset_entry);
747 debugfs_remove(intf->driver_entry); 785 debugfs_remove(intf->driver_entry);
748 debugfs_remove(intf->driver_folder); 786 debugfs_remove(intf->driver_folder);
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 9bffe8438d1f..7776d9f1f297 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -200,7 +200,7 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
200 * here as they will fetch the next beacon directly prior to 200 * here as they will fetch the next beacon directly prior to
201 * transmission. 201 * transmission.
202 */ 202 */
203 if (test_bit(DRIVER_SUPPORT_PRE_TBTT_INTERRUPT, &rt2x00dev->flags)) 203 if (test_bit(CAPABILITY_PRE_TBTT_INTERRUPT, &rt2x00dev->cap_flags))
204 return; 204 return;
205 205
206 /* fetch next beacon */ 206 /* fetch next beacon */
@@ -225,7 +225,7 @@ EXPORT_SYMBOL_GPL(rt2x00lib_pretbtt);
225void rt2x00lib_dmastart(struct queue_entry *entry) 225void rt2x00lib_dmastart(struct queue_entry *entry)
226{ 226{
227 set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); 227 set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
228 rt2x00queue_index_inc(entry->queue, Q_INDEX); 228 rt2x00queue_index_inc(entry, Q_INDEX);
229} 229}
230EXPORT_SYMBOL_GPL(rt2x00lib_dmastart); 230EXPORT_SYMBOL_GPL(rt2x00lib_dmastart);
231 231
@@ -233,7 +233,7 @@ void rt2x00lib_dmadone(struct queue_entry *entry)
233{ 233{
234 set_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags); 234 set_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags);
235 clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); 235 clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
236 rt2x00queue_index_inc(entry->queue, Q_INDEX_DMA_DONE); 236 rt2x00queue_index_inc(entry, Q_INDEX_DMA_DONE);
237} 237}
238EXPORT_SYMBOL_GPL(rt2x00lib_dmadone); 238EXPORT_SYMBOL_GPL(rt2x00lib_dmadone);
239 239
@@ -271,7 +271,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
271 /* 271 /*
272 * Remove L2 padding which was added during 272 * Remove L2 padding which was added during
273 */ 273 */
274 if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags)) 274 if (test_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags))
275 rt2x00queue_remove_l2pad(entry->skb, header_length); 275 rt2x00queue_remove_l2pad(entry->skb, header_length);
276 276
277 /* 277 /*
@@ -280,7 +280,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
280 * mac80211 will expect the same data to be present it the 280 * mac80211 will expect the same data to be present it the
281 * frame as it was passed to us. 281 * frame as it was passed to us.
282 */ 282 */
283 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) 283 if (test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags))
284 rt2x00crypto_tx_insert_iv(entry->skb, header_length); 284 rt2x00crypto_tx_insert_iv(entry->skb, header_length);
285 285
286 /* 286 /*
@@ -377,7 +377,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
377 * send the status report back. 377 * send the status report back.
378 */ 378 */
379 if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) { 379 if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) {
380 if (test_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags)) 380 if (test_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags))
381 ieee80211_tx_status(rt2x00dev->hw, entry->skb); 381 ieee80211_tx_status(rt2x00dev->hw, entry->skb);
382 else 382 else
383 ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb); 383 ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
@@ -392,7 +392,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
392 392
393 rt2x00dev->ops->lib->clear_entry(entry); 393 rt2x00dev->ops->lib->clear_entry(entry);
394 394
395 rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); 395 rt2x00queue_index_inc(entry, Q_INDEX_DONE);
396 396
397 /* 397 /*
398 * If the data queue was below the threshold before the txdone 398 * If the data queue was below the threshold before the txdone
@@ -559,7 +559,7 @@ void rt2x00lib_rxdone(struct queue_entry *entry)
559 559
560submit_entry: 560submit_entry:
561 entry->flags = 0; 561 entry->flags = 0;
562 rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); 562 rt2x00queue_index_inc(entry, Q_INDEX_DONE);
563 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && 563 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) &&
564 test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) 564 test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
565 rt2x00dev->ops->lib->clear_entry(entry); 565 rt2x00dev->ops->lib->clear_entry(entry);
@@ -806,15 +806,15 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
806 /* 806 /*
807 * Take TX headroom required for alignment into account. 807 * Take TX headroom required for alignment into account.
808 */ 808 */
809 if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags)) 809 if (test_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags))
810 rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE; 810 rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE;
811 else if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags)) 811 else if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags))
812 rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE; 812 rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE;
813 813
814 /* 814 /*
815 * Allocate tx status FIFO for driver use. 815 * Allocate tx status FIFO for driver use.
816 */ 816 */
817 if (test_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags)) { 817 if (test_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags)) {
818 /* 818 /*
819 * Allocate the txstatus fifo. In the worst case the tx 819 * Allocate the txstatus fifo. In the worst case the tx
820 * status fifo has to hold the tx status of all entries 820 * status fifo has to hold the tx status of all entries
@@ -1071,6 +1071,7 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1071 /* 1071 /*
1072 * Stop all work. 1072 * Stop all work.
1073 */ 1073 */
1074 del_timer_sync(&rt2x00dev->txstatus_timer);
1074 cancel_work_sync(&rt2x00dev->intf_work); 1075 cancel_work_sync(&rt2x00dev->intf_work);
1075 if (rt2x00_is_usb(rt2x00dev)) { 1076 if (rt2x00_is_usb(rt2x00dev)) {
1076 cancel_work_sync(&rt2x00dev->rxdone_work); 1077 cancel_work_sync(&rt2x00dev->rxdone_work);
diff --git a/drivers/net/wireless/rt2x00/rt2x00firmware.c b/drivers/net/wireless/rt2x00/rt2x00firmware.c
index be0ff78c1b16..f316aad30612 100644
--- a/drivers/net/wireless/rt2x00/rt2x00firmware.c
+++ b/drivers/net/wireless/rt2x00/rt2x00firmware.c
@@ -99,7 +99,7 @@ int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev)
99{ 99{
100 int retval; 100 int retval;
101 101
102 if (!test_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags)) 102 if (!test_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags))
103 return 0; 103 return 0;
104 104
105 if (!rt2x00dev->fw) { 105 if (!rt2x00dev->fw) {
diff --git a/drivers/net/wireless/rt2x00/rt2x00ht.c b/drivers/net/wireless/rt2x00/rt2x00ht.c
deleted file mode 100644
index e8c0c3e92c2f..000000000000
--- a/drivers/net/wireless/rt2x00/rt2x00ht.c
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
3 <http://rt2x00.serialmonkey.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the
17 Free Software Foundation, Inc.,
18 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21/*
22 Module: rt2x00lib
23 Abstract: rt2x00 HT specific routines.
24 */
25
26#include <linux/kernel.h>
27#include <linux/module.h>
28
29#include "rt2x00.h"
30#include "rt2x00lib.h"
31
32void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
33 struct txentry_desc *txdesc,
34 const struct rt2x00_rate *hwrate)
35{
36 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
37 struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
38 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data;
39
40 if (tx_info->control.sta)
41 txdesc->u.ht.mpdu_density =
42 tx_info->control.sta->ht_cap.ampdu_density;
43
44 txdesc->u.ht.ba_size = 7; /* FIXME: What value is needed? */
45
46 /*
47 * Only one STBC stream is supported for now.
48 */
49 if (tx_info->flags & IEEE80211_TX_CTL_STBC)
50 txdesc->u.ht.stbc = 1;
51
52 /*
53 * If IEEE80211_TX_RC_MCS is set txrate->idx just contains the
54 * mcs rate to be used
55 */
56 if (txrate->flags & IEEE80211_TX_RC_MCS) {
57 txdesc->u.ht.mcs = txrate->idx;
58
59 /*
60 * MIMO PS should be set to 1 for STA's using dynamic SM PS
61 * when using more then one tx stream (>MCS7).
62 */
63 if (tx_info->control.sta && txdesc->u.ht.mcs > 7 &&
64 ((tx_info->control.sta->ht_cap.cap &
65 IEEE80211_HT_CAP_SM_PS) >>
66 IEEE80211_HT_CAP_SM_PS_SHIFT) ==
67 WLAN_HT_CAP_SM_PS_DYNAMIC)
68 __set_bit(ENTRY_TXD_HT_MIMO_PS, &txdesc->flags);
69 } else {
70 txdesc->u.ht.mcs = rt2x00_get_rate_mcs(hwrate->mcs);
71 if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
72 txdesc->u.ht.mcs |= 0x08;
73 }
74
75 /*
76 * This frame is eligible for an AMPDU, however, don't aggregate
77 * frames that are intended to probe a specific tx rate.
78 */
79 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU &&
80 !(tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE))
81 __set_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags);
82
83 /*
84 * Set 40Mhz mode if necessary (for legacy rates this will
85 * duplicate the frame to both channels).
86 */
87 if (txrate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH ||
88 txrate->flags & IEEE80211_TX_RC_DUP_DATA)
89 __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags);
90 if (txrate->flags & IEEE80211_TX_RC_SHORT_GI)
91 __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags);
92
93 /*
94 * Determine IFS values
95 * - Use TXOP_BACKOFF for management frames
96 * - Use TXOP_SIFS for fragment bursts
97 * - Use TXOP_HTTXOP for everything else
98 *
99 * Note: rt2800 devices won't use CTS protection (if used)
100 * for frames not transmitted with TXOP_HTTXOP
101 */
102 if (ieee80211_is_mgmt(hdr->frame_control))
103 txdesc->u.ht.txop = TXOP_BACKOFF;
104 else if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT))
105 txdesc->u.ht.txop = TXOP_SIFS;
106 else
107 txdesc->u.ht.txop = TXOP_HTTXOP;
108}
109
110u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
111 struct ieee80211_conf *conf)
112{
113 struct hw_mode_spec *spec = &rt2x00dev->spec;
114 int center_channel;
115 u16 i;
116
117 /*
118 * Initialize center channel to current channel.
119 */
120 center_channel = spec->channels[conf->channel->hw_value].channel;
121
122 /*
123 * Adjust center channel to HT40+ and HT40- operation.
124 */
125 if (conf_is_ht40_plus(conf))
126 center_channel += 2;
127 else if (conf_is_ht40_minus(conf))
128 center_channel -= (center_channel == 14) ? 1 : 2;
129
130 for (i = 0; i < spec->num_channels; i++)
131 if (spec->channels[i].channel == center_channel)
132 return i;
133
134 WARN_ON(1);
135 return conf->channel->hw_value;
136}
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 88f2f9275528..322cc4f3de5d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -175,14 +175,14 @@ int rt2x00queue_clear_beacon(struct rt2x00_dev *rt2x00dev,
175 175
176/** 176/**
177 * rt2x00queue_index_inc - Index incrementation function 177 * rt2x00queue_index_inc - Index incrementation function
178 * @queue: Queue (&struct data_queue) to perform the action on. 178 * @entry: Queue entry (&struct queue_entry) to perform the action on.
179 * @index: Index type (&enum queue_index) to perform the action on. 179 * @index: Index type (&enum queue_index) to perform the action on.
180 * 180 *
181 * This function will increase the requested index on the queue, 181 * This function will increase the requested index on the entry's queue,
182 * it will grab the appropriate locks and handle queue overflow events by 182 * it will grab the appropriate locks and handle queue overflow events by
183 * resetting the index to the start of the queue. 183 * resetting the index to the start of the queue.
184 */ 184 */
185void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index); 185void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index);
186 186
187/** 187/**
188 * rt2x00queue_init_queues - Initialize all data queues 188 * rt2x00queue_init_queues - Initialize all data queues
@@ -388,41 +388,17 @@ static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
388#endif /* CONFIG_RT2X00_LIB_CRYPTO */ 388#endif /* CONFIG_RT2X00_LIB_CRYPTO */
389 389
390/* 390/*
391 * HT handlers.
392 */
393#ifdef CONFIG_RT2X00_LIB_HT
394void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
395 struct txentry_desc *txdesc,
396 const struct rt2x00_rate *hwrate);
397
398u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
399 struct ieee80211_conf *conf);
400#else
401static inline void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
402 struct txentry_desc *txdesc,
403 const struct rt2x00_rate *hwrate)
404{
405}
406
407static inline u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
408 struct ieee80211_conf *conf)
409{
410 return conf->channel->hw_value;
411}
412#endif /* CONFIG_RT2X00_LIB_HT */
413
414/*
415 * RFkill handlers. 391 * RFkill handlers.
416 */ 392 */
417static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) 393static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
418{ 394{
419 if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 395 if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags))
420 wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy); 396 wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy);
421} 397}
422 398
423static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) 399static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
424{ 400{
425 if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 401 if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags))
426 wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy); 402 wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy);
427} 403}
428 404
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c
index 1435976b8779..ea10b0068f82 100644
--- a/drivers/net/wireless/rt2x00/rt2x00link.c
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c
@@ -192,17 +192,7 @@ static bool rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
192 /* 192 /*
193 * Determine if software diversity is enabled for 193 * Determine if software diversity is enabled for
194 * either the TX or RX antenna (or both). 194 * either the TX or RX antenna (or both).
195 * Always perform this check since within the link
196 * tuner interval the configuration might have changed.
197 */ 195 */
198 ant->flags &= ~ANTENNA_RX_DIVERSITY;
199 ant->flags &= ~ANTENNA_TX_DIVERSITY;
200
201 if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
202 ant->flags |= ANTENNA_RX_DIVERSITY;
203 if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
204 ant->flags |= ANTENNA_TX_DIVERSITY;
205
206 if (!(ant->flags & ANTENNA_RX_DIVERSITY) && 196 if (!(ant->flags & ANTENNA_RX_DIVERSITY) &&
207 !(ant->flags & ANTENNA_TX_DIVERSITY)) { 197 !(ant->flags & ANTENNA_TX_DIVERSITY)) {
208 ant->flags = 0; 198 ant->flags = 0;
@@ -383,7 +373,7 @@ static void rt2x00link_tuner(struct work_struct *work)
383 * do not support link tuning at all, while other devices can disable 373 * do not support link tuning at all, while other devices can disable
384 * the feature from the EEPROM. 374 * the feature from the EEPROM.
385 */ 375 */
386 if (test_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags)) 376 if (test_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags))
387 rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count); 377 rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count);
388 378
389 /* 379 /*
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 661c6baad2b9..93bec140e598 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -119,7 +119,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
119 * Use the ATIM queue if appropriate and present. 119 * Use the ATIM queue if appropriate and present.
120 */ 120 */
121 if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM && 121 if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM &&
122 test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) 122 test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags))
123 qid = QID_ATIM; 123 qid = QID_ATIM;
124 124
125 queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); 125 queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);
@@ -158,7 +158,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
158 return; 158 return;
159 159
160 exit_fail: 160 exit_fail:
161 ieee80211_stop_queue(rt2x00dev->hw, qid); 161 rt2x00queue_pause_queue(queue);
162 dev_kfree_skb_any(skb); 162 dev_kfree_skb_any(skb);
163} 163}
164EXPORT_SYMBOL_GPL(rt2x00mac_tx); 164EXPORT_SYMBOL_GPL(rt2x00mac_tx);
@@ -411,11 +411,11 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
411 * of different types, but has no a separate filter for PS Poll frames, 411 * of different types, but has no a separate filter for PS Poll frames,
412 * FIF_CONTROL flag implies FIF_PSPOLL. 412 * FIF_CONTROL flag implies FIF_PSPOLL.
413 */ 413 */
414 if (!test_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags)) { 414 if (!test_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags)) {
415 if (*total_flags & FIF_CONTROL || *total_flags & FIF_PSPOLL) 415 if (*total_flags & FIF_CONTROL || *total_flags & FIF_PSPOLL)
416 *total_flags |= FIF_CONTROL | FIF_PSPOLL; 416 *total_flags |= FIF_CONTROL | FIF_PSPOLL;
417 } 417 }
418 if (!test_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags)) { 418 if (!test_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags)) {
419 if (*total_flags & FIF_CONTROL) 419 if (*total_flags & FIF_CONTROL)
420 *total_flags |= FIF_PSPOLL; 420 *total_flags |= FIF_PSPOLL;
421 } 421 }
@@ -496,7 +496,7 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
496 496
497 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) 497 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
498 return 0; 498 return 0;
499 else if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) 499 else if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags))
500 return -EOPNOTSUPP; 500 return -EOPNOTSUPP;
501 else if (key->keylen > 32) 501 else if (key->keylen > 32)
502 return -ENOSPC; 502 return -ENOSPC;
@@ -562,7 +562,7 @@ EXPORT_SYMBOL_GPL(rt2x00mac_set_key);
562void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw) 562void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw)
563{ 563{
564 struct rt2x00_dev *rt2x00dev = hw->priv; 564 struct rt2x00_dev *rt2x00dev = hw->priv;
565 __set_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags); 565 set_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags);
566 rt2x00link_stop_tuner(rt2x00dev); 566 rt2x00link_stop_tuner(rt2x00dev);
567} 567}
568EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start); 568EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start);
@@ -570,7 +570,7 @@ EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start);
570void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw) 570void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw)
571{ 571{
572 struct rt2x00_dev *rt2x00dev = hw->priv; 572 struct rt2x00_dev *rt2x00dev = hw->priv;
573 __clear_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags); 573 clear_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags);
574 rt2x00link_start_tuner(rt2x00dev); 574 rt2x00link_start_tuner(rt2x00dev);
575} 575}
576EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_complete); 576EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_complete);
@@ -737,3 +737,84 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop)
737 rt2x00queue_flush_queue(queue, drop); 737 rt2x00queue_flush_queue(queue, drop);
738} 738}
739EXPORT_SYMBOL_GPL(rt2x00mac_flush); 739EXPORT_SYMBOL_GPL(rt2x00mac_flush);
740
741int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
742{
743 struct rt2x00_dev *rt2x00dev = hw->priv;
744 struct link_ant *ant = &rt2x00dev->link.ant;
745 struct antenna_setup *def = &rt2x00dev->default_ant;
746 struct antenna_setup setup;
747
748 // The antenna value is not supposed to be 0,
749 // or exceed the maximum number of antenna's.
750 if (!tx_ant || (tx_ant & ~3) || !rx_ant || (rx_ant & ~3))
751 return -EINVAL;
752
753 // When the client tried to configure the antenna to or from
754 // diversity mode, we must reset the default antenna as well
755 // as that controls the diversity switch.
756 if (ant->flags & ANTENNA_TX_DIVERSITY && tx_ant != 3)
757 ant->flags &= ~ANTENNA_TX_DIVERSITY;
758 if (ant->flags & ANTENNA_RX_DIVERSITY && rx_ant != 3)
759 ant->flags &= ~ANTENNA_RX_DIVERSITY;
760
761 // If diversity is being enabled, check if we need hardware
762 // or software diversity. In the latter case, reset the value,
763 // and make sure we update the antenna flags to have the
764 // link tuner pick up the diversity tuning.
765 if (tx_ant == 3 && def->tx == ANTENNA_SW_DIVERSITY) {
766 tx_ant = ANTENNA_SW_DIVERSITY;
767 ant->flags |= ANTENNA_TX_DIVERSITY;
768 }
769
770 if (rx_ant == 3 && def->rx == ANTENNA_SW_DIVERSITY) {
771 rx_ant = ANTENNA_SW_DIVERSITY;
772 ant->flags |= ANTENNA_RX_DIVERSITY;
773 }
774
775 setup.tx = tx_ant;
776 setup.rx = rx_ant;
777
778 rt2x00lib_config_antenna(rt2x00dev, setup);
779
780 return 0;
781}
782EXPORT_SYMBOL_GPL(rt2x00mac_set_antenna);
783
784int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
785{
786 struct rt2x00_dev *rt2x00dev = hw->priv;
787 struct link_ant *ant = &rt2x00dev->link.ant;
788 struct antenna_setup *active = &rt2x00dev->link.ant.active;
789
790 // When software diversity is active, we must report this to the
791 // client and not the current active antenna state.
792 if (ant->flags & ANTENNA_TX_DIVERSITY)
793 *tx_ant = ANTENNA_HW_DIVERSITY;
794 else
795 *tx_ant = active->tx;
796
797 if (ant->flags & ANTENNA_RX_DIVERSITY)
798 *rx_ant = ANTENNA_HW_DIVERSITY;
799 else
800 *rx_ant = active->rx;
801
802 return 0;
803}
804EXPORT_SYMBOL_GPL(rt2x00mac_get_antenna);
805
806void rt2x00mac_get_ringparam(struct ieee80211_hw *hw,
807 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
808{
809 struct rt2x00_dev *rt2x00dev = hw->priv;
810 struct data_queue *queue;
811
812 tx_queue_for_each(rt2x00dev, queue) {
813 *tx += queue->length;
814 *tx_max += queue->limit;
815 }
816
817 *rx = rt2x00dev->rx->length;
818 *rx_max = rt2x00dev->rx->limit;
819}
820EXPORT_SYMBOL_GPL(rt2x00mac_get_ringparam);
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 9649bd0cd718..17148bb24426 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -99,6 +99,15 @@ bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
99} 99}
100EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); 100EXPORT_SYMBOL_GPL(rt2x00pci_rxdone);
101 101
102void rt2x00pci_flush_queue(struct data_queue *queue, bool drop)
103{
104 unsigned int i;
105
106 for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++)
107 msleep(10);
108}
109EXPORT_SYMBOL_GPL(rt2x00pci_flush_queue);
110
102/* 111/*
103 * Device initialization handlers. 112 * Device initialization handlers.
104 */ 113 */
@@ -242,9 +251,8 @@ exit:
242 return -ENOMEM; 251 return -ENOMEM;
243} 252}
244 253
245int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) 254int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops)
246{ 255{
247 struct rt2x00_ops *ops = (struct rt2x00_ops *)id->driver_data;
248 struct ieee80211_hw *hw; 256 struct ieee80211_hw *hw;
249 struct rt2x00_dev *rt2x00dev; 257 struct rt2x00_dev *rt2x00dev;
250 int retval; 258 int retval;
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.h b/drivers/net/wireless/rt2x00/rt2x00pci.h
index 07961b8b369a..e2c99f2b9a14 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.h
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.h
@@ -107,6 +107,16 @@ struct queue_entry_priv_pci {
107 */ 107 */
108bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); 108bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev);
109 109
110/**
111 * rt2x00pci_flush_queue - Flush data queue
112 * @queue: Data queue to stop
113 * @drop: True to drop all pending frames.
114 *
115 * This will wait for a maximum of 100ms, waiting for the queues
116 * to become empty.
117 */
118void rt2x00pci_flush_queue(struct data_queue *queue, bool drop);
119
110/* 120/*
111 * Device initialization handlers. 121 * Device initialization handlers.
112 */ 122 */
@@ -116,7 +126,7 @@ void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev);
116/* 126/*
117 * PCI driver handlers. 127 * PCI driver handlers.
118 */ 128 */
119int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id); 129int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops);
120void rt2x00pci_remove(struct pci_dev *pci_dev); 130void rt2x00pci_remove(struct pci_dev *pci_dev);
121#ifdef CONFIG_PM 131#ifdef CONFIG_PM
122int rt2x00pci_suspend(struct pci_dev *pci_dev, pm_message_t state); 132int rt2x00pci_suspend(struct pci_dev *pci_dev, pm_message_t state);
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 94b8bbb7ad80..ab8c16f8bcaf 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -60,7 +60,7 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry)
60 * at least 8 bytes bytes available in headroom for IV/EIV 60 * at least 8 bytes bytes available in headroom for IV/EIV
61 * and 8 bytes for ICV data as tailroon. 61 * and 8 bytes for ICV data as tailroon.
62 */ 62 */
63 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { 63 if (test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) {
64 head_size += 8; 64 head_size += 8;
65 tail_size += 8; 65 tail_size += 8;
66 } 66 }
@@ -86,7 +86,7 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry)
86 memset(skbdesc, 0, sizeof(*skbdesc)); 86 memset(skbdesc, 0, sizeof(*skbdesc));
87 skbdesc->entry = entry; 87 skbdesc->entry = entry;
88 88
89 if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags)) { 89 if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags)) {
90 skbdesc->skb_dma = dma_map_single(rt2x00dev->dev, 90 skbdesc->skb_dma = dma_map_single(rt2x00dev->dev,
91 skb->data, 91 skb->data,
92 skb->len, 92 skb->len,
@@ -213,7 +213,7 @@ static void rt2x00queue_create_tx_descriptor_seq(struct queue_entry *entry,
213 213
214 __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); 214 __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
215 215
216 if (!test_bit(DRIVER_REQUIRE_SW_SEQNO, &entry->queue->rt2x00dev->flags)) 216 if (!test_bit(REQUIRE_SW_SEQNO, &entry->queue->rt2x00dev->cap_flags))
217 return; 217 return;
218 218
219 /* 219 /*
@@ -302,6 +302,85 @@ static void rt2x00queue_create_tx_descriptor_plcp(struct queue_entry *entry,
302 } 302 }
303} 303}
304 304
305static void rt2x00queue_create_tx_descriptor_ht(struct queue_entry *entry,
306 struct txentry_desc *txdesc,
307 const struct rt2x00_rate *hwrate)
308{
309 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
310 struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
311 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data;
312
313 if (tx_info->control.sta)
314 txdesc->u.ht.mpdu_density =
315 tx_info->control.sta->ht_cap.ampdu_density;
316
317 txdesc->u.ht.ba_size = 7; /* FIXME: What value is needed? */
318
319 /*
320 * Only one STBC stream is supported for now.
321 */
322 if (tx_info->flags & IEEE80211_TX_CTL_STBC)
323 txdesc->u.ht.stbc = 1;
324
325 /*
326 * If IEEE80211_TX_RC_MCS is set txrate->idx just contains the
327 * mcs rate to be used
328 */
329 if (txrate->flags & IEEE80211_TX_RC_MCS) {
330 txdesc->u.ht.mcs = txrate->idx;
331
332 /*
333 * MIMO PS should be set to 1 for STA's using dynamic SM PS
334 * when using more then one tx stream (>MCS7).
335 */
336 if (tx_info->control.sta && txdesc->u.ht.mcs > 7 &&
337 ((tx_info->control.sta->ht_cap.cap &
338 IEEE80211_HT_CAP_SM_PS) >>
339 IEEE80211_HT_CAP_SM_PS_SHIFT) ==
340 WLAN_HT_CAP_SM_PS_DYNAMIC)
341 __set_bit(ENTRY_TXD_HT_MIMO_PS, &txdesc->flags);
342 } else {
343 txdesc->u.ht.mcs = rt2x00_get_rate_mcs(hwrate->mcs);
344 if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
345 txdesc->u.ht.mcs |= 0x08;
346 }
347
348 /*
349 * This frame is eligible for an AMPDU, however, don't aggregate
350 * frames that are intended to probe a specific tx rate.
351 */
352 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU &&
353 !(tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE))
354 __set_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags);
355
356 /*
357 * Set 40Mhz mode if necessary (for legacy rates this will
358 * duplicate the frame to both channels).
359 */
360 if (txrate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH ||
361 txrate->flags & IEEE80211_TX_RC_DUP_DATA)
362 __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags);
363 if (txrate->flags & IEEE80211_TX_RC_SHORT_GI)
364 __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags);
365
366 /*
367 * Determine IFS values
368 * - Use TXOP_BACKOFF for management frames except beacons
369 * - Use TXOP_SIFS for fragment bursts
370 * - Use TXOP_HTTXOP for everything else
371 *
372 * Note: rt2800 devices won't use CTS protection (if used)
373 * for frames not transmitted with TXOP_HTTXOP
374 */
375 if (ieee80211_is_mgmt(hdr->frame_control) &&
376 !ieee80211_is_beacon(hdr->frame_control))
377 txdesc->u.ht.txop = TXOP_BACKOFF;
378 else if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT))
379 txdesc->u.ht.txop = TXOP_SIFS;
380 else
381 txdesc->u.ht.txop = TXOP_HTTXOP;
382}
383
305static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, 384static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
306 struct txentry_desc *txdesc) 385 struct txentry_desc *txdesc)
307{ 386{
@@ -396,8 +475,8 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
396 rt2x00crypto_create_tx_descriptor(entry, txdesc); 475 rt2x00crypto_create_tx_descriptor(entry, txdesc);
397 rt2x00queue_create_tx_descriptor_seq(entry, txdesc); 476 rt2x00queue_create_tx_descriptor_seq(entry, txdesc);
398 477
399 if (test_bit(DRIVER_REQUIRE_HT_TX_DESC, &rt2x00dev->flags)) 478 if (test_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags))
400 rt2x00ht_create_tx_descriptor(entry, txdesc, hwrate); 479 rt2x00queue_create_tx_descriptor_ht(entry, txdesc, hwrate);
401 else 480 else
402 rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate); 481 rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
403} 482}
@@ -436,7 +515,7 @@ static int rt2x00queue_write_tx_data(struct queue_entry *entry,
436 /* 515 /*
437 * Map the skb to DMA. 516 * Map the skb to DMA.
438 */ 517 */
439 if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags)) 518 if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags))
440 rt2x00queue_map_txskb(entry); 519 rt2x00queue_map_txskb(entry);
441 520
442 return 0; 521 return 0;
@@ -529,7 +608,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
529 */ 608 */
530 if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) && 609 if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) &&
531 !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags)) { 610 !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags)) {
532 if (test_bit(DRIVER_REQUIRE_COPY_IV, &queue->rt2x00dev->flags)) 611 if (test_bit(REQUIRE_COPY_IV, &queue->rt2x00dev->cap_flags))
533 rt2x00crypto_tx_copy_iv(skb, &txdesc); 612 rt2x00crypto_tx_copy_iv(skb, &txdesc);
534 else 613 else
535 rt2x00crypto_tx_remove_iv(skb, &txdesc); 614 rt2x00crypto_tx_remove_iv(skb, &txdesc);
@@ -543,9 +622,9 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
543 * PCI and USB devices, while header alignment only is valid 622 * PCI and USB devices, while header alignment only is valid
544 * for PCI devices. 623 * for PCI devices.
545 */ 624 */
546 if (test_bit(DRIVER_REQUIRE_L2PAD, &queue->rt2x00dev->flags)) 625 if (test_bit(REQUIRE_L2PAD, &queue->rt2x00dev->cap_flags))
547 rt2x00queue_insert_l2pad(entry->skb, txdesc.header_length); 626 rt2x00queue_insert_l2pad(entry->skb, txdesc.header_length);
548 else if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags)) 627 else if (test_bit(REQUIRE_DMA, &queue->rt2x00dev->cap_flags))
549 rt2x00queue_align_frame(entry->skb); 628 rt2x00queue_align_frame(entry->skb);
550 629
551 /* 630 /*
@@ -561,7 +640,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
561 640
562 set_bit(ENTRY_DATA_PENDING, &entry->flags); 641 set_bit(ENTRY_DATA_PENDING, &entry->flags);
563 642
564 rt2x00queue_index_inc(queue, Q_INDEX); 643 rt2x00queue_index_inc(entry, Q_INDEX);
565 rt2x00queue_write_tx_descriptor(entry, &txdesc); 644 rt2x00queue_write_tx_descriptor(entry, &txdesc);
566 rt2x00queue_kick_tx_queue(queue, &txdesc); 645 rt2x00queue_kick_tx_queue(queue, &txdesc);
567 646
@@ -650,10 +729,12 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
650 return ret; 729 return ret;
651} 730}
652 731
653void rt2x00queue_for_each_entry(struct data_queue *queue, 732bool rt2x00queue_for_each_entry(struct data_queue *queue,
654 enum queue_index start, 733 enum queue_index start,
655 enum queue_index end, 734 enum queue_index end,
656 void (*fn)(struct queue_entry *entry)) 735 void *data,
736 bool (*fn)(struct queue_entry *entry,
737 void *data))
657{ 738{
658 unsigned long irqflags; 739 unsigned long irqflags;
659 unsigned int index_start; 740 unsigned int index_start;
@@ -664,7 +745,7 @@ void rt2x00queue_for_each_entry(struct data_queue *queue,
664 ERROR(queue->rt2x00dev, 745 ERROR(queue->rt2x00dev,
665 "Entry requested from invalid index range (%d - %d)\n", 746 "Entry requested from invalid index range (%d - %d)\n",
666 start, end); 747 start, end);
667 return; 748 return true;
668 } 749 }
669 750
670 /* 751 /*
@@ -683,15 +764,23 @@ void rt2x00queue_for_each_entry(struct data_queue *queue,
683 * send out all frames in the correct order. 764 * send out all frames in the correct order.
684 */ 765 */
685 if (index_start < index_end) { 766 if (index_start < index_end) {
686 for (i = index_start; i < index_end; i++) 767 for (i = index_start; i < index_end; i++) {
687 fn(&queue->entries[i]); 768 if (fn(&queue->entries[i], data))
769 return true;
770 }
688 } else { 771 } else {
689 for (i = index_start; i < queue->limit; i++) 772 for (i = index_start; i < queue->limit; i++) {
690 fn(&queue->entries[i]); 773 if (fn(&queue->entries[i], data))
774 return true;
775 }
691 776
692 for (i = 0; i < index_end; i++) 777 for (i = 0; i < index_end; i++) {
693 fn(&queue->entries[i]); 778 if (fn(&queue->entries[i], data))
779 return true;
780 }
694 } 781 }
782
783 return false;
695} 784}
696EXPORT_SYMBOL_GPL(rt2x00queue_for_each_entry); 785EXPORT_SYMBOL_GPL(rt2x00queue_for_each_entry);
697 786
@@ -717,8 +806,9 @@ struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue,
717} 806}
718EXPORT_SYMBOL_GPL(rt2x00queue_get_entry); 807EXPORT_SYMBOL_GPL(rt2x00queue_get_entry);
719 808
720void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index) 809void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index)
721{ 810{
811 struct data_queue *queue = entry->queue;
722 unsigned long irqflags; 812 unsigned long irqflags;
723 813
724 if (unlikely(index >= Q_INDEX_MAX)) { 814 if (unlikely(index >= Q_INDEX_MAX)) {
@@ -733,7 +823,7 @@ void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index)
733 if (queue->index[index] >= queue->limit) 823 if (queue->index[index] >= queue->limit)
734 queue->index[index] = 0; 824 queue->index[index] = 0;
735 825
736 queue->last_action[index] = jiffies; 826 entry->last_action = jiffies;
737 827
738 if (index == Q_INDEX) { 828 if (index == Q_INDEX) {
739 queue->length++; 829 queue->length++;
@@ -838,7 +928,6 @@ EXPORT_SYMBOL_GPL(rt2x00queue_stop_queue);
838 928
839void rt2x00queue_flush_queue(struct data_queue *queue, bool drop) 929void rt2x00queue_flush_queue(struct data_queue *queue, bool drop)
840{ 930{
841 unsigned int i;
842 bool started; 931 bool started;
843 bool tx_queue = 932 bool tx_queue =
844 (queue->qid == QID_AC_VO) || 933 (queue->qid == QID_AC_VO) ||
@@ -873,20 +962,12 @@ void rt2x00queue_flush_queue(struct data_queue *queue, bool drop)
873 } 962 }
874 963
875 /* 964 /*
876 * Check if driver supports flushing, we can only guarantee 965 * Check if driver supports flushing, if that is the case we can
877 * full support for flushing if the driver is able 966 * defer the flushing to the driver. Otherwise we must use the
878 * to cancel all pending frames (drop = true). 967 * alternative which just waits for the queue to become empty.
879 */ 968 */
880 if (drop && queue->rt2x00dev->ops->lib->flush_queue) 969 if (likely(queue->rt2x00dev->ops->lib->flush_queue))
881 queue->rt2x00dev->ops->lib->flush_queue(queue); 970 queue->rt2x00dev->ops->lib->flush_queue(queue, drop);
882
883 /*
884 * When we don't want to drop any frames, or when
885 * the driver doesn't fully flush the queue correcly,
886 * we must wait for the queue to become empty.
887 */
888 for (i = 0; !rt2x00queue_empty(queue) && i < 100; i++)
889 msleep(10);
890 971
891 /* 972 /*
892 * The queue flush has failed... 973 * The queue flush has failed...
@@ -959,10 +1040,8 @@ static void rt2x00queue_reset(struct data_queue *queue)
959 queue->count = 0; 1040 queue->count = 0;
960 queue->length = 0; 1041 queue->length = 0;
961 1042
962 for (i = 0; i < Q_INDEX_MAX; i++) { 1043 for (i = 0; i < Q_INDEX_MAX; i++)
963 queue->index[i] = 0; 1044 queue->index[i] = 0;
964 queue->last_action[i] = jiffies;
965 }
966 1045
967 spin_unlock_irqrestore(&queue->index_lock, irqflags); 1046 spin_unlock_irqrestore(&queue->index_lock, irqflags);
968} 1047}
@@ -1069,7 +1148,7 @@ int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev)
1069 if (status) 1148 if (status)
1070 goto exit; 1149 goto exit;
1071 1150
1072 if (test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) { 1151 if (test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags)) {
1073 status = rt2x00queue_alloc_entries(rt2x00dev->atim, 1152 status = rt2x00queue_alloc_entries(rt2x00dev->atim,
1074 rt2x00dev->ops->atim); 1153 rt2x00dev->ops->atim);
1075 if (status) 1154 if (status)
@@ -1121,7 +1200,7 @@ int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev)
1121 struct data_queue *queue; 1200 struct data_queue *queue;
1122 enum data_queue_qid qid; 1201 enum data_queue_qid qid;
1123 unsigned int req_atim = 1202 unsigned int req_atim =
1124 !!test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); 1203 !!test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags);
1125 1204
1126 /* 1205 /*
1127 * We need the following queues: 1206 * We need the following queues:
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index 5db6a99fce7d..167d45873dca 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -364,6 +364,7 @@ enum queue_entry_flags {
364 * struct queue_entry: Entry inside the &struct data_queue 364 * struct queue_entry: Entry inside the &struct data_queue
365 * 365 *
366 * @flags: Entry flags, see &enum queue_entry_flags. 366 * @flags: Entry flags, see &enum queue_entry_flags.
367 * @last_action: Timestamp of last change.
367 * @queue: The data queue (&struct data_queue) to which this entry belongs. 368 * @queue: The data queue (&struct data_queue) to which this entry belongs.
368 * @skb: The buffer which is currently being transmitted (for TX queue), 369 * @skb: The buffer which is currently being transmitted (for TX queue),
369 * or used to directly receive data in (for RX queue). 370 * or used to directly receive data in (for RX queue).
@@ -373,6 +374,7 @@ enum queue_entry_flags {
373 */ 374 */
374struct queue_entry { 375struct queue_entry {
375 unsigned long flags; 376 unsigned long flags;
377 unsigned long last_action;
376 378
377 struct data_queue *queue; 379 struct data_queue *queue;
378 380
@@ -463,7 +465,6 @@ struct data_queue {
463 unsigned short threshold; 465 unsigned short threshold;
464 unsigned short length; 466 unsigned short length;
465 unsigned short index[Q_INDEX_MAX]; 467 unsigned short index[Q_INDEX_MAX];
466 unsigned long last_action[Q_INDEX_MAX];
467 468
468 unsigned short txop; 469 unsigned short txop;
469 unsigned short aifs; 470 unsigned short aifs;
@@ -580,16 +581,22 @@ struct data_queue_desc {
580 * @queue: Pointer to @data_queue 581 * @queue: Pointer to @data_queue
581 * @start: &enum queue_index Pointer to start index 582 * @start: &enum queue_index Pointer to start index
582 * @end: &enum queue_index Pointer to end index 583 * @end: &enum queue_index Pointer to end index
584 * @data: Data to pass to the callback function
583 * @fn: The function to call for each &struct queue_entry 585 * @fn: The function to call for each &struct queue_entry
584 * 586 *
585 * This will walk through all entries in the queue, in chronological 587 * This will walk through all entries in the queue, in chronological
586 * order. This means it will start at the current @start pointer 588 * order. This means it will start at the current @start pointer
587 * and will walk through the queue until it reaches the @end pointer. 589 * and will walk through the queue until it reaches the @end pointer.
590 *
591 * If fn returns true for an entry rt2x00queue_for_each_entry will stop
592 * processing and return true as well.
588 */ 593 */
589void rt2x00queue_for_each_entry(struct data_queue *queue, 594bool rt2x00queue_for_each_entry(struct data_queue *queue,
590 enum queue_index start, 595 enum queue_index start,
591 enum queue_index end, 596 enum queue_index end,
592 void (*fn)(struct queue_entry *entry)); 597 void *data,
598 bool (*fn)(struct queue_entry *entry,
599 void *data));
593 600
594/** 601/**
595 * rt2x00queue_empty - Check if the queue is empty. 602 * rt2x00queue_empty - Check if the queue is empty.
@@ -629,22 +636,24 @@ static inline int rt2x00queue_threshold(struct data_queue *queue)
629 636
630/** 637/**
631 * rt2x00queue_status_timeout - Check if a timeout occurred for STATUS reports 638 * rt2x00queue_status_timeout - Check if a timeout occurred for STATUS reports
632 * @queue: Queue to check. 639 * @entry: Queue entry to check.
633 */ 640 */
634static inline int rt2x00queue_status_timeout(struct data_queue *queue) 641static inline int rt2x00queue_status_timeout(struct queue_entry *entry)
635{ 642{
636 return time_after(queue->last_action[Q_INDEX_DMA_DONE], 643 if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
637 queue->last_action[Q_INDEX_DONE] + (HZ / 10)); 644 return false;
645 return time_after(jiffies, entry->last_action + msecs_to_jiffies(100));
638} 646}
639 647
640/** 648/**
641 * rt2x00queue_timeout - Check if a timeout occurred for DMA transfers 649 * rt2x00queue_dma_timeout - Check if a timeout occurred for DMA transfers
642 * @queue: Queue to check. 650 * @entry: Queue entry to check.
643 */ 651 */
644static inline int rt2x00queue_dma_timeout(struct data_queue *queue) 652static inline int rt2x00queue_dma_timeout(struct queue_entry *entry)
645{ 653{
646 return time_after(queue->last_action[Q_INDEX], 654 if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
647 queue->last_action[Q_INDEX_DMA_DONE] + (HZ / 10)); 655 return false;
656 return time_after(jiffies, entry->last_action + msecs_to_jiffies(100));
648} 657}
649 658
650/** 659/**
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 36f388f97d65..cb208d589ff8 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -165,6 +165,56 @@ int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev,
165} 165}
166EXPORT_SYMBOL_GPL(rt2x00usb_regbusy_read); 166EXPORT_SYMBOL_GPL(rt2x00usb_regbusy_read);
167 167
168
169struct rt2x00_async_read_data {
170 __le32 reg;
171 struct usb_ctrlrequest cr;
172 struct rt2x00_dev *rt2x00dev;
173 void (*callback)(struct rt2x00_dev *,int,u32);
174};
175
176static void rt2x00usb_register_read_async_cb(struct urb *urb)
177{
178 struct rt2x00_async_read_data *rd = urb->context;
179 rd->callback(rd->rt2x00dev, urb->status, le32_to_cpu(rd->reg));
180 kfree(urb->context);
181}
182
183void rt2x00usb_register_read_async(struct rt2x00_dev *rt2x00dev,
184 const unsigned int offset,
185 void (*callback)(struct rt2x00_dev*,int,u32))
186{
187 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
188 struct urb *urb;
189 struct rt2x00_async_read_data *rd;
190
191 rd = kmalloc(sizeof(*rd), GFP_ATOMIC);
192 if (!rd)
193 return;
194
195 urb = usb_alloc_urb(0, GFP_ATOMIC);
196 if (!urb) {
197 kfree(rd);
198 return;
199 }
200
201 rd->rt2x00dev = rt2x00dev;
202 rd->callback = callback;
203 rd->cr.bRequestType = USB_VENDOR_REQUEST_IN;
204 rd->cr.bRequest = USB_MULTI_READ;
205 rd->cr.wValue = 0;
206 rd->cr.wIndex = cpu_to_le16(offset);
207 rd->cr.wLength = cpu_to_le16(sizeof(u32));
208
209 usb_fill_control_urb(urb, usb_dev, usb_rcvctrlpipe(usb_dev, 0),
210 (unsigned char *)(&rd->cr), &rd->reg, sizeof(rd->reg),
211 rt2x00usb_register_read_async_cb, rd);
212 if (usb_submit_urb(urb, GFP_ATOMIC) < 0)
213 kfree(rd);
214 usb_free_urb(urb);
215}
216EXPORT_SYMBOL_GPL(rt2x00usb_register_read_async);
217
168/* 218/*
169 * TX data handlers. 219 * TX data handlers.
170 */ 220 */
@@ -212,6 +262,9 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
212 if (!test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) 262 if (!test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
213 return; 263 return;
214 264
265 if (rt2x00dev->ops->lib->tx_dma_done)
266 rt2x00dev->ops->lib->tx_dma_done(entry);
267
215 /* 268 /*
216 * Report the frame as DMA done 269 * Report the frame as DMA done
217 */ 270 */
@@ -227,10 +280,12 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
227 * Schedule the delayed work for reading the TX status 280 * Schedule the delayed work for reading the TX status
228 * from the device. 281 * from the device.
229 */ 282 */
230 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); 283 if (!test_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags) ||
284 !kfifo_is_empty(&rt2x00dev->txstatus_fifo))
285 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
231} 286}
232 287
233static void rt2x00usb_kick_tx_entry(struct queue_entry *entry) 288static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry, void* data)
234{ 289{
235 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 290 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
236 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); 291 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
@@ -240,7 +295,7 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
240 295
241 if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags) || 296 if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags) ||
242 test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) 297 test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
243 return; 298 return true;
244 299
245 /* 300 /*
246 * USB devices cannot blindly pass the skb->len as the 301 * USB devices cannot blindly pass the skb->len as the
@@ -261,6 +316,8 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
261 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); 316 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
262 rt2x00lib_dmadone(entry); 317 rt2x00lib_dmadone(entry);
263 } 318 }
319
320 return false;
264} 321}
265 322
266/* 323/*
@@ -323,7 +380,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
323 queue_work(rt2x00dev->workqueue, &rt2x00dev->rxdone_work); 380 queue_work(rt2x00dev->workqueue, &rt2x00dev->rxdone_work);
324} 381}
325 382
326static void rt2x00usb_kick_rx_entry(struct queue_entry *entry) 383static bool rt2x00usb_kick_rx_entry(struct queue_entry *entry, void* data)
327{ 384{
328 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 385 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
329 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); 386 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
@@ -332,7 +389,7 @@ static void rt2x00usb_kick_rx_entry(struct queue_entry *entry)
332 389
333 if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || 390 if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) ||
334 test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) 391 test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
335 return; 392 return true;
336 393
337 rt2x00lib_dmastart(entry); 394 rt2x00lib_dmastart(entry);
338 395
@@ -348,6 +405,8 @@ static void rt2x00usb_kick_rx_entry(struct queue_entry *entry)
348 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); 405 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
349 rt2x00lib_dmadone(entry); 406 rt2x00lib_dmadone(entry);
350 } 407 }
408
409 return false;
351} 410}
352 411
353void rt2x00usb_kick_queue(struct data_queue *queue) 412void rt2x00usb_kick_queue(struct data_queue *queue)
@@ -358,12 +417,18 @@ void rt2x00usb_kick_queue(struct data_queue *queue)
358 case QID_AC_BE: 417 case QID_AC_BE:
359 case QID_AC_BK: 418 case QID_AC_BK:
360 if (!rt2x00queue_empty(queue)) 419 if (!rt2x00queue_empty(queue))
361 rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, 420 rt2x00queue_for_each_entry(queue,
421 Q_INDEX_DONE,
422 Q_INDEX,
423 NULL,
362 rt2x00usb_kick_tx_entry); 424 rt2x00usb_kick_tx_entry);
363 break; 425 break;
364 case QID_RX: 426 case QID_RX:
365 if (!rt2x00queue_full(queue)) 427 if (!rt2x00queue_full(queue))
366 rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, 428 rt2x00queue_for_each_entry(queue,
429 Q_INDEX_DONE,
430 Q_INDEX,
431 NULL,
367 rt2x00usb_kick_rx_entry); 432 rt2x00usb_kick_rx_entry);
368 break; 433 break;
369 default: 434 default:
@@ -372,14 +437,14 @@ void rt2x00usb_kick_queue(struct data_queue *queue)
372} 437}
373EXPORT_SYMBOL_GPL(rt2x00usb_kick_queue); 438EXPORT_SYMBOL_GPL(rt2x00usb_kick_queue);
374 439
375static void rt2x00usb_flush_entry(struct queue_entry *entry) 440static bool rt2x00usb_flush_entry(struct queue_entry *entry, void* data)
376{ 441{
377 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 442 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
378 struct queue_entry_priv_usb *entry_priv = entry->priv_data; 443 struct queue_entry_priv_usb *entry_priv = entry->priv_data;
379 struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; 444 struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data;
380 445
381 if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) 446 if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
382 return; 447 return true;
383 448
384 usb_kill_urb(entry_priv->urb); 449 usb_kill_urb(entry_priv->urb);
385 450
@@ -387,17 +452,20 @@ static void rt2x00usb_flush_entry(struct queue_entry *entry)
387 * Kill guardian urb (if required by driver). 452 * Kill guardian urb (if required by driver).
388 */ 453 */
389 if ((entry->queue->qid == QID_BEACON) && 454 if ((entry->queue->qid == QID_BEACON) &&
390 (test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags))) 455 (test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags)))
391 usb_kill_urb(bcn_priv->guardian_urb); 456 usb_kill_urb(bcn_priv->guardian_urb);
457
458 return false;
392} 459}
393 460
394void rt2x00usb_flush_queue(struct data_queue *queue) 461void rt2x00usb_flush_queue(struct data_queue *queue, bool drop)
395{ 462{
396 struct work_struct *completion; 463 struct work_struct *completion;
397 unsigned int i; 464 unsigned int i;
398 465
399 rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, 466 if (drop)
400 rt2x00usb_flush_entry); 467 rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, NULL,
468 rt2x00usb_flush_entry);
401 469
402 /* 470 /*
403 * Obtain the queue completion handler 471 * Obtain the queue completion handler
@@ -416,7 +484,7 @@ void rt2x00usb_flush_queue(struct data_queue *queue)
416 return; 484 return;
417 } 485 }
418 486
419 for (i = 0; i < 20; i++) { 487 for (i = 0; i < 10; i++) {
420 /* 488 /*
421 * Check if the driver is already done, otherwise we 489 * Check if the driver is already done, otherwise we
422 * have to sleep a little while to give the driver/hw 490 * have to sleep a little while to give the driver/hw
@@ -456,15 +524,31 @@ static void rt2x00usb_watchdog_tx_status(struct data_queue *queue)
456 queue_work(queue->rt2x00dev->workqueue, &queue->rt2x00dev->txdone_work); 524 queue_work(queue->rt2x00dev->workqueue, &queue->rt2x00dev->txdone_work);
457} 525}
458 526
527static int rt2x00usb_status_timeout(struct data_queue *queue)
528{
529 struct queue_entry *entry;
530
531 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
532 return rt2x00queue_status_timeout(entry);
533}
534
535static int rt2x00usb_dma_timeout(struct data_queue *queue)
536{
537 struct queue_entry *entry;
538
539 entry = rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE);
540 return rt2x00queue_dma_timeout(entry);
541}
542
459void rt2x00usb_watchdog(struct rt2x00_dev *rt2x00dev) 543void rt2x00usb_watchdog(struct rt2x00_dev *rt2x00dev)
460{ 544{
461 struct data_queue *queue; 545 struct data_queue *queue;
462 546
463 tx_queue_for_each(rt2x00dev, queue) { 547 tx_queue_for_each(rt2x00dev, queue) {
464 if (!rt2x00queue_empty(queue)) { 548 if (!rt2x00queue_empty(queue)) {
465 if (rt2x00queue_dma_timeout(queue)) 549 if (rt2x00usb_dma_timeout(queue))
466 rt2x00usb_watchdog_tx_dma(queue); 550 rt2x00usb_watchdog_tx_dma(queue);
467 if (rt2x00queue_status_timeout(queue)) 551 if (rt2x00usb_status_timeout(queue))
468 rt2x00usb_watchdog_tx_status(queue); 552 rt2x00usb_watchdog_tx_status(queue);
469 } 553 }
470 } 554 }
@@ -489,7 +573,7 @@ void rt2x00usb_clear_entry(struct queue_entry *entry)
489 entry->flags = 0; 573 entry->flags = 0;
490 574
491 if (entry->queue->qid == QID_RX) 575 if (entry->queue->qid == QID_RX)
492 rt2x00usb_kick_rx_entry(entry); 576 rt2x00usb_kick_rx_entry(entry, NULL);
493} 577}
494EXPORT_SYMBOL_GPL(rt2x00usb_clear_entry); 578EXPORT_SYMBOL_GPL(rt2x00usb_clear_entry);
495 579
@@ -583,7 +667,7 @@ static int rt2x00usb_alloc_entries(struct data_queue *queue)
583 * then we are done. 667 * then we are done.
584 */ 668 */
585 if (queue->qid != QID_BEACON || 669 if (queue->qid != QID_BEACON ||
586 !test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags)) 670 !test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags))
587 return 0; 671 return 0;
588 672
589 for (i = 0; i < queue->limit; i++) { 673 for (i = 0; i < queue->limit; i++) {
@@ -618,7 +702,7 @@ static void rt2x00usb_free_entries(struct data_queue *queue)
618 * then we are done. 702 * then we are done.
619 */ 703 */
620 if (queue->qid != QID_BEACON || 704 if (queue->qid != QID_BEACON ||
621 !test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags)) 705 !test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags))
622 return; 706 return;
623 707
624 for (i = 0; i < queue->limit; i++) { 708 for (i = 0; i < queue->limit; i++) {
@@ -707,10 +791,9 @@ exit:
707} 791}
708 792
709int rt2x00usb_probe(struct usb_interface *usb_intf, 793int rt2x00usb_probe(struct usb_interface *usb_intf,
710 const struct usb_device_id *id) 794 const struct rt2x00_ops *ops)
711{ 795{
712 struct usb_device *usb_dev = interface_to_usbdev(usb_intf); 796 struct usb_device *usb_dev = interface_to_usbdev(usb_intf);
713 struct rt2x00_ops *ops = (struct rt2x00_ops *)id->driver_info;
714 struct ieee80211_hw *hw; 797 struct ieee80211_hw *hw;
715 struct rt2x00_dev *rt2x00dev; 798 struct rt2x00_dev *rt2x00dev;
716 int retval; 799 int retval;
@@ -735,6 +818,7 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
735 818
736 INIT_WORK(&rt2x00dev->rxdone_work, rt2x00usb_work_rxdone); 819 INIT_WORK(&rt2x00dev->rxdone_work, rt2x00usb_work_rxdone);
737 INIT_WORK(&rt2x00dev->txdone_work, rt2x00usb_work_txdone); 820 INIT_WORK(&rt2x00dev->txdone_work, rt2x00usb_work_txdone);
821 init_timer(&rt2x00dev->txstatus_timer);
738 822
739 retval = rt2x00usb_alloc_reg(rt2x00dev); 823 retval = rt2x00usb_alloc_reg(rt2x00dev);
740 if (retval) 824 if (retval)
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index e11c759ac9ed..64be34f612f6 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -35,12 +35,6 @@
35}) 35})
36 36
37/* 37/*
38 * This variable should be used with the
39 * usb_driver structure initialization.
40 */
41#define USB_DEVICE_DATA(__ops) .driver_info = (kernel_ulong_t)(__ops)
42
43/*
44 * For USB vendor requests we need to pass a timeout 38 * For USB vendor requests we need to pass a timeout
45 * time in ms, for this we use the REGISTER_TIMEOUT, 39 * time in ms, for this we use the REGISTER_TIMEOUT,
46 * however when loading firmware a higher value is 40 * however when loading firmware a higher value is
@@ -345,6 +339,21 @@ int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev,
345 const struct rt2x00_field32 field, 339 const struct rt2x00_field32 field,
346 u32 *reg); 340 u32 *reg);
347 341
342/**
343 * rt2x00usb_register_read_async - Asynchronously read 32bit register word
344 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
345 * @offset: Register offset
346 * @callback: Functon to call when read completes.
347 *
348 * Submit a control URB to read a 32bit register. This safe to
349 * be called from atomic context. The callback will be called
350 * when the URB completes. Otherwise the function is similar
351 * to rt2x00usb_register_read().
352 */
353void rt2x00usb_register_read_async(struct rt2x00_dev *rt2x00dev,
354 const unsigned int offset,
355 void (*callback)(struct rt2x00_dev*,int,u32));
356
348/* 357/*
349 * Radio handlers 358 * Radio handlers
350 */ 359 */
@@ -389,11 +398,13 @@ void rt2x00usb_kick_queue(struct data_queue *queue);
389/** 398/**
390 * rt2x00usb_flush_queue - Flush data queue 399 * rt2x00usb_flush_queue - Flush data queue
391 * @queue: Data queue to stop 400 * @queue: Data queue to stop
401 * @drop: True to drop all pending frames.
392 * 402 *
393 * This will walk through all entries of the queue and kill all 403 * This will walk through all entries of the queue and will optionally
394 * URB's which were send to the device. 404 * kill all URB's which were send to the device, or at least wait until
405 * they have been returned from the device..
395 */ 406 */
396void rt2x00usb_flush_queue(struct data_queue *queue); 407void rt2x00usb_flush_queue(struct data_queue *queue, bool drop);
397 408
398/** 409/**
399 * rt2x00usb_watchdog - Watchdog for USB communication 410 * rt2x00usb_watchdog - Watchdog for USB communication
@@ -416,7 +427,7 @@ void rt2x00usb_uninitialize(struct rt2x00_dev *rt2x00dev);
416 * USB driver handlers. 427 * USB driver handlers.
417 */ 428 */
418int rt2x00usb_probe(struct usb_interface *usb_intf, 429int rt2x00usb_probe(struct usb_interface *usb_intf,
419 const struct usb_device_id *id); 430 const struct rt2x00_ops *ops);
420void rt2x00usb_disconnect(struct usb_interface *usb_intf); 431void rt2x00usb_disconnect(struct usb_interface *usb_intf);
421#ifdef CONFIG_PM 432#ifdef CONFIG_PM
422int rt2x00usb_suspend(struct usb_interface *usb_intf, pm_message_t state); 433int rt2x00usb_suspend(struct usb_interface *usb_intf, pm_message_t state);
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 8ee1514a7943..9d35ec16a3a5 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -683,7 +683,7 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
683 683
684 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF2529)); 684 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF2529));
685 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 685 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
686 !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); 686 !test_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags));
687 687
688 /* 688 /*
689 * Configure the RX antenna. 689 * Configure the RX antenna.
@@ -811,10 +811,10 @@ static void rt61pci_config_ant(struct rt2x00_dev *rt2x00dev,
811 811
812 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { 812 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
813 sel = antenna_sel_a; 813 sel = antenna_sel_a;
814 lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); 814 lna = test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
815 } else { 815 } else {
816 sel = antenna_sel_bg; 816 sel = antenna_sel_bg;
817 lna = test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); 817 lna = test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
818 } 818 }
819 819
820 for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++) 820 for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++)
@@ -834,7 +834,7 @@ static void rt61pci_config_ant(struct rt2x00_dev *rt2x00dev,
834 else if (rt2x00_rf(rt2x00dev, RF2527)) 834 else if (rt2x00_rf(rt2x00dev, RF2527))
835 rt61pci_config_antenna_2x(rt2x00dev, ant); 835 rt61pci_config_antenna_2x(rt2x00dev, ant);
836 else if (rt2x00_rf(rt2x00dev, RF2529)) { 836 else if (rt2x00_rf(rt2x00dev, RF2529)) {
837 if (test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) 837 if (test_bit(CAPABILITY_DOUBLE_ANTENNA, &rt2x00dev->cap_flags))
838 rt61pci_config_antenna_2x(rt2x00dev, ant); 838 rt61pci_config_antenna_2x(rt2x00dev, ant);
839 else 839 else
840 rt61pci_config_antenna_2529(rt2x00dev, ant); 840 rt61pci_config_antenna_2529(rt2x00dev, ant);
@@ -848,13 +848,13 @@ static void rt61pci_config_lna_gain(struct rt2x00_dev *rt2x00dev,
848 short lna_gain = 0; 848 short lna_gain = 0;
849 849
850 if (libconf->conf->channel->band == IEEE80211_BAND_2GHZ) { 850 if (libconf->conf->channel->band == IEEE80211_BAND_2GHZ) {
851 if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags)) 851 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags))
852 lna_gain += 14; 852 lna_gain += 14;
853 853
854 rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &eeprom); 854 rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &eeprom);
855 lna_gain -= rt2x00_get_field16(eeprom, EEPROM_RSSI_OFFSET_BG_1); 855 lna_gain -= rt2x00_get_field16(eeprom, EEPROM_RSSI_OFFSET_BG_1);
856 } else { 856 } else {
857 if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) 857 if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags))
858 lna_gain += 14; 858 lna_gain += 14;
859 859
860 rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_A, &eeprom); 860 rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_A, &eeprom);
@@ -1050,14 +1050,14 @@ static void rt61pci_link_tuner(struct rt2x00_dev *rt2x00dev,
1050 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { 1050 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
1051 low_bound = 0x28; 1051 low_bound = 0x28;
1052 up_bound = 0x48; 1052 up_bound = 0x48;
1053 if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) { 1053 if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) {
1054 low_bound += 0x10; 1054 low_bound += 0x10;
1055 up_bound += 0x10; 1055 up_bound += 0x10;
1056 } 1056 }
1057 } else { 1057 } else {
1058 low_bound = 0x20; 1058 low_bound = 0x20;
1059 up_bound = 0x40; 1059 up_bound = 0x40;
1060 if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags)) { 1060 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) {
1061 low_bound += 0x10; 1061 low_bound += 0x10;
1062 up_bound += 0x10; 1062 up_bound += 0x10;
1063 } 1063 }
@@ -2260,8 +2260,8 @@ static void rt61pci_wakeup(struct rt2x00_dev *rt2x00dev)
2260 rt61pci_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS); 2260 rt61pci_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS);
2261} 2261}
2262 2262
2263static void rt61pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, 2263static inline void rt61pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,
2264 struct rt2x00_field32 irq_field) 2264 struct rt2x00_field32 irq_field)
2265{ 2265{
2266 u32 reg; 2266 u32 reg;
2267 2267
@@ -2537,7 +2537,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2537 * Determine number of antennas. 2537 * Determine number of antennas.
2538 */ 2538 */
2539 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_NUM) == 2) 2539 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_NUM) == 2)
2540 __set_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags); 2540 __set_bit(CAPABILITY_DOUBLE_ANTENNA, &rt2x00dev->cap_flags);
2541 2541
2542 /* 2542 /*
2543 * Identify default antenna configuration. 2543 * Identify default antenna configuration.
@@ -2551,20 +2551,20 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2551 * Read the Frame type. 2551 * Read the Frame type.
2552 */ 2552 */
2553 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_FRAME_TYPE)) 2553 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_FRAME_TYPE))
2554 __set_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags); 2554 __set_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags);
2555 2555
2556 /* 2556 /*
2557 * Detect if this device has a hardware controlled radio. 2557 * Detect if this device has a hardware controlled radio.
2558 */ 2558 */
2559 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) 2559 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
2560 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); 2560 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
2561 2561
2562 /* 2562 /*
2563 * Read frequency offset and RF programming sequence. 2563 * Read frequency offset and RF programming sequence.
2564 */ 2564 */
2565 rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom); 2565 rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
2566 if (rt2x00_get_field16(eeprom, EEPROM_FREQ_SEQ)) 2566 if (rt2x00_get_field16(eeprom, EEPROM_FREQ_SEQ))
2567 __set_bit(CONFIG_RF_SEQUENCE, &rt2x00dev->flags); 2567 __set_bit(CAPABILITY_RF_SEQUENCE, &rt2x00dev->cap_flags);
2568 2568
2569 rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET); 2569 rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
2570 2570
@@ -2574,9 +2574,9 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2574 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); 2574 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
2575 2575
2576 if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A)) 2576 if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A))
2577 __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); 2577 __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
2578 if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG)) 2578 if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG))
2579 __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); 2579 __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
2580 2580
2581 /* 2581 /*
2582 * When working with a RF2529 chip without double antenna, 2582 * When working with a RF2529 chip without double antenna,
@@ -2584,7 +2584,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2584 * eeprom word. 2584 * eeprom word.
2585 */ 2585 */
2586 if (rt2x00_rf(rt2x00dev, RF2529) && 2586 if (rt2x00_rf(rt2x00dev, RF2529) &&
2587 !test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) { 2587 !test_bit(CAPABILITY_DOUBLE_ANTENNA, &rt2x00dev->cap_flags)) {
2588 rt2x00dev->default_ant.rx = 2588 rt2x00dev->default_ant.rx =
2589 ANTENNA_A + rt2x00_get_field16(eeprom, EEPROM_NIC_RX_FIXED); 2589 ANTENNA_A + rt2x00_get_field16(eeprom, EEPROM_NIC_RX_FIXED);
2590 rt2x00dev->default_ant.tx = 2590 rt2x00dev->default_ant.tx =
@@ -2799,7 +2799,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2799 spec->supported_bands = SUPPORT_BAND_2GHZ; 2799 spec->supported_bands = SUPPORT_BAND_2GHZ;
2800 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; 2800 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
2801 2801
2802 if (!test_bit(CONFIG_RF_SEQUENCE, &rt2x00dev->flags)) { 2802 if (!test_bit(CAPABILITY_RF_SEQUENCE, &rt2x00dev->cap_flags)) {
2803 spec->num_channels = 14; 2803 spec->num_channels = 14;
2804 spec->channels = rf_vals_noseq; 2804 spec->channels = rf_vals_noseq;
2805 } else { 2805 } else {
@@ -2869,16 +2869,16 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
2869 * This device has multiple filters for control frames, 2869 * This device has multiple filters for control frames,
2870 * but has no a separate filter for PS Poll frames. 2870 * but has no a separate filter for PS Poll frames.
2871 */ 2871 */
2872 __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags); 2872 __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
2873 2873
2874 /* 2874 /*
2875 * This device requires firmware and DMA mapped skbs. 2875 * This device requires firmware and DMA mapped skbs.
2876 */ 2876 */
2877 __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); 2877 __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
2878 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); 2878 __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags);
2879 if (!modparam_nohwcrypt) 2879 if (!modparam_nohwcrypt)
2880 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); 2880 __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
2881 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); 2881 __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
2882 2882
2883 /* 2883 /*
2884 * Set the rssi offset. 2884 * Set the rssi offset.
@@ -2979,6 +2979,9 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = {
2979 .get_tsf = rt61pci_get_tsf, 2979 .get_tsf = rt61pci_get_tsf,
2980 .rfkill_poll = rt2x00mac_rfkill_poll, 2980 .rfkill_poll = rt2x00mac_rfkill_poll,
2981 .flush = rt2x00mac_flush, 2981 .flush = rt2x00mac_flush,
2982 .set_antenna = rt2x00mac_set_antenna,
2983 .get_antenna = rt2x00mac_get_antenna,
2984 .get_ringparam = rt2x00mac_get_ringparam,
2982}; 2985};
2983 2986
2984static const struct rt2x00lib_ops rt61pci_rt2x00_ops = { 2987static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
@@ -3003,6 +3006,7 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
3003 .start_queue = rt61pci_start_queue, 3006 .start_queue = rt61pci_start_queue,
3004 .kick_queue = rt61pci_kick_queue, 3007 .kick_queue = rt61pci_kick_queue,
3005 .stop_queue = rt61pci_stop_queue, 3008 .stop_queue = rt61pci_stop_queue,
3009 .flush_queue = rt2x00pci_flush_queue,
3006 .write_tx_desc = rt61pci_write_tx_desc, 3010 .write_tx_desc = rt61pci_write_tx_desc,
3007 .write_beacon = rt61pci_write_beacon, 3011 .write_beacon = rt61pci_write_beacon,
3008 .clear_beacon = rt61pci_clear_beacon, 3012 .clear_beacon = rt61pci_clear_beacon,
@@ -3060,11 +3064,11 @@ static const struct rt2x00_ops rt61pci_ops = {
3060 */ 3064 */
3061static DEFINE_PCI_DEVICE_TABLE(rt61pci_device_table) = { 3065static DEFINE_PCI_DEVICE_TABLE(rt61pci_device_table) = {
3062 /* RT2561s */ 3066 /* RT2561s */
3063 { PCI_DEVICE(0x1814, 0x0301), PCI_DEVICE_DATA(&rt61pci_ops) }, 3067 { PCI_DEVICE(0x1814, 0x0301) },
3064 /* RT2561 v2 */ 3068 /* RT2561 v2 */
3065 { PCI_DEVICE(0x1814, 0x0302), PCI_DEVICE_DATA(&rt61pci_ops) }, 3069 { PCI_DEVICE(0x1814, 0x0302) },
3066 /* RT2661 */ 3070 /* RT2661 */
3067 { PCI_DEVICE(0x1814, 0x0401), PCI_DEVICE_DATA(&rt61pci_ops) }, 3071 { PCI_DEVICE(0x1814, 0x0401) },
3068 { 0, } 3072 { 0, }
3069}; 3073};
3070 3074
@@ -3079,10 +3083,16 @@ MODULE_FIRMWARE(FIRMWARE_RT2561s);
3079MODULE_FIRMWARE(FIRMWARE_RT2661); 3083MODULE_FIRMWARE(FIRMWARE_RT2661);
3080MODULE_LICENSE("GPL"); 3084MODULE_LICENSE("GPL");
3081 3085
3086static int rt61pci_probe(struct pci_dev *pci_dev,
3087 const struct pci_device_id *id)
3088{
3089 return rt2x00pci_probe(pci_dev, &rt61pci_ops);
3090}
3091
3082static struct pci_driver rt61pci_driver = { 3092static struct pci_driver rt61pci_driver = {
3083 .name = KBUILD_MODNAME, 3093 .name = KBUILD_MODNAME,
3084 .id_table = rt61pci_device_table, 3094 .id_table = rt61pci_device_table,
3085 .probe = rt2x00pci_probe, 3095 .probe = rt61pci_probe,
3086 .remove = __devexit_p(rt2x00pci_remove), 3096 .remove = __devexit_p(rt2x00pci_remove),
3087 .suspend = rt2x00pci_suspend, 3097 .suspend = rt2x00pci_suspend,
3088 .resume = rt2x00pci_resume, 3098 .resume = rt2x00pci_resume,
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 6593059f9c7e..a6ce7d6cbdfa 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -595,7 +595,7 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
595 switch (ant->rx) { 595 switch (ant->rx) {
596 case ANTENNA_HW_DIVERSITY: 596 case ANTENNA_HW_DIVERSITY:
597 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 2); 597 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 2);
598 temp = !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags) 598 temp = !test_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags)
599 && (rt2x00dev->curr_band != IEEE80211_BAND_5GHZ); 599 && (rt2x00dev->curr_band != IEEE80211_BAND_5GHZ);
600 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, temp); 600 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, temp);
601 break; 601 break;
@@ -636,7 +636,7 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
636 636
637 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); 637 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0);
638 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 638 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
639 !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); 639 !test_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags));
640 640
641 /* 641 /*
642 * Configure the RX antenna. 642 * Configure the RX antenna.
@@ -709,10 +709,10 @@ static void rt73usb_config_ant(struct rt2x00_dev *rt2x00dev,
709 709
710 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { 710 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
711 sel = antenna_sel_a; 711 sel = antenna_sel_a;
712 lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); 712 lna = test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
713 } else { 713 } else {
714 sel = antenna_sel_bg; 714 sel = antenna_sel_bg;
715 lna = test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); 715 lna = test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
716 } 716 }
717 717
718 for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++) 718 for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++)
@@ -740,7 +740,7 @@ static void rt73usb_config_lna_gain(struct rt2x00_dev *rt2x00dev,
740 short lna_gain = 0; 740 short lna_gain = 0;
741 741
742 if (libconf->conf->channel->band == IEEE80211_BAND_2GHZ) { 742 if (libconf->conf->channel->band == IEEE80211_BAND_2GHZ) {
743 if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags)) 743 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags))
744 lna_gain += 14; 744 lna_gain += 14;
745 745
746 rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &eeprom); 746 rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &eeprom);
@@ -930,7 +930,7 @@ static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev,
930 low_bound = 0x28; 930 low_bound = 0x28;
931 up_bound = 0x48; 931 up_bound = 0x48;
932 932
933 if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) { 933 if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) {
934 low_bound += 0x10; 934 low_bound += 0x10;
935 up_bound += 0x10; 935 up_bound += 0x10;
936 } 936 }
@@ -946,7 +946,7 @@ static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev,
946 up_bound = 0x1c; 946 up_bound = 0x1c;
947 } 947 }
948 948
949 if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags)) { 949 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) {
950 low_bound += 0x14; 950 low_bound += 0x14;
951 up_bound += 0x10; 951 up_bound += 0x10;
952 } 952 }
@@ -1661,7 +1661,7 @@ static int rt73usb_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxd_w1)
1661 } 1661 }
1662 1662
1663 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { 1663 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
1664 if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) { 1664 if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) {
1665 if (lna == 3 || lna == 2) 1665 if (lna == 3 || lna == 2)
1666 offset += 10; 1666 offset += 10;
1667 } else { 1667 } else {
@@ -1899,13 +1899,13 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1899 * Read the Frame type. 1899 * Read the Frame type.
1900 */ 1900 */
1901 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_FRAME_TYPE)) 1901 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_FRAME_TYPE))
1902 __set_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags); 1902 __set_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags);
1903 1903
1904 /* 1904 /*
1905 * Detect if this device has an hardware controlled radio. 1905 * Detect if this device has an hardware controlled radio.
1906 */ 1906 */
1907 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) 1907 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
1908 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); 1908 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
1909 1909
1910 /* 1910 /*
1911 * Read frequency offset. 1911 * Read frequency offset.
@@ -1919,8 +1919,8 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1919 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); 1919 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
1920 1920
1921 if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA)) { 1921 if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA)) {
1922 __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); 1922 __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
1923 __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); 1923 __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
1924 } 1924 }
1925 1925
1926 /* 1926 /*
@@ -2200,15 +2200,15 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
2200 * This device has multiple filters for control frames, 2200 * This device has multiple filters for control frames,
2201 * but has no a separate filter for PS Poll frames. 2201 * but has no a separate filter for PS Poll frames.
2202 */ 2202 */
2203 __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags); 2203 __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
2204 2204
2205 /* 2205 /*
2206 * This device requires firmware. 2206 * This device requires firmware.
2207 */ 2207 */
2208 __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); 2208 __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
2209 if (!modparam_nohwcrypt) 2209 if (!modparam_nohwcrypt)
2210 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); 2210 __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
2211 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); 2211 __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
2212 2212
2213 /* 2213 /*
2214 * Set the rssi offset. 2214 * Set the rssi offset.
@@ -2310,6 +2310,9 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = {
2310 .get_tsf = rt73usb_get_tsf, 2310 .get_tsf = rt73usb_get_tsf,
2311 .rfkill_poll = rt2x00mac_rfkill_poll, 2311 .rfkill_poll = rt2x00mac_rfkill_poll,
2312 .flush = rt2x00mac_flush, 2312 .flush = rt2x00mac_flush,
2313 .set_antenna = rt2x00mac_set_antenna,
2314 .get_antenna = rt2x00mac_get_antenna,
2315 .get_ringparam = rt2x00mac_get_ringparam,
2313}; 2316};
2314 2317
2315static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { 2318static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
@@ -2388,113 +2391,113 @@ static const struct rt2x00_ops rt73usb_ops = {
2388 */ 2391 */
2389static struct usb_device_id rt73usb_device_table[] = { 2392static struct usb_device_id rt73usb_device_table[] = {
2390 /* AboCom */ 2393 /* AboCom */
2391 { USB_DEVICE(0x07b8, 0xb21b), USB_DEVICE_DATA(&rt73usb_ops) }, 2394 { USB_DEVICE(0x07b8, 0xb21b) },
2392 { USB_DEVICE(0x07b8, 0xb21c), USB_DEVICE_DATA(&rt73usb_ops) }, 2395 { USB_DEVICE(0x07b8, 0xb21c) },
2393 { USB_DEVICE(0x07b8, 0xb21d), USB_DEVICE_DATA(&rt73usb_ops) }, 2396 { USB_DEVICE(0x07b8, 0xb21d) },
2394 { USB_DEVICE(0x07b8, 0xb21e), USB_DEVICE_DATA(&rt73usb_ops) }, 2397 { USB_DEVICE(0x07b8, 0xb21e) },
2395 { USB_DEVICE(0x07b8, 0xb21f), USB_DEVICE_DATA(&rt73usb_ops) }, 2398 { USB_DEVICE(0x07b8, 0xb21f) },
2396 /* AL */ 2399 /* AL */
2397 { USB_DEVICE(0x14b2, 0x3c10), USB_DEVICE_DATA(&rt73usb_ops) }, 2400 { USB_DEVICE(0x14b2, 0x3c10) },
2398 /* Amigo */ 2401 /* Amigo */
2399 { USB_DEVICE(0x148f, 0x9021), USB_DEVICE_DATA(&rt73usb_ops) }, 2402 { USB_DEVICE(0x148f, 0x9021) },
2400 { USB_DEVICE(0x0eb0, 0x9021), USB_DEVICE_DATA(&rt73usb_ops) }, 2403 { USB_DEVICE(0x0eb0, 0x9021) },
2401 /* AMIT */ 2404 /* AMIT */
2402 { USB_DEVICE(0x18c5, 0x0002), USB_DEVICE_DATA(&rt73usb_ops) }, 2405 { USB_DEVICE(0x18c5, 0x0002) },
2403 /* Askey */ 2406 /* Askey */
2404 { USB_DEVICE(0x1690, 0x0722), USB_DEVICE_DATA(&rt73usb_ops) }, 2407 { USB_DEVICE(0x1690, 0x0722) },
2405 /* ASUS */ 2408 /* ASUS */
2406 { USB_DEVICE(0x0b05, 0x1723), USB_DEVICE_DATA(&rt73usb_ops) }, 2409 { USB_DEVICE(0x0b05, 0x1723) },
2407 { USB_DEVICE(0x0b05, 0x1724), USB_DEVICE_DATA(&rt73usb_ops) }, 2410 { USB_DEVICE(0x0b05, 0x1724) },
2408 /* Belkin */ 2411 /* Belkin */
2409 { USB_DEVICE(0x050d, 0x705a), USB_DEVICE_DATA(&rt73usb_ops) }, 2412 { USB_DEVICE(0x050d, 0x705a) },
2410 { USB_DEVICE(0x050d, 0x905b), USB_DEVICE_DATA(&rt73usb_ops) }, 2413 { USB_DEVICE(0x050d, 0x905b) },
2411 { USB_DEVICE(0x050d, 0x905c), USB_DEVICE_DATA(&rt73usb_ops) }, 2414 { USB_DEVICE(0x050d, 0x905c) },
2412 /* Billionton */ 2415 /* Billionton */
2413 { USB_DEVICE(0x1631, 0xc019), USB_DEVICE_DATA(&rt73usb_ops) }, 2416 { USB_DEVICE(0x1631, 0xc019) },
2414 { USB_DEVICE(0x08dd, 0x0120), USB_DEVICE_DATA(&rt73usb_ops) }, 2417 { USB_DEVICE(0x08dd, 0x0120) },
2415 /* Buffalo */ 2418 /* Buffalo */
2416 { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) }, 2419 { USB_DEVICE(0x0411, 0x00d8) },
2417 { USB_DEVICE(0x0411, 0x00d9), USB_DEVICE_DATA(&rt73usb_ops) }, 2420 { USB_DEVICE(0x0411, 0x00d9) },
2418 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) }, 2421 { USB_DEVICE(0x0411, 0x00f4) },
2419 { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) }, 2422 { USB_DEVICE(0x0411, 0x0116) },
2420 { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) }, 2423 { USB_DEVICE(0x0411, 0x0119) },
2421 { USB_DEVICE(0x0411, 0x0137), USB_DEVICE_DATA(&rt73usb_ops) }, 2424 { USB_DEVICE(0x0411, 0x0137) },
2422 /* CEIVA */ 2425 /* CEIVA */
2423 { USB_DEVICE(0x178d, 0x02be), USB_DEVICE_DATA(&rt73usb_ops) }, 2426 { USB_DEVICE(0x178d, 0x02be) },
2424 /* CNet */ 2427 /* CNet */
2425 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) }, 2428 { USB_DEVICE(0x1371, 0x9022) },
2426 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) }, 2429 { USB_DEVICE(0x1371, 0x9032) },
2427 /* Conceptronic */ 2430 /* Conceptronic */
2428 { USB_DEVICE(0x14b2, 0x3c22), USB_DEVICE_DATA(&rt73usb_ops) }, 2431 { USB_DEVICE(0x14b2, 0x3c22) },
2429 /* Corega */ 2432 /* Corega */
2430 { USB_DEVICE(0x07aa, 0x002e), USB_DEVICE_DATA(&rt73usb_ops) }, 2433 { USB_DEVICE(0x07aa, 0x002e) },
2431 /* D-Link */ 2434 /* D-Link */
2432 { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) }, 2435 { USB_DEVICE(0x07d1, 0x3c03) },
2433 { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, 2436 { USB_DEVICE(0x07d1, 0x3c04) },
2434 { USB_DEVICE(0x07d1, 0x3c06), USB_DEVICE_DATA(&rt73usb_ops) }, 2437 { USB_DEVICE(0x07d1, 0x3c06) },
2435 { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) }, 2438 { USB_DEVICE(0x07d1, 0x3c07) },
2436 /* Edimax */ 2439 /* Edimax */
2437 { USB_DEVICE(0x7392, 0x7318), USB_DEVICE_DATA(&rt73usb_ops) }, 2440 { USB_DEVICE(0x7392, 0x7318) },
2438 { USB_DEVICE(0x7392, 0x7618), USB_DEVICE_DATA(&rt73usb_ops) }, 2441 { USB_DEVICE(0x7392, 0x7618) },
2439 /* EnGenius */ 2442 /* EnGenius */
2440 { USB_DEVICE(0x1740, 0x3701), USB_DEVICE_DATA(&rt73usb_ops) }, 2443 { USB_DEVICE(0x1740, 0x3701) },
2441 /* Gemtek */ 2444 /* Gemtek */
2442 { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) }, 2445 { USB_DEVICE(0x15a9, 0x0004) },
2443 /* Gigabyte */ 2446 /* Gigabyte */
2444 { USB_DEVICE(0x1044, 0x8008), USB_DEVICE_DATA(&rt73usb_ops) }, 2447 { USB_DEVICE(0x1044, 0x8008) },
2445 { USB_DEVICE(0x1044, 0x800a), USB_DEVICE_DATA(&rt73usb_ops) }, 2448 { USB_DEVICE(0x1044, 0x800a) },
2446 /* Huawei-3Com */ 2449 /* Huawei-3Com */
2447 { USB_DEVICE(0x1472, 0x0009), USB_DEVICE_DATA(&rt73usb_ops) }, 2450 { USB_DEVICE(0x1472, 0x0009) },
2448 /* Hercules */ 2451 /* Hercules */
2449 { USB_DEVICE(0x06f8, 0xe002), USB_DEVICE_DATA(&rt73usb_ops) }, 2452 { USB_DEVICE(0x06f8, 0xe002) },
2450 { USB_DEVICE(0x06f8, 0xe010), USB_DEVICE_DATA(&rt73usb_ops) }, 2453 { USB_DEVICE(0x06f8, 0xe010) },
2451 { USB_DEVICE(0x06f8, 0xe020), USB_DEVICE_DATA(&rt73usb_ops) }, 2454 { USB_DEVICE(0x06f8, 0xe020) },
2452 /* Linksys */ 2455 /* Linksys */
2453 { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) }, 2456 { USB_DEVICE(0x13b1, 0x0020) },
2454 { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) }, 2457 { USB_DEVICE(0x13b1, 0x0023) },
2455 { USB_DEVICE(0x13b1, 0x0028), USB_DEVICE_DATA(&rt73usb_ops) }, 2458 { USB_DEVICE(0x13b1, 0x0028) },
2456 /* MSI */ 2459 /* MSI */
2457 { USB_DEVICE(0x0db0, 0x4600), USB_DEVICE_DATA(&rt73usb_ops) }, 2460 { USB_DEVICE(0x0db0, 0x4600) },
2458 { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) }, 2461 { USB_DEVICE(0x0db0, 0x6877) },
2459 { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) }, 2462 { USB_DEVICE(0x0db0, 0x6874) },
2460 { USB_DEVICE(0x0db0, 0xa861), USB_DEVICE_DATA(&rt73usb_ops) }, 2463 { USB_DEVICE(0x0db0, 0xa861) },
2461 { USB_DEVICE(0x0db0, 0xa874), USB_DEVICE_DATA(&rt73usb_ops) }, 2464 { USB_DEVICE(0x0db0, 0xa874) },
2462 /* Ovislink */ 2465 /* Ovislink */
2463 { USB_DEVICE(0x1b75, 0x7318), USB_DEVICE_DATA(&rt73usb_ops) }, 2466 { USB_DEVICE(0x1b75, 0x7318) },
2464 /* Ralink */ 2467 /* Ralink */
2465 { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) }, 2468 { USB_DEVICE(0x04bb, 0x093d) },
2466 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) }, 2469 { USB_DEVICE(0x148f, 0x2573) },
2467 { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) }, 2470 { USB_DEVICE(0x148f, 0x2671) },
2468 { USB_DEVICE(0x0812, 0x3101), USB_DEVICE_DATA(&rt73usb_ops) }, 2471 { USB_DEVICE(0x0812, 0x3101) },
2469 /* Qcom */ 2472 /* Qcom */
2470 { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) }, 2473 { USB_DEVICE(0x18e8, 0x6196) },
2471 { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) }, 2474 { USB_DEVICE(0x18e8, 0x6229) },
2472 { USB_DEVICE(0x18e8, 0x6238), USB_DEVICE_DATA(&rt73usb_ops) }, 2475 { USB_DEVICE(0x18e8, 0x6238) },
2473 /* Samsung */ 2476 /* Samsung */
2474 { USB_DEVICE(0x04e8, 0x4471), USB_DEVICE_DATA(&rt73usb_ops) }, 2477 { USB_DEVICE(0x04e8, 0x4471) },
2475 /* Senao */ 2478 /* Senao */
2476 { USB_DEVICE(0x1740, 0x7100), USB_DEVICE_DATA(&rt73usb_ops) }, 2479 { USB_DEVICE(0x1740, 0x7100) },
2477 /* Sitecom */ 2480 /* Sitecom */
2478 { USB_DEVICE(0x0df6, 0x0024), USB_DEVICE_DATA(&rt73usb_ops) }, 2481 { USB_DEVICE(0x0df6, 0x0024) },
2479 { USB_DEVICE(0x0df6, 0x0027), USB_DEVICE_DATA(&rt73usb_ops) }, 2482 { USB_DEVICE(0x0df6, 0x0027) },
2480 { USB_DEVICE(0x0df6, 0x002f), USB_DEVICE_DATA(&rt73usb_ops) }, 2483 { USB_DEVICE(0x0df6, 0x002f) },
2481 { USB_DEVICE(0x0df6, 0x90ac), USB_DEVICE_DATA(&rt73usb_ops) }, 2484 { USB_DEVICE(0x0df6, 0x90ac) },
2482 { USB_DEVICE(0x0df6, 0x9712), USB_DEVICE_DATA(&rt73usb_ops) }, 2485 { USB_DEVICE(0x0df6, 0x9712) },
2483 /* Surecom */ 2486 /* Surecom */
2484 { USB_DEVICE(0x0769, 0x31f3), USB_DEVICE_DATA(&rt73usb_ops) }, 2487 { USB_DEVICE(0x0769, 0x31f3) },
2485 /* Tilgin */ 2488 /* Tilgin */
2486 { USB_DEVICE(0x6933, 0x5001), USB_DEVICE_DATA(&rt73usb_ops) }, 2489 { USB_DEVICE(0x6933, 0x5001) },
2487 /* Philips */ 2490 /* Philips */
2488 { USB_DEVICE(0x0471, 0x200a), USB_DEVICE_DATA(&rt73usb_ops) }, 2491 { USB_DEVICE(0x0471, 0x200a) },
2489 /* Planex */ 2492 /* Planex */
2490 { USB_DEVICE(0x2019, 0xab01), USB_DEVICE_DATA(&rt73usb_ops) }, 2493 { USB_DEVICE(0x2019, 0xab01) },
2491 { USB_DEVICE(0x2019, 0xab50), USB_DEVICE_DATA(&rt73usb_ops) }, 2494 { USB_DEVICE(0x2019, 0xab50) },
2492 /* WideTell */ 2495 /* WideTell */
2493 { USB_DEVICE(0x7167, 0x3840), USB_DEVICE_DATA(&rt73usb_ops) }, 2496 { USB_DEVICE(0x7167, 0x3840) },
2494 /* Zcom */ 2497 /* Zcom */
2495 { USB_DEVICE(0x0cde, 0x001c), USB_DEVICE_DATA(&rt73usb_ops) }, 2498 { USB_DEVICE(0x0cde, 0x001c) },
2496 /* ZyXEL */ 2499 /* ZyXEL */
2497 { USB_DEVICE(0x0586, 0x3415), USB_DEVICE_DATA(&rt73usb_ops) }, 2500 { USB_DEVICE(0x0586, 0x3415) },
2498 { 0, } 2501 { 0, }
2499}; 2502};
2500 2503
@@ -2506,10 +2509,16 @@ MODULE_DEVICE_TABLE(usb, rt73usb_device_table);
2506MODULE_FIRMWARE(FIRMWARE_RT2571); 2509MODULE_FIRMWARE(FIRMWARE_RT2571);
2507MODULE_LICENSE("GPL"); 2510MODULE_LICENSE("GPL");
2508 2511
2512static int rt73usb_probe(struct usb_interface *usb_intf,
2513 const struct usb_device_id *id)
2514{
2515 return rt2x00usb_probe(usb_intf, &rt73usb_ops);
2516}
2517
2509static struct usb_driver rt73usb_driver = { 2518static struct usb_driver rt73usb_driver = {
2510 .name = KBUILD_MODNAME, 2519 .name = KBUILD_MODNAME,
2511 .id_table = rt73usb_device_table, 2520 .id_table = rt73usb_device_table,
2512 .probe = rt2x00usb_probe, 2521 .probe = rt73usb_probe,
2513 .disconnect = rt2x00usb_disconnect, 2522 .disconnect = rt2x00usb_disconnect,
2514 .suspend = rt2x00usb_suspend, 2523 .suspend = rt2x00usb_suspend,
2515 .resume = rt2x00usb_resume, 2524 .resume = rt2x00usb_resume,