diff options
author | Minda Chen <minda.chen@starfivetech.com> | 2024-05-17 06:20:14 +0300 |
---|---|---|
committer | Minda Chen <minda.chen@starfivetech.com> | 2024-05-21 04:24:19 +0300 |
commit | fc399f0cfa0b31325b3a750a206656804b963e29 (patch) | |
tree | effb6e8ba440d4ff5ce6042d690ed4414671bb0a | |
parent | 7572e010f531c4aea2c8d6fd9ad0bd626028b464 (diff) | |
download | u-boot-fc399f0cfa0b31325b3a750a206656804b963e29.tar.xz |
amp: Set devkits mac addr to share ram while one gmac is disable.
In AMP case, one GMAC is moved to RTOS side. u-boot dts node
is disabled, RTOS need to get the MAC address. So u-boot write
the MAC address to share RAM.
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
-rw-r--r-- | board/starfive/devkits/starfive_devkits.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/board/starfive/devkits/starfive_devkits.c b/board/starfive/devkits/starfive_devkits.c index 66c1918e31..8fd1cb4784 100644 --- a/board/starfive/devkits/starfive_devkits.c +++ b/board/starfive/devkits/starfive_devkits.c @@ -28,6 +28,8 @@ #define SYS_CLOCK_ENABLE(clk) \ setbits_le32(SYS_CRG_BASE + clk, CLK_ENABLE_MASK) +DECLARE_GLOBAL_DATA_PTR; + #define CPU_VOL_BINNING_OFFSET 0x7fc enum { BOOT_FLASH = 0, @@ -372,7 +374,9 @@ err: int board_late_init(void) { struct udevice *dev; - int ret; + int ret, offset; + u8 mac0[6], mac1[6]; + u64 share_ram_addr; get_boot_mode(); @@ -394,8 +398,22 @@ int board_late_init(void) if (ret) goto err; + /* AMP case : write MAC to share ram */ + offset = fdt_path_offset(gd->fdt_blob, + "/chosen/opensbi-domains/rpmsg_shmem"); + if (offset >= 0) { + share_ram_addr = + fdtdec_get_uint64(gd->fdt_blob, offset, "base", 0); + if (share_ram_addr) { + eth_env_get_enetaddr("eth0addr", mac0); + eth_env_get_enetaddr("eth1addr", mac1); + memcpy((void *)share_ram_addr, mac0, 6); + memcpy((void *)(share_ram_addr + 8), mac1, 6); + } + } + err: - return 0; + return 0; } |