[PATCH v1] board: mpfs_icicle: implement board_fdt_blob_setup()

Conor Dooley conor.dooley at microchip.com
Tue Jun 25 11:08:06 CEST 2024


The firmware on the Icicle is capable of providing a devicetree in a1 to
U-Boot, but until now the devicetree has been packaged in a "payload" [1]
alongside U-Boot (or other bootloaders/RTOSes) and appended to the image.
The address of this appended devicetree is placed in a1 by the firmware.
This meant that the mechanism used by OF_SEPARATE to locate the
devicetree at the end of the image would pick up the one provided by the
firmware when u-boot-nodtb.bin was in the payload and U-Boot's devicetree
when u-boot.bin was.

The firmware is now going to be capable of providing a minimal devicetree
(quite cut down due to severe space constraints), but this devicetree is
linked into the firmware that runs out of the L2 rather than at the end
of the U-Boot image. Implement board_fdt_blob_setup() so that this
devicetree can be optionally used, and the devicetree provided in the
"payload" can be used without relying on "happening" to implement the
same strategy as OF_SEPARATE expects in combination with
u-boot-nodtb.bin. Unlike other RISC-V boards, the firmware provided
devicetree is only used when OF_BOARD is set, so that the almost
certainly more complete devicetree in U-Boot will be used unless
explicitly requested otherwise.

Link: https://github.com/polarfire-soc/hart-software-services/blob/master/tools/hss-payload-generator/README.md [1]
Signed-off-by: Conor Dooley <conor.dooley at microchip.com>
---
CC: Ivan Griffin <ivan.griffin at microchip.com>
CC: Padmarao Begari <padmarao.begari at microchip.com>
CC: Cyril Jean <cyril.jean at microchip.com>
CC: Tom Rini <trini at konsulko.com>
CC: Conor Dooley <conor.dooley at microchip.com>
CC: u-boot at lists.denx.de
---
 board/microchip/mpfs_icicle/mpfs_icicle.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/board/microchip/mpfs_icicle/mpfs_icicle.c b/board/microchip/mpfs_icicle/mpfs_icicle.c
index 4d7d843dfa3..2c1f7175f0e 100644
--- a/board/microchip/mpfs_icicle/mpfs_icicle.c
+++ b/board/microchip/mpfs_icicle/mpfs_icicle.c
@@ -9,6 +9,7 @@
 #include <init.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
+#include <asm/sections.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -50,6 +51,24 @@ static void read_device_serial_number(u8 *response, u8 response_size)
 		response_buf[idx] = readb(MPFS_SYS_SERVICE_MAILBOX + idx);
 }
 
+void *board_fdt_blob_setup(int *err)
+{
+	*err = 0;
+	/*
+	 * The devicetree provided by the previous stage is very minimal due to
+	 * severe space constraints. The firmware performs no fixups etc.
+	 * U-Boot, if providing a devicetree, almost certainly has a better
+	 * more complete one than the firmware so that provided by the firmware
+	 * is ignored for OF_SEPARATE.
+	 */
+	if (IS_ENABLED(CONFIG_OF_BOARD)) {
+		if (gd->arch.firmware_fdt_addr)
+			return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
+	}
+
+	return (ulong *)_end;
+}
+
 int board_init(void)
 {
 	/* For now nothing to do here. */
-- 
2.43.2



More information about the U-Boot mailing list