Re: [PATCH v2] riscv: mpfs: Read and store FPGA design information on MPFS hardware.

Conor Dooley <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <20260821-clubbed-wildcard-e645eb5c9584@spud>
On Tue, Aug 18, 2026 at 08:48:15AM -0400, Nathan Whitehorn wrote:
> When working with systems with multiple FPGA firmwares, it is sometimes
> useful to be able to use the same U-Boot and script conditional behavior
> based on the FPGA firmware ID and version number. This, allows, for
> example, flashing new FPGA images without flashing the bootloader and
> letting U-Boot and the Linux kernel adapt appropriately.
> 
> This does two things with the information:
> 1. Prints the FPGA design ID and version to the console as part of U-Boot
>    startup, which is helpful to a human working with the board.
> 2. Stores the same information, plus the already-acquired FPGA serial
>    number, in a new set of environment variables (serial_number,
>    design_id, design_ver [the version], and design_backlevel
>    [minimum-version backlevel]). These can be used in a U-Boot script to
>    load different kernels, device trees, etc. depending on the currently
>    installed firmware, which allows U-Boot and the kernel to adapt
>    cleanly to FPGA firmware updates that change accessible peripherals
>    etc.
> 
> Signed-off-by: Nathan Whitehorn <[email protected]>
> ---
> Changes for v2:
> - Rename environment variables to remove the pf_ prefix
> - Remove portions of the patch that added properties to the device tree
> - Style changes
> - Rebase after a5f93037f28624c612288e2d97604d73e03af5a3
> 
> Thanks to Conor Dooley and Tim Ouyang for helpful suggestions.

This looks fine to me modulo some formatting nitpicks. I'd like Jamie to
take a look here but in my book this is
Reviewed-by: Conor Dooley <[email protected]>
with the following changes made:
diff --git a/board/microchip/mpfs_generic/mpfs_generic.c b/board/microchip/mpfs_generic/mpfs_generic.c
index 4423dd1e38c..408fd031c5d 100644
--- a/board/microchip/mpfs_generic/mpfs_generic.c
+++ b/board/microchip/mpfs_generic/mpfs_generic.c
@@ -151,12 +151,13 @@ int board_late_init(void)
 	memset(designid, 0, sizeof(designid));
 	memset(serialstring, 0, sizeof(serialstring));
 
-	ret = mpfs_syscontroller_read_design_info(sys_serv_priv, designid,
-			&designver, &designbacklevel);
+	ret = mpfs_syscontroller_read_design_info(sys_serv_priv, designid, designver,
+						  &designbacklevel);
 	if (ret) {
 		printf("Cannot read device design information\n");
 		return -EINVAL;
 	}
+
 	for (idx = 0; idx < 16; idx++)
 		sprintf(&serialstring[2*idx], "%02x", device_serial_number[idx]);
 
@@ -167,8 +168,7 @@ int board_late_init(void)
 
 	printf("FPGA Design name: %s\n", designid);
 	printf("FPGA Serial: %s\n", serialstring);
-	printf("Design version number %d (backlevel %d)\n", designver,
-			designbacklevel);
+	printf("Design version number %d (backlevel %d)\n", designver, designbacklevel);
 
 	/* Update MAC address with device serial number */
 	mac_addr[0] = 0x00;


Cheers,
Conor.
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCaohMxgAKCRB4tDGHoIJi
0lAWAQCxMc08kThtivJQqogZfLGhjiCacEUjZXJR4oqANNTnCwEA3APj6Qr16/qq
xCLclR2iWWvjWAobjfYj8nnU5f2kRQU=
=uFhU
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.