[vortex] 3Com 3c556B

Louis Gerbarg gerbal@rpi.edu
Mon, 25 Sep 2000 00:06:42 -0400 (EDT)


Okay, here are a bunch of patches. They all currently use HAS_MII, though
they might be better off using HAS_NWAY. 

There are 3 patches here, one for the netdriver package, one against
2.2.17, and one againt 2.4.0-test8. This code fixes the reset issue the
driver had been having. I have tested all 3 versions, though not
exhaustively.

Enjoy.

Louis

netdrivers.patch:

diff -u -r netdrivers2/3c59x.c netdrivers/3c59x.c
--- netdrivers2/3c59x.c	Mon Aug  7 18:58:58 2000
+++ netdrivers/3c59x.c	Sun Sep 24 19:39:28 2000
@@ -225,7 +225,7 @@
 #define CYCLONE_SIZE 0x80
 enum { IS_VORTEX=1, IS_BOOMERANG=2, IS_CYCLONE=4, IS_TORNADO=8,
 	   HAS_PWR_CTRL=0x10, HAS_MII=0x20, HAS_NWAY=0x40, HAS_CB_FNS=0x80,
-	   EEPROM_8BIT=0x200, INVERT_LED_PWR=0x400, MII_XCVR_PWR=0x4000, };
+	   EEPROM_8BIT=0x200, INVERT_LED_PWR=0x400, EEPROM_OFFSET=0x800, WEIRD_RESET=0x1000, MII_XCVR_PWR=0x4000, };
 static void *vortex_probe1(struct pci_dev *pdev, void *init_dev,
 						   long ioaddr, int irq, int chip_idx, int find_cnt);
 static int pwr_event(void *dev_instance, int event);
@@ -278,6 +278,8 @@
 	 PCI_IOTYPE, CYCLONE_SIZE, IS_CYCLONE, },
 	{"3c556 Laptop Tornado",{ 0x605510B7, 0xffffffff },
 	 PCI_IOTYPE, CYCLONE_SIZE, IS_TORNADO|HAS_NWAY|EEPROM_8BIT, },
