Commit 9a856acf authored by Tim Hockin's avatar Tim Hockin

Link status detection fix for natsemi net driver.

Apparently, the LSTATUS bit of BMSR latches low until a management read. 
This causes ETHTOOL_GLINK to report no-link on the first read after the
link is connected.  (damned QA people catch dumb stuff like this KNOWING
I'll have to fix it).  This patch just forces GLINK to mdio_read() twice.
parent 61000d04
...@@ -1925,6 +1925,8 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -1925,6 +1925,8 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
/* get link status */ /* get link status */
case ETHTOOL_GLINK: { case ETHTOOL_GLINK: {
struct ethtool_value edata = {ETHTOOL_GLINK}; struct ethtool_value edata = {ETHTOOL_GLINK};
/* LSTATUS is latched low until a read - so read twice */
mdio_read(dev, 1, MII_BMSR);
edata.data = (mdio_read(dev, 1, MII_BMSR)&BMSR_LSTATUS) ? 1:0; edata.data = (mdio_read(dev, 1, MII_BMSR)&BMSR_LSTATUS) ? 1:0;
if (copy_to_user(useraddr, &edata, sizeof(edata))) if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT; return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment