diff options
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/phy_device.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index bce918bd3cdd..b344a0b55dbf 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -564,20 +564,32 @@ EXPORT_SYMBOL(genphy_restart_aneg); | |||
564 | */ | 564 | */ |
565 | int genphy_config_aneg(struct phy_device *phydev) | 565 | int genphy_config_aneg(struct phy_device *phydev) |
566 | { | 566 | { |
567 | int result = 0; | 567 | int result; |
568 | 568 | ||
569 | if (AUTONEG_ENABLE == phydev->autoneg) { | 569 | if (AUTONEG_ENABLE != phydev->autoneg) |
570 | int result = genphy_config_advert(phydev); | 570 | return genphy_setup_forced(phydev); |
571 | |||
572 | result = genphy_config_advert(phydev); | ||
573 | |||
574 | if (result < 0) /* error */ | ||
575 | return result; | ||
571 | 576 | ||
572 | if (result < 0) /* error */ | 577 | if (result == 0) { |
573 | return result; | 578 | /* Advertisment hasn't changed, but maybe aneg was never on to |
579 | * begin with? Or maybe phy was isolated? */ | ||
580 | int ctl = phy_read(phydev, MII_BMCR); | ||
581 | |||
582 | if (ctl < 0) | ||
583 | return ctl; | ||
584 | |||
585 | if (!(ctl & BMCR_ANENABLE) || (ctl & BMCR_ISOLATE)) | ||
586 | result = 1; /* do restart aneg */ | ||
587 | } | ||
574 | 588 | ||
575 | /* Only restart aneg if we are advertising something different | 589 | /* Only restart aneg if we are advertising something different |
576 | * than we were before. */ | 590 | * than we were before. */ |
577 | if (result > 0) | 591 | if (result > 0) |
578 | result = genphy_restart_aneg(phydev); | 592 | result = genphy_restart_aneg(phydev); |
579 | } else | ||
580 | result = genphy_setup_forced(phydev); | ||
581 | 593 | ||
582 | return result; | 594 | return result; |
583 | } | 595 | } |