diff options
author | Tom Rini <trini@konsulko.com> | 2019-09-02 23:21:44 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-09-02 23:21:44 -0400 |
commit | 83a5df42614c566c3c642871f683e66a53d228ae (patch) | |
tree | ea53c8fd1dd9bf65bc1d29dd9a0957d060dc1917 /board/sifive/fu540/fu540.c | |
parent | d22c8be964a870f59d2fdab6c67cefa0c4799364 (diff) | |
parent | 61ce84b2cf1a6672c8e402ce8174554b25629692 (diff) |
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
- Skip unavailable hart in the get_count().
- fu540 set serial env from otp.
- fu540 add mmc0 as a boot target device.
- Update fix_rela_dyn and add absolute reloc addend.
- Andestech PLIC driver will skip unavailable hart.
- Support Andestech V5L2 cache driver.
Diffstat (limited to 'board/sifive/fu540/fu540.c')
-rw-r--r-- | board/sifive/fu540/fu540.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c index 11daf1a75a..47a2090251 100644 --- a/board/sifive/fu540/fu540.c +++ b/board/sifive/fu540/fu540.c @@ -122,10 +122,20 @@ static void fu540_setup_macaddr(u32 serialnum) int misc_init_r(void) { - /* Set ethaddr environment variable if not set */ - if (!env_get("ethaddr")) - fu540_setup_macaddr(fu540_read_serialnum()); - + u32 serial_num; + char buf[9] = {0}; + + /* Set ethaddr environment variable from board serial number */ + if (!env_get("serial#")) { + serial_num = fu540_read_serialnum(); + if (!serial_num) { + WARN(true, "Board serial number should not be 0 !!\n"); + return 0; + } + snprintf(buf, sizeof(buf), "%08x", serial_num); + env_set("serial#", buf); + fu540_setup_macaddr(serial_num); + } return 0; } |