diff options
author | Gertjan van Wingerde <gwingerde@gmail.com> | 2009-12-22 18:03:25 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-12-28 16:31:38 -0500 |
commit | 5122d8986232ef2a761f5cf70c31666c4d65c3e4 (patch) | |
tree | 4669d6f1a6dd41c7b721788389420f9d4552b9fd | |
parent | 73a2f1259ebb49f9768aa12eee2a1071345eb7f2 (diff) |
rt2x00: Cleanup chip handling helper functions.
Let each of them take a struct rt2x00_dev pointer as argument instead of
a mixture of struct rt2x00_chip and struct rt2x00_dev pointers.
Preparation for further clean ups in the rt2x00 chip handling, especially
for rt2800 devices.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 39 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 90 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 24 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 29 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 36 |
9 files changed, 125 insertions, 143 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index e7f46405a418..d86d233c6810 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -451,7 +451,7 @@ static void rt2400pci_config_channel(struct rt2x00_dev *rt2x00dev, | |||
451 | /* | 451 | /* |
452 | * RF2420 chipset don't need any additional actions. | 452 | * RF2420 chipset don't need any additional actions. |
453 | */ | 453 | */ |
454 | if (rt2x00_rf(&rt2x00dev->chip, RF2420)) | 454 | if (rt2x00_rf(rt2x00dev, RF2420)) |
455 | return; | 455 | return; |
456 | 456 | ||
457 | /* | 457 | /* |
@@ -1343,8 +1343,7 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1343 | rt2x00_set_chip_rf(rt2x00dev, value, reg); | 1343 | rt2x00_set_chip_rf(rt2x00dev, value, reg); |
1344 | rt2x00_print_chip(rt2x00dev); | 1344 | rt2x00_print_chip(rt2x00dev); |
1345 | 1345 | ||
1346 | if (!rt2x00_rf(&rt2x00dev->chip, RF2420) && | 1346 | if (!rt2x00_rf(rt2x00dev, RF2420) && !rt2x00_rf(rt2x00dev, RF2421)) { |
1347 | !rt2x00_rf(&rt2x00dev->chip, RF2421)) { | ||
1348 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); | 1347 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); |
1349 | return -ENODEV; | 1348 | return -ENODEV; |
1350 | } | 1349 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 408fcfc120f5..46cbc6ef66ab 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -440,8 +440,7 @@ static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev, | |||
440 | /* | 440 | /* |
441 | * RT2525E and RT5222 need to flip TX I/Q | 441 | * RT2525E and RT5222 need to flip TX I/Q |
442 | */ | 442 | */ |
443 | if (rt2x00_rf(&rt2x00dev->chip, RF2525E) || | 443 | 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); | 444 | rt2x00_set_field8(&r2, BBP_R2_TX_IQ_FLIP, 1); |
446 | rt2x00_set_field32(®, BBPCSR1_CCK_FLIP, 1); | 445 | rt2x00_set_field32(®, BBPCSR1_CCK_FLIP, 1); |
447 | rt2x00_set_field32(®, BBPCSR1_OFDM_FLIP, 1); | 446 | rt2x00_set_field32(®, BBPCSR1_OFDM_FLIP, 1); |
@@ -449,7 +448,7 @@ static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev, | |||
449 | /* | 448 | /* |
450 | * RT2525E does not need RX I/Q Flip. | 449 | * RT2525E does not need RX I/Q Flip. |
451 | */ | 450 | */ |
452 | if (rt2x00_rf(&rt2x00dev->chip, RF2525E)) | 451 | if (rt2x00_rf(rt2x00dev, RF2525E)) |
453 | rt2x00_set_field8(&r14, BBP_R14_RX_IQ_FLIP, 0); | 452 | rt2x00_set_field8(&r14, BBP_R14_RX_IQ_FLIP, 0); |
454 | } else { | 453 | } else { |
455 | rt2x00_set_field32(®, BBPCSR1_CCK_FLIP, 0); | 454 | rt2x00_set_field32(®, BBPCSR1_CCK_FLIP, 0); |
@@ -475,14 +474,14 @@ static void rt2500pci_config_channel(struct rt2x00_dev *rt2x00dev, | |||
475 | * Switch on tuning bits. | 474 | * Switch on tuning bits. |
476 | * For RT2523 devices we do not need to update the R1 register. | 475 | * For RT2523 devices we do not need to update the R1 register. |
477 | */ | 476 | */ |
478 | if (!rt2x00_rf(&rt2x00dev->chip, RF2523)) | 477 | if (!rt2x00_rf(rt2x00dev, RF2523)) |
479 | rt2x00_set_field32(&rf->rf1, RF1_TUNER, 1); | 478 | rt2x00_set_field32(&rf->rf1, RF1_TUNER, 1); |
480 | rt2x00_set_field32(&rf->rf3, RF3_TUNER, 1); | 479 | rt2x00_set_field32(&rf->rf3, RF3_TUNER, 1); |
481 | 480 | ||
482 | /* | 481 | /* |
483 | * For RT2525 we should first set the channel to half band higher. | 482 | * For RT2525 we should first set the channel to half band higher. |
484 | */ | 483 | */ |
485 | if (rt2x00_rf(&rt2x00dev->chip, RF2525)) { | 484 | if (rt2x00_rf(rt2x00dev, RF2525)) { |
486 | static const u32 vals[] = { | 485 | static const u32 vals[] = { |
487 | 0x00080cbe, 0x00080d02, 0x00080d06, 0x00080d0a, | 486 | 0x00080cbe, 0x00080d02, 0x00080d06, 0x00080d0a, |
488 | 0x00080d0e, 0x00080d12, 0x00080d16, 0x00080d1a, | 487 | 0x00080d0e, 0x00080d12, 0x00080d16, 0x00080d1a, |
@@ -516,7 +515,7 @@ static void rt2500pci_config_channel(struct rt2x00_dev *rt2x00dev, | |||
516 | * Switch off tuning bits. | 515 | * Switch off tuning bits. |
517 | * For RT2523 devices we do not need to update the R1 register. | 516 | * For RT2523 devices we do not need to update the R1 register. |
518 | */ | 517 | */ |
519 | if (!rt2x00_rf(&rt2x00dev->chip, RF2523)) { | 518 | if (!rt2x00_rf(rt2x00dev, RF2523)) { |
520 | rt2x00_set_field32(&rf->rf1, RF1_TUNER, 0); | 519 | rt2x00_set_field32(&rf->rf1, RF1_TUNER, 0); |
521 | rt2500pci_rf_write(rt2x00dev, 1, rf->rf1); | 520 | rt2500pci_rf_write(rt2x00dev, 1, rf->rf1); |
522 | } | 521 | } |
@@ -640,7 +639,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev, | |||
640 | * up to version C the link tuning should halt after 20 | 639 | * up to version C the link tuning should halt after 20 |
641 | * seconds while being associated. | 640 | * seconds while being associated. |
642 | */ | 641 | */ |
643 | if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D && | 642 | if (rt2x00_rev(rt2x00dev) < RT2560_VERSION_D && |
644 | rt2x00dev->intf_associated && count > 20) | 643 | rt2x00dev->intf_associated && count > 20) |
645 | return; | 644 | return; |
646 | 645 | ||
@@ -650,7 +649,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev, | |||
650 | * should go straight to dynamic CCA tuning when they | 649 | * should go straight to dynamic CCA tuning when they |
651 | * are not associated. | 650 | * are not associated. |
652 | */ | 651 | */ |
653 | if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D || | 652 | if (rt2x00_rev(rt2x00dev) < RT2560_VERSION_D || |
654 | !rt2x00dev->intf_associated) | 653 | !rt2x00dev->intf_associated) |
655 | goto dynamic_cca_tune; | 654 | goto dynamic_cca_tune; |
656 | 655 | ||
@@ -1507,12 +1506,12 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1507 | rt2x00_set_chip_rf(rt2x00dev, value, reg); | 1506 | rt2x00_set_chip_rf(rt2x00dev, value, reg); |
1508 | rt2x00_print_chip(rt2x00dev); | 1507 | rt2x00_print_chip(rt2x00dev); |
1509 | 1508 | ||
1510 | if (!rt2x00_rf(&rt2x00dev->chip, RF2522) && | 1509 | if (!rt2x00_rf(rt2x00dev, RF2522) && |
1511 | !rt2x00_rf(&rt2x00dev->chip, RF2523) && | 1510 | !rt2x00_rf(rt2x00dev, RF2523) && |
1512 | !rt2x00_rf(&rt2x00dev->chip, RF2524) && | 1511 | !rt2x00_rf(rt2x00dev, RF2524) && |
1513 | !rt2x00_rf(&rt2x00dev->chip, RF2525) && | 1512 | !rt2x00_rf(rt2x00dev, RF2525) && |
1514 | !rt2x00_rf(&rt2x00dev->chip, RF2525E) && | 1513 | !rt2x00_rf(rt2x00dev, RF2525E) && |
1515 | !rt2x00_rf(&rt2x00dev->chip, RF5222)) { | 1514 | !rt2x00_rf(rt2x00dev, RF5222)) { |
1516 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); | 1515 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); |
1517 | return -ENODEV; | 1516 | return -ENODEV; |
1518 | } | 1517 | } |
@@ -1744,22 +1743,22 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1744 | spec->supported_bands = SUPPORT_BAND_2GHZ; | 1743 | spec->supported_bands = SUPPORT_BAND_2GHZ; |
1745 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; | 1744 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; |
1746 | 1745 | ||
1747 | if (rt2x00_rf(&rt2x00dev->chip, RF2522)) { | 1746 | if (rt2x00_rf(rt2x00dev, RF2522)) { |
1748 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); | 1747 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); |
1749 | spec->channels = rf_vals_bg_2522; | 1748 | spec->channels = rf_vals_bg_2522; |
1750 | } else if (rt2x00_rf(&rt2x00dev->chip, RF2523)) { | 1749 | } else if (rt2x00_rf(rt2x00dev, RF2523)) { |
1751 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523); | 1750 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523); |
1752 | spec->channels = rf_vals_bg_2523; | 1751 | spec->channels = rf_vals_bg_2523; |
1753 | } else if (rt2x00_rf(&rt2x00dev->chip, RF2524)) { | 1752 | } else if (rt2x00_rf(rt2x00dev, RF2524)) { |
1754 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524); | 1753 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524); |
1755 | spec->channels = rf_vals_bg_2524; | 1754 | spec->channels = rf_vals_bg_2524; |
1756 | } else if (rt2x00_rf(&rt2x00dev->chip, RF2525)) { | 1755 | } else if (rt2x00_rf(rt2x00dev, RF2525)) { |
1757 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525); | 1756 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525); |
1758 | spec->channels = rf_vals_bg_2525; | 1757 | spec->channels = rf_vals_bg_2525; |
1759 | } else if (rt2x00_rf(&rt2x00dev->chip, RF2525E)) { | 1758 | } else if (rt2x00_rf(rt2x00dev, RF2525E)) { |
1760 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e); | 1759 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e); |
1761 | spec->channels = rf_vals_bg_2525e; | 1760 | spec->channels = rf_vals_bg_2525e; |
1762 | } else if (rt2x00_rf(&rt2x00dev->chip, RF5222)) { | 1761 | } else if (rt2x00_rf(rt2x00dev, RF5222)) { |
1763 | spec->supported_bands |= SUPPORT_BAND_5GHZ; | 1762 | spec->supported_bands |= SUPPORT_BAND_5GHZ; |
1764 | spec->num_channels = ARRAY_SIZE(rf_vals_5222); | 1763 | spec->num_channels = ARRAY_SIZE(rf_vals_5222); |
1765 | spec->channels = rf_vals_5222; | 1764 | spec->channels = rf_vals_5222; |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 83f2592c59de..9e6f865c57f2 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -565,8 +565,7 @@ static void rt2500usb_config_ant(struct rt2x00_dev *rt2x00dev, | |||
565 | /* | 565 | /* |
566 | * RT2525E and RT5222 need to flip TX I/Q | 566 | * RT2525E and RT5222 need to flip TX I/Q |
567 | */ | 567 | */ |
568 | if (rt2x00_rf(&rt2x00dev->chip, RF2525E) || | 568 | if (rt2x00_rf(rt2x00dev, RF2525E) || rt2x00_rf(rt2x00dev, RF5222)) { |
569 | rt2x00_rf(&rt2x00dev->chip, RF5222)) { | ||
570 | rt2x00_set_field8(&r2, BBP_R2_TX_IQ_FLIP, 1); | 569 | rt2x00_set_field8(&r2, BBP_R2_TX_IQ_FLIP, 1); |
571 | rt2x00_set_field16(&csr5, PHY_CSR5_CCK_FLIP, 1); | 570 | rt2x00_set_field16(&csr5, PHY_CSR5_CCK_FLIP, 1); |
572 | rt2x00_set_field16(&csr6, PHY_CSR6_OFDM_FLIP, 1); | 571 | rt2x00_set_field16(&csr6, PHY_CSR6_OFDM_FLIP, 1); |
@@ -574,7 +573,7 @@ static void rt2500usb_config_ant(struct rt2x00_dev *rt2x00dev, | |||
574 | /* | 573 | /* |
575 | * RT2525E does not need RX I/Q Flip. | 574 | * RT2525E does not need RX I/Q Flip. |
576 | */ | 575 | */ |
577 | if (rt2x00_rf(&rt2x00dev->chip, RF2525E)) | 576 | if (rt2x00_rf(rt2x00dev, RF2525E)) |
578 | rt2x00_set_field8(&r14, BBP_R14_RX_IQ_FLIP, 0); | 577 | rt2x00_set_field8(&r14, BBP_R14_RX_IQ_FLIP, 0); |
579 | } else { | 578 | } else { |
580 | rt2x00_set_field16(&csr5, PHY_CSR5_CCK_FLIP, 0); | 579 | rt2x00_set_field16(&csr5, PHY_CSR5_CCK_FLIP, 0); |
@@ -598,7 +597,7 @@ static void rt2500usb_config_channel(struct rt2x00_dev *rt2x00dev, | |||
598 | /* | 597 | /* |
599 | * For RT2525E we should first set the channel to half band higher. | 598 | * For RT2525E we should first set the channel to half band higher. |
600 | */ | 599 | */ |
601 | if (rt2x00_rf(&rt2x00dev->chip, RF2525E)) { | 600 | if (rt2x00_rf(rt2x00dev, RF2525E)) { |
602 | static const u32 vals[] = { | 601 | static const u32 vals[] = { |
603 | 0x000008aa, 0x000008ae, 0x000008ae, 0x000008b2, | 602 | 0x000008aa, 0x000008ae, 0x000008ae, 0x000008b2, |
604 | 0x000008b2, 0x000008b6, 0x000008b6, 0x000008ba, | 603 | 0x000008b2, 0x000008b6, 0x000008b6, 0x000008ba, |
@@ -793,7 +792,7 @@ static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev) | |||
793 | rt2x00_set_field16(®, MAC_CSR1_HOST_READY, 1); | 792 | rt2x00_set_field16(®, MAC_CSR1_HOST_READY, 1); |
794 | rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg); | 793 | rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg); |
795 | 794 | ||
796 | if (rt2x00_rev(&rt2x00dev->chip) >= RT2570_VERSION_C) { | 795 | if (rt2x00_rev(rt2x00dev) >= RT2570_VERSION_C) { |
797 | rt2500usb_register_read(rt2x00dev, PHY_CSR2, ®); | 796 | rt2500usb_register_read(rt2x00dev, PHY_CSR2, ®); |
798 | rt2x00_set_field16(®, PHY_CSR2_LNA, 0); | 797 | rt2x00_set_field16(®, PHY_CSR2_LNA, 0); |
799 | } else { | 798 | } else { |
@@ -1411,19 +1410,18 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1411 | rt2x00_set_chip(rt2x00dev, RT2570, value, reg); | 1410 | rt2x00_set_chip(rt2x00dev, RT2570, value, reg); |
1412 | rt2x00_print_chip(rt2x00dev); | 1411 | rt2x00_print_chip(rt2x00dev); |
1413 | 1412 | ||
1414 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0x000ffff0, 0) || | 1413 | if (!rt2x00_check_rev(rt2x00dev, 0x000ffff0, 0) || |
1415 | rt2x00_check_rev(&rt2x00dev->chip, 0x0000000f, 0)) { | 1414 | rt2x00_check_rev(rt2x00dev, 0x0000000f, 0)) { |
1416 | |||
1417 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1415 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1418 | return -ENODEV; | 1416 | return -ENODEV; |
1419 | } | 1417 | } |
1420 | 1418 | ||
1421 | if (!rt2x00_rf(&rt2x00dev->chip, RF2522) && | 1419 | if (!rt2x00_rf(rt2x00dev, RF2522) && |
1422 | !rt2x00_rf(&rt2x00dev->chip, RF2523) && | 1420 | !rt2x00_rf(rt2x00dev, RF2523) && |
1423 | !rt2x00_rf(&rt2x00dev->chip, RF2524) && | 1421 | !rt2x00_rf(rt2x00dev, RF2524) && |
1424 | !rt2x00_rf(&rt2x00dev->chip, RF2525) && | 1422 | !rt2x00_rf(rt2x00dev, RF2525) && |
1425 | !rt2x00_rf(&rt2x00dev->chip, RF2525E) && | 1423 | !rt2x00_rf(rt2x00dev, RF2525E) && |
1426 | !rt2x00_rf(&rt2x00dev->chip, RF5222)) { | 1424 | !rt2x00_rf(rt2x00dev, RF5222)) { |
1427 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); | 1425 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); |
1428 | return -ENODEV; | 1426 | return -ENODEV; |
1429 | } | 1427 | } |
@@ -1667,22 +1665,22 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1667 | spec->supported_bands = SUPPORT_BAND_2GHZ; | 1665 | spec->supported_bands = SUPPORT_BAND_2GHZ; |
1668 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; | 1666 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; |
1669 | 1667 | ||
1670 | if (rt2x00_rf(&rt2x00dev->chip, RF2522)) { | 1668 | if (rt2x00_rf(rt2x00dev, RF2522)) { |
1671 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); | 1669 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); |
1672 | spec->channels = rf_vals_bg_2522; | 1670 | spec->channels = rf_vals_bg_2522; |
1673 | } else if (rt2x00_rf(&rt2x00dev->chip, RF2523)) { | 1671 | } else if (rt2x00_rf(rt2x00dev, RF2523)) { |
1674 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523); | 1672 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523); |
1675 | spec->channels = rf_vals_bg_2523; | 1673 | spec->channels = rf_vals_bg_2523; |
1676 | } else if (rt2x00_rf(&rt2x00dev->chip, RF2524)) { | 1674 | } else if (rt2x00_rf(rt2x00dev, RF2524)) { |
1677 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524); | 1675 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524); |
1678 | spec->channels = rf_vals_bg_2524; | 1676 | spec->channels = rf_vals_bg_2524; |
1679 | } else if (rt2x00_rf(&rt2x00dev->chip, RF2525)) { | 1677 | } else if (rt2x00_rf(rt2x00dev, RF2525)) { |
1680 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525); | 1678 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525); |
1681 | spec->channels = rf_vals_bg_2525; | 1679 | spec->channels = rf_vals_bg_2525; |
1682 | } else if (rt2x00_rf(&rt2x00dev->chip, RF2525E)) { | 1680 | } else if (rt2x00_rf(rt2x00dev, RF2525E)) { |
1683 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e); | 1681 | spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e); |
1684 | spec->channels = rf_vals_bg_2525e; | 1682 | spec->channels = rf_vals_bg_2525e; |
1685 | } else if (rt2x00_rf(&rt2x00dev->chip, RF5222)) { | 1683 | } else if (rt2x00_rf(rt2x00dev, RF5222)) { |
1686 | spec->supported_bands |= SUPPORT_BAND_5GHZ; | 1684 | spec->supported_bands |= SUPPORT_BAND_5GHZ; |
1687 | spec->num_channels = ARRAY_SIZE(rf_vals_5222); | 1685 | spec->num_channels = ARRAY_SIZE(rf_vals_5222); |
1688 | spec->channels = rf_vals_5222; | 1686 | spec->channels = rf_vals_5222; |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index a654551b7325..8ff7db853286 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -220,8 +220,7 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, | |||
220 | /* | 220 | /* |
221 | * RT2880 and RT3052 don't support MCU requests. | 221 | * RT2880 and RT3052 don't support MCU requests. |
222 | */ | 222 | */ |
223 | if (rt2x00_rt(&rt2x00dev->chip, RT2880) || | 223 | if (rt2x00_rt(rt2x00dev, RT2880) || rt2x00_rt(rt2x00dev, RT3052)) |
224 | rt2x00_rt(&rt2x00dev->chip, RT3052)) | ||
225 | return; | 224 | return; |
226 | 225 | ||
227 | mutex_lock(&rt2x00dev->csr_mutex); | 226 | mutex_lock(&rt2x00dev->csr_mutex); |
@@ -806,12 +805,12 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, | |||
806 | unsigned int tx_pin; | 805 | unsigned int tx_pin; |
807 | u8 bbp; | 806 | u8 bbp; |
808 | 807 | ||
809 | if ((rt2x00_rt(&rt2x00dev->chip, RT3070) || | 808 | if ((rt2x00_rt(rt2x00dev, RT3070) || |
810 | rt2x00_rt(&rt2x00dev->chip, RT3090)) && | 809 | rt2x00_rt(rt2x00dev, RT3090)) && |
811 | (rt2x00_rf(&rt2x00dev->chip, RF2020) || | 810 | (rt2x00_rf(rt2x00dev, RF2020) || |
812 | rt2x00_rf(&rt2x00dev->chip, RF3020) || | 811 | rt2x00_rf(rt2x00dev, RF3020) || |
813 | rt2x00_rf(&rt2x00dev->chip, RF3021) || | 812 | rt2x00_rf(rt2x00dev, RF3021) || |
814 | rt2x00_rf(&rt2x00dev->chip, RF3022))) | 813 | rt2x00_rf(rt2x00dev, RF3022))) |
815 | rt2800_config_channel_rt3x(rt2x00dev, conf, rf, info); | 814 | rt2800_config_channel_rt3x(rt2x00dev, conf, rf, info); |
816 | else | 815 | else |
817 | rt2800_config_channel_rt2x(rt2x00dev, conf, rf, info); | 816 | rt2800_config_channel_rt2x(rt2x00dev, conf, rf, info); |
@@ -878,7 +877,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, | |||
878 | rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf)); | 877 | rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf)); |
879 | rt2800_bbp_write(rt2x00dev, 3, bbp); | 878 | rt2800_bbp_write(rt2x00dev, 3, bbp); |
880 | 879 | ||
881 | if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) { | 880 | if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) { |
882 | if (conf_is_ht40(conf)) { | 881 | if (conf_is_ht40(conf)) { |
883 | rt2800_bbp_write(rt2x00dev, 69, 0x1a); | 882 | rt2800_bbp_write(rt2x00dev, 69, 0x1a); |
884 | rt2800_bbp_write(rt2x00dev, 70, 0x0a); | 883 | rt2800_bbp_write(rt2x00dev, 70, 0x0a); |
@@ -1041,7 +1040,7 @@ static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev) | |||
1041 | { | 1040 | { |
1042 | if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { | 1041 | if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { |
1043 | if (rt2x00_intf_is_usb(rt2x00dev) && | 1042 | if (rt2x00_intf_is_usb(rt2x00dev) && |
1044 | rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION) | 1043 | rt2x00_rev(rt2x00dev) == RT3070_VERSION) |
1045 | return 0x1c + (2 * rt2x00dev->lna_gain); | 1044 | return 0x1c + (2 * rt2x00dev->lna_gain); |
1046 | else | 1045 | else |
1047 | return 0x2e + rt2x00dev->lna_gain; | 1046 | return 0x2e + rt2x00dev->lna_gain; |
@@ -1072,7 +1071,7 @@ EXPORT_SYMBOL_GPL(rt2800_reset_tuner); | |||
1072 | void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, | 1071 | void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, |
1073 | const u32 count) | 1072 | const u32 count) |
1074 | { | 1073 | { |
1075 | if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) | 1074 | if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) |
1076 | return; | 1075 | return; |
1077 | 1076 | ||
1078 | /* | 1077 | /* |
@@ -1158,7 +1157,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1158 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | 1157 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); |
1159 | 1158 | ||
1160 | if (rt2x00_intf_is_usb(rt2x00dev) && | 1159 | if (rt2x00_intf_is_usb(rt2x00dev) && |
1161 | rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION) { | 1160 | rt2x00_rev(rt2x00dev) == RT3070_VERSION) { |
1162 | rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); | 1161 | rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); |
1163 | rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); | 1162 | rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); |
1164 | rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); | 1163 | rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); |
@@ -1185,8 +1184,8 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1185 | 1184 | ||
1186 | rt2800_register_read(rt2x00dev, MAX_LEN_CFG, ®); | 1185 | rt2800_register_read(rt2x00dev, MAX_LEN_CFG, ®); |
1187 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE); | 1186 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE); |
1188 | if (rt2x00_rev(&rt2x00dev->chip) >= RT2880E_VERSION && | 1187 | if (rt2x00_rev(rt2x00dev) >= RT2880E_VERSION && |
1189 | rt2x00_rev(&rt2x00dev->chip) < RT3070_VERSION) | 1188 | rt2x00_rev(rt2x00dev) < RT3070_VERSION) |
1190 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 2); | 1189 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 2); |
1191 | else | 1190 | else |
1192 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 1); | 1191 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 1); |
@@ -1465,22 +1464,22 @@ int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
1465 | rt2800_bbp_write(rt2x00dev, 103, 0x00); | 1464 | rt2800_bbp_write(rt2x00dev, 103, 0x00); |
1466 | rt2800_bbp_write(rt2x00dev, 105, 0x05); | 1465 | rt2800_bbp_write(rt2x00dev, 105, 0x05); |
1467 | 1466 | ||
1468 | if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) { | 1467 | if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) { |
1469 | rt2800_bbp_write(rt2x00dev, 69, 0x16); | 1468 | rt2800_bbp_write(rt2x00dev, 69, 0x16); |
1470 | rt2800_bbp_write(rt2x00dev, 73, 0x12); | 1469 | rt2800_bbp_write(rt2x00dev, 73, 0x12); |
1471 | } | 1470 | } |
1472 | 1471 | ||
1473 | if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION) | 1472 | if (rt2x00_rev(rt2x00dev) > RT2860D_VERSION) |
1474 | rt2800_bbp_write(rt2x00dev, 84, 0x19); | 1473 | rt2800_bbp_write(rt2x00dev, 84, 0x19); |
1475 | 1474 | ||
1476 | if (rt2x00_intf_is_usb(rt2x00dev) && | 1475 | if (rt2x00_intf_is_usb(rt2x00dev) && |
1477 | rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION) { | 1476 | rt2x00_rev(rt2x00dev) == RT3070_VERSION) { |
1478 | rt2800_bbp_write(rt2x00dev, 70, 0x0a); | 1477 | rt2800_bbp_write(rt2x00dev, 70, 0x0a); |
1479 | rt2800_bbp_write(rt2x00dev, 84, 0x99); | 1478 | rt2800_bbp_write(rt2x00dev, 84, 0x99); |
1480 | rt2800_bbp_write(rt2x00dev, 105, 0x05); | 1479 | rt2800_bbp_write(rt2x00dev, 105, 0x05); |
1481 | } | 1480 | } |
1482 | 1481 | ||
1483 | if (rt2x00_rt(&rt2x00dev->chip, RT3052)) { | 1482 | if (rt2x00_rt(rt2x00dev, RT3052)) { |
1484 | rt2800_bbp_write(rt2x00dev, 31, 0x08); | 1483 | rt2800_bbp_write(rt2x00dev, 31, 0x08); |
1485 | rt2800_bbp_write(rt2x00dev, 78, 0x0e); | 1484 | rt2800_bbp_write(rt2x00dev, 78, 0x0e); |
1486 | rt2800_bbp_write(rt2x00dev, 80, 0x08); | 1485 | rt2800_bbp_write(rt2x00dev, 80, 0x08); |
@@ -1566,13 +1565,13 @@ int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
1566 | u8 bbp; | 1565 | u8 bbp; |
1567 | 1566 | ||
1568 | if (rt2x00_intf_is_usb(rt2x00dev) && | 1567 | if (rt2x00_intf_is_usb(rt2x00dev) && |
1569 | rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION) | 1568 | rt2x00_rev(rt2x00dev) != RT3070_VERSION) |
1570 | return 0; | 1569 | return 0; |
1571 | 1570 | ||
1572 | if (rt2x00_intf_is_pci(rt2x00dev)) { | 1571 | if (rt2x00_intf_is_pci(rt2x00dev)) { |
1573 | if (!rt2x00_rf(&rt2x00dev->chip, RF3020) && | 1572 | if (!rt2x00_rf(rt2x00dev, RF3020) && |
1574 | !rt2x00_rf(&rt2x00dev->chip, RF3021) && | 1573 | !rt2x00_rf(rt2x00dev, RF3021) && |
1575 | !rt2x00_rf(&rt2x00dev->chip, RF3022)) | 1574 | !rt2x00_rf(rt2x00dev, RF3022)) |
1576 | return 0; | 1575 | return 0; |
1577 | } | 1576 | } |
1578 | 1577 | ||
@@ -1737,7 +1736,7 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1737 | rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820); | 1736 | rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820); |
1738 | rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); | 1737 | rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); |
1739 | EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); | 1738 | EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); |
1740 | } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) { | 1739 | } else if (rt2x00_rev(rt2x00dev) < RT2883_VERSION) { |
1741 | /* | 1740 | /* |
1742 | * There is a max of 2 RX streams for RT28x0 series | 1741 | * There is a max of 2 RX streams for RT28x0 series |
1743 | */ | 1742 | */ |
@@ -1839,17 +1838,15 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1839 | rt2x00_set_chip_rf(rt2x00dev, value, reg); | 1838 | rt2x00_set_chip_rf(rt2x00dev, value, reg); |
1840 | 1839 | ||
1841 | if (rt2x00_intf_is_usb(rt2x00dev)) { | 1840 | if (rt2x00_intf_is_usb(rt2x00dev)) { |
1842 | struct rt2x00_chip *chip = &rt2x00dev->chip; | ||
1843 | |||
1844 | /* | 1841 | /* |
1845 | * The check for rt2860 is not a typo, some rt2870 hardware | 1842 | * The check for rt2860 is not a typo, some rt2870 hardware |
1846 | * identifies itself as rt2860 in the CSR register. | 1843 | * identifies itself as rt2860 in the CSR register. |
1847 | */ | 1844 | */ |
1848 | if (rt2x00_check_rev(chip, 0xfff00000, 0x28600000) || | 1845 | if (rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28600000) || |
1849 | rt2x00_check_rev(chip, 0xfff00000, 0x28700000) || | 1846 | rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28700000) || |
1850 | rt2x00_check_rev(chip, 0xfff00000, 0x28800000)) { | 1847 | rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28800000)) { |
1851 | rt2x00_set_chip_rt(rt2x00dev, RT2870); | 1848 | rt2x00_set_chip_rt(rt2x00dev, RT2870); |
1852 | } else if (rt2x00_check_rev(chip, 0xffff0000, 0x30700000)) { | 1849 | } else if (rt2x00_check_rev(rt2x00dev, 0xffff0000, 0x30700000)) { |
1853 | rt2x00_set_chip_rt(rt2x00dev, RT3070); | 1850 | rt2x00_set_chip_rt(rt2x00dev, RT3070); |
1854 | } else { | 1851 | } else { |
1855 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1852 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
@@ -1858,14 +1855,14 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1858 | } | 1855 | } |
1859 | rt2x00_print_chip(rt2x00dev); | 1856 | rt2x00_print_chip(rt2x00dev); |
1860 | 1857 | ||
1861 | if (!rt2x00_rf(&rt2x00dev->chip, RF2820) && | 1858 | if (!rt2x00_rf(rt2x00dev, RF2820) && |
1862 | !rt2x00_rf(&rt2x00dev->chip, RF2850) && | 1859 | !rt2x00_rf(rt2x00dev, RF2850) && |
1863 | !rt2x00_rf(&rt2x00dev->chip, RF2720) && | 1860 | !rt2x00_rf(rt2x00dev, RF2720) && |
1864 | !rt2x00_rf(&rt2x00dev->chip, RF2750) && | 1861 | !rt2x00_rf(rt2x00dev, RF2750) && |
1865 | !rt2x00_rf(&rt2x00dev->chip, RF3020) && | 1862 | !rt2x00_rf(rt2x00dev, RF3020) && |
1866 | !rt2x00_rf(&rt2x00dev->chip, RF2020) && | 1863 | !rt2x00_rf(rt2x00dev, RF2020) && |
1867 | !rt2x00_rf(&rt2x00dev->chip, RF3021) && | 1864 | !rt2x00_rf(rt2x00dev, RF3021) && |
1868 | !rt2x00_rf(&rt2x00dev->chip, RF3022)) { | 1865 | !rt2x00_rf(rt2x00dev, RF3022)) { |
1869 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); | 1866 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); |
1870 | return -ENODEV; | 1867 | return -ENODEV; |
1871 | } | 1868 | } |
@@ -2013,7 +2010,6 @@ static const struct rf_channel rf_vals_302x[] = { | |||
2013 | 2010 | ||
2014 | int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | 2011 | int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) |
2015 | { | 2012 | { |
2016 | struct rt2x00_chip *chip = &rt2x00dev->chip; | ||
2017 | struct hw_mode_spec *spec = &rt2x00dev->spec; | 2013 | struct hw_mode_spec *spec = &rt2x00dev->spec; |
2018 | struct channel_info *info; | 2014 | struct channel_info *info; |
2019 | char *tx_power1; | 2015 | char *tx_power1; |
@@ -2049,19 +2045,19 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2049 | spec->supported_bands = SUPPORT_BAND_2GHZ; | 2045 | spec->supported_bands = SUPPORT_BAND_2GHZ; |
2050 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; | 2046 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; |
2051 | 2047 | ||
2052 | if (rt2x00_rf(chip, RF2820) || | 2048 | if (rt2x00_rf(rt2x00dev, RF2820) || |
2053 | rt2x00_rf(chip, RF2720) || | 2049 | rt2x00_rf(rt2x00dev, RF2720) || |
2054 | (rt2x00_intf_is_pci(rt2x00dev) && rt2x00_rf(chip, RF3052))) { | 2050 | (rt2x00_intf_is_pci(rt2x00dev) && rt2x00_rf(rt2x00dev, RF3052))) { |
2055 | spec->num_channels = 14; | 2051 | spec->num_channels = 14; |
2056 | spec->channels = rf_vals; | 2052 | spec->channels = rf_vals; |
2057 | } else if (rt2x00_rf(chip, RF2850) || rt2x00_rf(chip, RF2750)) { | 2053 | } else if (rt2x00_rf(rt2x00dev, RF2850) || rt2x00_rf(rt2x00dev, RF2750)) { |
2058 | spec->supported_bands |= SUPPORT_BAND_5GHZ; | 2054 | spec->supported_bands |= SUPPORT_BAND_5GHZ; |
2059 | spec->num_channels = ARRAY_SIZE(rf_vals); | 2055 | spec->num_channels = ARRAY_SIZE(rf_vals); |
2060 | spec->channels = rf_vals; | 2056 | spec->channels = rf_vals; |
2061 | } else if (rt2x00_rf(chip, RF3020) || | 2057 | } else if (rt2x00_rf(rt2x00dev, RF3020) || |
2062 | rt2x00_rf(chip, RF2020) || | 2058 | rt2x00_rf(rt2x00dev, RF2020) || |
2063 | rt2x00_rf(chip, RF3021) || | 2059 | rt2x00_rf(rt2x00dev, RF3021) || |
2064 | rt2x00_rf(chip, RF3022)) { | 2060 | rt2x00_rf(rt2x00dev, RF3022)) { |
2065 | spec->num_channels = ARRAY_SIZE(rf_vals_302x); | 2061 | spec->num_channels = ARRAY_SIZE(rf_vals_302x); |
2066 | spec->channels = rf_vals_302x; | 2062 | spec->channels = rf_vals_302x; |
2067 | } | 2063 | } |
@@ -2069,7 +2065,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2069 | /* | 2065 | /* |
2070 | * Initialize HT information. | 2066 | * Initialize HT information. |
2071 | */ | 2067 | */ |
2072 | if (!rt2x00_rf(chip, RF2020)) | 2068 | if (!rt2x00_rf(rt2x00dev, RF2020)) |
2073 | spec->ht.ht_supported = true; | 2069 | spec->ht.ht_supported = true; |
2074 | else | 2070 | else |
2075 | spec->ht.ht_supported = false; | 2071 | spec->ht.ht_supported = false; |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 2f9deddaf75b..b93eabb4fbe1 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -1121,8 +1121,7 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1121 | /* | 1121 | /* |
1122 | * This device requires firmware. | 1122 | * This device requires firmware. |
1123 | */ | 1123 | */ |
1124 | if (!rt2x00_rt(&rt2x00dev->chip, RT2880) && | 1124 | if (!rt2x00_rt(rt2x00dev, RT2880) && !rt2x00_rt(rt2x00dev, RT3052)) |
1125 | !rt2x00_rt(&rt2x00dev->chip, RT3052)) | ||
1126 | __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); | 1125 | __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); |
1127 | __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); | 1126 | __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); |
1128 | __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); | 1127 | __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 40295b454ff6..411655ecaf3a 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -92,7 +92,7 @@ static bool rt2800usb_check_crc(const u8 *data, const size_t len) | |||
92 | static int rt2800usb_check_firmware(struct rt2x00_dev *rt2x00dev, | 92 | static int rt2800usb_check_firmware(struct rt2x00_dev *rt2x00dev, |
93 | const u8 *data, const size_t len) | 93 | const u8 *data, const size_t len) |
94 | { | 94 | { |
95 | u16 chipset = (rt2x00_rev(&rt2x00dev->chip) >> 16) & 0xffff; | 95 | u16 chipset = (rt2x00_rev(rt2x00dev) >> 16) & 0xffff; |
96 | size_t offset = 0; | 96 | size_t offset = 0; |
97 | 97 | ||
98 | /* | 98 | /* |
@@ -138,7 +138,7 @@ static int rt2800usb_load_firmware(struct rt2x00_dev *rt2x00dev, | |||
138 | u32 reg; | 138 | u32 reg; |
139 | u32 offset; | 139 | u32 offset; |
140 | u32 length; | 140 | u32 length; |
141 | u16 chipset = (rt2x00_rev(&rt2x00dev->chip) >> 16) & 0xffff; | 141 | u16 chipset = (rt2x00_rev(rt2x00dev) >> 16) & 0xffff; |
142 | 142 | ||
143 | /* | 143 | /* |
144 | * Check which section of the firmware we need. | 144 | * Check which section of the firmware we need. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 194dae01d0c3..a664a999b2b0 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -937,25 +937,25 @@ static inline void rt2x00_print_chip(struct rt2x00_dev *rt2x00dev) | |||
937 | rt2x00dev->chip.rt, rt2x00dev->chip.rf, rt2x00dev->chip.rev); | 937 | rt2x00dev->chip.rt, rt2x00dev->chip.rf, rt2x00dev->chip.rev); |
938 | } | 938 | } |
939 | 939 | ||
940 | static inline char rt2x00_rt(const struct rt2x00_chip *chipset, const u16 chip) | 940 | static inline char rt2x00_rt(struct rt2x00_dev *rt2x00dev, const u16 rt) |
941 | { | 941 | { |
942 | return (chipset->rt == chip); | 942 | return (rt2x00dev->chip.rt == rt); |
943 | } | 943 | } |
944 | 944 | ||
945 | static inline char rt2x00_rf(const struct rt2x00_chip *chipset, const u16 chip) | 945 | static inline char rt2x00_rf(struct rt2x00_dev *rt2x00dev, const u16 rf) |
946 | { | 946 | { |
947 | return (chipset->rf == chip); | 947 | return (rt2x00dev->chip.rf == rf); |
948 | } | 948 | } |
949 | 949 | ||
950 | static inline u32 rt2x00_rev(const struct rt2x00_chip *chipset) | 950 | static inline u32 rt2x00_rev(struct rt2x00_dev *rt2x00dev) |
951 | { | 951 | { |
952 | return chipset->rev; | 952 | return rt2x00dev->chip.rev; |
953 | } | 953 | } |
954 | 954 | ||
955 | static inline bool rt2x00_check_rev(const struct rt2x00_chip *chipset, | 955 | static inline bool rt2x00_check_rev(struct rt2x00_dev *rt2x00dev, |
956 | const u32 mask, const u32 rev) | 956 | const u32 mask, const u32 rev) |
957 | { | 957 | { |
958 | return ((chipset->rev & mask) == rev); | 958 | return ((rt2x00dev->chip.rev & mask) == rev); |
959 | } | 959 | } |
960 | 960 | ||
961 | static inline void rt2x00_set_chip_intf(struct rt2x00_dev *rt2x00dev, | 961 | static inline void rt2x00_set_chip_intf(struct rt2x00_dev *rt2x00dev, |
@@ -964,20 +964,20 @@ static inline void rt2x00_set_chip_intf(struct rt2x00_dev *rt2x00dev, | |||
964 | rt2x00dev->chip.intf = intf; | 964 | rt2x00dev->chip.intf = intf; |
965 | } | 965 | } |
966 | 966 | ||
967 | static inline bool rt2x00_intf(const struct rt2x00_chip *chipset, | 967 | static inline bool rt2x00_intf(struct rt2x00_dev *rt2x00dev, |
968 | enum rt2x00_chip_intf intf) | 968 | enum rt2x00_chip_intf intf) |
969 | { | 969 | { |
970 | return (chipset->intf == intf); | 970 | return (rt2x00dev->chip.intf == intf); |
971 | } | 971 | } |
972 | 972 | ||
973 | static inline bool rt2x00_intf_is_pci(struct rt2x00_dev *rt2x00dev) | 973 | static inline bool rt2x00_intf_is_pci(struct rt2x00_dev *rt2x00dev) |
974 | { | 974 | { |
975 | return rt2x00_intf(&rt2x00dev->chip, RT2X00_CHIP_INTF_PCI); | 975 | return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI); |
976 | } | 976 | } |
977 | 977 | ||
978 | static inline bool rt2x00_intf_is_usb(struct rt2x00_dev *rt2x00dev) | 978 | static inline bool rt2x00_intf_is_usb(struct rt2x00_dev *rt2x00dev) |
979 | { | 979 | { |
980 | return rt2x00_intf(&rt2x00dev->chip, RT2X00_CHIP_INTF_USB); | 980 | return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_USB); |
981 | } | 981 | } |
982 | 982 | ||
983 | /** | 983 | /** |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 0ca589306d71..c353b497a65d 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); |
@@ -2302,10 +2298,10 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2302 | rt2x00_set_chip_rf(rt2x00dev, value, reg); | 2298 | rt2x00_set_chip_rf(rt2x00dev, value, reg); |
2303 | rt2x00_print_chip(rt2x00dev); | 2299 | rt2x00_print_chip(rt2x00dev); |
2304 | 2300 | ||
2305 | if (!rt2x00_rf(&rt2x00dev->chip, RF5225) && | 2301 | if (!rt2x00_rf(rt2x00dev, RF5225) && |
2306 | !rt2x00_rf(&rt2x00dev->chip, RF5325) && | 2302 | !rt2x00_rf(rt2x00dev, RF5325) && |
2307 | !rt2x00_rf(&rt2x00dev->chip, RF2527) && | 2303 | !rt2x00_rf(rt2x00dev, RF2527) && |
2308 | !rt2x00_rf(&rt2x00dev->chip, RF2529)) { | 2304 | !rt2x00_rf(rt2x00dev, RF2529)) { |
2309 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); | 2305 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); |
2310 | return -ENODEV; | 2306 | return -ENODEV; |
2311 | } | 2307 | } |
@@ -2360,7 +2356,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2360 | * the antenna settings should be gathered from the NIC | 2356 | * the antenna settings should be gathered from the NIC |
2361 | * eeprom word. | 2357 | * eeprom word. |
2362 | */ | 2358 | */ |
2363 | if (rt2x00_rf(&rt2x00dev->chip, RF2529) && | 2359 | if (rt2x00_rf(rt2x00dev, RF2529) && |
2364 | !test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) { | 2360 | !test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) { |
2365 | rt2x00dev->default_ant.rx = | 2361 | rt2x00dev->default_ant.rx = |
2366 | ANTENNA_A + rt2x00_get_field16(eeprom, EEPROM_NIC_RX_FIXED); | 2362 | ANTENNA_A + rt2x00_get_field16(eeprom, EEPROM_NIC_RX_FIXED); |
@@ -2571,8 +2567,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2571 | spec->channels = rf_vals_seq; | 2567 | spec->channels = rf_vals_seq; |
2572 | } | 2568 | } |
2573 | 2569 | ||
2574 | if (rt2x00_rf(&rt2x00dev->chip, RF5225) || | 2570 | if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF5325)) { |
2575 | rt2x00_rf(&rt2x00dev->chip, RF5325)) { | ||
2576 | spec->supported_bands |= SUPPORT_BAND_5GHZ; | 2571 | spec->supported_bands |= SUPPORT_BAND_5GHZ; |
2577 | spec->num_channels = ARRAY_SIZE(rf_vals_seq); | 2572 | spec->num_channels = ARRAY_SIZE(rf_vals_seq); |
2578 | } | 2573 | } |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 6ce88d3c3b65..a02691294395 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -136,8 +136,8 @@ static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev, | |||
136 | * all others contain 20 bits. | 136 | * all others contain 20 bits. |
137 | */ | 137 | */ |
138 | rt2x00_set_field32(®, PHY_CSR4_NUMBER_OF_BITS, | 138 | rt2x00_set_field32(®, PHY_CSR4_NUMBER_OF_BITS, |
139 | 20 + (rt2x00_rf(&rt2x00dev->chip, RF5225) || | 139 | 20 + (rt2x00_rf(rt2x00dev, RF5225) || |
140 | rt2x00_rf(&rt2x00dev->chip, RF2527))); | 140 | rt2x00_rf(rt2x00dev, RF2527))); |
141 | rt2x00_set_field32(®, PHY_CSR4_IF_SELECT, 0); | 141 | rt2x00_set_field32(®, PHY_CSR4_IF_SELECT, 0); |
142 | rt2x00_set_field32(®, PHY_CSR4_BUSY, 1); | 142 | rt2x00_set_field32(®, PHY_CSR4_BUSY, 1); |
143 | 143 | ||
@@ -741,11 +741,9 @@ static void rt73usb_config_ant(struct rt2x00_dev *rt2x00dev, | |||
741 | 741 | ||
742 | rt2x00usb_register_write(rt2x00dev, PHY_CSR0, reg); | 742 | rt2x00usb_register_write(rt2x00dev, PHY_CSR0, reg); |
743 | 743 | ||
744 | if (rt2x00_rf(&rt2x00dev->chip, RF5226) || | 744 | if (rt2x00_rf(rt2x00dev, RF5226) || rt2x00_rf(rt2x00dev, RF5225)) |
745 | rt2x00_rf(&rt2x00dev->chip, RF5225)) | ||
746 | rt73usb_config_antenna_5x(rt2x00dev, ant); | 745 | rt73usb_config_antenna_5x(rt2x00dev, ant); |
747 | else if (rt2x00_rf(&rt2x00dev->chip, RF2528) || | 746 | else if (rt2x00_rf(rt2x00dev, RF2528) || rt2x00_rf(rt2x00dev, RF2527)) |
748 | rt2x00_rf(&rt2x00dev->chip, RF2527)) | ||
749 | rt73usb_config_antenna_2x(rt2x00dev, ant); | 747 | rt73usb_config_antenna_2x(rt2x00dev, ant); |
750 | } | 748 | } |
751 | 749 | ||
@@ -779,8 +777,7 @@ static void rt73usb_config_channel(struct rt2x00_dev *rt2x00dev, | |||
779 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); | 777 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); |
780 | rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset); | 778 | rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset); |
781 | 779 | ||
782 | smart = !(rt2x00_rf(&rt2x00dev->chip, RF5225) || | 780 | smart = !(rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527)); |
783 | rt2x00_rf(&rt2x00dev->chip, RF2527)); | ||
784 | 781 | ||
785 | rt73usb_bbp_read(rt2x00dev, 3, &r3); | 782 | rt73usb_bbp_read(rt2x00dev, 3, &r3); |
786 | rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart); | 783 | rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart); |
@@ -1210,8 +1207,7 @@ static int rt73usb_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1210 | rt2x00usb_register_write(rt2x00dev, SEC_CSR5, 0x00000000); | 1207 | rt2x00usb_register_write(rt2x00dev, SEC_CSR5, 0x00000000); |
1211 | 1208 | ||
1212 | reg = 0x000023b0; | 1209 | reg = 0x000023b0; |
1213 | if (rt2x00_rf(&rt2x00dev->chip, RF5225) || | 1210 | if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527)) |
1214 | rt2x00_rf(&rt2x00dev->chip, RF2527)) | ||
1215 | rt2x00_set_field32(®, PHY_CSR1_RF_RPI, 1); | 1211 | rt2x00_set_field32(®, PHY_CSR1_RF_RPI, 1); |
1216 | rt2x00usb_register_write(rt2x00dev, PHY_CSR1, reg); | 1212 | rt2x00usb_register_write(rt2x00dev, PHY_CSR1, reg); |
1217 | 1213 | ||
@@ -1827,16 +1823,16 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1827 | rt2x00_set_chip(rt2x00dev, RT2571, value, reg); | 1823 | rt2x00_set_chip(rt2x00dev, RT2571, value, reg); |
1828 | rt2x00_print_chip(rt2x00dev); | 1824 | rt2x00_print_chip(rt2x00dev); |
1829 | 1825 | ||
1830 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0x000ffff0, 0x25730) || | 1826 | if (!rt2x00_check_rev(rt2x00dev, 0x000ffff0, 0x25730) || |
1831 | rt2x00_check_rev(&rt2x00dev->chip, 0x0000000f, 0)) { | 1827 | rt2x00_check_rev(rt2x00dev, 0x0000000f, 0)) { |
1832 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1828 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1833 | return -ENODEV; | 1829 | return -ENODEV; |
1834 | } | 1830 | } |
1835 | 1831 | ||
1836 | if (!rt2x00_rf(&rt2x00dev->chip, RF5226) && | 1832 | if (!rt2x00_rf(rt2x00dev, RF5226) && |
1837 | !rt2x00_rf(&rt2x00dev->chip, RF2528) && | 1833 | !rt2x00_rf(rt2x00dev, RF2528) && |
1838 | !rt2x00_rf(&rt2x00dev->chip, RF5225) && | 1834 | !rt2x00_rf(rt2x00dev, RF5225) && |
1839 | !rt2x00_rf(&rt2x00dev->chip, RF2527)) { | 1835 | !rt2x00_rf(rt2x00dev, RF2527)) { |
1840 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); | 1836 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); |
1841 | return -ENODEV; | 1837 | return -ENODEV; |
1842 | } | 1838 | } |
@@ -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; |