* [PATCH] clk: rockchip: pass the mux mask, not its width, for table muxes
@ 2026-12-01 4:26 Dustin Lundquist
0 siblings, 0 replies; only message in thread
From: Dustin Lundquist @ 2026-12-01 4:26 UTC (permalink / raw)
To: Heiko Stuebner, Stephen Boyd
Cc: Brian Masney, Jerome Brunet, Jagan Teki, Elaine Zhang, linux-clk,
linux-arm-kernel, linux-rockchip, linux-kernel
rockchip_clk_register_branches() passes the mux width to
clk_register_mux_table(), whose argument is a mask. A 2-bit table mux
therefore gets mask 0b10, and because Rockchip muxes use HIWORD write
enables, bit 0 of the field is never written.
The only MUXTBL user is RV1126's rgmii_mode_clk (CRU_GMAC_CON[3:2],
table { 2, 3, 0, 1 }). Selecting the /5 parent for 100 Mbit/s RGMII
writes 0b11, which lands as 0b10, the /50 parent. The clock framework
reports 25 MHz while the MAC's TX clock runs at 2.5 MHz, so at
100 Mbit/s the link comes up and receives, but nothing sent arrives.
1000 Mbit/s (0b00) and 10 Mbit/s (0b10) are unaffected.
Pass BIT(width) - 1, as clk_register_mux() does.
Tested on a GL.iNet Comet (RV1126, RTL8211F): with the fix,
CRU_GMAC_CON reads 0xc at 100 Mbit/s, and traffic passes at 1000, 100
and 10 Mbit/s, full and half duplex. Before, it read 0x8 and nothing
was transmitted at 100 Mbit/s.
Fixes: 30d8b7d43c84 ("clk: rockchip: Add MUXTBL variant")
Cc: stable@vger.kernel.org
Assisted-by: Claude Opus 5.5
Signed-off-by: Dustin Lundquist <dustin@null-ptr.net>
---
drivers/clk/rockchip/clk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index 10df21178ba4..19f737722ab1 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -546,7 +546,8 @@ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
list->parent_names, list->num_parents,
flags,
ctx->reg_base + list->muxdiv_offset,
- list->mux_shift, list->mux_width,
+ list->mux_shift,
+ BIT(list->mux_width) - 1,
list->mux_flags, list->mux_table,
&ctx->lock);
else
--
2.47.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-01 4:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-01 4:26 [PATCH] clk: rockchip: pass the mux mask, not its width, for table muxes Dustin Lundquist
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®