diff options
| author | Michal Simek <[email protected]> | 2026-06-23 14:53:30 +0200 |
|---|---|---|
| committer | Michal Simek <[email protected]> | 2026-07-08 08:55:51 +0200 |
| commit | 70236dca329910b05bf35b3e05fd460d6e9d2d76 (patch) | |
| tree | 70eefcf16f4048f2cc01dbbaea1d48c24bda2690 /arch/arm | |
| parent | b444110e51f09444f55367c18168ef04fcb1b6a2 (diff) | |
arm64: versal: Move bootmode decoding out of board code
versal_get_bootmode() lived in board code and open-coded the
IS_ENABLED(CONFIG_ZYNQMP_FIRMWARE) selection between the firmware call
zynqmp_pm_get_bootmode_reg() and a direct readl(). To keep generic board
code free of firmware specifics and SoC register details and ready for
SCMI, move the whole function, including the alt-shift and mask decoding,
behind an overridable hook.
The weak versal_get_bootmode() in arch/arm/mach-versal does the plain
MMIO read via versal_bootmode_reg() and decodes it (used at EL3 and
without firmware). When CONFIG_ZYNQMP_FIRMWARE is enabled,
firmware-zynqmp.c provides a strong definition that reads the register
through the firmware call, falling back to the direct read at EL3 where
the SMC path to firmware is unavailable. This preserves the existing
firmware-based bootmode behaviour while removing the firmware interface
from board code; the now unused zynqmp_firmware.h include is dropped.
Signed-off-by: Michal Simek <[email protected]>
Link: https://patch.msgid.link/d60073feed8da8d3aff9eabee6ab132e0bbd0f8e.1782219202.git.michal.simek@amd.com
Diffstat (limited to 'arch/arm')
| -rw-r--r-- | arch/arm/mach-versal/cpu.c | 15 | ||||
| -rw-r--r-- | arch/arm/mach-versal/include/mach/sys_proto.h | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/mach-versal/cpu.c b/arch/arm/mach-versal/cpu.c index 7ad93982e8d..5cb013d5f2e 100644 --- a/arch/arm/mach-versal/cpu.c +++ b/arch/arm/mach-versal/cpu.c @@ -120,6 +120,21 @@ u32 __weak versal_pmc_multi_boot(void) return versal_multi_boot_reg(); } +u32 versal_bootmode_reg(void) +{ + return readl(&crp_base->boot_mode_usr); +} + +u8 __weak versal_get_bootmode(void) +{ + u32 reg = versal_bootmode_reg(); + + if (reg >> BOOT_MODE_ALT_SHIFT) + reg >>= BOOT_MODE_ALT_SHIFT; + + return reg & BOOT_MODES_MASK; +} + U_BOOT_DRVINFO(soc_xilinx_versal) = { .name = "soc_xilinx_versal", }; diff --git a/arch/arm/mach-versal/include/mach/sys_proto.h b/arch/arm/mach-versal/include/mach/sys_proto.h index d7ab2549658..f8836db5ef0 100644 --- a/arch/arm/mach-versal/include/mach/sys_proto.h +++ b/arch/arm/mach-versal/include/mach/sys_proto.h @@ -21,5 +21,9 @@ void mem_map_fill(void); u32 versal_pmc_multi_boot(void); /* Direct MMIO read of the multiboot register (EL3 / no-firmware path) */ u32 versal_multi_boot_reg(void); +/* Overridable bootmode decode: weak MMIO default, firmware override */ +u8 versal_get_bootmode(void); +/* Direct MMIO read of the bootmode register (EL3 / no-firmware path) */ +u32 versal_bootmode_reg(void); #endif /* _ASM_ARCH_SYS_PROTO_H */ |
