summaryrefslogtreecommitdiff
path: root/drivers/firmware
diff options
context:
space:
mode:
authorPrasad Kummari <[email protected]>2025-03-05 19:18:46 +0530
committerMichal Simek <[email protected]>2025-04-16 13:42:06 +0200
commit5ffab6ee1279fe86ab21b529a04b1638a6664eaf (patch)
tree7594d8021c3f6bf41a8cb0b85bf1b3d994a05fb3 /drivers/firmware
parent253da1f0a2821bf741c8dc24ed2e568b7013f6e0 (diff)
xilinx: versal: add firmware access to PMC multi Boot mode register
Added extended support for retrieving the PMC muti boot mode register via the firmware interface, which is preferred when U-Boot runs in EL2 and cannot directly access PMC registers via raw reads. Ideally, all secure registers should be accessed via xilinx_pm_request(). Introduced the secure zynqmp_pm_get_pmc_multi_boot_reg() call, which uses xilinx_pm_request() to read the PMC multi boot mode register. BootROM increments the MultiBoot register (PMC_MULTI_BOOT) read address offset by 32 KB and retries. For SD and eMMC boot modes, it can search up to 8191 FAT files for the identification string. A 13-bit mask (0x1FFF) is applied to PMC_MULTI_BOOT_MASK to obtain the correct values in BootROM. Signed-off-by: Prasad Kummari <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michal Simek <[email protected]>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/firmware-zynqmp.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
index 2adc132b4cc..584397ba29a 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -218,6 +218,29 @@ u32 zynqmp_pm_get_bootmode_reg(void)
return ret_payload[1];
}
+u32 zynqmp_pm_get_pmc_multi_boot_reg(void)
+{
+ int ret;
+ u32 ret_payload[PAYLOAD_ARG_CNT];
+
+ ret = zynqmp_pm_is_function_supported(PM_IOCTL, IOCTL_READ_REG);
+ if (ret) {
+ printf("%s: IOCTL_READ_REG is not supported failed with error code: %d\n"
+ , __func__, ret);
+ return 0;
+ }
+
+ ret = xilinx_pm_request(PM_IOCTL, PM_REG_PMC_GLOBAL_NODE, IOCTL_READ_REG,
+ PMC_MULTI_BOOT_MODE_REG_OFFSET, 0, ret_payload);
+ if (ret) {
+ printf("%s: node 0x%x: get_bootmode 0x%x failed\n",
+ __func__, PM_REG_PMC_GLOBAL_NODE, PMC_MULTI_BOOT_MODE_REG_OFFSET);
+ return 0;
+ }
+
+ return ret_payload[1];
+}
+
int zynqmp_pm_feature(const u32 api_id)
{
int ret;