Commit d2fd719b authored by Nathan Sullivan's avatar Nathan Sullivan Committed by David S. Miller

net/phy: micrel: Add workaround for bad autoneg

Very rarely, the KSZ9031 will appear to complete autonegotiation, but
will drop all traffic afterwards.  When this happens, the idle error
count will read 0xFF after autonegotiation completes.  Reset the PHY
when in that state.
Signed-off-by: default avatarNathan Sullivan <nathan.sullivan@ni.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ec3661b4
...@@ -514,6 +514,27 @@ static int ksz8873mll_read_status(struct phy_device *phydev) ...@@ -514,6 +514,27 @@ static int ksz8873mll_read_status(struct phy_device *phydev)
return 0; return 0;
} }
static int ksz9031_read_status(struct phy_device *phydev)
{
int err;
int regval;
err = genphy_read_status(phydev);
if (err)
return err;
/* Make sure the PHY is not broken. Read idle error count,
* and reset the PHY if it is maxed out.
*/
regval = phy_read(phydev, MII_STAT1000);
if ((regval & 0xFF) == 0xFF) {
phy_init_hw(phydev);
phydev->link = 0;
}
return 0;
}
static int ksz8873mll_config_aneg(struct phy_device *phydev) static int ksz8873mll_config_aneg(struct phy_device *phydev)
{ {
return 0; return 0;
...@@ -772,7 +793,7 @@ static struct phy_driver ksphy_driver[] = { ...@@ -772,7 +793,7 @@ static struct phy_driver ksphy_driver[] = {
.driver_data = &ksz9021_type, .driver_data = &ksz9021_type,
.config_init = ksz9031_config_init, .config_init = ksz9031_config_init,
.config_aneg = genphy_config_aneg, .config_aneg = genphy_config_aneg,
.read_status = genphy_read_status, .read_status = ksz9031_read_status,
.ack_interrupt = kszphy_ack_interrupt, .ack_interrupt = kszphy_ack_interrupt,
.config_intr = kszphy_config_intr, .config_intr = kszphy_config_intr,
.suspend = genphy_suspend, .suspend = genphy_suspend,
......
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