Commit 0cc70c6e authored by David S. Miller's avatar David S. Miller

Merge branch 'dsa-ocelot-phylink-updates'

Russell King says:

====================
net: dsa: ocelot: phylink updates

This series updates the Ocelot DSA driver for some of the recent
phylink changes. Specifically, we fill in the supported_interfaces
fields, convert to mac_select_pcs and mark the driver as non-legacy.
We do not convert to phylink_generic_validate() as Ocelot has
special support for its rate adapting PCS which makes the generic
validate method unsuitable for this driver.

The three changes mentioned above are implemented in their own
separate patches with one additional cleanup:

1) Populate the supported_interfaces bitmap
2) Remove the now unnecessary interface checks in the validate methods
3) Convert from phylink_set_pcs() to .mac_select_pcs.
4) Mark the driver as non-legacy

Thanks.

RFC -> non-RFC: add reviewed-by/tested-by's, update patch 1 to set the
supported_interfaces bitmap in felix.c rather than the sub-drivers as
requested by Vladimir.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 3e120e45 f6f04c02
...@@ -778,6 +778,21 @@ static int felix_vlan_del(struct dsa_switch *ds, int port, ...@@ -778,6 +778,21 @@ static int felix_vlan_del(struct dsa_switch *ds, int port,
return ocelot_vlan_del(ocelot, port, vlan->vid); return ocelot_vlan_del(ocelot, port, vlan->vid);
} }
static void felix_phylink_get_caps(struct dsa_switch *ds, int port,
struct phylink_config *config)
{
struct ocelot *ocelot = ds->priv;
/* This driver does not make use of the speed, duplex, pause or the
* advertisement in its mac_config, so it is safe to mark this driver
* as non-legacy.
*/
config->legacy_pre_march2020 = false;
__set_bit(ocelot->ports[port]->phy_mode,
config->supported_interfaces);
}
static void felix_phylink_validate(struct dsa_switch *ds, int port, static void felix_phylink_validate(struct dsa_switch *ds, int port,
unsigned long *supported, unsigned long *supported,
struct phylink_link_state *state) struct phylink_link_state *state)
...@@ -789,16 +804,18 @@ static void felix_phylink_validate(struct dsa_switch *ds, int port, ...@@ -789,16 +804,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,
...@@ -1587,8 +1604,9 @@ const struct dsa_switch_ops felix_switch_ops = { ...@@ -1587,8 +1604,9 @@ const struct dsa_switch_ops felix_switch_ops = {
.get_ethtool_stats = felix_get_ethtool_stats, .get_ethtool_stats = felix_get_ethtool_stats,
.get_sset_count = felix_get_sset_count, .get_sset_count = felix_get_sset_count,
.get_ts_info = felix_get_ts_info, .get_ts_info = felix_get_ts_info,
.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,
......
...@@ -944,15 +944,8 @@ static void vsc9959_phylink_validate(struct ocelot *ocelot, int port, ...@@ -944,15 +944,8 @@ static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
unsigned long *supported, unsigned long *supported,
struct phylink_link_state *state) struct phylink_link_state *state)
{ {
struct ocelot_port *ocelot_port = ocelot->ports[port];
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
if (state->interface != PHY_INTERFACE_MODE_NA &&
state->interface != ocelot_port->phy_mode) {
linkmode_zero(supported);
return;
}
phylink_set_port_modes(mask); phylink_set_port_modes(mask);
phylink_set(mask, Autoneg); phylink_set(mask, Autoneg);
phylink_set(mask, Pause); phylink_set(mask, Pause);
......
...@@ -917,15 +917,8 @@ static void vsc9953_phylink_validate(struct ocelot *ocelot, int port, ...@@ -917,15 +917,8 @@ static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
unsigned long *supported, unsigned long *supported,
struct phylink_link_state *state) struct phylink_link_state *state)
{ {
struct ocelot_port *ocelot_port = ocelot->ports[port];
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
if (state->interface != PHY_INTERFACE_MODE_NA &&
state->interface != ocelot_port->phy_mode) {
linkmode_zero(supported);
return;
}
phylink_set_port_modes(mask); phylink_set_port_modes(mask);
phylink_set(mask, Autoneg); phylink_set(mask, Autoneg);
phylink_set(mask, Pause); phylink_set(mask, Pause);
......
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