From 1c16b574c4f77a30a0268acee30be96ae0dc5948 Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 27 Nov 2019 11:45:25 +0000 Subject: kernel: add backported phy/phylink/sfp patches Backport the phy/phylink/sfp patches currently queued in netdev or in mainline necessary to support GPON popular modules, specifically to support Huawei and Nokia GPON modules. Signed-off-by: Russell King [jonas.gorski: include kernel version in file names, refresh patches] Signed-off-by: Jonas Gorski --- ...t-Add-helper-for-set_pauseparam-for-Asym-.patch | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 target/linux/generic/backport-4.19/703-v4.20-net-ethernet-Add-helper-for-set_pauseparam-for-Asym-.patch (limited to 'target/linux/generic/backport-4.19/703-v4.20-net-ethernet-Add-helper-for-set_pauseparam-for-Asym-.patch') diff --git a/target/linux/generic/backport-4.19/703-v4.20-net-ethernet-Add-helper-for-set_pauseparam-for-Asym-.patch b/target/linux/generic/backport-4.19/703-v4.20-net-ethernet-Add-helper-for-set_pauseparam-for-Asym-.patch new file mode 100644 index 0000000000..8d68fbfe0f --- /dev/null +++ b/target/linux/generic/backport-4.19/703-v4.20-net-ethernet-Add-helper-for-set_pauseparam-for-Asym-.patch @@ -0,0 +1,66 @@ +From ce825df56e0480a2cbb296e38976babafb57e503 Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Wed, 12 Sep 2018 01:53:17 +0200 +Subject: [PATCH 601/660] net: ethernet: Add helper for set_pauseparam for Asym + Pause + +ethtool can be used to enable/disable pause. Add a helper to configure +the PHY when asym pause is supported. + +Signed-off-by: Andrew Lunn +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/phy/phy_device.c | 30 ++++++++++++++++++++++++++++++ + include/linux/phy.h | 1 + + 2 files changed, 31 insertions(+) + +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -1789,6 +1789,36 @@ void phy_support_asym_pause(struct phy_d + } + EXPORT_SYMBOL(phy_support_asym_pause); + ++/** ++ * phy_set_asym_pause - Configure Pause and Asym Pause ++ * @phydev: target phy_device struct ++ * @rx: Receiver Pause is supported ++ * @tx: Transmit Pause is supported ++ * ++ * Description: Configure advertised Pause support depending on if ++ * transmit and receiver pause is supported. If there has been a ++ * change in adverting, trigger a new autoneg. Generally called from ++ * the set_pauseparam .ndo. ++ */ ++void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx) ++{ ++ u16 oldadv = phydev->advertising; ++ u16 newadv = oldadv &= ~(SUPPORTED_Pause | SUPPORTED_Asym_Pause); ++ ++ if (rx) ++ newadv |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; ++ if (tx) ++ newadv ^= SUPPORTED_Asym_Pause; ++ ++ if (oldadv != newadv) { ++ phydev->advertising = newadv; ++ ++ if (phydev->autoneg) ++ phy_start_aneg(phydev); ++ } ++} ++EXPORT_SYMBOL(phy_set_asym_pause); ++ + static void of_set_phy_supported(struct phy_device *phydev) + { + struct device_node *node = phydev->mdio.dev.of_node; +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -1050,6 +1050,7 @@ int phy_start_interrupts(struct phy_devi + void phy_print_status(struct phy_device *phydev); + int phy_set_max_speed(struct phy_device *phydev, u32 max_speed); + void phy_support_asym_pause(struct phy_device *phydev); ++void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx); + + int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask, + int (*run)(struct phy_device *)); -- cgit v1.2.3