mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-24 15:21:43 +02:00
riscv: Fix arch_fixup_fdt always failing without /chosen
If /chosen was missing, chosen_offset would never get updated with the new /chosen node. This would cause fdt_setprop_u32 to fail. This patch fixes this by setting chosen_offset. In addition, log any errors from setting boot-hartid as well. Fixes: 5370478d1c7 ("riscv: Add boot hartid to device tree") Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Rick Chen <rick@andestech.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
parent
a6d7e8c914
commit
e90cb0db34
@ -151,14 +151,17 @@ int arch_fixup_fdt(void *blob)
|
|||||||
}
|
}
|
||||||
chosen_offset = fdt_path_offset(blob, "/chosen");
|
chosen_offset = fdt_path_offset(blob, "/chosen");
|
||||||
if (chosen_offset < 0) {
|
if (chosen_offset < 0) {
|
||||||
err = fdt_add_subnode(blob, 0, "chosen");
|
chosen_offset = fdt_add_subnode(blob, 0, "chosen");
|
||||||
if (err < 0) {
|
if (chosen_offset < 0) {
|
||||||
log_err("chosen node cannot be added\n");
|
log_err("chosen node cannot be added\n");
|
||||||
return err;
|
return chosen_offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Overwrite the boot-hartid as U-Boot is the last stage BL */
|
/* Overwrite the boot-hartid as U-Boot is the last stage BL */
|
||||||
fdt_setprop_u32(blob, chosen_offset, "boot-hartid", gd->arch.boot_hart);
|
err = fdt_setprop_u32(blob, chosen_offset, "boot-hartid",
|
||||||
|
gd->arch.boot_hart);
|
||||||
|
if (err < 0)
|
||||||
|
return log_msg_ret("could not set boot-hartid", err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Copy the reserved-memory node to the DT used by OS */
|
/* Copy the reserved-memory node to the DT used by OS */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user