Don Fry wrote:
I get the same results in my testing.  Good catch on the coding error
for ecmd.transciever.  Without adding some more specific code to support
the Allied Telesyn cards I don`t know how to get things to work without
using ethtool.

Maybe someone else has a better idea.

Here is my current patch for you to review.  I would like to submit it
for 2.6.17.
OK. applied it to 2.6.16-rc6. applies and works flawless. The new check_media function is subjectively slower than the older code without it but thats all I found.

Tested with AT 2700FTX and 2701FTX. Both work and can be reconfigured with ethtool. Supplying default options like 100full work as well.

I fiddled with the code a bit and got AUTONEG running. With this extension our AT FTX cards will work fine. All cards will be configured by default to use fibre at 100full and the module will use autoneg. Since the fibre phy ignores settings for autoneg, 100full is not overridden and works. But copper the phy will do autoneg. Tested and works (un-/plugging and switching too of course).


<snip>
+    } else {
+       int first_phy = -1;
+       u16 bmcr;
+       u32 bcr9;
+       struct ethtool_cmd ecmd;
+
+       /*
+        * There is really no good other way to handle multiple PHYs
+        * other than turning off all automatics
+        */
ASEL in BCR2 should be turned off as well. I noticed that only because ethtool clears it. And without clearing it autoneg doesn't work.

        val = lp->a.read_bcr(ioaddr, 2);
        lp->a.write_bcr(ioaddr, 2, val & ~2);
+       val = lp->a.read_bcr(ioaddr, 32);
+       lp->a.write_bcr(ioaddr, 32, val & ~(1 << 7)); /* stop MII manager */
+
Do the following only if not asel:

if (!(lp->options & PCNET32_PORT_ASEL)) {
+       /* setup ecmd */
+       ecmd.port = PORT_MII;
+       ecmd.transceiver = XCVR_INTERNAL;
+       ecmd.autoneg = AUTONEG_DISABLE;
+       ecmd.speed = lp->options & PCNET32_PORT_100 ? SPEED_100 : SPEED_10;
+       bcr9 = lp->a.read_bcr(ioaddr, 9);
+
+       if (lp->options & PCNET32_PORT_FD) {
+           ecmd.duplex = DUPLEX_FULL;
+           bcr9 |= (1 << 0);
+       } else {
+           ecmd.duplex = DUPLEX_HALF;
+           bcr9 |= ~(1 << 0);
+       }
+       lp->a.write_bcr(ioaddr, 9, bcr9);
}

+
+       for (i=0; i<PCNET32_MAX_PHYS; i++) {
+           if (lp->phymask & (1 << i)) {
+               /* isolate all but the first PHY */
+               bmcr = mdio_read(dev, i, MII_BMCR);
+               if (first_phy == -1) {
+                   first_phy = i;
+                   mdio_write(dev, i, MII_BMCR, bmcr & ~BMCR_ISOLATE);
+               } else {
+                   mdio_write(dev, i, MII_BMCR, bmcr | BMCR_ISOLATE);
+               }
+               /* use mii_ethtool_sset to setup PHY */
+               lp->mii_if.phy_id = i;
+               ecmd.phy_address = i;
AUTOSEL Support: use ethtool_gset to setup ecmd...

                if (lp->options & PCNET32_PORT_ASEL) {
                  mii_ethtool_gset(&lp->mii_if, &ecmd);
                  ecmd.autoneg = AUTONEG_ENABLE;
                }
+               mii_ethtool_sset(&lp->mii_if, &ecmd);
+           }
+       }
+       lp->mii_if.phy_id = first_phy;
+       if (netif_msg_link(lp))
+           printk(KERN_INFO "%s: Using PHY number %d.\n", dev->name, 
first_phy);
     }
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to