diff options
author | Antonio Borneo | 2015-07-19 22:19:46 +0800 |
---|---|---|
committer | Tom Rini | 2015-07-27 15:02:14 -0400 |
commit | 089fddfde2cb360ac2d040166301d5ce7af8314e (patch) | |
tree | 20197d42c8a726023a283499361ab83708db5896 /board/st | |
parent | b0c8f4a7972ea114654a9bac88fd458f2e2e8636 (diff) |
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 <borneo.antonio@gmail.com>
To: Albert Aribaud <albert.u.boot@aribaud.net>
To: Tom Rini <trini@konsulko.com>
To: Kamil Lulko <rev13@wp.pl>
Cc: u-boot@lists.denx.de
Diffstat (limited to 'board/st')
-rw-r--r-- | board/st/stm32f429-discovery/stm32f429-discovery.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c b/board/st/stm32f429-discovery/stm32f429-discovery.c index 2dd5d935d9e..f418186c1ea 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 |