blob: 9c4ce085f5857a3e31e73f31059e29c38998a180 [file] [log] [blame]
Kukjin Kimf1fee582010-09-08 19:25:44 +09001/* linux/arch/arm/mach-s5p64x0/dma.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
7 * Jaswinder Singh <jassi.brar@samsung.com>
8 *
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.
13 *
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.
18 *
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.
22*/
23
Kukjin Kimf1fee582010-09-08 19:25:44 +090024#include <linux/dma-mapping.h>
Boojin Kim3091e612011-09-02 09:44:39 +090025#include <linux/amba/bus.h>
26#include <linux/amba/pl330.h>
27
28#include <asm/irq.h>
Kukjin Kimf1fee582010-09-08 19:25:44 +090029
30#include <mach/map.h>
31#include <mach/irqs.h>
32#include <mach/regs-clock.h>
Boojin Kim3091e612011-09-02 09:44:39 +090033#include <mach/dma.h>
Kukjin Kimf1fee582010-09-08 19:25:44 +090034
Kukjin Kima3d93582011-08-20 02:30:08 +090035#include <plat/cpu.h>
Kukjin Kimf1fee582010-09-08 19:25:44 +090036#include <plat/devs.h>
Boojin Kim3091e612011-09-02 09:44:39 +090037#include <plat/irqs.h>
Kukjin Kimf1fee582010-09-08 19:25:44 +090038
Kukjin Kim15545022012-01-21 11:29:30 +090039static u8 s5p6440_pdma_peri[] = {
Thomas Abrahamdc732f502011-10-24 11:45:01 +020040 DMACH_UART0_RX,
41 DMACH_UART0_TX,
42 DMACH_UART1_RX,
43 DMACH_UART1_TX,
44 DMACH_UART2_RX,
45 DMACH_UART2_TX,
46 DMACH_UART3_RX,
47 DMACH_UART3_TX,
48 DMACH_MAX,
49 DMACH_MAX,
50 DMACH_PCM0_TX,
51 DMACH_PCM0_RX,
52 DMACH_I2S0_TX,
53 DMACH_I2S0_RX,
54 DMACH_SPI0_TX,
55 DMACH_SPI0_RX,
56 DMACH_MAX,
57 DMACH_MAX,
58 DMACH_MAX,
59 DMACH_MAX,
60 DMACH_SPI1_TX,
61 DMACH_SPI1_RX,
Kukjin Kimf1fee582010-09-08 19:25:44 +090062};
63
Kukjin Kim15545022012-01-21 11:29:30 +090064static struct dma_pl330_platdata s5p6440_pdma_pdata = {
Boojin Kim3091e612011-09-02 09:44:39 +090065 .nr_valid_peri = ARRAY_SIZE(s5p6440_pdma_peri),
Thomas Abrahamdc732f502011-10-24 11:45:01 +020066 .peri_id = s5p6440_pdma_peri,
Boojin Kim3091e612011-09-02 09:44:39 +090067};
68
Kukjin Kim15545022012-01-21 11:29:30 +090069static u8 s5p6450_pdma_peri[] = {
Thomas Abrahamdc732f502011-10-24 11:45:01 +020070 DMACH_UART0_RX,
71 DMACH_UART0_TX,
72 DMACH_UART1_RX,
73 DMACH_UART1_TX,
74 DMACH_UART2_RX,
75 DMACH_UART2_TX,
76 DMACH_UART3_RX,
77 DMACH_UART3_TX,
78 DMACH_UART4_RX,
79 DMACH_UART4_TX,
80 DMACH_PCM0_TX,
81 DMACH_PCM0_RX,
82 DMACH_I2S0_TX,
83 DMACH_I2S0_RX,
84 DMACH_SPI0_TX,
85 DMACH_SPI0_RX,
86 DMACH_PCM1_TX,
87 DMACH_PCM1_RX,
88 DMACH_PCM2_TX,
89 DMACH_PCM2_RX,
90 DMACH_SPI1_TX,
91 DMACH_SPI1_RX,
92 DMACH_USI_TX,
93 DMACH_USI_RX,
94 DMACH_MAX,
95 DMACH_I2S1_TX,
96 DMACH_I2S1_RX,
97 DMACH_I2S2_TX,
98 DMACH_I2S2_RX,
99 DMACH_PWM,
100 DMACH_UART5_RX,
101 DMACH_UART5_TX,
Kukjin Kimf1fee582010-09-08 19:25:44 +0900102};
103
Kukjin Kim15545022012-01-21 11:29:30 +0900104static struct dma_pl330_platdata s5p6450_pdma_pdata = {
Boojin Kim3091e612011-09-02 09:44:39 +0900105 .nr_valid_peri = ARRAY_SIZE(s5p6450_pdma_peri),
Thomas Abrahamdc732f502011-10-24 11:45:01 +0200106 .peri_id = s5p6450_pdma_peri,
Kukjin Kimf1fee582010-09-08 19:25:44 +0900107};
108
Kukjin Kim60571f92012-03-07 03:34:41 -0800109static AMBA_AHB_DEVICE(s5p64x0_pdma, "dma-pl330", 0x00041330,
110 S5P64X0_PA_PDMA, {IRQ_DMA0}, NULL);
Kukjin Kimf1fee582010-09-08 19:25:44 +0900111
112static int __init s5p64x0_dma_init(void)
113{
Thomas Abrahamdc732f502011-10-24 11:45:01 +0200114 if (soc_is_s5p6450()) {
115 dma_cap_set(DMA_SLAVE, s5p6450_pdma_pdata.cap_mask);
116 dma_cap_set(DMA_CYCLIC, s5p6450_pdma_pdata.cap_mask);
Russell King75c06962012-01-20 09:14:40 +0000117 s5p64x0_pdma_device.dev.platform_data = &s5p6450_pdma_pdata;
Thomas Abrahamdc732f502011-10-24 11:45:01 +0200118 } else {
119 dma_cap_set(DMA_SLAVE, s5p6440_pdma_pdata.cap_mask);
120 dma_cap_set(DMA_CYCLIC, s5p6440_pdma_pdata.cap_mask);
Russell King75c06962012-01-20 09:14:40 +0000121 s5p64x0_pdma_device.dev.platform_data = &s5p6440_pdma_pdata;
Thomas Abrahamdc732f502011-10-24 11:45:01 +0200122 }
Kukjin Kimf1fee582010-09-08 19:25:44 +0900123
Russell King75c06962012-01-20 09:14:40 +0000124 amba_device_register(&s5p64x0_pdma_device, &iomem_resource);
Kukjin Kimf1fee582010-09-08 19:25:44 +0900125
126 return 0;
127}
128arch_initcall(s5p64x0_dma_init);