aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-s3c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2010-01-29 04:02:15 -0500
committerBen Dooks <ben-linux@fluff.org>2010-02-22 19:03:43 -0500
commit2c420fe22f3d526691773288807d010068ce3033 (patch)
tree8e2605d8ec4cc6f076d7a04f2aa9e3e2727d976d /arch/arm/plat-s3c
parent806c17b5497f62faa65a1fdd235b7fa2df17d704 (diff)
ARM: SAMSUNG: Move DMA support to plat-samsung
Move the core of the DMA support to plat-samsung for everyone to use. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-s3c')
-rw-r--r--arch/arm/plat-s3c/Makefile4
-rw-r--r--arch/arm/plat-s3c/dma.c84
-rw-r--r--arch/arm/plat-s3c/include/plat/dma.h127
3 files changed, 0 insertions, 215 deletions
diff --git a/arch/arm/plat-s3c/Makefile b/arch/arm/plat-s3c/Makefile
index 197b9bd139ac..2a3c4a49117a 100644
--- a/arch/arm/plat-s3c/Makefile
+++ b/arch/arm/plat-s3c/Makefile
@@ -13,7 +13,3 @@ obj- :=
13 13
14obj-y += init.o 14obj-y += init.o
15obj-y += time.o 15obj-y += time.o
16
17# DMA support
18
19obj-$(CONFIG_S3C_DMA) += dma.o
diff --git a/arch/arm/plat-s3c/dma.c b/arch/arm/plat-s3c/dma.c
deleted file mode 100644
index 606db1af5fe7..000000000000
--- a/arch/arm/plat-s3c/dma.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/* linux/arch/arm/plat-s3c/dma.c
2 *
3 * Copyright (c) 2003-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C DMA core
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14struct s3c2410_dma_buf;
15
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/errno.h>
19
20#include <mach/dma.h>
21#include <mach/irqs.h>
22
23/* dma channel state information */
24struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS];
25struct s3c2410_dma_chan *s3c_dma_chan_map[DMACH_MAX];
26
27/* s3c_dma_lookup_channel
28 *
29 * change the dma channel number given into a real dma channel id
30*/
31
32struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel)
33{
34 if (channel & DMACH_LOW_LEVEL)
35 return &s3c2410_chans[channel & ~DMACH_LOW_LEVEL];
36 else
37 return s3c_dma_chan_map[channel];
38}
39
40/* do we need to protect the settings of the fields from
41 * irq?
42*/
43
44int s3c2410_dma_set_opfn(unsigned int channel, s3c2410_dma_opfn_t rtn)
45{
46 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
47
48 if (chan == NULL)
49 return -EINVAL;
50
51 pr_debug("%s: chan=%p, op rtn=%p\n", __func__, chan, rtn);
52
53 chan->op_fn = rtn;
54
55 return 0;
56}
57EXPORT_SYMBOL(s3c2410_dma_set_opfn);
58
59int s3c2410_dma_set_buffdone_fn(unsigned int channel, s3c2410_dma_cbfn_t rtn)
60{
61 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
62
63 if (chan == NULL)
64 return -EINVAL;
65
66 pr_debug("%s: chan=%p, callback rtn=%p\n", __func__, chan, rtn);
67
68 chan->callback_fn = rtn;
69
70 return 0;
71}
72EXPORT_SYMBOL(s3c2410_dma_set_buffdone_fn);
73
74int s3c2410_dma_setflags(unsigned int channel, unsigned int flags)
75{
76 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
77
78 if (chan == NULL)
79 return -EINVAL;
80
81 chan->flags = flags;
82 return 0;
83}
84EXPORT_SYMBOL(s3c2410_dma_setflags);
diff --git a/arch/arm/plat-s3c/include/plat/dma.h b/arch/arm/plat-s3c/include/plat/dma.h
deleted file mode 100644
index e429d10be3ad..000000000000
--- a/arch/arm/plat-s3c/include/plat/dma.h
+++ /dev/null
@@ -1,127 +0,0 @@
1/* arch/arm/plat-s3c/include/plat/dma.h
2 *
3 * Copyright (C) 2003-2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Samsung S3C DMA support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13enum s3c2410_dma_buffresult {
14 S3C2410_RES_OK,
15 S3C2410_RES_ERR,
16 S3C2410_RES_ABORT
17};
18
19enum s3c2410_dmasrc {
20 S3C2410_DMASRC_HW, /* source is memory */
21 S3C2410_DMASRC_MEM /* source is hardware */
22};
23
24/* enum s3c2410_chan_op
25 *
26 * operation codes passed to the DMA code by the user, and also used
27 * to inform the current channel owner of any changes to the system state
28*/
29
30enum s3c2410_chan_op {
31 S3C2410_DMAOP_START,
32 S3C2410_DMAOP_STOP,
33 S3C2410_DMAOP_PAUSE,
34 S3C2410_DMAOP_RESUME,
35 S3C2410_DMAOP_FLUSH,
36 S3C2410_DMAOP_TIMEOUT, /* internal signal to handler */
37 S3C2410_DMAOP_STARTED, /* indicate channel started */
38};
39
40struct s3c2410_dma_client {
41 char *name;
42};
43
44struct s3c2410_dma_chan;
45
46/* s3c2410_dma_cbfn_t
47 *
48 * buffer callback routine type
49*/
50
51typedef void (*s3c2410_dma_cbfn_t)(struct s3c2410_dma_chan *,
52 void *buf, int size,
53 enum s3c2410_dma_buffresult result);
54
55typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,
56 enum s3c2410_chan_op );
57
58
59
60/* s3c2410_dma_request
61 *
62 * request a dma channel exclusivley
63*/
64
65extern int s3c2410_dma_request(unsigned int channel,
66 struct s3c2410_dma_client *, void *dev);
67
68
69/* s3c2410_dma_ctrl
70 *
71 * change the state of the dma channel
72*/
73
74extern int s3c2410_dma_ctrl(unsigned int channel, enum s3c2410_chan_op op);
75
76/* s3c2410_dma_setflags
77 *
78 * set the channel's flags to a given state
79*/
80
81extern int s3c2410_dma_setflags(unsigned int channel,
82 unsigned int flags);
83
84/* s3c2410_dma_free
85 *
86 * free the dma channel (will also abort any outstanding operations)
87*/
88
89extern int s3c2410_dma_free(unsigned int channel, struct s3c2410_dma_client *);
90
91/* s3c2410_dma_enqueue
92 *
93 * place the given buffer onto the queue of operations for the channel.
94 * The buffer must be allocated from dma coherent memory, or the Dcache/WB
95 * drained before the buffer is given to the DMA system.
96*/
97
98extern int s3c2410_dma_enqueue(unsigned int channel, void *id,
99 dma_addr_t data, int size);
100
101/* s3c2410_dma_config
102 *
103 * configure the dma channel
104*/
105
106extern int s3c2410_dma_config(unsigned int channel, int xferunit);
107
108/* s3c2410_dma_devconfig
109 *
110 * configure the device we're talking to
111*/
112
113extern int s3c2410_dma_devconfig(int channel, enum s3c2410_dmasrc source,
114 unsigned long devaddr);
115
116/* s3c2410_dma_getposition
117 *
118 * get the position that the dma transfer is currently at
119*/
120
121extern int s3c2410_dma_getposition(unsigned int channel,
122 dma_addr_t *src, dma_addr_t *dest);
123
124extern int s3c2410_dma_set_opfn(unsigned int, s3c2410_dma_opfn_t rtn);
125extern int s3c2410_dma_set_buffdone_fn(unsigned int, s3c2410_dma_cbfn_t rtn);
126
127