Skip to content

Commit 674b34c

Browse files
KanjiMonsterkuba-moo
authored andcommitted
net: dsa: b53: fix ageing time for BCM53101
For some reason Broadcom decided that BCM53101 uses 0.5s increments for the ageing time register, but kept the field width the same [1]. Due to this, the actual ageing time was always half of what was configured. Fix this by adapting the limits and value calculation for BCM53101. So far it looks like this is the only chip with the increased tick speed: $ grep -l -r "Specifies the aging time in 0.5 seconds" cdk/PKG/chip | sort cdk/PKG/chip/bcm53101/bcm53101_a0_defs.h $ grep -l -r "Specifies the aging time in seconds" cdk/PKG/chip | sort cdk/PKG/chip/bcm53010/bcm53010_a0_defs.h cdk/PKG/chip/bcm53020/bcm53020_a0_defs.h cdk/PKG/chip/bcm53084/bcm53084_a0_defs.h cdk/PKG/chip/bcm53115/bcm53115_a0_defs.h cdk/PKG/chip/bcm53118/bcm53118_a0_defs.h cdk/PKG/chip/bcm53125/bcm53125_a0_defs.h cdk/PKG/chip/bcm53128/bcm53128_a0_defs.h cdk/PKG/chip/bcm53134/bcm53134_a0_defs.h cdk/PKG/chip/bcm53242/bcm53242_a0_defs.h cdk/PKG/chip/bcm53262/bcm53262_a0_defs.h cdk/PKG/chip/bcm53280/bcm53280_a0_defs.h cdk/PKG/chip/bcm53280/bcm53280_b0_defs.h cdk/PKG/chip/bcm53600/bcm53600_a0_defs.h cdk/PKG/chip/bcm89500/bcm89500_a0_defs.h [1] https://github.com/Broadcom/OpenMDK/blob/a5d3fc9b12af3eeb68f2ca0ce7ec4056cd14d6c2/cdk/PKG/chip/bcm53101/bcm53101_a0_defs.h#L28966 Fixes: e39d14a ("net: dsa: b53: implement setting ageing time") Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://patch.msgid.link/20250905124507.59186-1-jonas.gorski@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1dbfb03 commit 674b34c

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

drivers/net/dsa/b53/b53_common.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,9 +1273,15 @@ static int b53_setup(struct dsa_switch *ds)
12731273
*/
12741274
ds->untag_vlan_aware_bridge_pvid = true;
12751275

1276-
/* Ageing time is set in seconds */
1277-
ds->ageing_time_min = 1 * 1000;
1278-
ds->ageing_time_max = AGE_TIME_MAX * 1000;
1276+
if (dev->chip_id == BCM53101_DEVICE_ID) {
1277+
/* BCM53101 uses 0.5 second increments */
1278+
ds->ageing_time_min = 1 * 500;
1279+
ds->ageing_time_max = AGE_TIME_MAX * 500;
1280+
} else {
1281+
/* Everything else uses 1 second increments */
1282+
ds->ageing_time_min = 1 * 1000;
1283+
ds->ageing_time_max = AGE_TIME_MAX * 1000;
1284+
}
12791285

12801286
ret = b53_reset_switch(dev);
12811287
if (ret) {
@@ -2559,7 +2565,10 @@ int b53_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
25592565
else
25602566
reg = B53_AGING_TIME_CONTROL;
25612567

2562-
atc = DIV_ROUND_CLOSEST(msecs, 1000);
2568+
if (dev->chip_id == BCM53101_DEVICE_ID)
2569+
atc = DIV_ROUND_CLOSEST(msecs, 500);
2570+
else
2571+
atc = DIV_ROUND_CLOSEST(msecs, 1000);
25632572

25642573
if (!is5325(dev) && !is5365(dev))
25652574
atc |= AGE_CHANGE;

0 commit comments

Comments
 (0)