1 /* linux/arch/arm/mach-s5p64x0/dma.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
7 * Jaswinder Singh <jassi.brar@samsung.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <linux/dma-mapping.h>
25 #include <linux/amba/bus.h>
26 #include <linux/amba/pl330.h>
31 #include <mach/irqs.h>
32 #include <mach/regs-clock.h>
36 #include <plat/devs.h>
37 #include <plat/irqs.h>
39 static u64 dma_dmamask = DMA_BIT_MASK(32);
41 struct dma_pl330_peri s5p6440_pdma_peri[22] = {
43 .peri_id = (u8)DMACH_UART0_RX,
46 .peri_id = (u8)DMACH_UART0_TX,
49 .peri_id = (u8)DMACH_UART1_RX,
52 .peri_id = (u8)DMACH_UART1_TX,
55 .peri_id = (u8)DMACH_UART2_RX,
58 .peri_id = (u8)DMACH_UART2_TX,
61 .peri_id = (u8)DMACH_UART3_RX,
64 .peri_id = (u8)DMACH_UART3_TX,
71 .peri_id = (u8)DMACH_PCM0_TX,
74 .peri_id = (u8)DMACH_PCM0_RX,
77 .peri_id = (u8)DMACH_I2S0_TX,
80 .peri_id = (u8)DMACH_I2S0_RX,
83 .peri_id = (u8)DMACH_SPI0_TX,
86 .peri_id = (u8)DMACH_SPI0_RX,
89 .peri_id = (u8)DMACH_MAX,
91 .peri_id = (u8)DMACH_MAX,
93 .peri_id = (u8)DMACH_MAX,
95 .peri_id = (u8)DMACH_MAX,
97 .peri_id = (u8)DMACH_SPI1_TX,
100 .peri_id = (u8)DMACH_SPI1_RX,
105 struct dma_pl330_platdata s5p6440_pdma_pdata = {
106 .nr_valid_peri = ARRAY_SIZE(s5p6440_pdma_peri),
107 .peri = s5p6440_pdma_peri,
110 struct dma_pl330_peri s5p6450_pdma_peri[32] = {
112 .peri_id = (u8)DMACH_UART0_RX,
115 .peri_id = (u8)DMACH_UART0_TX,
118 .peri_id = (u8)DMACH_UART1_RX,
121 .peri_id = (u8)DMACH_UART1_TX,
124 .peri_id = (u8)DMACH_UART2_RX,
127 .peri_id = (u8)DMACH_UART2_TX,
130 .peri_id = (u8)DMACH_UART3_RX,
133 .peri_id = (u8)DMACH_UART3_TX,
136 .peri_id = (u8)DMACH_UART4_RX,
139 .peri_id = (u8)DMACH_UART4_TX,
142 .peri_id = (u8)DMACH_PCM0_TX,
145 .peri_id = (u8)DMACH_PCM0_RX,
148 .peri_id = (u8)DMACH_I2S0_TX,
151 .peri_id = (u8)DMACH_I2S0_RX,
154 .peri_id = (u8)DMACH_SPI0_TX,
157 .peri_id = (u8)DMACH_SPI0_RX,
160 .peri_id = (u8)DMACH_PCM1_TX,
163 .peri_id = (u8)DMACH_PCM1_RX,
166 .peri_id = (u8)DMACH_PCM2_TX,
169 .peri_id = (u8)DMACH_PCM2_RX,
172 .peri_id = (u8)DMACH_SPI1_TX,
175 .peri_id = (u8)DMACH_SPI1_RX,
178 .peri_id = (u8)DMACH_USI_TX,
181 .peri_id = (u8)DMACH_USI_RX,
184 .peri_id = (u8)DMACH_MAX,
186 .peri_id = (u8)DMACH_I2S1_TX,
189 .peri_id = (u8)DMACH_I2S1_RX,
192 .peri_id = (u8)DMACH_I2S2_TX,
195 .peri_id = (u8)DMACH_I2S2_RX,
198 .peri_id = (u8)DMACH_PWM,
200 .peri_id = (u8)DMACH_UART5_RX,
203 .peri_id = (u8)DMACH_UART5_TX,
208 struct dma_pl330_platdata s5p6450_pdma_pdata = {
209 .nr_valid_peri = ARRAY_SIZE(s5p6450_pdma_peri),
210 .peri = s5p6450_pdma_peri,
213 struct amba_device s5p64x0_device_pdma = {
215 .init_name = "dma-pl330",
216 .dma_mask = &dma_dmamask,
217 .coherent_dma_mask = DMA_BIT_MASK(32),
220 .start = S5P64X0_PA_PDMA,
221 .end = S5P64X0_PA_PDMA + SZ_4K,
222 .flags = IORESOURCE_MEM,
224 .irq = {IRQ_DMA0, NO_IRQ},
225 .periphid = 0x00041330,
228 static int __init s5p64x0_dma_init(void)
230 if (soc_is_s5p6450())
231 s5p64x0_device_pdma.dev.platform_data = &s5p6450_pdma_pdata;
233 s5p64x0_device_pdma.dev.platform_data = &s5p6440_pdma_pdata;
235 amba_device_register(&s5p64x0_device_pdma, &iomem_resource);
239 arch_initcall(s5p64x0_dma_init);