[PATCH] clk: rockchip: pass the mux mask, not its width, for table muxes
Dustin Lundquist
dustin at null-ptr.net
Mon Nov 30 20:26:05 PST 2026
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 at vger.kernel.org
Assisted-by: Claude Opus 5.5
Signed-off-by: Dustin Lundquist <dustin at 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
More information about the Linux-rockchip
mailing list