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 /drivers/net/wireless/rt2x00/rt2500usb.c | |
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>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 38 |
1 files changed, 18 insertions, 20 deletions
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; |