dmaengine: Add Xilinx AXI Central Direct Memory Access Engine driver support
Subsystems (2)
PATCH v6 2/2 dmaengine: Add Xilinx AXI Central Direct Memory Access Engine driver support
This is the driver for the AXI Central Direct Memory Access (AXI CDMA) core, which is a soft Xilinx IP core that provides high-bandwidth Direct Memory Access (DMA) between a memory-mapped source address and a memory-mapped destination address.
This module works on Zynq (ARM Based SoC) and Microblaze platforms.
---
Changes in v6:
- Used the readl_poll_timeout instead of do while loops in the driver
- Improved the SG list handling by chaining the bds.
- Removed the unnecessary xilinx_cdma_channel_set_config API the properties in this API is not being used by the driver.
Changes in v5:
- updated license in the driver as suggested by Paul.
- Corrected return value in is_idle funtion.
Changes in v4:
- used GFP_NOWAIT instead of GFP_KERNEL during the desc allocation
- Modified spin_lock handling moved the spin_lock to the appropriate functions
- device_control api is removed and updated driver as per newer APi's. Changes in v3:
- Check for CDMA idle condition before changing the configuration.
- Modified the xilinx_dma.h header file location to the include/linux/dma/xilinx_dma.h
Changes in v2:
- Rebased on 3.16-rc7.
drivers/dma/Kconfig | 12 + drivers/dma/xilinx/Makefile | 1 + drivers/dma/xilinx/xilinx_cdma.c | 991 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 1004 insertions(+) create mode 100644 drivers/dma/xilinx/xilinx_cdma.c
drivers/dma/Kconfig +12 -0
@@ -515,6 +515,18 @@ config XILINX_VDMA channels, Memory Mapped to Stream (MM2S) and Stream to Memory Mapped (S2MM) for the data transfers. +config XILINX_CDMA + tristate "Xilinx AXI CDMA Engine" + depends on (ARCH_ZYNQ || MICROBLAZE) + select DMA_ENGINE + help + Enable support for Xilinx AXI CDMA Soft IP. + + The AXI CDMA is a soft IP which provides high-bandwidth + Direct Memory Access (DMA) between a memory-mapped source + address and a memory-mapped destination address using the + AXI4 protocol. + config ZX_DMA tristate "ZTE ZX296702 DMA support" depends on ARCH_ZX
drivers/dma/xilinx/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_XILINX_VDMA) += xilinx_vdma.o +obj-$(CONFIG_XILINX_CDMA) += xilinx_cdma.o
drivers/dma/xilinx/xilinx_cdma.c new file +991 -0
991 lines not on this page · raw message
Signature · 1 line
2.1.2
Quoted 4 lines · Kedareswara rao Appana
This is the driver for the AXI Central Direct Memory Access (AXI CDMA) core, which is a soft Xilinx IP core that provides high-bandwidth Direct Memory Access (DMA) between a memory-mapped source address and a memory-mapped destination address.
Where is the 1/2 here ? I have only this one in my mails..
Signature · 1 line
~Vinod
Hi Vinod,
Quoted 10 lines
-----Original Message-----
From: Vinod Koul [mailto:vinod.koul at intel.com]
Sent: Monday, October 05, 2015 7:09 PM
To: Appana Durga Kedareswara Rao
Cc: dan.j.williams at intel.com; Anirudha Sarangi; Michal Simek; Soren Brinkmann; Appana Durga Kedareswara Rao; dmaengine at vger.kernel.org; linux-arm- kernel at lists.infradead.org; linux-kernel at vger.kernel.org
Subject: Re: [PATCH v6 2/2] dmaengine: Add Xilinx AXI Central Direct Memory Access Engine driver support
Quoted 7 lines
Quoted 4 lines · Kedareswara rao Appana
This is the driver for the AXI Central Direct Memory Access (AXI CDMA) core, which is a soft Xilinx IP core that provides high-bandwidth Direct Memory Access (DMA) between a memory-mapped source address and a memory-mapped destination address.
Where is the 1/2 here ? I have only this one in my mails..
You are there in the 1/2 not the dmaengine at vger.kernel.org.
./scripts/get_maintainer.pl -f Documentation/devicetree/bindings/dma/xilinx/xilinx_cdma.txt Rob Herring <[email protected]> (maintainer:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS) Pawel Moll <[email protected]> (maintainer:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS) Mark Rutland <[email protected]> (maintainer:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS) Ian Campbell <[email protected]> (maintainer:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS) Kumar Gala <[email protected]> (maintainer:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS) Michal Simek <[email protected]> (supporter:ARM/ZYNQ ARCHITECTURE)
"S?ren Brinkmann" <[email protected]> (reviewer)
Kedareswara rao Appana <[email protected]> (commit_signer:1/1=100%,authored:1/1=100%,added_lines:54/54=100%) devicetree at vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS) linux-arm-kernel at lists.infradead.org (moderated list:ARM/ZYNQ ARCHITECTURE)
linux-kernel at vger.kernel.org (open list)
If you want me to resend the patch will resend
Regards,
Kedar.
Quoted 3 lines
--
~Vinod
Quoted 10 lines · Appana Durga Kedareswara Rao
Quoted 8 lines · Kedareswara rao Appana
Quoted 4 lines
This is the driver for the AXI Central Direct Memory Access (AXI CDMA) core, which is a soft Xilinx IP core that provides high-bandwidth Direct Memory Access (DMA) between a memory-mapped source address and a memory-mapped destination address.
Where is the 1/2 here ? I have only this one in my mails..
You are there in the 1/2 not the dmaengine at vger.kernel.org.
The threading is broken in your patch series. ON searching I found the 1/2. Please make sure patch series are threaded properly.
Signature · 1 line
~Vinod
Hi Vinod,
Quoted 21 lines
-----Original Message-----
From: dmaengine-owner at vger.kernel.org [mailto:dmaengine-
owner at vger.kernel.org] On Behalf Of Koul, Vinod
Sent: Monday, October 05, 2015 7:40 PM
To: Appana Durga Kedareswara Rao
Cc: linux-kernel at vger.kernel.org; Anirudha Sarangi; Michal Simek; Williams, Dan J; Soren Brinkmann; dmaengine at vger.kernel.org; linux-arm-
kernel at lists.infradead.org; arnd at arndb.de
Subject: Re: [PATCH v6 2/2] dmaengine: Add Xilinx AXI Central Direct Memory Access Engine driver supportQuoted 2 lines · Appana Durga Kedareswara Rao
Quoted 2 lines
On Mon, Sep 07, 2015 at 06:03:18PM +0530, Kedareswara rao Appana
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 4 lines
This is the driver for the AXI Central Direct Memory Access (AXI CDMA) core, which is a soft Xilinx IP core that provides high-bandwidth Direct Memory Access (DMA) between a memory-mapped source address and a memory-mapped destination address.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Where is the 1/2 here ? I have only this one in my mails..
You are there in the 1/2 not the dmaengine at vger.kernel.org.
The threading is broken in your patch series. ON searching I found the 1/2. Please make sure patch series are threaded properly.
Sorry for the noise will take care from the next series onwards.
Regards,
Kedar.
Quoted 3 lines
--
~Vinod
N r y b X ?v ^ )?{.n + )?{ay
?? ,j f h z
w j:+v w j m zZ+ ?j" !
Quoted 1 line
i
drivers/dma/xilinx/xilinx_cdma.c line 220
Quoted 11 lines · Kedareswara rao Appana
drivers/dma/xilinx/xilinx_cdma.c new file +11
-0+static struct xilinx_cdma_tx_segment * +xilinx_cdma_alloc_tx_segment (struct xilinx_cdma_chan *chan) +{ +struct xilinx_cdma_tx_segment *segment; +dma_addr_t phys; + + segment =dma_pool_alloc (chan->desc_pool,GFP_ATOMIC , &phys); +if (!segment) +return NULL ; + +memset (segment,0 ,sizeof (*segment));
dma_pool_zalloc() pls
Quoted 4 lines
drivers/dma/xilinx/xilinx_cdma.c new file +4
-0+static void xilinx_cdma_start_transfer (struct xilinx_cdma_chan *chan) +{ +struct xilinx_cdma_tx_descriptor *head_desc, *tail_desc; +struct xilinx_cdma_tx_segment *tail_segment;
drivers/dma/xilinx/xilinx_cdma.c line 425
Quoted 10 lines
drivers/dma/xilinx/xilinx_cdma.c new file +10
-0+u32 ctrl_reg =cdma_read (chan,XILINX_CDMA_CONTROL_OFFSET ); + +if (chan->err) +return ; + +if (list_empty (&chan->pending_list)) +return ; + +if (!chan->idle) +return ;
this and err case can be combined !
Quoted 9 lines
drivers/dma/xilinx/xilinx_cdma.c new file +9
-0+static struct dma_async_tx_descriptor * +xilinx_cdma_prep_memcpy (struct dma_chan *dchan,dma_addr_t dma_dst, +dma_addr_t dma_src,size_t len,unsigned long flags) +{ +struct xilinx_cdma_chan *chan =to_xilinx_chan (dchan); +struct xilinx_cdma_desc_hw *hw; +struct xilinx_cdma_tx_descriptor *desc; +struct xilinx_cdma_tx_segment *segment, *prev; +
drivers/dma/xilinx/xilinx_cdma.c line 704
Quoted 10 lines
drivers/dma/xilinx/xilinx_cdma.c new file +10
-0+if (!len || len >XILINX_CDMA_MAX_TRANS_LEN ) +return NULL ; + + desc =xilinx_cdma_alloc_tx_descriptor (chan); +if (!desc) +return NULL ; + +dma_async_tx_descriptor_init (&desc->async_tx, &chan->common); + desc->async_tx.tx_submit = xilinx_cdma_tx_submit; +async_tx_ack (&desc->async_tx);
Why do you need this ?
drivers/dma/xilinx/xilinx_cdma.c line 750
Quoted 6 lines
drivers/dma/xilinx/xilinx_cdma.c new file +6
-0+static int xilinx_cdma_terminate_all (struct dma_chan *dchan) +{ +struct xilinx_cdma_chan *chan =to_xilinx_chan (dchan); + +/* Reset the channel */ +xilinx_cdma_chan_reset (chan);
what about the irqs that are already fired/tasklets scheduled?
Quoted 6 lines
drivers/dma/xilinx/xilinx_cdma.c new file +6
-0+ +/* Remove and free all of the descriptors in the lists */ +xilinx_cdma_free_descriptors (chan); + +return 0 ; +}
drivers/dma/xilinx/xilinx_cdma.c line 766
Quoted 10 lines
drivers/dma/xilinx/xilinx_cdma.c new file +10
-0+ +/* ----------------------------------------------------------------------------- +* Probe and remove +*/ + +/** +* xilinx_cdma_free_channel - Channel remove function +* @chan: Driver specific cdma channel +*/ +static void xilinx_cdma_free_channel (struct xilinx_cdma_chan *chan)
Free channel is a bad name, as we alloc and free channels from dmaengine API
Signature · 1 line
~Vinod