1 /* linux/arch/arm/mach-s3c2412/dma.c
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * S3C2412 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>
21 #include <asm/arch/dma.h>
24 #include <asm/plat-s3c24xx/dma.h>
25 #include <asm/plat-s3c24xx/cpu.h>
27 #include <asm/arch/regs-serial.h>
28 #include <asm/arch/regs-gpio.h>
29 #include <asm/arch/regs-ac97.h>
30 #include <asm/arch/regs-mem.h>
31 #include <asm/arch/regs-lcd.h>
32 #include <asm/arch/regs-sdi.h>
33 #include <asm/arch/regs-iis.h>
34 #include <asm/arch/regs-spi.h>
36 #define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID }
38 static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = {
41 .channels = MAP(S3C2412_DMAREQSEL_XDREQ0),
45 .channels = MAP(S3C2412_DMAREQSEL_XDREQ1),
49 .channels = MAP(S3C2412_DMAREQSEL_SDI),
50 .hw_addr.to = S3C2410_PA_IIS + S3C2410_IISFIFO,
51 .hw_addr.from = S3C2410_PA_IIS + S3C2410_IISFIFO,
55 .channels = MAP(S3C2412_DMAREQSEL_SPI0TX),
56 .hw_addr.to = S3C2410_PA_SPI + S3C2410_SPTDAT,
57 .hw_addr.from = S3C2410_PA_SPI + S3C2410_SPRDAT,
61 .channels = MAP(S3C2412_DMAREQSEL_SPI1TX),
62 .hw_addr.to = S3C2410_PA_SPI + S3C2412_SPI1 + S3C2410_SPTDAT,
63 .hw_addr.from = S3C2410_PA_SPI + S3C2412_SPI1 + S3C2410_SPRDAT,
67 .channels = MAP(S3C2412_DMAREQSEL_UART0_0),
68 .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH,
69 .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH,
73 .channels = MAP(S3C2412_DMAREQSEL_UART1_0),
74 .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH,
75 .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH,
79 .channels = MAP(S3C2412_DMAREQSEL_UART2_0),
80 .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH,
81 .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH,
83 [DMACH_UART0_SRC2] = {
85 .channels = MAP(S3C2412_DMAREQSEL_UART0_1),
86 .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH,
87 .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH,
89 [DMACH_UART1_SRC2] = {
91 .channels = MAP(S3C2412_DMAREQSEL_UART1_1),
92 .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH,
93 .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH,
95 [DMACH_UART2_SRC2] = {
97 .channels = MAP(S3C2412_DMAREQSEL_UART2_1),
98 .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH,
99 .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH,
103 .channels = MAP(S3C2412_DMAREQSEL_TIMER),
107 .channels = MAP(S3C2412_DMAREQSEL_I2SRX),
108 .hw_addr.from = S3C2410_PA_IIS + S3C2410_IISFIFO,
112 .channels = MAP(S3C2412_DMAREQSEL_I2STX),
113 .hw_addr.to = S3C2410_PA_IIS + S3C2410_IISFIFO,
117 .channels = MAP(S3C2412_DMAREQSEL_USBEP1),
121 .channels = MAP(S3C2412_DMAREQSEL_USBEP2),
125 .channels = MAP(S3C2412_DMAREQSEL_USBEP3),
129 .channels = MAP(S3C2412_DMAREQSEL_USBEP4),
133 static void s3c2412_dma_select(struct s3c2410_dma_chan *chan,
134 struct s3c24xx_dma_map *map)
136 writel(map->channels[0] | S3C2412_DMAREQSEL_HW,
137 chan->regs + S3C2412_DMA_DMAREQSEL);
140 static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = {
141 .select = s3c2412_dma_select,
143 .map = s3c2412_dma_mappings,
144 .map_size = ARRAY_SIZE(s3c2412_dma_mappings),
147 static int s3c2412_dma_add(struct sys_device *sysdev)
150 return s3c24xx_dma_init_map(&s3c2412_dma_sel);
153 static struct sysdev_driver s3c2412_dma_driver = {
154 .add = s3c2412_dma_add,
157 static int __init s3c2412_dma_init(void)
159 return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_dma_driver);
162 arch_initcall(s3c2412_dma_init);