mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-11 10:11:34 +02:00
91 lines
2.6 KiB
Diff
91 lines
2.6 KiB
Diff
|
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
|