Fix for Donald Becker's DP83815 network driver (v1.07)

Steve Hill
2001-04-17T15:59:12Z

[-- Attachment #1: Type: TEXT/PLAIN, Size: 459 bytes --]

The attached patch fixes the following problems with the DP83815 driver
(natsemi.c):

1. When compiled into the kernel, the cards would be registered multiple
times.
2. Autonegotiation code was buggy, causing the card to stop working after
autonegotiation.

--

- Steve Hill
System Administrator Email: steve@navaho.co.uk
Navaho Technologies Ltd. Tel: +44-870-7034015

... Alcohol and calculus don't mix - Don't drink and derive! ...

[-- Attachment #2: Type: TEXT/PLAIN, Size: 1434 bytes --]

diff -urN linux.natsemi/drivers/net/natsemi.c linux/drivers/net/natsemi.c
--- linux.natsemi/drivers/net/natsemi.c Tue Apr 17 13:12:26 2001
+++ linux/drivers/net/natsemi.c Tue Apr 17 13:20:04 2001
@@ -19,6 +19,16 @@
http://www.scyld.com/network/netsemi.html
*/

+/*
+ 11 April 2001 Steve Hill <steve@navaho.co.uk>
+ Bugfix: When compiled into the kernel instead of as a module the driver
+ incorrectly registered multiple network cards.
+
+ 17 April 2001 Steve Hill <steve@navaho.co.uk>
+ Bugfix: Autonegotiation code was using writew() instead of writel() - this
+ resulted in the card failing after autonegotiation.
+*/
+
/* These identify the driver base version and may not be removed. */
static const char version1[] =
"natsemi.c:v1.07 1/9/2001 Written by Donald Becker <becker@scyld.com>\n";
@@ -363,8 +373,12 @@
#ifndef MODULE
int natsemi_probe(struct net_device *dev)
{
+ static int done = 0;
+
+ if (done) return -ENODEV;
if (pci_drv_register(&natsemi_drv_id, dev) < 0)
return -ENODEV;
+ done = 1;
printk(KERN_INFO "%s" KERN_INFO "%s", version1, version2);
return 0;
}
@@ -637,8 +651,8 @@
np->rx_config &= ~0x10000000;
np->tx_config &= ~0xC0000000;
}
- writew(np->tx_config, ioaddr + TxConfig);
- writew(np->rx_config, ioaddr + RxConfig);
+ writel(np->tx_config, ioaddr + TxConfig);
+ writel(np->rx_config, ioaddr + RxConfig);
}
}