summaryrefslogtreecommitdiff
path: root/board/amd
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@amd.com>2025-11-27 09:28:46 +0100
committerMichal Simek <michal.simek@amd.com>2025-12-19 08:25:27 +0100
commit29427fdf7198953f361ce6535b67272e3645d53b (patch)
tree5224726c850d594afed4ff4c06a0567ca86a8720 /board/amd
parentb6391d1d9b3d04c1986b3ce7951528f8fde76bbd (diff)
arm64: versal2: Read and show multiboot value
SOC can boot from different boot medias and also different offsets that's why by default show multiboot value to be aware which image system is booting out of. It is especially useful for systems with A/B update enabled. Also limit zynqmp_pm_get_pmc_multi_boot_reg() usage only for Versal and Versal Gen 2. Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/fd7564ce2f51d965c273e939e98de01beb92e6f5.1764232124.git.michal.simek@amd.com
Diffstat (limited to 'board/amd')
-rw-r--r--board/amd/versal2/board.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/board/amd/versal2/board.c b/board/amd/versal2/board.c
index 7d91d288d2e..1fd05a1157a 100644
--- a/board/amd/versal2/board.c
+++ b/board/amd/versal2/board.c
@@ -21,6 +21,7 @@
#include <dm/device.h>
#include <dm/uclass.h>
#include <versalpl.h>
+#include <zynqmp_firmware.h>
#include "../../xilinx/common/board.h"
#include <linux/bitfield.h>
@@ -180,6 +181,23 @@ static u8 versal2_get_bootmode(void)
return bootmode;
}
+static u32 versal2_multi_boot(void)
+{
+ u8 bootmode = versal2_get_bootmode();
+ u32 reg = 0;
+
+ /* Mostly workaround for QEMU CI pipeline */
+ if (bootmode == JTAG_MODE)
+ return 0;
+
+ 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;
+}
+
static int boot_targets_setup(void)
{
u8 bootmode;
@@ -319,6 +337,7 @@ static int boot_targets_setup(void)
int board_late_init(void)
{
int ret;
+ u32 multiboot;
if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
debug("Saved variables - Skipping\n");
@@ -328,6 +347,9 @@ int board_late_init(void)
if (!IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG))
return 0;
+ multiboot = versal2_multi_boot();
+ env_set_hex("multiboot", multiboot);
+
if (IS_ENABLED(CONFIG_DISTRO_DEFAULTS)) {
ret = boot_targets_setup();
if (ret)