diff options
author | Gertjan van Wingerde <gwingerde@gmail.com> | 2010-02-13 14:55:48 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-02-15 16:14:10 -0500 |
commit | 714fa6636331d33c6045efe394f36c964a6c14ee (patch) | |
tree | dcdb5f14cd2275cec4dac094327d3b3524e201de /drivers/net/wireless/rt2x00/rt2800lib.c | |
parent | cea90e55969ff70b970d64d564076a5469331527 (diff) |
rt2x00: Reorganize RT chipset setting for PCI/SOC devices.
Don't set the RT chipset for a device from within the generic PCI/SOC code,
but rather from the individual drivers, so that individual drivers have
more control over what RT chipset is set.
Preparation for chip handling updates 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/rt2800lib.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index e78df53b9515..7340e487df6b 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -40,6 +40,9 @@ | |||
40 | #if defined(CONFIG_RT2X00_LIB_USB) || defined(CONFIG_RT2X00_LIB_USB_MODULE) | 40 | #if defined(CONFIG_RT2X00_LIB_USB) || defined(CONFIG_RT2X00_LIB_USB_MODULE) |
41 | #include "rt2x00usb.h" | 41 | #include "rt2x00usb.h" |
42 | #endif | 42 | #endif |
43 | #if defined(CONFIG_RT2X00_LIB_PCI) || defined(CONFIG_RT2X00_LIB_PCI_MODULE) | ||
44 | #include "rt2x00pci.h" | ||
45 | #endif | ||
43 | #include "rt2800lib.h" | 46 | #include "rt2800lib.h" |
44 | #include "rt2800.h" | 47 | #include "rt2800.h" |
45 | #include "rt2800usb.h" | 48 | #include "rt2800usb.h" |
@@ -1839,6 +1842,7 @@ EXPORT_SYMBOL_GPL(rt2800_validate_eeprom); | |||
1839 | int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | 1842 | int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) |
1840 | { | 1843 | { |
1841 | u32 reg; | 1844 | u32 reg; |
1845 | u16 chip; | ||
1842 | u16 value; | 1846 | u16 value; |
1843 | u16 eeprom; | 1847 | u16 eeprom; |
1844 | 1848 | ||
@@ -1853,25 +1857,40 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1853 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); | 1857 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); |
1854 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); | 1858 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); |
1855 | 1859 | ||
1856 | rt2x00_set_chip_rf(rt2x00dev, value, reg); | 1860 | if (rt2x00_is_pci(rt2x00dev)) { |
1857 | 1861 | #if defined(CONFIG_RT2X00_LIB_PCI) || defined(CONFIG_RT2X00_LIB_PCI_MODULE) | |
1858 | if (rt2x00_is_usb(rt2x00dev)) { | 1862 | pci_read_config_word(to_pci_dev(rt2x00dev->dev), |
1863 | PCI_DEVICE_ID, | ||
1864 | &chip); | ||
1865 | #else | ||
1866 | BUG(); | ||
1867 | #endif | ||
1868 | } else if (rt2x00_is_usb(rt2x00dev)) { | ||
1859 | /* | 1869 | /* |
1860 | * The check for rt2860 is not a typo, some rt2870 hardware | 1870 | * The check for rt2860 is not a typo, some rt2870 hardware |
1861 | * identifies itself as rt2860 in the CSR register. | 1871 | * identifies itself as rt2860 in the CSR register. |
1862 | */ | 1872 | */ |
1863 | if (rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28600000) || | 1873 | if (((reg & 0xfff00000) == 0x28600000) || |
1864 | rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28700000) || | 1874 | ((reg & 0xfff00000) == 0x28700000) || |
1865 | rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28800000)) { | 1875 | ((reg & 0xfff00000) == 0x28800000)) { |
1866 | rt2x00_set_chip_rt(rt2x00dev, RT2870); | 1876 | chip = RT2870; |
1867 | } else if (rt2x00_check_rev(rt2x00dev, 0xffff0000, 0x30700000)) { | 1877 | } else if ((reg & 0xffff0000) == 0x30700000) { |
1868 | rt2x00_set_chip_rt(rt2x00dev, RT3070); | 1878 | chip = RT3070; |
1869 | } else { | 1879 | } else { |
1870 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1880 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1871 | return -ENODEV; | 1881 | return -ENODEV; |
1872 | } | 1882 | } |
1883 | } else if (rt2x00_is_soc(rt2x00dev)) { | ||
1884 | #if defined(CONFIG_RALINK_RT288X) | ||
1885 | chip = RT2880; | ||
1886 | #elif defined(CONFIG_RALINK_RT305X) | ||
1887 | chip = RT3052; | ||
1888 | #else | ||
1889 | BUG(); | ||
1890 | #endif | ||
1873 | } | 1891 | } |
1874 | rt2x00_print_chip(rt2x00dev); | 1892 | |
1893 | rt2x00_set_chip(rt2x00dev, chip, value, reg); | ||
1875 | 1894 | ||
1876 | if (!rt2x00_rf(rt2x00dev, RF2820) && | 1895 | if (!rt2x00_rf(rt2x00dev, RF2820) && |
1877 | !rt2x00_rf(rt2x00dev, RF2850) && | 1896 | !rt2x00_rf(rt2x00dev, RF2850) && |