[PATCH] riscv: ae350: Fix xip config boot failure

Andes uboot at andestech.com
Wed Apr 20 03:33:53 CEST 2022


From: Rick Chen <rick at andestech.com>

It will fail to boot with ae350_rv[32|64]_spl_xip_defconfig.
It need to add OONFIG_XIP to get the specific HW address for DTB.
Also drop OF_SEPARATE in board_fdt_blob_setup() because it will
never reach here anyway.It only allow OF_BOARD to call
board_fdt_blob_setup() in fdtdec_setup().

Fixes: 2e8d2f88439d ("riscv: Remove OF_PRIOR_STAGE from RISC-V boards")
Signed-off-by: Rick Chen <rick at andestech.com>
---
 board/AndesTech/ax25-ae350/ax25-ae350.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/board/AndesTech/ax25-ae350/ax25-ae350.c b/board/AndesTech/ax25-ae350/ax25-ae350.c
index d6a4291..9ca7fdf 100644
--- a/board/AndesTech/ax25-ae350/ax25-ae350.c
+++ b/board/AndesTech/ax25-ae350/ax25-ae350.c
@@ -54,13 +54,20 @@ ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
 	return 0;
 }
 
+#define ANDES_HW_DTB_ADDRESS	0xF2000000
 void *board_fdt_blob_setup(int *err)
 {
 	*err = 0;
+
 #if defined(CONFIG_OF_BOARD)
-	return (void *)(ulong)gd->arch.firmware_fdt_addr;
-#elif defined(CONFIG_OF_SEPARATE)
+#if (defined(CONFIG_XIP) && CONFIG_IS_ENABLED(RISCV_MMODE))
+	if (fdt_magic(CONFIG_SYS_FDT_BASE) == FDT_MAGIC)
 	return (void *)CONFIG_SYS_FDT_BASE;
+	return (void *)ANDES_HW_DTB_ADDRESS;
+#else
+
+	return (void *)(ulong)gd->arch.firmware_fdt_addr;
+#endif
 #else
 	*err = -EINVAL;
 	return NULL;
-- 
2.7.4



More information about the U-Boot mailing list