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