Author: nbd
Date: 2014-12-26 13:36:30 +0100 (Fri, 26 Dec 2014)
New Revision: 43776

Added:
   
trunk/target/linux/generic/patches-3.14/072-net-phy-Check-for-aneg-completion-before-setting-sta.patch
   
trunk/target/linux/generic/patches-3.14/073-net-phy-resume-phydev-when-going-to-RESUMING.patch
Log:
kernel: backport a few PHY layer fixes from upstream

Signed-off-by: Felix Fietkau <[email protected]>

Added: 
trunk/target/linux/generic/patches-3.14/072-net-phy-Check-for-aneg-completion-before-setting-sta.patch
===================================================================
--- 
trunk/target/linux/generic/patches-3.14/072-net-phy-Check-for-aneg-completion-before-setting-sta.patch
                              (rev 0)
+++ 
trunk/target/linux/generic/patches-3.14/072-net-phy-Check-for-aneg-completion-before-setting-sta.patch
      2014-12-26 12:36:30 UTC (rev 43776)
@@ -0,0 +1,35 @@
+From: Balakumaran Kannan <[email protected]>
+Date: Thu, 24 Apr 2014 08:22:47 +0530
+Subject: [PATCH] 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 <[email protected]>
+Reviewed-by: Florian Fainelli <[email protected]>
+Signed-off-by: David S. Miller <[email protected]>
+---
+
+--- a/drivers/net/phy/phy.c
++++ b/drivers/net/phy/phy.c
+@@ -744,6 +744,17 @@ void phy_state_machine(struct work_struc
+                       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);

Added: 
trunk/target/linux/generic/patches-3.14/073-net-phy-resume-phydev-when-going-to-RESUMING.patch
===================================================================
--- 
trunk/target/linux/generic/patches-3.14/073-net-phy-resume-phydev-when-going-to-RESUMING.patch
                              (rev 0)
+++ 
trunk/target/linux/generic/patches-3.14/073-net-phy-resume-phydev-when-going-to-RESUMING.patch
      2014-12-26 12:36:30 UTC (rev 43776)
@@ -0,0 +1,68 @@
+--- a/drivers/net/phy/phy.c
++++ b/drivers/net/phy/phy.c
+@@ -690,7 +690,7 @@ void phy_state_machine(struct work_struc
+       struct delayed_work *dwork = to_delayed_work(work);
+       struct phy_device *phydev =
+                       container_of(dwork, struct phy_device, state_queue);
+-      int needs_aneg = 0, do_suspend = 0;
++      bool needs_aneg = false, do_suspend = false, do_resume = false;
+       int err = 0;
+ 
+       mutex_lock(&phydev->lock);
+@@ -702,7 +702,7 @@ void phy_state_machine(struct work_struc
+       case PHY_PENDING:
+               break;
+       case PHY_UP:
+-              needs_aneg = 1;
++              needs_aneg = true;
+ 
+               phydev->link_timeout = PHY_AN_TIMEOUT;
+ 
+@@ -732,7 +732,7 @@ void phy_state_machine(struct work_struc
+                       phydev->adjust_link(phydev->attached_dev);
+ 
+               } else if (0 == phydev->link_timeout--) {
+-                      needs_aneg = 1;
++                      needs_aneg = true;
+                       /* If we have the magic_aneg bit, we try again */
+                       if (phydev->drv->flags & PHY_HAS_MAGICANEG)
+                               break;
+@@ -770,7 +770,7 @@ void phy_state_machine(struct work_struc
+                       netif_carrier_on(phydev->attached_dev);
+               } else {
+                       if (0 == phydev->link_timeout--)
+-                              needs_aneg = 1;
++                              needs_aneg = true;
+               }
+ 
+               phydev->adjust_link(phydev->attached_dev);
+@@ -806,7 +806,7 @@ void phy_state_machine(struct work_struc
+                       phydev->link = 0;
+                       netif_carrier_off(phydev->attached_dev);
+                       phydev->adjust_link(phydev->attached_dev);
+-                      do_suspend = 1;
++                      do_suspend = true;
+               }
+               break;
+       case PHY_RESUMING:
+@@ -855,6 +855,7 @@ void phy_state_machine(struct work_struc
+                       }
+                       phydev->adjust_link(phydev->attached_dev);
+               }
++              do_resume = true;
+               break;
+       }
+ 
+@@ -862,9 +863,10 @@ void phy_state_machine(struct work_struc
+ 
+       if (needs_aneg)
+               err = phy_start_aneg(phydev);
+-
+-      if (do_suspend)
++      else if (do_suspend)
+               phy_suspend(phydev);
++      else if (do_resume)
++              phy_resume(phydev);
+ 
+       if (err < 0)
+               phy_error(phydev);
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to