[PATCH 1/3] reset: zynqmp: Add reset driver support for versal

Ashok Reddy Soma ashok.reddy.soma at xilinx.com
Wed Jul 20 11:59:57 CEST 2022


From: T Karthik Reddy <t.karthik.reddy at amd.com>

Add support for versal platform by adding "xlnx,versal-reset"
compatible string in zynqmp-reset driver. Reset numbering schema
for versal is not same as zynqmp, so nr_reset and reset_id are
set to zero. In case of assert/dessert, required device reset id
is sent from respective driver through struct reset_ctl.

Signed-off-by: T Karthik Reddy <t.karthik.reddy at amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma at xilinx.com>
---

 drivers/reset/Kconfig        |  6 +++---
 drivers/reset/reset-zynqmp.c | 10 +++++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index b57714111b..69a7b4ccba 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -199,11 +199,11 @@ config RESET_SCMI
 	  protocol communication with a SCMI server.
 
 config RESET_ZYNQMP
-	bool "Reset Driver for Xilinx ZynqMP SoC's"
+	bool "Reset Driver for Xilinx ZynqMP & Versal SoC's"
 	depends on DM_RESET && ZYNQMP_FIRMWARE
 	help
-	  Support for reset controller on Xilinx ZynqMP SoC. Driver is only
-	  passing request via Xilinx firmware interface to TF-A and PMU
+	  Support for reset controller on Xilinx ZynqMP & Versal SoC's. Driver
+	  is only passing request via Xilinx firmware interface to TF-A and PMU
 	  firmware.
 
 config RESET_DRA7
diff --git a/drivers/reset/reset-zynqmp.c b/drivers/reset/reset-zynqmp.c
index 4e3f907980..52c08c4722 100644
--- a/drivers/reset/reset-zynqmp.c
+++ b/drivers/reset/reset-zynqmp.c
@@ -53,7 +53,7 @@ static int zynqmp_reset_request(struct reset_ctl *rst)
 	dev_dbg(rst->dev, "%s(rst=%p) (id=%lu) (nr_reset=%d)\n", __func__,
 		rst, rst->id, priv->nr_reset);
 
-	if (rst->id > priv->nr_reset)
+	if (priv->nr_reset && rst->id > priv->nr_reset)
 		return -EINVAL;
 
 	return 0;
@@ -63,8 +63,11 @@ static int zynqmp_reset_probe(struct udevice *dev)
 {
 	struct zynqmp_reset_priv *priv = dev_get_priv(dev);
 
-	priv->reset_id = ZYNQMP_RESET_ID;
-	priv->nr_reset = ZYNQMP_NR_RESETS;
+	if (device_is_compatible(dev, "xlnx,zynqmp-reset")) {
+		priv->reset_id = ZYNQMP_RESET_ID;
+		priv->nr_reset = ZYNQMP_NR_RESETS;
+	}
+
 	return 0;
 }
 
@@ -76,6 +79,7 @@ const struct reset_ops zynqmp_reset_ops = {
 
 static const struct udevice_id zynqmp_reset_ids[] = {
 	{ .compatible = "xlnx,zynqmp-reset" },
+	{ .compatible = "xlnx,versal-reset" },
 	{ }
 };
 
-- 
2.17.1



More information about the U-Boot mailing list