mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dustin Lundquist <dustin@null-ptr.net>
To: Heiko Stuebner <heiko@sntech.de>, Stephen Boyd <sboyd@kernel.org>
Cc: Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Jagan Teki <jagan@edgeble.ai>,
	Elaine Zhang <zhangqing@rock-chips.com>,
	linux-clk@vger.kernel.org,  linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org,
	 linux-kernel@vger.kernel.org
Subject: [PATCH] clk: rockchip: pass the mux mask, not its width, for table muxes
Date: Mon, 30 Nov 2026 20:26:05 -0800	[thread overview]
Message-ID: <e3be928630ea2c4f8b97c744cc1ae9380087252f.camel@null-ptr.net> (raw)

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

                 reply	other threads:[~2026-12-01  4:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3be928630ea2c4f8b97c744cc1ae9380087252f.camel@null-ptr.net \
    --to=dustin@null-ptr.net \
    --cc=bmasney+clk@redhat.com \
    --cc=heiko@sntech.de \
    --cc=jagan@edgeble.ai \
    --cc=jbrunet+clk@baylibre.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=sboyd@kernel.org \
    --cc=zhangqing@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®