summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-12-11 12:14:43 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-12-12 20:02:44 +0100
commita1a50a465485dea02aa58ed861ae4594922e7c54 (patch)
tree745a0b95440f20cbcaf11802222928d0d69f6305 /drivers/net/phy/phy.c
parent11cb1620fec786ced1be458a21c4c53ee6870d1d (diff)
downloadbarebox-a1a50a465485dea02aa58ed861ae4594922e7c54.tar.gz
barebox-a1a50a465485dea02aa58ed861ae4594922e7c54.tar.xz
net phylib: force to wait for link
When starting a network device wait until the link is up. Otherwise autobooting does not work with little timeout and several attempts have to be made until the network is finally up. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 58546f8546..d7e6b3d5b9 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -400,11 +400,14 @@ int genphy_setup_forced(struct phy_device *phydev)
return err;
}
-static int phy_aneg_done(struct phy_device *phydev)
+int phy_wait_aneg_done(struct phy_device *phydev)
{
uint64_t start = get_time_ns();
int ctl;
+ if (phydev->autoneg == AUTONEG_DISABLE)
+ return 0;
+
while (!is_timeout(start, PHY_AN_TIMEOUT * SECOND)) {
ctl = phy_read(phydev, MII_BMSR);
if (ctl & BMSR_ANEGCOMPLETE) {
@@ -451,7 +454,7 @@ int genphy_restart_aneg(struct phy_device *phydev)
if (ctl < 0)
return ctl;
- return phy_aneg_done(phydev);
+ return 0;
}
/**