--- via-rhine.c.origkernel Fri May 3 09:13:07 2002 +++ via-rhine.c Fri May 3 15:57:10 2002 @@ -9,8 +9,8 @@ a complete program and may only be used when the entire operating system is licensed under the GPL. - This driver is designed for the VIA VT86c100A Rhine-II PCI Fast Ethernet - controller. It also works with the older 3043 Rhine-I chip. + This driver is designed for the VIA VT86C100A Rhine-I. + It also works with the 6102 Rhine-II, and 6105/6105M Rhine-III. The author may be reached as becker@scyld.com, or C/O Scyld Computing Corporation @@ -136,9 +136,6 @@ #define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer.*/ -/* max time out delay time */ -#define W_MAX_TIMEOUT 0x0FFFU - #if !defined(__OPTIMIZE__) || !defined(__KERNEL__) #warning You must compile this file with the correct options! #warning See the last lines of the source file. @@ -343,7 +340,7 @@ static struct via_rhine_chip_info via_rhine_chip_info[] __devinitdata = { { "VIA VT86C100A Rhine", RHINE_IOTYPE, 128, - CanHaveMII | ReqTxAlign }, + CanHaveMII | ReqTxAlign | HasDavicomPhy }, { "VIA VT6102 Rhine-II", RHINE_IOTYPE, 256, CanHaveMII | HasWOL }, { "VIA VT6105 Rhine-III", RHINE_IOTYPE, 256, @@ -506,14 +503,12 @@ static int via_rhine_close(struct net_device *dev); static inline void clear_tally_counters(long ioaddr); -static void wait_for_reset(struct net_device *dev, char *name) +static void wait_for_reset(struct net_device *dev, int chip_id, char *name) { - struct netdev_private *np = dev->priv; long ioaddr = dev->base_addr; - int chip_id = np->chip_id; int i; - /* 3043 may need long delay after reset (dlink) */ + /* VT86C100A may need long delay after reset (dlink) */ if (chip_id == VT86C100A) udelay(100); @@ -539,7 +534,7 @@ /* More recent docs say that this bit is reserved ... */ n = inb(ioaddr + ConfigA) | 0x20; outb(n, ioaddr + ConfigA); - } else if (chip_id == VT6102) { + } else { n = inb(ioaddr + ConfigD) | 0x80; outb(n, ioaddr + ConfigD); } @@ -663,7 +658,7 @@ writew(CmdReset, ioaddr + ChipCmd); dev->base_addr = ioaddr; - wait_for_reset(dev, shortname); + wait_for_reset(dev, chip_id, shortname); /* Reload the station address from the EEPROM. */ #ifdef USE_IO @@ -1074,7 +1069,7 @@ return i; alloc_rbufs(dev); alloc_tbufs(dev); - wait_for_reset(dev, dev->name); + wait_for_reset(dev, np->chip_id, dev->name); init_registers(dev); if (debug > 2) printk(KERN_DEBUG "%s: Done via_rhine_open(), status %4.4x " @@ -1181,7 +1176,7 @@ alloc_rbufs(dev); /* Reinitialize the hardware. */ - wait_for_reset(dev, dev->name); + wait_for_reset(dev, np->chip_id, dev->name); init_registers(dev); spin_unlock(&np->lock); @@ -1251,7 +1246,7 @@ if (debug > 4) { printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", - dev->name, np->cur_tx, entry); + dev->name, np->cur_tx-1, entry); } return 0; } @@ -1502,8 +1497,8 @@ printk(KERN_INFO "%s: Transmitter underrun, increasing Tx " "threshold setting to %2.2x.\n", dev->name, np->tx_thresh); } - if ((intr_status & ~( IntrLinkChange | IntrStatsMax | - IntrTxAbort | IntrTxAborted))) { + if (intr_status & ~( IntrLinkChange | IntrStatsMax | + IntrTxAbort | IntrTxAborted | IntrNormalSummary)) { if (debug > 1) printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n", dev->name, intr_status);