diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 104 |
1 files changed, 35 insertions, 69 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index dfc886fcb44d..aca8c124f434 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -48,14 +48,6 @@ | |||
48 | #include "rt2800.h" | 48 | #include "rt2800.h" |
49 | #include "rt2800pci.h" | 49 | #include "rt2800pci.h" |
50 | 50 | ||
51 | #ifdef CONFIG_RT2800PCI_PCI_MODULE | ||
52 | #define CONFIG_RT2800PCI_PCI | ||
53 | #endif | ||
54 | |||
55 | #ifdef CONFIG_RT2800PCI_WISOC_MODULE | ||
56 | #define CONFIG_RT2800PCI_WISOC | ||
57 | #endif | ||
58 | |||
59 | /* | 51 | /* |
60 | * Allow hardware encryption to be disabled. | 52 | * Allow hardware encryption to be disabled. |
61 | */ | 53 | */ |
@@ -87,7 +79,7 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token) | |||
87 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 79 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
88 | } | 80 | } |
89 | 81 | ||
90 | #ifdef CONFIG_RT2800PCI_WISOC | 82 | #ifdef CONFIG_RT2800PCI_SOC |
91 | static void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | 83 | static void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) |
92 | { | 84 | { |
93 | u32 *base_addr = (u32 *) KSEG1ADDR(0x1F040000); /* XXX for RT3052 */ | 85 | u32 *base_addr = (u32 *) KSEG1ADDR(0x1F040000); /* XXX for RT3052 */ |
@@ -98,7 +90,7 @@ static void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | |||
98 | static inline void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | 90 | static inline void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) |
99 | { | 91 | { |
100 | } | 92 | } |
101 | #endif /* CONFIG_RT2800PCI_WISOC */ | 93 | #endif /* CONFIG_RT2800PCI_SOC */ |
102 | 94 | ||
103 | #ifdef CONFIG_RT2800PCI_PCI | 95 | #ifdef CONFIG_RT2800PCI_PCI |
104 | static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) | 96 | static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) |
@@ -461,24 +453,6 @@ static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev, | |||
461 | rt2800_register_write(rt2x00dev, INT_MASK_CSR, reg); | 453 | rt2800_register_write(rt2x00dev, INT_MASK_CSR, reg); |
462 | } | 454 | } |
463 | 455 | ||
464 | static int rt2800pci_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) | ||
465 | { | ||
466 | unsigned int i; | ||
467 | u32 reg; | ||
468 | |||
469 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | ||
470 | rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); | ||
471 | if (!rt2x00_get_field32(reg, WPDMA_GLO_CFG_TX_DMA_BUSY) && | ||
472 | !rt2x00_get_field32(reg, WPDMA_GLO_CFG_RX_DMA_BUSY)) | ||
473 | return 0; | ||
474 | |||
475 | msleep(1); | ||
476 | } | ||
477 | |||
478 | ERROR(rt2x00dev, "WPDMA TX/RX busy, aborting.\n"); | ||
479 | return -EACCES; | ||
480 | } | ||
481 | |||
482 | static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev) | 456 | static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev) |
483 | { | 457 | { |
484 | u32 reg; | 458 | u32 reg; |
@@ -487,10 +461,10 @@ static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
487 | /* | 461 | /* |
488 | * Initialize all registers. | 462 | * Initialize all registers. |
489 | */ | 463 | */ |
490 | if (unlikely(rt2800pci_wait_wpdma_ready(rt2x00dev) || | 464 | if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) || |
491 | rt2800pci_init_queues(rt2x00dev) || | 465 | rt2800pci_init_queues(rt2x00dev) || |
492 | rt2800_init_registers(rt2x00dev) || | 466 | rt2800_init_registers(rt2x00dev) || |
493 | rt2800pci_wait_wpdma_ready(rt2x00dev) || | 467 | rt2800_wait_wpdma_ready(rt2x00dev) || |
494 | rt2800_init_bbp(rt2x00dev) || | 468 | rt2800_init_bbp(rt2x00dev) || |
495 | rt2800_init_rfcsr(rt2x00dev))) | 469 | rt2800_init_rfcsr(rt2x00dev))) |
496 | return -EIO; | 470 | return -EIO; |
@@ -570,7 +544,7 @@ static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
570 | rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00); | 544 | rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00); |
571 | 545 | ||
572 | /* Wait for DMA, ignore error */ | 546 | /* Wait for DMA, ignore error */ |
573 | rt2800pci_wait_wpdma_ready(rt2x00dev); | 547 | rt2800_wait_wpdma_ready(rt2x00dev); |
574 | } | 548 | } |
575 | 549 | ||
576 | static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev, | 550 | static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev, |
@@ -835,7 +809,6 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry, | |||
835 | struct rxdone_entry_desc *rxdesc) | 809 | struct rxdone_entry_desc *rxdesc) |
836 | { | 810 | { |
837 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 811 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
838 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
839 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 812 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
840 | __le32 *rxd = entry_priv->desc; | 813 | __le32 *rxd = entry_priv->desc; |
841 | __le32 *rxwi = (__le32 *)entry->skb->data; | 814 | __le32 *rxwi = (__le32 *)entry->skb->data; |
@@ -883,10 +856,8 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry, | |||
883 | if (rt2x00_get_field32(rxd3, RXD_W3_MY_BSS)) | 856 | if (rt2x00_get_field32(rxd3, RXD_W3_MY_BSS)) |
884 | rxdesc->dev_flags |= RXDONE_MY_BSS; | 857 | rxdesc->dev_flags |= RXDONE_MY_BSS; |
885 | 858 | ||
886 | if (rt2x00_get_field32(rxd3, RXD_W3_L2PAD)) { | 859 | if (rt2x00_get_field32(rxd3, RXD_W3_L2PAD)) |
887 | rxdesc->dev_flags |= RXDONE_L2PAD; | 860 | rxdesc->dev_flags |= RXDONE_L2PAD; |
888 | skbdesc->flags |= SKBDESC_L2_PADDED; | ||
889 | } | ||
890 | 861 | ||
891 | if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI)) | 862 | if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI)) |
892 | rxdesc->flags |= RX_FLAG_SHORT_GI; | 863 | rxdesc->flags |= RX_FLAG_SHORT_GI; |
@@ -927,7 +898,6 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry, | |||
927 | * Remove TXWI descriptor from start of buffer. | 898 | * Remove TXWI descriptor from start of buffer. |
928 | */ | 899 | */ |
929 | skb_pull(entry->skb, RXWI_DESC_SIZE); | 900 | skb_pull(entry->skb, RXWI_DESC_SIZE); |
930 | skb_trim(entry->skb, rxdesc->size); | ||
931 | } | 901 | } |
932 | 902 | ||
933 | /* | 903 | /* |
@@ -1071,18 +1041,12 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1071 | /* | 1041 | /* |
1072 | * Read EEPROM into buffer | 1042 | * Read EEPROM into buffer |
1073 | */ | 1043 | */ |
1074 | switch (rt2x00dev->chip.rt) { | 1044 | if (rt2x00_is_soc(rt2x00dev)) |
1075 | case RT2880: | ||
1076 | case RT3052: | ||
1077 | rt2800pci_read_eeprom_soc(rt2x00dev); | 1045 | rt2800pci_read_eeprom_soc(rt2x00dev); |
1078 | break; | 1046 | else if (rt2800pci_efuse_detect(rt2x00dev)) |
1079 | default: | 1047 | rt2800pci_read_eeprom_efuse(rt2x00dev); |
1080 | if (rt2800pci_efuse_detect(rt2x00dev)) | 1048 | else |
1081 | rt2800pci_read_eeprom_efuse(rt2x00dev); | 1049 | rt2800pci_read_eeprom_pci(rt2x00dev); |
1082 | else | ||
1083 | rt2800pci_read_eeprom_pci(rt2x00dev); | ||
1084 | break; | ||
1085 | } | ||
1086 | 1050 | ||
1087 | return rt2800_validate_eeprom(rt2x00dev); | 1051 | return rt2800_validate_eeprom(rt2x00dev); |
1088 | } | 1052 | } |
@@ -1133,8 +1097,7 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1133 | /* | 1097 | /* |
1134 | * This device requires firmware. | 1098 | * This device requires firmware. |
1135 | */ | 1099 | */ |
1136 | if (!rt2x00_rt(&rt2x00dev->chip, RT2880) && | 1100 | if (!rt2x00_is_soc(rt2x00dev)) |
1137 | !rt2x00_rt(&rt2x00dev->chip, RT3052)) | ||
1138 | __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); | 1101 | __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); |
1139 | __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); | 1102 | __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); |
1140 | __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); | 1103 | __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); |
@@ -1221,8 +1184,11 @@ static const struct rt2x00_ops rt2800pci_ops = { | |||
1221 | /* | 1184 | /* |
1222 | * RT2800pci module information. | 1185 | * RT2800pci module information. |
1223 | */ | 1186 | */ |
1224 | static struct pci_device_id rt2800pci_device_table[] = { | 1187 | static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table) = { |
1225 | { PCI_DEVICE(0x1462, 0x891a), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1188 | { PCI_DEVICE(0x1814, 0x0601), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1189 | { PCI_DEVICE(0x1814, 0x0681), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1190 | { PCI_DEVICE(0x1814, 0x0701), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1191 | { PCI_DEVICE(0x1814, 0x0781), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1226 | { PCI_DEVICE(0x1432, 0x7708), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1192 | { PCI_DEVICE(0x1432, 0x7708), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1227 | { PCI_DEVICE(0x1432, 0x7727), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1193 | { PCI_DEVICE(0x1432, 0x7727), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1228 | { PCI_DEVICE(0x1432, 0x7728), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1194 | { PCI_DEVICE(0x1432, 0x7728), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
@@ -1230,18 +1196,19 @@ static struct pci_device_id rt2800pci_device_table[] = { | |||
1230 | { PCI_DEVICE(0x1432, 0x7748), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1196 | { PCI_DEVICE(0x1432, 0x7748), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1231 | { PCI_DEVICE(0x1432, 0x7758), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1197 | { PCI_DEVICE(0x1432, 0x7758), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1232 | { PCI_DEVICE(0x1432, 0x7768), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1198 | { PCI_DEVICE(0x1432, 0x7768), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1233 | { PCI_DEVICE(0x1814, 0x0601), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1199 | { PCI_DEVICE(0x1a3b, 0x1059), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1234 | { PCI_DEVICE(0x1814, 0x0681), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1200 | #ifdef CONFIG_RT2800PCI_RT30XX |
1235 | { PCI_DEVICE(0x1814, 0x0701), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1236 | { PCI_DEVICE(0x1814, 0x0781), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1237 | { PCI_DEVICE(0x1814, 0x3060), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1238 | { PCI_DEVICE(0x1814, 0x3062), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1239 | { PCI_DEVICE(0x1814, 0x3090), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1201 | { PCI_DEVICE(0x1814, 0x3090), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1240 | { PCI_DEVICE(0x1814, 0x3091), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1202 | { PCI_DEVICE(0x1814, 0x3091), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1241 | { PCI_DEVICE(0x1814, 0x3092), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1203 | { PCI_DEVICE(0x1814, 0x3092), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1204 | { PCI_DEVICE(0x1462, 0x891a), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1205 | #endif | ||
1206 | #ifdef CONFIG_RT2800PCI_RT35XX | ||
1207 | { PCI_DEVICE(0x1814, 0x3060), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1208 | { PCI_DEVICE(0x1814, 0x3062), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1242 | { PCI_DEVICE(0x1814, 0x3562), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1209 | { PCI_DEVICE(0x1814, 0x3562), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1243 | { PCI_DEVICE(0x1814, 0x3592), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1210 | { PCI_DEVICE(0x1814, 0x3592), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1244 | { PCI_DEVICE(0x1a3b, 0x1059), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1211 | #endif |
1245 | { 0, } | 1212 | { 0, } |
1246 | }; | 1213 | }; |
1247 | 1214 | ||
@@ -1255,12 +1222,11 @@ MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); | |||
1255 | #endif /* CONFIG_RT2800PCI_PCI */ | 1222 | #endif /* CONFIG_RT2800PCI_PCI */ |
1256 | MODULE_LICENSE("GPL"); | 1223 | MODULE_LICENSE("GPL"); |
1257 | 1224 | ||
1258 | #ifdef CONFIG_RT2800PCI_WISOC | 1225 | #ifdef CONFIG_RT2800PCI_SOC |
1259 | #if defined(CONFIG_RALINK_RT288X) | 1226 | static int rt2800soc_probe(struct platform_device *pdev) |
1260 | __rt2x00soc_probe(RT2880, &rt2800pci_ops); | 1227 | { |
1261 | #elif defined(CONFIG_RALINK_RT305X) | 1228 | return rt2x00soc_probe(pdev, rt2800pci_ops); |
1262 | __rt2x00soc_probe(RT3052, &rt2800pci_ops); | 1229 | } |
1263 | #endif | ||
1264 | 1230 | ||
1265 | static struct platform_driver rt2800soc_driver = { | 1231 | static struct platform_driver rt2800soc_driver = { |
1266 | .driver = { | 1232 | .driver = { |
@@ -1268,12 +1234,12 @@ static struct platform_driver rt2800soc_driver = { | |||
1268 | .owner = THIS_MODULE, | 1234 | .owner = THIS_MODULE, |
1269 | .mod_name = KBUILD_MODNAME, | 1235 | .mod_name = KBUILD_MODNAME, |
1270 | }, | 1236 | }, |
1271 | .probe = __rt2x00soc_probe, | 1237 | .probe = rt2800soc_probe, |
1272 | .remove = __devexit_p(rt2x00soc_remove), | 1238 | .remove = __devexit_p(rt2x00soc_remove), |
1273 | .suspend = rt2x00soc_suspend, | 1239 | .suspend = rt2x00soc_suspend, |
1274 | .resume = rt2x00soc_resume, | 1240 | .resume = rt2x00soc_resume, |
1275 | }; | 1241 | }; |
1276 | #endif /* CONFIG_RT2800PCI_WISOC */ | 1242 | #endif /* CONFIG_RT2800PCI_SOC */ |
1277 | 1243 | ||
1278 | #ifdef CONFIG_RT2800PCI_PCI | 1244 | #ifdef CONFIG_RT2800PCI_PCI |
1279 | static struct pci_driver rt2800pci_driver = { | 1245 | static struct pci_driver rt2800pci_driver = { |
@@ -1290,7 +1256,7 @@ static int __init rt2800pci_init(void) | |||
1290 | { | 1256 | { |
1291 | int ret = 0; | 1257 | int ret = 0; |
1292 | 1258 | ||
1293 | #ifdef CONFIG_RT2800PCI_WISOC | 1259 | #ifdef CONFIG_RT2800PCI_SOC |
1294 | ret = platform_driver_register(&rt2800soc_driver); | 1260 | ret = platform_driver_register(&rt2800soc_driver); |
1295 | if (ret) | 1261 | if (ret) |
1296 | return ret; | 1262 | return ret; |
@@ -1298,7 +1264,7 @@ static int __init rt2800pci_init(void) | |||
1298 | #ifdef CONFIG_RT2800PCI_PCI | 1264 | #ifdef CONFIG_RT2800PCI_PCI |
1299 | ret = pci_register_driver(&rt2800pci_driver); | 1265 | ret = pci_register_driver(&rt2800pci_driver); |
1300 | if (ret) { | 1266 | if (ret) { |
1301 | #ifdef CONFIG_RT2800PCI_WISOC | 1267 | #ifdef CONFIG_RT2800PCI_SOC |
1302 | platform_driver_unregister(&rt2800soc_driver); | 1268 | platform_driver_unregister(&rt2800soc_driver); |
1303 | #endif | 1269 | #endif |
1304 | return ret; | 1270 | return ret; |
@@ -1313,7 +1279,7 @@ static void __exit rt2800pci_exit(void) | |||
1313 | #ifdef CONFIG_RT2800PCI_PCI | 1279 | #ifdef CONFIG_RT2800PCI_PCI |
1314 | pci_unregister_driver(&rt2800pci_driver); | 1280 | pci_unregister_driver(&rt2800pci_driver); |
1315 | #endif | 1281 | #endif |
1316 | #ifdef CONFIG_RT2800PCI_WISOC | 1282 | #ifdef CONFIG_RT2800PCI_SOC |
1317 | platform_driver_unregister(&rt2800soc_driver); | 1283 | platform_driver_unregister(&rt2800soc_driver); |
1318 | #endif | 1284 | #endif |
1319 | } | 1285 | } |