aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800.h6
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c247
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c44
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c2
9 files changed, 196 insertions, 119 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index e3a2d9070cf6..a2d2bc2c7b3d 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1831,7 +1831,7 @@ static struct pci_driver rt2400pci_driver = {
1831 .name = KBUILD_MODNAME, 1831 .name = KBUILD_MODNAME,
1832 .id_table = rt2400pci_device_table, 1832 .id_table = rt2400pci_device_table,
1833 .probe = rt2400pci_probe, 1833 .probe = rt2400pci_probe,
1834 .remove = __devexit_p(rt2x00pci_remove), 1834 .remove = rt2x00pci_remove,
1835 .suspend = rt2x00pci_suspend, 1835 .suspend = rt2x00pci_suspend,
1836 .resume = rt2x00pci_resume, 1836 .resume = rt2x00pci_resume,
1837}; 1837};
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 479d756e275b..9bea10f53f0a 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -2122,7 +2122,7 @@ static struct pci_driver rt2500pci_driver = {
2122 .name = KBUILD_MODNAME, 2122 .name = KBUILD_MODNAME,
2123 .id_table = rt2500pci_device_table, 2123 .id_table = rt2500pci_device_table,
2124 .probe = rt2500pci_probe, 2124 .probe = rt2500pci_probe,
2125 .remove = __devexit_p(rt2x00pci_remove), 2125 .remove = rt2x00pci_remove,
2126 .suspend = rt2x00pci_suspend, 2126 .suspend = rt2x00pci_suspend,
2127 .resume = rt2x00pci_resume, 2127 .resume = rt2x00pci_resume,
2128}; 2128};
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index 6d67c3ede651..4db1088a847f 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -1993,8 +1993,10 @@ struct mac_iveiv_entry {
1993 */ 1993 */
1994#define RFCSR3_K FIELD8(0x0f) 1994#define RFCSR3_K FIELD8(0x0f)
1995/* Bits [7-4] for RF3320 (RT3370/RT3390), on other chipsets reserved */ 1995/* Bits [7-4] for RF3320 (RT3370/RT3390), on other chipsets reserved */
1996#define RFCSR3_PA1_BIAS_CCK FIELD8(0x70); 1996#define RFCSR3_PA1_BIAS_CCK FIELD8(0x70)
1997#define RFCSR3_PA2_CASCODE_BIAS_CCKK FIELD8(0x80); 1997#define RFCSR3_PA2_CASCODE_BIAS_CCKK FIELD8(0x80)
1998/* Bits for RF3290/RF5360/RF5370/RF5372/RF5390/RF5392 */
1999#define RFCSR3_VCOCAL_EN FIELD8(0x80)
1998 2000
1999/* 2001/*
2000 * FRCSR 5: 2002 * FRCSR 5:
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 01dc8891070c..197b4466a5d2 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2173,7 +2173,7 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
2173 rt2800_rfcsr_write(rt2x00dev, 59, 2173 rt2800_rfcsr_write(rt2x00dev, 59,
2174 r59_nonbt_rev[idx]); 2174 r59_nonbt_rev[idx]);
2175 } else if (rt2x00_rt(rt2x00dev, RT5390) || 2175 } else if (rt2x00_rt(rt2x00dev, RT5390) ||
2176 rt2x00_rt(rt2x00dev, RT5392)) { 2176 rt2x00_rt(rt2x00dev, RT5392)) {
2177 static const char r59_non_bt[] = {0x8f, 0x8f, 2177 static const char r59_non_bt[] = {0x8f, 0x8f,
2178 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d, 2178 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
2179 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86}; 2179 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
@@ -2243,7 +2243,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
2243 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); 2243 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
2244 2244
2245 rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); 2245 rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr);
2246 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1); 2246 rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
2247 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); 2247 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
2248 } 2248 }
2249 2249
@@ -2264,7 +2264,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
2264 2264
2265 if (rf->channel <= 14) { 2265 if (rf->channel <= 14) {
2266 if (!rt2x00_rt(rt2x00dev, RT5390) && 2266 if (!rt2x00_rt(rt2x00dev, RT5390) &&
2267 !rt2x00_rt(rt2x00dev, RT5392)) { 2267 !rt2x00_rt(rt2x00dev, RT5392)) {
2268 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, 2268 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG,
2269 &rt2x00dev->cap_flags)) { 2269 &rt2x00dev->cap_flags)) {
2270 rt2800_bbp_write(rt2x00dev, 82, 0x62); 2270 rt2800_bbp_write(rt2x00dev, 82, 0x62);
@@ -2449,7 +2449,7 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev)
2449 /* 2449 /*
2450 * Check if temperature compensation is supported. 2450 * Check if temperature compensation is supported.
2451 */ 2451 */
2452 if (tssi_bounds[4] == 0xff) 2452 if (tssi_bounds[4] == 0xff || step == 0xff)
2453 return 0; 2453 return 0;
2454 2454
2455 /* 2455 /*
@@ -2520,20 +2520,37 @@ static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev,
2520 return comp_value; 2520 return comp_value;
2521} 2521}
2522 2522
2523static int rt2800_get_txpower_reg_delta(struct rt2x00_dev *rt2x00dev,
2524 int power_level, int max_power)
2525{
2526 int delta;
2527
2528 if (test_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags))
2529 return 0;
2530
2531 /*
2532 * XXX: We don't know the maximum transmit power of our hardware since
2533 * the EEPROM doesn't expose it. We only know that we are calibrated
2534 * to 100% tx power.
2535 *
2536 * Hence, we assume the regulatory limit that cfg80211 calulated for
2537 * the current channel is our maximum and if we are requested to lower
2538 * the value we just reduce our tx power accordingly.
2539 */
2540 delta = power_level - max_power;
2541 return min(delta, 0);
2542}
2543
2523static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b, 2544static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
2524 enum ieee80211_band band, int power_level, 2545 enum ieee80211_band band, int power_level,
2525 u8 txpower, int delta) 2546 u8 txpower, int delta)
2526{ 2547{
2527 u32 reg;
2528 u16 eeprom; 2548 u16 eeprom;
2529 u8 criterion; 2549 u8 criterion;
2530 u8 eirp_txpower; 2550 u8 eirp_txpower;
2531 u8 eirp_txpower_criterion; 2551 u8 eirp_txpower_criterion;
2532 u8 reg_limit; 2552 u8 reg_limit;
2533 2553
2534 if (!((band == IEEE80211_BAND_5GHZ) && is_rate_b))
2535 return txpower;
2536
2537 if (test_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags)) { 2554 if (test_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags)) {
2538 /* 2555 /*
2539 * Check if eirp txpower exceed txpower_limit. 2556 * Check if eirp txpower exceed txpower_limit.
@@ -2542,11 +2559,13 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
2542 * .11b data rate need add additional 4dbm 2559 * .11b data rate need add additional 4dbm
2543 * when calculating eirp txpower. 2560 * when calculating eirp txpower.
2544 */ 2561 */
2545 rt2800_register_read(rt2x00dev, TX_PWR_CFG_0, &reg); 2562 rt2x00_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + 1,
2546 criterion = rt2x00_get_field32(reg, TX_PWR_CFG_0_6MBS); 2563 &eeprom);
2564 criterion = rt2x00_get_field16(eeprom,
2565 EEPROM_TXPOWER_BYRATE_RATE0);
2547 2566
2548 rt2x00_eeprom_read(rt2x00dev, 2567 rt2x00_eeprom_read(rt2x00dev, EEPROM_EIRP_MAX_TX_POWER,
2549 EEPROM_EIRP_MAX_TX_POWER, &eeprom); 2568 &eeprom);
2550 2569
2551 if (band == IEEE80211_BAND_2GHZ) 2570 if (band == IEEE80211_BAND_2GHZ)
2552 eirp_txpower_criterion = rt2x00_get_field16(eeprom, 2571 eirp_txpower_criterion = rt2x00_get_field16(eeprom,
@@ -2563,36 +2582,71 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
2563 } else 2582 } else
2564 reg_limit = 0; 2583 reg_limit = 0;
2565 2584
2566 return txpower + delta - reg_limit; 2585 txpower = max(0, txpower + delta - reg_limit);
2586 return min_t(u8, txpower, 0xc);
2567} 2587}
2568 2588
2589/*
2590 * We configure transmit power using MAC TX_PWR_CFG_{0,...,N} registers and
2591 * BBP R1 register. TX_PWR_CFG_X allow to configure per rate TX power values,
2592 * 4 bits for each rate (tune from 0 to 15 dBm). BBP_R1 controls transmit power
2593 * for all rates, but allow to set only 4 discrete values: -12, -6, 0 and 6 dBm.
2594 * Reference per rate transmit power values are located in the EEPROM at
2595 * EEPROM_TXPOWER_BYRATE offset. We adjust them and BBP R1 settings according to
2596 * current conditions (i.e. band, bandwidth, temperature, user settings).
2597 */
2569static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, 2598static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
2570 enum ieee80211_band band, 2599 struct ieee80211_channel *chan,
2571 int power_level) 2600 int power_level)
2572{ 2601{
2573 u8 txpower; 2602 u8 txpower, r1;
2574 u16 eeprom; 2603 u16 eeprom;
2575 int i, is_rate_b; 2604 u32 reg, offset;
2576 u32 reg; 2605 int i, is_rate_b, delta, power_ctrl;
2577 u8 r1; 2606 enum ieee80211_band band = chan->band;
2578 u32 offset;
2579 int delta;
2580 2607
2581 /* 2608 /*
2582 * Calculate HT40 compensation delta 2609 * Calculate HT40 compensation. For 40MHz we need to add or subtract
2610 * value read from EEPROM (different for 2GHz and for 5GHz).
2583 */ 2611 */
2584 delta = rt2800_get_txpower_bw_comp(rt2x00dev, band); 2612 delta = rt2800_get_txpower_bw_comp(rt2x00dev, band);
2585 2613
2586 /* 2614 /*
2587 * calculate temperature compensation delta 2615 * Calculate temperature compensation. Depends on measurement of current
2616 * TSSI (Transmitter Signal Strength Indication) we know TX power (due
2617 * to temperature or maybe other factors) is smaller or bigger than
2618 * expected. We adjust it, based on TSSI reference and boundaries values
2619 * provided in EEPROM.
2588 */ 2620 */
2589 delta += rt2800_get_gain_calibration_delta(rt2x00dev); 2621 delta += rt2800_get_gain_calibration_delta(rt2x00dev);
2590 2622
2591 /* 2623 /*
2592 * set to normal bbp tx power control mode: +/- 0dBm 2624 * Decrease power according to user settings, on devices with unknown
2625 * maximum tx power. For other devices we take user power_level into
2626 * consideration on rt2800_compensate_txpower().
2627 */
2628 delta += rt2800_get_txpower_reg_delta(rt2x00dev, power_level,
2629 chan->max_power);
2630
2631 /*
2632 * BBP_R1 controls TX power for all rates, it allow to set the following
2633 * gains -12, -6, 0, +6 dBm by setting values 2, 1, 0, 3 respectively.
2634 *
2635 * TODO: we do not use +6 dBm option to do not increase power beyond
2636 * regulatory limit, however this could be utilized for devices with
2637 * CAPABILITY_POWER_LIMIT.
2593 */ 2638 */
2594 rt2800_bbp_read(rt2x00dev, 1, &r1); 2639 rt2800_bbp_read(rt2x00dev, 1, &r1);
2595 rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, 0); 2640 if (delta <= -12) {
2641 power_ctrl = 2;
2642 delta += 12;
2643 } else if (delta <= -6) {
2644 power_ctrl = 1;
2645 delta += 6;
2646 } else {
2647 power_ctrl = 0;
2648 }
2649 rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
2596 rt2800_bbp_write(rt2x00dev, 1, r1); 2650 rt2800_bbp_write(rt2x00dev, 1, r1);
2597 offset = TX_PWR_CFG_0; 2651 offset = TX_PWR_CFG_0;
2598 2652
@@ -2710,7 +2764,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
2710 2764
2711void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev) 2765void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev)
2712{ 2766{
2713 rt2800_config_txpower(rt2x00dev, rt2x00dev->curr_band, 2767 rt2800_config_txpower(rt2x00dev, rt2x00dev->hw->conf.channel,
2714 rt2x00dev->tx_power); 2768 rt2x00dev->tx_power);
2715} 2769}
2716EXPORT_SYMBOL_GPL(rt2800_gain_calibration); 2770EXPORT_SYMBOL_GPL(rt2800_gain_calibration);
@@ -2750,7 +2804,7 @@ void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev)
2750 case RF5390: 2804 case RF5390:
2751 case RF5392: 2805 case RF5392:
2752 rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); 2806 rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr);
2753 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1); 2807 rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
2754 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); 2808 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
2755 break; 2809 break;
2756 default: 2810 default:
@@ -2845,11 +2899,11 @@ void rt2800_config(struct rt2x00_dev *rt2x00dev,
2845 if (flags & IEEE80211_CONF_CHANGE_CHANNEL) { 2899 if (flags & IEEE80211_CONF_CHANGE_CHANNEL) {
2846 rt2800_config_channel(rt2x00dev, libconf->conf, 2900 rt2800_config_channel(rt2x00dev, libconf->conf,
2847 &libconf->rf, &libconf->channel); 2901 &libconf->rf, &libconf->channel);
2848 rt2800_config_txpower(rt2x00dev, libconf->conf->channel->band, 2902 rt2800_config_txpower(rt2x00dev, libconf->conf->channel,
2849 libconf->conf->power_level); 2903 libconf->conf->power_level);
2850 } 2904 }
2851 if (flags & IEEE80211_CONF_CHANGE_POWER) 2905 if (flags & IEEE80211_CONF_CHANGE_POWER)
2852 rt2800_config_txpower(rt2x00dev, libconf->conf->channel->band, 2906 rt2800_config_txpower(rt2x00dev, libconf->conf->channel,
2853 libconf->conf->power_level); 2907 libconf->conf->power_level);
2854 if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS) 2908 if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
2855 rt2800_config_retry_limit(rt2x00dev, libconf); 2909 rt2800_config_retry_limit(rt2x00dev, libconf);
@@ -3538,8 +3592,8 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
3538 if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860D)) 3592 if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860D))
3539 rt2800_bbp_write(rt2x00dev, 84, 0x19); 3593 rt2800_bbp_write(rt2x00dev, 84, 0x19);
3540 else if (rt2x00_rt(rt2x00dev, RT3290) || 3594 else if (rt2x00_rt(rt2x00dev, RT3290) ||
3541 rt2x00_rt(rt2x00dev, RT5390) || 3595 rt2x00_rt(rt2x00dev, RT5390) ||
3542 rt2x00_rt(rt2x00dev, RT5392)) 3596 rt2x00_rt(rt2x00dev, RT5392))
3543 rt2800_bbp_write(rt2x00dev, 84, 0x9a); 3597 rt2800_bbp_write(rt2x00dev, 84, 0x9a);
3544 else 3598 else
3545 rt2800_bbp_write(rt2x00dev, 84, 0x99); 3599 rt2800_bbp_write(rt2x00dev, 84, 0x99);
@@ -3598,7 +3652,7 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
3598 else if (rt2x00_rt(rt2x00dev, RT3352)) 3652 else if (rt2x00_rt(rt2x00dev, RT3352))
3599 rt2800_bbp_write(rt2x00dev, 105, 0x34); 3653 rt2800_bbp_write(rt2x00dev, 105, 0x34);
3600 else if (rt2x00_rt(rt2x00dev, RT5390) || 3654 else if (rt2x00_rt(rt2x00dev, RT5390) ||
3601 rt2x00_rt(rt2x00dev, RT5392)) 3655 rt2x00_rt(rt2x00dev, RT5392))
3602 rt2800_bbp_write(rt2x00dev, 105, 0x3c); 3656 rt2800_bbp_write(rt2x00dev, 105, 0x3c);
3603 else 3657 else
3604 rt2800_bbp_write(rt2x00dev, 105, 0x05); 3658 rt2800_bbp_write(rt2x00dev, 105, 0x05);
@@ -3692,7 +3746,7 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
3692 } 3746 }
3693 3747
3694 if (rt2x00_rt(rt2x00dev, RT5390) || 3748 if (rt2x00_rt(rt2x00dev, RT5390) ||
3695 rt2x00_rt(rt2x00dev, RT5392)) { 3749 rt2x00_rt(rt2x00dev, RT5392)) {
3696 int ant, div_mode; 3750 int ant, div_mode;
3697 3751
3698 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); 3752 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
@@ -4166,66 +4220,66 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
4166 rt2800_rfcsr_write(rt2x00dev, 61, 0xdd); 4220 rt2800_rfcsr_write(rt2x00dev, 61, 0xdd);
4167 rt2800_rfcsr_write(rt2x00dev, 62, 0x00); 4221 rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
4168 rt2800_rfcsr_write(rt2x00dev, 63, 0x00); 4222 rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
4169 } else if (rt2x00_rt(rt2x00dev, RT5392)) { 4223 } else if (rt2x00_rt(rt2x00dev, RT5392)) {
4170 rt2800_rfcsr_write(rt2x00dev, 1, 0x17); 4224 rt2800_rfcsr_write(rt2x00dev, 1, 0x17);
4171 rt2800_rfcsr_write(rt2x00dev, 2, 0x80); 4225 rt2800_rfcsr_write(rt2x00dev, 2, 0x80);
4172 rt2800_rfcsr_write(rt2x00dev, 3, 0x88); 4226 rt2800_rfcsr_write(rt2x00dev, 3, 0x88);
4173 rt2800_rfcsr_write(rt2x00dev, 5, 0x10); 4227 rt2800_rfcsr_write(rt2x00dev, 5, 0x10);
4174 rt2800_rfcsr_write(rt2x00dev, 6, 0xe0); 4228 rt2800_rfcsr_write(rt2x00dev, 6, 0xe0);
4175 rt2800_rfcsr_write(rt2x00dev, 7, 0x00); 4229 rt2800_rfcsr_write(rt2x00dev, 7, 0x00);
4176 rt2800_rfcsr_write(rt2x00dev, 10, 0x53); 4230 rt2800_rfcsr_write(rt2x00dev, 10, 0x53);
4177 rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); 4231 rt2800_rfcsr_write(rt2x00dev, 11, 0x4a);
4178 rt2800_rfcsr_write(rt2x00dev, 12, 0x46); 4232 rt2800_rfcsr_write(rt2x00dev, 12, 0x46);
4179 rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); 4233 rt2800_rfcsr_write(rt2x00dev, 13, 0x9f);
4180 rt2800_rfcsr_write(rt2x00dev, 14, 0x00); 4234 rt2800_rfcsr_write(rt2x00dev, 14, 0x00);
4181 rt2800_rfcsr_write(rt2x00dev, 15, 0x00); 4235 rt2800_rfcsr_write(rt2x00dev, 15, 0x00);
4182 rt2800_rfcsr_write(rt2x00dev, 16, 0x00); 4236 rt2800_rfcsr_write(rt2x00dev, 16, 0x00);
4183 rt2800_rfcsr_write(rt2x00dev, 18, 0x03); 4237 rt2800_rfcsr_write(rt2x00dev, 18, 0x03);
4184 rt2800_rfcsr_write(rt2x00dev, 19, 0x4d); 4238 rt2800_rfcsr_write(rt2x00dev, 19, 0x4d);
4185 rt2800_rfcsr_write(rt2x00dev, 20, 0x00); 4239 rt2800_rfcsr_write(rt2x00dev, 20, 0x00);
4186 rt2800_rfcsr_write(rt2x00dev, 21, 0x8d); 4240 rt2800_rfcsr_write(rt2x00dev, 21, 0x8d);
4187 rt2800_rfcsr_write(rt2x00dev, 22, 0x20); 4241 rt2800_rfcsr_write(rt2x00dev, 22, 0x20);
4188 rt2800_rfcsr_write(rt2x00dev, 23, 0x0b); 4242 rt2800_rfcsr_write(rt2x00dev, 23, 0x0b);
4189 rt2800_rfcsr_write(rt2x00dev, 24, 0x44); 4243 rt2800_rfcsr_write(rt2x00dev, 24, 0x44);
4190 rt2800_rfcsr_write(rt2x00dev, 25, 0x80); 4244 rt2800_rfcsr_write(rt2x00dev, 25, 0x80);
4191 rt2800_rfcsr_write(rt2x00dev, 26, 0x82); 4245 rt2800_rfcsr_write(rt2x00dev, 26, 0x82);
4192 rt2800_rfcsr_write(rt2x00dev, 27, 0x09); 4246 rt2800_rfcsr_write(rt2x00dev, 27, 0x09);
4193 rt2800_rfcsr_write(rt2x00dev, 28, 0x00); 4247 rt2800_rfcsr_write(rt2x00dev, 28, 0x00);
4194 rt2800_rfcsr_write(rt2x00dev, 29, 0x10); 4248 rt2800_rfcsr_write(rt2x00dev, 29, 0x10);
4195 rt2800_rfcsr_write(rt2x00dev, 30, 0x10); 4249 rt2800_rfcsr_write(rt2x00dev, 30, 0x10);
4196 rt2800_rfcsr_write(rt2x00dev, 31, 0x80); 4250 rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
4197 rt2800_rfcsr_write(rt2x00dev, 32, 0x20); 4251 rt2800_rfcsr_write(rt2x00dev, 32, 0x20);
4198 rt2800_rfcsr_write(rt2x00dev, 33, 0xC0); 4252 rt2800_rfcsr_write(rt2x00dev, 33, 0xC0);
4199 rt2800_rfcsr_write(rt2x00dev, 34, 0x07); 4253 rt2800_rfcsr_write(rt2x00dev, 34, 0x07);
4200 rt2800_rfcsr_write(rt2x00dev, 35, 0x12); 4254 rt2800_rfcsr_write(rt2x00dev, 35, 0x12);
4201 rt2800_rfcsr_write(rt2x00dev, 36, 0x00); 4255 rt2800_rfcsr_write(rt2x00dev, 36, 0x00);
4202 rt2800_rfcsr_write(rt2x00dev, 37, 0x08); 4256 rt2800_rfcsr_write(rt2x00dev, 37, 0x08);
4203 rt2800_rfcsr_write(rt2x00dev, 38, 0x89); 4257 rt2800_rfcsr_write(rt2x00dev, 38, 0x89);
4204 rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); 4258 rt2800_rfcsr_write(rt2x00dev, 39, 0x1b);
4205 rt2800_rfcsr_write(rt2x00dev, 40, 0x0f); 4259 rt2800_rfcsr_write(rt2x00dev, 40, 0x0f);
4206 rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); 4260 rt2800_rfcsr_write(rt2x00dev, 41, 0xbb);
4207 rt2800_rfcsr_write(rt2x00dev, 42, 0xd5); 4261 rt2800_rfcsr_write(rt2x00dev, 42, 0xd5);
4208 rt2800_rfcsr_write(rt2x00dev, 43, 0x9b); 4262 rt2800_rfcsr_write(rt2x00dev, 43, 0x9b);
4209 rt2800_rfcsr_write(rt2x00dev, 44, 0x0e); 4263 rt2800_rfcsr_write(rt2x00dev, 44, 0x0e);
4210 rt2800_rfcsr_write(rt2x00dev, 45, 0xa2); 4264 rt2800_rfcsr_write(rt2x00dev, 45, 0xa2);
4211 rt2800_rfcsr_write(rt2x00dev, 46, 0x73); 4265 rt2800_rfcsr_write(rt2x00dev, 46, 0x73);
4212 rt2800_rfcsr_write(rt2x00dev, 47, 0x0c); 4266 rt2800_rfcsr_write(rt2x00dev, 47, 0x0c);
4213 rt2800_rfcsr_write(rt2x00dev, 48, 0x10); 4267 rt2800_rfcsr_write(rt2x00dev, 48, 0x10);
4214 rt2800_rfcsr_write(rt2x00dev, 49, 0x94); 4268 rt2800_rfcsr_write(rt2x00dev, 49, 0x94);
4215 rt2800_rfcsr_write(rt2x00dev, 50, 0x94); 4269 rt2800_rfcsr_write(rt2x00dev, 50, 0x94);
4216 rt2800_rfcsr_write(rt2x00dev, 51, 0x3a); 4270 rt2800_rfcsr_write(rt2x00dev, 51, 0x3a);
4217 rt2800_rfcsr_write(rt2x00dev, 52, 0x48); 4271 rt2800_rfcsr_write(rt2x00dev, 52, 0x48);
4218 rt2800_rfcsr_write(rt2x00dev, 53, 0x44); 4272 rt2800_rfcsr_write(rt2x00dev, 53, 0x44);
4219 rt2800_rfcsr_write(rt2x00dev, 54, 0x38); 4273 rt2800_rfcsr_write(rt2x00dev, 54, 0x38);
4220 rt2800_rfcsr_write(rt2x00dev, 55, 0x43); 4274 rt2800_rfcsr_write(rt2x00dev, 55, 0x43);
4221 rt2800_rfcsr_write(rt2x00dev, 56, 0xa1); 4275 rt2800_rfcsr_write(rt2x00dev, 56, 0xa1);
4222 rt2800_rfcsr_write(rt2x00dev, 57, 0x00); 4276 rt2800_rfcsr_write(rt2x00dev, 57, 0x00);
4223 rt2800_rfcsr_write(rt2x00dev, 58, 0x39); 4277 rt2800_rfcsr_write(rt2x00dev, 58, 0x39);
4224 rt2800_rfcsr_write(rt2x00dev, 59, 0x07); 4278 rt2800_rfcsr_write(rt2x00dev, 59, 0x07);
4225 rt2800_rfcsr_write(rt2x00dev, 60, 0x45); 4279 rt2800_rfcsr_write(rt2x00dev, 60, 0x45);
4226 rt2800_rfcsr_write(rt2x00dev, 61, 0x91); 4280 rt2800_rfcsr_write(rt2x00dev, 61, 0x91);
4227 rt2800_rfcsr_write(rt2x00dev, 62, 0x39); 4281 rt2800_rfcsr_write(rt2x00dev, 62, 0x39);
4228 rt2800_rfcsr_write(rt2x00dev, 63, 0x07); 4282 rt2800_rfcsr_write(rt2x00dev, 63, 0x07);
4229 } 4283 }
4230 4284
4231 if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { 4285 if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) {
@@ -4302,7 +4356,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
4302 rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26); 4356 rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26);
4303 4357
4304 if (!rt2x00_rt(rt2x00dev, RT5390) && 4358 if (!rt2x00_rt(rt2x00dev, RT5390) &&
4305 !rt2x00_rt(rt2x00dev, RT5392)) { 4359 !rt2x00_rt(rt2x00dev, RT5392)) {
4306 /* 4360 /*
4307 * Set back to initial state 4361 * Set back to initial state
4308 */ 4362 */
@@ -4331,7 +4385,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
4331 rt2800_register_write(rt2x00dev, OPT_14_CSR, reg); 4385 rt2800_register_write(rt2x00dev, OPT_14_CSR, reg);
4332 4386
4333 if (!rt2x00_rt(rt2x00dev, RT5390) && 4387 if (!rt2x00_rt(rt2x00dev, RT5390) &&
4334 !rt2x00_rt(rt2x00dev, RT5392)) { 4388 !rt2x00_rt(rt2x00dev, RT5392)) {
4335 rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); 4389 rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
4336 rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0); 4390 rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0);
4337 if (rt2x00_rt(rt2x00dev, RT3070) || 4391 if (rt2x00_rt(rt2x00dev, RT3070) ||
@@ -4403,7 +4457,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
4403 } 4457 }
4404 4458
4405 if (rt2x00_rt(rt2x00dev, RT5390) || 4459 if (rt2x00_rt(rt2x00dev, RT5390) ||
4406 rt2x00_rt(rt2x00dev, RT5392)) { 4460 rt2x00_rt(rt2x00dev, RT5392)) {
4407 rt2800_rfcsr_read(rt2x00dev, 38, &rfcsr); 4461 rt2800_rfcsr_read(rt2x00dev, 38, &rfcsr);
4408 rt2x00_set_field8(&rfcsr, RFCSR38_RX_LO1_EN, 0); 4462 rt2x00_set_field8(&rfcsr, RFCSR38_RX_LO1_EN, 0);
4409 rt2800_rfcsr_write(rt2x00dev, 38, rfcsr); 4463 rt2800_rfcsr_write(rt2x00dev, 38, rfcsr);
@@ -5036,7 +5090,8 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
5036 IEEE80211_HW_SUPPORTS_PS | 5090 IEEE80211_HW_SUPPORTS_PS |
5037 IEEE80211_HW_PS_NULLFUNC_STACK | 5091 IEEE80211_HW_PS_NULLFUNC_STACK |
5038 IEEE80211_HW_AMPDU_AGGREGATION | 5092 IEEE80211_HW_AMPDU_AGGREGATION |
5039 IEEE80211_HW_REPORTS_TX_ACK_STATUS; 5093 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
5094 IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL;
5040 5095
5041 /* 5096 /*
5042 * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices 5097 * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 27829e1e2e38..9224d874bf24 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1176,7 +1176,7 @@ static struct platform_driver rt2800soc_driver = {
1176 .mod_name = KBUILD_MODNAME, 1176 .mod_name = KBUILD_MODNAME,
1177 }, 1177 },
1178 .probe = rt2800soc_probe, 1178 .probe = rt2800soc_probe,
1179 .remove = __devexit_p(rt2x00soc_remove), 1179 .remove = rt2x00soc_remove,
1180 .suspend = rt2x00soc_suspend, 1180 .suspend = rt2x00soc_suspend,
1181 .resume = rt2x00soc_resume, 1181 .resume = rt2x00soc_resume,
1182}; 1182};
@@ -1193,7 +1193,7 @@ static struct pci_driver rt2800pci_driver = {
1193 .name = KBUILD_MODNAME, 1193 .name = KBUILD_MODNAME,
1194 .id_table = rt2800pci_device_table, 1194 .id_table = rt2800pci_device_table,
1195 .probe = rt2800pci_probe, 1195 .probe = rt2800pci_probe,
1196 .remove = __devexit_p(rt2x00pci_remove), 1196 .remove = rt2x00pci_remove,
1197 .suspend = rt2x00pci_suspend, 1197 .suspend = rt2x00pci_suspend,
1198 .resume = rt2x00pci_resume, 1198 .resume = rt2x00pci_resume,
1199}; 1199};
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 3b8fb5a603f2..5c149b58ab46 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1096,6 +1096,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
1096 { USB_DEVICE(0x177f, 0x0153) }, 1096 { USB_DEVICE(0x177f, 0x0153) },
1097 { USB_DEVICE(0x177f, 0x0302) }, 1097 { USB_DEVICE(0x177f, 0x0302) },
1098 { USB_DEVICE(0x177f, 0x0313) }, 1098 { USB_DEVICE(0x177f, 0x0313) },
1099 { USB_DEVICE(0x177f, 0x0323) },
1099 /* U-Media */ 1100 /* U-Media */
1100 { USB_DEVICE(0x157e, 0x300e) }, 1101 { USB_DEVICE(0x157e, 0x300e) },
1101 { USB_DEVICE(0x157e, 0x3013) }, 1102 { USB_DEVICE(0x157e, 0x3013) },
@@ -1169,6 +1170,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
1169 { USB_DEVICE(0x2001, 0x3c19) }, 1170 { USB_DEVICE(0x2001, 0x3c19) },
1170 { USB_DEVICE(0x2001, 0x3c1c) }, 1171 { USB_DEVICE(0x2001, 0x3c1c) },
1171 { USB_DEVICE(0x2001, 0x3c1d) }, 1172 { USB_DEVICE(0x2001, 0x3c1d) },
1173 { USB_DEVICE(0x2001, 0x3c1e) },
1172 /* LG innotek */ 1174 /* LG innotek */
1173 { USB_DEVICE(0x043e, 0x7a22) }, 1175 { USB_DEVICE(0x043e, 0x7a22) },
1174 /* Panasonic */ 1176 /* Panasonic */
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 69097d1faeb6..44f8b3f3cbed 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -157,6 +157,7 @@ static void rt2x00lib_intf_scheduled(struct work_struct *work)
157 * requested configurations. 157 * requested configurations.
158 */ 158 */
159 ieee80211_iterate_active_interfaces(rt2x00dev->hw, 159 ieee80211_iterate_active_interfaces(rt2x00dev->hw,
160 IEEE80211_IFACE_ITER_RESUME_ALL,
160 rt2x00lib_intf_scheduled_iter, 161 rt2x00lib_intf_scheduled_iter,
161 rt2x00dev); 162 rt2x00dev);
162} 163}
@@ -225,9 +226,9 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
225 return; 226 return;
226 227
227 /* send buffered bc/mc frames out for every bssid */ 228 /* send buffered bc/mc frames out for every bssid */
228 ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw, 229 ieee80211_iterate_active_interfaces_atomic(
229 rt2x00lib_bc_buffer_iter, 230 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
230 rt2x00dev); 231 rt2x00lib_bc_buffer_iter, rt2x00dev);
231 /* 232 /*
232 * Devices with pre tbtt interrupt don't need to update the beacon 233 * Devices with pre tbtt interrupt don't need to update the beacon
233 * here as they will fetch the next beacon directly prior to 234 * here as they will fetch the next beacon directly prior to
@@ -237,9 +238,9 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
237 return; 238 return;
238 239
239 /* fetch next beacon */ 240 /* fetch next beacon */
240 ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw, 241 ieee80211_iterate_active_interfaces_atomic(
241 rt2x00lib_beaconupdate_iter, 242 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
242 rt2x00dev); 243 rt2x00lib_beaconupdate_iter, rt2x00dev);
243} 244}
244EXPORT_SYMBOL_GPL(rt2x00lib_beacondone); 245EXPORT_SYMBOL_GPL(rt2x00lib_beacondone);
245 246
@@ -249,9 +250,9 @@ void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev)
249 return; 250 return;
250 251
251 /* fetch next beacon */ 252 /* fetch next beacon */
252 ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw, 253 ieee80211_iterate_active_interfaces_atomic(
253 rt2x00lib_beaconupdate_iter, 254 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
254 rt2x00dev); 255 rt2x00lib_beaconupdate_iter, rt2x00dev);
255} 256}
256EXPORT_SYMBOL_GPL(rt2x00lib_pretbtt); 257EXPORT_SYMBOL_GPL(rt2x00lib_pretbtt);
257 258
@@ -391,10 +392,9 @@ void rt2x00lib_txdone(struct queue_entry *entry,
391 tx_info->flags |= IEEE80211_TX_STAT_AMPDU; 392 tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
392 tx_info->status.ampdu_len = 1; 393 tx_info->status.ampdu_len = 1;
393 tx_info->status.ampdu_ack_len = success ? 1 : 0; 394 tx_info->status.ampdu_ack_len = success ? 1 : 0;
394 /* 395
395 * TODO: Need to tear down BA session here 396 if (!success)
396 * if not successful. 397 tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
397 */
398 } 398 }
399 399
400 if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { 400 if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
@@ -685,6 +685,14 @@ void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp)
685 * to mac80211. 685 * to mac80211.
686 */ 686 */
687 rx_status = IEEE80211_SKB_RXCB(entry->skb); 687 rx_status = IEEE80211_SKB_RXCB(entry->skb);
688
689 /* Ensure that all fields of rx_status are initialized
690 * properly. The skb->cb array was used for driver
691 * specific informations, so rx_status might contain
692 * garbage.
693 */
694 memset(rx_status, 0, sizeof(*rx_status));
695
688 rx_status->mactime = rxdesc.timestamp; 696 rx_status->mactime = rxdesc.timestamp;
689 rx_status->band = rt2x00dev->curr_band; 697 rx_status->band = rt2x00dev->curr_band;
690 rx_status->freq = rt2x00dev->curr_freq; 698 rx_status->freq = rt2x00dev->curr_freq;
@@ -1123,6 +1131,9 @@ static inline void rt2x00lib_set_if_combinations(struct rt2x00_dev *rt2x00dev)
1123 struct ieee80211_iface_limit *if_limit; 1131 struct ieee80211_iface_limit *if_limit;
1124 struct ieee80211_iface_combination *if_combination; 1132 struct ieee80211_iface_combination *if_combination;
1125 1133
1134 if (rt2x00dev->ops->max_ap_intf < 2)
1135 return;
1136
1126 /* 1137 /*
1127 * Build up AP interface limits structure. 1138 * Build up AP interface limits structure.
1128 */ 1139 */
@@ -1182,6 +1193,13 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1182 rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf); 1193 rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf);
1183 1194
1184 /* 1195 /*
1196 * rt2x00 devices can only use the last n bits of the MAC address
1197 * for virtual interfaces.
1198 */
1199 rt2x00dev->hw->wiphy->addr_mask[ETH_ALEN - 1] =
1200 (rt2x00dev->ops->max_ap_intf - 1);
1201
1202 /*
1185 * Determine which operating modes are supported, all modes 1203 * Determine which operating modes are supported, all modes
1186 * which require beaconing, depend on the availability of 1204 * which require beaconing, depend on the availability of
1187 * beacon entries. 1205 * beacon entries.
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 98a9e48f8e4a..ed7a1bb3f245 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -424,9 +424,9 @@ int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
424 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) 424 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
425 return 0; 425 return 0;
426 426
427 ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw, 427 ieee80211_iterate_active_interfaces_atomic(
428 rt2x00mac_set_tim_iter, 428 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
429 rt2x00dev); 429 rt2x00mac_set_tim_iter, rt2x00dev);
430 430
431 /* queue work to upodate the beacon template */ 431 /* queue work to upodate the beacon template */
432 ieee80211_queue_work(rt2x00dev->hw, &rt2x00dev->intf_work); 432 ieee80211_queue_work(rt2x00dev->hw, &rt2x00dev->intf_work);
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index d6582a2fa353..f95792cfcf89 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -3094,7 +3094,7 @@ static struct pci_driver rt61pci_driver = {
3094 .name = KBUILD_MODNAME, 3094 .name = KBUILD_MODNAME,
3095 .id_table = rt61pci_device_table, 3095 .id_table = rt61pci_device_table,
3096 .probe = rt61pci_probe, 3096 .probe = rt61pci_probe,
3097 .remove = __devexit_p(rt2x00pci_remove), 3097 .remove = rt2x00pci_remove,
3098 .suspend = rt2x00pci_suspend, 3098 .suspend = rt2x00pci_suspend,
3099 .resume = rt2x00pci_resume, 3099 .resume = rt2x00pci_resume,
3100}; 3100};