diff options
author | Ben Dooks <ben@simtec.co.uk> | 2009-03-19 11:02:39 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-05-01 06:39:07 -0400 |
commit | 97c1b145231730e62dd71921ec653315a1da3aad (patch) | |
tree | 8bfc9e4d781f5ad1e17aae3e058372e53c24574a /arch/arm/plat-s3c | |
parent | 20934cdbaae9c26a31d7f593c6a747c687ae79a1 (diff) |
[ARM] S3C: Move DMA channel management code to plat-s3c
Change the name of S3C2410_DMA_CHANNELS to S3C_DMA_CHANNELS in the process.
Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-s3c')
-rw-r--r-- | arch/arm/plat-s3c/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/plat-s3c/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/plat-s3c/dma.c | 86 | ||||
-rw-r--r-- | arch/arm/plat-s3c/include/plat/dma-core.h | 22 |
4 files changed, 119 insertions, 0 deletions
diff --git a/arch/arm/plat-s3c/Kconfig b/arch/arm/plat-s3c/Kconfig index de9383814e5e..d4fc89fc5f45 100644 --- a/arch/arm/plat-s3c/Kconfig +++ b/arch/arm/plat-s3c/Kconfig | |||
@@ -150,6 +150,13 @@ config S3C_GPIO_CFG_S3C64XX | |||
150 | Internal configuration to enable S3C64XX style GPIO configuration | 150 | Internal configuration to enable S3C64XX style GPIO configuration |
151 | functions. | 151 | functions. |
152 | 152 | ||
153 | # DMA | ||
154 | |||
155 | config S3C_DMA | ||
156 | bool | ||
157 | help | ||
158 | Internal configuration for S3C DMA core | ||
159 | |||
153 | # device definitions to compile in | 160 | # device definitions to compile in |
154 | 161 | ||
155 | config S3C_DEV_HSMMC | 162 | config S3C_DEV_HSMMC |
diff --git a/arch/arm/plat-s3c/Makefile b/arch/arm/plat-s3c/Makefile index 8d7815d25a51..e8b23fc8fba2 100644 --- a/arch/arm/plat-s3c/Makefile +++ b/arch/arm/plat-s3c/Makefile | |||
@@ -18,6 +18,10 @@ obj-y += pwm-clock.o | |||
18 | obj-y += gpio.o | 18 | obj-y += gpio.o |
19 | obj-y += gpio-config.o | 19 | obj-y += gpio-config.o |
20 | 20 | ||
21 | # DMA support | ||
22 | |||
23 | obj-$(CONFIG_S3C_DMA) += dma.o | ||
24 | |||
21 | # PM support | 25 | # PM support |
22 | 26 | ||
23 | obj-$(CONFIG_PM) += pm.o | 27 | obj-$(CONFIG_PM) += pm.o |
diff --git a/arch/arm/plat-s3c/dma.c b/arch/arm/plat-s3c/dma.c new file mode 100644 index 000000000000..c9db75c06af5 --- /dev/null +++ b/arch/arm/plat-s3c/dma.c | |||
@@ -0,0 +1,86 @@ | |||
1 | /* linux/arch/arm/plat-s3c/dma.c | ||
2 | * | ||
3 | * Copyright (c) 2003-2005,2006,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 | #include <plat/dma-plat.h> | ||
24 | |||
25 | /* dma channel state information */ | ||
26 | struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS]; | ||
27 | struct s3c2410_dma_chan *s3c_dma_chan_map[DMACH_MAX]; | ||
28 | |||
29 | /* s3c_dma_lookup_channel | ||
30 | * | ||
31 | * change the dma channel number given into a real dma channel id | ||
32 | */ | ||
33 | |||
34 | struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel) | ||
35 | { | ||
36 | if (channel & DMACH_LOW_LEVEL) | ||
37 | return &s3c2410_chans[channel & ~DMACH_LOW_LEVEL]; | ||
38 | else | ||
39 | return s3c_dma_chan_map[channel]; | ||
40 | } | ||
41 | |||
42 | /* do we need to protect the settings of the fields from | ||
43 | * irq? | ||
44 | */ | ||
45 | |||
46 | int s3c2410_dma_set_opfn(unsigned int channel, s3c2410_dma_opfn_t rtn) | ||
47 | { | ||
48 | struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
49 | |||
50 | if (chan == NULL) | ||
51 | return -EINVAL; | ||
52 | |||
53 | pr_debug("%s: chan=%p, op rtn=%p\n", __func__, chan, rtn); | ||
54 | |||
55 | chan->op_fn = rtn; | ||
56 | |||
57 | return 0; | ||
58 | } | ||
59 | EXPORT_SYMBOL(s3c2410_dma_set_opfn); | ||
60 | |||
61 | int s3c2410_dma_set_buffdone_fn(unsigned int channel, s3c2410_dma_cbfn_t rtn) | ||
62 | { | ||
63 | struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
64 | |||
65 | if (chan == NULL) | ||
66 | return -EINVAL; | ||
67 | |||
68 | pr_debug("%s: chan=%p, callback rtn=%p\n", __func__, chan, rtn); | ||
69 | |||
70 | chan->callback_fn = rtn; | ||
71 | |||
72 | return 0; | ||
73 | } | ||
74 | EXPORT_SYMBOL(s3c2410_dma_set_buffdone_fn); | ||
75 | |||
76 | int s3c2410_dma_setflags(unsigned int channel, unsigned int flags) | ||
77 | { | ||
78 | struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
79 | |||
80 | if (chan == NULL) | ||
81 | return -EINVAL; | ||
82 | |||
83 | chan->flags = flags; | ||
84 | return 0; | ||
85 | } | ||
86 | EXPORT_SYMBOL(s3c2410_dma_setflags); | ||
diff --git a/arch/arm/plat-s3c/include/plat/dma-core.h b/arch/arm/plat-s3c/include/plat/dma-core.h new file mode 100644 index 000000000000..32ff2a92cb3c --- /dev/null +++ b/arch/arm/plat-s3c/include/plat/dma-core.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* arch/arm/plat-s3c/include/plat/dma.h | ||
2 | * | ||
3 | * Copyright 2008 Openmoko, Inc. | ||
4 | * Copyright 2008 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * http://armlinux.simtec.co.uk/ | ||
7 | * | ||
8 | * Samsung S3C DMA core support | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | extern struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel); | ||
16 | |||
17 | extern struct s3c2410_dma_chan *s3c_dma_chan_map[]; | ||
18 | |||
19 | /* the currently allocated channel information */ | ||
20 | extern struct s3c2410_dma_chan s3c2410_chans[]; | ||
21 | |||
22 | |||