2 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
3 * Jaswinder Singh <jassi.brar@samsung.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <linux/platform_device.h>
21 #include <linux/dma-mapping.h>
23 #include <plat/devs.h>
24 #include <plat/irqs.h>
25 #ifdef CONFIG_S5PV310_DEV_PD
30 #include <mach/irqs.h>
32 #include <plat/s3c-pl330-pdata.h>
34 static u64 dma_dmamask = DMA_BIT_MASK(32);
36 static struct resource s5pv310_mdma_resource[] = {
38 .start = S5PV310_PA_MDMA1,
39 .end = S5PV310_PA_MDMA1 + SZ_4K,
40 .flags = IORESOURCE_MEM,
45 .flags = IORESOURCE_IRQ,
49 struct s3c_pl330_platdata s5pv310_mdma_pdata = {
52 * The DMAC can have max 8 channel so there
53 * can be MAX 8 M<->M requests served at any time.
55 * Always keep the first 8 M->M channels on the
56 * DMAC dedicated for M->M transfers.
94 struct platform_device s5pv310_device_mdma = {
97 .num_resources = ARRAY_SIZE(s5pv310_mdma_resource),
98 .resource = s5pv310_mdma_resource,
100 .dma_mask = &dma_dmamask,
101 .coherent_dma_mask = DMA_BIT_MASK(32),
102 .platform_data = &s5pv310_mdma_pdata,
105 EXPORT_SYMBOL_GPL(s5pv310_device_mdma);
107 static struct resource s5pv310_pdma0_resource[] = {
109 .start = S5PV310_PA_PDMA0,
110 .end = S5PV310_PA_PDMA0 + SZ_4K,
111 .flags = IORESOURCE_MEM,
116 .flags = IORESOURCE_IRQ,
120 static struct s3c_pl330_platdata s5pv310_pdma0_pdata = {
126 [4] = DMACH_MSM_REQ0,
127 [5] = DMACH_MSM_REQ2,
132 [10] = DMACH_I2S0S_TX,
133 [11] = DMACH_I2S0_RX,
134 [12] = DMACH_I2S0_TX,
135 [13] = DMACH_I2S2_RX,
136 [14] = DMACH_I2S2_TX,
137 [15] = DMACH_UART0_RX,
138 [16] = DMACH_UART0_TX,
139 [17] = DMACH_UART2_RX,
140 [18] = DMACH_UART2_TX,
141 [19] = DMACH_UART4_RX,
142 [20] = DMACH_UART4_TX,
143 [21] = DMACH_SLIMBUS0_RX,
144 [22] = DMACH_SLIMBUS0_TX,
145 [23] = DMACH_SLIMBUS2_RX,
146 [24] = DMACH_SLIMBUS2_TX,
147 [25] = DMACH_SLIMBUS4_RX,
148 [26] = DMACH_SLIMBUS4_TX,
149 [27] = DMACH_AC97_MICIN,
150 [28] = DMACH_AC97_PCMIN,
151 [29] = DMACH_AC97_PCMOUT,
158 struct platform_device s5pv310_device_pdma0 = {
161 .num_resources = ARRAY_SIZE(s5pv310_pdma0_resource),
162 .resource = s5pv310_pdma0_resource,
164 .dma_mask = &dma_dmamask,
165 .coherent_dma_mask = DMA_BIT_MASK(32),
166 .platform_data = &s5pv310_pdma0_pdata,
169 EXPORT_SYMBOL_GPL(s5pv310_device_pdma0);
171 static struct resource s5pv310_pdma1_resource[] = {
173 .start = S5PV310_PA_PDMA1,
174 .end = S5PV310_PA_PDMA1 + SZ_4K,
175 .flags = IORESOURCE_MEM,
180 .flags = IORESOURCE_IRQ,
184 static struct s3c_pl330_platdata s5pv310_pdma1_pdata = {
190 [4] = DMACH_MSM_REQ1,
191 [5] = DMACH_MSM_REQ3,
194 [8] = DMACH_I2S0S_TX,
196 [10] = DMACH_I2S0_TX,
197 [11] = DMACH_I2S1_RX,
198 [12] = DMACH_I2S1_TX,
199 [13] = DMACH_UART0_RX,
200 [14] = DMACH_UART0_TX,
201 [15] = DMACH_UART1_RX,
202 [16] = DMACH_UART1_TX,
203 [17] = DMACH_UART3_RX,
204 [18] = DMACH_UART3_TX,
205 [19] = DMACH_SLIMBUS1_RX,
206 [20] = DMACH_SLIMBUS1_TX,
207 [21] = DMACH_SLIMBUS3_RX,
208 [22] = DMACH_SLIMBUS3_TX,
209 [23] = DMACH_SLIMBUS5_RX,
210 [24] = DMACH_SLIMBUS5_TX,
211 [25] = DMACH_SLIMBUS0AUX_RX,
212 [26] = DMACH_SLIMBUS0AUX_TX,
222 struct platform_device s5pv310_device_pdma1 = {
225 .num_resources = ARRAY_SIZE(s5pv310_pdma1_resource),
226 .resource = s5pv310_pdma1_resource,
228 .dma_mask = &dma_dmamask,
229 .coherent_dma_mask = DMA_BIT_MASK(32),
230 .platform_data = &s5pv310_pdma1_pdata,
233 EXPORT_SYMBOL_GPL(s5pv310_device_pdma1);
235 static struct platform_device *s5pv310_dmacs[] __initdata = {
236 &s5pv310_device_mdma,
237 &s5pv310_device_pdma0,
238 &s5pv310_device_pdma1,
241 static int __init s5pv310_dma_init(void)
243 platform_add_devices(s5pv310_dmacs, ARRAY_SIZE(s5pv310_dmacs));
247 arch_initcall(s5pv310_dma_init);