Skip to contentSkip to conversation

Documentation: DT: dma: Add Xilinx zynqmp dma device tree binding documentation

PATCH In review Kedareswara rao Appana 2 participants 6 messages Jul 1, 2016 – Jul 9, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v12 1/2 Documentation: DT: dma: Add Xilinx zynqmp dma device tree binding documentation

Device-tree binding documentation for Xilinx zynqmp dma engine used in Zynq UltraScale+ MPSoC.

---
Changes in v12:
- None.
Changes in v11:
- None.
Changes in v10:
- Added Rob Acked-by in the commit message.
Changs in v9:
- Removed include sg runtime configuration parameter
from the binding doc as suggested by Lars.
Changes in v8:
- Removed all the software runtime configuration parameters
from the binding doc as suggested by the Lars.
Changes in v7:
- None.
Changes in v6:
- Removed desc-axi-cache/dst-axi-cache/src-axi-cache properties from the binding doc as it allow broken combinations when dma-coherent is set as suggested by Rob.
- Fixed minor comments given by Rob related coding(lower case DT node name). Changes in v5:
- Use dma-coherent flag for coherent transfers as suggested by rob.
- Removed unnecessary properties from binding doc as suggested by Rob. Changes in v4:
- None
Changes in v3:
- None
Changes in v2:
- None.

 .../devicetree/bindings/dma/xilinx/zynqmp_dma.txt  |   27 ++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/xilinx/zynqmp_dma.txt
Documentation/devicetree/bindings/dma/xilinx/zynqmp_dma.txt new file +27 -0
new file mode 100644
index 0000000..a784cdd
@@ -0,0 +1,27 @@
+Xilinx ZynqMP DMA engine, it does support memory to memory transfers,
+memory to device and device to memory transfers. It also has flow
+control and rate control support for slave/peripheral dma access.
+
+Required properties:
+- compatible		: Should be "xlnx,zynqmp-dma-1.0"
+- reg			: Memory map for gdma/adma module access.
+- interrupt-parent	: Interrupt controller the interrupt is routed through
+- interrupts		: Should contain DMA channel interrupt.
+- xlnx,bus-width	: Axi buswidth in bits. Should contain 128 or 64
+- clock-names		: List of input clocks "clk_main", "clk_apb"
+			  (see clock bindings for details)
+
+Optional properties:
+- dma-coherent		: Present if dma operations are coherent.
+
+Example:
+++++++++
+fpd_dma_chan1: dma at fd500000 {
+	compatible = "xlnx,zynqmp-dma-1.0";
+	reg = <0x0 0xFD500000 0x1000>;
+	interrupt-parent = <&gic>;
+	interrupts = <0 117 4>;
+	clock-names = "clk_main", "clk_apb";
+	xlnx,bus-width = <128>;
+	dma-coherent;
+};
Signature · 1 line
1.7.1
#1 lore raw

PATCH v12 2/2 dmaengine: Add Xilinx zynqmp dma engine driver support

Added the driver for zynqmp dma engine used in Zynq UltraScale+ MPSoC. This dma controller supports memory to memory and I/O to I/O buffer transfers.

