Skip to contentSkip to conversation

DMA: PL330: Add dma api driver

PATCH In review Jassi Brar 4 participants 5 messages May 12, 2010 – May 17, 2010 dmaengine

lore
Share & tools
lore

Jassi Brar

author
#0 lore raw

PATCH 1/1 DMA: PL330: Add dma api driver

Add DMA Engine API driver for the PL330 DMAC. This driver is supposed to be reusable by various platforms that have one or more PL330 DMACs. Atm, DMA_SLAVE and DMA_MEMCPY capabilities have been implemented.

---
Note:-
a) This patch is revised to apply over
async_tx of http://www.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx.git
b) This api driver depends upon the PL330 Core driver being merged.
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6115/1

 drivers/dma/Kconfig        |    9 +
 drivers/dma/Makefile       |    1 +
 drivers/dma/pl330.c        |  865 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/amba/pl330.h |   45 +++
 4 files changed, 920 insertions(+), 0 deletions(-)
 create mode 100644 drivers/dma/pl330.c
 create mode 100644 include/linux/amba/pl330.h
drivers/dma/Kconfig +9 -0
index 1b88779..c55bdeb 100644
@@ -166,6 +166,15 @@ config TIMB_DMA
 config ARCH_HAS_ASYNC_TX_FIND_CHANNEL
 	bool
 
+config PL330_DMA
+	tristate "DMA API Driver for PL330"
+	select DMA_ENGINE
+	select PL330
+	help
+	  Select if your platform has one or more PL330 DMACs.
+	  You need to provide platform specific settings via
+	  platform_data for a dma-pl330 device.
+
 config DMA_ENGINE
 	bool
 
drivers/dma/Makefile +1 -0
index 2088142..0fe5ebb 100644
@@ -22,3 +22,4 @@ obj-$(CONFIG_COH901318) += coh901318.o coh901318_lli.o
 obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += ppc4xx/
 obj-$(CONFIG_TIMB_DMA) += timb_dma.o
 obj-$(CONFIG_STE_DMA40) += ste_dma40.o ste_dma40_ll.o
+obj-$(CONFIG_PL330_DMA) += pl330.o
drivers/dma/pl330.c new file +865 -0

865 lines not on this page · raw message

include/linux/amba/pl330.h new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
1.6.2.5
#2 lore raw
Quoted 8 lines · Linus Walleij

2010/5/12 Jassi Brar <[email protected]>:

Quoted 6 lines

Add DMA Engine API driver for the PL330 DMAC. This driver is supposed to be reusable by various platforms that have one or more PL330 DMACs. Atm, DMA_SLAVE and DMA_MEMCPY capabilities have been implemented.

Quoted 5 lines
Quoted 1 line

Really looking good now!

Thanks.
Now that the core driver has been accepted by Russell,
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6132/1
this api driver too could be merged by DMA API maintainers?

regards,
jassi

Acked-by on v1 1/1
#3 lore raw
In reply to Jassi Brar

Hi Jassi,

Looks good, one comment:

Quoted 7 lines · Jassi Brar

Add DMA Engine API driver for the PL330 DMAC. This driver is supposed to be reusable by various platforms that have one or more PL330 DMACs. Atm, DMA_SLAVE and DMA_MEMCPY capabilities have been implemented.

[..]

Quoted 5 lines
(quoted diff) +5 -0
+static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
+{
+ ? ? ? struct dma_pl330_desc *desc = token;
+ ? ? ? struct dma_pl330_chan *pch = desc->pchan;
+ ? ? ? unsigned long flags;

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+ ? ? ? /* If desc aborted */
+ ? ? ? if (!pch)
+ ? ? ? ? ? ? ? return;
+
+ ? ? ? spin_lock_irqsave(&pch->lock, flags);
+
+ ? ? ? desc->status = DONE;
+
+ ? ? ? spin_unlock_irqrestore(&pch->lock, flags);

I don't think you need the lock here. Assigning an integer is atomic, and you reschedule the tasklet.

Since this patch depends on the generic bits in Russell's tree I need to wait until after the ARM tree is pulled to take it through the dma tree. So, for now...

#4 lore raw
Quoted 12 lines · Dan Williams
Quoted 10 lines · Jassi Brar
(quoted diff) +10 -0
+static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
+{
+ ? ? ? struct dma_pl330_desc *desc = token;
+ ? ? ? struct dma_pl330_chan *pch = desc->pchan;
+ ? ? ? unsigned long flags;
+
+ ? ? ? /* If desc aborted */
+ ? ? ? if (!pch)
+ ? ? ? ? ? ? ? return;
+
Quoted 8 lines

drivers/dma/pl330.c

Quoted 5 lines

+ ? ? ? spin_lock_irqsave(&pch->lock, flags);

drivers/dma/pl330.c new file +4 -0
+
+ ? ? ? desc->status = DONE;
+
+ ? ? ? spin_unlock_irqrestore(&pch->lock, flags);

I don't think you need the lock here. ?Assigning an integer is atomic, and you reschedule the tasklet.

yes right

Quoted 5 lines

Since this patch depends on the generic bits in Russell's tree I need to wait until after the ARM tree is pulled to take it through the dma tree. ?So, for now...

Thanks