diff options
Diffstat (limited to 'arch/arm/mach-exynos/dma.c')
-rw-r--r-- | arch/arm/mach-exynos/dma.c | 229 |
1 files changed, 68 insertions, 161 deletions
diff --git a/arch/arm/mach-exynos/dma.c b/arch/arm/mach-exynos/dma.c index 9667c61e64fb..b10fcd270f07 100644 --- a/arch/arm/mach-exynos/dma.c +++ b/arch/arm/mach-exynos/dma.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/dma-mapping.h> | 24 | #include <linux/dma-mapping.h> |
25 | #include <linux/amba/bus.h> | 25 | #include <linux/amba/bus.h> |
26 | #include <linux/amba/pl330.h> | 26 | #include <linux/amba/pl330.h> |
27 | #include <linux/of.h> | ||
27 | 28 | ||
28 | #include <asm/irq.h> | 29 | #include <asm/irq.h> |
29 | #include <plat/devs.h> | 30 | #include <plat/devs.h> |
@@ -35,95 +36,42 @@ | |||
35 | 36 | ||
36 | static u64 dma_dmamask = DMA_BIT_MASK(32); | 37 | static u64 dma_dmamask = DMA_BIT_MASK(32); |
37 | 38 | ||
38 | struct dma_pl330_peri pdma0_peri[28] = { | 39 | u8 pdma0_peri[] = { |
39 | { | 40 | DMACH_PCM0_RX, |
40 | .peri_id = (u8)DMACH_PCM0_RX, | 41 | DMACH_PCM0_TX, |
41 | .rqtype = DEVTOMEM, | 42 | DMACH_PCM2_RX, |
42 | }, { | 43 | DMACH_PCM2_TX, |
43 | .peri_id = (u8)DMACH_PCM0_TX, | 44 | DMACH_MSM_REQ0, |
44 | .rqtype = MEMTODEV, | 45 | DMACH_MSM_REQ2, |
45 | }, { | 46 | DMACH_SPI0_RX, |
46 | .peri_id = (u8)DMACH_PCM2_RX, | 47 | DMACH_SPI0_TX, |
47 | .rqtype = DEVTOMEM, | 48 | DMACH_SPI2_RX, |
48 | }, { | 49 | DMACH_SPI2_TX, |
49 | .peri_id = (u8)DMACH_PCM2_TX, | 50 | DMACH_I2S0S_TX, |
50 | .rqtype = MEMTODEV, | 51 | DMACH_I2S0_RX, |
51 | }, { | 52 | DMACH_I2S0_TX, |
52 | .peri_id = (u8)DMACH_MSM_REQ0, | 53 | DMACH_I2S2_RX, |
53 | }, { | 54 | DMACH_I2S2_TX, |
54 | .peri_id = (u8)DMACH_MSM_REQ2, | 55 | DMACH_UART0_RX, |
55 | }, { | 56 | DMACH_UART0_TX, |
56 | .peri_id = (u8)DMACH_SPI0_RX, | 57 | DMACH_UART2_RX, |
57 | .rqtype = DEVTOMEM, | 58 | DMACH_UART2_TX, |
58 | }, { | 59 | DMACH_UART4_RX, |
59 | .peri_id = (u8)DMACH_SPI0_TX, | 60 | DMACH_UART4_TX, |
60 | .rqtype = MEMTODEV, | 61 | DMACH_SLIMBUS0_RX, |
61 | }, { | 62 | DMACH_SLIMBUS0_TX, |
62 | .peri_id = (u8)DMACH_SPI2_RX, | 63 | DMACH_SLIMBUS2_RX, |
63 | .rqtype = DEVTOMEM, | 64 | DMACH_SLIMBUS2_TX, |
64 | }, { | 65 | DMACH_SLIMBUS4_RX, |
65 | .peri_id = (u8)DMACH_SPI2_TX, | 66 | DMACH_SLIMBUS4_TX, |
66 | .rqtype = MEMTODEV, | 67 | DMACH_AC97_MICIN, |
67 | }, { | 68 | DMACH_AC97_PCMIN, |
68 | .peri_id = (u8)DMACH_I2S0S_TX, | 69 | DMACH_AC97_PCMOUT, |
69 | .rqtype = MEMTODEV, | ||
70 | }, { | ||
71 | .peri_id = (u8)DMACH_I2S0_RX, | ||
72 | .rqtype = DEVTOMEM, | ||
73 | }, { | ||
74 | .peri_id = (u8)DMACH_I2S0_TX, | ||
75 | .rqtype = MEMTODEV, | ||
76 | }, { | ||
77 | .peri_id = (u8)DMACH_UART0_RX, | ||
78 | .rqtype = DEVTOMEM, | ||
79 | }, { | ||
80 | .peri_id = (u8)DMACH_UART0_TX, | ||
81 | .rqtype = MEMTODEV, | ||
82 | }, { | ||
83 | .peri_id = (u8)DMACH_UART2_RX, | ||
84 | .rqtype = DEVTOMEM, | ||
85 | }, { | ||
86 | .peri_id = (u8)DMACH_UART2_TX, | ||
87 | .rqtype = MEMTODEV, | ||
88 | }, { | ||
89 | .peri_id = (u8)DMACH_UART4_RX, | ||
90 | .rqtype = DEVTOMEM, | ||
91 | }, { | ||
92 | .peri_id = (u8)DMACH_UART4_TX, | ||
93 | .rqtype = MEMTODEV, | ||
94 | }, { | ||
95 | .peri_id = (u8)DMACH_SLIMBUS0_RX, | ||
96 | .rqtype = DEVTOMEM, | ||
97 | }, { | ||
98 | .peri_id = (u8)DMACH_SLIMBUS0_TX, | ||
99 | .rqtype = MEMTODEV, | ||
100 | }, { | ||
101 | .peri_id = (u8)DMACH_SLIMBUS2_RX, | ||
102 | .rqtype = DEVTOMEM, | ||
103 | }, { | ||
104 | .peri_id = (u8)DMACH_SLIMBUS2_TX, | ||
105 | .rqtype = MEMTODEV, | ||
106 | }, { | ||
107 | .peri_id = (u8)DMACH_SLIMBUS4_RX, | ||
108 | .rqtype = DEVTOMEM, | ||
109 | }, { | ||
110 | .peri_id = (u8)DMACH_SLIMBUS4_TX, | ||
111 | .rqtype = MEMTODEV, | ||
112 | }, { | ||
113 | .peri_id = (u8)DMACH_AC97_MICIN, | ||
114 | .rqtype = DEVTOMEM, | ||
115 | }, { | ||
116 | .peri_id = (u8)DMACH_AC97_PCMIN, | ||
117 | .rqtype = DEVTOMEM, | ||
118 | }, { | ||
119 | .peri_id = (u8)DMACH_AC97_PCMOUT, | ||
120 | .rqtype = MEMTODEV, | ||
121 | }, | ||
122 | }; | 70 | }; |
123 | 71 | ||
124 | struct dma_pl330_platdata exynos4_pdma0_pdata = { | 72 | struct dma_pl330_platdata exynos4_pdma0_pdata = { |
125 | .nr_valid_peri = ARRAY_SIZE(pdma0_peri), | 73 | .nr_valid_peri = ARRAY_SIZE(pdma0_peri), |
126 | .peri = pdma0_peri, | 74 | .peri_id = pdma0_peri, |
127 | }; | 75 | }; |
128 | 76 | ||
129 | struct amba_device exynos4_device_pdma0 = { | 77 | struct amba_device exynos4_device_pdma0 = { |
@@ -142,86 +90,37 @@ struct amba_device exynos4_device_pdma0 = { | |||
142 | .periphid = 0x00041330, | 90 | .periphid = 0x00041330, |
143 | }; | 91 | }; |
144 | 92 | ||
145 | struct dma_pl330_peri pdma1_peri[25] = { | 93 | u8 pdma1_peri[] = { |
146 | { | 94 | DMACH_PCM0_RX, |
147 | .peri_id = (u8)DMACH_PCM0_RX, | 95 | DMACH_PCM0_TX, |
148 | .rqtype = DEVTOMEM, | 96 | DMACH_PCM1_RX, |
149 | }, { | 97 | DMACH_PCM1_TX, |
150 | .peri_id = (u8)DMACH_PCM0_TX, | 98 | DMACH_MSM_REQ1, |
151 | .rqtype = MEMTODEV, | 99 | DMACH_MSM_REQ3, |
152 | }, { | 100 | DMACH_SPI1_RX, |
153 | .peri_id = (u8)DMACH_PCM1_RX, | 101 | DMACH_SPI1_TX, |
154 | .rqtype = DEVTOMEM, | 102 | DMACH_I2S0S_TX, |
155 | }, { | 103 | DMACH_I2S0_RX, |
156 | .peri_id = (u8)DMACH_PCM1_TX, | 104 | DMACH_I2S0_TX, |
157 | .rqtype = MEMTODEV, | 105 | DMACH_I2S1_RX, |
158 | }, { | 106 | DMACH_I2S1_TX, |
159 | .peri_id = (u8)DMACH_MSM_REQ1, | 107 | DMACH_UART0_RX, |
160 | }, { | 108 | DMACH_UART0_TX, |
161 | .peri_id = (u8)DMACH_MSM_REQ3, | 109 | DMACH_UART1_RX, |
162 | }, { | 110 | DMACH_UART1_TX, |
163 | .peri_id = (u8)DMACH_SPI1_RX, | 111 | DMACH_UART3_RX, |
164 | .rqtype = DEVTOMEM, | 112 | DMACH_UART3_TX, |
165 | }, { | 113 | DMACH_SLIMBUS1_RX, |
166 | .peri_id = (u8)DMACH_SPI1_TX, | 114 | DMACH_SLIMBUS1_TX, |
167 | .rqtype = MEMTODEV, | 115 | DMACH_SLIMBUS3_RX, |
168 | }, { | 116 | DMACH_SLIMBUS3_TX, |
169 | .peri_id = (u8)DMACH_I2S0S_TX, | 117 | DMACH_SLIMBUS5_RX, |
170 | .rqtype = MEMTODEV, | 118 | DMACH_SLIMBUS5_TX, |
171 | }, { | ||
172 | .peri_id = (u8)DMACH_I2S0_RX, | ||
173 | .rqtype = DEVTOMEM, | ||
174 | }, { | ||
175 | .peri_id = (u8)DMACH_I2S0_TX, | ||
176 | .rqtype = MEMTODEV, | ||
177 | }, { | ||
178 | .peri_id = (u8)DMACH_I2S1_RX, | ||
179 | .rqtype = DEVTOMEM, | ||
180 | }, { | ||
181 | .peri_id = (u8)DMACH_I2S1_TX, | ||
182 | .rqtype = MEMTODEV, | ||
183 | }, { | ||
184 | .peri_id = (u8)DMACH_UART0_RX, | ||
185 | .rqtype = DEVTOMEM, | ||
186 | }, { | ||
187 | .peri_id = (u8)DMACH_UART0_TX, | ||
188 | .rqtype = MEMTODEV, | ||
189 | }, { | ||
190 | .peri_id = (u8)DMACH_UART1_RX, | ||
191 | .rqtype = DEVTOMEM, | ||
192 | }, { | ||
193 | .peri_id = (u8)DMACH_UART1_TX, | ||
194 | .rqtype = MEMTODEV, | ||
195 | }, { | ||
196 | .peri_id = (u8)DMACH_UART3_RX, | ||
197 | .rqtype = DEVTOMEM, | ||
198 | }, { | ||
199 | .peri_id = (u8)DMACH_UART3_TX, | ||
200 | .rqtype = MEMTODEV, | ||
201 | }, { | ||
202 | .peri_id = (u8)DMACH_SLIMBUS1_RX, | ||
203 | .rqtype = DEVTOMEM, | ||
204 | }, { | ||
205 | .peri_id = (u8)DMACH_SLIMBUS1_TX, | ||
206 | .rqtype = MEMTODEV, | ||
207 | }, { | ||
208 | .peri_id = (u8)DMACH_SLIMBUS3_RX, | ||
209 | .rqtype = DEVTOMEM, | ||
210 | }, { | ||
211 | .peri_id = (u8)DMACH_SLIMBUS3_TX, | ||
212 | .rqtype = MEMTODEV, | ||
213 | }, { | ||
214 | .peri_id = (u8)DMACH_SLIMBUS5_RX, | ||
215 | .rqtype = DEVTOMEM, | ||
216 | }, { | ||
217 | .peri_id = (u8)DMACH_SLIMBUS5_TX, | ||
218 | .rqtype = MEMTODEV, | ||
219 | }, | ||
220 | }; | 119 | }; |
221 | 120 | ||
222 | struct dma_pl330_platdata exynos4_pdma1_pdata = { | 121 | struct dma_pl330_platdata exynos4_pdma1_pdata = { |
223 | .nr_valid_peri = ARRAY_SIZE(pdma1_peri), | 122 | .nr_valid_peri = ARRAY_SIZE(pdma1_peri), |
224 | .peri = pdma1_peri, | 123 | .peri_id = pdma1_peri, |
225 | }; | 124 | }; |
226 | 125 | ||
227 | struct amba_device exynos4_device_pdma1 = { | 126 | struct amba_device exynos4_device_pdma1 = { |
@@ -242,7 +141,15 @@ struct amba_device exynos4_device_pdma1 = { | |||
242 | 141 | ||
243 | static int __init exynos4_dma_init(void) | 142 | static int __init exynos4_dma_init(void) |
244 | { | 143 | { |
144 | if (of_have_populated_dt()) | ||
145 | return 0; | ||
146 | |||
147 | dma_cap_set(DMA_SLAVE, exynos4_pdma0_pdata.cap_mask); | ||
148 | dma_cap_set(DMA_CYCLIC, exynos4_pdma0_pdata.cap_mask); | ||
245 | amba_device_register(&exynos4_device_pdma0, &iomem_resource); | 149 | amba_device_register(&exynos4_device_pdma0, &iomem_resource); |
150 | |||
151 | dma_cap_set(DMA_SLAVE, exynos4_pdma1_pdata.cap_mask); | ||
152 | dma_cap_set(DMA_CYCLIC, exynos4_pdma1_pdata.cap_mask); | ||
246 | amba_device_register(&exynos4_device_pdma1, &iomem_resource); | 153 | amba_device_register(&exynos4_device_pdma1, &iomem_resource); |
247 | 154 | ||
248 | return 0; | 155 | return 0; |