aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c56
1 files changed, 41 insertions, 15 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index ae20e6728b1e..14c361ae87be 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1,9 +1,9 @@
1/* 1/*
2 Copyright (C) 2010 Ivo van Doorn <IvDoorn@gmail.com>
2 Copyright (C) 2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 3 Copyright (C) 2009 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
3 Copyright (C) 2009 Gertjan van Wingerde <gwingerde@gmail.com> 4 Copyright (C) 2009 Gertjan van Wingerde <gwingerde@gmail.com>
4 5
5 Based on the original rt2800pci.c and rt2800usb.c. 6 Based on the original rt2800pci.c and rt2800usb.c.
6 Copyright (C) 2009 Ivo van Doorn <IvDoorn@gmail.com>
7 Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com> 7 Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com>
8 Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org> 8 Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
9 Copyright (C) 2009 Luis Correia <luis.f.correia@gmail.com> 9 Copyright (C) 2009 Luis Correia <luis.f.correia@gmail.com>
@@ -41,10 +41,6 @@
41#include "rt2800lib.h" 41#include "rt2800lib.h"
42#include "rt2800.h" 42#include "rt2800.h"
43 43
44MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
45MODULE_DESCRIPTION("rt2800 library");
46MODULE_LICENSE("GPL");
47
48/* 44/*
49 * Register access. 45 * Register access.
50 * All access to the CSR registers will go through the methods 46 * All access to the CSR registers will go through the methods
@@ -558,15 +554,28 @@ static void rt2800_config_wcid_attr(struct rt2x00_dev *rt2x00dev,
558 554
559 offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx); 555 offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx);
560 556
561 rt2800_register_read(rt2x00dev, offset, &reg); 557 if (crypto->cmd == SET_KEY) {
562 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_KEYTAB, 558 rt2800_register_read(rt2x00dev, offset, &reg);
563 !!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)); 559 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_KEYTAB,
564 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_CIPHER, 560 !!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE));
565 (crypto->cmd == SET_KEY) * crypto->cipher); 561 /*
566 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_BSS_IDX, 562 * Both the cipher as the BSS Idx numbers are split in a main
567 (crypto->cmd == SET_KEY) * crypto->bssidx); 563 * value of 3 bits, and a extended field for adding one additional
568 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, crypto->cipher); 564 * bit to the value.
569 rt2800_register_write(rt2x00dev, offset, reg); 565 */
566 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_CIPHER,
567 (crypto->cipher & 0x7));
568 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_CIPHER_EXT,
569 (crypto->cipher & 0x8) >> 3);
570 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_BSS_IDX,
571 (crypto->bssidx & 0x7));
572 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_BSS_IDX_EXT,
573 (crypto->bssidx & 0x8) >> 3);
574 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, crypto->cipher);
575 rt2800_register_write(rt2x00dev, offset, reg);
576 } else {
577 rt2800_register_write(rt2x00dev, offset, 0);
578 }
570 579
571 offset = MAC_IVEIV_ENTRY(key->hw_key_idx); 580 offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
572 581
@@ -1079,7 +1088,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
1079 u8 r1; 1088 u8 r1;
1080 1089
1081 rt2800_bbp_read(rt2x00dev, 1, &r1); 1090 rt2800_bbp_read(rt2x00dev, 1, &r1);
1082 rt2x00_set_field8(&reg, BBP1_TX_POWER, 0); 1091 rt2x00_set_field8(&r1, BBP1_TX_POWER, 0);
1083 rt2800_bbp_write(rt2x00dev, 1, r1); 1092 rt2800_bbp_write(rt2x00dev, 1, r1);
1084 1093
1085 rt2800_register_read(rt2x00dev, TX_PWR_CFG_0, &reg); 1094 rt2800_register_read(rt2x00dev, TX_PWR_CFG_0, &reg);
@@ -2497,6 +2506,18 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2497 rt2x00_eeprom_addr(rt2x00dev, 2506 rt2x00_eeprom_addr(rt2x00dev,
2498 EEPROM_MAC_ADDR_0)); 2507 EEPROM_MAC_ADDR_0));
2499 2508
2509 /*
2510 * As rt2800 has a global fallback table we cannot specify
2511 * more then one tx rate per frame but since the hw will
2512 * try several rates (based on the fallback table) we should
2513 * still initialize max_rates to the maximum number of rates
2514 * we are going to try. Otherwise mac80211 will truncate our
2515 * reported tx rates and the rc algortihm will end up with
2516 * incorrect data.
2517 */
2518 rt2x00dev->hw->max_rates = 7;
2519 rt2x00dev->hw->max_rate_tries = 1;
2520
2500 rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); 2521 rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
2501 2522
2502 /* 2523 /*
@@ -2749,3 +2770,8 @@ const struct ieee80211_ops rt2800_mac80211_ops = {
2749 .rfkill_poll = rt2x00mac_rfkill_poll, 2770 .rfkill_poll = rt2x00mac_rfkill_poll,
2750}; 2771};
2751EXPORT_SYMBOL_GPL(rt2800_mac80211_ops); 2772EXPORT_SYMBOL_GPL(rt2800_mac80211_ops);
2773
2774MODULE_AUTHOR(DRV_PROJECT ", Bartlomiej Zolnierkiewicz");
2775MODULE_VERSION(DRV_VERSION);
2776MODULE_DESCRIPTION("Ralink RT2800 library");
2777MODULE_LICENSE("GPL");