diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-11-08 14:38:54 +0100 |
---|---|---|
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) | |
download | kernel-crypto-7ab71325cf0940099c376799aca6de7bc86ad2d0.tar.gz kernel-crypto-7ab71325cf0940099c376799aca6de7bc86ad2d0.tar.xz kernel-crypto-7ab71325cf0940099c376799aca6de7bc86ad2d0.zip |
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 3168ad4437a..080947cc5d6 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, /* * Device probe functions. */ -static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) +static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) { u16 word; u8 *mac; u8 default_lna_gain; - rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE); - /* * Start validation of the data that has been read. */ @@ -691,7 +689,7 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) { /* - * There is a max of 2 RX streams for RT2870 series + * There is a max of 2 RX streams for RT28x0 series */ if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2) rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2); @@ -770,6 +768,13 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) return 0; } +static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) +{ + rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE); + + return rt2800_validate_eeprom(rt2x00dev); +} + static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev) { u32 reg; @@ -786,18 +791,23 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev) */ value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); rt2800_register_read(rt2x00dev, MAC_CSR0, ®); - rt2x00_set_chip(rt2x00dev, RT2870, value, reg); - /* - * The check for rt2860 is not a typo, some rt2870 hardware - * identifies itself as rt2860 in the CSR register. - */ - if (!rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) && - !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) && - !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000) && - !rt2x00_check_rev(&rt2x00dev->chip, 0xffff0000, 0x30700000)) { - ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); - return -ENODEV; + if (rt2x00_intf_is_usb(rt2x00dev)) { + struct rt2x00_chip *chip = &rt2x00dev->chip; + + rt2x00_set_chip(rt2x00dev, RT2870, value, reg); + + /* + * The check for rt2860 is not a typo, some rt2870 hardware + * identifies itself as rt2860 in the CSR register. + */ + if (!rt2x00_check_rev(chip, 0xfff00000, 0x28600000) && + !rt2x00_check_rev(chip, 0xfff00000, 0x28700000) && + !rt2x00_check_rev(chip, 0xfff00000, 0x28800000) && + !rt2x00_check_rev(chip, 0xffff0000, 0x30700000)) { + ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); + return -ENODEV; + } } if (!rt2x00_rf(&rt2x00dev->chip, RF2820) && |