mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race
[linux/fpc-iii.git] / arch / arm / mach-s3c64xx / pl080.c
blob66fc774b70ec238548c0f3a99fd749baf4062787
1 /*
2 * Samsung's S3C64XX generic DMA support using amba-pl08x driver.
4 * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #include <linux/kernel.h>
12 #include <linux/amba/bus.h>
13 #include <linux/amba/pl080.h>
14 #include <linux/amba/pl08x.h>
15 #include <linux/of.h>
17 #include <plat/cpu.h>
18 #include <mach/irqs.h>
19 #include <mach/map.h>
21 #include "regs-sys.h"
23 static int pl08x_get_xfer_signal(const struct pl08x_channel_data *cd)
25 return cd->min_signal;
28 static void pl08x_put_xfer_signal(const struct pl08x_channel_data *cd, int ch)
33 * DMA0
36 static struct pl08x_channel_data s3c64xx_dma0_info[] = {
38 .bus_id = "uart0_tx",
39 .min_signal = 0,
40 .max_signal = 0,
41 .periph_buses = PL08X_AHB2,
42 }, {
43 .bus_id = "uart0_rx",
44 .min_signal = 1,
45 .max_signal = 1,
46 .periph_buses = PL08X_AHB2,
47 }, {
48 .bus_id = "uart1_tx",
49 .min_signal = 2,
50 .max_signal = 2,
51 .periph_buses = PL08X_AHB2,
52 }, {
53 .bus_id = "uart1_rx",
54 .min_signal = 3,
55 .max_signal = 3,
56 .periph_buses = PL08X_AHB2,
57 }, {
58 .bus_id = "uart2_tx",
59 .min_signal = 4,
60 .max_signal = 4,
61 .periph_buses = PL08X_AHB2,
62 }, {
63 .bus_id = "uart2_rx",
64 .min_signal = 5,
65 .max_signal = 5,
66 .periph_buses = PL08X_AHB2,
67 }, {
68 .bus_id = "uart3_tx",
69 .min_signal = 6,
70 .max_signal = 6,
71 .periph_buses = PL08X_AHB2,
72 }, {
73 .bus_id = "uart3_rx",
74 .min_signal = 7,
75 .max_signal = 7,
76 .periph_buses = PL08X_AHB2,
77 }, {
78 .bus_id = "pcm0_tx",
79 .min_signal = 8,
80 .max_signal = 8,
81 .periph_buses = PL08X_AHB2,
82 }, {
83 .bus_id = "pcm0_rx",
84 .min_signal = 9,
85 .max_signal = 9,
86 .periph_buses = PL08X_AHB2,
87 }, {
88 .bus_id = "i2s0_tx",
89 .min_signal = 10,
90 .max_signal = 10,
91 .periph_buses = PL08X_AHB2,
92 }, {
93 .bus_id = "i2s0_rx",
94 .min_signal = 11,
95 .max_signal = 11,
96 .periph_buses = PL08X_AHB2,
97 }, {
98 .bus_id = "spi0_tx",
99 .min_signal = 12,
100 .max_signal = 12,
101 .periph_buses = PL08X_AHB2,
102 }, {
103 .bus_id = "spi0_rx",
104 .min_signal = 13,
105 .max_signal = 13,
106 .periph_buses = PL08X_AHB2,
107 }, {
108 .bus_id = "i2s2_tx",
109 .min_signal = 14,
110 .max_signal = 14,
111 .periph_buses = PL08X_AHB2,
112 }, {
113 .bus_id = "i2s2_rx",
114 .min_signal = 15,
115 .max_signal = 15,
116 .periph_buses = PL08X_AHB2,
120 static const struct dma_slave_map s3c64xx_dma0_slave_map[] = {
121 { "s3c6400-uart.0", "tx", &s3c64xx_dma0_info[0] },
122 { "s3c6400-uart.0", "rx", &s3c64xx_dma0_info[1] },
123 { "s3c6400-uart.1", "tx", &s3c64xx_dma0_info[2] },
124 { "s3c6400-uart.1", "rx", &s3c64xx_dma0_info[3] },
125 { "s3c6400-uart.2", "tx", &s3c64xx_dma0_info[4] },
126 { "s3c6400-uart.2", "rx", &s3c64xx_dma0_info[5] },
127 { "s3c6400-uart.3", "tx", &s3c64xx_dma0_info[6] },
128 { "s3c6400-uart.3", "rx", &s3c64xx_dma0_info[7] },
129 { "samsung-pcm.0", "tx", &s3c64xx_dma0_info[8] },
130 { "samsung-pcm.0", "rx", &s3c64xx_dma0_info[9] },
131 { "samsung-i2s.0", "tx", &s3c64xx_dma0_info[10] },
132 { "samsung-i2s.0", "rx", &s3c64xx_dma0_info[11] },
133 { "s3c6410-spi.0", "tx", &s3c64xx_dma0_info[12] },
134 { "s3c6410-spi.0", "rx", &s3c64xx_dma0_info[13] },
135 { "samsung-i2s.2", "tx", &s3c64xx_dma0_info[14] },
136 { "samsung-i2s.2", "rx", &s3c64xx_dma0_info[15] },
139 struct pl08x_platform_data s3c64xx_dma0_plat_data = {
140 .memcpy_burst_size = PL08X_BURST_SZ_4,
141 .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
142 .memcpy_prot_buff = true,
143 .memcpy_prot_cache = true,
144 .lli_buses = PL08X_AHB1,
145 .mem_buses = PL08X_AHB1,
146 .get_xfer_signal = pl08x_get_xfer_signal,
147 .put_xfer_signal = pl08x_put_xfer_signal,
148 .slave_channels = s3c64xx_dma0_info,
149 .num_slave_channels = ARRAY_SIZE(s3c64xx_dma0_info),
150 .slave_map = s3c64xx_dma0_slave_map,
151 .slave_map_len = ARRAY_SIZE(s3c64xx_dma0_slave_map),
154 static AMBA_AHB_DEVICE(s3c64xx_dma0, "dma-pl080s.0", 0,
155 0x75000000, {IRQ_DMA0}, &s3c64xx_dma0_plat_data);
158 * DMA1
161 static struct pl08x_channel_data s3c64xx_dma1_info[] = {
163 .bus_id = "pcm1_tx",
164 .min_signal = 0,
165 .max_signal = 0,
166 .periph_buses = PL08X_AHB2,
167 }, {
168 .bus_id = "pcm1_rx",
169 .min_signal = 1,
170 .max_signal = 1,
171 .periph_buses = PL08X_AHB2,
172 }, {
173 .bus_id = "i2s1_tx",
174 .min_signal = 2,
175 .max_signal = 2,
176 .periph_buses = PL08X_AHB2,
177 }, {
178 .bus_id = "i2s1_rx",
179 .min_signal = 3,
180 .max_signal = 3,
181 .periph_buses = PL08X_AHB2,
182 }, {
183 .bus_id = "spi1_tx",
184 .min_signal = 4,
185 .max_signal = 4,
186 .periph_buses = PL08X_AHB2,
187 }, {
188 .bus_id = "spi1_rx",
189 .min_signal = 5,
190 .max_signal = 5,
191 .periph_buses = PL08X_AHB2,
192 }, {
193 .bus_id = "ac97_out",
194 .min_signal = 6,
195 .max_signal = 6,
196 .periph_buses = PL08X_AHB2,
197 }, {
198 .bus_id = "ac97_in",
199 .min_signal = 7,
200 .max_signal = 7,
201 .periph_buses = PL08X_AHB2,
202 }, {
203 .bus_id = "ac97_mic",
204 .min_signal = 8,
205 .max_signal = 8,
206 .periph_buses = PL08X_AHB2,
207 }, {
208 .bus_id = "pwm",
209 .min_signal = 9,
210 .max_signal = 9,
211 .periph_buses = PL08X_AHB2,
212 }, {
213 .bus_id = "irda",
214 .min_signal = 10,
215 .max_signal = 10,
216 .periph_buses = PL08X_AHB2,
217 }, {
218 .bus_id = "external",
219 .min_signal = 11,
220 .max_signal = 11,
221 .periph_buses = PL08X_AHB2,
225 static const struct dma_slave_map s3c64xx_dma1_slave_map[] = {
226 { "samsung-pcm.1", "tx", &s3c64xx_dma1_info[0] },
227 { "samsung-pcm.1", "rx", &s3c64xx_dma1_info[1] },
228 { "samsung-i2s.1", "tx", &s3c64xx_dma1_info[2] },
229 { "samsung-i2s.1", "rx", &s3c64xx_dma1_info[3] },
230 { "s3c6410-spi.1", "tx", &s3c64xx_dma1_info[4] },
231 { "s3c6410-spi.1", "rx", &s3c64xx_dma1_info[5] },
234 struct pl08x_platform_data s3c64xx_dma1_plat_data = {
235 .memcpy_burst_size = PL08X_BURST_SZ_4,
236 .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
237 .memcpy_prot_buff = true,
238 .memcpy_prot_cache = true,
239 .lli_buses = PL08X_AHB1,
240 .mem_buses = PL08X_AHB1,
241 .get_xfer_signal = pl08x_get_xfer_signal,
242 .put_xfer_signal = pl08x_put_xfer_signal,
243 .slave_channels = s3c64xx_dma1_info,
244 .num_slave_channels = ARRAY_SIZE(s3c64xx_dma1_info),
245 .slave_map = s3c64xx_dma1_slave_map,
246 .slave_map_len = ARRAY_SIZE(s3c64xx_dma1_slave_map),
249 static AMBA_AHB_DEVICE(s3c64xx_dma1, "dma-pl080s.1", 0,
250 0x75100000, {IRQ_DMA1}, &s3c64xx_dma1_plat_data);
252 static int __init s3c64xx_pl080_init(void)
254 if (!soc_is_s3c64xx())
255 return 0;
257 /* Set all DMA configuration to be DMA, not SDMA */
258 writel(0xffffff, S3C64XX_SDMA_SEL);
260 if (of_have_populated_dt())
261 return 0;
263 amba_device_register(&s3c64xx_dma0_device, &iomem_resource);
264 amba_device_register(&s3c64xx_dma1_device, &iomem_resource);
266 return 0;
268 arch_initcall(s3c64xx_pl080_init);