All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next: PATCH] net: dsa: mv88e6xxx: fix speed setting for CPU/DSA ports
@ 2022-07-14  1:00 Marcin Wojtas
  2022-07-14 12:32 ` Russell King (Oracle)
  2022-07-24 23:38 ` Vladimir Oltean
  0 siblings, 2 replies; 10+ messages in thread
From: Marcin Wojtas @ 2022-07-14  1:00 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: andrew, vivien.didelot, f.fainelli, olteanv, davem, edumazet,
	kuba, pabeni, linux, mw, jaz, tn

Commit 3c783b83bd0f ("net: dsa: mv88e6xxx: get rid of SPEED_MAX setting")
stopped relying on SPEED_MAX constant and hardcoded speed settings
for the switch ports and rely on phylink configuration.

It turned out, however, that when the relevant code is called,
the mac_capabilites of CPU/DSA port remain unset.
mv88e6xxx_setup_port() is called via mv88e6xxx_setup() in
dsa_tree_setup_switches(), which precedes setting the caps in
phylink_get_caps down in the chain of dsa_tree_setup_ports().

As a result the mac_capabilites are 0 and the default speed for CPU/DSA
port is 10M at the start. To fix that execute phylink_get_caps() callback
which fills port's mac_capabilities before they are processed.

Fixes: 3c783b83bd0f ("net: dsa: mv88e6xxx: get rid of SPEED_MAX setting")
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 37b649501500..9fab76f256bb 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3293,7 +3293,12 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
 	 * port and all DSA ports to their maximum bandwidth and full duplex.
 	 */
 	if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) {
-		unsigned long caps = dp->pl_config.mac_capabilities;
+		unsigned long caps;
+
+		if (ds->ops->phylink_get_caps)
+			ds->ops->phylink_get_caps(ds, port, &dp->pl_config);
+
+		caps = dp->pl_config.mac_capabilities;
 
 		if (chip->info->ops->port_max_speed_mode)
 			mode = chip->info->ops->port_max_speed_mode(port);
-- 
2.29.0


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

end of thread, other threads:[~2022-07-25 13:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14  1:00 [net-next: PATCH] net: dsa: mv88e6xxx: fix speed setting for CPU/DSA ports Marcin Wojtas
2022-07-14 12:32 ` Russell King (Oracle)
2022-07-14 17:18   ` Marcin Wojtas
2022-07-14 19:44     ` Russell King (Oracle)
2022-07-15  8:34       ` Marcin Wojtas
2022-07-24 23:38 ` Vladimir Oltean
2022-07-25  0:18   ` Marcin Wojtas
2022-07-25 12:21     ` Vladimir Oltean
2022-07-25 13:32       ` Russell King (Oracle)
2022-07-25 13:43         ` Marcin Wojtas

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.