Skip to content

Commit 0cc70c6

Browse files
committed
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: David S. Miller <[email protected]>
2 parents 3e120e4 + f6f04c0 commit 0cc70c6

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

drivers/net/dsa/ocelot/felix.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,21 @@ static int felix_vlan_del(struct dsa_switch *ds, int port,
778778
return ocelot_vlan_del(ocelot, port, vlan->vid);
779779
}
780780

781+
static void felix_phylink_get_caps(struct dsa_switch *ds, int port,
782+
struct phylink_config *config)
783+
{
784+
struct ocelot *ocelot = ds->priv;
785+
786+
/* This driver does not make use of the speed, duplex, pause or the
787+
* advertisement in its mac_config, so it is safe to mark this driver
788+
* as non-legacy.
789+
*/
790+
config->legacy_pre_march2020 = false;
791+
792+
__set_bit(ocelot->ports[port]->phy_mode,
793+
config->supported_interfaces);
794+
}
795+
781796
static void felix_phylink_validate(struct dsa_switch *ds, int port,
782797
unsigned long *supported,
783798
struct phylink_link_state *state)
@@ -789,16 +804,18 @@ static void felix_phylink_validate(struct dsa_switch *ds, int port,
789804
felix->info->phylink_validate(ocelot, port, supported, state);
790805
}
791806

792-
static void felix_phylink_mac_config(struct dsa_switch *ds, int port,
793-
unsigned int link_an_mode,
794-
const struct phylink_link_state *state)
807+
static struct phylink_pcs *felix_phylink_mac_select_pcs(struct dsa_switch *ds,
808+
int port,
809+
phy_interface_t iface)
795810
{
796811
struct ocelot *ocelot = ds->priv;
797812
struct felix *felix = ocelot_to_felix(ocelot);
798-
struct dsa_port *dp = dsa_to_port(ds, port);
813+
struct phylink_pcs *pcs = NULL;
799814

800815
if (felix->pcs && felix->pcs[port])
801-
phylink_set_pcs(dp->pl, felix->pcs[port]);
816+
pcs = felix->pcs[port];
817+
818+
return pcs;
802819
}
803820

804821
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 = {
15871604
.get_ethtool_stats = felix_get_ethtool_stats,
15881605
.get_sset_count = felix_get_sset_count,
15891606
.get_ts_info = felix_get_ts_info,
1607+
.phylink_get_caps = felix_phylink_get_caps,
15901608
.phylink_validate = felix_phylink_validate,
1591-
.phylink_mac_config = felix_phylink_mac_config,
1609+
.phylink_mac_select_pcs = felix_phylink_mac_select_pcs,
15921610
.phylink_mac_link_down = felix_phylink_mac_link_down,
15931611
.phylink_mac_link_up = felix_phylink_mac_link_up,
15941612
.port_fast_age = felix_port_fast_age,

drivers/net/dsa/ocelot/felix_vsc9959.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -944,15 +944,8 @@ static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
944944
unsigned long *supported,
945945
struct phylink_link_state *state)
946946
{
947-
struct ocelot_port *ocelot_port = ocelot->ports[port];
948947
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
949948

950-
if (state->interface != PHY_INTERFACE_MODE_NA &&
951-
state->interface != ocelot_port->phy_mode) {
952-
linkmode_zero(supported);
953-
return;
954-
}
955-
956949
phylink_set_port_modes(mask);
957950
phylink_set(mask, Autoneg);
958951
phylink_set(mask, Pause);

drivers/net/dsa/ocelot/seville_vsc9953.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -917,15 +917,8 @@ static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
917917
unsigned long *supported,
918918
struct phylink_link_state *state)
919919
{
920-
struct ocelot_port *ocelot_port = ocelot->ports[port];
921920
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
922921

923-
if (state->interface != PHY_INTERFACE_MODE_NA &&
924-
state->interface != ocelot_port->phy_mode) {
925-
linkmode_zero(supported);
926-
return;
927-
}
928-
929922
phylink_set_port_modes(mask);
930923
phylink_set(mask, Autoneg);
931924
phylink_set(mask, Pause);

0 commit comments

Comments
 (0)