arm64: versal: Decouple multiboot register access from firmware

versal_multi_boot() in board code selected between the firmware call
zynqmp_pm_get_pmc_multi_boot_reg() and a direct readl() based on an
IS_ENABLED(CONFIG_ZYNQMP_FIRMWARE) check. Generic board code should not
carry firmware-specific ifdefs, and this becomes harder to maintain once
SCMI introduces yet another access method.

Introduce an overridable accessor versal_pmc_multi_boot(). The weak
default lives in arch/arm/mach-versal and performs the plain MMIO read
(used at EL3 and when no firmware is present). When CONFIG_ZYNQMP_FIRMWARE
is enabled, firmware-zynqmp.c provides a strong definition that issues the
firmware call, falling back to the direct read at EL3 where the SMC path
to firmware is unavailable. The shared MMIO read is factored into
versal_multi_boot_reg() so the firmware override does not duplicate it.

versal_multi_boot() keeps the generic JTAG/QEMU workaround and simply
calls the accessor, so board code no longer references the firmware
interface for the multiboot register. The firmware-vs-MMIO decision is
selected at link time, and adding SCMI later only requires a third strong
definition with no board-code changes.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://patch.msgid.link/199ef6a1411c54f154fe4a43b5fef166b9927f7a.1782219202.git.michal.simek@amd.com
This commit is contained in:
Michal Simek
2026-07-08 08:55:51 +02:00
parent 789a487194
commit b444110e51
4 changed files with 27 additions and 7 deletions
+10
View File
@@ -110,6 +110,16 @@ int arm_reserve_mmu(void)
}
#endif
u32 versal_multi_boot_reg(void)
{
return readl(PMC_MULTI_BOOT_REG) & PMC_MULTI_BOOT_MASK;
}
u32 __weak versal_pmc_multi_boot(void)
{
return versal_multi_boot_reg();
}
U_BOOT_DRVINFO(soc_xilinx_versal) = {
.name = "soc_xilinx_versal",
};
@@ -17,4 +17,9 @@ void initialize_tcm(enum tcm_mode mode);
void tcm_init(enum tcm_mode mode);
void mem_map_fill(void);
/* Overridable PMC multiboot accessor: weak MMIO default, firmware override */
u32 versal_pmc_multi_boot(void);
/* Direct MMIO read of the multiboot register (EL3 / no-firmware path) */
u32 versal_multi_boot_reg(void);
#endif /* _ASM_ARCH_SYS_PROTO_H */
+1 -7
View File
@@ -62,18 +62,12 @@ 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;
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;
return versal_pmc_multi_boot();
}
int board_init(void)
+11
View File
@@ -328,6 +328,17 @@ u32 zynqmp_pm_get_pmc_multi_boot_reg(void)
}
#endif
#if defined(CONFIG_ARCH_VERSAL)
u32 versal_pmc_multi_boot(void)
{
/* At EL3 the SMC path to firmware is unavailable, read directly */
if (current_el() == 3)
return versal_multi_boot_reg();
return zynqmp_pm_get_pmc_multi_boot_reg() & PMC_MULTI_BOOT_MASK;
}
#endif
#if defined(CONFIG_ARCH_VERSAL2)
u32 versal2_pmc_multi_boot(void)
{