net: dsa: sja1105: provide own phylink MAC operations
PATCH 1/1 net: dsa: sja1105: provide own phylink MAC operations
Convert sja1105 to provide its own phylink MAC operations, thus avoiding the shim layer in DSA's port.c
Signed-off-by Russell King (Oracle) <[email protected]>
--- drivers/net/dsa/sja1105/sja1105_main.c | 38 ++++++++++++++++++-------- 1 file changed, 27 insertions(+), 11 deletions(-)
drivers/net/dsa/sja1105/sja1105_main.c +27 -11
@@ -1358,10 +1358,11 @@ static int sja1105_adjust_port_config(struct sja1105_private *priv, int port, }static struct phylink_pcs * -sja1105_mac_select_pcs (struct dsa_switch *ds,int port,phy_interface_t iface) +sja1105_mac_select_pcs (struct phylink_config *config,phy_interface_t iface) { -struct sja1105_private *priv = ds->priv; -struct dw_xpcs *xpcs = priv->xpcs[port]; +struct dsa_port *dp =dsa_phylink_to_port (config); +struct sja1105_private *priv = dp->ds->priv; +struct dw_xpcs *xpcs = priv->xpcs[dp->index];if (xpcs)return &xpcs->pcs;
@@ -1369,21 +1370,31 @@ sja1105_mac_select_pcs(struct dsa_switch *ds, int port, phy_interface_t iface)return NULL ; } -static void sja1105_mac_link_down (struct dsa_switch *ds,int port, +static void sja1105_mac_config (struct phylink_config *config, +unsigned int mode, +const struct phylink_link_state *state) +{ +} + +static void sja1105_mac_link_down (struct phylink_config *config,unsigned int mode,phy_interface_t interface) { -sja1105_inhibit_tx (ds->priv,BIT (port), true); +struct dsa_port *dp =dsa_phylink_to_port (config); + +sja1105_inhibit_tx (dp->ds->priv,BIT (dp->index), true); } -static void sja1105_mac_link_up (struct dsa_switch *ds,int port, +static void sja1105_mac_link_up (struct phylink_config *config, +struct phy_device *phydev,unsigned int mode,phy_interface_t interface, -struct phy_device *phydev,int speed,int duplex,bool tx_pause,bool rx_pause) { -struct sja1105_private *priv = ds->priv; +struct dsa_port *dp =dsa_phylink_to_port (config); +struct sja1105_private *priv = dp->ds->priv; +int port = dp->index;sja1105_adjust_port_config (priv, port, speed);
@@ -3198,6 +3209,13 @@ static void sja1105_teardown(struct dsa_switch *ds)sja1105_static_config_free (&priv->static_config); } +static const struct phylink_mac_ops sja1105_phylink_mac_ops = { + .mac_select_pcs = sja1105_mac_select_pcs, + .mac_config = sja1105_mac_config, + .mac_link_up = sja1105_mac_link_up, + .mac_link_down = sja1105_mac_link_down, +}; +static const struct dsa_switch_ops sja1105_switch_ops = { .get_tag_protocol = sja1105_get_tag_protocol, .connect_tag_protocol = sja1105_connect_tag_protocol,
@@ -3207,9 +3225,6 @@ static const struct dsa_switch_ops sja1105_switch_ops = { .port_change_mtu = sja1105_change_mtu, .port_max_mtu = sja1105_get_max_mtu, .phylink_get_caps = sja1105_phylink_get_caps, - .phylink_mac_select_pcs = sja1105_mac_select_pcs, - .phylink_mac_link_up = sja1105_mac_link_up, - .phylink_mac_link_down = sja1105_mac_link_down, .get_strings = sja1105_get_strings, .get_ethtool_stats = sja1105_get_ethtool_stats, .get_sset_count = sja1105_get_sset_count,
@@ -3375,6 +3390,7 @@ static int sja1105_probe(struct spi_device *spi) ds->dev = dev; ds->num_ports = priv->info->num_ports; ds->ops = &sja1105_switch_ops; + ds->phylink_mac_ops = &sja1105_phylink_mac_ops; ds->priv = priv; priv->ds = ds;
Signature · 1 line
2.30.2
Quoted 5 lines · Russell King (Oracle)
Convert sja1105 to provide its own phylink MAC operations, thus avoiding the shim layer in DSA's
port.cSigned-off-by Russell King (Oracle) <[email protected]>---
Reviewed-by Vladimir Oltean <[email protected]>
Quoted 4 lines · Russell King (Oracle)
Convert sja1105 to provide its own phylink MAC operations, thus avoiding the shim layer in DSA's
port.cSigned-off-by Russell King (Oracle) <[email protected]>
Reviewed-by Florian Fainelli <[email protected]>
Signature · 1 line
Florian
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 7 lines · On Fri, 12 Apr 2024 16:15:13 +0100 you wrote:
Convert sja1105 to provide its own phylink MAC operations, thus avoiding the shim layer in DSA's
port.cSigned-off-by Russell King (Oracle) <[email protected]>--- drivers/net/dsa/sja1105/sja1105_main.c | 38 ++++++++++++++++++-------- 1 file changed, 27 insertions(+), 11 deletions(-)
Here is the summary with links:
- [net-next] net: dsa: sja1105: provide own phylink MAC operations
https://git.kernel.org/netdev/net-next/c/0be9a1e43a07
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html