rt2x00: rework RT chipset and revision determination for PCI an SOC devices.

The recent rt2800 devices are no longer really identified by their PCI
ID's, but rather by the contents of their CSR0 register. Also for the
other chipsets is the contents of this CSR0 register important.
Change the chipset determination logic to be more aligned with the rt2800
model.
Preparation for the support of rt3070 / rt3090 based 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>
This commit is contained in:
Gertjan van Wingerde
2010-02-13 20:55:49 +01:00
committed by John W. Linville
parent 714fa66363
commit 49e721ec6c
14 changed files with 112 additions and 118 deletions

View File

@@ -1131,16 +1131,18 @@ dynamic_cca_tune:
*/
static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev)
{
u16 chip;
char *fw_name;
switch (rt2x00dev->chip.rt) {
case RT2561:
pci_read_config_word(to_pci_dev(rt2x00dev->dev), PCI_DEVICE_ID, &chip);
switch (chip) {
case RT2561_PCI_ID:
fw_name = FIRMWARE_RT2561;
break;
case RT2561s:
case RT2561s_PCI_ID:
fw_name = FIRMWARE_RT2561s;
break;
case RT2661:
case RT2661_PCI_ID:
fw_name = FIRMWARE_RT2661;
break;
default:
@@ -2282,7 +2284,6 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
{
u32 reg;
u16 chip;
u16 value;
u16 eeprom;
@@ -2291,17 +2292,13 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
*/
rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
/*
* Identify RT chipset.
*/
pci_read_config_word(to_pci_dev(rt2x00dev->dev), PCI_DEVICE_ID, &chip);
/*
* Identify RF chipset.
*/
value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg);
rt2x00_set_chip(rt2x00dev, chip, value, reg);
rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET),
value, rt2x00_get_field32(reg, MAC_CSR0_REVISION));
if (!rt2x00_rf(rt2x00dev, RF5225) &&
!rt2x00_rf(rt2x00dev, RF5325) &&