[PATCH] 3c59x: fix networking for 10base2 NICs
authorSteffen Klassert <klassert@mathematik.tu-chemnitz.de>
Fri, 31 Mar 2006 10:30:48 +0000 (02:30 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 31 Mar 2006 20:18:55 +0000 (12:18 -0800)
The "3c59x: use mii_check_media" patch introduced a netif_carrier_off in
vortex_up.  10base2 stoped working because of this.  This is removed.

Tx/Rx reset is back in vortex_up because the 3c900B-Combo stops working after
changing from half duplex to full duplex when Tx/Rx reset is done with
vortex_timer.

Also brought back some mii stuff to be sure that it does not break something
else.

Thanks to Pete Clements <clem@clem.clem-digital.net> for reporting and testing.

Signed-off-by: Steffen Klassert <klassert@mathematik.tu-chemnitz.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/net/3c59x.c

index 51129079853bf036c3713d566776d3b06a359d60..274b0138d44200b8e828e315a0ebf071834dca20 100644 (file)
@@ -788,7 +788,7 @@ struct vortex_private {
        int options;                                            /* User-settable misc. driver options. */
        unsigned int media_override:4,          /* Passed-in media type. */
                default_media:4,                                /* Read from the EEPROM/Wn3_Config. */
-               full_duplex:1, force_fd:1, autoselect:1,
+               full_duplex:1, autoselect:1,
                bus_master:1,                                   /* Vortex can only do a fragment bus-m. */
                full_bus_master_tx:1, full_bus_master_rx:2, /* Boomerang  */
                flow_ctrl:1,                                    /* Use 802.3x flow control (PAUSE only) */
@@ -1633,12 +1633,6 @@ vortex_set_duplex(struct net_device *dev)
                        ((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ?
                                        0x100 : 0),
                        ioaddr + Wn3_MAC_Ctrl);
-
-       issue_and_wait(dev, TxReset);
-       /*
-        * Don't reset the PHY - that upsets autonegotiation during DHCP operations.
-        */
-       issue_and_wait(dev, RxReset|0x04);
 }
 
 static void vortex_check_media(struct net_device *dev, unsigned int init)
@@ -1663,7 +1657,7 @@ vortex_up(struct net_device *dev)
        struct vortex_private *vp = netdev_priv(dev);
        void __iomem *ioaddr = vp->ioaddr;
        unsigned int config;
-       int i;
+       int i, mii_reg1, mii_reg5;
 
        if (VORTEX_PCI(vp)) {
                pci_set_power_state(VORTEX_PCI(vp), PCI_D0);    /* Go active */
@@ -1723,14 +1717,23 @@ vortex_up(struct net_device *dev)
                printk(KERN_DEBUG "vortex_up(): writing 0x%x to InternalConfig\n", config);
        iowrite32(config, ioaddr + Wn3_Config);
 
-       netif_carrier_off(dev);
        if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) {
                EL3WINDOW(4);
+               mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
+               mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);
+               vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0);
+
                vortex_check_media(dev, 1);
        }
        else
                vortex_set_duplex(dev);
 
+       issue_and_wait(dev, TxReset);
+       /*
+        * Don't reset the PHY - that upsets autonegotiation during DHCP operations.
+        */
+       issue_and_wait(dev, RxReset|0x04);
+
 
        iowrite16(SetStatusEnb | 0x00, ioaddr + EL3_CMD);