diff mbox series

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

Message ID 20211008195655.46046-6-mr.nuke.me@gmail.com
State Deferred
Delegated to: Tom Rini
Headers show
Series stm32mp1: Support falcon mode with OP-TEE payloads | expand

Commit Message

Alex G. Oct. 8, 2021, 7:56 p.m. UTC
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@gmail.com>
---
 board/st/stm32mp1/spl.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

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);
+}