diff options
author | Ben Dooks <ben-linux@fluff.org> | 2010-01-29 04:02:15 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-02-22 19:03:43 -0500 |
commit | 2c420fe22f3d526691773288807d010068ce3033 (patch) | |
tree | 8e2605d8ec4cc6f076d7a04f2aa9e3e2727d976d /arch/arm/plat-samsung/dma.c | |
parent | 806c17b5497f62faa65a1fdd235b7fa2df17d704 (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-samsung/dma.c')
-rw-r--r-- | arch/arm/plat-samsung/dma.c | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/dma.c b/arch/arm/plat-samsung/dma.c new file mode 100644 index 000000000000..606db1af5fe7 --- /dev/null +++ b/arch/arm/plat-samsung/dma.c | |||
@@ -0,0 +1,84 @@ | |||
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 | |||
14 | struct 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 */ | ||
24 | struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS]; | ||
25 | struct 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 | |||
32 | struct 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 | |||
44 | int 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 | } | ||
57 | EXPORT_SYMBOL(s3c2410_dma_set_opfn); | ||
58 | |||
59 | int 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 | } | ||
72 | EXPORT_SYMBOL(s3c2410_dma_set_buffdone_fn); | ||
73 | |||
74 | int 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 | } | ||
84 | EXPORT_SYMBOL(s3c2410_dma_setflags); | ||