Skip to content

Commit 829f45f

Browse files
triha2workkuba-moo
authored andcommitted
net: dsa: microchip: Fix KSZ8863 reset problem
ksz8873_valid_regs[] was added for register access for KSZ8863/KSZ8873 switches, but the reset register is not in the list so ksz8_reset_switch() does not take any effect. Replace regmap_update_bits() using ksz_regmap_8 with ksz_rmw8() so that an error message will be given if the register is not defined. A side effect of not resetting the switch is the static MAC table is not cleared. Further additions to the table will show write error as there are only 8 entries in the table. Fixes: d0dec33 ("net: dsa: microchip: Add register access control for KSZ8873 chip") Signed-off-by: Tristram Ha <tristram.ha@microchip.com> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://patch.msgid.link/20250807005453.8306-1-Tristram.Ha@microchip.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent fd60d8a commit 829f45f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

drivers/net/dsa/microchip/ksz8.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@
3636

3737
static void ksz_cfg(struct ksz_device *dev, u32 addr, u8 bits, bool set)
3838
{
39-
regmap_update_bits(ksz_regmap_8(dev), addr, bits, set ? bits : 0);
39+
ksz_rmw8(dev, addr, bits, set ? bits : 0);
4040
}
4141

4242
static void ksz_port_cfg(struct ksz_device *dev, int port, int offset, u8 bits,
4343
bool set)
4444
{
45-
regmap_update_bits(ksz_regmap_8(dev),
46-
dev->dev_ops->get_port_addr(port, offset),
47-
bits, set ? bits : 0);
45+
ksz_rmw8(dev, dev->dev_ops->get_port_addr(port, offset), bits,
46+
set ? bits : 0);
4847
}
4948

5049
/**
@@ -1955,16 +1954,19 @@ int ksz8_setup(struct dsa_switch *ds)
19551954
ksz_cfg(dev, S_LINK_AGING_CTRL, SW_LINK_AUTO_AGING, true);
19561955

19571956
/* Enable aggressive back off algorithm in half duplex mode. */
1958-
regmap_update_bits(ksz_regmap_8(dev), REG_SW_CTRL_1,
1959-
SW_AGGR_BACKOFF, SW_AGGR_BACKOFF);
1957+
ret = ksz_rmw8(dev, REG_SW_CTRL_1, SW_AGGR_BACKOFF, SW_AGGR_BACKOFF);
1958+
if (ret)
1959+
return ret;
19601960

19611961
/*
19621962
* Make sure unicast VLAN boundary is set as default and
19631963
* enable no excessive collision drop.
19641964
*/
1965-
regmap_update_bits(ksz_regmap_8(dev), REG_SW_CTRL_2,
1966-
UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP,
1967-
UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP);
1965+
ret = ksz_rmw8(dev, REG_SW_CTRL_2,
1966+
UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP,
1967+
UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP);
1968+
if (ret)
1969+
return ret;
19681970

19691971
ksz_cfg(dev, S_REPLACE_VID_CTRL, SW_REPLACE_VID, false);
19701972

drivers/net/dsa/microchip/ksz_common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,7 @@ static const struct regmap_range ksz8873_valid_regs[] = {
14471447
regmap_reg_range(0x3f, 0x3f),
14481448

14491449
/* advanced control registers */
1450+
regmap_reg_range(0x43, 0x43),
14501451
regmap_reg_range(0x60, 0x6f),
14511452
regmap_reg_range(0x70, 0x75),
14521453
regmap_reg_range(0x76, 0x78),

0 commit comments

Comments
 (0)