public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	FUKAUMI Naoki <naoki@radxa.com>,
	Marco Schirrmeister <mschirrmeister@gmail.com>,
	John Clark <inindev@gmail.com>, Tianling Shen <cnsztl@gmail.com>,
	Detlev Casanova <detlev.casanova@collabora.com>,
	Shawn Lin <shawn.lin@rock-chips.com>
Subject: Re: [PATCH 2/3] soc: rockchip: grf: Support multiple grf to be handled
Date: Mon, 12 Jan 2026 12:07:13 +0100	[thread overview]
Message-ID: <7339936.aoefvbuG5b@diego> (raw)
In-Reply-To: <1768189768-96333-3-git-send-email-shawn.lin@rock-chips.com>

Am Montag, 12. Januar 2026, 04:49:27 Mitteleuropäische Normalzeit schrieb Shawn Lin:
> Currently, only the first matched node will be handled. This leads
> to jtag switching broken for RK3576, as rk3576-sys-grf is found before
> rk3576-ioc-grf. Change the code to scan all the possible node to fix
> the problem.
> 
> Fixes: e1aaecacfa13 ("soc: rockchip: grf: Add rk3576 default GRF values")
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
> 
>  drivers/soc/rockchip/grf.c | 59 +++++++++++++++++++++++-----------------------
>  1 file changed, 30 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/soc/rockchip/grf.c b/drivers/soc/rockchip/grf.c
> index 8974d1c..6d1c624e 100644
> --- a/drivers/soc/rockchip/grf.c
> +++ b/drivers/soc/rockchip/grf.c
> @@ -213,40 +213,41 @@ static int __init rockchip_grf_init(void)
>  {
>  	const struct rockchip_grf_info *grf_info;
>  	const struct of_device_id *match;
> -	struct device_node *np;
> +	struct device_node *np, *from_np = NULL;
>  	struct regmap *grf;
>  	int ret, i;
>  
> -	np = of_find_matching_node_and_match(NULL, rockchip_grf_dt_match,
> -					     &match);
> -	if (!np)
> -		return -ENODEV;
> -	if (!match || !match->data) {
> -		pr_err("%s: missing grf data\n", __func__);
> -		of_node_put(np);
> -		return -EINVAL;
> -	}
> +	while (1) {
> +		np = of_find_matching_node_and_match(from_np,
> +				rockchip_grf_dt_match, &match);

I think this loop could be simplified by using
	for_each_matching_node_and_match

(i.e. like in https://elixir.bootlin.com/linux/v6.18.4/source/drivers/clk/clk.c#L5545)

Heiko



  parent reply	other threads:[~2026-01-12 11:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12  3:49 [PATCH 0/3] Fix sd card support for RK3576 Shawn Lin
2026-01-12  3:49 ` [PATCH 1/3] soc: rockchip: grf: Fix wrong RK3576_IOCGRF_MISC_CON definition Shawn Lin
2026-01-12 11:10   ` Chaoyi Chen
2026-01-12  3:49 ` [PATCH 2/3] soc: rockchip: grf: Support multiple grf to be handled Shawn Lin
2026-01-12 11:04   ` Chaoyi Chen
2026-01-12 11:07   ` Heiko Stübner [this message]
2026-01-12  3:49 ` [PATCH 3/3] arm64: dts: rockchip: Add cd-gpios for sdmmc of RK3576 EVB1 Shawn Lin
2026-01-12 11:08   ` Heiko Stübner

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=7339936.aoefvbuG5b@diego \
    --to=heiko@sntech.de \
    --cc=cnsztl@gmail.com \
    --cc=detlev.casanova@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=inindev@gmail.com \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mschirrmeister@gmail.com \
    --cc=naoki@radxa.com \
    --cc=shawn.lin@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