arm64: versal: RO multi_boot register in non JTAG bootmode
authorMichal Simek <michal.simek@amd.com>
Mon, 6 Jan 2025 09:20:40 +0000 (10:20 +0100)
committerMichal Simek <michal.simek@amd.com>
Tue, 14 Jan 2025 07:29:45 +0000 (08:29 +0100)
The main reason for this change is that upstream QEMU has no multiboot
register implemented that's why access to it fails which ends up in CI
failure for our target.
That's why in JTAG bootmode returns 0 which is correct behaviour because
multiboot register is not used in this mode and value should be ignored and
as a side effect it is also fixing CI/Qemu issue.

Also move versal_get_bootmode() to avoid function declaration.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/484b9cafc45e72308a1a29a3ab772020f96784cc.1736155238.git.michal.simek@amd.com
board/xilinx/versal/board.c

index d05220f..cff810e 100644 (file)
@@ -36,8 +36,29 @@ static xilinx_desc versalpl = {
 };
 #endif
 
+static u8 versal_get_bootmode(void)
+{
+       u8 bootmode;
+       u32 reg = 0;
+
+       reg = readl(&crp_base->boot_mode_usr);
+
+       if (reg >> BOOT_MODE_ALT_SHIFT)
+               reg >>= BOOT_MODE_ALT_SHIFT;
+
+       bootmode = reg & BOOT_MODES_MASK;
+
+       return bootmode;
+}
+
 static u32 versal_multi_boot(void)
 {
+       u8 bootmode = versal_get_bootmode();
+
+       /* Mostly workaround for QEMU CI pipeline */
+       if (bootmode == JTAG_MODE)
+               return 0;
+
        return readl(0xF1110004);
 }
 
@@ -120,21 +141,6 @@ unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
        return ret;
 }
 
-static u8 versal_get_bootmode(void)
-{
-       u8 bootmode;
-       u32 reg = 0;
-
-       reg = readl(&crp_base->boot_mode_usr);
-
-       if (reg >> BOOT_MODE_ALT_SHIFT)
-               reg >>= BOOT_MODE_ALT_SHIFT;
-
-       bootmode = reg & BOOT_MODES_MASK;
-
-       return bootmode;
-}
-
 static int boot_targets_setup(void)
 {
        u8 bootmode;