From 7d4810cac5fcfb5c4873cef9dcc5f831a4ae2f3f Mon Sep 17 00:00:00 2001 From: Shengyu Qu Date: Sun, 17 Sep 2023 03:36:32 +0800 Subject: [PATCH 1/2] configs: visionfive2: Enable CONFIG_OF_BOARD_SETUP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable CONFIG_OF_BOARD_SETUP, so we could use ft_board_setup() to fixup memory size passed to kernel. Signed-off-by: Shengyu Qu Tested-by: Milan P. Stanić --- configs/starfive_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig index 9df6fcee0f5..8abe645cd11 100644 --- a/configs/starfive_visionfive2_defconfig +++ b/configs/starfive_visionfive2_defconfig @@ -36,6 +36,7 @@ CONFIG_SPL_OPENSBI_LOAD_ADDR=0x40000000 CONFIG_ARCH_RV64I=y CONFIG_CMODEL_MEDANY=y CONFIG_RISCV_SMODE=y +CONFIG_OF_BOARD_SETUP=y # CONFIG_OF_BOARD_FIXUP is not set CONFIG_FIT=y CONFIG_DISTRO_DEFAULTS=y From 43177705ab29ed1ccca970096de1ef3c6095e7e6 Mon Sep 17 00:00:00 2001 From: Shengyu Qu Date: Sun, 17 Sep 2023 03:36:33 +0800 Subject: [PATCH 2/2] board: visionfive2: Fixup memory size passed to kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use fdt_fixup_memory to make the memory size data from dtb match the actual size. Signed-off-by: Shengyu Qu Tested-by: Milan P. Stanić --- board/starfive/visionfive2/starfive_visionfive2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c index 07dcca26b30..07e171cfa2b 100644 --- a/board/starfive/visionfive2/starfive_visionfive2.c +++ b/board/starfive/visionfive2/starfive_visionfive2.c @@ -9,8 +9,10 @@ #include #include #include +#include #include +DECLARE_GLOBAL_DATA_PTR; #define JH7110_L2_PREFETCHER_BASE_ADDR 0x2030000 #define JH7110_L2_PREFETCHER_HART_OFFSET 0x2000 @@ -51,3 +53,8 @@ void *board_fdt_blob_setup(int *err) return (ulong *)&_end; } + +int ft_board_setup(void *blob, struct bd_info *bd) +{ + return fdt_fixup_memory(blob, 0x40000000, gd->ram_size); +}