Commit cb86d3746a4a3f74142ca25f5a21848d5c2b5b55
Committed by
Tom Rini
1 parent
fb07f97d6e
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
odroid-c2: Populate serial# environment variable from efuse
Showing 1 changed file with 8 additions and 0 deletions Side-by-side Diff
board/amlogic/odroid-c2/odroid-c2.c
... | ... | @@ -24,6 +24,7 @@ |
24 | 24 | int misc_init_r(void) |
25 | 25 | { |
26 | 26 | u8 mac_addr[EFUSE_MAC_SIZE]; |
27 | + char serial[EFUSE_SN_SIZE]; | |
27 | 28 | ssize_t len; |
28 | 29 | |
29 | 30 | /* Set RGMII mode */ |
... | ... | @@ -48,6 +49,13 @@ |
48 | 49 | mac_addr, EFUSE_MAC_SIZE); |
49 | 50 | if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr)) |
50 | 51 | eth_setenv_enetaddr("ethaddr", mac_addr); |
52 | + } | |
53 | + | |
54 | + if (!getenv("serial#")) { | |
55 | + len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial, | |
56 | + EFUSE_SN_SIZE); | |
57 | + if (len == EFUSE_SN_SIZE) | |
58 | + setenv("serial#", serial); | |
51 | 59 | } |
52 | 60 | |
53 | 61 | return 0; |