diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-02-05 06:03:37 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-02-08 05:47:03 -0500 |
commit | 69ddb488035068fce9a4ac4a63cffa91dfb3f37f (patch) | |
tree | 0c2ba1504d0664646679880e5837371032615022 /arch/arm/mach-mx2/devices.c | |
parent | ccd0e42c827666e91296b6395b7b7b04fb8c8803 (diff) |
arm/mx2: use cpp magic to create imx-ssi devices
This makes the source shorter and easier to verify. While at it switch
to use the SoC-prefixed constants.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx2/devices.c')
-rw-r--r-- | arch/arm/mach-mx2/devices.c | 107 |
1 files changed, 32 insertions, 75 deletions
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c index 71fd2c5e8a0d..bed0fdb43bb8 100644 --- a/arch/arm/mach-mx2/devices.c +++ b/arch/arm/mach-mx2/devices.c | |||
@@ -387,83 +387,40 @@ struct platform_device mxc_usbh2 = { | |||
387 | }; | 387 | }; |
388 | #endif | 388 | #endif |
389 | 389 | ||
390 | static struct resource imx_ssi_resources0[] = { | 390 | #define DEFINE_IMX_SSI_DMARES(_name, ssin, suffix) \ |
391 | { | 391 | { \ |
392 | .start = SSI1_BASE_ADDR, | 392 | .name = _name, \ |
393 | .end = SSI1_BASE_ADDR + 0x6F, | 393 | .start = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix, \ |
394 | .flags = IORESOURCE_MEM, | 394 | .end = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix, \ |
395 | }, { | 395 | .flags = IORESOURCE_DMA, \ |
396 | .start = MXC_INT_SSI1, | 396 | } |
397 | .end = MXC_INT_SSI1, | ||
398 | .flags = IORESOURCE_IRQ, | ||
399 | }, { | ||
400 | .name = "tx0", | ||
401 | .start = DMA_REQ_SSI1_TX0, | ||
402 | .end = DMA_REQ_SSI1_TX0, | ||
403 | .flags = IORESOURCE_DMA, | ||
404 | }, { | ||
405 | .name = "rx0", | ||
406 | .start = DMA_REQ_SSI1_RX0, | ||
407 | .end = DMA_REQ_SSI1_RX0, | ||
408 | .flags = IORESOURCE_DMA, | ||
409 | }, { | ||
410 | .name = "tx1", | ||
411 | .start = DMA_REQ_SSI1_TX1, | ||
412 | .end = DMA_REQ_SSI1_TX1, | ||
413 | .flags = IORESOURCE_DMA, | ||
414 | }, { | ||
415 | .name = "rx1", | ||
416 | .start = DMA_REQ_SSI1_RX1, | ||
417 | .end = DMA_REQ_SSI1_RX1, | ||
418 | .flags = IORESOURCE_DMA, | ||
419 | }, | ||
420 | }; | ||
421 | |||
422 | static struct resource imx_ssi_resources1[] = { | ||
423 | { | ||
424 | .start = SSI2_BASE_ADDR, | ||
425 | .end = SSI2_BASE_ADDR + 0x6F, | ||
426 | .flags = IORESOURCE_MEM, | ||
427 | }, { | ||
428 | .start = MXC_INT_SSI2, | ||
429 | .end = MXC_INT_SSI2, | ||
430 | .flags = IORESOURCE_IRQ, | ||
431 | }, { | ||
432 | .name = "tx0", | ||
433 | .start = DMA_REQ_SSI2_TX0, | ||
434 | .end = DMA_REQ_SSI2_TX0, | ||
435 | .flags = IORESOURCE_DMA, | ||
436 | }, { | ||
437 | .name = "rx0", | ||
438 | .start = DMA_REQ_SSI2_RX0, | ||
439 | .end = DMA_REQ_SSI2_RX0, | ||
440 | .flags = IORESOURCE_DMA, | ||
441 | }, { | ||
442 | .name = "tx1", | ||
443 | .start = DMA_REQ_SSI2_TX1, | ||
444 | .end = DMA_REQ_SSI2_TX1, | ||
445 | .flags = IORESOURCE_DMA, | ||
446 | }, { | ||
447 | .name = "rx1", | ||
448 | .start = DMA_REQ_SSI2_RX1, | ||
449 | .end = DMA_REQ_SSI2_RX1, | ||
450 | .flags = IORESOURCE_DMA, | ||
451 | }, | ||
452 | }; | ||
453 | 397 | ||
454 | struct platform_device imx_ssi_device0 = { | 398 | #define DEFINE_IMX_SSI_DEVICE(n, ssin, baseaddr, irq) \ |
455 | .name = "imx-ssi", | 399 | static struct resource imx_ssi_resources ## n[] = { \ |
456 | .id = 0, | 400 | { \ |
457 | .num_resources = ARRAY_SIZE(imx_ssi_resources0), | 401 | .start = MX2x_SSI ## ssin ## _BASE_ADDR, \ |
458 | .resource = imx_ssi_resources0, | 402 | .end = MX2x_SSI ## ssin ## _BASE_ADDR + 0x6f, \ |
459 | }; | 403 | .flags = IORESOURCE_MEM, \ |
404 | }, { \ | ||
405 | .start = MX2x_INT_SSI1, \ | ||
406 | .end = MX2x_INT_SSI1, \ | ||
407 | .flags = IORESOURCE_IRQ, \ | ||
408 | }, \ | ||
409 | DEFINE_IMX_SSI_DMARES("tx0", ssin, TX0), \ | ||
410 | DEFINE_IMX_SSI_DMARES("rx0", ssin, RX0), \ | ||
411 | DEFINE_IMX_SSI_DMARES("tx1", ssin, TX1), \ | ||
412 | DEFINE_IMX_SSI_DMARES("rx1", ssin, RX1), \ | ||
413 | }; \ | ||
414 | \ | ||
415 | struct platform_device imx_ssi_device ## n = { \ | ||
416 | .name = "imx-ssi", \ | ||
417 | .id = n, \ | ||
418 | .num_resources = ARRAY_SIZE(imx_ssi_resources ## n), \ | ||
419 | .resource = imx_ssi_resources ## n, \ | ||
420 | } | ||
460 | 421 | ||
461 | struct platform_device imx_ssi_device1 = { | 422 | DEFINE_IMX_SSI_DEVICE(0, 1, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1); |
462 | .name = "imx-ssi", | 423 | DEFINE_IMX_SSI_DEVICE(1, 2, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1); |
463 | .id = 1, | ||
464 | .num_resources = ARRAY_SIZE(imx_ssi_resources1), | ||
465 | .resource = imx_ssi_resources1, | ||
466 | }; | ||
467 | 424 | ||
468 | /* GPIO port description */ | 425 | /* GPIO port description */ |
469 | static struct mxc_gpio_port imx_gpio_ports[] = { | 426 | static struct mxc_gpio_port imx_gpio_ports[] = { |