[PATCH v3 13/13] board: starfive: spl: Support multiple DTBs for JH7110 based boards

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Nov 5 07:47:37 CET 2024


On 11/5/24 04:43, Hal Feng wrote:
> Get product ID and PCB version from EEPROM, use them to select
> the correct DTB.
>
> Signed-off-by: Hal Feng <hal.feng at starfivetech.com>
> ---
>   board/starfive/visionfive2/spl.c | 25 +++++++++++++++++++++++--
>   1 file changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c
> index cf7f39d5c5..4396583026 100644
> --- a/board/starfive/visionfive2/spl.c
> +++ b/board/starfive/visionfive2/spl.c
> @@ -113,7 +113,28 @@ void board_init_f(ulong dummy)
>   #if CONFIG_IS_ENABLED(LOAD_FIT)
>   int board_fit_config_name_match(const char *name)
>   {
> -	/* boot using first FIT config */
> -	return 0;
> +	const char *product_id;
> +	u8 version;
> +
> +	product_id = get_product_id_from_eeprom();
> +
> +	if (!strncmp(product_id, "VF7110", 6)) {
> +		version = get_pcb_revision_from_eeprom();
> +		if ((version == 'b' || version == 'B') &&
> +		    !strcmp(name, "jh7110-starfive-visionfive-2-v1.3b"))
> +			return 0;
> +
> +		if ((version == 'a' || version == 'A') &&
> +		    !strcmp(name, "jh7110-starfive-visionfive-2-v1.2a"))
> +			return 0;
> +	} else if (!strncmp(product_id, "MARS", 4) &&
> +		   !strcmp(name, "jh7110-milkv-mars")) {
> +		return 0;

Hello Hal,

I have seen

Milk-V Mars CM:      MARC-V10-2340-D004E016-xxxxxxxx
Milk-V Mars CM lite: MARC-V10-2340-D002E016-xxxxxxxx

Obviously here they got the eMMC size wrong. Milk-V should have used
E000 for the lite version. But at least they provide a correction
procedure in
https://milkv.io/docs/mars/compute-module/update-eeprom
and confirm the usage of the values MARC and E###.

So here we should be able to detect these two boards, too.

Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

> +	}  else if (!strncmp(product_id, "STAR64", 6) &&
> +		    !strcmp(name, "jh7110-pine64-star64")) {
> +		return 0;
> +	}
> +
> +	return -EINVAL;
>   }
>   #endif



More information about the U-Boot mailing list