aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c38
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c18
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h10
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00soc.c6
4 files changed, 34 insertions, 38 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index a45e027f2d1..e78df53b951 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -89,7 +89,7 @@ static void rt2800_bbp_write(struct rt2x00_dev *rt2x00dev,
89 rt2x00_set_field32(&reg, BBP_CSR_CFG_REGNUM, word); 89 rt2x00_set_field32(&reg, BBP_CSR_CFG_REGNUM, word);
90 rt2x00_set_field32(&reg, BBP_CSR_CFG_BUSY, 1); 90 rt2x00_set_field32(&reg, BBP_CSR_CFG_BUSY, 1);
91 rt2x00_set_field32(&reg, BBP_CSR_CFG_READ_CONTROL, 0); 91 rt2x00_set_field32(&reg, BBP_CSR_CFG_READ_CONTROL, 0);
92 if (rt2x00_intf_is_pci(rt2x00dev)) 92 if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev))
93 rt2x00_set_field32(&reg, BBP_CSR_CFG_BBP_RW_MODE, 1); 93 rt2x00_set_field32(&reg, BBP_CSR_CFG_BBP_RW_MODE, 1);
94 94
95 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg); 95 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg);
@@ -118,7 +118,7 @@ static void rt2800_bbp_read(struct rt2x00_dev *rt2x00dev,
118 rt2x00_set_field32(&reg, BBP_CSR_CFG_REGNUM, word); 118 rt2x00_set_field32(&reg, BBP_CSR_CFG_REGNUM, word);
119 rt2x00_set_field32(&reg, BBP_CSR_CFG_BUSY, 1); 119 rt2x00_set_field32(&reg, BBP_CSR_CFG_BUSY, 1);
120 rt2x00_set_field32(&reg, BBP_CSR_CFG_READ_CONTROL, 1); 120 rt2x00_set_field32(&reg, BBP_CSR_CFG_READ_CONTROL, 1);
121 if (rt2x00_intf_is_pci(rt2x00dev)) 121 if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev))
122 rt2x00_set_field32(&reg, BBP_CSR_CFG_BBP_RW_MODE, 1); 122 rt2x00_set_field32(&reg, BBP_CSR_CFG_BBP_RW_MODE, 1);
123 123
124 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg); 124 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg);
@@ -218,9 +218,9 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
218 u32 reg; 218 u32 reg;
219 219
220 /* 220 /*
221 * RT2880 and RT3052 don't support MCU requests. 221 * SOC devices don't support MCU requests.
222 */ 222 */
223 if (rt2x00_rt(rt2x00dev, RT2880) || rt2x00_rt(rt2x00dev, RT3052)) 223 if (rt2x00_is_soc(rt2x00dev))
224 return; 224 return;
225 225
226 mutex_lock(&rt2x00dev->csr_mutex); 226 mutex_lock(&rt2x00dev->csr_mutex);
@@ -660,7 +660,7 @@ void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant)
660 switch ((int)ant->tx) { 660 switch ((int)ant->tx) {
661 case 1: 661 case 1:
662 rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 0); 662 rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 0);
663 if (rt2x00_intf_is_pci(rt2x00dev)) 663 if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev))
664 rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0); 664 rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0);
665 break; 665 break;
666 case 2: 666 case 2:
@@ -1057,7 +1057,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_stats);
1057static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev) 1057static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev)
1058{ 1058{
1059 if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { 1059 if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
1060 if (rt2x00_intf_is_usb(rt2x00dev) && 1060 if (rt2x00_is_usb(rt2x00dev) &&
1061 rt2x00_rev(rt2x00dev) == RT3070_VERSION) 1061 rt2x00_rev(rt2x00dev) == RT3070_VERSION)
1062 return 0x1c + (2 * rt2x00dev->lna_gain); 1062 return 0x1c + (2 * rt2x00dev->lna_gain);
1063 else 1063 else
@@ -1109,7 +1109,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1109 u32 reg; 1109 u32 reg;
1110 unsigned int i; 1110 unsigned int i;
1111 1111
1112 if (rt2x00_intf_is_usb(rt2x00dev)) { 1112 if (rt2x00_is_usb(rt2x00dev)) {
1113 /* 1113 /*
1114 * Wait until BBP and RF are ready. 1114 * Wait until BBP and RF are ready.
1115 */ 1115 */
@@ -1128,7 +1128,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1128 rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, &reg); 1128 rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, &reg);
1129 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 1129 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL,
1130 reg & ~0x00002000); 1130 reg & ~0x00002000);
1131 } else if (rt2x00_intf_is_pci(rt2x00dev)) 1131 } else if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev))
1132 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); 1132 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
1133 1133
1134 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); 1134 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
@@ -1136,7 +1136,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1136 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1); 1136 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
1137 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 1137 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
1138 1138
1139 if (rt2x00_intf_is_usb(rt2x00dev)) { 1139 if (rt2x00_is_usb(rt2x00dev)) {
1140 rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); 1140 rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000);
1141#if defined(CONFIG_RT2X00_LIB_USB) || defined(CONFIG_RT2X00_LIB_USB_MODULE) 1141#if defined(CONFIG_RT2X00_LIB_USB) || defined(CONFIG_RT2X00_LIB_USB_MODULE)
1142 rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, 1142 rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0,
@@ -1174,7 +1174,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1174 rt2x00_set_field32(&reg, BCN_TIME_CFG_TX_TIME_COMPENSATE, 0); 1174 rt2x00_set_field32(&reg, BCN_TIME_CFG_TX_TIME_COMPENSATE, 0);
1175 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); 1175 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
1176 1176
1177 if (rt2x00_intf_is_usb(rt2x00dev) && 1177 if (rt2x00_is_usb(rt2x00dev) &&
1178 rt2x00_rev(rt2x00dev) == RT3070_VERSION) { 1178 rt2x00_rev(rt2x00dev) == RT3070_VERSION) {
1179 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); 1179 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400);
1180 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); 1180 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
@@ -1293,7 +1293,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1293 rt2x00_set_field32(&reg, GF40_PROT_CFG_TX_OP_ALLOW_GF40, 1); 1293 rt2x00_set_field32(&reg, GF40_PROT_CFG_TX_OP_ALLOW_GF40, 1);
1294 rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg); 1294 rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg);
1295 1295
1296 if (rt2x00_intf_is_usb(rt2x00dev)) { 1296 if (rt2x00_is_usb(rt2x00dev)) {
1297 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40006); 1297 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40006);
1298 1298
1299 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg); 1299 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
@@ -1353,7 +1353,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1353 rt2800_register_write(rt2x00dev, HW_BEACON_BASE6, 0); 1353 rt2800_register_write(rt2x00dev, HW_BEACON_BASE6, 0);
1354 rt2800_register_write(rt2x00dev, HW_BEACON_BASE7, 0); 1354 rt2800_register_write(rt2x00dev, HW_BEACON_BASE7, 0);
1355 1355
1356 if (rt2x00_intf_is_usb(rt2x00dev)) { 1356 if (rt2x00_is_usb(rt2x00dev)) {
1357 rt2800_register_read(rt2x00dev, USB_CYC_CFG, &reg); 1357 rt2800_register_read(rt2x00dev, USB_CYC_CFG, &reg);
1358 rt2x00_set_field32(&reg, USB_CYC_CFG_CLOCK_CYCLE, 30); 1358 rt2x00_set_field32(&reg, USB_CYC_CFG_CLOCK_CYCLE, 30);
1359 rt2800_register_write(rt2x00dev, USB_CYC_CFG, reg); 1359 rt2800_register_write(rt2x00dev, USB_CYC_CFG, reg);
@@ -1490,7 +1490,7 @@ int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
1490 if (rt2x00_rev(rt2x00dev) > RT2860D_VERSION) 1490 if (rt2x00_rev(rt2x00dev) > RT2860D_VERSION)
1491 rt2800_bbp_write(rt2x00dev, 84, 0x19); 1491 rt2800_bbp_write(rt2x00dev, 84, 0x19);
1492 1492
1493 if (rt2x00_intf_is_usb(rt2x00dev) && 1493 if (rt2x00_is_usb(rt2x00dev) &&
1494 rt2x00_rev(rt2x00dev) == RT3070_VERSION) { 1494 rt2x00_rev(rt2x00dev) == RT3070_VERSION) {
1495 rt2800_bbp_write(rt2x00dev, 70, 0x0a); 1495 rt2800_bbp_write(rt2x00dev, 70, 0x0a);
1496 rt2800_bbp_write(rt2x00dev, 84, 0x99); 1496 rt2800_bbp_write(rt2x00dev, 84, 0x99);
@@ -1582,11 +1582,11 @@ int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
1582 u8 rfcsr; 1582 u8 rfcsr;
1583 u8 bbp; 1583 u8 bbp;
1584 1584
1585 if (rt2x00_intf_is_usb(rt2x00dev) && 1585 if (rt2x00_is_usb(rt2x00dev) &&
1586 rt2x00_rev(rt2x00dev) != RT3070_VERSION) 1586 rt2x00_rev(rt2x00dev) != RT3070_VERSION)
1587 return 0; 1587 return 0;
1588 1588
1589 if (rt2x00_intf_is_pci(rt2x00dev)) { 1589 if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) {
1590 if (!rt2x00_rf(rt2x00dev, RF3020) && 1590 if (!rt2x00_rf(rt2x00dev, RF3020) &&
1591 !rt2x00_rf(rt2x00dev, RF3021) && 1591 !rt2x00_rf(rt2x00dev, RF3021) &&
1592 !rt2x00_rf(rt2x00dev, RF3022)) 1592 !rt2x00_rf(rt2x00dev, RF3022))
@@ -1603,7 +1603,7 @@ int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
1603 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0); 1603 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
1604 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); 1604 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
1605 1605
1606 if (rt2x00_intf_is_usb(rt2x00dev)) { 1606 if (rt2x00_is_usb(rt2x00dev)) {
1607 rt2800_rfcsr_write(rt2x00dev, 4, 0x40); 1607 rt2800_rfcsr_write(rt2x00dev, 4, 0x40);
1608 rt2800_rfcsr_write(rt2x00dev, 5, 0x03); 1608 rt2800_rfcsr_write(rt2x00dev, 5, 0x03);
1609 rt2800_rfcsr_write(rt2x00dev, 6, 0x02); 1609 rt2800_rfcsr_write(rt2x00dev, 6, 0x02);
@@ -1624,7 +1624,7 @@ int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
1624 rt2800_rfcsr_write(rt2x00dev, 25, 0x01); 1624 rt2800_rfcsr_write(rt2x00dev, 25, 0x01);
1625 rt2800_rfcsr_write(rt2x00dev, 27, 0x03); 1625 rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
1626 rt2800_rfcsr_write(rt2x00dev, 29, 0x1f); 1626 rt2800_rfcsr_write(rt2x00dev, 29, 0x1f);
1627 } else if (rt2x00_intf_is_pci(rt2x00dev)) { 1627 } else if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) {
1628 rt2800_rfcsr_write(rt2x00dev, 0, 0x50); 1628 rt2800_rfcsr_write(rt2x00dev, 0, 0x50);
1629 rt2800_rfcsr_write(rt2x00dev, 1, 0x01); 1629 rt2800_rfcsr_write(rt2x00dev, 1, 0x01);
1630 rt2800_rfcsr_write(rt2x00dev, 2, 0xf7); 1630 rt2800_rfcsr_write(rt2x00dev, 2, 0xf7);
@@ -1855,7 +1855,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
1855 1855
1856 rt2x00_set_chip_rf(rt2x00dev, value, reg); 1856 rt2x00_set_chip_rf(rt2x00dev, value, reg);
1857 1857
1858 if (rt2x00_intf_is_usb(rt2x00dev)) { 1858 if (rt2x00_is_usb(rt2x00dev)) {
1859 /* 1859 /*
1860 * The check for rt2860 is not a typo, some rt2870 hardware 1860 * The check for rt2860 is not a typo, some rt2870 hardware
1861 * identifies itself as rt2860 in the CSR register. 1861 * identifies itself as rt2860 in the CSR register.
@@ -2039,7 +2039,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2039 /* 2039 /*
2040 * Disable powersaving as default on PCI devices. 2040 * Disable powersaving as default on PCI devices.
2041 */ 2041 */
2042 if (rt2x00_intf_is_pci(rt2x00dev)) 2042 if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev))
2043 rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 2043 rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
2044 2044
2045 /* 2045 /*
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index daea0b7c416..d57531ce1f8 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1041,18 +1041,12 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
1041 /* 1041 /*
1042 * Read EEPROM into buffer 1042 * Read EEPROM into buffer
1043 */ 1043 */
1044 switch (rt2x00dev->chip.rt) { 1044 if (rt2x00_is_soc(rt2x00dev))
1045 case RT2880:
1046 case RT3052:
1047 rt2800pci_read_eeprom_soc(rt2x00dev); 1045 rt2800pci_read_eeprom_soc(rt2x00dev);
1048 break; 1046 else if (rt2800pci_efuse_detect(rt2x00dev))
1049 default: 1047 rt2800pci_read_eeprom_efuse(rt2x00dev);
1050 if (rt2800pci_efuse_detect(rt2x00dev)) 1048 else
1051 rt2800pci_read_eeprom_efuse(rt2x00dev); 1049 rt2800pci_read_eeprom_pci(rt2x00dev);
1052 else
1053 rt2800pci_read_eeprom_pci(rt2x00dev);
1054 break;
1055 }
1056 1050
1057 return rt2800_validate_eeprom(rt2x00dev); 1051 return rt2800_validate_eeprom(rt2x00dev);
1058} 1052}
@@ -1103,7 +1097,7 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1103 /* 1097 /*
1104 * This device requires firmware. 1098 * This device requires firmware.
1105 */ 1099 */
1106 if (!rt2x00_rt(rt2x00dev, RT2880) && !rt2x00_rt(rt2x00dev, RT3052)) 1100 if (!rt2x00_is_soc(rt2x00dev))
1107 __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); 1101 __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
1108 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); 1102 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags);
1109 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); 1103 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 43b70c6e4e9..d741367304b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -160,6 +160,7 @@ struct avg_val {
160enum rt2x00_chip_intf { 160enum rt2x00_chip_intf {
161 RT2X00_CHIP_INTF_PCI, 161 RT2X00_CHIP_INTF_PCI,
162 RT2X00_CHIP_INTF_USB, 162 RT2X00_CHIP_INTF_USB,
163 RT2X00_CHIP_INTF_SOC,
163}; 164};
164 165
165/* 166/*
@@ -976,16 +977,21 @@ static inline bool rt2x00_intf(struct rt2x00_dev *rt2x00dev,
976 return (rt2x00dev->chip.intf == intf); 977 return (rt2x00dev->chip.intf == intf);
977} 978}
978 979
979static inline bool rt2x00_intf_is_pci(struct rt2x00_dev *rt2x00dev) 980static inline bool rt2x00_is_pci(struct rt2x00_dev *rt2x00dev)
980{ 981{
981 return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI); 982 return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI);
982} 983}
983 984
984static inline bool rt2x00_intf_is_usb(struct rt2x00_dev *rt2x00dev) 985static inline bool rt2x00_is_usb(struct rt2x00_dev *rt2x00dev)
985{ 986{
986 return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_USB); 987 return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_USB);
987} 988}
988 989
990static inline bool rt2x00_is_soc(struct rt2x00_dev *rt2x00dev)
991{
992 return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
993}
994
989/** 995/**
990 * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. 996 * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes.
991 * @rt2x00dev: Pointer to &struct rt2x00_dev. 997 * @rt2x00dev: Pointer to &struct rt2x00_dev.
diff --git a/drivers/net/wireless/rt2x00/rt2x00soc.c b/drivers/net/wireless/rt2x00/rt2x00soc.c
index 19e684f8ffa..0d6b43afc4e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00soc.c
+++ b/drivers/net/wireless/rt2x00/rt2x00soc.c
@@ -94,11 +94,7 @@ int rt2x00soc_probe(struct platform_device *pdev,
94 rt2x00dev->irq = platform_get_irq(pdev, 0); 94 rt2x00dev->irq = platform_get_irq(pdev, 0);
95 rt2x00dev->name = pdev->dev.driver->name; 95 rt2x00dev->name = pdev->dev.driver->name;
96 96
97 /* 97 rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
98 * SoC devices mimic PCI behavior.
99 */
100 rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI);
101
102 rt2x00_set_chip_rt(rt2x00dev, chipset); 98 rt2x00_set_chip_rt(rt2x00dev, chipset);
103 99
104 retval = rt2x00soc_alloc_reg(rt2x00dev); 100 retval = rt2x00soc_alloc_reg(rt2x00dev);