---
Changes for v12:
- Removed zynqmp_dma_config structure as suggested by vinod.
- For slave usages using the dma_slave_config as suggsted by vinod. Changes for v11:
- Fixed Kconfig/Make file order as suggested by Vinod.
- Removed unnecessary head files
- Fixed coding style comments line spaces etc...as suggested by vinod.
- Used dma_cookie_status as status call back.
- Used EXPORT_SYMBOL_GPL instead of EXPORT_SYMBOL as suggested by vinod. Changes for v10:
- Use 64bit write for 64-bit platforms as suggested by Shubhrajyoti. Changes for v9:
- Derive the include sg software runtime configuration parameter through config strucutre as suggested by the Lars.
Changes for v8:
- Derive the software runtime configuration parameters through config strucutre and configure them during transfer as suggested by the Lars.
Changes for v7:
- Fixed kbuild compilation warnings.
- Fixed {src,dst}_addr_widths are supposed to be a bitmask of supported slave device widths as suggested by Rob.
Changes in v6:
- Removed unnecessary axcache properties from the driver
- Fixed compilation issues
Changes in v5:
- Removed in_interrupt check from the tasklet cleanup as suggested by the vinod/lars.
Changes in v4:
- Modified the defines to start with ZYNQMP_DMA perfix
- Changed the zynqmp_dma_alloc_chan_resources to return number of allocated descriptors
- Changed the zynqmp_dma_device variable name
- Released the locks before calling user callback
- freeup irq in zynqmp_dma_chan_remove function.
Changes in v3:
- Modified the zynqmp_dma_chan_is_idle function return type to bool Changes in v2:
- Corrected the function header documentation
- Framework expects bus-width value in bytes. so, fixed it
- Removed magic numbers for bus-width

 drivers/dma/Kconfig             |    7 +
 drivers/dma/xilinx/Makefile     |    1 +
 drivers/dma/xilinx/zynqmp_dma.c | 1145 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 1153 insertions(+), 0 deletions(-)
 create mode 100644 drivers/dma/xilinx/zynqmp_dma.c
drivers/dma/Kconfig +7 -0
index 8c98779..01a53ed 100644
@@ -533,6 +533,13 @@ config XILINX_VDMA
 	  channels, Memory Mapped to Stream (MM2S) and Stream to
 	  Memory Mapped (S2MM) for the data transfers.
 
+config XILINX_ZYNQMP_DMA
+	tristate "Xilinx ZynqMP DMA Engine"
+	depends on (ARCH_ZYNQ || MICROBLAZE || ARM64)
+	select DMA_ENGINE
+	help
+	  Enable support for Xilinx ZynqMP DMA controller.
+
 config ZX_DMA
 	tristate "ZTE ZX296702 DMA support"
 	depends on ARCH_ZX
drivers/dma/xilinx/Makefile +1 -0
index 3c4e9f2..95469dc 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_XILINX_VDMA) += xilinx_vdma.o
+obj-$(CONFIG_XILINX_ZYNQMP_DMA) += zynqmp_dma.o
drivers/dma/xilinx/zynqmp_dma.c new file +1145 -0

1,145 lines not on this page · raw message

+MODULE_LICENSE("GPL");

Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH v12 2/2] dmaengine: Add Xilinx zynqmp dma engine driver support

Quoted 22 lines · Kedareswara rao Appana
drivers/dma/xilinx/zynqmp_dma.c new file +22 -0
+static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
+			   struct platform_device *pdev)
+{
+	struct zynqmp_dma_chan *chan;
+	struct resource *res;
+	struct device_node *node = pdev->dev.of_node;
+	int err;
+
+	chan = devm_kzalloc(zdev->dev, sizeof(*chan), GFP_KERNEL);
+	if (!chan)
+		return -ENOMEM;
+	chan->dev = zdev->dev;
+	chan->zdev = zdev;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	chan->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(chan->regs))
+		return PTR_ERR(chan->regs);
+
+	chan->bus_width = ZYNQMP_DMA_BUS_WIDTH_64;
+	chan->dst_burst_len = ZYNQMP_DMA_AWLEN_RST_VAL;
+	chan->src_burst_len = ZYNQMP_DMA_ARLEN_RST_VAL;

drivers/dma/xilinx/zynqmp_dma.c line 981

Quoted 10 lines
drivers/dma/xilinx/zynqmp_dma.c new file +10 -0
+	err = of_property_read_u32(node, "xlnx,bus-width", &chan->bus_width);
+	if ((err < 0) && ((chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_64) ||
+			  (chan->bus_width != ZYNQMP_DMA_BUS_WIDTH_128))) {
+		dev_err(zdev->dev, "invalid bus-width value");
+		return err;
+	}
+
+	chan->is_dmacoherent =  of_property_read_bool(node, "dma-coherent");
+	zdev->chan = chan;
+	tasklet_init(&chan->tasklet, zynqmp_dma_do_tasklet, (ulong)chan);

