[PATCH 1/2] reset: zynqmp: move reset assert helper into firmware driver

Akshay Belsare <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
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.

Signed-off-by: Akshay Belsare <[email protected]>
---
 drivers/firmware/firmware-zynqmp.c | 7 +++++++
 drivers/reset/reset-zynqmp.c       | 7 -------
 include/zynqmp_firmware.h          | 2 ++
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
index fae66ccb3d8..9f5556751be 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -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
diff --git a/drivers/reset/reset-zynqmp.c b/drivers/reset/reset-zynqmp.c
index 2b58f3a75b4..eb2f6d0bdfe 100644
--- a/drivers/reset/reset-zynqmp.c
+++ b/drivers/reset/reset-zynqmp.c
@@ -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);
diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h
index f753a67ac27..86f3ccf8932 100644
--- a/include/zynqmp_firmware.h
+++ b/include/zynqmp_firmware.h
@@ -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);
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.