aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt61pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt61pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 0ca589306d7..e2da928dd9f 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -637,8 +637,7 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
637 rt61pci_bbp_read(rt2x00dev, 4, &r4); 637 rt61pci_bbp_read(rt2x00dev, 4, &r4);
638 rt61pci_bbp_read(rt2x00dev, 77, &r77); 638 rt61pci_bbp_read(rt2x00dev, 77, &r77);
639 639
640 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 640 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF5325));
641 rt2x00_rf(&rt2x00dev->chip, RF5325));
642 641
643 /* 642 /*
644 * Configure the RX antenna. 643 * Configure the RX antenna.
@@ -684,8 +683,7 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
684 rt61pci_bbp_read(rt2x00dev, 4, &r4); 683 rt61pci_bbp_read(rt2x00dev, 4, &r4);
685 rt61pci_bbp_read(rt2x00dev, 77, &r77); 684 rt61pci_bbp_read(rt2x00dev, 77, &r77);
686 685
687 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 686 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF2529));
688 rt2x00_rf(&rt2x00dev->chip, RF2529));
689 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 687 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
690 !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); 688 !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags));
691 689
@@ -833,12 +831,11 @@ static void rt61pci_config_ant(struct rt2x00_dev *rt2x00dev,
833 831
834 rt2x00pci_register_write(rt2x00dev, PHY_CSR0, reg); 832 rt2x00pci_register_write(rt2x00dev, PHY_CSR0, reg);
835 833
836 if (rt2x00_rf(&rt2x00dev->chip, RF5225) || 834 if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF5325))
837 rt2x00_rf(&rt2x00dev->chip, RF5325))
838 rt61pci_config_antenna_5x(rt2x00dev, ant); 835 rt61pci_config_antenna_5x(rt2x00dev, ant);
839 else if (rt2x00_rf(&rt2x00dev->chip, RF2527)) 836 else if (rt2x00_rf(rt2x00dev, RF2527))
840 rt61pci_config_antenna_2x(rt2x00dev, ant); 837 rt61pci_config_antenna_2x(rt2x00dev, ant);
841 else if (rt2x00_rf(&rt2x00dev->chip, RF2529)) { 838 else if (rt2x00_rf(rt2x00dev, RF2529)) {
842 if (test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) 839 if (test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags))
843 rt61pci_config_antenna_2x(rt2x00dev, ant); 840 rt61pci_config_antenna_2x(rt2x00dev, ant);
844 else 841 else
@@ -879,8 +876,7 @@ static void rt61pci_config_channel(struct rt2x00_dev *rt2x00dev,
879 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); 876 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower));
880 rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset); 877 rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset);
881 878
882 smart = !(rt2x00_rf(&rt2x00dev->chip, RF5225) || 879 smart = !(rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527));
883 rt2x00_rf(&rt2x00dev->chip, RF2527));
884 880
885 rt61pci_bbp_read(rt2x00dev, 3, &r3); 881 rt61pci_bbp_read(rt2x00dev, 3, &r3);
886 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart); 882 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart);
@@ -1135,16 +1131,18 @@ dynamic_cca_tune:
1135 */ 1131 */
1136static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) 1132static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev)
1137{ 1133{
1134 u16 chip;
1138 char *fw_name; 1135 char *fw_name;
1139 1136
1140 switch (rt2x00dev->chip.rt) { 1137 pci_read_config_word(to_pci_dev(rt2x00dev->dev), PCI_DEVICE_ID, &chip);
1141 case RT2561: 1138 switch (chip) {
1139 case RT2561_PCI_ID:
1142 fw_name = FIRMWARE_RT2561; 1140 fw_name = FIRMWARE_RT2561;
1143 break; 1141 break;
1144 case RT2561s: 1142 case RT2561s_PCI_ID:
1145 fw_name = FIRMWARE_RT2561s; 1143 fw_name = FIRMWARE_RT2561s;
1146 break; 1144 break;
1147 case RT2661: 1145 case RT2661_PCI_ID:
1148 fw_name = FIRMWARE_RT2661; 1146 fw_name = FIRMWARE_RT2661;
1149 break; 1147 break;
1150 default: 1148 default:
@@ -2299,13 +2297,13 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2299 */ 2297 */
2300 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 2298 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
2301 rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg); 2299 rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg);
2302 rt2x00_set_chip_rf(rt2x00dev, value, reg); 2300 rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET),
2303 rt2x00_print_chip(rt2x00dev); 2301 value, rt2x00_get_field32(reg, MAC_CSR0_REVISION));
2304 2302
2305 if (!rt2x00_rf(&rt2x00dev->chip, RF5225) && 2303 if (!rt2x00_rf(rt2x00dev, RF5225) &&
2306 !rt2x00_rf(&rt2x00dev->chip, RF5325) && 2304 !rt2x00_rf(rt2x00dev, RF5325) &&
2307 !rt2x00_rf(&rt2x00dev->chip, RF2527) && 2305 !rt2x00_rf(rt2x00dev, RF2527) &&
2308 !rt2x00_rf(&rt2x00dev->chip, RF2529)) { 2306 !rt2x00_rf(rt2x00dev, RF2529)) {
2309 ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); 2307 ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
2310 return -ENODEV; 2308 return -ENODEV;
2311 } 2309 }
@@ -2360,7 +2358,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2360 * the antenna settings should be gathered from the NIC 2358 * the antenna settings should be gathered from the NIC
2361 * eeprom word. 2359 * eeprom word.
2362 */ 2360 */
2363 if (rt2x00_rf(&rt2x00dev->chip, RF2529) && 2361 if (rt2x00_rf(rt2x00dev, RF2529) &&
2364 !test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) { 2362 !test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) {
2365 rt2x00dev->default_ant.rx = 2363 rt2x00dev->default_ant.rx =
2366 ANTENNA_A + rt2x00_get_field16(eeprom, EEPROM_NIC_RX_FIXED); 2364 ANTENNA_A + rt2x00_get_field16(eeprom, EEPROM_NIC_RX_FIXED);
@@ -2571,8 +2569,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2571 spec->channels = rf_vals_seq; 2569 spec->channels = rf_vals_seq;
2572 } 2570 }
2573 2571
2574 if (rt2x00_rf(&rt2x00dev->chip, RF5225) || 2572 if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF5325)) {
2575 rt2x00_rf(&rt2x00dev->chip, RF5325)) {
2576 spec->supported_bands |= SUPPORT_BAND_5GHZ; 2573 spec->supported_bands |= SUPPORT_BAND_5GHZ;
2577 spec->num_channels = ARRAY_SIZE(rf_vals_seq); 2574 spec->num_channels = ARRAY_SIZE(rf_vals_seq);
2578 } 2575 }
@@ -2735,7 +2732,6 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = {
2735 .get_stats = rt2x00mac_get_stats, 2732 .get_stats = rt2x00mac_get_stats,
2736 .bss_info_changed = rt2x00mac_bss_info_changed, 2733 .bss_info_changed = rt2x00mac_bss_info_changed,
2737 .conf_tx = rt61pci_conf_tx, 2734 .conf_tx = rt61pci_conf_tx,
2738 .get_tx_stats = rt2x00mac_get_tx_stats,
2739 .get_tsf = rt61pci_get_tsf, 2735 .get_tsf = rt61pci_get_tsf,
2740 .rfkill_poll = rt2x00mac_rfkill_poll, 2736 .rfkill_poll = rt2x00mac_rfkill_poll,
2741}; 2737};
@@ -2812,7 +2808,7 @@ static const struct rt2x00_ops rt61pci_ops = {
2812/* 2808/*
2813 * RT61pci module information. 2809 * RT61pci module information.
2814 */ 2810 */
2815static struct pci_device_id rt61pci_device_table[] = { 2811static DEFINE_PCI_DEVICE_TABLE(rt61pci_device_table) = {
2816 /* RT2561s */ 2812 /* RT2561s */
2817 { PCI_DEVICE(0x1814, 0x0301), PCI_DEVICE_DATA(&rt61pci_ops) }, 2813 { PCI_DEVICE(0x1814, 0x0301), PCI_DEVICE_DATA(&rt61pci_ops) },
2818 /* RT2561 v2 */ 2814 /* RT2561 v2 */