aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-12-06 04:59:23 -0500
committerSimon Horman <horms+renesas@verge.net.au>2013-12-24 07:09:07 -0500
commitc9e06d8edc56d87c1882824c2896c7227aedb358 (patch)
tree41668c4e59b51ca1c716be5315847de85b71abdf /arch
parentd000fff90a8d0e2cd5b437b3fbc3d3d5b8322cba (diff)
ARM: shmobile: r8a7740: Use macros to declare SCIF devices
Replace copy-n-paste SCIF platform data and device declaration with a macro. This reduces the amount of code and improves readability. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c191
1 files changed, 29 insertions, 162 deletions
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index b7d4b2c3bc29..8778b57ed7d9 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -203,167 +203,34 @@ static struct platform_device irqpin3_device = {
203 }, 203 },
204}; 204};
205 205
206/* SCIFA0 */ 206/* SCIF */
207static struct plat_sci_port scif0_platform_data = { 207#define R8A7740_SCIF(scif_type, index, baseaddr, irq) \
208 .mapbase = 0xe6c40000, 208static struct plat_sci_port scif##index##_platform_data = { \
209 .flags = UPF_BOOT_AUTOCONF, 209 .type = scif_type, \
210 .scscr = SCSCR_RE | SCSCR_TE, 210 .mapbase = baseaddr, \
211 .scbrr_algo_id = SCBRR_ALGO_4, 211 .flags = UPF_BOOT_AUTOCONF, \
212 .type = PORT_SCIFA, 212 .irqs = SCIx_IRQ_MUXED(irq), \
213 .irqs = SCIx_IRQ_MUXED(gic_spi(100)), 213 .scbrr_algo_id = SCBRR_ALGO_4, \
214}; 214 .scscr = SCSCR_RE | SCSCR_TE, \
215 215}; \
216static struct platform_device scif0_device = { 216 \
217 .name = "sh-sci", 217static struct platform_device scif##index##_device = { \
218 .id = 0, 218 .name = "sh-sci", \
219 .dev = { 219 .id = index, \
220 .platform_data = &scif0_platform_data, 220 .dev = { \
221 }, 221 .platform_data = &scif##index##_platform_data, \
222}; 222 }, \
223 223}
224/* SCIFA1 */
225static struct plat_sci_port scif1_platform_data = {
226 .mapbase = 0xe6c50000,
227 .flags = UPF_BOOT_AUTOCONF,
228 .scscr = SCSCR_RE | SCSCR_TE,
229 .scbrr_algo_id = SCBRR_ALGO_4,
230 .type = PORT_SCIFA,
231 .irqs = SCIx_IRQ_MUXED(gic_spi(101)),
232};
233
234static struct platform_device scif1_device = {
235 .name = "sh-sci",
236 .id = 1,
237 .dev = {
238 .platform_data = &scif1_platform_data,
239 },
240};
241
242/* SCIFA2 */
243static struct plat_sci_port scif2_platform_data = {
244 .mapbase = 0xe6c60000,
245 .flags = UPF_BOOT_AUTOCONF,
246 .scscr = SCSCR_RE | SCSCR_TE,
247 .scbrr_algo_id = SCBRR_ALGO_4,
248 .type = PORT_SCIFA,
249 .irqs = SCIx_IRQ_MUXED(gic_spi(102)),
250};
251
252static struct platform_device scif2_device = {
253 .name = "sh-sci",
254 .id = 2,
255 .dev = {
256 .platform_data = &scif2_platform_data,
257 },
258};
259
260/* SCIFA3 */
261static struct plat_sci_port scif3_platform_data = {
262 .mapbase = 0xe6c70000,
263 .flags = UPF_BOOT_AUTOCONF,
264 .scscr = SCSCR_RE | SCSCR_TE,
265 .scbrr_algo_id = SCBRR_ALGO_4,
266 .type = PORT_SCIFA,
267 .irqs = SCIx_IRQ_MUXED(gic_spi(103)),
268};
269
270static struct platform_device scif3_device = {
271 .name = "sh-sci",
272 .id = 3,
273 .dev = {
274 .platform_data = &scif3_platform_data,
275 },
276};
277
278/* SCIFA4 */
279static struct plat_sci_port scif4_platform_data = {
280 .mapbase = 0xe6c80000,
281 .flags = UPF_BOOT_AUTOCONF,
282 .scscr = SCSCR_RE | SCSCR_TE,
283 .scbrr_algo_id = SCBRR_ALGO_4,
284 .type = PORT_SCIFA,
285 .irqs = SCIx_IRQ_MUXED(gic_spi(104)),
286};
287
288static struct platform_device scif4_device = {
289 .name = "sh-sci",
290 .id = 4,
291 .dev = {
292 .platform_data = &scif4_platform_data,
293 },
294};
295
296/* SCIFA5 */
297static struct plat_sci_port scif5_platform_data = {
298 .mapbase = 0xe6cb0000,
299 .flags = UPF_BOOT_AUTOCONF,
300 .scscr = SCSCR_RE | SCSCR_TE,
301 .scbrr_algo_id = SCBRR_ALGO_4,
302 .type = PORT_SCIFA,
303 .irqs = SCIx_IRQ_MUXED(gic_spi(105)),
304};
305
306static struct platform_device scif5_device = {
307 .name = "sh-sci",
308 .id = 5,
309 .dev = {
310 .platform_data = &scif5_platform_data,
311 },
312};
313
314/* SCIFA6 */
315static struct plat_sci_port scif6_platform_data = {
316 .mapbase = 0xe6cc0000,
317 .flags = UPF_BOOT_AUTOCONF,
318 .scscr = SCSCR_RE | SCSCR_TE,
319 .scbrr_algo_id = SCBRR_ALGO_4,
320 .type = PORT_SCIFA,
321 .irqs = SCIx_IRQ_MUXED(gic_spi(106)),
322};
323
324static struct platform_device scif6_device = {
325 .name = "sh-sci",
326 .id = 6,
327 .dev = {
328 .platform_data = &scif6_platform_data,
329 },
330};
331
332/* SCIFA7 */
333static struct plat_sci_port scif7_platform_data = {
334 .mapbase = 0xe6cd0000,
335 .flags = UPF_BOOT_AUTOCONF,
336 .scscr = SCSCR_RE | SCSCR_TE,
337 .scbrr_algo_id = SCBRR_ALGO_4,
338 .type = PORT_SCIFA,
339 .irqs = SCIx_IRQ_MUXED(gic_spi(107)),
340};
341
342static struct platform_device scif7_device = {
343 .name = "sh-sci",
344 .id = 7,
345 .dev = {
346 .platform_data = &scif7_platform_data,
347 },
348};
349
350/* SCIFB */
351static struct plat_sci_port scifb_platform_data = {
352 .mapbase = 0xe6c30000,
353 .flags = UPF_BOOT_AUTOCONF,
354 .scscr = SCSCR_RE | SCSCR_TE,
355 .scbrr_algo_id = SCBRR_ALGO_4,
356 .type = PORT_SCIFB,
357 .irqs = SCIx_IRQ_MUXED(gic_spi(108)),
358};
359 224
360static struct platform_device scifb_device = { 225R8A7740_SCIF(PORT_SCIFA, 0, 0xe6c40000, gic_spi(100));
361 .name = "sh-sci", 226R8A7740_SCIF(PORT_SCIFA, 1, 0xe6c50000, gic_spi(101));
362 .id = 8, 227R8A7740_SCIF(PORT_SCIFA, 2, 0xe6c60000, gic_spi(102));
363 .dev = { 228R8A7740_SCIF(PORT_SCIFA, 3, 0xe6c70000, gic_spi(103));
364 .platform_data = &scifb_platform_data, 229R8A7740_SCIF(PORT_SCIFA, 4, 0xe6c80000, gic_spi(104));
365 }, 230R8A7740_SCIF(PORT_SCIFA, 5, 0xe6cb0000, gic_spi(105));
366}; 231R8A7740_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(106));
232R8A7740_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(107));
233R8A7740_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(108));
367 234
368/* CMT */ 235/* CMT */
369static struct sh_timer_config cmt10_platform_data = { 236static struct sh_timer_config cmt10_platform_data = {
@@ -528,7 +395,7 @@ static struct platform_device *r8a7740_devices_dt[] __initdata = {
528 &scif5_device, 395 &scif5_device,
529 &scif6_device, 396 &scif6_device,
530 &scif7_device, 397 &scif7_device,
531 &scifb_device, 398 &scif8_device,
532 &cmt10_device, 399 &cmt10_device,
533}; 400};
534 401
@@ -981,7 +848,7 @@ void __init r8a7740_add_standard_devices(void)
981 rmobile_add_device_to_domain("A3SP", &scif5_device); 848 rmobile_add_device_to_domain("A3SP", &scif5_device);
982 rmobile_add_device_to_domain("A3SP", &scif6_device); 849 rmobile_add_device_to_domain("A3SP", &scif6_device);
983 rmobile_add_device_to_domain("A3SP", &scif7_device); 850 rmobile_add_device_to_domain("A3SP", &scif7_device);
984 rmobile_add_device_to_domain("A3SP", &scifb_device); 851 rmobile_add_device_to_domain("A3SP", &scif8_device);
985 rmobile_add_device_to_domain("A3SP", &i2c1_device); 852 rmobile_add_device_to_domain("A3SP", &i2c1_device);
986} 853}
987 854