diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-11-08 08:38:54 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-11 17:09:13 -0500 |
commit | 7ab71325cf0940099c376799aca6de7bc86ad2d0 (patch) | |
tree | fd6f8316362e19f87a322d19612fce296c779a28 /drivers/net/wireless/rt2x00/rt2800usb.c | |
parent | 863cc978a73bc07f1de0e9a9bd9889bed6e618da (diff) |
rt2800: prepare for unification of EEPROM support code
* Factor out common code from rt2800[pci,usb]_validate_eeprom()
to rt2800_validate_eeprom().
* Fix interface specific comment in rt2800[pci,usb]_validate_eeprom().
* Enclose interface specific code in rt2800[pci,usb]_init_eeprom()
with rt2x00_intf_is_[pci,usb]() checks.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 3168ad4437a4..080947cc5d6b 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -665,14 +665,12 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
665 | /* | 665 | /* |
666 | * Device probe functions. | 666 | * Device probe functions. |
667 | */ | 667 | */ |
668 | static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) | 668 | static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) |
669 | { | 669 | { |
670 | u16 word; | 670 | u16 word; |
671 | u8 *mac; | 671 | u8 *mac; |
672 | u8 default_lna_gain; | 672 | u8 default_lna_gain; |
673 | 673 | ||
674 | rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE); | ||
675 | |||
676 | /* | 674 | /* |
677 | * Start validation of the data that has been read. | 675 | * Start validation of the data that has been read. |
678 | */ | 676 | */ |
@@ -691,7 +689,7 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
691 | EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); | 689 | EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); |
692 | } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) { | 690 | } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) { |
693 | /* | 691 | /* |
694 | * There is a max of 2 RX streams for RT2870 series | 692 | * There is a max of 2 RX streams for RT28x0 series |
695 | */ | 693 | */ |
696 | if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2) | 694 | if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2) |
697 | rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2); | 695 | rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2); |
@@ -770,6 +768,13 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
770 | return 0; | 768 | return 0; |
771 | } | 769 | } |
772 | 770 | ||
771 | static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) | ||
772 | { | ||
773 | rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE); | ||
774 | |||
775 | return rt2800_validate_eeprom(rt2x00dev); | ||
776 | } | ||
777 | |||
773 | static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | 778 | static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev) |
774 | { | 779 | { |
775 | u32 reg; | 780 | u32 reg; |
@@ -786,18 +791,23 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
786 | */ | 791 | */ |
787 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); | 792 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); |
788 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); | 793 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); |
789 | rt2x00_set_chip(rt2x00dev, RT2870, value, reg); | ||
790 | 794 | ||
791 | /* | 795 | if (rt2x00_intf_is_usb(rt2x00dev)) { |
792 | * The check for rt2860 is not a typo, some rt2870 hardware | 796 | struct rt2x00_chip *chip = &rt2x00dev->chip; |
793 | * identifies itself as rt2860 in the CSR register. | 797 | |
794 | */ | 798 | rt2x00_set_chip(rt2x00dev, RT2870, value, reg); |
795 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) && | 799 | |
796 | !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) && | 800 | /* |
797 | !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000) && | 801 | * The check for rt2860 is not a typo, some rt2870 hardware |
798 | !rt2x00_check_rev(&rt2x00dev->chip, 0xffff0000, 0x30700000)) { | 802 | * identifies itself as rt2860 in the CSR register. |
799 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 803 | */ |
800 | return -ENODEV; | 804 | if (!rt2x00_check_rev(chip, 0xfff00000, 0x28600000) && |
805 | !rt2x00_check_rev(chip, 0xfff00000, 0x28700000) && | ||
806 | !rt2x00_check_rev(chip, 0xfff00000, 0x28800000) && | ||
807 | !rt2x00_check_rev(chip, 0xffff0000, 0x30700000)) { | ||
808 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | ||
809 | return -ENODEV; | ||
810 | } | ||
801 | } | 811 | } |
802 | 812 | ||
803 | if (!rt2x00_rf(&rt2x00dev->chip, RF2820) && | 813 | if (!rt2x00_rf(&rt2x00dev->chip, RF2820) && |