[PATCH 09/11] ARM: add PrimeCell generic DMA to PL022 v5

Previous thread: [PATCH 08/11] ARM: add PrimeCell generic DMA to PL011 v5 by Linus Walleij on Wednesday, April 7, 2010 - 4:13 pm. (1 message)

Next thread: [PATCH 10/11] ARM: config U300 PL180 PL011 PL022 for DMA v5 by Linus Walleij on Wednesday, April 7, 2010 - 4:14 pm. (1 message)
From: Linus Walleij
Date: Wednesday, April 7, 2010 - 4:14 pm

This extends the PL022 UART driver with generic DMA engine support
using the PrimeCell DMA engine interface. Also fix up the test
code for the U300 platform.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
 arch/arm/mach-u300/dummyspichip.c |    1 +
 drivers/spi/amba-pl022.c          |  517 +++++++++++++++++++++++++++++++------
 include/linux/amba/pl022.h        |    6 +
 3 files changed, 438 insertions(+), 86 deletions(-)

diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c
index 5f55012..5672189 100644
--- a/arch/arm/mach-u300/dummyspichip.c
+++ b/arch/arm/mach-u300/dummyspichip.c
@@ -268,6 +268,7 @@ static struct spi_driver pl022_dummy_driver = {
 	.driver = {
 		.name	= "spi-dummy",
 		.owner	= THIS_MODULE,
+		.bus = &spi_bus_type,
 	},
 	.probe	= pl022_dummy_probe,
 	.remove	= __devexit_p(pl022_dummy_remove),
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index e9aeee1..09a701c 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -27,7 +27,6 @@
 /*
  * TODO:
  * - add timeout on polled transfers
- * - add generic DMA framework support
  */
 
 #include <linux/init.h>
@@ -45,6 +44,10 @@
 #include <linux/amba/pl022.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
+#include <linux/scatterlist.h>
+#include <linux/amba/dma.h>
 
 /*
  * This macro is used to define some register default values.
@@ -365,6 +368,14 @@ struct pl022 {
 	enum ssp_reading		read;
 	enum ssp_writing		write;
 	u32				exp_fifo_level;
+	/* DMA settings */
+#ifdef CONFIG_DMADEVICES
+	struct dma_chan			*dma_rx_channel;
+	struct dma_chan			*dma_tx_channel;
+	struct sg_table			sgt_rx;
+	struct sg_table			sgt_tx;
+	char				*dummypage;
+#endif
 };
 
 /**
@@ -699,6 +710,367 @@ static void *next_transfer(struct pl022 *pl022)
 	}
 	return STATE_DONE;
 }
+
+/*
+ * This DMA functionality is only compiled in if we have
+ * access to the ...
From: Grant Likely
Date: Wednesday, April 7, 2010 - 11:17 pm

On Wed, Apr 7, 2010 at 5:14 PM, Linus Walleij

I have not reviewed, compiled, or tested this.  I've only skimmed over
it.  Simply for the purpose of merging the spi portion, you can add my
"Acked-by: Grant Likely <grant.likely@secretlab.ca>" line, but collect
other acks from people who will actually review it.




-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--

Previous thread: [PATCH 08/11] ARM: add PrimeCell generic DMA to PL011 v5 by Linus Walleij on Wednesday, April 7, 2010 - 4:13 pm. (1 message)

Next thread: [PATCH 10/11] ARM: config U300 PL180 PL011 PL022 for DMA v5 by Linus Walleij on Wednesday, April 7, 2010 - 4:14 pm. (1 message)