]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/st/stm32f429-discovery/stm32f429-discovery.c
stm32f429: pass the device unique ID in DTB
[karo-tx-uboot.git] / board / st / stm32f429-discovery / stm32f429-discovery.c
index 2dd5d935d9ec9af0c661794d1daea9a9944fd6ae..f418186c1eab88d5942e412e5f84eb32be17a671 100644 (file)
@@ -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