Skip to content

Commit 75fb63a

Browse files
shawn1221mmind
authored andcommitted
soc: rockchip: grf: Support multiple grf to be handled
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>
1 parent 3cdc30c commit 75fb63a

1 file changed

Lines changed: 27 additions & 28 deletions

File tree

  • drivers/soc/rockchip

drivers/soc/rockchip/grf.c

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

220-
np = of_find_matching_node_and_match(NULL, rockchip_grf_dt_match,
221-
&match);
222-
if (!np)
223-
return -ENODEV;
224-
if (!match || !match->data) {
225-
pr_err("%s: missing grf data\n", __func__);
226-
of_node_put(np);
227-
return -EINVAL;
228-
}
229-
230-
grf_info = match->data;
231-
232-
grf = syscon_node_to_regmap(np);
233-
of_node_put(np);
234-
if (IS_ERR(grf)) {
235-
pr_err("%s: could not get grf syscon\n", __func__);
236-
return PTR_ERR(grf);
237-
}
238-
239-
for (i = 0; i < grf_info->num_values; i++) {
240-
const struct rockchip_grf_value *val = &grf_info->values[i];
241-
242-
pr_debug("%s: adjusting %s in %#6x to %#10x\n", __func__,
243-
val->desc, val->reg, val->val);
244-
ret = regmap_write(grf, val->reg, val->val);
245-
if (ret < 0)
246-
pr_err("%s: write to %#6x failed with %d\n",
247-
__func__, val->reg, ret);
220+
for_each_matching_node_and_match(np, rockchip_grf_dt_match, &match) {
221+
if (!of_device_is_available(np))
222+
continue;
223+
if (!match || !match->data) {
224+
pr_err("%s: missing grf data\n", __func__);
225+
of_node_put(np);
226+
return -EINVAL;
227+
}
228+
229+
grf_info = match->data;
230+
231+
grf = syscon_node_to_regmap(np);
232+
if (IS_ERR(grf)) {
233+
pr_err("%s: could not get grf syscon\n", __func__);
234+
return PTR_ERR(grf);
235+
}
236+
237+
for (i = 0; i < grf_info->num_values; i++) {
238+
const struct rockchip_grf_value *val = &grf_info->values[i];
239+
240+
pr_debug("%s: adjusting %s in %#6x to %#10x\n", __func__,
241+
val->desc, val->reg, val->val);
242+
ret = regmap_write(grf, val->reg, val->val);
243+
if (ret < 0)
244+
pr_err("%s: write to %#6x failed with %d\n",
245+
__func__, val->reg, ret);
246+
}
248247
}
249248

250249
return 0;

0 commit comments

Comments
 (0)