Adds edma_clear_event API support to EDMA.

There has been a change to the MMC interface on TI's DA830
architecture that requires setting the DMATRIG bit to trigger
the first read data transfer when doing a read operation using
the CPU, but it has the unintended consequence causing a DMA
event.  Because of this, the next DMA read from the MMC/SD will
fail with an Event Miss. This API will be used to clear the ER.

Signed-off-by: Sudhakar Rajashekhara <[email protected]>
---
 arch/arm/mach-davinci/dma.c               |   18 ++++++++++++++++++
 arch/arm/mach-davinci/include/mach/edma.h |    1 +
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index fc74ccc..9427c80 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -95,6 +95,8 @@
 #define EDMA_CCSTAT    0x0640
 
 #define EDMA_M         0x1000  /* global channel registers */
+#define EDMA_ECR       0x1008
+#define EDMA_ECRH      0x100C
 #define EDMA_SHADOW0   0x2000  /* 4 regions shadowing global channels */
 #define EDMA_PARM      0x4000  /* 128 param entries */
 
@@ -987,6 +989,22 @@ void edma_clean_channel(unsigned channel)
 }
 EXPORT_SYMBOL(edma_clean_channel);
 
+/*
+ * edma_clear_event - clear an outstanding event on the DMA channel
+ * Arguments:
+ *     channel - channel number
+ */
+void edma_clear_event(unsigned channel)
+{
+       if (channel >= num_channels)
+               return;
+       if (channel < 32)
+               edma_write(EDMA_ECR, 1 << channel);
+       else
+               edma_write(EDMA_ECRH, 1 << (channel - 32));
+}
+EXPORT_SYMBOL(edma_clear_event);
+
 /*-----------------------------------------------------------------------*/
 
 static int __init edma_probe(struct platform_device *pdev)
diff --git a/arch/arm/mach-davinci/include/mach/edma.h 
b/arch/arm/mach-davinci/include/mach/edma.h
index c16e383..b467358 100644
--- a/arch/arm/mach-davinci/include/mach/edma.h
+++ b/arch/arm/mach-davinci/include/mach/edma.h
@@ -205,6 +205,7 @@ void edma_read_slot(unsigned slot, struct edmacc_param 
*params);
 int edma_start(unsigned channel);
 void edma_stop(unsigned channel);
 void edma_clean_channel(unsigned channel);
+void edma_clear_event(unsigned channel);
 void edma_pause(unsigned channel);
 void edma_resume(unsigned channel);
 
-- 
1.5.6

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to