kernel: update 3.14 to 3.14.30
[openwrt.git] / target / linux / generic / patches-3.14 / 072-net-phy-Check-for-aneg-completion-before-setting-sta.patch
1 From: Balakumaran Kannan <kumaran.4353@gmail.com>
2 Date: Thu, 24 Apr 2014 08:22:47 +0530
3 Subject: [PATCH] net phy: Check for aneg completion before setting state to
4  PHY_RUNNING
5
6 phy_state_machine should check whether auto-negotiatin is completed
7 before changing phydev->state from PHY_NOLINK to PHY_RUNNING. If
8 auto-negotiation is not completed phydev->state should be set to
9 PHY_AN.
10
11 Signed-off-by: Balakumaran Kannan <kumaran.4353@gmail.com>
12 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 ---
15
16 --- a/drivers/net/phy/phy.c
17 +++ b/drivers/net/phy/phy.c
18 @@ -744,6 +744,17 @@ void phy_state_machine(struct work_struc
19                         break;
20  
21                 if (phydev->link) {
22 +                       if (AUTONEG_ENABLE == phydev->autoneg) {
23 +                               err = phy_aneg_done(phydev);
24 +                               if (err < 0)
25 +                                       break;
26 +
27 +                               if (!err) {
28 +                                       phydev->state = PHY_AN;
29 +                                       phydev->link_timeout = PHY_AN_TIMEOUT;
30 +                                       break;
31 +                               }
32 +                       }
33                         phydev->state = PHY_RUNNING;
34                         netif_carrier_on(phydev->attached_dev);
35                         phydev->adjust_link(phydev->attached_dev);