Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dma-s3c2443.c
Go to the documentation of this file.
1 /* linux/arch/arm/mach-s3c2443/dma.c
2  *
3  * Copyright (c) 2007 Simtec Electronics
4  * Ben Dooks <[email protected]>
5  *
6  * S3C2443 DMA selection
7  *
8  * http://armlinux.simtec.co.uk/
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 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/device.h>
18 #include <linux/serial_core.h>
19 #include <linux/io.h>
20 
21 #include <mach/dma.h>
22 
23 #include <plat/dma-s3c24xx.h>
24 #include <plat/cpu.h>
25 
26 #include <plat/regs-serial.h>
27 #include <mach/regs-gpio.h>
28 #include <plat/regs-ac97.h>
29 #include <plat/regs-dma.h>
30 #include <mach/regs-mem.h>
31 #include <mach/regs-lcd.h>
32 #include <mach/regs-sdi.h>
33 #include <plat/regs-iis.h>
34 #include <plat/regs-spi.h>
35 
36 #define MAP(x) { \
37  [0] = (x) | DMA_CH_VALID, \
38  [1] = (x) | DMA_CH_VALID, \
39  [2] = (x) | DMA_CH_VALID, \
40  [3] = (x) | DMA_CH_VALID, \
41  [4] = (x) | DMA_CH_VALID, \
42  [5] = (x) | DMA_CH_VALID, \
43  }
44 
45 static struct s3c24xx_dma_map __initdata s3c2443_dma_mappings[] = {
46  [DMACH_XD0] = {
47  .name = "xdreq0",
48  .channels = MAP(S3C2443_DMAREQSEL_XDREQ0),
49  },
50  [DMACH_XD1] = {
51  .name = "xdreq1",
52  .channels = MAP(S3C2443_DMAREQSEL_XDREQ1),
53  },
54  [DMACH_SDI] = { /* only on S3C2443 */
55  .name = "sdi",
56  .channels = MAP(S3C2443_DMAREQSEL_SDI),
57  },
58  [DMACH_SPI0_RX] = {
59  .name = "spi0-rx",
60  .channels = MAP(S3C2443_DMAREQSEL_SPI0RX),
61  },
62  [DMACH_SPI0_TX] = {
63  .name = "spi0-tx",
64  .channels = MAP(S3C2443_DMAREQSEL_SPI0TX),
65  },
66  [DMACH_SPI1_RX] = { /* only on S3C2443/S3C2450 */
67  .name = "spi1-rx",
68  .channels = MAP(S3C2443_DMAREQSEL_SPI1RX),
69  },
70  [DMACH_SPI1_TX] = { /* only on S3C2443/S3C2450 */
71  .name = "spi1-tx",
72  .channels = MAP(S3C2443_DMAREQSEL_SPI1TX),
73  },
74  [DMACH_UART0] = {
75  .name = "uart0",
76  .channels = MAP(S3C2443_DMAREQSEL_UART0_0),
77  },
78  [DMACH_UART1] = {
79  .name = "uart1",
80  .channels = MAP(S3C2443_DMAREQSEL_UART1_0),
81  },
82  [DMACH_UART2] = {
83  .name = "uart2",
84  .channels = MAP(S3C2443_DMAREQSEL_UART2_0),
85  },
86  [DMACH_UART3] = {
87  .name = "uart3",
88  .channels = MAP(S3C2443_DMAREQSEL_UART3_0),
89  },
90  [DMACH_UART0_SRC2] = {
91  .name = "uart0",
92  .channels = MAP(S3C2443_DMAREQSEL_UART0_1),
93  },
94  [DMACH_UART1_SRC2] = {
95  .name = "uart1",
96  .channels = MAP(S3C2443_DMAREQSEL_UART1_1),
97  },
98  [DMACH_UART2_SRC2] = {
99  .name = "uart2",
100  .channels = MAP(S3C2443_DMAREQSEL_UART2_1),
101  },
102  [DMACH_UART3_SRC2] = {
103  .name = "uart3",
104  .channels = MAP(S3C2443_DMAREQSEL_UART3_1),
105  },
106  [DMACH_TIMER] = {
107  .name = "timer",
108  .channels = MAP(S3C2443_DMAREQSEL_TIMER),
109  },
110  [DMACH_I2S_IN] = {
111  .name = "i2s-sdi",
112  .channels = MAP(S3C2443_DMAREQSEL_I2SRX),
113  },
114  [DMACH_I2S_OUT] = {
115  .name = "i2s-sdo",
116  .channels = MAP(S3C2443_DMAREQSEL_I2STX),
117  },
118  [DMACH_PCM_IN] = {
119  .name = "pcm-in",
120  .channels = MAP(S3C2443_DMAREQSEL_PCMIN),
121  },
122  [DMACH_PCM_OUT] = {
123  .name = "pcm-out",
124  .channels = MAP(S3C2443_DMAREQSEL_PCMOUT),
125  },
126  [DMACH_MIC_IN] = {
127  .name = "mic-in",
128  .channels = MAP(S3C2443_DMAREQSEL_MICIN),
129  },
130 };
131 
132 static void s3c2443_dma_select(struct s3c2410_dma_chan *chan,
133  struct s3c24xx_dma_map *map)
134 {
135  writel(map->channels[0] | S3C2443_DMAREQSEL_HW,
136  chan->regs + S3C2443_DMA_DMAREQSEL);
137 }
138 
139 static struct s3c24xx_dma_selection __initdata s3c2443_dma_sel = {
140  .select = s3c2443_dma_select,
141  .dcon_mask = 0,
142  .map = s3c2443_dma_mappings,
143  .map_size = ARRAY_SIZE(s3c2443_dma_mappings),
144 };
145 
146 static int __init s3c2443_dma_add(struct device *dev,
147  struct subsys_interface *sif)
148 {
150  return s3c24xx_dma_init_map(&s3c2443_dma_sel);
151 }
152 
153 #ifdef CONFIG_CPU_S3C2416
154 /* S3C2416 DMA contains the same selection table as the S3C2443 */
155 static struct subsys_interface s3c2416_dma_interface = {
156  .name = "s3c2416_dma",
157  .subsys = &s3c2416_subsys,
158  .add_dev = s3c2443_dma_add,
159 };
160 
161 static int __init s3c2416_dma_init(void)
162 {
163  return subsys_interface_register(&s3c2416_dma_interface);
164 }
165 
166 arch_initcall(s3c2416_dma_init);
167 #endif
168 
169 #ifdef CONFIG_CPU_S3C2443
170 static struct subsys_interface s3c2443_dma_interface = {
171  .name = "s3c2443_dma",
172  .subsys = &s3c2443_subsys,
173  .add_dev = s3c2443_dma_add,
174 };
175 
176 static int __init s3c2443_dma_init(void)
177 {
178  return subsys_interface_register(&s3c2443_dma_interface);
179 }
180 
181 arch_initcall(s3c2443_dma_init);
182 #endif