1 From: Russell King <rmk+kernel@armlinux.org.uk>
2 Date: Fri, 13 Jan 2017 11:17:30 +0000
3 Subject: [PATCH] net: phy: hook up clause 45 autonegotiation restart
5 genphy_restart_aneg() can only restart autonegotiation on clause 22
6 PHYs. Add a phy_restart_aneg() function which selects between the
7 clause 22 and clause 45 restart functionality depending on the PHY
10 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
13 --- a/drivers/net/phy/phy.c
14 +++ b/drivers/net/phy/phy.c
15 @@ -134,6 +134,24 @@ static int phy_config_interrupt(struct p
20 + * phy_restart_aneg - restart auto-negotiation
21 + * @phydev: target phy_device struct
23 + * Restart the autonegotiation on @phydev. Returns >= 0 on success or
24 + * negative errno on error.
26 +static int phy_restart_aneg(struct phy_device *phydev)
31 + ret = genphy_c45_restart_aneg(phydev);
33 + ret = genphy_restart_aneg(phydev);
39 * phy_aneg_done - return auto-negotiation status
40 @@ -1442,3 +1460,14 @@ int phy_ethtool_set_link_ksettings(struc
41 return phy_ethtool_ksettings_set(phydev, cmd);
43 EXPORT_SYMBOL(phy_ethtool_set_link_ksettings);
45 +int phy_ethtool_nway_reset(struct net_device *ndev)
47 + struct phy_device *phydev = ndev->phydev;
52 + return phy_restart_aneg(phydev);
54 +EXPORT_SYMBOL(phy_ethtool_nway_reset);