summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalakumaran Kannan <kumaran.4353@gmail.com>2014-04-24 02:52:47 (GMT)
committerDavid S. Miller <davem@davemloft.net>2014-05-02 19:50:57 (GMT)
commite46e08b843d8ff8c46ad8d7b0b95acaacc4e6195 (patch)
tree7c701f63cca0b50f09b655e06543f9de79264e29
parent22041fb05b66387b2854f789d1e1f55c7d07b4f4 (diff)
downloadlinux-e46e08b843d8ff8c46ad8d7b0b95acaacc4e6195.tar.xz
net phy: Check for aneg completion before setting state to PHY_RUNNING
phy_state_machine should check whether auto-negotiatin is completed before changing phydev->state from PHY_NOLINK to PHY_RUNNING. If auto-negotiation is not completed phydev->state should be set to PHY_AN. Signed-off-by: Balakumaran Kannan <kumaran.4353@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/phy.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1b6d09a..a972056 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -765,6 +765,17 @@ void phy_state_machine(struct work_struct *work)
break;
if (phydev->link) {
+ if (AUTONEG_ENABLE == phydev->autoneg) {
+ err = phy_aneg_done(phydev);
+ if (err < 0)
+ break;
+
+ if (!err) {
+ phydev->state = PHY_AN;
+ phydev->link_timeout = PHY_AN_TIMEOUT;
+ break;
+ }
+ }
phydev->state = PHY_RUNNING;
netif_carrier_on(phydev->attached_dev);
phydev->adjust_link(phydev->attached_dev);