blob: c9cd51439126ad2a122d1f46988a7d1536e77c21 [file] [log] [blame]
Ben Dooksa21765a2007-02-11 18:31:01 +01001/* linux/arch/arm/mach-s3c2412/dma.c
Ben Dooks34348012006-09-18 23:52:03 +01002 *
Ben Dooksc16f7bd2006-12-17 20:05:21 +01003 * Copyright (c) 2006 Simtec Electronics
Ben Dooks34348012006-09-18 23:52:03 +01004 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2412 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/sysdev.h>
Ben Dooksb6d1f542006-12-17 23:22:26 +010018#include <linux/serial_core.h>
Ben Dooks34348012006-09-18 23:52:03 +010019
20#include <asm/dma.h>
21#include <asm/arch/dma.h>
22#include <asm/io.h>
23
Ben Dooksa21765a2007-02-11 18:31:01 +010024#include <asm/plat-s3c24xx/dma.h>
25#include <asm/plat-s3c24xx/cpu.h>
Ben Dooks34348012006-09-18 23:52:03 +010026
Ben Dooks531b6172007-07-22 16:05:25 +010027#include <asm/plat-s3c/regs-serial.h>
Ben Dooks34348012006-09-18 23:52:03 +010028#include <asm/arch/regs-gpio.h>
Ben Dooks06cfa552007-07-22 16:23:02 +010029#include <asm/plat-s3c/regs-ac97.h>
Ben Dooks34348012006-09-18 23:52:03 +010030#include <asm/arch/regs-mem.h>
31#include <asm/arch/regs-lcd.h>
32#include <asm/arch/regs-sdi.h>
Ben Dooksd45c30c2007-12-23 03:09:40 +010033#include <asm/plat-s3c24xx/regs-s3c2412-iis.h>
Ben Dooks06cfa552007-07-22 16:23:02 +010034#include <asm/plat-s3c24xx/regs-iis.h>
35#include <asm/plat-s3c24xx/regs-spi.h>
Ben Dooks34348012006-09-18 23:52:03 +010036
37#define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID }
38
39static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = {
40 [DMACH_XD0] = {
41 .name = "xdreq0",
42 .channels = MAP(S3C2412_DMAREQSEL_XDREQ0),
43 },
44 [DMACH_XD1] = {
45 .name = "xdreq1",
46 .channels = MAP(S3C2412_DMAREQSEL_XDREQ1),
47 },
48 [DMACH_SDI] = {
49 .name = "sdi",
50 .channels = MAP(S3C2412_DMAREQSEL_SDI),
Ben Dooksd45c30c2007-12-23 03:09:40 +010051 .hw_addr.to = S3C2410_PA_SDI + S3C2410_SDIDATA,
52 .hw_addr.from = S3C2410_PA_SDI + S3C2410_SDIDATA,
Ben Dooks34348012006-09-18 23:52:03 +010053 },
54 [DMACH_SPI0] = {
55 .name = "spi0",
56 .channels = MAP(S3C2412_DMAREQSEL_SPI0TX),
57 .hw_addr.to = S3C2410_PA_SPI + S3C2410_SPTDAT,
58 .hw_addr.from = S3C2410_PA_SPI + S3C2410_SPRDAT,
59 },
60 [DMACH_SPI1] = {
61 .name = "spi1",
62 .channels = MAP(S3C2412_DMAREQSEL_SPI1TX),
Sandeep Sanjay Patile9033822007-05-16 10:51:45 +010063 .hw_addr.to = S3C2410_PA_SPI + S3C2412_SPI1 + S3C2410_SPTDAT,
64 .hw_addr.from = S3C2410_PA_SPI + S3C2412_SPI1 + S3C2410_SPRDAT,
Ben Dooks34348012006-09-18 23:52:03 +010065 },
66 [DMACH_UART0] = {
67 .name = "uart0",
68 .channels = MAP(S3C2412_DMAREQSEL_UART0_0),
69 .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH,
70 .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH,
71 },
72 [DMACH_UART1] = {
73 .name = "uart1",
74 .channels = MAP(S3C2412_DMAREQSEL_UART1_0),
75 .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH,
76 .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH,
77 },
78 [DMACH_UART2] = {
79 .name = "uart2",
80 .channels = MAP(S3C2412_DMAREQSEL_UART2_0),
81 .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH,
82 .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH,
83 },
84 [DMACH_UART0_SRC2] = {
85 .name = "uart0",
86 .channels = MAP(S3C2412_DMAREQSEL_UART0_1),
87 .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH,
88 .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH,
89 },
90 [DMACH_UART1_SRC2] = {
91 .name = "uart1",
92 .channels = MAP(S3C2412_DMAREQSEL_UART1_1),
93 .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH,
94 .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH,
95 },
96 [DMACH_UART2_SRC2] = {
97 .name = "uart2",
98 .channels = MAP(S3C2412_DMAREQSEL_UART2_1),
99 .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH,
100 .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH,
101 },
102 [DMACH_TIMER] = {
103 .name = "timer",
104 .channels = MAP(S3C2412_DMAREQSEL_TIMER),
105 },
106 [DMACH_I2S_IN] = {
107 .name = "i2s-sdi",
108 .channels = MAP(S3C2412_DMAREQSEL_I2SRX),
Ben Dooksd45c30c2007-12-23 03:09:40 +0100109 .hw_addr.from = S3C2410_PA_IIS + S3C2412_IISRXD,
Ben Dooks34348012006-09-18 23:52:03 +0100110 },
111 [DMACH_I2S_OUT] = {
112 .name = "i2s-sdo",
113 .channels = MAP(S3C2412_DMAREQSEL_I2STX),
Ben Dooksd45c30c2007-12-23 03:09:40 +0100114 .hw_addr.to = S3C2410_PA_IIS + S3C2412_IISTXD,
Ben Dooks34348012006-09-18 23:52:03 +0100115 },
116 [DMACH_USB_EP1] = {
117 .name = "usb-ep1",
118 .channels = MAP(S3C2412_DMAREQSEL_USBEP1),
119 },
120 [DMACH_USB_EP2] = {
121 .name = "usb-ep2",
122 .channels = MAP(S3C2412_DMAREQSEL_USBEP2),
123 },
124 [DMACH_USB_EP3] = {
125 .name = "usb-ep3",
126 .channels = MAP(S3C2412_DMAREQSEL_USBEP3),
127 },
128 [DMACH_USB_EP4] = {
129 .name = "usb-ep4",
130 .channels = MAP(S3C2412_DMAREQSEL_USBEP4),
131 },
132};
133
134static void s3c2412_dma_select(struct s3c2410_dma_chan *chan,
135 struct s3c24xx_dma_map *map)
136{
Ben Dooksb9d19022007-01-29 00:11:29 +0100137 writel(map->channels[0] | S3C2412_DMAREQSEL_HW,
138 chan->regs + S3C2412_DMA_DMAREQSEL);
Ben Dooks34348012006-09-18 23:52:03 +0100139}
140
141static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = {
142 .select = s3c2412_dma_select,
143 .dcon_mask = 0,
144 .map = s3c2412_dma_mappings,
145 .map_size = ARRAY_SIZE(s3c2412_dma_mappings),
146};
147
Krzysztof Heltf2c10d62007-09-04 17:19:33 +0100148static int __init s3c2412_dma_add(struct sys_device *sysdev)
Ben Dooks34348012006-09-18 23:52:03 +0100149{
Ben Dooks48adbcf2007-02-17 15:37:14 +0100150 s3c2410_dma_init();
Ben Dooks34348012006-09-18 23:52:03 +0100151 return s3c24xx_dma_init_map(&s3c2412_dma_sel);
152}
153
154static struct sysdev_driver s3c2412_dma_driver = {
155 .add = s3c2412_dma_add,
156};
157
158static int __init s3c2412_dma_init(void)
159{
160 return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_dma_driver);
161}
162
163arch_initcall(s3c2412_dma_init);