diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-02-05 04:46:56 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-02-08 05:47:02 -0500 |
commit | ccd0e42c827666e91296b6395b7b7b04fb8c8803 (patch) | |
tree | a55c76c359499526c2dce0b127d0d9e9b9c04b15 | |
parent | 9309b2ba54d9082b8eb2ce641ad395cf5d9929f4 (diff) |
arm/mx2: use cpp magic to create imx-mmc 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>
-rw-r--r-- | arch/arm/mach-mx2/devices.c | 87 |
1 files changed, 31 insertions, 56 deletions
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c index b32dfa045088..71fd2c5e8a0d 100644 --- a/arch/arm/mach-mx2/devices.c +++ b/arch/arm/mach-mx2/devices.c | |||
@@ -261,63 +261,38 @@ struct platform_device mxc_pwm_device = { | |||
261 | /* | 261 | /* |
262 | * Resource definition for the MXC SDHC | 262 | * Resource definition for the MXC SDHC |
263 | */ | 263 | */ |
264 | static struct resource mxc_sdhc1_resources[] = { | 264 | #define DEFINE_MXC_MMC_DEVICE(n, baseaddr, irq, dmareq) \ |
265 | { | 265 | static struct resource mxc_sdhc_resources ## n[] = { \ |
266 | .start = SDHC1_BASE_ADDR, | 266 | { \ |
267 | .end = SDHC1_BASE_ADDR + SZ_4K - 1, | 267 | .start = baseaddr, \ |
268 | .flags = IORESOURCE_MEM, | 268 | .end = baseaddr + SZ_4K - 1, \ |
269 | }, { | 269 | .flags = IORESOURCE_MEM, \ |
270 | .start = MXC_INT_SDHC1, | 270 | }, { \ |
271 | .end = MXC_INT_SDHC1, | 271 | .start = irq, \ |
272 | .flags = IORESOURCE_IRQ, | 272 | .end = irq, \ |
273 | }, { | 273 | .flags = IORESOURCE_IRQ, \ |
274 | .start = DMA_REQ_SDHC1, | 274 | }, { \ |
275 | .end = DMA_REQ_SDHC1, | 275 | .start = dmareq, \ |
276 | .flags = IORESOURCE_DMA, | 276 | .end = dmareq, \ |
277 | }, | 277 | .flags = IORESOURCE_DMA, \ |
278 | }; | 278 | }, \ |
279 | 279 | }; \ | |
280 | static u64 mxc_sdhc1_dmamask = 0xffffffffUL; | 280 | \ |
281 | 281 | static u64 mxc_sdhc ## n ## _dmamask = 0xffffffffUL; \ | |
282 | struct platform_device mxc_sdhc_device0 = { | 282 | \ |
283 | .name = "mxc-mmc", | 283 | struct platform_device mxc_sdhc_device ## n = { \ |
284 | .id = 0, | 284 | .name = "mxc-mmc", \ |
285 | .dev = { | 285 | .id = n, \ |
286 | .dma_mask = &mxc_sdhc1_dmamask, | 286 | .dev = { \ |
287 | .coherent_dma_mask = 0xffffffff, | 287 | .dma_mask = &mxc_sdhc ## n ## _dmamask, \ |
288 | }, | 288 | .coherent_dma_mask = 0xffffffff, \ |
289 | .num_resources = ARRAY_SIZE(mxc_sdhc1_resources), | 289 | }, \ |
290 | .resource = mxc_sdhc1_resources, | 290 | .num_resources = ARRAY_SIZE(mxc_sdhc_resources ## n), \ |
291 | }; | 291 | .resource = mxc_sdhc_resources ## n, \ |
292 | 292 | } | |
293 | static struct resource mxc_sdhc2_resources[] = { | ||
294 | { | ||
295 | .start = SDHC2_BASE_ADDR, | ||
296 | .end = SDHC2_BASE_ADDR + SZ_4K - 1, | ||
297 | .flags = IORESOURCE_MEM, | ||
298 | }, { | ||
299 | .start = MXC_INT_SDHC2, | ||
300 | .end = MXC_INT_SDHC2, | ||
301 | .flags = IORESOURCE_IRQ, | ||
302 | }, { | ||
303 | .start = DMA_REQ_SDHC2, | ||
304 | .end = DMA_REQ_SDHC2, | ||
305 | .flags = IORESOURCE_DMA, | ||
306 | }, | ||
307 | }; | ||
308 | 293 | ||
309 | static u64 mxc_sdhc2_dmamask = 0xffffffffUL; | 294 | DEFINE_MXC_MMC_DEVICE(0, MX2x_SDHC1_BASE_ADDR, MX2x_INT_SDHC1, MX2x_DMA_REQ_SDHC1); |
310 | 295 | DEFINE_MXC_MMC_DEVICE(1, MX2x_SDHC2_BASE_ADDR, MX2x_INT_SDHC2, MX2x_DMA_REQ_SDHC2); | |
311 | struct platform_device mxc_sdhc_device1 = { | ||
312 | .name = "mxc-mmc", | ||
313 | .id = 1, | ||
314 | .dev = { | ||
315 | .dma_mask = &mxc_sdhc2_dmamask, | ||
316 | .coherent_dma_mask = 0xffffffff, | ||
317 | }, | ||
318 | .num_resources = ARRAY_SIZE(mxc_sdhc2_resources), | ||
319 | .resource = mxc_sdhc2_resources, | ||
320 | }; | ||
321 | 296 | ||
322 | #ifdef CONFIG_MACH_MX27 | 297 | #ifdef CONFIG_MACH_MX27 |
323 | static struct resource otg_resources[] = { | 298 | static struct resource otg_resources[] = { |