Skip to content

Commit b6a8a54

Browse files
KanjiMonsterkuba-moo
authored andcommitted
net: dsa: b53: fix resetting speed and pause on forced link
There is no guarantee that the port state override registers have their default values, as not all switches support being reset via register or have a reset GPIO. So when forcing port config, we need to make sure to clear all fields, which we currently do not do for the speed and flow control configuration. This can cause flow control stay enabled, or in the case of speed becoming an illegal value, e.g. configured for 1G (0x2), then setting 100M (0x1), results in 0x3 which is invalid. For PORT_OVERRIDE_SPEED_2000M we need to make sure to only clear it on supported chips, as the bit can have different meanings on other chips, e.g. for BCM5389 this controls scanning PHYs for link/speed configuration. Fixes: 5e00446 ("net: dsa: b53: Add helper to set link parameters") Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://patch.msgid.link/20251101132807.50419-2-jonas.gorski@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 7ed8b63 commit b6a8a54

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,10 @@ static void b53_force_port_config(struct b53_device *dev, int port,
13721372
else
13731373
reg &= ~PORT_OVERRIDE_FULL_DUPLEX;
13741374

1375+
reg &= ~(0x3 << GMII_PO_SPEED_S);
1376+
if (is5301x(dev) || is58xx(dev))
1377+
reg &= ~PORT_OVERRIDE_SPEED_2000M;
1378+
13751379
switch (speed) {
13761380
case 2000:
13771381
reg |= PORT_OVERRIDE_SPEED_2000M;
@@ -1390,6 +1394,11 @@ static void b53_force_port_config(struct b53_device *dev, int port,
13901394
return;
13911395
}
13921396

1397+
if (is5325(dev))
1398+
reg &= ~PORT_OVERRIDE_LP_FLOW_25;
1399+
else
1400+
reg &= ~(PORT_OVERRIDE_RX_FLOW | PORT_OVERRIDE_TX_FLOW);
1401+
13931402
if (rx_pause) {
13941403
if (is5325(dev))
13951404
reg |= PORT_OVERRIDE_LP_FLOW_25;

0 commit comments

Comments
 (0)