diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 7340e487df6b..18d4d8e4ae6b 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -898,7 +898,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, | |||
898 | rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf)); | 898 | rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf)); |
899 | rt2800_bbp_write(rt2x00dev, 3, bbp); | 899 | rt2800_bbp_write(rt2x00dev, 3, bbp); |
900 | 900 | ||
901 | if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) { | 901 | if (rt2x00_rt(rt2x00dev, RT2860) && |
902 | (rt2x00_rev(rt2x00dev) == RT2860C_VERSION)) { | ||
902 | if (conf_is_ht40(conf)) { | 903 | if (conf_is_ht40(conf)) { |
903 | rt2800_bbp_write(rt2x00dev, 69, 0x1a); | 904 | rt2800_bbp_write(rt2x00dev, 69, 0x1a); |
904 | rt2800_bbp_write(rt2x00dev, 70, 0x0a); | 905 | rt2800_bbp_write(rt2x00dev, 70, 0x0a); |
@@ -1061,7 +1062,8 @@ static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev) | |||
1061 | { | 1062 | { |
1062 | if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { | 1063 | if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { |
1063 | if (rt2x00_is_usb(rt2x00dev) && | 1064 | if (rt2x00_is_usb(rt2x00dev) && |
1064 | rt2x00_rev(rt2x00dev) == RT3070_VERSION) | 1065 | rt2x00_rt(rt2x00dev, RT3070) && |
1066 | (rt2x00_rev(rt2x00dev) == RT3070_VERSION)) | ||
1065 | return 0x1c + (2 * rt2x00dev->lna_gain); | 1067 | return 0x1c + (2 * rt2x00dev->lna_gain); |
1066 | else | 1068 | else |
1067 | return 0x2e + rt2x00dev->lna_gain; | 1069 | return 0x2e + rt2x00dev->lna_gain; |
@@ -1092,7 +1094,8 @@ EXPORT_SYMBOL_GPL(rt2800_reset_tuner); | |||
1092 | void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, | 1094 | void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, |
1093 | const u32 count) | 1095 | const u32 count) |
1094 | { | 1096 | { |
1095 | if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) | 1097 | if (rt2x00_rt(rt2x00dev, RT2860) && |
1098 | (rt2x00_rev(rt2x00dev) == RT2860C_VERSION)) | ||
1096 | return; | 1099 | return; |
1097 | 1100 | ||
1098 | /* | 1101 | /* |
@@ -1178,7 +1181,8 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1178 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | 1181 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); |
1179 | 1182 | ||
1180 | if (rt2x00_is_usb(rt2x00dev) && | 1183 | if (rt2x00_is_usb(rt2x00dev) && |
1181 | rt2x00_rev(rt2x00dev) == RT3070_VERSION) { | 1184 | rt2x00_rt(rt2x00dev, RT3070) && |
1185 | (rt2x00_rev(rt2x00dev) == RT3070_VERSION)) { | ||
1182 | rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); | 1186 | rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); |
1183 | rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); | 1187 | rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); |
1184 | rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); | 1188 | rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); |
@@ -1205,8 +1209,14 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1205 | 1209 | ||
1206 | rt2800_register_read(rt2x00dev, MAX_LEN_CFG, ®); | 1210 | rt2800_register_read(rt2x00dev, MAX_LEN_CFG, ®); |
1207 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE); | 1211 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE); |
1208 | if (rt2x00_rev(rt2x00dev) >= RT2880E_VERSION && | 1212 | if ((rt2x00_rt(rt2x00dev, RT2872) && |
1209 | rt2x00_rev(rt2x00dev) < RT3070_VERSION) | 1213 | (rt2x00_rev(rt2x00dev) >= RT2880E_VERSION)) || |
1214 | rt2x00_rt(rt2x00dev, RT2880) || | ||
1215 | rt2x00_rt(rt2x00dev, RT2883) || | ||
1216 | rt2x00_rt(rt2x00dev, RT2890) || | ||
1217 | rt2x00_rt(rt2x00dev, RT3052) || | ||
1218 | (rt2x00_rt(rt2x00dev, RT3070) && | ||
1219 | (rt2x00_rev(rt2x00dev) < RT3070_VERSION))) | ||
1210 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 2); | 1220 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 2); |
1211 | else | 1221 | else |
1212 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 1); | 1222 | rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 1); |
@@ -1485,16 +1495,19 @@ int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
1485 | rt2800_bbp_write(rt2x00dev, 103, 0x00); | 1495 | rt2800_bbp_write(rt2x00dev, 103, 0x00); |
1486 | rt2800_bbp_write(rt2x00dev, 105, 0x05); | 1496 | rt2800_bbp_write(rt2x00dev, 105, 0x05); |
1487 | 1497 | ||
1488 | if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) { | 1498 | if (rt2x00_rt(rt2x00dev, RT2860) && |
1499 | (rt2x00_rev(rt2x00dev) == RT2860C_VERSION)) { | ||
1489 | rt2800_bbp_write(rt2x00dev, 69, 0x16); | 1500 | rt2800_bbp_write(rt2x00dev, 69, 0x16); |
1490 | rt2800_bbp_write(rt2x00dev, 73, 0x12); | 1501 | rt2800_bbp_write(rt2x00dev, 73, 0x12); |
1491 | } | 1502 | } |
1492 | 1503 | ||
1493 | if (rt2x00_rev(rt2x00dev) > RT2860D_VERSION) | 1504 | if (rt2x00_rt(rt2x00dev, RT2860) && |
1505 | (rt2x00_rev(rt2x00dev) > RT2860D_VERSION)) | ||
1494 | rt2800_bbp_write(rt2x00dev, 84, 0x19); | 1506 | rt2800_bbp_write(rt2x00dev, 84, 0x19); |
1495 | 1507 | ||
1496 | if (rt2x00_is_usb(rt2x00dev) && | 1508 | if (rt2x00_is_usb(rt2x00dev) && |
1497 | rt2x00_rev(rt2x00dev) == RT3070_VERSION) { | 1509 | rt2x00_rt(rt2x00dev, RT3070) && |
1510 | (rt2x00_rev(rt2x00dev) == RT3070_VERSION)) { | ||
1498 | rt2800_bbp_write(rt2x00dev, 70, 0x0a); | 1511 | rt2800_bbp_write(rt2x00dev, 70, 0x0a); |
1499 | rt2800_bbp_write(rt2x00dev, 84, 0x99); | 1512 | rt2800_bbp_write(rt2x00dev, 84, 0x99); |
1500 | rt2800_bbp_write(rt2x00dev, 105, 0x05); | 1513 | rt2800_bbp_write(rt2x00dev, 105, 0x05); |
@@ -1586,7 +1599,8 @@ int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
1586 | u8 bbp; | 1599 | u8 bbp; |
1587 | 1600 | ||
1588 | if (rt2x00_is_usb(rt2x00dev) && | 1601 | if (rt2x00_is_usb(rt2x00dev) && |
1589 | rt2x00_rev(rt2x00dev) != RT3070_VERSION) | 1602 | rt2x00_rt(rt2x00dev, RT3070) && |
1603 | (rt2x00_rev(rt2x00dev) != RT3070_VERSION)) | ||
1590 | return 0; | 1604 | return 0; |
1591 | 1605 | ||
1592 | if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) { | 1606 | if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) { |
@@ -1757,7 +1771,12 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1757 | rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820); | 1771 | rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820); |
1758 | rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); | 1772 | rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); |
1759 | EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); | 1773 | EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); |
1760 | } else if (rt2x00_rev(rt2x00dev) < RT2883_VERSION) { | 1774 | } else if (rt2x00_rt(rt2x00dev, RT2860) || |
1775 | rt2x00_rt(rt2x00dev, RT2870) || | ||
1776 | rt2x00_rt(rt2x00dev, RT2872) || | ||
1777 | rt2x00_rt(rt2x00dev, RT2880) || | ||
1778 | (rt2x00_rt(rt2x00dev, RT2883) && | ||
1779 | (rt2x00_rev(rt2x00dev) < RT2883_VERSION))) { | ||
1761 | /* | 1780 | /* |
1762 | * There is a max of 2 RX streams for RT28x0 series | 1781 | * There is a max of 2 RX streams for RT28x0 series |
1763 | */ | 1782 | */ |
@@ -1842,7 +1861,6 @@ EXPORT_SYMBOL_GPL(rt2800_validate_eeprom); | |||
1842 | int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | 1861 | int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) |
1843 | { | 1862 | { |
1844 | u32 reg; | 1863 | u32 reg; |
1845 | u16 chip; | ||
1846 | u16 value; | 1864 | u16 value; |
1847 | u16 eeprom; | 1865 | u16 eeprom; |
1848 | 1866 | ||
@@ -1857,41 +1875,25 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1857 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); | 1875 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); |
1858 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); | 1876 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); |
1859 | 1877 | ||
1860 | if (rt2x00_is_pci(rt2x00dev)) { | 1878 | rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), |
1861 | #if defined(CONFIG_RT2X00_LIB_PCI) || defined(CONFIG_RT2X00_LIB_PCI_MODULE) | 1879 | value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); |
1862 | pci_read_config_word(to_pci_dev(rt2x00dev->dev), | 1880 | |
1863 | PCI_DEVICE_ID, | 1881 | if (!rt2x00_rt(rt2x00dev, RT2860) && |
1864 | &chip); | 1882 | !rt2x00_rt(rt2x00dev, RT2870) && |
1865 | #else | 1883 | !rt2x00_rt(rt2x00dev, RT2872) && |
1866 | BUG(); | 1884 | !rt2x00_rt(rt2x00dev, RT2880) && |
1867 | #endif | 1885 | !rt2x00_rt(rt2x00dev, RT2883) && |
1868 | } else if (rt2x00_is_usb(rt2x00dev)) { | 1886 | !rt2x00_rt(rt2x00dev, RT2890) && |
1869 | /* | 1887 | !rt2x00_rt(rt2x00dev, RT3052) && |
1870 | * The check for rt2860 is not a typo, some rt2870 hardware | 1888 | !rt2x00_rt(rt2x00dev, RT3070) && |
1871 | * identifies itself as rt2860 in the CSR register. | 1889 | !rt2x00_rt(rt2x00dev, RT3071) && |
1872 | */ | 1890 | !rt2x00_rt(rt2x00dev, RT3090) && |
1873 | if (((reg & 0xfff00000) == 0x28600000) || | 1891 | !rt2x00_rt(rt2x00dev, RT3390) && |
1874 | ((reg & 0xfff00000) == 0x28700000) || | 1892 | !rt2x00_rt(rt2x00dev, RT3572)) { |
1875 | ((reg & 0xfff00000) == 0x28800000)) { | 1893 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1876 | chip = RT2870; | 1894 | return -ENODEV; |
1877 | } else if ((reg & 0xffff0000) == 0x30700000) { | ||
1878 | chip = RT3070; | ||
1879 | } else { | ||
1880 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | ||
1881 | return -ENODEV; | ||
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 | ||
1891 | } | 1895 | } |
1892 | 1896 | ||
1893 | rt2x00_set_chip(rt2x00dev, chip, value, reg); | ||
1894 | |||
1895 | if (!rt2x00_rf(rt2x00dev, RF2820) && | 1897 | if (!rt2x00_rf(rt2x00dev, RF2820) && |
1896 | !rt2x00_rf(rt2x00dev, RF2850) && | 1898 | !rt2x00_rf(rt2x00dev, RF2850) && |
1897 | !rt2x00_rf(rt2x00dev, RF2720) && | 1899 | !rt2x00_rf(rt2x00dev, RF2720) && |