aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@foss.st.com>2024-01-15 15:05:55 +0100
committerPatrice Chotard <patrice.chotard@foss.st.com>2024-01-19 14:38:59 +0100
commiteff29f0a6092dee3c5cf5b759cf14ef1f3c4dab8 (patch)
treed154feb8bdba2e1143f0d6e5155003f22589123e
parent1067d7e3a00f7a50b6b50ea7ccac8ed46db1b0af (diff)
downloadu-boot-eff29f0a6092dee3c5cf5b759cf14ef1f3c4dab8.zip
u-boot-eff29f0a6092dee3c5cf5b759cf14ef1f3c4dab8.tar.gz
u-boot-eff29f0a6092dee3c5cf5b759cf14ef1f3c4dab8.tar.bz2
board: st: stm32mp2: display the board identification
Add the display of the STMicroelectronics board identification saved in OTP in stm32mp2 checkboard function. Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
-rw-r--r--board/st/stm32mp2/stm32mp2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c
index 9a88158..aa7dd31 100644
--- a/board/st/stm32mp2/stm32mp2.c
+++ b/board/st/stm32mp2/stm32mp2.c
@@ -9,9 +9,12 @@
#include <env.h>
#include <fdt_support.h>
#include <log.h>
+#include <misc.h>
#include <asm/global_data.h>
#include <asm/arch/sys_proto.h>
+#include <dm/device.h>
#include <dm/ofnode.h>
+#include <dm/uclass.h>
/*
* Get a global data pointer
@@ -20,6 +23,9 @@ DECLARE_GLOBAL_DATA_PTR;
int checkboard(void)
{
+ int ret;
+ u32 otp;
+ struct udevice *dev;
const char *fdt_compat;
int fdt_compat_len;
@@ -27,6 +33,23 @@ int checkboard(void)
log_info("Board: stm32mp2 (%s)\n", fdt_compat && fdt_compat_len ? fdt_compat : "");
+ /* display the STMicroelectronics board identification */
+ if (CONFIG_IS_ENABLED(CMD_STBOARD)) {
+ ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_DRIVER_GET(stm32mp_bsec),
+ &dev);
+ if (!ret)
+ ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
+ &otp, sizeof(otp));
+ if (ret > 0 && otp)
+ log_info("Board: MB%04x Var%d.%d Rev.%c-%02d\n",
+ otp >> 16,
+ (otp >> 12) & 0xF,
+ (otp >> 4) & 0xF,
+ ((otp >> 8) & 0xF) - 1 + 'A',
+ otp & 0xF);
+ }
+
return 0;
}