diff options
author | Russell King <linux@armlinux.org.uk> | 2019-11-27 11:45:25 +0000 |
---|---|---|
committer | Jonas Gorski <jonas.gorski@gmail.com> | 2020-01-21 22:32:48 +0100 |
commit | 1c16b574c4f77a30a0268acee30be96ae0dc5948 (patch) | |
tree | 716fd94ee81e332ba19e1af7bf98371120ea1856 /target/linux/generic/backport-4.19/711-v5.3-net-sfp-add-mandatory-attach-detach-methods-for-sfp-.patch | |
parent | a07638eb24b8310a35ea6c3b09f6db59bb31cd68 (diff) | |
download | upstream-1c16b574c4f77a30a0268acee30be96ae0dc5948.tar.gz upstream-1c16b574c4f77a30a0268acee30be96ae0dc5948.tar.bz2 upstream-1c16b574c4f77a30a0268acee30be96ae0dc5948.zip |
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 <linux@armlinux.org.uk>
[jonas.gorski: include kernel version in file names, refresh patches]
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/generic/backport-4.19/711-v5.3-net-sfp-add-mandatory-attach-detach-methods-for-sfp-.patch')
-rw-r--r-- | target/linux/generic/backport-4.19/711-v5.3-net-sfp-add-mandatory-attach-detach-methods-for-sfp-.patch | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/target/linux/generic/backport-4.19/711-v5.3-net-sfp-add-mandatory-attach-detach-methods-for-sfp-.patch b/target/linux/generic/backport-4.19/711-v5.3-net-sfp-add-mandatory-attach-detach-methods-for-sfp-.patch new file mode 100644 index 0000000000..74dc39fa7f --- /dev/null +++ b/target/linux/generic/backport-4.19/711-v5.3-net-sfp-add-mandatory-attach-detach-methods-for-sfp-.patch @@ -0,0 +1,94 @@ +From aeabfaa63285470e81fa341e14f92d68880aa160 Mon Sep 17 00:00:00 2001 +From: Russell King <rmk+kernel@armlinux.org.uk> +Date: Tue, 28 May 2019 10:57:34 +0100 +Subject: [PATCH 609/660] net: sfp: add mandatory attach/detach methods for sfp + buses + +Add attach and detach methods for SFP buses, which will allow us to get +rid of the netdev storage in sfp-bus. + +Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> +Reviewed-by: Andrew Lunn <andrew@lunn.ch> +Signed-off-by: David S. Miller <davem@davemloft.net> +Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> +--- + drivers/net/phy/phylink.c | 16 ++++++++++++++++ + drivers/net/phy/sfp-bus.c | 4 ++-- + include/linux/sfp.h | 6 ++++++ + 3 files changed, 24 insertions(+), 2 deletions(-) + +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -1615,6 +1615,20 @@ int phylink_mii_ioctl(struct phylink *pl + } + EXPORT_SYMBOL_GPL(phylink_mii_ioctl); + ++static void phylink_sfp_attach(void *upstream, struct sfp_bus *bus) ++{ ++ struct phylink *pl = upstream; ++ ++ pl->netdev->sfp_bus = bus; ++} ++ ++static void phylink_sfp_detach(void *upstream, struct sfp_bus *bus) ++{ ++ struct phylink *pl = upstream; ++ ++ pl->netdev->sfp_bus = NULL; ++} ++ + static int phylink_sfp_module_insert(void *upstream, + const struct sfp_eeprom_id *id) + { +@@ -1733,6 +1747,8 @@ static void phylink_sfp_disconnect_phy(v + } + + static const struct sfp_upstream_ops sfp_phylink_ops = { ++ .attach = phylink_sfp_attach, ++ .detach = phylink_sfp_detach, + .module_insert = phylink_sfp_module_insert, + .link_up = phylink_sfp_link_up, + .link_down = phylink_sfp_link_down, +--- a/drivers/net/phy/sfp-bus.c ++++ b/drivers/net/phy/sfp-bus.c +@@ -350,7 +350,7 @@ static int sfp_register_bus(struct sfp_b + bus->socket_ops->attach(bus->sfp); + if (bus->started) + bus->socket_ops->start(bus->sfp); +- bus->netdev->sfp_bus = bus; ++ bus->upstream_ops->attach(bus->upstream, bus); + bus->registered = true; + return 0; + } +@@ -359,8 +359,8 @@ static void sfp_unregister_bus(struct sf + { + const struct sfp_upstream_ops *ops = bus->upstream_ops; + +- bus->netdev->sfp_bus = NULL; + if (bus->registered) { ++ bus->upstream_ops->detach(bus->upstream, bus); + if (bus->started) + bus->socket_ops->stop(bus->sfp); + bus->socket_ops->detach(bus->sfp); +--- a/include/linux/sfp.h ++++ b/include/linux/sfp.h +@@ -469,6 +469,10 @@ struct sfp_bus; + + /** + * struct sfp_upstream_ops - upstream operations structure ++ * @attach: called when the sfp socket driver is bound to the upstream ++ * (mandatory). ++ * @detach: called when the sfp socket driver is unbound from the upstream ++ * (mandatory). + * @module_insert: called after a module has been detected to determine + * whether the module is supported for the upstream device. + * @module_remove: called after the module has been removed. +@@ -481,6 +485,8 @@ struct sfp_bus; + * been removed. + */ + struct sfp_upstream_ops { ++ void (*attach)(void *priv, struct sfp_bus *bus); ++ void (*detach)(void *priv, struct sfp_bus *bus); + int (*module_insert)(void *priv, const struct sfp_eeprom_id *id); + void (*module_remove)(void *priv); + void (*link_down)(void *priv); |