Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xiangyu Zhu" <1194781887@qq.com>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 3/3] clk: rockchip: rk3506: Register the SAI MCLK output gates
Date: Mon, 23 Nov 2026 00:49:41 +0000	[thread overview]
Message-ID: <sashiko-outbox-228491@kernel.org> (raw)
In-Reply-To: <tencent_4C9312830F80807EB3C015E9A2653587B906@qq.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] clk: rockchip: rk3506: missing system GRF lookup in
  rk3506_clk_init()
--

commit a7ec6ea6b886d5202ab753e0b478970ccba36fb0
Author: Xiangyu Zhu <1194781887@qq.com>

clk: rockchip: rk3506: Register the SAI MCLK output gates

This commit registers the four RK3506 SAI MCLK output gates in the system
and PMU GRFs, looking up the PMU GRF syscon by compatible and registering
the SAI0 and SAI1 gates when it is present.

> diff --git a/drivers/clk/rockchip/clk-rk3506.c b/drivers/clk/rockchip/clk-rk3506.c
> index dd59bd60382ef..956d5e9238b9c 100644
> --- a/drivers/clk/rockchip/clk-rk3506.c
> +++ b/drivers/clk/rockchip/clk-rk3506.c
[ ... ]
> @@ -608,6 +609,8 @@ static struct rockchip_clk_branch rk3506_clk_branches[] __initdata = {
>  			RK3506_CLKGATE_CON(18), 3, GFLAGS),
>  	GATE(MCLK_OUT_SAI2, "mclk_out_sai2", "mclk_sai2", 0,
>  			RK3506_CLKGATE_CON(18), 4, GFLAGS),
> +	GATE_GRF(MCLK_OUT_SAI2_TO_IO, "mclk_sai2_to_io", "mclk_out_sai2",
> +		 0, 0x4, 2, CLK_GATE_HIWORD_MASK, grf_type_sys),
>  	COMPOSITE(MCLK_SAI3_SRC, "mclk_sai3_src", mclk_sai_asrc_parents_p, 0,
>  			RK3506_CLKSEL_CON(52), 8, 4, MFLAGS, 0, 8, DFLAGS,
>  			RK3506_CLKGATE_CON(18), 5, GFLAGS),
> @@ -617,6 +620,8 @@ static struct rockchip_clk_branch rk3506_clk_branches[] __initdata = {
>  			RK3506_CLKGATE_CON(18), 7, GFLAGS),
>  	GATE(MCLK_OUT_SAI3, "mclk_out_sai3", "mclk_sai3_src", 0,
>  			RK3506_CLKGATE_CON(18), 8, GFLAGS),
> +	GATE_GRF(MCLK_OUT_SAI3_TO_IO, "mclk_sai3_to_io", "mclk_out_sai3",
> +		 0, 0x4, 3, CLK_GATE_HIWORD_MASK, grf_type_sys),
>  	COMPOSITE(MCLK_SAI4_SRC, "mclk_sai4_src", mclk_sai_asrc_parents_p, 0,
>  			RK3506_CLKSEL_CON(53), 8, 4, MFLAGS, 0, 8, DFLAGS,
>  			RK3506_CLKGATE_CON(18), 9, GFLAGS),
[ ... ]
> @@ -804,6 +818,15 @@ static void __init rk3506_clk_init(struct device_node *np)
>  		return;
>  	}
>  
> +	pmu_grf = syscon_regmap_lookup_by_compatible("rockchip,rk3506-pmu-grf");
> +	if (IS_ERR(pmu_grf)) {
> +		pr_warn("%s: could not get PMU GRF syscon\n", __func__);
> +	} else if (rockchip_clk_add_grf(ctx, pmu_grf, grf_type_pmu0)) {
> +		pr_warn("%s: could not add PMU GRF\n", __func__);
> +	} else {
> +		have_pmu_grf = true;
> +	}
> +

[Severity: Medium]
Does registering MCLK_OUT_SAI2_TO_IO and MCLK_OUT_SAI3_TO_IO fail with
-EOPNOTSUPP on a binding-compliant device tree?

The commit message notes that the CRU already has the system GRF via its
"rockchip,grf" phandle, which rockchip_clk_init_base() uses to populate
ctx->grf.  However,
Documentation/devicetree/bindings/clock/rockchip,rk3506-cru.yaml does not
define "rockchip,grf" and sets "additionalProperties: false", so ctx->grf
is ERR_PTR(-ENODEV).  Because rk3506_clk_init() does not look up
"rockchip,rk3506-grf" or register grf_type_sys via rockchip_clk_add_grf(),
rockchip_clk_register_branches() falls back to ctx->grf and
rockchip_clk_register_gate_grf() fails for both SAI2 and SAI3 gates.

Should rk3506_clk_init() also look up "rockchip,rk3506-grf" by compatible
and register grf_type_sys (and if the SAI2/SAI3 gates are moved to a
separate conditional branch table, include that table when computing
clk_nr_clks since MCLK_OUT_SAI3_TO_IO has the highest clock ID)?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_452BA245FE6A7C7308A5121F5281E9E6A807@qq.com?part=3

      reply	other threads:[~2026-11-23  0:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1795394137.git.1194781887@qq.com>
2026-11-23  0:38 ` [PATCH v4 1/3] dt-bindings: soc: rockchip: Add RK3506 GRF compatibles Xiangyu Zhu
2026-11-23  0:38 ` [PATCH v4 2/3] dt-bindings: clock: rockchip,rk3506-cru: Add SAI MCLK output gate IDs Xiangyu Zhu
2026-11-23  0:38 ` [PATCH v4 3/3] clk: rockchip: rk3506: Register the SAI MCLK output gates Xiangyu Zhu
2026-11-23  0:49   ` sashiko-bot [this message]

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=sashiko-outbox-228491@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=1194781887@qq.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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