dmaengine: zynqmp_dma: Add reset support for Versal Gen2 and Versal Net
Subsystems (3)
v6 cover dmaengine: zynqmp_dma: Add reset support for Versal Gen2 and Versal Net
This series adds per-channel reset support for Versal Gen2 and Versal Net DMA channels.
Patch 1 requires the resets property for Versal Gen2 DMA devices.
Patch 2 adds the amd,versal-net-dma-1.0 compatible with xlnx,zynqmp-dma-1.0 as its fallback and requires the resets property for Versal Net devices.
Patch 3 adds the Versal Net compatible to the driver match table. Versal Net uses the base IRQ register block.
Patch 4 resets each Versal Gen2 and Versal Net DMA channel during probe using device_reset_optional(). Legacy SoCs without a reset line continue to work.
Changes in V6:
- Initially, used device_reset() and checked the has_reset flag in the driver, explaining that reset was needed only for those Versal Net and Versa2 . So we decided to allow the reset patch to run for those 2 compatibles, while it would be skipped entirely for the legacy one. But, following the Frank Li's’ review and suggestions, the required reset property is validated by the DT binding, so switched to device_reset_optional and removed the check from the driver.
Changes in V5:
- Drop the probe-time PM and unrelated IRQ-guard patches; retain only the patches required for reset support
- Split the Versal Gen2 reset requirement and Versal Net compatible into separate binding patches.
Changes in V4:
- Patch 1: Use PM_RUNTIME_ACQUIRE_AUTOSUSPEND() instead of pm_runtime_resume_and_get(), and fail probe immediately if the guard acquire fails. Add zynqmp_dma_probe_pm_put()/_fail() helpers so every error path releases the reference and gates the clocks without goto-based cleanup, and pair every direct zynqmp_dma_runtime_suspend() call with pm_runtime_set_suspended() to keep the runtime PM status in sync with the clocks
- Patch 2: Bypass the guard when pm_runtime_get_if_active() returns -EINVAL, covering disabled runtime PM and CONFIG_PM=n, so interrupt handlers keep servicing interrupts instead of bailing out
- Patch 3: Remove the IS_ENABLED(CONFIG_PM) condition from the guard error check, since patch 2 already handles disabled runtime PM and CONFIG_PM=n inside the guard itself
- Patch 4: Move the allOf block under the required field Add the new compatible string and the resets property in the example
- Patch 5: No change
- Patch 6: No change
Changes in V3:
- Patch 1: New patch - split PM usage count fix into a separate patch as
- Patch 2: New patch - add PM_RUNTIME_ACQUIRE_IF_ACTIVE() guard and its backing infrastructure to pm_runtime.h
- Patch 3: Use PM_RUNTIME_ACQUIRE_IF_ACTIVE() guard instead of the manual pm_runtime_get_if_active()/pm_runtime_put() pair from V2
- Patch 4: Use allOf:if:then: to restrict the resets property per- compatible with resets: false for non-matching platforms also expand to include amd,versal-net-dma-1.0
- Patch 5: New patch - add amd,versal-net-dma-1.0 compatible to driver
- Patch 6: Introduce has_reset flag in zynqmp_dma_config to gate the reset path; PM usage count fix split into patch 1/6
Link to V5:
-----------
https://lore.kernel.org/all/[email protected]/
---
Golla Nagendra (4):
dt-bindings: dma: xlnx,zynqmp-dma: Require resets for Versal Gen2
dt-bindings: dma: xlnx,zynqmp-dma: Add Versal Net compatible
dmaengine: zynqmp_dma: Add new compatible string for Versal Net
dmaengine: zynqmp_dma: Add per-channel reset support
.../bindings/dma/xilinx/xlnx,zynqmp-dma-1.0.yaml | 35 +++++++++++++++++----- drivers/dma/xilinx/zynqmp_dma.c | 7 +++++ 2 files changed, 35 insertions(+), 7 deletions(-)
---
base-commit: b6aedcd927635d94afef249a72b0a498d1896f94
change-id: 20261202-v_6_reset_series-12d7d4e9f9ca
Best regards,
Signature · 1 line
Golla Nagendra <[email protected]>
PATCH v6 1/4 dt-bindings: dma: xlnx,zynqmp-dma: Require resets for Versal Gen2
Require the per-channel resets property for Versal Gen2 DMA devices, which expose dedicated reset lines.
Making resets required for Versal Gen2 results in an ABI break, but this is unavoidable. While the driver works in many scenarios when no other firmware has used the DMA prior to Linux boot, there is no guarantee the channel is left in a clean state. In observed error scenarios, a reset is necessary before Linux can reconfigure the IP after previous use by other firmware components. Due to configuration differences or the DMA being left in a bad state, DMA functionality fails when sequential software components use the channel (e.g., firmware before Linux boot). The channel can only be cleanly re-configured after a per-channel reset, making it essential. This ABI break is only applied to Versal Gen2 and where the per-channel reset capability is available.
--- .../bindings/dma/xilinx/xlnx,zynqmp-dma-1.0.yaml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/dma/xilinx/xlnx,zynqmp-dma-1.0.yaml +18 -3
@@ -16,9 +16,6 @@ maintainers: - Harini Katakam <[email protected]> - Radhey Shyam Pandey <[email protected]> -allOf: - - $ref: ../dma-controller.yaml# - properties: "#dma-cells": const: 1
@@ -59,6 +56,9 @@ properties: power-domains: maxItems: 1 + resets: + maxItems: 1 + dma-coherent: true required:
@@ -70,6 +70,21 @@ required: - clock-names - xlnx,bus-width +allOf: + - $ref: ../dma-controller.yaml# + - if: + properties: + compatible: + contains: + enum: + - amd,versal2-dma-1.0 + then: + required: + - resets + else: + properties: + resets: false + additionalProperties: false examples:
Signature · 1 line
2.43.7
PATCH v6 2/4 dt-bindings: dma: xlnx,zynqmp-dma: Add Versal Net compatible
In reply to Golla NagendraAdd support for the amd,versal-net-dma-1.0 compatible with xlnx,zynqmp-dma-1.0 as its fallback compatible.
Include the Versal Net compatible in the reset requirements, making the per-channel resets property mandatory for Versal Net devices.
--- .../bindings/dma/xilinx/xlnx,zynqmp-dma-1.0.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/dma/xilinx/xlnx,zynqmp-dma-1.0.yaml +10 -4
@@ -21,9 +21,13 @@ properties: const: 1 compatible: - enum: - - amd,versal2-dma-1.0 - - xlnx,zynqmp-dma-1.0 + oneOf: + - enum: + - amd,versal2-dma-1.0 + - xlnx,zynqmp-dma-1.0 + - items: + - const: amd,versal-net-dma-1.0 + - const: xlnx,zynqmp-dma-1.0 reg: description: memory map for gdma/adma module access
@@ -78,6 +82,7 @@ allOf: contains: enum: - amd,versal2-dma-1.0 + - amd,versal-net-dma-1.0 then: required: - resets
@@ -91,7 +96,7 @@ examples: - | fpd_dma_chan1: dma-controller@fd500000 { - compatible = "xlnx,zynqmp-dma-1.0"; + compatible = "amd,versal-net-dma-1.0", "xlnx,zynqmp-dma-1.0"; reg = <0xfd500000 0x1000>; interrupt-parent = <&gic>; interrupts = <0 117 0x4>;
@@ -99,5 +104,6 @@ examples: clock-names = "clk_main", "clk_apb"; clocks = <&zynqmp_clk 19>, <&zynqmp_clk 31>; xlnx,bus-width = <128>; + resets = <&reset 0>; dma-coherent; };
Signature · 1 line
2.43.7
PATCH v6 3/4 dmaengine: zynqmp_dma: Add new compatible string for Versal Net
In reply to Golla NagendraVersal Net previously used the legacy xlnx,zynqmp-dma-1.0 compatible string. Add amd,versal-net-dma-1.0 to the of_device_id match table without match data; the driver uses the base IRQ register offset by default.
--- drivers/dma/xilinx/zynqmp_dma.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/xilinx/zynqmp_dma.c +1 -0
@@ -1193,6 +1193,7 @@ static void zynqmp_dma_remove(struct platform_device *pdev)static const struct of_device_id zynqmp_dma_of_match[] = { { .compatible ="amd,versal2-dma-1.0" , .data = &versal2_dma_config }, + { .compatible ="amd,versal-net-dma-1.0" , }, { .compatible ="xlnx,zynqmp-dma-1.0" , }, {} };
Signature · 1 line
2.43.7
Re: [PATCH v6 3/4] dmaengine: zynqmp_dma: Add new compatible string for Versal Net
Quoted 7 lines · Golla Nagendra
Versal Net previously used the legacy xlnx,zynqmp-dma-1.0 compatible string. Add amd,versal-net-dma-1.0 to the
of_device_idmatch table without match data; the driver uses the base IRQ register offset by default.Signed-off-by Golla Nagendra <[email protected]>---
The binding declares amd,versal-net-dma-1.0 with xlnx,zynqmp-dma-1.0 as its fallback, so OF matching already binds this through the existing xlnx,zynqmp-dma-1.0 entry. Neither entry carries match data, so adding it changes nothing. I think we can skip this patch but let's wait for other reviewers.
Quoted 16 lines
drivers/dma/xilinx/zynqmp_dma.c | 1 + 1 file changed, 1 insertion(+)drivers/dma/xilinx/zynqmp_dma.c +1
-0@@ -1193,6 +1193,7 @@ static void zynqmp_dma_remove(struct platform_device *pdev)static const struct of_device_id zynqmp_dma_of_match[] = { { .compatible ="amd,versal2-dma-1.0" , .data = &versal2_dma_config }, + { .compatible ="amd,versal-net-dma-1.0" , }, { .compatible ="xlnx,zynqmp-dma-1.0" , }, {} };
Re: [PATCH v6 3/4] dmaengine: zynqmp_dma: Add new compatible string for Versal Net
Quoted 6 lines · Radhey Shyam
Quoted 5 lines · Golla Nagendra
Versal Net previously used the legacy xlnx,zynqmp-dma-1.0 compatible string. Add amd,versal-net-dma-1.0 to the
of_device_idmatch table without match data; the driver uses the base IRQ register offset by default.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Golla Nagendra <[email protected]>---
The binding declares amd,versal-net-dma-1.0 with xlnx,zynqmp-dma-1.0 as its fallback, so OF matching already binds this through the existing xlnx,zynqmp-dma-1.0 entry. Neither entry carries match data, so adding it changes nothing. I think we can skip this patch but let's wait for other reviewers.
Yes, needn't this patch.
Frank
Quoted 17 lines
Quoted 16 lines
drivers/dma/xilinx/zynqmp_dma.c | 1 + 1 file changed, 1 insertion(+)drivers/dma/xilinx/zynqmp_dma.c +1
-0@@ -1193,6 +1193,7 @@ static void zynqmp_dma_remove(struct platform_device *pdev)static const struct of_device_id zynqmp_dma_of_match[] = { { .compatible ="amd,versal2-dma-1.0" , .data = &versal2_dma_config }, + { .compatible ="amd,versal-net-dma-1.0" , }, { .compatible ="xlnx,zynqmp-dma-1.0" , }, {} };
PATCH v6 4/4 dmaengine: zynqmp_dma: Add per-channel reset support
In reply to Golla NagendraVersal Gen2 and Versal Net expose a dedicated reset line per ZDMA channel. Trigger a reset pulse during probe using device_reset_optional().
The binding requires resets for Versal Gen2 and Versal Net and forbids them for the legacy xlnx,zynqmp-dma-1.0 compatible. Since the same probe path serves all three, use device_reset_optional() to reset the channel when a reset is described while allowing legacy devices to continue probing.
The binding's per-compatible reset requirements are validated by dtbs_check, so duplicating the compatible-specific check in the driver is unnecessary.
--- drivers/dma/xilinx/zynqmp_dma.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/dma/xilinx/zynqmp_dma.c +6 -0
@@ -19,6 +19,7 @@#include <linux/clk.h> #include <linux/io-64-nonatomic-lo-hi.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include "../dmaengine.h"
@@ -930,6 +931,11 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,if (IS_ERR (chan->regs))return PTR_ERR (chan->regs); + err =device_reset_optional (&pdev->dev); +if (err) +return dev_err_probe (&pdev->dev, err, +"failed to reset channel\n" ); + chan->bus_width =ZYNQMP_DMA_BUS_WIDTH_64 ; chan->dst_burst_len =ZYNQMP_DMA_MAX_DST_BURST_LEN ; chan->src_burst_len =ZYNQMP_DMA_MAX_SRC_BURST_LEN ;
Signature · 1 line
2.43.7
Re: [PATCH v6 4/4] dmaengine: zynqmp_dma: Add per-channel reset support
Quoted 10 lines · Golla Nagendra
Versal Gen2 and Versal Net expose a dedicated reset line per ZDMA channel. Trigger a reset pulse during probe using
device_reset_optional().The binding requires resets for Versal Gen2 and Versal Net and forbids them for the legacy xlnx,zynqmp-dma-1.0 compatible. Since the same probe path serves all three, use
device_reset_optional()to reset the channel when a reset is described while allowing legacy devices to continue probing.
Quoted 5 lines
The binding's per-compatible reset requirements are validated by
dtbs_check, so duplicating the compatible-specific check in the driver is unnecessary.Signed-off-by Golla Nagendra <[email protected]>
Thanks!
Quoted 29 lines
--- drivers/dma/xilinx/zynqmp_dma.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/dma/xilinx/zynqmp_dma.c +6
-0@@ -19,6 +19,7 @@#include <linux/clk.h> #include <linux/io-64-nonatomic-lo-hi.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include "../dmaengine.h" @@ -930,6 +931,11 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,if (IS_ERR (chan->regs))return PTR_ERR (chan->regs); + err =device_reset_optional (&pdev->dev); +if (err) +return dev_err_probe (&pdev->dev, err, +"failed to reset channel\n" ); + chan->bus_width =ZYNQMP_DMA_BUS_WIDTH_64 ; chan->dst_burst_len =ZYNQMP_DMA_MAX_DST_BURST_LEN ; chan->src_burst_len =ZYNQMP_DMA_MAX_SRC_BURST_LEN ;
Re: [PATCH v6 4/4] dmaengine: zynqmp_dma: Add per-channel reset support
In reply to Golla NagendraQuoted 10 lines · Golla Nagendra
Versal Gen2 and Versal Net expose a dedicated reset line per ZDMA channel. Trigger a reset pulse during probe using
device_reset_optional().The binding requires resets for Versal Gen2 and Versal Net and forbids them for the legacy xlnx,zynqmp-dma-1.0 compatible. Since the same probe path serves all three, use
device_reset_optional()to reset the channel when a reset is described while allowing legacy devices to continue probing.
Quoted 6 lines
The binding's per-compatible reset requirements are validated by
dtbs_check, so duplicating the compatible-specific check in the driver is unnecessary.Signed-off-by Golla Nagendra <[email protected]>---
Quoted 31 lines
drivers/dma/xilinx/zynqmp_dma.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/dma/xilinx/zynqmp_dma.c +6
-1@@ -19,6 +19,7 @@#include <linux/clk.h> #include <linux/io-64-nonatomic-lo-hi.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include "../dmaengine.h" @@ -930,6 +931,11 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,if (IS_ERR (chan->regs))return PTR_ERR (chan->regs); + err =device_reset_optional (&pdev->dev); +if (err) +return dev_err_probe (&pdev->dev, err, +"failed to reset channel\n" ); + chan->bus_width =ZYNQMP_DMA_BUS_WIDTH_64 ; chan->dst_burst_len =ZYNQMP_DMA_MAX_DST_BURST_LEN ; chan->src_burst_len =ZYNQMP_DMA_MAX_SRC_BURST_LEN ; --2.43.7