Re: [PATCH v1 2/2] board: starfive: visionfive2: Drop setting of $fdtfile

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Apr 22 09:28:20 CEST 2025


Am 22. April 2025 08:45:26 MESZ schrieb E Shattow <e at freeshell.de>:
>Remove board detection logic from main payload that is duplicated from SPL
>and do not set convenience data into $fdtfile environment variable. U-Boot
>"starfive visionfive2" board target(s) now boot on recent upstream Linux
>Kernel releases without this manipulation since the JH7110 OF_UPSTREAM
>migration. Changes to $fdtfile by users (i.e. following newer or older Linux
>Kernel releases) should follow the advice in general U-Boot documentation.

We cannot expect that users have a U-Boot installed in SPI flash that matches the Linux they intend to boot.

Linux is known to break device-tree compatibility between versions.

Without U-Boot providing a value of $fdtfile that matches the board, U-Boot will not pick up the device-tree on the ESP of Ubuntu's installer image which matches the kernel version.

Please, keep U-Boot providing a value of $fdtfile that matches the actual board.

It would be preferable if that name could be based on the choice of the configuration by SPL instead of duplicating the logic. But I am not aware of logic that provides the configuration name to main U-Boot. Maybe we should simply match the model or conpatible string.

Best regards

Heinrich 

>
>Signed-off-by: E Shattow <e at freeshell.de>
>---
> .../visionfive2/starfive_visionfive2.c        | 61 -------------------
> 1 file changed, 61 deletions(-)
>
>diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
>index b8cd509bc89..039a32f1874 100644
>--- a/board/starfive/visionfive2/starfive_visionfive2.c
>+++ b/board/starfive/visionfive2/starfive_visionfive2.c
>@@ -17,14 +17,6 @@
> DECLARE_GLOBAL_DATA_PTR;
> #define JH7110_L2_PREFETCHER_BASE_ADDR		0x2030000
> #define JH7110_L2_PREFETCHER_HART_OFFSET	0x2000
>-#define FDTFILE_MILK_V_MARS \
>-	"starfive/jh7110-milkv-mars.dtb"
>-#define FDTFILE_VISIONFIVE2_1_2A \
>-	"starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"
>-#define FDTFILE_VISIONFIVE2_1_3B \
>-	"starfive/jh7110-starfive-visionfive-2-v1.3b.dtb"
>-#define FDTFILE_PINE64_STAR64 \
>-	"starfive/jh7110-pine64-star64.dtb"
> 
> /* enable U74-mc hart1~hart4 prefetcher */
> static void enable_prefetcher(void)
>@@ -45,51 +37,6 @@ static void enable_prefetcher(void)
> 	}
> }
> 
>-/**
>- * set_fdtfile() - set the $fdtfile variable based on the board revision
>- */
>-static void set_fdtfile(void)
>-{
>-	u8 version;
>-	const char *fdtfile;
>-	const char *product_id;
>-
>-	fdtfile = env_get("fdtfile");
>-	if (fdtfile)
>-		return;
>-
>-	product_id = get_product_id_from_eeprom();
>-	if (!product_id) {
>-		log_err("Can't read EEPROM\n");
>-		return;
>-	}
>-	if (!strncmp(product_id, "MARS", 4)) {
>-		fdtfile = FDTFILE_MILK_V_MARS;
>-	} else if (!strncmp(product_id, "VF7110", 6)) {
>-		version = get_pcb_revision_from_eeprom();
>-
>-		switch (version) {
>-		case 'a':
>-		case 'A':
>-			fdtfile = FDTFILE_VISIONFIVE2_1_2A;
>-			break;
>-
>-		case 'b':
>-		case 'B':
>-		default:
>-			fdtfile = FDTFILE_VISIONFIVE2_1_3B;
>-			break;
>-		}
>-	} else if (!strncmp(product_id, "STAR64", 6)) {
>-		fdtfile = FDTFILE_PINE64_STAR64;
>-	} else {
>-		log_err("Unknown product\n");
>-		return;
>-	}
>-
>-	env_set("fdtfile", fdtfile);
>-}
>-
> int board_init(void)
> {
> 	enable_caches();
>@@ -98,14 +45,6 @@ int board_init(void)
> 	return 0;
> }
> 
>-int board_late_init(void)
>-{
>-	if (CONFIG_IS_ENABLED(ID_EEPROM))
>-		set_fdtfile();
>-
>-	return 0;
>-}
>-
> int board_fdt_blob_setup(void **fdtp)
> {
> 	if (gd->arch.firmware_fdt_addr) {



More information about the U-Boot mailing list