diff options
Diffstat (limited to 'board/xilinx/versal/board.c')
-rw-r--r-- | board/xilinx/versal/board.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 05530736751..9371c30ea27 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -27,6 +27,7 @@ #include <dm/device.h> #include <dm/uclass.h> #include <versalpl.h> +#include <zynqmp_firmware.h> #include "../common/board.h" DECLARE_GLOBAL_DATA_PTR; @@ -43,7 +44,11 @@ static u8 versal_get_bootmode(void) u8 bootmode; u32 reg = 0; - reg = readl(&crp_base->boot_mode_usr); + if (IS_ENABLED(CONFIG_ZYNQMP_FIRMWARE) && current_el() != 3) { + reg = zynqmp_pm_get_bootmode_reg(); + } else { + reg = readl(&crp_base->boot_mode_usr); + } if (reg >> BOOT_MODE_ALT_SHIFT) reg >>= BOOT_MODE_ALT_SHIFT; @@ -56,12 +61,18 @@ static u8 versal_get_bootmode(void) static u32 versal_multi_boot(void) { u8 bootmode = versal_get_bootmode(); + u32 reg = 0; /* Mostly workaround for QEMU CI pipeline */ if (bootmode == JTAG_MODE) return 0; - return readl(0xF1110004); + if (IS_ENABLED(CONFIG_ZYNQMP_FIRMWARE) && current_el() != 3) + reg = zynqmp_pm_get_pmc_multi_boot_reg(); + else + reg = readl(PMC_MULTI_BOOT_REG); + + return reg & PMC_MULTI_BOOT_MASK; } int board_init(void) @@ -272,6 +283,7 @@ static int boot_targets_setup(void) env_targets ? env_targets : ""); env_set("boot_targets", new_targets); + free(new_targets); } return 0; @@ -395,7 +407,7 @@ void configure_capsule_updates(void) ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); - memset(buf, 0, sizeof(buf)); + memset(buf, 0, DFU_ALT_BUF_LEN); multiboot = env_get_hex("multiboot", multiboot); |