Linux clock framework development
 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 v3 2/2] clk: rockchip: rk3506: Register the SAI MCLK output gates
Date: Mon, 23 Nov 2026 00:26:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-228472@kernel.org> (raw)
In-Reply-To: <tencent_8AD71C4349D2274F40A1B9ED0A78F1AF1A05@qq.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] clk: rockchip: rk3506: unconditional grf_type_sys gate
  registration
- [Low] clk: rockchip: rk3506: undocumented PMU GRF compatible in
  rk3506_clk_init()
--

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

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

This commit registers the four SAI MCLK output GRF gate clocks for the
RK3506 SoC across the system GRF and PMU GRF.

> diff --git a/drivers/clk/rockchip/clk-rk3506.c b/drivers/clk/rockchip/clk-rk3506.c
> index dd59bd60382ef..5046a6585d580 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),

[Severity: Medium]
Will registering MCLK_OUT_SAI2_TO_IO and MCLK_OUT_SAI3_TO_IO
unconditionally in rk3506_clk_branches fail when the CRU node does not
have a rockchip,grf phandle?

rockchip_clk_init_base() populates ctx->grf from the CRU node's
rockchip,grf property, which is not defined in
Documentation/devicetree/bindings/clock/rockchip,rk3506-cru.yaml
(additionalProperties: false).  When rockchip,grf is absent, ctx->grf is
ERR_PTR(-ENODEV), causing rockchip_clk_register_gate_grf() to log an
error and fail with -EOPNOTSUPP at boot.

If these gates are moved to a separate conditional branch table (or if
system GRF is looked up and added via rockchip_clk_add_grf()), note that
clk_nr_clks in rk3506_clk_init() is currently computed only from
rk3506_clk_branches and would also need to account for the IDs in the
auxiliary GRF branch tables.

>  	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),
> @@ -782,11 +787,20 @@ static struct rockchip_clk_branch rk3506_clk_branches[] __initdata = {
>  			RK3506_CLKGATE_CON(20), 0, GFLAGS),
>  };
>  
> +static struct rockchip_clk_branch rk3506_clk_pmu_grf_branches[] __initdata = {
> +	GATE_GRF(MCLK_OUT_SAI0_TO_IO, "mclk_sai0_to_io", "mclk_out_sai0",
> +		 0, 0x4, 8, CLK_GATE_HIWORD_MASK, grf_type_pmu0),
> +	GATE_GRF(MCLK_OUT_SAI1_TO_IO, "mclk_sai1_to_io", "mclk_out_sai1",
> +		 0, 0x4, 9, CLK_GATE_HIWORD_MASK, grf_type_pmu0),
> +};
> +
>  static void __init rk3506_clk_init(struct device_node *np)
>  {
>  	struct rockchip_clk_provider *ctx;
>  	unsigned long clk_nr_clks;
>  	void __iomem *reg_base;
> +	struct regmap *pmu_grf;
> +	bool have_pmu_grf = false;
>  
>  	clk_nr_clks = rockchip_clk_find_max_clk_id(rk3506_clk_branches,
>  						   ARRAY_SIZE(rk3506_clk_branches)) + 1;
> @@ -804,6 +818,15 @@ static void __init rk3506_clk_init(struct device_node *np)
>  		return;
>  	}
>  
> +	pmu_grf = syscon_regmap_lookup_by_compatible("rockchip,rk3506-grf-pmu");

[Severity: Low]
Is "rockchip,rk3506-grf-pmu" the intended compatible string here?  It is
not documented in Documentation/devicetree/bindings/soc/rockchip/grf.yaml,
where other Rockchip PMU GRF bindings use the "rockchip,<soc>-pmu-grf"
(or "-pmu0-grf" / "-pmugrf") naming convention.

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

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1795366993.git.1194781887@qq.com>
2026-11-23  0:10 ` [PATCH v3 1/2] dt-bindings: clock: rockchip,rk3506-cru: Add SAI MCLK output gate IDs Xiangyu Zhu
2026-11-23  0:10 ` [PATCH v3 2/2] clk: rockchip: rk3506: Register the SAI MCLK output gates Xiangyu Zhu
2026-11-23  0:26   ` 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-228472@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