* [PATCH net v2] net: dsa: microchip: Fix KSZ8863 reset problem
@ 2025-08-07 0:54 Tristram.Ha
2025-08-07 5:36 ` Oleksij Rempel
2025-08-08 20:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Tristram.Ha @ 2025-08-07 0:54 UTC (permalink / raw)
To: Oleksij Rempel, Woojung Huh, Andrew Lunn, Vladimir Oltean
Cc: Maxime Chevallier, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, UNGLinuxDriver, netdev, linux-kernel, Tristram Ha
From: Tristram Ha <tristram.ha@microchip.com>
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: d0dec3333040 ("net: dsa: microchip: Add register access control for KSZ8873 chip")
Signed-off-by: Tristram Ha <tristram.ha@microchip.com>
---
v2
- Use ksz_rmw8() to display error message
drivers/net/dsa/microchip/ksz8.c | 20 +++++++++++---------
drivers/net/dsa/microchip/ksz_common.c | 1 +
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8.c b/drivers/net/dsa/microchip/ksz8.c
index 76e490070e9c..c354abdafc1b 100644
--- a/drivers/net/dsa/microchip/ksz8.c
+++ b/drivers/net/dsa/microchip/ksz8.c
@@ -36,15 +36,14 @@
static void ksz_cfg(struct ksz_device *dev, u32 addr, u8 bits, bool set)
{
- regmap_update_bits(ksz_regmap_8(dev), addr, bits, set ? bits : 0);
+ ksz_rmw8(dev, addr, bits, set ? bits : 0);
}
static void ksz_port_cfg(struct ksz_device *dev, int port, int offset, u8 bits,
bool set)
{
- regmap_update_bits(ksz_regmap_8(dev),
- dev->dev_ops->get_port_addr(port, offset),
- bits, set ? bits : 0);
+ ksz_rmw8(dev, dev->dev_ops->get_port_addr(port, offset), bits,
+ set ? bits : 0);
}
/**
@@ -1955,16 +1954,19 @@ int ksz8_setup(struct dsa_switch *ds)
ksz_cfg(dev, S_LINK_AGING_CTRL, SW_LINK_AUTO_AGING, true);
/* Enable aggressive back off algorithm in half duplex mode. */
- regmap_update_bits(ksz_regmap_8(dev), REG_SW_CTRL_1,
- SW_AGGR_BACKOFF, SW_AGGR_BACKOFF);
+ ret = ksz_rmw8(dev, REG_SW_CTRL_1, SW_AGGR_BACKOFF, SW_AGGR_BACKOFF);
+ if (ret)
+ return ret;
/*
* Make sure unicast VLAN boundary is set as default and
* enable no excessive collision drop.
*/
- regmap_update_bits(ksz_regmap_8(dev), REG_SW_CTRL_2,
- UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP,
- UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP);
+ ret = ksz_rmw8(dev, REG_SW_CTRL_2,
+ UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP,
+ UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP);
+ if (ret)
+ return ret;
ksz_cfg(dev, S_REPLACE_VID_CTRL, SW_REPLACE_VID, false);
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 7292bfe2f7ca..4cb14288ff0f 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -1447,6 +1447,7 @@ static const struct regmap_range ksz8873_valid_regs[] = {
regmap_reg_range(0x3f, 0x3f),
/* advanced control registers */
+ regmap_reg_range(0x43, 0x43),
regmap_reg_range(0x60, 0x6f),
regmap_reg_range(0x70, 0x75),
regmap_reg_range(0x76, 0x78),
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: dsa: microchip: Fix KSZ8863 reset problem
2025-08-07 0:54 [PATCH net v2] net: dsa: microchip: Fix KSZ8863 reset problem Tristram.Ha
@ 2025-08-07 5:36 ` Oleksij Rempel
2025-08-08 20:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Oleksij Rempel @ 2025-08-07 5:36 UTC (permalink / raw)
To: Tristram.Ha
Cc: Oleksij Rempel, Woojung Huh, Andrew Lunn, Vladimir Oltean,
Maxime Chevallier, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, UNGLinuxDriver, netdev, linux-kernel
On Wed, Aug 06, 2025 at 05:54:53PM -0700, Tristram.Ha@microchip.com wrote:
> From: Tristram Ha <tristram.ha@microchip.com>
>
> 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: d0dec3333040 ("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>
Thank you!
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: dsa: microchip: Fix KSZ8863 reset problem
2025-08-07 0:54 [PATCH net v2] net: dsa: microchip: Fix KSZ8863 reset problem Tristram.Ha
2025-08-07 5:36 ` Oleksij Rempel
@ 2025-08-08 20:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-08 20:50 UTC (permalink / raw)
To: Tristram.Ha
Cc: linux, woojung.huh, andrew, olteanv, maxime.chevallier, davem,
edumazet, kuba, pabeni, UNGLinuxDriver, netdev, linux-kernel,
tristram.ha
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 6 Aug 2025 17:54:53 -0700 you wrote:
> From: Tristram Ha <tristram.ha@microchip.com>
>
> 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.
>
> [...]
Here is the summary with links:
- [net,v2] net: dsa: microchip: Fix KSZ8863 reset problem
https://git.kernel.org/netdev/net/c/829f45f9d992
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-08 20:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 0:54 [PATCH net v2] net: dsa: microchip: Fix KSZ8863 reset problem Tristram.Ha
2025-08-07 5:36 ` Oleksij Rempel
2025-08-08 20:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).