]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
odroid-c2: Populate serial# environment variable from efuse
authorMartin Böh <mart.b@outlook.de>
Fri, 23 Jun 2017 13:40:00 +0000 (13:40 +0000)
committerTom Rini <trini@konsulko.com>
Thu, 6 Jul 2017 17:09:36 +0000 (13:09 -0400)
board/amlogic/odroid-c2/odroid-c2.c

index 9306b56a6ab39cfca385392fd2ef29890ed2561f..b29f56d5ebc0b0ac4539ad7425ce05ca3901e072 100644 (file)
@@ -24,6 +24,7 @@ int board_init(void)
 int misc_init_r(void)
 {
        u8 mac_addr[EFUSE_MAC_SIZE];
+       char serial[EFUSE_SN_SIZE];
        ssize_t len;
 
        /* Set RGMII mode */
@@ -50,5 +51,12 @@ int misc_init_r(void)
                        eth_setenv_enetaddr("ethaddr", mac_addr);
        }
 
+       if (!getenv("serial#")) {
+               len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
+                       EFUSE_SN_SIZE);
+               if (len == EFUSE_SN_SIZE) 
+                       setenv("serial#", serial);
+       }
+
        return 0;
 }