Commit 864ba485 authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by David S. Miller

net: dsa: ocelot: convert to mac_select_pcs()

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.
Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e57a1540
...@@ -798,16 +798,18 @@ static void felix_phylink_validate(struct dsa_switch *ds, int port, ...@@ -798,16 +798,18 @@ static void felix_phylink_validate(struct dsa_switch *ds, int port,
felix->info->phylink_validate(ocelot, port, supported, state); felix->info->phylink_validate(ocelot, port, supported, state);
} }
static void felix_phylink_mac_config(struct dsa_switch *ds, int port, static struct phylink_pcs *felix_phylink_mac_select_pcs(struct dsa_switch *ds,
unsigned int link_an_mode, int port,
const struct phylink_link_state *state) phy_interface_t iface)
{ {
struct ocelot *ocelot = ds->priv; struct ocelot *ocelot = ds->priv;
struct felix *felix = ocelot_to_felix(ocelot); struct felix *felix = ocelot_to_felix(ocelot);
struct dsa_port *dp = dsa_to_port(ds, port); struct phylink_pcs *pcs = NULL;
if (felix->pcs && felix->pcs[port]) if (felix->pcs && felix->pcs[port])
phylink_set_pcs(dp->pl, felix->pcs[port]); pcs = felix->pcs[port];
return pcs;
} }
static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port,
...@@ -1598,7 +1600,7 @@ const struct dsa_switch_ops felix_switch_ops = { ...@@ -1598,7 +1600,7 @@ const struct dsa_switch_ops felix_switch_ops = {
.get_ts_info = felix_get_ts_info, .get_ts_info = felix_get_ts_info,
.phylink_get_caps = felix_phylink_get_caps, .phylink_get_caps = felix_phylink_get_caps,
.phylink_validate = felix_phylink_validate, .phylink_validate = felix_phylink_validate,
.phylink_mac_config = felix_phylink_mac_config, .phylink_mac_select_pcs = felix_phylink_mac_select_pcs,
.phylink_mac_link_down = felix_phylink_mac_link_down, .phylink_mac_link_down = felix_phylink_mac_link_down,
.phylink_mac_link_up = felix_phylink_mac_link_up, .phylink_mac_link_up = felix_phylink_mac_link_up,
.port_fast_age = felix_port_fast_age, .port_fast_age = felix_port_fast_age,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment