[PATCH v2 04/11] board: stm32mp1: Implement board_fit_config_name_match() for SPL

Alexandru Gagniuc mr.nuke.me at gmail.com
Wed Sep 8 01:59:26 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 921d0190e0..7542ee52c9 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,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