diff options
Diffstat (limited to 'board/xilinx/versal/board.c')
-rw-r--r-- | board/xilinx/versal/board.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index b4483d00ad1..9371c30ea27 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -8,6 +8,7 @@ #include <cpu_func.h> #include <dfu.h> #include <env.h> +#include <efi_loader.h> #include <fdtdec.h> #include <init.h> #include <env_internal.h> @@ -26,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; @@ -42,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; @@ -55,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) @@ -271,6 +283,7 @@ static int boot_targets_setup(void) env_targets ? env_targets : ""); env_set("boot_targets", new_targets); + free(new_targets); } return 0; @@ -280,6 +293,9 @@ int board_late_init(void) { int ret; + if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) + configure_capsule_updates(); + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { debug("Saved variables - Skipping\n"); return 0; @@ -356,8 +372,6 @@ enum env_location env_get_location(enum env_operation op, int prio) } #endif -#if defined(CONFIG_SET_DFU_ALT_INFO) - #define DFU_ALT_BUF_LEN SZ_1K static void mtd_found_part(u32 *base, u32 *size) @@ -385,7 +399,7 @@ static void mtd_found_part(u32 *base, u32 *size) } } -void set_dfu_alt_info(char *interface, char *devstr) +void configure_capsule_updates(void) { int bootseq = 0, len = 0; u32 multiboot = versal_multi_boot(); @@ -393,10 +407,7 @@ void set_dfu_alt_info(char *interface, char *devstr) ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); - if (env_get("dfu_alt_info")) - return; - - memset(buf, 0, sizeof(buf)); + memset(buf, 0, DFU_ALT_BUF_LEN); multiboot = env_get_hex("multiboot", multiboot); @@ -436,7 +447,6 @@ void set_dfu_alt_info(char *interface, char *devstr) return; } - env_set("dfu_alt_info", buf); - puts("DFU alt info setting: done\n"); + update_info.dfu_string = strdup(buf); + debug("Capsule DFU: %s\n", update_info.dfu_string); } -#endif |