[package] base-files: add an experimental "-c" flag which tries to preserve *all...
[openwrt.git] / target / linux / coldfire / patches / 037-m5445x_edma_callback.patch
1 From acd937ac924aefd22ea9a66ea621ab80a4f9b594 Mon Sep 17 00:00:00 2001
2 From: Kurt Mahan <kmahan@freescale.com>
3 Date: Mon, 10 Dec 2007 03:37:19 -0700
4 Subject: [PATCH] Update EDMA driver to allow callback/arg changes.
5
6 LTIBName: m5445x-edma-callback
7 Signed-off-by: Kurt Mahan <kmahan@freescale.com>
8 ---
9 drivers/spi/coldfire_edma.c | 27 +++++++++++++++++++++++++++
10 include/asm-m68k/coldfire_edma.h | 20 ++++++++++++++++++++
11 2 files changed, 47 insertions(+), 0 deletions(-)
12
13 --- a/drivers/spi/coldfire_edma.c
14 +++ b/drivers/spi/coldfire_edma.c
15 @@ -206,6 +206,31 @@ int request_edma_channel(int channel,
16 EXPORT_SYMBOL(request_edma_channel);
17
18 /**
19 + * set_edma_callback - Update the channel callback/arg
20 + * @channel: channel number
21 + * @handler: dma handler
22 + * @error_handler: dma error handler
23 + * @arg: argument to pass back
24 + *
25 + * Returns 0 if success or a negative value if failure
26 + */
27 +int set_edma_callback(int channel,
28 + edma_irq_handler handler,
29 + edma_error_handler error_handler,
30 + void *arg )
31 +{
32 + if (devp!=NULL && channel>=0 && channel<=EDMA_CHANNELS &&
33 + devp->dma_interrupt_handlers[channel].allocated) {
34 + devp->dma_interrupt_handlers[channel].irq_handler = handler;
35 + devp->dma_interrupt_handlers[channel].error_handler = error_handler;
36 + devp->dma_interrupt_handlers[channel].arg = arg;
37 + return 0;
38 + }
39 + return -EINVAL;
40 +}
41 +EXPORT_SYMBOL(set_edma_callback);
42 +
43 +/**
44 * free_edma_channel - Free the edma channel
45 * @channel: channel number
46 * @arg: argument created with
47 @@ -216,8 +241,10 @@ int free_edma_channel(int channel, void
48 {
49 if (devp!=NULL && channel>=0 && channel<=EDMA_CHANNELS) {
50 if (devp->dma_interrupt_handlers[channel].allocated) {
51 +#if 0
52 if (devp->dma_interrupt_handlers[channel].arg != arg)
53 return -EBUSY;
54 +#endif
55
56 devp->dma_interrupt_handlers[channel].allocated = 0;
57 devp->dma_interrupt_handlers[channel].arg = NULL;
58 --- a/include/asm-m68k/coldfire_edma.h
59 +++ b/include/asm-m68k/coldfire_edma.h
60 @@ -96,10 +96,30 @@ int request_edma_channel(int channel,
61 void *dev,
62 spinlock_t *lock,
63 const char *device_id);
64 +
65 +/**
66 + * set_edma_callback - Update the channel callback/arg
67 + * @channel: channel number
68 + * @handler: dma handler
69 + * @error_handler: dma error handler
70 + * @arg: argument to pass back
71 + *
72 + * Returns 0 if success or a negative value if failure
73 + */
74 +int set_edma_callback(int channel,
75 + edma_irq_handler handler,
76 + edma_error_handler error_handler,
77 + void *arg);
78
79 /* Free eDMA channel
80 * channel - eDMA TCD number
81 * dev - device
82 */
83 int free_edma_channel(int channel, void *dev);
84 +
85 +/*
86 + * DMA Modes
87 + */
88 +#define DMA_MODE_READ 0
89 +#define DMA_MODE_WRITE 1
90 #endif
This page took 0.043567 seconds and 5 git commands to generate.