Skip to content
/ linux Public

Commit d13418d

Browse files
shawn1221Sasha Levin
authored andcommitted
soc: rockchip: grf: Support multiple grf to be handled
[ Upstream commit 75fb63a ] 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: e1aaeca ("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>
1 parent 833fd7a commit d13418d

File tree

1 file changed

+27
-28
lines changed
  • drivers/soc/rockchip

1 file changed

+27
-28
lines changed

drivers/soc/rockchip/grf.c

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -202,34 +202,33 @@ static int __init rockchip_grf_init(void)
202202
struct regmap *grf;
203203
int ret, i;
204204

205-
np = of_find_matching_node_and_match(NULL, rockchip_grf_dt_match,
206-
&match);
207-
if (!np)
208-
return -ENODEV;
209-
if (!match || !match->data) {
210-
pr_err("%s: missing grf data\n", __func__);
211-
of_node_put(np);
212-
return -EINVAL;
213-
}
214-
215-
grf_info = match->data;
216-
217-
grf = syscon_node_to_regmap(np);
218-
of_node_put(np);
219-
if (IS_ERR(grf)) {
220-
pr_err("%s: could not get grf syscon\n", __func__);
221-
return PTR_ERR(grf);
222-
}
223-
224-
for (i = 0; i < grf_info->num_values; i++) {
225-
const struct rockchip_grf_value *val = &grf_info->values[i];
226-
227-
pr_debug("%s: adjusting %s in %#6x to %#10x\n", __func__,
228-
val->desc, val->reg, val->val);
229-
ret = regmap_write(grf, val->reg, val->val);
230-
if (ret < 0)
231-
pr_err("%s: write to %#6x failed with %d\n",
232-
__func__, val->reg, ret);
205+
for_each_matching_node_and_match(np, rockchip_grf_dt_match, &match) {
206+
if (!of_device_is_available(np))
207+
continue;
208+
if (!match || !match->data) {
209+
pr_err("%s: missing grf data\n", __func__);
210+
of_node_put(np);
211+
return -EINVAL;
212+
}
213+
214+
grf_info = match->data;
215+
216+
grf = syscon_node_to_regmap(np);
217+
if (IS_ERR(grf)) {
218+
pr_err("%s: could not get grf syscon\n", __func__);
219+
return PTR_ERR(grf);
220+
}
221+
222+
for (i = 0; i < grf_info->num_values; i++) {
223+
const struct rockchip_grf_value *val = &grf_info->values[i];
224+
225+
pr_debug("%s: adjusting %s in %#6x to %#10x\n", __func__,
226+
val->desc, val->reg, val->val);
227+
ret = regmap_write(grf, val->reg, val->val);
228+
if (ret < 0)
229+
pr_err("%s: write to %#6x failed with %d\n",
230+
__func__, val->reg, ret);
231+
}
233232
}
234233

235234
return 0;

0 commit comments

Comments
 (0)