All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: dsa: mv88e6xxx: Allow MAC configuration for ports with internal PHY
@ 2020-06-22 18:34 Daniel Mack
  2020-06-22 18:41 ` Andrew Lunn
  2020-06-22 18:52 ` Russell King - ARM Linux admin
  0 siblings, 2 replies; 10+ messages in thread
From: Daniel Mack @ 2020-06-22 18:34 UTC (permalink / raw)
  To: netdev; +Cc: vivien.didelot, andrew, f.fainelli, linux, Daniel Mack

Ports with internal PHYs that are not in 'fixed-link' mode are currently
only set up once at startup with a static config. Attempts to change the
link speed or duplex settings are currently prevented by an early bail
in mv88e6xxx_mac_config(). As the default config forces the speed to
1000M, setups with reduced link speed on such ports are unsupported.

Change that, and allow the configuration of all ports with the passed
settings.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
Russell,

This changes the behaviour implemented in c9a2356f35409a ("net:
dsa: mv88e6xxx: add PHYLINK support"). Do you recall why your code
didn't touch the MLO_AN_PHY mode links in the first place?

 drivers/net/dsa/mv88e6xxx/chip.c | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 2f993e673ec74..5452490dbe9d5 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -471,13 +471,6 @@ int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, int link,
 	return err;
 }
 
-static int mv88e6xxx_phy_is_internal(struct dsa_switch *ds, int port)
-{
-	struct mv88e6xxx_chip *chip = ds->priv;
-
-	return port < chip->info->num_internal_phys;
-}
-
 static void mv88e6065_phylink_validate(struct mv88e6xxx_chip *chip, int port,
 				       unsigned long *mask,
 				       struct phylink_link_state *state)
@@ -605,23 +598,24 @@ static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port,
 	struct mv88e6xxx_chip *chip = ds->priv;
 	int speed, duplex, link, pause, err;
 
-	if ((mode == MLO_AN_PHY) && mv88e6xxx_phy_is_internal(ds, port))
-		return;
+	speed = state->speed;
+	duplex = state->duplex;
+	pause = !!phylink_test(state->advertising, Pause);
 
-	if (mode == MLO_AN_FIXED) {
-		link = LINK_FORCED_UP;
-		speed = state->speed;
-		duplex = state->duplex;
-	} else if (!mv88e6xxx_phy_is_internal(ds, port)) {
+	switch (mode) {
+	case MLO_AN_PHY:
 		link = state->link;
-		speed = state->speed;
-		duplex = state->duplex;
-	} else {
+		break;
+
+	case MLO_AN_FIXED:
+		link = LINK_FORCED_UP;
+		break;
+
+	default:
 		speed = SPEED_UNFORCED;
 		duplex = DUPLEX_UNFORCED;
 		link = LINK_UNFORCED;
 	}
-	pause = !!phylink_test(state->advertising, Pause);
 
 	mv88e6xxx_reg_lock(chip);
 	err = mv88e6xxx_port_setup_mac(chip, port, link, speed, duplex, pause,
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-06-22 19:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 18:34 [PATCH] net: dsa: mv88e6xxx: Allow MAC configuration for ports with internal PHY Daniel Mack
2020-06-22 18:41 ` Andrew Lunn
2020-06-22 18:44   ` Daniel Mack
2020-06-22 18:52     ` Andrew Lunn
2020-06-22 18:58     ` Russell King - ARM Linux admin
2020-06-22 19:16       ` Daniel Mack
2020-06-22 19:29         ` Andrew Lunn
2020-06-22 19:43         ` Russell King - ARM Linux admin
2020-06-22 19:50           ` Daniel Mack
2020-06-22 18:52 ` Russell King - ARM Linux admin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.