summaryrefslogtreecommitdiff
path: root/target/linux/coldfire/patches/037-m5445x_edma_callback.patch
blob: af2705c63bd235c33f66c97b20f7ba13692fe37c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From acd937ac924aefd22ea9a66ea621ab80a4f9b594 Mon Sep 17 00:00:00 2001
From: Kurt Mahan <kmahan@freescale.com>
Date: Mon, 10 Dec 2007 03:37:19 -0700
Subject: [PATCH] Update EDMA driver to allow callback/arg changes.

LTIBName: m5445x-edma-callback
Signed-off-by: Kurt Mahan <kmahan@freescale.com>
---
 drivers/spi/coldfire_edma.c      |   27 +++++++++++++++++++++++++++
 include/asm-m68k/coldfire_edma.h |   20 ++++++++++++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)

--- a/drivers/spi/coldfire_edma.c
+++ b/drivers/spi/coldfire_edma.c
@@ -206,6 +206,31 @@ int request_edma_channel(int channel,
 EXPORT_SYMBOL(request_edma_channel);
 
 /**
+ * set_edma_callback - Update the channel callback/arg
+ * @channel: channel number
+ * @handler: dma handler
+ * @error_handler: dma error handler
+ * @arg: argument to pass back
+ *
+ * Returns 0 if success or a negative value if failure
+ */
+int set_edma_callback(int channel,
+	edma_irq_handler handler,
+	edma_error_handler error_handler,
+	void *arg )
+{
+	if (devp!=NULL && channel>=0 && channel<=EDMA_CHANNELS &&
+	    devp->dma_interrupt_handlers[channel].allocated) {
+		devp->dma_interrupt_handlers[channel].irq_handler = handler;
+		devp->dma_interrupt_handlers[channel].error_handler = error_handler;
+		devp->dma_interrupt_handlers[channel].arg = arg;
+		return 0;
+	}
+	return -EINVAL;
+}
+EXPORT_SYMBOL(set_edma_callback);
+
+/**
  * free_edma_channel - Free the edma channel
  * @channel: channel number
  * @arg: argument created with
@@ -216,8 +241,10 @@ int free_edma_channel(int channel, void 
 {
 	if (devp!=NULL && channel>=0 && channel<=EDMA_CHANNELS) {
 		if (devp->dma_interrupt_handlers[channel].allocated) {
+#if 0
 			if (devp->dma_interrupt_handlers[channel].arg != arg)
 				return -EBUSY;
+#endif
 
 			devp->dma_interrupt_handlers[channel].allocated = 0;
 			devp->dma_interrupt_handlers[channel].arg = NULL;
--- a/include/asm-m68k/coldfire_edma.h
+++ b/include/asm-m68k/coldfire_edma.h
@@ -96,10 +96,30 @@ int request_edma_channel(int channel,
 		void *dev,
 		spinlock_t *lock,
 		const char *device_id);
+
+/**
+ * set_edma_callback - Update the channel callback/arg
+ * @channel: channel number
+ * @handler: dma handler
+ * @error_handler: dma error handler
+ * @arg: argument to pass back
+ *
+ * Returns 0 if success or a negative value if failure
+ */
+int set_edma_callback(int channel,
+		edma_irq_handler handler,
+		edma_error_handler error_handler,
+		void *arg);
   
 /* Free eDMA channel
  *  channel - eDMA TCD number
  *  dev - device
  */
 int free_edma_channel(int channel, void *dev);
+
+/*
+ * DMA Modes
+ */
+#define	DMA_MODE_READ		0
+#define DMA_MODE_WRITE		1
 #endif