[PATCH v3 05/13] board: stm32mp1: Implement board_fit_config_name_match() for SPL

Alexandru Gagniuc mr.nuke.me at gmail.com
Fri Oct 8 21:56:47 CEST 2021


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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/board/st/stm32mp1/spl.c b/board/st/stm32mp1/spl.c
index ea2f809245..01aa5e51c5 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>
@@ -82,3 +83,16 @@ void board_debug_uart_init(void)
 #endif
 }
 #endif
+
+int board_fit_config_name_match(const char *name)
+{
+	const void *compatible;
+
+	compatible = fdt_getprop(gd->fdt_blob, 0, "compatible", NULL);
+
+	/* only STM boards are supported (currently) */
+	if (strncmp(compatible, "st,", 3) != 0)
+		return 1;
+
+	return !strstr(name, compatible + 3);
+}
-- 
2.31.1



More information about the U-Boot mailing list