
On Fri, Mar 20, 2020 at 4:57 AM Atish Patra atishp@atishpatra.org wrote:
On Thu, Mar 19, 2020 at 7:32 AM Bin Meng bmeng.cn@gmail.com wrote:
On Wed, Mar 18, 2020 at 5:19 AM Atish Patra atish.patra@wdc.com wrote:
FU540 uses OF_SEPARATE instead of OF_PRIOR.
Enable OF_BOARD_FIXUP to update the DT with reserved-memory node.
Signed-off-by: Atish Patra atish.patra@wdc.com
board/sifive/fu540/fu540.c | 15 +++++++++++++++ configs/sifive_fu540_defconfig | 1 + 2 files changed, 16 insertions(+)
diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c index 47a20902517c..82b3a9c8e729 100644 --- a/board/sifive/fu540/fu540.c +++ b/board/sifive/fu540/fu540.c @@ -141,6 +141,21 @@ int misc_init_r(void)
#endif
+#ifdef CONFIG_OF_BOARD_FIXUP +int board_fix_fdt(void *fdt)
This routine should be put in a more generic file, as this could potentially apply to all RISC-V platforms that need OF_BOARD_FIXUP (e.g.: U-Boot itself is built with OF_SEPARATE).
In case other platform wants to override this, we can define it as a __weak.
I am not opposed to that idea but board specific functions should be defined in board specific file. If we can violate that rule, I am okay with the proposal.
Probably we need a new option for this kind of fix-up, not CONFIG_OF_BOARD_FIXUP that suggests it should be put in a board codes, as it is really that board-specific.
We can define a __weak board_fix_fdt in arch/riscv/lib/fdt_fixup.c and guard it under CONFIG_OF_BOARD_FIXUP.
Yep for now this looks good.
+{
int err;
err = riscv_board_reserved_mem_fixup(fdt);
if (err < 0) {
printf("failed to fixup DT for reserved memory: %d\n", err);
return err;
}
return 0;
+} +#endif
int board_init(void) { /* For now nothing to do here. */ diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig index 6d61e6c960ee..8fb3794cd578 100644 --- a/configs/sifive_fu540_defconfig +++ b/configs/sifive_fu540_defconfig @@ -12,3 +12,4 @@ CONFIG_DISPLAY_BOARDINFO=y CONFIG_DEFAULT_DEVICE_TREE="hifive-unleashed-a00" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y +CONFIG_OF_BOARD_FIXUP=y
This line should be inserted after CONFIG_DISPLAY_BOARDINFO=y
Please ensure defconfig file is updated like this:
$ make sifive_fu540_defconfig $ make savedefconfig $ cp defconfig configs/sifive_fu540_defconfig
Sure. Will do that.
Regards, Bin