From: Lothar Waßmann Date: Wed, 29 Oct 2014 07:41:31 +0000 (+0100) Subject: net: phy: don't try autonegotiation if it is not enabled in the PHY X-Git-Tag: KARO-TX-2014-11-10~7^2~1 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=commitdiff_plain;h=0c9e2dc612e8b970ea2d13712b0e0f3f1282be4f;hp=2e44e7dce4e2b0966edcb59d1f11fdd7058978c8 net: phy: don't try autonegotiation if it is not enabled in the PHY --- 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;