+	{"3c556B Laptop Hurricane", { 0x605610B7, 0xffffffff },
+	 PCI_IOTYPE, CYCLONE_SIZE, IS_TORNADO|HAS_MII|EEPROM_OFFSET|INVERT_LED_PWR|MII_XCVR_PWR|WEIRD_RESET,},
 	{"3c556 series Laptop Tornado",{ 0x605510B7, 0xf0ffffff },
 	 PCI_IOTYPE, CYCLONE_SIZE, IS_TORNADO|HAS_NWAY|EEPROM_8BIT, },
 	{"3c575 Boomerang CardBus",	{ 0x505710B7, 0xffffffff },
@@ -798,11 +800,12 @@
 		vp->medialock = 1;
 	vp->options = option;
 
+
 	/* Read the station address from the EEPROM. */
 	EL3WINDOW(0);
 	for (i = 0; i < 0x40; i++) {
 		int timer;
-		outw((drv_flags & EEPROM_8BIT ? 0x230 : EEPROM_Read) + i,
+		outw((drv_flags & EEPROM_8BIT ? 0x230 : (drv_flags & EEPROM_OFFSET ? EEPROM_Read + 0x30 : EEPROM_Read)) + i,
 			  ioaddr + Wn0EepromCmd);
 		/* The read may take up to 162 usec, timed with PCI cycles. */
 		for (timer = 162*5; timer >= 0; timer--) {
@@ -2337,7 +2340,10 @@
 	while (root_vortex_dev) {
 		struct vortex_private *vp=(void *)(root_vortex_dev->priv);
 		unregister_netdev(root_vortex_dev);
-		outw(TotalReset, root_vortex_dev->base_addr + EL3_CMD);
+		if(vp->drv_flags & WEIRD_RESET)
+		{
+			outw(TotalReset | 0xff, root_vortex_dev->base_addr + EL3_CMD);
+		}
 #ifdef USE_MEM_OPS
 		iounmap((char *)root_vortex_dev->base_addr);
 #else

2.2.17.patch:

diff -u -r /root/linux/drivers/net/3c59x.c linux-2.2.17/drivers/net/3c59x.c
--- /root/linux/drivers/net/3c59x.c	Mon Sep  4 13:39:18 2000
+++ linux-2.2.17/drivers/net/3c59x.c	Sun Sep 24 21:49:39 2000
@@ -336,6 +336,8 @@
 	 PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE, 128, vortex_probe1},
 	{"3c556 10/100 Mini PCI Adapter",	0x10B7, 0x6055, 0xffff,
 	 PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_CB_FNS, 128, vortex_probe1},
+	{"3c556B 10/100 Mini PCI Adapter",	0x10B7, 0x6056, 0xffff,
+	 PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_MII, 128, vortex_probe1},
 	{"3c575 Boomerang CardBus",		0x10B7, 0x5057, 0xffff,
 	 PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII, 64, vortex_probe1},
 	{"3CCFE575 Cyclone CardBus",	0x10B7, 0x5157, 0xffff,
@@ -932,6 +934,8 @@
 #else
 		if (pci_tbl[chip_idx].device_id == 0x6055) {
 			outw(0x230 + i, ioaddr + Wn0EepromCmd);
+		} else if  (pci_tbl[chip_idx].device_id == 0x6056) {
+			outw(EEPROM_Read + 0x30 + i, ioaddr + Wn0EepromCmd);
 		} else {
 			outw(EEPROM_Read + i, ioaddr + Wn0EepromCmd);
 		}
@@ -2357,7 +2361,12 @@
 		struct vortex_private *vp=(void *)(root_vortex_dev->priv);
 		next_dev = vp->next_module;
 		unregister_netdev(root_vortex_dev);
-		outw(TotalReset, root_vortex_dev->base_addr + EL3_CMD);
+		if(pci_tbl[vp->chip_id].device_id==0x6056)
+		{
+			outw(TotalReset | 0xff, root_vortex_dev->base_addr + EL3_CMD);
+		} else {
+			outw(TotalReset, root_vortex_dev->base_addr + EL3_CMD);
+		}
 		release_region(root_vortex_dev->base_addr,
 					   pci_tbl[vp->chip_id].io_size);
 		kfree(root_vortex_dev);

2.4.0-test8.patch:

diff -u -r /root/linux/drivers/net/3c59x.c linux/drivers/net/3c59x.c
--- /root/linux/drivers/net/3c59x.c	Sun Aug 13 22:27:39 2000
+++ linux/drivers/net/3c59x.c	Sun Sep 24 23:23:24 2000
@@ -303,7 +303,7 @@
 enum {	IS_VORTEX=1, IS_BOOMERANG=2, IS_CYCLONE=4, IS_TORNADO=8,
 	EEPROM_8BIT=0x10,	/* AKPM: Uses 0x230 as the base bitmaps for EEPROM reads */
 	HAS_PWR_CTRL=0x20, HAS_MII=0x40, HAS_NWAY=0x80, HAS_CB_FNS=0x100,
-	INVERT_MII_PWR=0x200, INVERT_LED_PWR=0x400 };
+	INVERT_MII_PWR=0x200, INVERT_LED_PWR=0x400, EEPROM_OFFSET=0x800, WEIRD_RESET=0x1000, };
 
 
 enum vortex_chips {
@@ -334,6 +334,7 @@
 	CH_3CSOHO100_TX,
 	CH_3C555,
 	CH_3C556,
+	CH_3C556B,
 	CH_3C575,
 	CH_3C575_1,
 
@@ -408,6 +409,8 @@
 	 PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE, 128, },
 	{"3c556 10/100 Mini PCI Adapter",
 	 PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|EEPROM_8BIT|HAS_CB_FNS|INVERT_MII_PWR, 128, },
+	{"3c556B 10/100 Mini PCI Adapter", 
+	 PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_MII|EEPROM_OFFSET|WEIRD_RESET|INVERT_MII_PWR|INVERT_LED_PWR, 128, },
 	{"3c575 [Megahertz] 10/100 LAN 	CardBus",
 	 PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
 	{"3c575 Boomerang CardBus",
@@ -458,6 +461,7 @@
 	{ 0x10B7, 0x7646, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3CSOHO100_TX },
 	{ 0x10B7, 0x5055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C555 },
 	{ 0x10B7, 0x6055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C556 },
+	{ 0x10B7, 0x6056, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C556B },
 	{ 0x10B7, 0x5b57, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C575 },
 	{ 0x10B7, 0x5057, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C575_1 },
 
@@ -841,6 +845,7 @@
 	int option;
 	unsigned int eeprom[0x40], checksum = 0;		/* EEPROM contents */
 	int i;
+	int base;
 	struct net_device *dev;
 	static int printed_version = 0;
 	int retval;
@@ -952,7 +957,14 @@
 	/* Read the station address from the EEPROM. */
 	EL3WINDOW(0);
 	{
-		int base = (vci->drv_flags & EEPROM_8BIT) ? 0x230 : EEPROM_Read;
+		if(vci->drv_flags & EEPROM_8BIT)
+		{
+			base = 0x230;
+		} else if (vci->drv_flags & EEPROM_OFFSET) {
+			base = 0x30 + EEPROM_Read;
+		} else {
+			base = EEPROM_Read;
+		}
 		for (i = 0; i < 0x40; i++) {
 			int timer;
 			outw(base + i, ioaddr + Wn0EepromCmd);
@@ -2570,7 +2582,12 @@
 	 * here
 	 */
 	unregister_netdev(dev);
-	outw(TotalReset, dev->base_addr + EL3_CMD);
+	if(vp->drv_flags & WEIRD_RESET)
+	{
+		outw(TotalReset | 0xff, dev->base_addr + EL3_CMD);
+	} else {
+		outw(TotalReset, dev->base_addr + EL3_CMD);
+	}
 	if (vp->must_free_region)
 		release_region(dev->base_addr, vp->io_size);
 	kfree(dev);