[PATCH 2/3] soc: rockchip: grf: Support multiple grf to be handled
Heiko Stübner
heiko at sntech.de
Mon Jan 12 03:07:13 PST 2026
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 at 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
More information about the Linux-rockchip
mailing list