reset: zynqmp: move reset_assert() into firmware driver
Subsystems (2)
cover reset: zynqmp: move reset_assert() into firmware driver
The ZynqMP reset assertion helper currently resides in drivers/reset/reset-zynqmp.c, even though the driver is built only when CONFIG_ZYNQMP_FIRMWARE is enabled and the implementation is entirely firmware-backed. This series moves zynqmp_pm_reset_assert() into firmware-zynqmp.c, alongside the rest of the PM firmware interfaces.
With the helper residing in the firmware driver, reset_cpu() is updated to invoke zynqmp_pm_reset_assert() directly rather than issuing the PM request itself or relying on the reset uclass. This is important for boot flows where reset_cpu() may be called before the reset framework is available.
Akshay Belsare (2):
reset: zynqmp: move reset assert helper into firmware driver
board: xilinx: zynqmp: use reset assert helper in reset_cpu()
board/xilinx/zynqmp/zynqmp.c | 7 +++---- drivers/firmware/firmware-zynqmp.c | 7 +++++++ drivers/reset/reset-zynqmp.c | 7 ------- include/zynqmp_firmware.h | 2 ++ 4 files changed, 12 insertions(+), 11 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/2 reset: zynqmp: move reset assert helper into firmware driver
zynqmp_pm_reset_assert() is currently implemented in the reset driver, requiring reset-zynqmp.c to invoke the PM firmware interface directly.
Move the helper into firmware-zynqmp.c and expose it through the firmware layer instead. Since reset assertion has no non-firmware implementation, this keeps the firmware-specific logic localized to the firmware driver and simplifies the reset driver.
--- drivers/firmware/firmware-zynqmp.c | 7 +++++++ drivers/reset/reset-zynqmp.c | 7 ------- include/zynqmp_firmware.h | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-)
drivers/firmware/firmware-zynqmp.c +7 -0
@@ -175,6 +175,13 @@ unsigned int zynqmp_firmware_version(void)return pm_api_version; }; +int zynqmp_pm_reset_assert (const u32 reset, +const enum zynqmp_pm_reset_action assert_flag) +{ +return xilinx_pm_request (PM_RESET_ASSERT , reset, assert_flag,0 ,0 , +0 ,0 ,NULL ); +} +#if defined(CONFIG_ARCH_VERSAL2 )/* * Poll the M-PHY TX/RX config-ready status until it settles or @timeout_us
drivers/reset/reset-zynqmp.c +0 -7
@@ -18,13 +18,6 @@ struct zynqmp_reset_priv {u32 nr_reset; }; -static int zynqmp_pm_reset_assert (const u32 reset, -const enum zynqmp_pm_reset_action assert_flag) -{ -return xilinx_pm_request (PM_RESET_ASSERT , reset, assert_flag,0 ,0 , -0 ,0 ,NULL ); -} -static int zynqmp_reset_assert (struct reset_ctl *rst) {struct zynqmp_reset_priv *priv =dev_get_priv (rst->dev);
include/zynqmp_firmware.h +2 -0
@@ -463,6 +463,8 @@ int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config,int zynqmp_pm_is_function_supported (const u32 api_id,const u32 id);int zynqmp_mmio_read (const u32 address,u32 *value);int zynqmp_mmio_write (const u32 address,const u32 mask,const u32 value); +int zynqmp_pm_reset_assert (const u32 reset, +const enum zynqmp_pm_reset_action assert_flag);int zynqmp_pm_feature (const u32 api_id);u32 zynqmp_pm_get_bootmode_reg (void );u32 zynqmp_pm_get_pmc_multi_boot_reg (void );
Signature · 1 line
2.34.1
PATCH 2/2 board: xilinx: zynqmp: use reset assert helper in reset_cpu()
In reply to Akshay Belsarereset_cpu() currently invokes xilinx_pm_request(PM_RESET_ASSERT, ...) directly to assert a system reset. Switch it to use zynqmp_pm_reset_assert(), matching the approach used by reset-zynqmp.c and centralizing the firmware interaction behind a common helper.
Keep the IS_ENABLED(CONFIG_ZYNQMP_FIRMWARE) early return unchanged so the reset path continues to compile out when firmware support is not enabled.
--- board/xilinx/zynqmp/zynqmp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
board/xilinx/zynqmp/zynqmp.c +3 -4
@@ -288,13 +288,12 @@ void reset_cpu(void) return; } -/* In case of !CONFIG_ZYNQMP_FIRMWARE the call to 'xilinx_pm_request()' +/* In case of !CONFIG_ZYNQMP_FIRMWARE the call to 'zynqmp_pm_reset_assert()' * will be removed by the compiler due to the early return. -* If CONFIG_ZYNQMP_FIRMWARE is defined in SPL 'xilinx_pm_request()' +* If CONFIG_ZYNQMP_FIRMWARE is defined in SPL 'zynqmp_pm_reset_assert()' * will send command over IPI and requires pmufw to be present. */ -xilinx_pm_request (PM_RESET_ASSERT ,ZYNQMP_PM_RESET_SOFT , -PM_RESET_ACTION_ASSERT ,0 ,0 ,0 ,0 ,NULL ); +zynqmp_pm_reset_assert (ZYNQMP_PM_RESET_SOFT ,PM_RESET_ACTION_ASSERT ); }#endif
Signature · 1 line
2.34.1
Michal Simek
AppliedQuoted 16 lines · Akshay Belsare
The ZynqMP reset assertion helper currently resides in
drivers/reset/reset-zynqmp.c, even though the driver is built only whenCONFIG_ZYNQMP_FIRMWAREis enabled and the implementation is entirely firmware-backed. This series moveszynqmp_pm_reset_assert()intofirmware-zynqmp.c, alongside the rest of the PM firmware interfaces.With the helper residing in the firmware driver,
reset_cpu()is updated to invokezynqmp_pm_reset_assert()directly rather than issuing the PM request itself or relying on the reset uclass. This is important for boot flows wherereset_cpu()may be called before the reset framework is available.Akshay Belsare (2):
reset: zynqmp: move reset assert helper into firmware driver
board: xilinx: zynqmp: use reset assert helper inreset_cpu()
Quoted 6 lines
board/xilinx/zynqmp/zynqmp.c | 7 +++---- drivers/firmware/firmware-zynqmp.c | 7 +++++++ drivers/reset/reset-zynqmp.c | 7 ------- include/zynqmp_firmware.h | 2 ++ 4 files changed, 12 insertions(+), 11 deletions(-)
Applied.
M
Signature · 6 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP/Versal ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal/Versal NET SoCs TF-A maintainer - Xilinx ZynqMP/Versal/Versal NET SoCs