summaryrefslogtreecommitdiff
path: root/target/linux/mvebu/patches-4.9/408-net-phy-hook-up-clause-45-autonegotiation-restart.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/mvebu/patches-4.9/408-net-phy-hook-up-clause-45-autonegotiation-restart.patch')
-rw-r--r--target/linux/mvebu/patches-4.9/408-net-phy-hook-up-clause-45-autonegotiation-restart.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/target/linux/mvebu/patches-4.9/408-net-phy-hook-up-clause-45-autonegotiation-restart.patch b/target/linux/mvebu/patches-4.9/408-net-phy-hook-up-clause-45-autonegotiation-restart.patch
new file mode 100644
index 0000000..7a16bd5
--- /dev/null
+++ b/target/linux/mvebu/patches-4.9/408-net-phy-hook-up-clause-45-autonegotiation-restart.patch
@@ -0,0 +1,54 @@
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Fri, 13 Jan 2017 11:17:30 +0000
+Subject: [PATCH] net: phy: hook up clause 45 autonegotiation restart
+
+genphy_restart_aneg() can only restart autonegotiation on clause 22
+PHYs. Add a phy_restart_aneg() function which selects between the
+clause 22 and clause 45 restart functionality depending on the PHY
+type.
+
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+---
+
+--- a/drivers/net/phy/phy.c
++++ b/drivers/net/phy/phy.c
+@@ -134,6 +134,24 @@ static int phy_config_interrupt(struct p
+ return 0;
+ }
+
++/**
++ * phy_restart_aneg - restart auto-negotiation
++ * @phydev: target phy_device struct
++ *
++ * Restart the autonegotiation on @phydev. Returns >= 0 on success or
++ * negative errno on error.
++ */
++static int phy_restart_aneg(struct phy_device *phydev)
++{
++ int ret;
++
++ if (phydev->is_c45)
++ ret = genphy_c45_restart_aneg(phydev);
++ else
++ ret = genphy_restart_aneg(phydev);
++
++ return ret;
++}
+
+ /**
+ * phy_aneg_done - return auto-negotiation status
+@@ -1403,3 +1421,14 @@ int phy_ethtool_set_link_ksettings(struc
+ return phy_ethtool_ksettings_set(phydev, cmd);
+ }
+ EXPORT_SYMBOL(phy_ethtool_set_link_ksettings);
++
++int phy_ethtool_nway_reset(struct net_device *ndev)
++{
++ struct phy_device *phydev = ndev->phydev;
++
++ if (!phydev)
++ return -ENODEV;
++
++ return phy_restart_aneg(phydev);
++}
++EXPORT_SYMBOL(phy_ethtool_nway_reset);