From 089fddfde2cb360ac2d040166301d5ce7af8314e Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 19 Jul 2015 22:19:46 +0800 Subject: stm32f429: pass the device unique ID in DTB Read device unique ID and set environment variable "serial#". Value would then be passed to kernel through DTB. To read ID from DTB, kernel is required to have commit: 3f599875e5202986b350618a617527ab441bf206 (ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo) This commit is already mainline since v4.1-rc1. Signed-off-by: Antonio Borneo To: Albert Aribaud To: Tom Rini To: Kamil Lulko Cc: u-boot@lists.denx.de --- board/st/stm32f429-discovery/stm32f429-discovery.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'board/st') diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c b/board/st/stm32f429-discovery/stm32f429-discovery.c index 2dd5d93..f418186 100644 --- a/board/st/stm32f429-discovery/stm32f429-discovery.c +++ b/board/st/stm32f429-discovery/stm32f429-discovery.c @@ -285,3 +285,22 @@ int board_init(void) return 0; } + +#ifdef CONFIG_MISC_INIT_R +int misc_init_r(void) +{ + char serialno[25]; + uint32_t u_id_low, u_id_mid, u_id_high; + + if (!getenv("serial#")) { + u_id_low = readl(&STM32_U_ID->u_id_low); + u_id_mid = readl(&STM32_U_ID->u_id_mid); + u_id_high = readl(&STM32_U_ID->u_id_high); + sprintf(serialno, "%08x%08x%08x", + u_id_high, u_id_mid, u_id_low); + setenv("serial#", serialno); + } + + return 0; +} +#endif -- cgit v1.1