diff options
Diffstat (limited to 'pkgs/patches-linux-5.15/781-v5.17-5-net-dsa-hellcreek-convert-to-phylink_generic_validat.patch')
-rw-r--r-- | pkgs/patches-linux-5.15/781-v5.17-5-net-dsa-hellcreek-convert-to-phylink_generic_validat.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/pkgs/patches-linux-5.15/781-v5.17-5-net-dsa-hellcreek-convert-to-phylink_generic_validat.patch b/pkgs/patches-linux-5.15/781-v5.17-5-net-dsa-hellcreek-convert-to-phylink_generic_validat.patch new file mode 100644 index 0000000..9c72c3e --- /dev/null +++ b/pkgs/patches-linux-5.15/781-v5.17-5-net-dsa-hellcreek-convert-to-phylink_generic_validat.patch @@ -0,0 +1,78 @@ +From 7e0b9a29934d228bec9a133f504f283903333029 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> +Date: Tue, 30 Nov 2021 13:10:11 +0000 +Subject: [PATCH 5/6] net: dsa: hellcreek: convert to + phylink_generic_validate() + +Populate the supported interfaces and MAC capabilities for the +hellcreek DSA switch and remove the old validate implementation to +allow DSA to use phylink_generic_validate() for this switch driver. + +The switch actually only supports MII and RGMII, but as phylib defaults +to GMII, we need to include this interface mode to keep existing DT +working. + +Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de> +Tested-by: Kurt Kanzenbach <kurt@linutronix.de> +Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> +Signed-off-by: Jakub Kicinski <kuba@kernel.org> +--- + drivers/net/dsa/hirschmann/hellcreek.c | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c +index b2bab460d2e9..a6ae2246844c 100644 +--- a/drivers/net/dsa/hirschmann/hellcreek.c ++++ b/drivers/net/dsa/hirschmann/hellcreek.c +@@ -1457,14 +1457,19 @@ static void hellcreek_teardown(struct dsa_switch *ds) + dsa_devlink_resources_unregister(ds); + } + +-static void hellcreek_phylink_validate(struct dsa_switch *ds, int port, +- unsigned long *supported, +- struct phylink_link_state *state) ++static void hellcreek_phylink_get_caps(struct dsa_switch *ds, int port, ++ struct phylink_config *config) + { +- __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; + struct hellcreek *hellcreek = ds->priv; + +- dev_dbg(hellcreek->dev, "Phylink validate for port %d\n", port); ++ __set_bit(PHY_INTERFACE_MODE_MII, config->supported_interfaces); ++ __set_bit(PHY_INTERFACE_MODE_RGMII, config->supported_interfaces); ++ ++ /* Include GMII - the hardware does not support this interface ++ * mode, but it's the default interface mode for phylib, so we ++ * need it for compatibility with existing DT. ++ */ ++ __set_bit(PHY_INTERFACE_MODE_GMII, config->supported_interfaces); + + /* The MAC settings are a hardware configuration option and cannot be + * changed at run time or by strapping. Therefore the attached PHYs +@@ -1472,12 +1477,9 @@ static void hellcreek_phylink_validate(struct dsa_switch *ds, int port, + * by the hardware. + */ + if (hellcreek->pdata->is_100_mbits) +- phylink_set(mask, 100baseT_Full); ++ config->mac_capabilities = MAC_100FD; + else +- phylink_set(mask, 1000baseT_Full); +- +- linkmode_and(supported, supported, mask); +- linkmode_and(state->advertising, state->advertising, mask); ++ config->mac_capabilities = MAC_1000FD; + } + + static int +@@ -1828,7 +1830,7 @@ static const struct dsa_switch_ops hellcreek_ds_ops = { + .get_strings = hellcreek_get_strings, + .get_tag_protocol = hellcreek_get_tag_protocol, + .get_ts_info = hellcreek_get_ts_info, +- .phylink_validate = hellcreek_phylink_validate, ++ .phylink_get_caps = hellcreek_phylink_get_caps, + .port_bridge_flags = hellcreek_bridge_flags, + .port_bridge_join = hellcreek_port_bridge_join, + .port_bridge_leave = hellcreek_port_bridge_leave, +-- +2.35.1 + |