diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800.h | 14 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 92 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 20 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 41 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00debug.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.h | 2 |
14 files changed, 112 insertions, 118 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 9207b9b100b0..676814d3a81b 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1327,7 +1327,6 @@ static int rt2400pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1327 | static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | 1327 | static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev) |
1328 | { | 1328 | { |
1329 | u32 reg; | 1329 | u32 reg; |
1330 | u16 chip; | ||
1331 | u16 value; | 1330 | u16 value; |
1332 | u16 eeprom; | 1331 | u16 eeprom; |
1333 | 1332 | ||
@@ -1337,16 +1336,12 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1337 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); | 1336 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); |
1338 | 1337 | ||
1339 | /* | 1338 | /* |
1340 | * Identify RT chipset. | ||
1341 | */ | ||
1342 | pci_read_config_word(to_pci_dev(rt2x00dev->dev), PCI_DEVICE_ID, &chip); | ||
1343 | |||
1344 | /* | ||
1345 | * Identify RF chipset. | 1339 | * Identify RF chipset. |
1346 | */ | 1340 | */ |
1347 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); | 1341 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); |
1348 | rt2x00pci_register_read(rt2x00dev, CSR0, ®); | 1342 | rt2x00pci_register_read(rt2x00dev, CSR0, ®); |
1349 | rt2x00_set_chip(rt2x00dev, chip, value, reg); | 1343 | rt2x00_set_chip(rt2x00dev, RT2460, value, |
1344 | rt2x00_get_field32(reg, CSR0_REVISION)); | ||
1350 | 1345 | ||
1351 | if (!rt2x00_rf(rt2x00dev, RF2420) && !rt2x00_rf(rt2x00dev, RF2421)) { | 1346 | if (!rt2x00_rf(rt2x00dev, RF2420) && !rt2x00_rf(rt2x00dev, RF2421)) { |
1352 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); | 1347 | ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); |
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.h b/drivers/net/wireless/rt2x00/rt2400pci.h index 6c21ef66dfe0..606137738848 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.h +++ b/drivers/net/wireless/rt2x00/rt2400pci.h | |||
@@ -65,6 +65,7 @@ | |||
65 | * CSR0: ASIC revision number. | 65 | * CSR0: ASIC revision number. |
66 | */ | 66 | */ |
67 | #define CSR0 0x0000 | 67 | #define CSR0 0x0000 |
68 | #define CSR0_REVISION FIELD32(0x0000ffff) | ||
68 | 69 | ||
69 | /* | 70 | /* |
70 | * CSR1: System control register. | 71 | * CSR1: System control register. |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 0f6d001267ac..c71266142ae9 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1490,7 +1490,6 @@ static int rt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1490 | static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | 1490 | static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) |
1491 | { | 1491 | { |
1492 | u32 reg; | 1492 | u32 reg; |
1493 | u16 chip; | ||
1494 | u16 value; | 1493 | u16 value; |
1495 | u16 eeprom; | 1494 | u16 eeprom; |
1496 | 1495 | ||
@@ -1500,16 +1499,12 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1500 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); | 1499 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); |
1501 | 1500 | ||
1502 | /* | 1501 | /* |
1503 | * Identify RT chipset. | ||
1504 | */ | ||
1505 | pci_read_config_word(to_pci_dev(rt2x00dev->dev), PCI_DEVICE_ID, &chip); | ||
1506 | |||
1507 | /* | ||
1508 | * Identify RF chipset. | 1502 | * Identify RF chipset. |
1509 | */ | 1503 | */ |
1510 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); | 1504 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); |
1511 | rt2x00pci_register_read(rt2x00dev, CSR0, ®); | 1505 | rt2x00pci_register_read(rt2x00dev, CSR0, ®); |
1512 | rt2x00_set_chip(rt2x00dev, chip, value, reg); | 1506 | rt2x00_set_chip(rt2x00dev, RT2560, value, |
1507 | rt2x00_get_field32(reg, CSR0_REVISION)); | ||
1513 | 1508 | ||
1514 | if (!rt2x00_rf(rt2x00dev, RF2522) && | 1509 | if (!rt2x00_rf(rt2x00dev, RF2522) && |
1515 | !rt2x00_rf(rt2x00dev, RF2523) && | 1510 | !rt2x00_rf(rt2x00dev, RF2523) && |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.h b/drivers/net/wireless/rt2x00/rt2500pci.h index b0075674c09b..6471f8e74b35 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.h +++ b/drivers/net/wireless/rt2x00/rt2500pci.h | |||
@@ -76,6 +76,7 @@ | |||
76 | * CSR0: ASIC revision number. | 76 | * CSR0: ASIC revision number. |
77 | */ | 77 | */ |
78 | #define CSR0 0x0000 | 78 | #define CSR0 0x0000 |
79 | #define CSR0_REVISION FIELD32(0x0000ffff) | ||
79 | 80 | ||
80 | /* | 81 | /* |
81 | * CSR1: System control register. | 82 | * CSR1: System control register. |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 99b7cb88a648..ee34c137e7cd 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1409,8 +1409,7 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1409 | rt2500usb_register_read(rt2x00dev, MAC_CSR0, ®); | 1409 | rt2500usb_register_read(rt2x00dev, MAC_CSR0, ®); |
1410 | rt2x00_set_chip(rt2x00dev, RT2570, value, reg); | 1410 | rt2x00_set_chip(rt2x00dev, RT2570, value, reg); |
1411 | 1411 | ||
1412 | if (!rt2x00_check_rev(rt2x00dev, 0x000ffff0, 0) || | 1412 | if (((reg & 0xfff0) != 0) || ((reg & 0x0000000f) == 0)) { |
1413 | rt2x00_check_rev(rt2x00dev, 0x0000000f, 0)) { | ||
1414 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1413 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1415 | return -ENODEV; | 1414 | return -ENODEV; |
1416 | } | 1415 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index 1a7eae357fef..74c0433dba37 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -60,11 +60,11 @@ | |||
60 | /* | 60 | /* |
61 | * Chipset version. | 61 | * Chipset version. |
62 | */ | 62 | */ |
63 | #define RT2860C_VERSION 0x28600100 | 63 | #define RT2860C_VERSION 0x0100 |
64 | #define RT2860D_VERSION 0x28600101 | 64 | #define RT2860D_VERSION 0x0101 |
65 | #define RT2880E_VERSION 0x28720200 | 65 | #define RT2880E_VERSION 0x0200 |
66 | #define RT2883_VERSION 0x28830300 | 66 | #define RT2883_VERSION 0x0300 |
67 | #define RT3070_VERSION 0x30700200 | 67 | #define RT3070_VERSION 0x0200 |
68 | 68 | ||
69 | /* | 69 | /* |
70 | * Signal information. | 70 | * Signal information. |
@@ -408,8 +408,8 @@ | |||
408 | * ASIC_VER: 2860 or 2870 | 408 | * ASIC_VER: 2860 or 2870 |
409 | */ | 409 | */ |
410 | #define MAC_CSR0 0x1000 | 410 | #define MAC_CSR0 0x1000 |
411 | #define MAC_CSR0_ASIC_REV FIELD32(0x0000ffff) | 411 | #define MAC_CSR0_REVISION FIELD32(0x0000ffff) |
412 | #define MAC_CSR0_ASIC_VER FIELD32(0xffff0000) | 412 | #define MAC_CSR0_CHIPSET FIELD32(0xffff0000) |
413 | 413 | ||
414 | /* | 414 | /* |
415 | * MAC_SYS_CTRL: | 415 | * MAC_SYS_CTRL: |
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) && |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 82755cf8b73e..79ea3798d597 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -92,7 +92,6 @@ static bool rt2800usb_check_crc(const u8 *data, const size_t len) | |||
92 | static int rt2800usb_check_firmware(struct rt2x00_dev *rt2x00dev, | 92 | static int rt2800usb_check_firmware(struct rt2x00_dev *rt2x00dev, |
93 | const u8 *data, const size_t len) | 93 | const u8 *data, const size_t len) |
94 | { | 94 | { |
95 | u16 chipset = (rt2x00_rev(rt2x00dev) >> 16) & 0xffff; | ||
96 | size_t offset = 0; | 95 | size_t offset = 0; |
97 | 96 | ||
98 | /* | 97 | /* |
@@ -111,9 +110,9 @@ static int rt2800usb_check_firmware(struct rt2x00_dev *rt2x00dev, | |||
111 | * Check if we need the upper 4kb firmware data or not. | 110 | * Check if we need the upper 4kb firmware data or not. |
112 | */ | 111 | */ |
113 | if ((len == 4096) && | 112 | if ((len == 4096) && |
114 | (chipset != 0x2860) && | 113 | !rt2x00_rt(rt2x00dev, RT2860) && |
115 | (chipset != 0x2872) && | 114 | !rt2x00_rt(rt2x00dev, RT2872) && |
116 | (chipset != 0x3070)) | 115 | !rt2x00_rt(rt2x00dev, RT3070)) |
117 | return FW_BAD_VERSION; | 116 | return FW_BAD_VERSION; |
118 | 117 | ||
119 | /* | 118 | /* |
@@ -138,14 +137,13 @@ static int rt2800usb_load_firmware(struct rt2x00_dev *rt2x00dev, | |||
138 | u32 reg; | 137 | u32 reg; |
139 | u32 offset; | 138 | u32 offset; |
140 | u32 length; | 139 | u32 length; |
141 | u16 chipset = (rt2x00_rev(rt2x00dev) >> 16) & 0xffff; | ||
142 | 140 | ||
143 | /* | 141 | /* |
144 | * Check which section of the firmware we need. | 142 | * Check which section of the firmware we need. |
145 | */ | 143 | */ |
146 | if ((chipset == 0x2860) || | 144 | if (rt2x00_rt(rt2x00dev, RT2860) || |
147 | (chipset == 0x2872) || | 145 | rt2x00_rt(rt2x00dev, RT2872) || |
148 | (chipset == 0x3070)) { | 146 | rt2x00_rt(rt2x00dev, RT3070)) { |
149 | offset = 0; | 147 | offset = 0; |
150 | length = 4096; | 148 | length = 4096; |
151 | } else { | 149 | } else { |
@@ -200,9 +198,9 @@ static int rt2800usb_load_firmware(struct rt2x00_dev *rt2x00dev, | |||
200 | */ | 198 | */ |
201 | rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0); | 199 | rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0); |
202 | 200 | ||
203 | if ((chipset == 0x3070) || | 201 | if (rt2x00_rt(rt2x00dev, RT3070) || |
204 | (chipset == 0x3071) || | 202 | rt2x00_rt(rt2x00dev, RT3071) || |
205 | (chipset == 0x3572)) { | 203 | rt2x00_rt(rt2x00dev, RT3572)) { |
206 | udelay(200); | 204 | udelay(200); |
207 | rt2800_mcu_request(rt2x00dev, MCU_CURRENT, 0, 0, 0); | 205 | rt2800_mcu_request(rt2x00dev, MCU_CURRENT, 0, 0, 0); |
208 | udelay(10); | 206 | udelay(10); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 1fed90acd198..d9daa9c406fa 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -170,25 +170,26 @@ enum rt2x00_chip_intf { | |||
170 | */ | 170 | */ |
171 | struct rt2x00_chip { | 171 | struct rt2x00_chip { |
172 | u16 rt; | 172 | u16 rt; |
173 | #define RT2460 0x0101 | 173 | #define RT2460 0x2460 |
174 | #define RT2560 0x0201 | 174 | #define RT2560 0x2560 |
175 | #define RT2570 0x1201 | 175 | #define RT2570 0x2570 |
176 | #define RT2561s 0x0301 /* Turbo */ | 176 | #define RT2661 0x2661 |
177 | #define RT2561 0x0302 | 177 | #define RT2573 0x2573 |
178 | #define RT2661 0x0401 | 178 | #define RT2860 0x2860 /* 2.4GHz PCI/CB */ |
179 | #define RT2571 0x1300 | 179 | #define RT2870 0x2870 |
180 | #define RT2860 0x0601 /* 2.4GHz PCI/CB */ | 180 | #define RT2872 0x2872 |
181 | #define RT2860D 0x0681 /* 2.4GHz, 5GHz PCI/CB */ | ||
182 | #define RT2890 0x0701 /* 2.4GHz PCIe */ | ||
183 | #define RT2890D 0x0781 /* 2.4GHz, 5GHz PCIe */ | ||
184 | #define RT2880 0x2880 /* WSOC */ | 181 | #define RT2880 0x2880 /* WSOC */ |
182 | #define RT2883 0x2883 /* WSOC */ | ||
183 | #define RT2890 0x2890 /* 2.4GHz PCIe */ | ||
185 | #define RT3052 0x3052 /* WSOC */ | 184 | #define RT3052 0x3052 /* WSOC */ |
185 | #define RT3070 0x3070 | ||
186 | #define RT3071 0x3071 | ||
186 | #define RT3090 0x3090 /* 2.4GHz PCIe */ | 187 | #define RT3090 0x3090 /* 2.4GHz PCIe */ |
187 | #define RT2870 0x1600 | 188 | #define RT3390 0x3390 |
188 | #define RT3070 0x1800 | 189 | #define RT3572 0x3572 |
189 | 190 | ||
190 | u16 rf; | 191 | u16 rf; |
191 | u32 rev; | 192 | u16 rev; |
192 | 193 | ||
193 | enum rt2x00_chip_intf intf; | 194 | enum rt2x00_chip_intf intf; |
194 | }; | 195 | }; |
@@ -918,14 +919,14 @@ static inline void rt2x00_eeprom_write(struct rt2x00_dev *rt2x00dev, | |||
918 | * Chipset handlers | 919 | * Chipset handlers |
919 | */ | 920 | */ |
920 | static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev, | 921 | static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev, |
921 | const u16 rt, const u16 rf, const u32 rev) | 922 | const u16 rt, const u16 rf, const u16 rev) |
922 | { | 923 | { |
923 | rt2x00dev->chip.rt = rt; | 924 | rt2x00dev->chip.rt = rt; |
924 | rt2x00dev->chip.rf = rf; | 925 | rt2x00dev->chip.rf = rf; |
925 | rt2x00dev->chip.rev = rev; | 926 | rt2x00dev->chip.rev = rev; |
926 | 927 | ||
927 | INFO(rt2x00dev, | 928 | INFO(rt2x00dev, |
928 | "Chipset detected - rt: %04x, rf: %04x, rev: %08x.\n", | 929 | "Chipset detected - rt: %04x, rf: %04x, rev: %04x.\n", |
929 | rt2x00dev->chip.rt, rt2x00dev->chip.rf, rt2x00dev->chip.rev); | 930 | rt2x00dev->chip.rt, rt2x00dev->chip.rf, rt2x00dev->chip.rev); |
930 | } | 931 | } |
931 | 932 | ||
@@ -939,17 +940,11 @@ static inline char rt2x00_rf(struct rt2x00_dev *rt2x00dev, const u16 rf) | |||
939 | return (rt2x00dev->chip.rf == rf); | 940 | return (rt2x00dev->chip.rf == rf); |
940 | } | 941 | } |
941 | 942 | ||
942 | static inline u32 rt2x00_rev(struct rt2x00_dev *rt2x00dev) | 943 | static inline u16 rt2x00_rev(struct rt2x00_dev *rt2x00dev) |
943 | { | 944 | { |
944 | return rt2x00dev->chip.rev; | 945 | return rt2x00dev->chip.rev; |
945 | } | 946 | } |
946 | 947 | ||
947 | static inline bool rt2x00_check_rev(struct rt2x00_dev *rt2x00dev, | ||
948 | const u32 mask, const u32 rev) | ||
949 | { | ||
950 | return ((rt2x00dev->chip.rev & mask) == rev); | ||
951 | } | ||
952 | |||
953 | static inline void rt2x00_set_chip_intf(struct rt2x00_dev *rt2x00dev, | 948 | static inline void rt2x00_set_chip_intf(struct rt2x00_dev *rt2x00dev, |
954 | enum rt2x00_chip_intf intf) | 949 | enum rt2x00_chip_intf intf) |
955 | { | 950 | { |
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index 7d323a763b54..70c04c282efc 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c | |||
@@ -184,7 +184,7 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, | |||
184 | dump_hdr->data_length = cpu_to_le32(skb->len); | 184 | dump_hdr->data_length = cpu_to_le32(skb->len); |
185 | dump_hdr->chip_rt = cpu_to_le16(rt2x00dev->chip.rt); | 185 | dump_hdr->chip_rt = cpu_to_le16(rt2x00dev->chip.rt); |
186 | dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf); | 186 | dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf); |
187 | dump_hdr->chip_rev = cpu_to_le32(rt2x00dev->chip.rev); | 187 | dump_hdr->chip_rev = cpu_to_le16(rt2x00dev->chip.rev); |
188 | dump_hdr->type = cpu_to_le16(type); | 188 | dump_hdr->type = cpu_to_le16(type); |
189 | dump_hdr->queue_index = desc->entry->queue->qid; | 189 | dump_hdr->queue_index = desc->entry->queue->qid; |
190 | dump_hdr->entry_index = desc->entry->entry_idx; | 190 | dump_hdr->entry_index = desc->entry->entry_idx; |
@@ -573,7 +573,7 @@ static struct dentry *rt2x00debug_create_file_chipset(const char *name, | |||
573 | blob->data = data; | 573 | blob->data = data; |
574 | data += sprintf(data, "rt chip:\t%04x\n", intf->rt2x00dev->chip.rt); | 574 | data += sprintf(data, "rt chip:\t%04x\n", intf->rt2x00dev->chip.rt); |
575 | data += sprintf(data, "rf chip:\t%04x\n", intf->rt2x00dev->chip.rf); | 575 | data += sprintf(data, "rf chip:\t%04x\n", intf->rt2x00dev->chip.rf); |
576 | data += sprintf(data, "revision:\t%08x\n", intf->rt2x00dev->chip.rev); | 576 | data += sprintf(data, "revision:\t%04x\n", intf->rt2x00dev->chip.rev); |
577 | data += sprintf(data, "\n"); | 577 | data += sprintf(data, "\n"); |
578 | data += sprintf(data, "register\tbase\twords\twordsize\n"); | 578 | data += sprintf(data, "register\tbase\twords\twordsize\n"); |
579 | data += sprintf(data, "csr\t%d\t%d\t%d\n", | 579 | data += sprintf(data, "csr\t%d\t%d\t%d\n", |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 4ca1d48fb737..ee9c696fe1d4 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1131,16 +1131,18 @@ dynamic_cca_tune: | |||
1131 | */ | 1131 | */ |
1132 | static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 1132 | static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
1133 | { | 1133 | { |
1134 | u16 chip; | ||
1134 | char *fw_name; | 1135 | char *fw_name; |
1135 | 1136 | ||
1136 | switch (rt2x00dev->chip.rt) { | 1137 | pci_read_config_word(to_pci_dev(rt2x00dev->dev), PCI_DEVICE_ID, &chip); |
1137 | case RT2561: | 1138 | switch (chip) { |
1139 | case RT2561_PCI_ID: | ||
1138 | fw_name = FIRMWARE_RT2561; | 1140 | fw_name = FIRMWARE_RT2561; |
1139 | break; | 1141 | break; |
1140 | case RT2561s: | 1142 | case RT2561s_PCI_ID: |
1141 | fw_name = FIRMWARE_RT2561s; | 1143 | fw_name = FIRMWARE_RT2561s; |
1142 | break; | 1144 | break; |
1143 | case RT2661: | 1145 | case RT2661_PCI_ID: |
1144 | fw_name = FIRMWARE_RT2661; | 1146 | fw_name = FIRMWARE_RT2661; |
1145 | break; | 1147 | break; |
1146 | default: | 1148 | default: |
@@ -2282,7 +2284,6 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2282 | static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | 2284 | static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) |
2283 | { | 2285 | { |
2284 | u32 reg; | 2286 | u32 reg; |
2285 | u16 chip; | ||
2286 | u16 value; | 2287 | u16 value; |
2287 | u16 eeprom; | 2288 | u16 eeprom; |
2288 | 2289 | ||
@@ -2292,16 +2293,12 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2292 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); | 2293 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); |
2293 | 2294 | ||
2294 | /* | 2295 | /* |
2295 | * Identify RT chipset. | ||
2296 | */ | ||
2297 | pci_read_config_word(to_pci_dev(rt2x00dev->dev), PCI_DEVICE_ID, &chip); | ||
2298 | |||
2299 | /* | ||
2300 | * Identify RF chipset. | 2296 | * Identify RF chipset. |
2301 | */ | 2297 | */ |
2302 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); | 2298 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); |
2303 | rt2x00pci_register_read(rt2x00dev, MAC_CSR0, ®); | 2299 | rt2x00pci_register_read(rt2x00dev, MAC_CSR0, ®); |
2304 | rt2x00_set_chip(rt2x00dev, chip, value, reg); | 2300 | rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), |
2301 | value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); | ||
2305 | 2302 | ||
2306 | if (!rt2x00_rf(rt2x00dev, RF5225) && | 2303 | if (!rt2x00_rf(rt2x00dev, RF5225) && |
2307 | !rt2x00_rf(rt2x00dev, RF5325) && | 2304 | !rt2x00_rf(rt2x00dev, RF5325) && |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.h b/drivers/net/wireless/rt2x00/rt61pci.h index 6f33f7f5668c..ab20c7758824 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.h +++ b/drivers/net/wireless/rt2x00/rt61pci.h | |||
@@ -28,6 +28,13 @@ | |||
28 | #define RT61PCI_H | 28 | #define RT61PCI_H |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * RT chip PCI IDs. | ||
32 | */ | ||
33 | #define RT2561s_PCI_ID 0x0301 | ||
34 | #define RT2561_PCI_ID 0x0302 | ||
35 | #define RT2661_PCI_ID 0x0401 | ||
36 | |||
37 | /* | ||
31 | * RF chip defines. | 38 | * RF chip defines. |
32 | */ | 39 | */ |
33 | #define RF5225 0x0001 | 40 | #define RF5225 0x0001 |
@@ -225,6 +232,8 @@ struct hw_pairwise_ta_entry { | |||
225 | * MAC_CSR0: ASIC revision number. | 232 | * MAC_CSR0: ASIC revision number. |
226 | */ | 233 | */ |
227 | #define MAC_CSR0 0x3000 | 234 | #define MAC_CSR0 0x3000 |
235 | #define MAC_CSR0_REVISION FIELD32(0x0000000f) | ||
236 | #define MAC_CSR0_CHIPSET FIELD32(0x000ffff0) | ||
228 | 237 | ||
229 | /* | 238 | /* |
230 | * MAC_CSR1: System control register. | 239 | * MAC_CSR1: System control register. |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 2950ac754921..f39a8ed17841 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1820,10 +1820,10 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1820 | */ | 1820 | */ |
1821 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); | 1821 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); |
1822 | rt2x00usb_register_read(rt2x00dev, MAC_CSR0, ®); | 1822 | rt2x00usb_register_read(rt2x00dev, MAC_CSR0, ®); |
1823 | rt2x00_set_chip(rt2x00dev, RT2571, value, reg); | 1823 | rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), |
1824 | value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); | ||
1824 | 1825 | ||
1825 | if (!rt2x00_check_rev(rt2x00dev, 0x000ffff0, 0x25730) || | 1826 | if (!rt2x00_rt(rt2x00dev, RT2573) || (rt2x00_rev(rt2x00dev) == 0)) { |
1826 | rt2x00_check_rev(rt2x00dev, 0x0000000f, 0)) { | ||
1827 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1827 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1828 | return -ENODEV; | 1828 | return -ENODEV; |
1829 | } | 1829 | } |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.h b/drivers/net/wireless/rt2x00/rt73usb.h index e783a099a8f1..b4e3ddda06cf 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.h +++ b/drivers/net/wireless/rt2x00/rt73usb.h | |||
@@ -142,6 +142,8 @@ struct hw_pairwise_ta_entry { | |||
142 | * MAC_CSR0: ASIC revision number. | 142 | * MAC_CSR0: ASIC revision number. |
143 | */ | 143 | */ |
144 | #define MAC_CSR0 0x3000 | 144 | #define MAC_CSR0 0x3000 |
145 | #define MAC_CSR0_REVISION FIELD32(0x0000000f) | ||
146 | #define MAC_CSR0_CHIPSET FIELD32(0x000ffff0) | ||
145 | 147 | ||
146 | /* | 148 | /* |
147 | * MAC_CSR1: System control register. | 149 | * MAC_CSR1: System control register. |