1 /* linux/arch/arm/mach-exynos4/dma.c
3 * Copyright (c) 2011 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>
30 #include <plat/devs.h>
31 #include <plat/irqs.h>
35 #include <mach/irqs.h>
38 static u8 exynos4210_pdma0_peri
[] = {
71 static u8 exynos4212_pdma0_peri
[] = {
106 static u8 exynos5250_pdma0_peri
[] = {
141 static struct dma_pl330_platdata exynos_pdma0_pdata
;
143 static AMBA_AHB_DEVICE(exynos_pdma0
, "dma-pl330.0", 0x00041330,
144 EXYNOS4_PA_PDMA0
, {EXYNOS4_IRQ_PDMA0
}, &exynos_pdma0_pdata
);
146 static u8 exynos4210_pdma1_peri
[] = {
174 static u8 exynos4212_pdma1_peri
[] = {
200 DMACH_SLIMBUS0AUX_RX
,
201 DMACH_SLIMBUS0AUX_TX
,
207 static u8 exynos5250_pdma1_peri
[] = {
233 DMACH_SLIMBUS0AUX_RX
,
234 DMACH_SLIMBUS0AUX_TX
,
242 static struct dma_pl330_platdata exynos_pdma1_pdata
;
244 static AMBA_AHB_DEVICE(exynos_pdma1
, "dma-pl330.1", 0x00041330,
245 EXYNOS4_PA_PDMA1
, {EXYNOS4_IRQ_PDMA1
}, &exynos_pdma1_pdata
);
247 static u8 mdma_peri
[] = {
258 static struct dma_pl330_platdata exynos_mdma1_pdata
= {
259 .nr_valid_peri
= ARRAY_SIZE(mdma_peri
),
260 .peri_id
= mdma_peri
,
263 static AMBA_AHB_DEVICE(exynos_mdma1
, "dma-pl330.2", 0x00041330,
264 EXYNOS4_PA_MDMA1
, {EXYNOS4_IRQ_MDMA1
}, &exynos_mdma1_pdata
);
266 static int __init
exynos_dma_init(void)
268 if (of_have_populated_dt())
271 if (soc_is_exynos4210()) {
272 exynos_pdma0_pdata
.nr_valid_peri
=
273 ARRAY_SIZE(exynos4210_pdma0_peri
);
274 exynos_pdma0_pdata
.peri_id
= exynos4210_pdma0_peri
;
275 exynos_pdma1_pdata
.nr_valid_peri
=
276 ARRAY_SIZE(exynos4210_pdma1_peri
);
277 exynos_pdma1_pdata
.peri_id
= exynos4210_pdma1_peri
;
278 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
279 exynos_pdma0_pdata
.nr_valid_peri
=
280 ARRAY_SIZE(exynos4212_pdma0_peri
);
281 exynos_pdma0_pdata
.peri_id
= exynos4212_pdma0_peri
;
282 exynos_pdma1_pdata
.nr_valid_peri
=
283 ARRAY_SIZE(exynos4212_pdma1_peri
);
284 exynos_pdma1_pdata
.peri_id
= exynos4212_pdma1_peri
;
285 } else if (soc_is_exynos5250()) {
286 exynos_pdma0_pdata
.nr_valid_peri
=
287 ARRAY_SIZE(exynos5250_pdma0_peri
);
288 exynos_pdma0_pdata
.peri_id
= exynos5250_pdma0_peri
;
289 exynos_pdma1_pdata
.nr_valid_peri
=
290 ARRAY_SIZE(exynos5250_pdma1_peri
);
291 exynos_pdma1_pdata
.peri_id
= exynos5250_pdma1_peri
;
293 exynos_pdma0_device
.res
.start
= EXYNOS5_PA_PDMA0
;
294 exynos_pdma0_device
.res
.end
= EXYNOS5_PA_PDMA0
+ SZ_4K
;
295 exynos_pdma0_device
.irq
[0] = EXYNOS5_IRQ_PDMA0
;
296 exynos_pdma1_device
.res
.start
= EXYNOS5_PA_PDMA1
;
297 exynos_pdma1_device
.res
.end
= EXYNOS5_PA_PDMA1
+ SZ_4K
;
298 exynos_pdma0_device
.irq
[0] = EXYNOS5_IRQ_PDMA1
;
299 exynos_mdma1_device
.res
.start
= EXYNOS5_PA_MDMA1
;
300 exynos_mdma1_device
.res
.end
= EXYNOS5_PA_MDMA1
+ SZ_4K
;
301 exynos_pdma0_device
.irq
[0] = EXYNOS5_IRQ_MDMA1
;
304 dma_cap_set(DMA_SLAVE
, exynos_pdma0_pdata
.cap_mask
);
305 dma_cap_set(DMA_CYCLIC
, exynos_pdma0_pdata
.cap_mask
);
306 dma_cap_set(DMA_PRIVATE
, exynos_pdma0_pdata
.cap_mask
);
307 amba_device_register(&exynos_pdma0_device
, &iomem_resource
);
309 dma_cap_set(DMA_SLAVE
, exynos_pdma1_pdata
.cap_mask
);
310 dma_cap_set(DMA_CYCLIC
, exynos_pdma1_pdata
.cap_mask
);
311 dma_cap_set(DMA_PRIVATE
, exynos_pdma1_pdata
.cap_mask
);
312 amba_device_register(&exynos_pdma1_device
, &iomem_resource
);
314 dma_cap_set(DMA_MEMCPY
, exynos_mdma1_pdata
.cap_mask
);
315 amba_device_register(&exynos_mdma1_device
, &iomem_resource
);
319 arch_initcall(exynos_dma_init
);