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/sysdev.h>
18 #include <linux/serial_core.h>
26 #include <plat/regs-serial.h>
27 #include <mach/regs-gpio.h>
28 #include <plat/regs-ac97.h>
29 #include <mach/regs-mem.h>
30 #include <mach/regs-lcd.h>
31 #include <mach/regs-sdi.h>
32 #include <asm/plat-s3c24xx/regs-iis.h>
33 #include <plat/regs-spi.h>
36 [0] = (x) | DMA_CH_VALID, \
37 [1] = (x) | DMA_CH_VALID, \
38 [2] = (x) | DMA_CH_VALID, \
39 [3] = (x) | DMA_CH_VALID, \
40 [4] = (x) | DMA_CH_VALID, \
41 [5] = (x) | DMA_CH_VALID, \
44 static struct s3c24xx_dma_map __initdata s3c2443_dma_mappings[] = {
47 .channels = MAP(S3C2443_DMAREQSEL_XDREQ0),
51 .channels = MAP(S3C2443_DMAREQSEL_XDREQ1),
55 .channels = MAP(S3C2443_DMAREQSEL_SDI),
56 .hw_addr.to = S3C2410_PA_IIS + S3C2410_IISFIFO,
57 .hw_addr.from = S3C2410_PA_IIS + S3C2410_IISFIFO,
61 .channels = MAP(S3C2443_DMAREQSEL_SPI0TX),
62 .hw_addr.to = S3C2410_PA_SPI + S3C2410_SPTDAT,
63 .hw_addr.from = S3C2410_PA_SPI + S3C2410_SPRDAT,
67 .channels = MAP(S3C2443_DMAREQSEL_SPI1TX),
68 .hw_addr.to = S3C2410_PA_SPI + 0x20 + S3C2410_SPTDAT,
69 .hw_addr.from = S3C2410_PA_SPI + 0x20 + S3C2410_SPRDAT,
73 .channels = MAP(S3C2443_DMAREQSEL_UART0_0),
74 .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH,
75 .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH,
79 .channels = MAP(S3C2443_DMAREQSEL_UART1_0),
80 .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH,
81 .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH,
85 .channels = MAP(S3C2443_DMAREQSEL_UART2_0),
86 .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH,
87 .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH,
91 .channels = MAP(S3C2443_DMAREQSEL_UART3_0),
92 .hw_addr.to = S3C2443_PA_UART3 + S3C2410_UTXH,
93 .hw_addr.from = S3C2443_PA_UART3 + S3C2410_URXH,
95 [DMACH_UART0_SRC2] = {
97 .channels = MAP(S3C2443_DMAREQSEL_UART0_1),
98 .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH,
99 .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH,
101 [DMACH_UART1_SRC2] = {
103 .channels = MAP(S3C2443_DMAREQSEL_UART1_1),
104 .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH,
105 .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH,
107 [DMACH_UART2_SRC2] = {
109 .channels = MAP(S3C2443_DMAREQSEL_UART2_1),
110 .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH,
111 .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH,
113 [DMACH_UART3_SRC2] = {
115 .channels = MAP(S3C2443_DMAREQSEL_UART3_1),
116 .hw_addr.to = S3C2443_PA_UART3 + S3C2410_UTXH,
117 .hw_addr.from = S3C2443_PA_UART3 + S3C2410_URXH,
121 .channels = MAP(S3C2443_DMAREQSEL_TIMER),
125 .channels = MAP(S3C2443_DMAREQSEL_I2SRX),
126 .hw_addr.from = S3C2410_PA_IIS + S3C2410_IISFIFO,
130 .channels = MAP(S3C2443_DMAREQSEL_I2STX),
131 .hw_addr.to = S3C2410_PA_IIS + S3C2410_IISFIFO,
135 .channels = MAP(S3C2443_DMAREQSEL_PCMIN),
136 .hw_addr.from = S3C2440_PA_AC97 + S3C_AC97_PCM_DATA,
140 .channels = MAP(S3C2443_DMAREQSEL_PCMOUT),
141 .hw_addr.to = S3C2440_PA_AC97 + S3C_AC97_PCM_DATA,
145 .channels = MAP(S3C2443_DMAREQSEL_MICIN),
146 .hw_addr.from = S3C2440_PA_AC97 + S3C_AC97_MIC_DATA,
150 static void s3c2443_dma_select(struct s3c2410_dma_chan *chan,
151 struct s3c24xx_dma_map *map)
153 writel(map->channels[0] | S3C2443_DMAREQSEL_HW,
154 chan->regs + S3C2443_DMA_DMAREQSEL);
157 static struct s3c24xx_dma_selection __initdata s3c2443_dma_sel = {
158 .select = s3c2443_dma_select,
160 .map = s3c2443_dma_mappings,
161 .map_size = ARRAY_SIZE(s3c2443_dma_mappings),
164 static int __init s3c2443_dma_add(struct sys_device *sysdev)
166 s3c24xx_dma_init(6, IRQ_S3C2443_DMA0, 0x100);
167 return s3c24xx_dma_init_map(&s3c2443_dma_sel);
170 static struct sysdev_driver s3c2443_dma_driver = {
171 .add = s3c2443_dma_add,
174 static int __init s3c2443_dma_init(void)
176 return sysdev_driver_register(&s3c2443_sysclass, &s3c2443_dma_driver);
179 arch_initcall(s3c2443_dma_init);