aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt73usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt73usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c77
1 files changed, 38 insertions, 39 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 14e7bb210075..bb58d797fb72 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1,5 +1,5 @@
1/* 1/*
2 Copyright (C) 2004 - 2009 rt2x00 SourceForge Project 2 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
3 <http://rt2x00.serialmonkey.com> 3 <http://rt2x00.serialmonkey.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
@@ -30,6 +30,7 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/slab.h>
33#include <linux/usb.h> 34#include <linux/usb.h>
34 35
35#include "rt2x00.h" 36#include "rt2x00.h"
@@ -136,8 +137,8 @@ static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev,
136 * all others contain 20 bits. 137 * all others contain 20 bits.
137 */ 138 */
138 rt2x00_set_field32(&reg, PHY_CSR4_NUMBER_OF_BITS, 139 rt2x00_set_field32(&reg, PHY_CSR4_NUMBER_OF_BITS,
139 20 + (rt2x00_rf(&rt2x00dev->chip, RF5225) || 140 20 + (rt2x00_rf(rt2x00dev, RF5225) ||
140 rt2x00_rf(&rt2x00dev->chip, RF2527))); 141 rt2x00_rf(rt2x00dev, RF2527)));
141 rt2x00_set_field32(&reg, PHY_CSR4_IF_SELECT, 0); 142 rt2x00_set_field32(&reg, PHY_CSR4_IF_SELECT, 0);
142 rt2x00_set_field32(&reg, PHY_CSR4_BUSY, 1); 143 rt2x00_set_field32(&reg, PHY_CSR4_BUSY, 1);
143 144
@@ -339,7 +340,7 @@ static int rt73usb_config_shared_key(struct rt2x00_dev *rt2x00dev,
339 * The driver does not support the IV/EIV generation 340 * The driver does not support the IV/EIV generation
340 * in hardware. However it doesn't support the IV/EIV 341 * in hardware. However it doesn't support the IV/EIV
341 * inside the ieee80211 frame either, but requires it 342 * inside the ieee80211 frame either, but requires it
342 * to be provided seperately for the descriptor. 343 * to be provided separately for the descriptor.
343 * rt2x00lib will cut the IV/EIV data out of all frames 344 * rt2x00lib will cut the IV/EIV data out of all frames
344 * given to us by mac80211, but we must tell mac80211 345 * given to us by mac80211, but we must tell mac80211
345 * to generate the IV/EIV data. 346 * to generate the IV/EIV data.
@@ -439,7 +440,7 @@ static int rt73usb_config_pairwise_key(struct rt2x00_dev *rt2x00dev,
439 * The driver does not support the IV/EIV generation 440 * The driver does not support the IV/EIV generation
440 * in hardware. However it doesn't support the IV/EIV 441 * in hardware. However it doesn't support the IV/EIV
441 * inside the ieee80211 frame either, but requires it 442 * inside the ieee80211 frame either, but requires it
442 * to be provided seperately for the descriptor. 443 * to be provided separately for the descriptor.
443 * rt2x00lib will cut the IV/EIV data out of all frames 444 * rt2x00lib will cut the IV/EIV data out of all frames
444 * given to us by mac80211, but we must tell mac80211 445 * given to us by mac80211, but we must tell mac80211
445 * to generate the IV/EIV data. 446 * to generate the IV/EIV data.
@@ -741,11 +742,9 @@ static void rt73usb_config_ant(struct rt2x00_dev *rt2x00dev,
741 742
742 rt2x00usb_register_write(rt2x00dev, PHY_CSR0, reg); 743 rt2x00usb_register_write(rt2x00dev, PHY_CSR0, reg);
743 744
744 if (rt2x00_rf(&rt2x00dev->chip, RF5226) || 745 if (rt2x00_rf(rt2x00dev, RF5226) || rt2x00_rf(rt2x00dev, RF5225))
745 rt2x00_rf(&rt2x00dev->chip, RF5225))
746 rt73usb_config_antenna_5x(rt2x00dev, ant); 746 rt73usb_config_antenna_5x(rt2x00dev, ant);
747 else if (rt2x00_rf(&rt2x00dev->chip, RF2528) || 747 else if (rt2x00_rf(rt2x00dev, RF2528) || rt2x00_rf(rt2x00dev, RF2527))
748 rt2x00_rf(&rt2x00dev->chip, RF2527))
749 rt73usb_config_antenna_2x(rt2x00dev, ant); 748 rt73usb_config_antenna_2x(rt2x00dev, ant);
750} 749}
751 750
@@ -779,8 +778,7 @@ static void rt73usb_config_channel(struct rt2x00_dev *rt2x00dev,
779 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); 778 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower));
780 rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset); 779 rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset);
781 780
782 smart = !(rt2x00_rf(&rt2x00dev->chip, RF5225) || 781 smart = !(rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527));
783 rt2x00_rf(&rt2x00dev->chip, RF2527));
784 782
785 rt73usb_bbp_read(rt2x00dev, 3, &r3); 783 rt73usb_bbp_read(rt2x00dev, 3, &r3);
786 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart); 784 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart);
@@ -1210,8 +1208,7 @@ static int rt73usb_init_registers(struct rt2x00_dev *rt2x00dev)
1210 rt2x00usb_register_write(rt2x00dev, SEC_CSR5, 0x00000000); 1208 rt2x00usb_register_write(rt2x00dev, SEC_CSR5, 0x00000000);
1211 1209
1212 reg = 0x000023b0; 1210 reg = 0x000023b0;
1213 if (rt2x00_rf(&rt2x00dev->chip, RF5225) || 1211 if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527))
1214 rt2x00_rf(&rt2x00dev->chip, RF2527))
1215 rt2x00_set_field32(&reg, PHY_CSR1_RF_RPI, 1); 1212 rt2x00_set_field32(&reg, PHY_CSR1_RF_RPI, 1);
1216 rt2x00usb_register_write(rt2x00dev, PHY_CSR1, reg); 1213 rt2x00usb_register_write(rt2x00dev, PHY_CSR1, reg);
1217 1214
@@ -1665,7 +1662,7 @@ static void rt73usb_fill_rxdone(struct queue_entry *entry,
1665 1662
1666 /* 1663 /*
1667 * Hardware has stripped IV/EIV data from 802.11 frame during 1664 * Hardware has stripped IV/EIV data from 802.11 frame during
1668 * decryption. It has provided the data seperately but rt2x00lib 1665 * decryption. It has provided the data separately but rt2x00lib
1669 * should decide if it should be reinserted. 1666 * should decide if it should be reinserted.
1670 */ 1667 */
1671 rxdesc->flags |= RX_FLAG_IV_STRIPPED; 1668 rxdesc->flags |= RX_FLAG_IV_STRIPPED;
@@ -1824,18 +1821,18 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1824 */ 1821 */
1825 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 1822 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
1826 rt2x00usb_register_read(rt2x00dev, MAC_CSR0, &reg); 1823 rt2x00usb_register_read(rt2x00dev, MAC_CSR0, &reg);
1827 rt2x00_set_chip(rt2x00dev, RT2571, value, reg); 1824 rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET),
1825 value, rt2x00_get_field32(reg, MAC_CSR0_REVISION));
1828 1826
1829 if (!rt2x00_check_rev(&rt2x00dev->chip, 0x000ffff0, 0x25730) || 1827 if (!rt2x00_rt(rt2x00dev, RT2573) || (rt2x00_rev(rt2x00dev) == 0)) {
1830 rt2x00_check_rev(&rt2x00dev->chip, 0x0000000f, 0)) {
1831 ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); 1828 ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
1832 return -ENODEV; 1829 return -ENODEV;
1833 } 1830 }
1834 1831
1835 if (!rt2x00_rf(&rt2x00dev->chip, RF5226) && 1832 if (!rt2x00_rf(rt2x00dev, RF5226) &&
1836 !rt2x00_rf(&rt2x00dev->chip, RF2528) && 1833 !rt2x00_rf(rt2x00dev, RF2528) &&
1837 !rt2x00_rf(&rt2x00dev->chip, RF5225) && 1834 !rt2x00_rf(rt2x00dev, RF5225) &&
1838 !rt2x00_rf(&rt2x00dev->chip, RF2527)) { 1835 !rt2x00_rf(rt2x00dev, RF2527)) {
1839 ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); 1836 ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
1840 return -ENODEV; 1837 return -ENODEV;
1841 } 1838 }
@@ -2068,7 +2065,6 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2068 IEEE80211_HW_SIGNAL_DBM | 2065 IEEE80211_HW_SIGNAL_DBM |
2069 IEEE80211_HW_SUPPORTS_PS | 2066 IEEE80211_HW_SUPPORTS_PS |
2070 IEEE80211_HW_PS_NULLFUNC_STACK; 2067 IEEE80211_HW_PS_NULLFUNC_STACK;
2071 rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
2072 2068
2073 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); 2069 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
2074 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, 2070 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -2081,17 +2077,17 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2081 spec->supported_bands = SUPPORT_BAND_2GHZ; 2077 spec->supported_bands = SUPPORT_BAND_2GHZ;
2082 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; 2078 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
2083 2079
2084 if (rt2x00_rf(&rt2x00dev->chip, RF2528)) { 2080 if (rt2x00_rf(rt2x00dev, RF2528)) {
2085 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2528); 2081 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2528);
2086 spec->channels = rf_vals_bg_2528; 2082 spec->channels = rf_vals_bg_2528;
2087 } else if (rt2x00_rf(&rt2x00dev->chip, RF5226)) { 2083 } else if (rt2x00_rf(rt2x00dev, RF5226)) {
2088 spec->supported_bands |= SUPPORT_BAND_5GHZ; 2084 spec->supported_bands |= SUPPORT_BAND_5GHZ;
2089 spec->num_channels = ARRAY_SIZE(rf_vals_5226); 2085 spec->num_channels = ARRAY_SIZE(rf_vals_5226);
2090 spec->channels = rf_vals_5226; 2086 spec->channels = rf_vals_5226;
2091 } else if (rt2x00_rf(&rt2x00dev->chip, RF2527)) { 2087 } else if (rt2x00_rf(rt2x00dev, RF2527)) {
2092 spec->num_channels = 14; 2088 spec->num_channels = 14;
2093 spec->channels = rf_vals_5225_2527; 2089 spec->channels = rf_vals_5225_2527;
2094 } else if (rt2x00_rf(&rt2x00dev->chip, RF5225)) { 2090 } else if (rt2x00_rf(rt2x00dev, RF5225)) {
2095 spec->supported_bands |= SUPPORT_BAND_5GHZ; 2091 spec->supported_bands |= SUPPORT_BAND_5GHZ;
2096 spec->num_channels = ARRAY_SIZE(rf_vals_5225_2527); 2092 spec->num_channels = ARRAY_SIZE(rf_vals_5225_2527);
2097 spec->channels = rf_vals_5225_2527; 2093 spec->channels = rf_vals_5225_2527;
@@ -2249,7 +2245,6 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = {
2249 .get_stats = rt2x00mac_get_stats, 2245 .get_stats = rt2x00mac_get_stats,
2250 .bss_info_changed = rt2x00mac_bss_info_changed, 2246 .bss_info_changed = rt2x00mac_bss_info_changed,
2251 .conf_tx = rt73usb_conf_tx, 2247 .conf_tx = rt73usb_conf_tx,
2252 .get_tx_stats = rt2x00mac_get_tx_stats,
2253 .get_tsf = rt73usb_get_tsf, 2248 .get_tsf = rt73usb_get_tsf,
2254 .rfkill_poll = rt2x00mac_rfkill_poll, 2249 .rfkill_poll = rt2x00mac_rfkill_poll,
2255}; 2250};
@@ -2305,19 +2300,20 @@ static const struct data_queue_desc rt73usb_queue_bcn = {
2305}; 2300};
2306 2301
2307static const struct rt2x00_ops rt73usb_ops = { 2302static const struct rt2x00_ops rt73usb_ops = {
2308 .name = KBUILD_MODNAME, 2303 .name = KBUILD_MODNAME,
2309 .max_sta_intf = 1, 2304 .max_sta_intf = 1,
2310 .max_ap_intf = 4, 2305 .max_ap_intf = 4,
2311 .eeprom_size = EEPROM_SIZE, 2306 .eeprom_size = EEPROM_SIZE,
2312 .rf_size = RF_SIZE, 2307 .rf_size = RF_SIZE,
2313 .tx_queues = NUM_TX_QUEUES, 2308 .tx_queues = NUM_TX_QUEUES,
2314 .rx = &rt73usb_queue_rx, 2309 .extra_tx_headroom = TXD_DESC_SIZE,
2315 .tx = &rt73usb_queue_tx, 2310 .rx = &rt73usb_queue_rx,
2316 .bcn = &rt73usb_queue_bcn, 2311 .tx = &rt73usb_queue_tx,
2317 .lib = &rt73usb_rt2x00_ops, 2312 .bcn = &rt73usb_queue_bcn,
2318 .hw = &rt73usb_mac80211_ops, 2313 .lib = &rt73usb_rt2x00_ops,
2314 .hw = &rt73usb_mac80211_ops,
2319#ifdef CONFIG_RT2X00_LIB_DEBUGFS 2315#ifdef CONFIG_RT2X00_LIB_DEBUGFS
2320 .debugfs = &rt73usb_rt2x00debug, 2316 .debugfs = &rt73usb_rt2x00debug,
2321#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ 2317#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
2322}; 2318};
2323 2319
@@ -2353,9 +2349,12 @@ static struct usb_device_id rt73usb_device_table[] = {
2353 { USB_DEVICE(0x08dd, 0x0120), USB_DEVICE_DATA(&rt73usb_ops) }, 2349 { USB_DEVICE(0x08dd, 0x0120), USB_DEVICE_DATA(&rt73usb_ops) },
2354 /* Buffalo */ 2350 /* Buffalo */
2355 { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) }, 2351 { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) },
2352 { USB_DEVICE(0x0411, 0x00d9), USB_DEVICE_DATA(&rt73usb_ops) },
2356 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) }, 2353 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) },
2357 { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) }, 2354 { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) },
2358 { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) }, 2355 { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) },
2356 /* CEIVA */
2357 { USB_DEVICE(0x178d, 0x02be), USB_DEVICE_DATA(&rt73usb_ops) },
2359 /* CNet */ 2358 /* CNet */
2360 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) }, 2359 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) },
2361 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) }, 2360 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) },