dmfe/tulip: Let dmfe handle DM910x except for SPARC on-board chips

The Davicom DM9100 and DM9102 chips are used on the motherboards of
some SPARC systems (supported by the tulip driver) and also in PCI
expansion cards (supported by the dmfe driver). There is no
difference in the PCI device ids for the two different configurations,
so these drivers both claim the device ids. However, it is possible
to distinguish the two configurations by the presence of Open Firmware
properties for them, so we do that.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Ben Hutchings and committed by David S. Miller 4d907069 6837e895

+50 -7
+4
drivers/net/tulip/Kconfig
··· 101 101 102 102 If in doubt, say Y. 103 103 104 + config TULIP_DM910X 105 + def_bool y 106 + depends on TULIP && SPARC 107 + 104 108 config DE4X5 105 109 tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" 106 110 depends on PCI || EISA
+21
drivers/net/tulip/dmfe.c
··· 92 92 #include <asm/uaccess.h> 93 93 #include <asm/irq.h> 94 94 95 + #ifdef CONFIG_TULIP_DM910X 96 + #include <linux/of.h> 97 + #endif 98 + 95 99 96 100 /* Board/System/Debug information/definition ---------------- */ 97 101 #define PCI_DM9132_ID 0x91321282 /* Davicom DM9132 ID */ ··· 380 376 381 377 if (!printed_version++) 382 378 printk(version); 379 + 380 + /* 381 + * SPARC on-board DM910x chips should be handled by the main 382 + * tulip driver, except for early DM9100s. 383 + */ 384 + #ifdef CONFIG_TULIP_DM910X 385 + if ((ent->driver_data == PCI_DM9100_ID && pdev->revision >= 0x30) || 386 + ent->driver_data == PCI_DM9102_ID) { 387 + struct device_node *dp = pci_device_to_OF_node(pdev); 388 + 389 + if (dp && of_get_property(dp, "local-mac-address", NULL)) { 390 + printk(KERN_INFO DRV_NAME 391 + ": skipping on-board DM910x (use tulip)\n"); 392 + return -ENODEV; 393 + } 394 + } 395 + #endif 383 396 384 397 /* Init network device */ 385 398 dev = alloc_etherdev(sizeof(*db));
+25 -7
drivers/net/tulip/tulip_core.c
··· 196 196 | HAS_NWAY | HAS_PCI_MWI, tulip_timer, tulip_media_task }, 197 197 198 198 /* DM910X */ 199 + #ifdef CONFIG_TULIP_DM910X 199 200 { "Davicom DM9102/DM9102A", 128, 0x0001ebef, 200 201 HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI, 201 202 tulip_timer, tulip_media_task }, 203 + #else 204 + { NULL }, 205 + #endif 202 206 203 207 /* RS7112 */ 204 208 { "Conexant LANfinity", 256, 0x0001ebef, ··· 232 228 { 0x1259, 0xa120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 233 229 { 0x11F6, 0x9881, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMPEX9881 }, 234 230 { 0x8086, 0x0039, PCI_ANY_ID, PCI_ANY_ID, 0, 0, I21145 }, 231 + #ifdef CONFIG_TULIP_DM910X 235 232 { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, 236 233 { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, 234 + #endif 237 235 { 0x1113, 0x1216, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 238 236 { 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 }, 239 237 { 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, ··· 1305 1299 } 1306 1300 1307 1301 /* 1308 - * Early DM9100's need software CRC and the DMFE driver 1302 + * DM910x chips should be handled by the dmfe driver, except 1303 + * on-board chips on SPARC systems. Also, early DM9100s need 1304 + * software CRC which only the dmfe driver supports. 1309 1305 */ 1310 1306 1311 - if (pdev->vendor == 0x1282 && pdev->device == 0x9100) 1312 - { 1313 - /* Read Chip revision */ 1314 - if (pdev->revision < 0x30) 1315 - { 1316 - printk(KERN_ERR PFX "skipping early DM9100 with Crc bug (use dmfe)\n"); 1307 + #ifdef CONFIG_TULIP_DM910X 1308 + if (chip_idx == DM910X) { 1309 + struct device_node *dp; 1310 + 1311 + if (pdev->vendor == 0x1282 && pdev->device == 0x9100 && 1312 + pdev->revision < 0x30) { 1313 + printk(KERN_INFO PFX 1314 + "skipping early DM9100 with Crc bug (use dmfe)\n"); 1315 + return -ENODEV; 1316 + } 1317 + 1318 + dp = pci_device_to_OF_node(pdev); 1319 + if (!(dp && of_get_property(dp, "local-mac-address", NULL))) { 1320 + printk(KERN_INFO PFX 1321 + "skipping DM910x expansion card (use dmfe)\n"); 1317 1322 return -ENODEV; 1318 1323 } 1319 1324 } 1325 + #endif 1320 1326 1321 1327 /* 1322 1328 * Looks for early PCI chipsets where people report hangs