1 /* linux/arch/arm/mach-s3c2443/dma.c
3 * Copyright (c) 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * S3C2443 DMA selection
8 * http://armlinux.simtec.co.uk/
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.
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/device.h>
18 #include <linux/serial_core.h>
23 #include <plat/dma-s3c24xx.h>
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-lcd.h>
31 #include <plat/regs-iis.h>
32 #include <plat/regs-spi.h>
35 [0] = (x) | DMA_CH_VALID, \
36 [1] = (x) | DMA_CH_VALID, \
37 [2] = (x) | DMA_CH_VALID, \
38 [3] = (x) | DMA_CH_VALID, \
39 [4] = (x) | DMA_CH_VALID, \
40 [5] = (x) | DMA_CH_VALID, \
43 static struct s3c24xx_dma_map __initdata s3c2443_dma_mappings[] = {
46 .channels = MAP(S3C2443_DMAREQSEL_XDREQ0),
50 .channels = MAP(S3C2443_DMAREQSEL_XDREQ1),
52 [DMACH_SDI] = { /* only on S3C2443 */
54 .channels = MAP(S3C2443_DMAREQSEL_SDI),
58 .channels = MAP(S3C2443_DMAREQSEL_SPI0RX),
62 .channels = MAP(S3C2443_DMAREQSEL_SPI0TX),
64 [DMACH_SPI1_RX] = { /* only on S3C2443/S3C2450 */
66 .channels = MAP(S3C2443_DMAREQSEL_SPI1RX),
68 [DMACH_SPI1_TX] = { /* only on S3C2443/S3C2450 */
70 .channels = MAP(S3C2443_DMAREQSEL_SPI1TX),
74 .channels = MAP(S3C2443_DMAREQSEL_UART0_0),
78 .channels = MAP(S3C2443_DMAREQSEL_UART1_0),
82 .channels = MAP(S3C2443_DMAREQSEL_UART2_0),
86 .channels = MAP(S3C2443_DMAREQSEL_UART3_0),
88 [DMACH_UART0_SRC2] = {
90 .channels = MAP(S3C2443_DMAREQSEL_UART0_1),
92 [DMACH_UART1_SRC2] = {
94 .channels = MAP(S3C2443_DMAREQSEL_UART1_1),
96 [DMACH_UART2_SRC2] = {
98 .channels = MAP(S3C2443_DMAREQSEL_UART2_1),
100 [DMACH_UART3_SRC2] = {
102 .channels = MAP(S3C2443_DMAREQSEL_UART3_1),
106 .channels = MAP(S3C2443_DMAREQSEL_TIMER),
110 .channels = MAP(S3C2443_DMAREQSEL_I2SRX),
114 .channels = MAP(S3C2443_DMAREQSEL_I2STX),
118 .channels = MAP(S3C2443_DMAREQSEL_PCMIN),
122 .channels = MAP(S3C2443_DMAREQSEL_PCMOUT),
126 .channels = MAP(S3C2443_DMAREQSEL_MICIN),
130 static void s3c2443_dma_select(struct s3c2410_dma_chan *chan,
131 struct s3c24xx_dma_map *map)
133 writel(map->channels[0] | S3C2443_DMAREQSEL_HW,
134 chan->regs + S3C2443_DMA_DMAREQSEL);
137 static struct s3c24xx_dma_selection __initdata s3c2443_dma_sel = {
138 .select = s3c2443_dma_select,
140 .map = s3c2443_dma_mappings,
141 .map_size = ARRAY_SIZE(s3c2443_dma_mappings),
144 static int __init s3c2443_dma_add(struct device *dev,
145 struct subsys_interface *sif)
147 s3c24xx_dma_init(6, IRQ_S3C2443_DMA0, 0x100);
148 return s3c24xx_dma_init_map(&s3c2443_dma_sel);
151 #ifdef CONFIG_CPU_S3C2416
152 /* S3C2416 DMA contains the same selection table as the S3C2443 */
153 static struct subsys_interface s3c2416_dma_interface = {
154 .name = "s3c2416_dma",
155 .subsys = &s3c2416_subsys,
156 .add_dev = s3c2443_dma_add,
159 static int __init s3c2416_dma_init(void)
161 return subsys_interface_register(&s3c2416_dma_interface);
164 arch_initcall(s3c2416_dma_init);
167 #ifdef CONFIG_CPU_S3C2443
168 static struct subsys_interface s3c2443_dma_interface = {
169 .name = "s3c2443_dma",
170 .subsys = &s3c2443_subsys,
171 .add_dev = s3c2443_dma_add,
174 static int __init s3c2443_dma_init(void)
176 return subsys_interface_register(&s3c2443_dma_interface);
179 arch_initcall(s3c2443_dma_init);