where is this killed?

Quoted 6 lines
drivers/dma/xilinx/zynqmp_dma.c new file +6 -0
+	spin_lock_init(&chan->lock);
+	INIT_LIST_HEAD(&chan->active_list);
+	INIT_LIST_HEAD(&chan->pending_list);
+	INIT_LIST_HEAD(&chan->done_list);
+	INIT_LIST_HEAD(&chan->free_list);
+

drivers/dma/xilinx/zynqmp_dma.c line 997

Quoted 10 lines
drivers/dma/xilinx/zynqmp_dma.c new file +10 -0
+	dma_cookie_init(&chan->common);
+	chan->common.device = &zdev->common;
+	list_add_tail(&chan->common.device_node, &zdev->common.channels);
+
+	zynqmp_dma_init(chan);
+	chan->irq = platform_get_irq(pdev, 0);
+	if (chan->irq < 0)
+		return -ENXIO;
+	err = devm_request_irq(&pdev->dev, chan->irq, zynqmp_dma_irq_handler, 0,
+			       "zynqmp-dma", chan);

this needs to be freed/diabled in remove, dont see that

Signature · 1 line
~Vinod
#3 lore raw

RE: [PATCH v12 2/2] dmaengine: Add Xilinx zynqmp dma engine driver support

Hi Vinod,

Thanks for the review...

Quoted 7 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+	chan->is_dmacoherent =  of_property_read_bool(node, "dma-

coherent");

drivers/dma/xilinx/zynqmp_dma.c line 981

Quoted 2 lines
drivers/dma/xilinx/zynqmp_dma.c new file +2 -0
+	zdev->chan = chan;
+	tasklet_init(&chan->tasklet, zynqmp_dma_do_tasklet, (ulong)chan);

where is this killed?

This is killed in the zynqmp_dma_chan_remove() API.

Quoted 12 lines

drivers/dma/xilinx/zynqmp_dma.c

Quoted 11 lines
drivers/dma/xilinx/zynqmp_dma.c new file +10 -0
+	spin_lock_init(&chan->lock);
+	INIT_LIST_HEAD(&chan->active_list);
+	INIT_LIST_HEAD(&chan->pending_list);
+	INIT_LIST_HEAD(&chan->done_list);
+	INIT_LIST_HEAD(&chan->free_list);
+	zynqmp_dma_init(chan);
+	chan->irq = platform_get_irq(pdev, 0);
+	if (chan->irq < 0)
+		return -ENXIO;
+	err = devm_request_irq(&pdev->dev, chan->irq,

zynqmp_dma_irq_handler, 0,

Quoted 3 lines

drivers/dma/xilinx/zynqmp_dma.c line 997

Quoted 1 line
drivers/dma/xilinx/zynqmp_dma.c new file +1 -0
+			       "zynqmp-dma", chan);

this needs to be freed/diabled in remove, dont see that

It is freed in the zynqmp_dma_chan_remove() API.

Regards,
Kedar.

#4 lore raw
In reply to Kedareswara rao Appana
Quoted 2 lines · Kedareswara rao Appana

Device-tree binding documentation for Xilinx zynqmp dma engine used in Zynq UltraScale+ MPSoC.

And I missed the cleanup part, so both applied now

Signature · 1 line
~Vinod
#5 lore raw

Hi Vinod,

Quoted 5 lines · Kedareswara rao Appana
Quoted 2 lines

Device-tree binding documentation for Xilinx zynqmp dma engine used in Zynq UltraScale+ MPSoC.

And I missed the cleanup part, so both applied now

Thanks for applying the patches will send patch for the cleanup part On top of this patch...

Regards,
Kedar.

Quoted 3 lines

--
~Vinod