[PATCH 03/10] board: stm32mp1: Implement board_fit_config_name_match() for SPL

Patrick DELAUNAY patrick.delaunay at foss.st.com
Tue Aug 31 18:39:41 CEST 2021


Hi

Add in CC the MAINTAINERS.

On 8/26/21 11:42 PM, Alexandru Gagniuc wrote:
> This function is needed when loading a FIT image from SPL. It selects
> the correct configuration node for the current board. Implement it.
>
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
> ---
>   board/st/stm32mp1/spl.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/board/st/stm32mp1/spl.c b/board/st/stm32mp1/spl.c
> index bb210d7727..543c037ad8 100644
> --- a/board/st/stm32mp1/spl.c
> +++ b/board/st/stm32mp1/spl.c
> @@ -5,6 +5,7 @@
>   
>   #include <config.h>
>   #include <common.h>
> +#include <dm/device.h>
>   #include <init.h>
>   #include <asm/io.h>
>   #include <asm/arch/sys_proto.h>
> @@ -92,3 +93,12 @@ void board_debug_uart_init(void)
>   #endif
>   }
>   #endif
> +
> +int board_fit_config_name_match(const char *name)
> +{
> +	if (of_machine_is_compatible("st,stm32mp157c-dk2"))
> +		return !strstr(name, "stm32mp157c-dk2");
> +
> +	/* Okay, it's most likely an EV board */
> +	return !strstr(name, "stm32mp157") + !strstr(name, "-ev");
> +}

It is not working for all STMicroelectronics boards....

=> st,stm32mp157a-dk1 for example

based on board_late_init => I propose board_name extraction from compatible :

#ifdef CONFIG_SPL_LOAD_FIT
int board_fit_config_name_match(const char *name)
{
	const void *fdt_compat;
	int fdt_compat_len;

	fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible", &fdt_compat_len);

	/* only STMicrolectronics board are supported */
	if (strncmp(fdt_compat, "st,", 3) != 0)
		return 1;
	
	return !strstr(name, fdt_compat + 3);
}
#endif




More information about the U-Boot mailing list