From 0c9e2dc612e8b970ea2d13712b0e0f3f1282be4f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lothar=20Wa=C3=9Fmann?= Date: Wed, 29 Oct 2014 08:41:31 +0100 Subject: [PATCH] net: phy: don't try autonegotiation if it is not enabled in the PHY --- drivers/net/phy/phy.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 9e6578644c..7ad1343ab1 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -200,6 +200,7 @@ int genphy_config_aneg(struct phy_device *phydev) int genphy_update_link(struct phy_device *phydev) { int mii_reg; + int bmcr; /* * Wait if the link is up, and autonegotiation is in progress @@ -216,6 +217,13 @@ int genphy_update_link(struct phy_device *phydev) if (phydev->link && mii_reg & BMSR_LSTATUS) return 0; + bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR); + if (bmcr < 0) + return bmcr; + + if (!(bmcr & BMCR_ANENABLE)) + return 0; + if ((mii_reg & BMSR_ANEGCAPABLE) && !(mii_reg & BMSR_ANEGCOMPLETE)) { int i = 0; -- 2.39.2