summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorMinda Chen <minda.chen@starfivetech.com>2024-04-12 13:21:14 +0300
committerMinda Chen <minda.chen@starfivetech.com>2024-04-29 08:56:41 +0300
commitd3c149575077bc5fd6b238f1a3d67f3c64f5fbeb (patch)
treed597fe2a6ca6cf95194ebe41733695cfab12b035 /board
parent1444304dac5753ace8b3b7e5c0e5671f97e4a657 (diff)
downloadu-boot-d3c149575077bc5fd6b238f1a3d67f3c64f5fbeb.tar.xz
amp: Set 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>
Diffstat (limited to 'board')
-rw-r--r--board/starfive/visionfive2/starfive_visionfive2.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
index a6656dcce1..6b3fe62f94 100644
--- a/board/starfive/visionfive2/starfive_visionfive2.c
+++ b/board/starfive/visionfive2/starfive_visionfive2.c
@@ -32,6 +32,8 @@
#define CPU_VOL_BINNING_OFFSET 0x7fc
+DECLARE_GLOBAL_DATA_PTR;
+
enum {
BOOT_FLASH = 0,
BOOT_SD,
@@ -422,7 +424,9 @@ int board_init(void)
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();
@@ -443,6 +447,20 @@ 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;
}