Skip to content

Commit 1b65492

Browse files
committed
Merge tag 'v6.20-rockchip-drivers1' of https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into soc/drivers
Two fixes for the default-settings code for the General-Register-Files, which sets system defaults for some settings like disabling the automatic jtag/sdmmc switching. One is a corrected register-offset and the other makes the code actually look for all matched GRF instances, which it didn't do before. * tag 'v6.20-rockchip-drivers1' of https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip: soc: rockchip: grf: Support multiple grf to be handled soc: rockchip: grf: Fix wrong RK3576_IOCGRF_MISC_CON definition Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 1918a0d + 75fb63a commit 1b65492

1 file changed

Lines changed: 28 additions & 29 deletions

File tree

  • drivers/soc/rockchip

drivers/soc/rockchip/grf.c

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static const struct rockchip_grf_info rk3576_sysgrf __initconst = {
146146
.num_values = ARRAY_SIZE(rk3576_defaults_sys_grf),
147147
};
148148

149-
#define RK3576_IOCGRF_MISC_CON 0x04F0
149+
#define RK3576_IOCGRF_MISC_CON 0x40F0
150150

151151
static const struct rockchip_grf_value rk3576_defaults_ioc_grf[] __initconst = {
152152
{ "jtag switching", RK3576_IOCGRF_MISC_CON, FIELD_PREP_WM16_CONST(BIT(1), 0) },
@@ -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)