[patch] vt6102 update to the 2.4 via-rhine.c

From: Urban Widmark (urban@svenskatest.se)
Date: Wed Aug 09 2000 - 07:42:47 EST


On Mon, 7 Aug 2000, Donald Becker wrote:

> Other updated PCI drivers of current interest are
[snip]
> via-rhine.c
> This has been updated for the new Rhine chip, which can now transmit
> from unaligned regions, avoiding the need for alignment copies.

Does the latest driver take advantage of that? I guess this would allow
the memcpy in the "if ((long)skb->data & 3) {" in start_tx to be avoided
(for that chip). Should it?

Below is an update to the via-rhine driver in 2.4. Interested parties,
please test.

/Urban

diff -urN -X dontdiff linux-2.4.0-test6-pre8-orig/drivers/net/via-rhine.c linux/drivers/net/via-rhine.c
--- linux-2.4.0-test6-pre8-orig/drivers/net/via-rhine.c Fri Aug 4 13:43:46 2000
+++ linux/drivers/net/via-rhine.c Wed Aug 9 14:14:43 2000
@@ -51,8 +51,13 @@
         - Urban Widmark: mdio locking, bounce buffer changes
                          merges from Beckers 1.05 version
                          added netif_running_on/off support
+
+ LK1.1.6:
+ - Urban Widmark: merges from Beckers 1.08 version (VT6102 + mdio)
+ set netif_running_on/off on startup, del_timer_sync
 */
 
+
 /* A few user-configurable values.
    These may be modified when a driver module is loaded. */
 
@@ -85,7 +90,7 @@
    bonding and packet priority.
    There are no ill effects from too-large receive rings. */
 #define TX_RING_SIZE 16
-#define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */
+#define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */
 #define RX_RING_SIZE 16
 
 
@@ -122,7 +127,7 @@
 
 /* These identify the driver base version and may not be removed. */
 static char version1[] __devinitdata =
-"via-rhine.c:v1.05-LK1.1.5 5/2/2000 Written by Donald Becker\n";
+"via-rhine.c:v1.08-LK1.1.6 8/9/2000 Written by Donald Becker\n";
 static char version2[] __devinitdata =
 " http://www.scyld.com/network/via-rhine.html\n";
 
@@ -261,6 +266,7 @@
 
 enum via_rhine_chips {
         VT86C100A = 0,
+ VT6102,
         VT3043,
 };
 
@@ -283,13 +289,15 @@
 /* directly indexed by enum via_rhine_chips, above */
 static struct via_rhine_chip_info via_rhine_chip_info[] __devinitdata =
 {
- { "VIA VT86C100A Rhine-II", RHINE_IOTYPE, 128, CanHaveMII },
+ { "VIA VT86C100A Rhine", RHINE_IOTYPE, 128, CanHaveMII },
+ { "VIA VT6102 Rhine-II", RHINE_IOTYPE, 128, CanHaveMII },
         { "VIA VT3043 Rhine", RHINE_IOTYPE, 128, CanHaveMII }
 };
 
 static struct pci_device_id via_rhine_pci_tbl[] __devinitdata =
 {
         {0x1106, 0x6100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT86C100A},
+ {0x1106, 0x3065, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT6102},
         {0x1106, 0x3043, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT3043},
         {0,} /* terminate list */
 };
@@ -585,6 +593,12 @@
                                            "0x%4.4x advertising %4.4x Link %4.4x.\n",
                                            dev->name, phy, mii_status, np->advertising,
                                            mdio_read(dev, phy, 5));
+
+ /* set IFF_RUNNING */
+ if (mii_status & MIILink)
+ netif_carrier_on(dev);
+ else
+ netif_carrier_off(dev);
                         }
                 }
         }
@@ -641,8 +655,20 @@
         long ioaddr = dev->base_addr;
         int boguscnt = 1024;
 
- if (phy_id == np->phys[0] && regnum == 4)
- np->advertising = value;
+ if (phy_id == np->phys[0]) {
+ switch (regnum) {
+ case 0: /* Is user forcing speed/duplex? */
+ if (value & 0x9000) /* Autonegotiation. */
+ np->duplex_lock = 0;
+ else
+ np->full_duplex = (value & 0x0100) ? 1 : 0;
+ /* fallthrough */
+ case 4:
+ np->advertising = value;
+ break;
+ }
+ }
+
         /* Wait for a previous command to complete. */
         while ((readb(ioaddr + MIICmd) & 0x60) && --boguscnt > 0)
                 ;
@@ -1309,6 +1335,8 @@
         int i;
         unsigned long flags;
 
+ del_timer_sync(&np->timer);
+
         spin_lock_irqsave(&np->lock, flags);
 
         netif_stop_queue(dev);
@@ -1322,8 +1350,6 @@
 
         /* Stop the chip's Tx and Rx processes. */
         writew(CmdStop, ioaddr + ChipCmd);
-
- del_timer(&np->timer);
 
         spin_unlock_irqrestore(&np->lock, flags);
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:18 EST