diff options
author | Balakumaran Kannan <kumaran.4353@gmail.com> | 2014-04-23 22:52:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-02 15:50:57 -0400 |
commit | e46e08b843d8ff8c46ad8d7b0b95acaacc4e6195 (patch) | |
tree | 7c701f63cca0b50f09b655e06543f9de79264e29 | |
parent | 22041fb05b66387b2854f789d1e1f55c7d07b4f4 (diff) |
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.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 1b6d09aef427..a972056b2249 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) | |||
765 | break; | 765 | break; |
766 | 766 | ||
767 | if (phydev->link) { | 767 | if (phydev->link) { |
768 | if (AUTONEG_ENABLE == phydev->autoneg) { | ||
769 | err = phy_aneg_done(phydev); | ||
770 | if (err < 0) | ||
771 | break; | ||
772 | |||
773 | if (!err) { | ||
774 | phydev->state = PHY_AN; | ||
775 | phydev->link_timeout = PHY_AN_TIMEOUT; | ||
776 | break; | ||
777 | } | ||
778 | } | ||
768 | phydev->state = PHY_RUNNING; | 779 | phydev->state = PHY_RUNNING; |
769 | netif_carrier_on(phydev->attached_dev); | 780 | netif_carrier_on(phydev->attached_dev); |
770 | phydev->adjust_link(phydev->attached_dev); | 781 | phydev->adjust_link(phydev->attached_dev); |