[U-Boot] [PATCH 4/5] stm32mp1: Fixup the Linux DeviceTree with coprocessor information

Fabien Dessenne fabien.dessenne at st.com
Wed Oct 9 15:36:28 UTC 2019


When the coprocessor has been started, provide the context to Linux
kernel so it can handle it:
- update the coprocessor node of kernel DeviceTree with the
  "early-booted" property.
- write the resource table address in a dedicated backup register.

Signed-off-by: Fabien Dessenne <fabien.dessenne at st.com>
---
 board/st/stm32mp1/stm32mp1.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 18f9b84..8c669d0 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -891,6 +891,7 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts)
 #if defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, bd_t *bd)
 {
+	int off, id = 0; /* Copro id fixed to 0 as only one coproc on mp1 */
 #ifdef CONFIG_FDT_FIXUP_PARTITIONS
 	struct node_info nodes[] = {
 		{ "st,stm32f469-qspi",		MTD_DEV_TYPE_NOR,  },
@@ -899,6 +900,17 @@ int ft_board_setup(void *blob, bd_t *bd)
 	fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
 #endif
 
+	/* Update DT if coprocessor started */
+	off = fdt_path_offset(blob, "/mlahb/m4 at 10000000");
+	if (off > 0) {
+		if (!rproc_is_running(id)) {
+			fdt_setprop_empty(blob, off, "early-booted");
+		} else {
+			fdt_delprop(blob, off, "early-booted");
+			writel(0, TAMP_COPRO_RSC_TBL_ADDRESS);
+		}
+	}
+
 	return 0;
 }
 #endif
@@ -918,10 +930,8 @@ static void board_copro_image_process(ulong fw_image, size_t fw_size)
 	printf("Load Remote Processor %d with data at addr=0x%08lx %u bytes:%s\n",
 	       id, fw_image, fw_size, ret ? " Failed!" : " Success!");
 
-	if (!ret) {
+	if (!ret)
 		rproc_start(id);
-		env_set("copro_state", "booted");
-	}
 }
 
 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_COPRO, board_copro_image_process);
-- 
2.7.4



More information about the U-Boot mailing list