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>
This commit is contained in:
Uwe Kleine-König 2010-02-05 12:03:37 +01:00
parent ccd0e42c82
commit 69ddb48803
1 changed files with 32 additions and 75 deletions

View File

@ -387,83 +387,40 @@ struct platform_device mxc_usbh2 = {
}; };
#endif #endif
static struct resource imx_ssi_resources0[] = { #define DEFINE_IMX_SSI_DMARES(_name, ssin, suffix) \
{ { \
.start = SSI1_BASE_ADDR, .name = _name, \
.end = SSI1_BASE_ADDR + 0x6F, .start = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix, \
.flags = IORESOURCE_MEM, .end = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix, \
}, { .flags = IORESOURCE_DMA, \
.start = MXC_INT_SSI1, }
.end = MXC_INT_SSI1,
.flags = IORESOURCE_IRQ,
}, {
.name = "tx0",
.start = DMA_REQ_SSI1_TX0,
.end = DMA_REQ_SSI1_TX0,
.flags = IORESOURCE_DMA,
}, {
.name = "rx0",
.start = DMA_REQ_SSI1_RX0,
.end = DMA_REQ_SSI1_RX0,
.flags = IORESOURCE_DMA,
}, {
.name = "tx1",
.start = DMA_REQ_SSI1_TX1,
.end = DMA_REQ_SSI1_TX1,
.flags = IORESOURCE_DMA,
}, {
.name = "rx1",
.start = DMA_REQ_SSI1_RX1,
.end = DMA_REQ_SSI1_RX1,
.flags = IORESOURCE_DMA,
},
};
static struct resource imx_ssi_resources1[] = { #define DEFINE_IMX_SSI_DEVICE(n, ssin, baseaddr, irq) \
{ static struct resource imx_ssi_resources ## n[] = { \
.start = SSI2_BASE_ADDR, { \
.end = SSI2_BASE_ADDR + 0x6F, .start = MX2x_SSI ## ssin ## _BASE_ADDR, \
.flags = IORESOURCE_MEM, .end = MX2x_SSI ## ssin ## _BASE_ADDR + 0x6f, \
}, { .flags = IORESOURCE_MEM, \
.start = MXC_INT_SSI2, }, { \
.end = MXC_INT_SSI2, .start = MX2x_INT_SSI1, \
.flags = IORESOURCE_IRQ, .end = MX2x_INT_SSI1, \
}, { .flags = IORESOURCE_IRQ, \
.name = "tx0", }, \
.start = DMA_REQ_SSI2_TX0, DEFINE_IMX_SSI_DMARES("tx0", ssin, TX0), \
.end = DMA_REQ_SSI2_TX0, DEFINE_IMX_SSI_DMARES("rx0", ssin, RX0), \
.flags = IORESOURCE_DMA, DEFINE_IMX_SSI_DMARES("tx1", ssin, TX1), \
}, { DEFINE_IMX_SSI_DMARES("rx1", ssin, RX1), \
.name = "rx0", }; \
.start = DMA_REQ_SSI2_RX0, \
.end = DMA_REQ_SSI2_RX0, struct platform_device imx_ssi_device ## n = { \
.flags = IORESOURCE_DMA, .name = "imx-ssi", \
}, { .id = n, \
.name = "tx1", .num_resources = ARRAY_SIZE(imx_ssi_resources ## n), \
.start = DMA_REQ_SSI2_TX1, .resource = imx_ssi_resources ## n, \
.end = DMA_REQ_SSI2_TX1, }
.flags = IORESOURCE_DMA,
}, {
.name = "rx1",
.start = DMA_REQ_SSI2_RX1,
.end = DMA_REQ_SSI2_RX1,
.flags = IORESOURCE_DMA,
},
};
struct platform_device imx_ssi_device0 = { DEFINE_IMX_SSI_DEVICE(0, 1, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
.name = "imx-ssi", DEFINE_IMX_SSI_DEVICE(1, 2, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
.id = 0,
.num_resources = ARRAY_SIZE(imx_ssi_resources0),
.resource = imx_ssi_resources0,
};
struct platform_device imx_ssi_device1 = {
.name = "imx-ssi",
.id = 1,
.num_resources = ARRAY_SIZE(imx_ssi_resources1),
.resource = imx_ssi_resources1,
};
/* GPIO port description */ /* GPIO port description */
static struct mxc_gpio_port imx_gpio_ports[] = { static struct mxc_gpio_port imx_gpio_ports[] = {