mvebu: add linux 4.9 support
[openwrt/openwrt.git] / target / linux / mvebu / patches-4.9 / 421-phylink-add-ethtool-nway_reset-support.patch
1 From: Russell King <rmk+kernel@arm.linux.org.uk>
2 Date: Thu, 1 Oct 2015 20:27:19 +0100
3 Subject: [PATCH] phylink: add ethtool nway_reset support
4
5 Add ethtool nway_reset support to phylink, to allow userspace to
6 request a re-negotiation of the link.
7
8 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
9 Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 ---
11
12 --- a/drivers/net/phy/phylink.c
13 +++ b/drivers/net/phy/phylink.c
14 @@ -783,6 +783,20 @@ int phylink_ethtool_ksettings_set(struct
15 }
16 EXPORT_SYMBOL_GPL(phylink_ethtool_ksettings_set);
17
18 +int phylink_ethtool_nway_reset(struct phylink *pl)
19 +{
20 + int ret = 0;
21 +
22 + mutex_lock(&pl->config_mutex);
23 + if (pl->phydev)
24 + ret = genphy_restart_aneg(pl->phydev);
25 + phylink_mac_an_restart(pl);
26 + mutex_unlock(&pl->config_mutex);
27 +
28 + return ret;
29 +}
30 +EXPORT_SYMBOL_GPL(phylink_ethtool_nway_reset);
31 +
32 /* This emulates MII registers for a fixed-mode phy operating as per the
33 * passed in state. "aneg" defines if we report negotiation is possible.
34 *
35 --- a/include/linux/phylink.h
36 +++ b/include/linux/phylink.h
37 @@ -86,6 +86,7 @@ int phylink_ethtool_ksettings_get(struct
38 struct ethtool_link_ksettings *);
39 int phylink_ethtool_ksettings_set(struct phylink *,
40 const struct ethtool_link_ksettings *);
41 +int phylink_ethtool_nway_reset(struct phylink *);
42 int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
43
44 int phylink_set_link(struct phylink *pl, unsigned int mode, u8 port,