patch-2.4.3 linux/drivers/net/eepro.c

Next file: linux/drivers/net/eexpress.c
Previous file: linux/drivers/net/dmfe.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.2/linux/drivers/net/eepro.c linux/drivers/net/eepro.c
@@ -23,6 +23,7 @@
 	This is a compatibility hardware problem.
 
 	Versions:
+	0.12c	fixing some problems with old cards (aris, 01/08/2001)
 	0.12b	misc fixes (aris, 06/26/2000)
 	0.12a   port of version 0.12a of 2.2.x kernels to 2.3.x
 		(aris (aris@conectiva.com.br), 05/19/2000)
@@ -96,7 +97,7 @@
 */
 
 static const char *version =
-	"eepro.c: v0.12b 04/26/2000 aris@conectiva.com.br\n";
+	"eepro.c: v0.12c 01/08/2000 aris@conectiva.com.br\n";
 
 #include <linux/module.h>
 
@@ -501,8 +502,10 @@
 /* set diagnose flag */
 #define eepro_diag(ioaddr) outb(DIAGNOSE_CMD, ioaddr)
 
+#ifdef ANSWER_TX_AND_RX		/* experimental way of handling interrupts */
 /* ack for rx/tx int */
 #define eepro_ack_rxtx(ioaddr) outb (RX_INT | TX_INT, ioaddr + STATUS_REG)
+#endif
 
 /* ack for rx int */
 #define eepro_ack_rx(ioaddr) outb (RX_INT, ioaddr + STATUS_REG)
@@ -585,7 +588,7 @@
 	return -ENODEV;
 }
 
-void printEEPROMInfo(short ioaddr, struct net_device *dev)
+static void printEEPROMInfo(short ioaddr, struct net_device *dev)
 {
 	unsigned short Word;
 	int i,j;
@@ -776,7 +779,8 @@
 				}
 				if (dev->irq < 2) {
 					printk(" Duh! illegal interrupt vector stored in EEPROM.\n");
-						return -ENODEV;
+					kfree(dev->priv);
+					return -ENODEV;
 				} else 
 				
 				if (dev->irq==2)
@@ -950,6 +954,7 @@
 		|| (irq2dev_map[dev->irq] = dev) == 0) && 
 		(irq2dev_map[dev->irq]!=dev)) {
 		/* printk("%s: IRQ map wrong\n", dev->name); */
+	        free_irq(dev->irq, dev);
 		return -EAGAIN;
 	}
 #endif
@@ -1067,6 +1072,8 @@
 	}
 	
 	eepro_sel_reset(ioaddr);
+	SLOW_DOWN;
+	SLOW_DOWN;
 
 	lp->tx_start = lp->tx_end = XMT_LOWER_LIMIT << 8;
 	lp->tx_last = 0;
@@ -1162,9 +1169,11 @@
 	while (((status = inb(ioaddr + STATUS_REG)) & 0x06) && (boguscount--))
 	{
 		switch (status & (RX_INT | TX_INT)) {
+#ifdef ANSWER_TX_AND_RX
 			case (RX_INT | TX_INT):
 				eepro_ack_rxtx(ioaddr);
 				break;
+#endif
 			case RX_INT:
 				eepro_ack_rx(ioaddr);
 				break;
@@ -1178,6 +1187,9 @@
 
 			/* Get the received packets */
 			eepro_rx(dev);
+#ifndef ANSWER_TX_AND_RX
+			continue;
+#endif
 		}
 		if (status & TX_INT) {
 			if (net_debug > 4)
@@ -1367,7 +1379,11 @@
 		/* Re-enable RX and TX interrupts */
 		eepro_en_int(ioaddr);
 	}
-	eepro_complete_selreset(ioaddr);
+	if (lp->eepro == LAN595FX_10ISA) {
+		eepro_complete_selreset(ioaddr);
+	}
+	else
+		eepro_en_rx(ioaddr);
 }
 
 /* The horrible routine to read a word from the serial EEPROM. */
@@ -1535,7 +1551,9 @@
 			printk(KERN_DEBUG "%s: exiting hardware_send_packet routine.\n", dev->name);
 		return;
 	}
-	netif_stop_queue(dev);
+	if (lp->eepro == LAN595FX_10ISA)
+		netif_stop_queue(dev);
+
 	if (net_debug > 5)
 		printk(KERN_DEBUG "%s: exiting hardware_send_packet routine.\n", dev->name);
 }
@@ -1591,6 +1609,7 @@
 	
 			skb->protocol = eth_type_trans(skb,dev);	
 			netif_rx(skb);
+			dev->last_rx = jiffies;
 			lp->stats.rx_packets++;
 		}
 		
@@ -1654,9 +1673,13 @@
 		xmt_status = inw(ioaddr+IO_PORT);
 		
 		if ((xmt_status & TX_DONE_BIT) == 0) {
-			udelay(40);
-			boguscount--;
-			continue;
+			if (lp->eepro == LAN595FX_10ISA) {
+				udelay(40);
+				boguscount--;
+				continue;
+			}
+			else
+				break;
 		}
 
 		xmt_status = inw(ioaddr+IO_PORT); 
@@ -1723,10 +1746,12 @@
 	 * interrupt again for tx. in other words: tx timeout what will take
 	 * a lot of time to happen, so we'll do a complete selreset.
 	 */
-	if (!boguscount)
+	if (!boguscount && lp->eepro == LAN595FX_10ISA)
 		eepro_complete_selreset(ioaddr);
 }
 
+#ifdef MODULE
+
 #define MAX_EEPRO 8
 static struct net_device dev_eepro[MAX_EEPRO];
 
@@ -1737,7 +1762,7 @@
 };
 static int autodetect;
 
-static int n_eepro = 0;
+static int n_eepro;
 /* For linux 2.1.xx */
 
 MODULE_AUTHOR("Pascal Dupuis <dupuis@lei.ucl.ac.be> for the 2.1 stuff (locking,...)");
@@ -1746,8 +1771,6 @@
 MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_EEPRO) "i");
 MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_EEPRO) "i");
 MODULE_PARM(autodetect, "1-" __MODULE_STRING(1) "i");
-
-#ifdef MODULE
 
 int 
 init_module(void)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)