aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/micrel.c
diff options
context:
space:
mode:
authorNathan Sullivan <nathan.sullivan@ni.com>2015-10-21 15:17:04 -0400
committerDavid S. Miller <davem@davemloft.net>2015-10-23 05:57:26 -0400
commitd2fd719bcb0e83cb39cfee22ee800f98a56eceb3 (patch)
tree7ef7a63150312fb62b7fb0b4e4dab7cbcf8d3825 /drivers/net/phy/micrel.c
parentec3661b42257d9a06cf0d318175623ac7a660113 (diff)
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: Nathan Sullivan <nathan.sullivan@ni.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/micrel.c')
-rw-r--r--drivers/net/phy/micrel.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 499185eaf413..cf6312fafea5 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -514,6 +514,27 @@ static int ksz8873mll_read_status(struct phy_device *phydev)
514 return 0; 514 return 0;
515} 515}
516 516
517static int ksz9031_read_status(struct phy_device *phydev)
518{
519 int err;
520 int regval;
521
522 err = genphy_read_status(phydev);
523 if (err)
524 return err;
525
526 /* Make sure the PHY is not broken. Read idle error count,
527 * and reset the PHY if it is maxed out.
528 */
529 regval = phy_read(phydev, MII_STAT1000);
530 if ((regval & 0xFF) == 0xFF) {
531 phy_init_hw(phydev);
532 phydev->link = 0;
533 }
534
535 return 0;
536}
537
517static int ksz8873mll_config_aneg(struct phy_device *phydev) 538static int ksz8873mll_config_aneg(struct phy_device *phydev)
518{ 539{
519 return 0; 540 return 0;
@@ -772,7 +793,7 @@ static struct phy_driver ksphy_driver[] = {
772 .driver_data = &ksz9021_type, 793 .driver_data = &ksz9021_type,
773 .config_init = ksz9031_config_init, 794 .config_init = ksz9031_config_init,
774 .config_aneg = genphy_config_aneg, 795 .config_aneg = genphy_config_aneg,
775 .read_status = genphy_read_status, 796 .read_status = ksz9031_read_status,
776 .ack_interrupt = kszphy_ack_interrupt, 797 .ack_interrupt = kszphy_ack_interrupt,
777 .config_intr = kszphy_config_intr, 798 .config_intr = kszphy_config_intr,
778 .suspend = genphy_suspend, 799 .suspend = genphy_suspend,