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

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

diff -u --recursive --new-file v2.4.2/linux/drivers/net/declance.c linux/drivers/net/declance.c
@@ -554,6 +554,7 @@
 	ib = (struct lance_init_block *) (dev->mem_start);
 
 #ifdef TEST_HITS
+	{
 	int i;
 
 	printk("[");
@@ -566,8 +567,10 @@
 			       ib->brx_ring[i].rmd1_bits & LE_R1_OWN ? "." : "1");
 	}
 	printk("]");
+	}
 #endif
 
+
 	for (rd = &ib->brx_ring[lp->rx_new];
 	     !((bits = rd->rmd1_bits) & LE_R1_OWN);
 	     rd = &ib->brx_ring[lp->rx_new]) {
@@ -608,9 +611,11 @@
 			skb->dev = dev;
 			skb_reserve(skb, 2);	/* 16 byte align */
 			skb_put(skb, len);	/* make room */
+
 			cp_from_buf(skb->data,
 				 (char *) lp->rx_buf_ptr_cpu[lp->rx_new],
 				    len);
+
 			skb->protocol = eth_type_trans(skb, dev);
 			netif_rx(skb);
 			dev->last_rx = jiffies;
@@ -656,7 +661,7 @@
 
 			if (status & LE_T3_CLOS) {
 				lp->stats.tx_carrier_errors++;
-				printk("%s: Carrier Lost", dev->name);
+				printk("%s: Carrier Lost\n", dev->name);
 				/* Stop the lance */
 				writereg(&ll->rap, LE_CSR0);
 				writereg(&ll->rdp, LE_C0_STOP);
@@ -741,7 +746,7 @@
 	if (csr0 & LE_C0_MERR) {
 		volatile unsigned long int_stat = *(unsigned long *) (system_base + IOCTL + SIR);
 
-		printk("%s: Memory error, status %04x", dev->name, csr0);
+		printk("%s: Memory error, status %04x\n", dev->name, csr0);
 
 		if (int_stat & LANCE_DMA_MEMRDERR) {
 			printk("%s: DMA error\n", dev->name);
@@ -759,6 +764,7 @@
 		init_restart_lance(lp);
 		netif_wake_queue(dev);
 	}
+
 	writereg(&ll->rdp, LE_C0_INEA);
 	writereg(&ll->rdp, LE_C0_INEA);
 }
@@ -774,11 +780,6 @@
 
 	last_dev = dev;
 
-	/* Associate IRQ with lance_interrupt */
-	if (request_irq(dev->irq, &lance_interrupt, 0, lp->name, dev)) {
-		printk("Lance: Can't get irq %d\n", dev->irq);
-		return -EAGAIN;
-	}
 	/* Stop the Lance */
 	writereg(&ll->rap, LE_CSR0);
 	writereg(&ll->rdp, LE_C0_STOP);
@@ -798,6 +799,12 @@
 
 	netif_start_queue(dev);
 
+	/* Associate IRQ with lance_interrupt */
+	if (request_irq(dev->irq, &lance_interrupt, 0, lp->name, dev)) {
+		printk("Lance: Can't get irq %d\n", dev->irq);
+		return -EAGAIN;
+	}
+
 	status = init_restart_lance(lp);
 
 	/*
@@ -999,7 +1006,7 @@
 	lance_set_multicast(dev);
 }
 
-static int __init dec_lance_init(struct net_device *dev, const int type)
+static int __init dec_lance_init(const int type)
 {
 	static unsigned version_printed;
 	struct net_device *dev;
@@ -1008,6 +1015,7 @@
 	int i, ret;
 	unsigned long esar_base;
 	unsigned char *esar;
+	struct net_device *dev;
 
 #ifndef CONFIG_TC
 	system_base = KN01_LANCE_BASE;
@@ -1018,12 +1026,12 @@
 	if (dec_lance_debug && version_printed++ == 0)
 		printk(version);
 
-	dev = init_etherdev(0, sizeof(struct lance_private));
+	dev = init_etherdev(NULL, sizeof(struct lance_private));
 	if (!dev)
 		return -ENOMEM;
 
 	/* init_etherdev ensures the data structures used by the LANCE are aligned. */
-	lp = (struct lance_private *) dev->priv;
+	lp = dev->priv;
 	spin_lock_init(&lp->lock);
 
 	switch (type) {
@@ -1035,10 +1043,13 @@
 		/*
 		 * FIXME: ugly hack!
 		 */
-		dev->mem_start = KSEG1ADDR(0x0020000);
+		dev->mem_start = KSEG1ADDR(0x00020000);
 		dev->mem_end = dev->mem_start + 0x00020000;
 		dev->irq = ETHER;
 		esar_base = system_base + ESAR;
+	
+		/* Workaround crash with booting KN04 2.1k from Disk */
+		memset(dev->mem_start, 0, dev->mem_end - dev->mem_start);
 
 		/*
 		 * setup the pointer arrays, this sucks [tm] :-(
@@ -1206,13 +1217,13 @@
 /* Find all the lance cards on the system and initialize them */
 static int __init dec_lance_probe(void)
 {
-	struct net_device *dev = NULL;
 	static int called = 0;
 
 #ifdef MODULE
 	root_lance_dev = NULL;
 #endif
 
+
 #ifdef CONFIG_TC
 	int slot = -1;
 
@@ -1244,7 +1255,7 @@
 	}
 #endif
 
-	return dec_lance_init(dev, type);
+	return dec_lance_init(type);
 }
 
 static void __exit dec_lance_cleanup(void)

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