aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c79
1 files changed, 39 insertions, 40 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 2e872ac69826..2a73f593aab0 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.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
@@ -31,6 +31,7 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <linux/eeprom_93cx6.h> 33#include <linux/eeprom_93cx6.h>
34#include <linux/slab.h>
34 35
35#include "rt2x00.h" 36#include "rt2x00.h"
36#include "rt2x00pci.h" 37#include "rt2x00pci.h"
@@ -440,8 +441,7 @@ static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev,
440 /* 441 /*
441 * RT2525E and RT5222 need to flip TX I/Q 442 * RT2525E and RT5222 need to flip TX I/Q
442 */ 443 */
443 if (rt2x00_rf(&rt2x00dev->chip, RF2525E) || 444 if (rt2x00_rf(rt2x00dev, RF2525E) || rt2x00_rf(rt2x00dev, RF5222)) {
444 rt2x00_rf(&rt2x00dev->chip, RF5222)) {
445 rt2x00_set_field8(&r2, BBP_R2_TX_IQ_FLIP, 1); 445 rt2x00_set_field8(&r2, BBP_R2_TX_IQ_FLIP, 1);
446 rt2x00_set_field32(&reg, BBPCSR1_CCK_FLIP, 1); 446 rt2x00_set_field32(&reg, BBPCSR1_CCK_FLIP, 1);
447 rt2x00_set_field32(&reg, BBPCSR1_OFDM_FLIP, 1); 447 rt2x00_set_field32(&reg, BBPCSR1_OFDM_FLIP, 1);
@@ -449,7 +449,7 @@ static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev,
449 /* 449 /*
450 * RT2525E does not need RX I/Q Flip. 450 * RT2525E does not need RX I/Q Flip.
451 */ 451 */
452 if (rt2x00_rf(&rt2x00dev->chip, RF2525E)) 452 if (rt2x00_rf(rt2x00dev, RF2525E))
453 rt2x00_set_field8(&r14, BBP_R14_RX_IQ_FLIP, 0); 453 rt2x00_set_field8(&r14, BBP_R14_RX_IQ_FLIP, 0);
454 } else { 454 } else {
455 rt2x00_set_field32(&reg, BBPCSR1_CCK_FLIP, 0); 455 rt2x00_set_field32(&reg, BBPCSR1_CCK_FLIP, 0);
@@ -475,14 +475,14 @@ static void rt2500pci_config_channel(struct rt2x00_dev *rt2x00dev,
475 * Switch on tuning bits. 475 * Switch on tuning bits.
476 * For RT2523 devices we do not need to update the R1 register. 476 * For RT2523 devices we do not need to update the R1 register.
477 */ 477 */
478 if (!rt2x00_rf(&rt2x00dev->chip, RF2523)) 478 if (!rt2x00_rf(rt2x00dev, RF2523))
479 rt2x00_set_field32(&rf->rf1, RF1_TUNER, 1); 479 rt2x00_set_field32(&rf->rf1, RF1_TUNER, 1);
480 rt2x00_set_field32(&rf->rf3, RF3_TUNER, 1); 480 rt2x00_set_field32(&rf->rf3, RF3_TUNER, 1);
481 481
482 /* 482 /*
483 * For RT2525 we should first set the channel to half band higher. 483 * For RT2525 we should first set the channel to half band higher.
484 */ 484 */
485 if (rt2x00_rf(&rt2x00dev->chip, RF2525)) { 485 if (rt2x00_rf(rt2x00dev, RF2525)) {
486 static const u32 vals[] = { 486 static const u32 vals[] = {
487 0x00080cbe, 0x00080d02, 0x00080d06, 0x00080d0a, 487 0x00080cbe, 0x00080d02, 0x00080d06, 0x00080d0a,
488 0x00080d0e, 0x00080d12, 0x00080d16, 0x00080d1a, 488 0x00080d0e, 0x00080d12, 0x00080d16, 0x00080d1a,
@@ -516,7 +516,7 @@ static void rt2500pci_config_channel(struct rt2x00_dev *rt2x00dev,
516 * Switch off tuning bits. 516 * Switch off tuning bits.
517 * For RT2523 devices we do not need to update the R1 register. 517 * For RT2523 devices we do not need to update the R1 register.
518 */ 518 */
519 if (!rt2x00_rf(&rt2x00dev->chip, RF2523)) { 519 if (!rt2x00_rf(rt2x00dev, RF2523)) {
520 rt2x00_set_field32(&rf->rf1, RF1_TUNER, 0); 520 rt2x00_set_field32(&rf->rf1, RF1_TUNER, 0);
521 rt2500pci_rf_write(rt2x00dev, 1, rf->rf1); 521 rt2500pci_rf_write(rt2x00dev, 1, rf->rf1);
522 } 522 }
@@ -640,7 +640,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev,
640 * up to version C the link tuning should halt after 20 640 * up to version C the link tuning should halt after 20
641 * seconds while being associated. 641 * seconds while being associated.
642 */ 642 */
643 if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D && 643 if (rt2x00_rev(rt2x00dev) < RT2560_VERSION_D &&
644 rt2x00dev->intf_associated && count > 20) 644 rt2x00dev->intf_associated && count > 20)
645 return; 645 return;
646 646
@@ -650,7 +650,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev,
650 * should go straight to dynamic CCA tuning when they 650 * should go straight to dynamic CCA tuning when they
651 * are not associated. 651 * are not associated.
652 */ 652 */
653 if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D || 653 if (rt2x00_rev(rt2x00dev) < RT2560_VERSION_D ||
654 !rt2x00dev->intf_associated) 654 !rt2x00dev->intf_associated)
655 goto dynamic_cca_tune; 655 goto dynamic_cca_tune;
656 656
@@ -1504,14 +1504,15 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
1504 */ 1504 */
1505 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 1505 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
1506 rt2x00pci_register_read(rt2x00dev, CSR0, &reg); 1506 rt2x00pci_register_read(rt2x00dev, CSR0, &reg);
1507 rt2x00_set_chip_rf(rt2x00dev, value, reg); 1507 rt2x00_set_chip(rt2x00dev, RT2560, value,
1508 1508 rt2x00_get_field32(reg, CSR0_REVISION));
1509 if (!rt2x00_rf(&rt2x00dev->chip, RF2522) && 1509
1510 !rt2x00_rf(&rt2x00dev->chip, RF2523) && 1510 if (!rt2x00_rf(rt2x00dev, RF2522) &&
1511 !rt2x00_rf(&rt2x00dev->chip, RF2524) && 1511 !rt2x00_rf(rt2x00dev, RF2523) &&
1512 !rt2x00_rf(&rt2x00dev->chip, RF2525) && 1512 !rt2x00_rf(rt2x00dev, RF2524) &&
1513 !rt2x00_rf(&rt2x00dev->chip, RF2525E) && 1513 !rt2x00_rf(rt2x00dev, RF2525) &&
1514 !rt2x00_rf(&rt2x00dev->chip, RF5222)) { 1514 !rt2x00_rf(rt2x00dev, RF2525E) &&
1515 !rt2x00_rf(rt2x00dev, RF5222)) {
1515 ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); 1516 ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
1516 return -ENODEV; 1517 return -ENODEV;
1517 } 1518 }
@@ -1732,8 +1733,6 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1732 IEEE80211_HW_SUPPORTS_PS | 1733 IEEE80211_HW_SUPPORTS_PS |
1733 IEEE80211_HW_PS_NULLFUNC_STACK; 1734 IEEE80211_HW_PS_NULLFUNC_STACK;
1734 1735
1735 rt2x00dev->hw->extra_tx_headroom = 0;
1736
1737 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); 1736 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
1738 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, 1737 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
1739 rt2x00_eeprom_addr(rt2x00dev, 1738 rt2x00_eeprom_addr(rt2x00dev,
@@ -1745,22 +1744,22 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1745 spec->supported_bands = SUPPORT_BAND_2GHZ; 1744 spec->supported_bands = SUPPORT_BAND_2GHZ;
1746 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; 1745 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
1747 1746
1748 if (rt2x00_rf(&rt2x00dev->chip, RF2522)) { 1747 if (rt2x00_rf(rt2x00dev, RF2522)) {
1749 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); 1748 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522);
1750 spec->channels = rf_vals_bg_2522; 1749 spec->channels = rf_vals_bg_2522;
1751 } else if (rt2x00_rf(&rt2x00dev->chip, RF2523)) { 1750 } else if (rt2x00_rf(rt2x00dev, RF2523)) {
1752 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523); 1751 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523);
1753 spec->channels = rf_vals_bg_2523; 1752 spec->channels = rf_vals_bg_2523;
1754 } else if (rt2x00_rf(&rt2x00dev->chip, RF2524)) { 1753 } else if (rt2x00_rf(rt2x00dev, RF2524)) {
1755 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524); 1754 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524);
1756 spec->channels = rf_vals_bg_2524; 1755 spec->channels = rf_vals_bg_2524;
1757 } else if (rt2x00_rf(&rt2x00dev->chip, RF2525)) { 1756 } else if (rt2x00_rf(rt2x00dev, RF2525)) {
1758 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525); 1757 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525);
1759 spec->channels = rf_vals_bg_2525; 1758 spec->channels = rf_vals_bg_2525;
1760 } else if (rt2x00_rf(&rt2x00dev->chip, RF2525E)) { 1759 } else if (rt2x00_rf(rt2x00dev, RF2525E)) {
1761 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e); 1760 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e);
1762 spec->channels = rf_vals_bg_2525e; 1761 spec->channels = rf_vals_bg_2525e;
1763 } else if (rt2x00_rf(&rt2x00dev->chip, RF5222)) { 1762 } else if (rt2x00_rf(rt2x00dev, RF5222)) {
1764 spec->supported_bands |= SUPPORT_BAND_5GHZ; 1763 spec->supported_bands |= SUPPORT_BAND_5GHZ;
1765 spec->num_channels = ARRAY_SIZE(rf_vals_5222); 1764 spec->num_channels = ARRAY_SIZE(rf_vals_5222);
1766 spec->channels = rf_vals_5222; 1765 spec->channels = rf_vals_5222;
@@ -1861,7 +1860,6 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = {
1861 .get_stats = rt2x00mac_get_stats, 1860 .get_stats = rt2x00mac_get_stats,
1862 .bss_info_changed = rt2x00mac_bss_info_changed, 1861 .bss_info_changed = rt2x00mac_bss_info_changed,
1863 .conf_tx = rt2x00mac_conf_tx, 1862 .conf_tx = rt2x00mac_conf_tx,
1864 .get_tx_stats = rt2x00mac_get_tx_stats,
1865 .get_tsf = rt2500pci_get_tsf, 1863 .get_tsf = rt2500pci_get_tsf,
1866 .tx_last_beacon = rt2500pci_tx_last_beacon, 1864 .tx_last_beacon = rt2500pci_tx_last_beacon,
1867 .rfkill_poll = rt2x00mac_rfkill_poll, 1865 .rfkill_poll = rt2x00mac_rfkill_poll,
@@ -1921,27 +1919,28 @@ static const struct data_queue_desc rt2500pci_queue_atim = {
1921}; 1919};
1922 1920
1923static const struct rt2x00_ops rt2500pci_ops = { 1921static const struct rt2x00_ops rt2500pci_ops = {
1924 .name = KBUILD_MODNAME, 1922 .name = KBUILD_MODNAME,
1925 .max_sta_intf = 1, 1923 .max_sta_intf = 1,
1926 .max_ap_intf = 1, 1924 .max_ap_intf = 1,
1927 .eeprom_size = EEPROM_SIZE, 1925 .eeprom_size = EEPROM_SIZE,
1928 .rf_size = RF_SIZE, 1926 .rf_size = RF_SIZE,
1929 .tx_queues = NUM_TX_QUEUES, 1927 .tx_queues = NUM_TX_QUEUES,
1930 .rx = &rt2500pci_queue_rx, 1928 .extra_tx_headroom = 0,
1931 .tx = &rt2500pci_queue_tx, 1929 .rx = &rt2500pci_queue_rx,
1932 .bcn = &rt2500pci_queue_bcn, 1930 .tx = &rt2500pci_queue_tx,
1933 .atim = &rt2500pci_queue_atim, 1931 .bcn = &rt2500pci_queue_bcn,
1934 .lib = &rt2500pci_rt2x00_ops, 1932 .atim = &rt2500pci_queue_atim,
1935 .hw = &rt2500pci_mac80211_ops, 1933 .lib = &rt2500pci_rt2x00_ops,
1934 .hw = &rt2500pci_mac80211_ops,
1936#ifdef CONFIG_RT2X00_LIB_DEBUGFS 1935#ifdef CONFIG_RT2X00_LIB_DEBUGFS
1937 .debugfs = &rt2500pci_rt2x00debug, 1936 .debugfs = &rt2500pci_rt2x00debug,
1938#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ 1937#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
1939}; 1938};
1940 1939
1941/* 1940/*
1942 * RT2500pci module information. 1941 * RT2500pci module information.
1943 */ 1942 */
1944static struct pci_device_id rt2500pci_device_table[] = { 1943static DEFINE_PCI_DEVICE_TABLE(rt2500pci_device_table) = {
1945 { PCI_DEVICE(0x1814, 0x0201), PCI_DEVICE_DATA(&rt2500pci_ops) }, 1944 { PCI_DEVICE(0x1814, 0x0201), PCI_DEVICE_DATA(&rt2500pci_ops) },
1946 { 0, } 1945 { 0, }
1947}; 1946};