summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2021-11-24 14:36:03 +0000
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2022-01-18 10:17:21 +0000
commitd5b9f8c5121b9a8734ddc2ceaa15f2734a361f70 (patch)
treeaa9a969348cb56e88f6200076bfa2a5e267d0fe2
parentc1be7ba93c308557a2de1f9eb016de9eaa64a0b2 (diff)
net: dsa: sja1105: use .mac_select_pcs() interface
Convert the PCS selection to use mac_select_pcs, which allows the PCS to perform any validation it needs, and removes the need to set the PCS in the mac_config() callback, delving into the higher DSA levels to do so. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r--drivers/net/dsa/sja1105/sja1105_main.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index 6d763f2f63b7..0ea979e4227b 100644
--- a/drivers/net/dsa/sja1105/sja1105_main.c
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
@@ -1370,24 +1370,28 @@ static bool sja1105_phy_mode_mismatch(struct sja1105_private *priv, int port,
return priv->phy_mode[port] != interface;
}
+static struct phylink_pcs *
+sja1105_mac_select_pcs(struct dsa_switch *ds, int port, phy_interface_t iface)
+{
+ struct sja1105_private *priv = ds->priv;
+ struct dw_xpcs *xpcs = priv->xpcs[port];
+
+ if (xpcs)
+ return &xpcs->pcs;
+
+ return NULL;
+}
+
+
static void sja1105_mac_config(struct dsa_switch *ds, int port,
unsigned int mode,
const struct phylink_link_state *state)
{
- struct dsa_port *dp = dsa_to_port(ds, port);
struct sja1105_private *priv = ds->priv;
- struct dw_xpcs *xpcs;
- if (sja1105_phy_mode_mismatch(priv, port, state->interface)) {
+ if (sja1105_phy_mode_mismatch(priv, port, state->interface))
dev_err(ds->dev, "Changing PHY mode to %s not supported!\n",
phy_modes(state->interface));
- return;
- }
-
- xpcs = priv->xpcs[port];
-
- if (xpcs)
- phylink_set_pcs(dp->pl, &xpcs->pcs);
}
static void sja1105_mac_link_down(struct dsa_switch *ds, int port,
@@ -3171,6 +3175,7 @@ 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_config = sja1105_mac_config,
.phylink_mac_link_up = sja1105_mac_link_up,
.phylink_mac_link_down = sja1105_mac_link_down,