3ada51636bda284f8bcb02e937d6d2aacba326e2
[openwrt/staging/zorun.git] /
1 From 1da223db3a0c522300b519ecbe1dc45927e28088 Mon Sep 17 00:00:00 2001
2 From: Andrew Lunn <andrew@lunn.ch>
3 Date: Wed, 12 Sep 2018 01:53:15 +0200
4 Subject: [PATCH 600/660] net: ethernet: Add helper for MACs which support asym
5 pause
6
7 Rather than have the MAC drivers manipulate phydev members to indicate
8 they support Asym Pause, add a helper function.
9
10 Signed-off-by: Andrew Lunn <andrew@lunn.ch>
11 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14 drivers/net/phy/phy_device.c | 13 +++++++++++++
15 include/linux/phy.h | 1 +
16 2 files changed, 14 insertions(+)
17
18 --- a/drivers/net/phy/phy_device.c
19 +++ b/drivers/net/phy/phy_device.c
20 @@ -1777,6 +1777,19 @@ int phy_set_max_speed(struct phy_device
21 }
22 EXPORT_SYMBOL(phy_set_max_speed);
23
24 +/**
25 + * phy_support_asym_pause - Enable support of asym pause
26 + * @phydev: target phy_device struct
27 + *
28 + * Description: Called by the MAC to indicate is supports Asym Pause.
29 + */
30 +void phy_support_asym_pause(struct phy_device *phydev)
31 +{
32 + phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
33 + phydev->advertising = phydev->supported;
34 +}
35 +EXPORT_SYMBOL(phy_support_asym_pause);
36 +
37 static void of_set_phy_supported(struct phy_device *phydev)
38 {
39 struct device_node *node = phydev->mdio.dev.of_node;
40 --- a/include/linux/phy.h
41 +++ b/include/linux/phy.h
42 @@ -1049,6 +1049,7 @@ int phy_mii_ioctl(struct phy_device *phy
43 int phy_start_interrupts(struct phy_device *phydev);
44 void phy_print_status(struct phy_device *phydev);
45 int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
46 +void phy_support_asym_pause(struct phy_device *phydev);
47
48 int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
49 int (*run)(struct phy_device *));