soc: rockchip: grf: Support multiple grf to be handled

[ Upstream commit 75fb63ae031211e9264ac888fabc2ca9cd3fcccf ]

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: e1aaecacfa ("soc: rockchip: grf: Add rk3576 default GRF values")
Cc: stable@vger.kernel.org
Cc: Detlev Casanova <detlev.casanova@collabora.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Tested-by: Marco Schirrmeister <mschirrmeister@gmail.com>
Link: https://patch.msgid.link/1768524932-163929-3-git-send-email-shawn.lin@rock-chips.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Shawn Lin 2026-01-16 08:55:29 +08:00 committed by Sasha Levin
parent 833fd7ad59
commit d13418d75e
1 changed files with 23 additions and 24 deletions

View File

@ -202,10 +202,9 @@ static int __init rockchip_grf_init(void)
struct regmap *grf; struct regmap *grf;
int ret, i; int ret, i;
np = of_find_matching_node_and_match(NULL, rockchip_grf_dt_match, for_each_matching_node_and_match(np, rockchip_grf_dt_match, &match) {
&match); if (!of_device_is_available(np))
if (!np) continue;
return -ENODEV;
if (!match || !match->data) { if (!match || !match->data) {
pr_err("%s: missing grf data\n", __func__); pr_err("%s: missing grf data\n", __func__);
of_node_put(np); of_node_put(np);
@ -215,7 +214,6 @@ static int __init rockchip_grf_init(void)
grf_info = match->data; grf_info = match->data;
grf = syscon_node_to_regmap(np); grf = syscon_node_to_regmap(np);
of_node_put(np);
if (IS_ERR(grf)) { if (IS_ERR(grf)) {
pr_err("%s: could not get grf syscon\n", __func__); pr_err("%s: could not get grf syscon\n", __func__);
return PTR_ERR(grf); return PTR_ERR(grf);
@ -231,6 +229,7 @@ static int __init rockchip_grf_init(void)
pr_err("%s: write to %#6x failed with %d\n", pr_err("%s: write to %#6x failed with %d\n",
__func__, val->reg, ret); __func__, val->reg, ret);
} }
}
return 0; return 0;
} }