diff options
Diffstat (limited to 'arch/arm/mach-s5pv210/dma.c')
-rw-r--r-- | arch/arm/mach-s5pv210/dma.c | 317 |
1 files changed, 205 insertions, 112 deletions
diff --git a/arch/arm/mach-s5pv210/dma.c b/arch/arm/mach-s5pv210/dma.c index 497d3439a142..86b749c18b77 100644 --- a/arch/arm/mach-s5pv210/dma.c +++ b/arch/arm/mach-s5pv210/dma.c | |||
@@ -1,4 +1,8 @@ | |||
1 | /* | 1 | /* linux/arch/arm/mach-s5pv210/dma.c |
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
2 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | 6 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. |
3 | * Jaswinder Singh <jassi.brar@samsung.com> | 7 | * Jaswinder Singh <jassi.brar@samsung.com> |
4 | * | 8 | * |
@@ -17,151 +21,240 @@ | |||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 | */ | 22 | */ |
19 | 23 | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/dma-mapping.h> | 24 | #include <linux/dma-mapping.h> |
25 | #include <linux/amba/bus.h> | ||
26 | #include <linux/amba/pl330.h> | ||
22 | 27 | ||
28 | #include <asm/irq.h> | ||
23 | #include <plat/devs.h> | 29 | #include <plat/devs.h> |
24 | #include <plat/irqs.h> | 30 | #include <plat/irqs.h> |
25 | 31 | ||
26 | #include <mach/map.h> | 32 | #include <mach/map.h> |
27 | #include <mach/irqs.h> | 33 | #include <mach/irqs.h> |
28 | 34 | #include <mach/dma.h> | |
29 | #include <plat/s3c-pl330-pdata.h> | ||
30 | 35 | ||
31 | static u64 dma_dmamask = DMA_BIT_MASK(32); | 36 | static u64 dma_dmamask = DMA_BIT_MASK(32); |
32 | 37 | ||
33 | static struct resource s5pv210_pdma0_resource[] = { | 38 | struct dma_pl330_peri pdma0_peri[28] = { |
34 | [0] = { | 39 | { |
35 | .start = S5PV210_PA_PDMA0, | 40 | .peri_id = (u8)DMACH_UART0_RX, |
36 | .end = S5PV210_PA_PDMA0 + SZ_4K, | 41 | .rqtype = DEVTOMEM, |
37 | .flags = IORESOURCE_MEM, | 42 | }, { |
38 | }, | 43 | .peri_id = (u8)DMACH_UART0_TX, |
39 | [1] = { | 44 | .rqtype = MEMTODEV, |
40 | .start = IRQ_PDMA0, | 45 | }, { |
41 | .end = IRQ_PDMA0, | 46 | .peri_id = (u8)DMACH_UART1_RX, |
42 | .flags = IORESOURCE_IRQ, | 47 | .rqtype = DEVTOMEM, |
48 | }, { | ||
49 | .peri_id = (u8)DMACH_UART1_TX, | ||
50 | .rqtype = MEMTODEV, | ||
51 | }, { | ||
52 | .peri_id = (u8)DMACH_UART2_RX, | ||
53 | .rqtype = DEVTOMEM, | ||
54 | }, { | ||
55 | .peri_id = (u8)DMACH_UART2_TX, | ||
56 | .rqtype = MEMTODEV, | ||
57 | }, { | ||
58 | .peri_id = (u8)DMACH_UART3_RX, | ||
59 | .rqtype = DEVTOMEM, | ||
60 | }, { | ||
61 | .peri_id = (u8)DMACH_UART3_TX, | ||
62 | .rqtype = MEMTODEV, | ||
63 | }, { | ||
64 | .peri_id = DMACH_MAX, | ||
65 | }, { | ||
66 | .peri_id = (u8)DMACH_I2S0_RX, | ||
67 | .rqtype = DEVTOMEM, | ||
68 | }, { | ||
69 | .peri_id = (u8)DMACH_I2S0_TX, | ||
70 | .rqtype = MEMTODEV, | ||
71 | }, { | ||
72 | .peri_id = (u8)DMACH_I2S0S_TX, | ||
73 | .rqtype = MEMTODEV, | ||
74 | }, { | ||
75 | .peri_id = (u8)DMACH_I2S1_RX, | ||
76 | .rqtype = DEVTOMEM, | ||
77 | }, { | ||
78 | .peri_id = (u8)DMACH_I2S1_TX, | ||
79 | .rqtype = MEMTODEV, | ||
80 | }, { | ||
81 | .peri_id = (u8)DMACH_MAX, | ||
82 | }, { | ||
83 | .peri_id = (u8)DMACH_MAX, | ||
84 | }, { | ||
85 | .peri_id = (u8)DMACH_SPI0_RX, | ||
86 | .rqtype = DEVTOMEM, | ||
87 | }, { | ||
88 | .peri_id = (u8)DMACH_SPI0_TX, | ||
89 | .rqtype = MEMTODEV, | ||
90 | }, { | ||
91 | .peri_id = (u8)DMACH_SPI1_RX, | ||
92 | .rqtype = DEVTOMEM, | ||
93 | }, { | ||
94 | .peri_id = (u8)DMACH_SPI1_TX, | ||
95 | .rqtype = MEMTODEV, | ||
96 | }, { | ||
97 | .peri_id = (u8)DMACH_MAX, | ||
98 | }, { | ||
99 | .peri_id = (u8)DMACH_MAX, | ||
100 | }, { | ||
101 | .peri_id = (u8)DMACH_AC97_MICIN, | ||
102 | .rqtype = DEVTOMEM, | ||
103 | }, { | ||
104 | .peri_id = (u8)DMACH_AC97_PCMIN, | ||
105 | .rqtype = DEVTOMEM, | ||
106 | }, { | ||
107 | .peri_id = (u8)DMACH_AC97_PCMOUT, | ||
108 | .rqtype = MEMTODEV, | ||
109 | }, { | ||
110 | .peri_id = (u8)DMACH_MAX, | ||
111 | }, { | ||
112 | .peri_id = (u8)DMACH_PWM, | ||
113 | }, { | ||
114 | .peri_id = (u8)DMACH_SPDIF, | ||
115 | .rqtype = MEMTODEV, | ||
43 | }, | 116 | }, |
44 | }; | 117 | }; |
45 | 118 | ||
46 | static struct s3c_pl330_platdata s5pv210_pdma0_pdata = { | 119 | struct dma_pl330_platdata s5pv210_pdma0_pdata = { |
47 | .peri = { | 120 | .nr_valid_peri = ARRAY_SIZE(pdma0_peri), |
48 | [0] = DMACH_UART0_RX, | 121 | .peri = pdma0_peri, |
49 | [1] = DMACH_UART0_TX, | ||
50 | [2] = DMACH_UART1_RX, | ||
51 | [3] = DMACH_UART1_TX, | ||
52 | [4] = DMACH_UART2_RX, | ||
53 | [5] = DMACH_UART2_TX, | ||
54 | [6] = DMACH_UART3_RX, | ||
55 | [7] = DMACH_UART3_TX, | ||
56 | [8] = DMACH_MAX, | ||
57 | [9] = DMACH_I2S0_RX, | ||
58 | [10] = DMACH_I2S0_TX, | ||
59 | [11] = DMACH_I2S0S_TX, | ||
60 | [12] = DMACH_I2S1_RX, | ||
61 | [13] = DMACH_I2S1_TX, | ||
62 | [14] = DMACH_MAX, | ||
63 | [15] = DMACH_MAX, | ||
64 | [16] = DMACH_SPI0_RX, | ||
65 | [17] = DMACH_SPI0_TX, | ||
66 | [18] = DMACH_SPI1_RX, | ||
67 | [19] = DMACH_SPI1_TX, | ||
68 | [20] = DMACH_MAX, | ||
69 | [21] = DMACH_MAX, | ||
70 | [22] = DMACH_AC97_MICIN, | ||
71 | [23] = DMACH_AC97_PCMIN, | ||
72 | [24] = DMACH_AC97_PCMOUT, | ||
73 | [25] = DMACH_MAX, | ||
74 | [26] = DMACH_PWM, | ||
75 | [27] = DMACH_SPDIF, | ||
76 | [28] = DMACH_MAX, | ||
77 | [29] = DMACH_MAX, | ||
78 | [30] = DMACH_MAX, | ||
79 | [31] = DMACH_MAX, | ||
80 | }, | ||
81 | }; | 122 | }; |
82 | 123 | ||
83 | static struct platform_device s5pv210_device_pdma0 = { | 124 | struct amba_device s5pv210_device_pdma0 = { |
84 | .name = "s3c-pl330", | 125 | .dev = { |
85 | .id = 0, | 126 | .init_name = "dma-pl330.0", |
86 | .num_resources = ARRAY_SIZE(s5pv210_pdma0_resource), | ||
87 | .resource = s5pv210_pdma0_resource, | ||
88 | .dev = { | ||
89 | .dma_mask = &dma_dmamask, | 127 | .dma_mask = &dma_dmamask, |
90 | .coherent_dma_mask = DMA_BIT_MASK(32), | 128 | .coherent_dma_mask = DMA_BIT_MASK(32), |
91 | .platform_data = &s5pv210_pdma0_pdata, | 129 | .platform_data = &s5pv210_pdma0_pdata, |
92 | }, | 130 | }, |
93 | }; | 131 | .res = { |
94 | 132 | .start = S5PV210_PA_PDMA0, | |
95 | static struct resource s5pv210_pdma1_resource[] = { | 133 | .end = S5PV210_PA_PDMA0 + SZ_4K, |
96 | [0] = { | ||
97 | .start = S5PV210_PA_PDMA1, | ||
98 | .end = S5PV210_PA_PDMA1 + SZ_4K, | ||
99 | .flags = IORESOURCE_MEM, | 134 | .flags = IORESOURCE_MEM, |
100 | }, | 135 | }, |
101 | [1] = { | 136 | .irq = {IRQ_PDMA0, NO_IRQ}, |
102 | .start = IRQ_PDMA1, | 137 | .periphid = 0x00041330, |
103 | .end = IRQ_PDMA1, | ||
104 | .flags = IORESOURCE_IRQ, | ||
105 | }, | ||
106 | }; | 138 | }; |
107 | 139 | ||
108 | static struct s3c_pl330_platdata s5pv210_pdma1_pdata = { | 140 | struct dma_pl330_peri pdma1_peri[32] = { |
109 | .peri = { | 141 | { |
110 | [0] = DMACH_UART0_RX, | 142 | .peri_id = (u8)DMACH_UART0_RX, |
111 | [1] = DMACH_UART0_TX, | 143 | .rqtype = DEVTOMEM, |
112 | [2] = DMACH_UART1_RX, | 144 | }, { |
113 | [3] = DMACH_UART1_TX, | 145 | .peri_id = (u8)DMACH_UART0_TX, |
114 | [4] = DMACH_UART2_RX, | 146 | .rqtype = MEMTODEV, |
115 | [5] = DMACH_UART2_TX, | 147 | }, { |
116 | [6] = DMACH_UART3_RX, | 148 | .peri_id = (u8)DMACH_UART1_RX, |
117 | [7] = DMACH_UART3_TX, | 149 | .rqtype = DEVTOMEM, |
118 | [8] = DMACH_MAX, | 150 | }, { |
119 | [9] = DMACH_I2S0_RX, | 151 | .peri_id = (u8)DMACH_UART1_TX, |
120 | [10] = DMACH_I2S0_TX, | 152 | .rqtype = MEMTODEV, |
121 | [11] = DMACH_I2S0S_TX, | 153 | }, { |
122 | [12] = DMACH_I2S1_RX, | 154 | .peri_id = (u8)DMACH_UART2_RX, |
123 | [13] = DMACH_I2S1_TX, | 155 | .rqtype = DEVTOMEM, |
124 | [14] = DMACH_I2S2_RX, | 156 | }, { |
125 | [15] = DMACH_I2S2_TX, | 157 | .peri_id = (u8)DMACH_UART2_TX, |
126 | [16] = DMACH_SPI0_RX, | 158 | .rqtype = MEMTODEV, |
127 | [17] = DMACH_SPI0_TX, | 159 | }, { |
128 | [18] = DMACH_SPI1_RX, | 160 | .peri_id = (u8)DMACH_UART3_RX, |
129 | [19] = DMACH_SPI1_TX, | 161 | .rqtype = DEVTOMEM, |
130 | [20] = DMACH_MAX, | 162 | }, { |
131 | [21] = DMACH_MAX, | 163 | .peri_id = (u8)DMACH_UART3_TX, |
132 | [22] = DMACH_PCM0_RX, | 164 | .rqtype = MEMTODEV, |
133 | [23] = DMACH_PCM0_TX, | 165 | }, { |
134 | [24] = DMACH_PCM1_RX, | 166 | .peri_id = DMACH_MAX, |
135 | [25] = DMACH_PCM1_TX, | 167 | }, { |
136 | [26] = DMACH_MSM_REQ0, | 168 | .peri_id = (u8)DMACH_I2S0_RX, |
137 | [27] = DMACH_MSM_REQ1, | 169 | .rqtype = DEVTOMEM, |
138 | [28] = DMACH_MSM_REQ2, | 170 | }, { |
139 | [29] = DMACH_MSM_REQ3, | 171 | .peri_id = (u8)DMACH_I2S0_TX, |
140 | [30] = DMACH_PCM2_RX, | 172 | .rqtype = MEMTODEV, |
141 | [31] = DMACH_PCM2_TX, | 173 | }, { |
174 | .peri_id = (u8)DMACH_I2S0S_TX, | ||
175 | .rqtype = MEMTODEV, | ||
176 | }, { | ||
177 | .peri_id = (u8)DMACH_I2S1_RX, | ||
178 | .rqtype = DEVTOMEM, | ||
179 | }, { | ||
180 | .peri_id = (u8)DMACH_I2S1_TX, | ||
181 | .rqtype = MEMTODEV, | ||
182 | }, { | ||
183 | .peri_id = (u8)DMACH_I2S2_RX, | ||
184 | .rqtype = DEVTOMEM, | ||
185 | }, { | ||
186 | .peri_id = (u8)DMACH_I2S2_TX, | ||
187 | .rqtype = MEMTODEV, | ||
188 | }, { | ||
189 | .peri_id = (u8)DMACH_SPI0_RX, | ||
190 | .rqtype = DEVTOMEM, | ||
191 | }, { | ||
192 | .peri_id = (u8)DMACH_SPI0_TX, | ||
193 | .rqtype = MEMTODEV, | ||
194 | }, { | ||
195 | .peri_id = (u8)DMACH_SPI1_RX, | ||
196 | .rqtype = DEVTOMEM, | ||
197 | }, { | ||
198 | .peri_id = (u8)DMACH_SPI1_TX, | ||
199 | .rqtype = MEMTODEV, | ||
200 | }, { | ||
201 | .peri_id = (u8)DMACH_MAX, | ||
202 | }, { | ||
203 | .peri_id = (u8)DMACH_MAX, | ||
204 | }, { | ||
205 | .peri_id = (u8)DMACH_PCM0_RX, | ||
206 | .rqtype = DEVTOMEM, | ||
207 | }, { | ||
208 | .peri_id = (u8)DMACH_PCM0_TX, | ||
209 | .rqtype = MEMTODEV, | ||
210 | }, { | ||
211 | .peri_id = (u8)DMACH_PCM1_RX, | ||
212 | .rqtype = DEVTOMEM, | ||
213 | }, { | ||
214 | .peri_id = (u8)DMACH_PCM1_TX, | ||
215 | .rqtype = MEMTODEV, | ||
216 | }, { | ||
217 | .peri_id = (u8)DMACH_MSM_REQ0, | ||
218 | }, { | ||
219 | .peri_id = (u8)DMACH_MSM_REQ1, | ||
220 | }, { | ||
221 | .peri_id = (u8)DMACH_MSM_REQ2, | ||
222 | }, { | ||
223 | .peri_id = (u8)DMACH_MSM_REQ3, | ||
224 | }, { | ||
225 | .peri_id = (u8)DMACH_PCM2_RX, | ||
226 | .rqtype = DEVTOMEM, | ||
227 | }, { | ||
228 | .peri_id = (u8)DMACH_PCM2_TX, | ||
229 | .rqtype = MEMTODEV, | ||
142 | }, | 230 | }, |
143 | }; | 231 | }; |
144 | 232 | ||
145 | static struct platform_device s5pv210_device_pdma1 = { | 233 | struct dma_pl330_platdata s5pv210_pdma1_pdata = { |
146 | .name = "s3c-pl330", | 234 | .nr_valid_peri = ARRAY_SIZE(pdma1_peri), |
147 | .id = 1, | 235 | .peri = pdma1_peri, |
148 | .num_resources = ARRAY_SIZE(s5pv210_pdma1_resource), | 236 | }; |
149 | .resource = s5pv210_pdma1_resource, | 237 | |
150 | .dev = { | 238 | struct amba_device s5pv210_device_pdma1 = { |
239 | .dev = { | ||
240 | .init_name = "dma-pl330.1", | ||
151 | .dma_mask = &dma_dmamask, | 241 | .dma_mask = &dma_dmamask, |
152 | .coherent_dma_mask = DMA_BIT_MASK(32), | 242 | .coherent_dma_mask = DMA_BIT_MASK(32), |
153 | .platform_data = &s5pv210_pdma1_pdata, | 243 | .platform_data = &s5pv210_pdma1_pdata, |
154 | }, | 244 | }, |
155 | }; | 245 | .res = { |
156 | 246 | .start = S5PV210_PA_PDMA1, | |
157 | static struct platform_device *s5pv210_dmacs[] __initdata = { | 247 | .end = S5PV210_PA_PDMA1 + SZ_4K, |
158 | &s5pv210_device_pdma0, | 248 | .flags = IORESOURCE_MEM, |
159 | &s5pv210_device_pdma1, | 249 | }, |
250 | .irq = {IRQ_PDMA1, NO_IRQ}, | ||
251 | .periphid = 0x00041330, | ||
160 | }; | 252 | }; |
161 | 253 | ||
162 | static int __init s5pv210_dma_init(void) | 254 | static int __init s5pv210_dma_init(void) |
163 | { | 255 | { |
164 | platform_add_devices(s5pv210_dmacs, ARRAY_SIZE(s5pv210_dmacs)); | 256 | amba_device_register(&s5pv210_device_pdma0, &iomem_resource); |
257 | amba_device_register(&s5pv210_device_pdma1, &iomem_resource); | ||
165 | 258 | ||
166 | return 0; | 259 | return 0; |
167 | } | 260 | } |