]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
net: phy: don't try autonegotiation if it is not enabled in the PHY
authorLothar Waßmann <LW@KARO-electronics.de>
Wed, 29 Oct 2014 07:41:31 +0000 (08:41 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 29 Oct 2014 07:41:31 +0000 (08:41 +0100)
drivers/net/phy/phy.c

index 9e6578644ca9e92802d92c959f0a2017c60ca229..7ad1343ab14692fe7219454407c97587f6fd300c 100644 (file)
@@ -200,6 +200,7 @@ int genphy_config_aneg(struct phy_device *phydev)
 int genphy_update_link(struct phy_device *phydev)
 {
        int mii_reg;
 int genphy_update_link(struct phy_device *phydev)
 {
        int mii_reg;
+       int bmcr;
 
        /*
         * Wait if the link is up, and autonegotiation is in progress
 
        /*
         * 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;
 
        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;
 
        if ((mii_reg & BMSR_ANEGCAPABLE) && !(mii_reg & BMSR_ANEGCOMPLETE)) {
                int i = 0;