On Thu, 13 Jan 2005, Mike Nix wrote:
I tested this by calling it from enable_net_traffic so that carrier was
checked whenever the interface was configured "up" - I then ran "ifconfig eth2 down;ifconfig eth2 up" inserting / removing the cable between runs - carrier was reported correctly every time.
I dug down to the code and found out that the real fix is to apply this patch:
---
@@ -1212,6 +1212,7 @@
dev_warn(&intf->dev, "can't locate MII phy, using default\n");
pegasus->phy = 1;
}
+ pegasus->mii.phy_id = pegasus->phy;
usb_set_intfdata(intf, pegasus);
SET_NETDEV_DEV(net, &intf->dev);
pegasus_reset_wol(net);---
As you could guess from the above i have forgotten to write the autodetected value of the PHY into the mii structure. The MII code was calling mdio_read() with phy == 0 (while 1 is the correct for most of the adapters out there) and the returned value was 0xffff. Hence the link was aways reported to be up.
All that is left is to call set_carrier() every few seconds from somewhere "safe" - I'll leave it to you to decide where as you know the driver better than me. Trying it from intr_callback was not pretty (kinda expected that one).
This is due to the fact that all register read/write needs to be synchronous. Attempt to do so without being in a process context result in an oops() :-)
Anyway, i'll think of something, may be timer..
Petko
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
