aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx2
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-02-04 16:04:32 -0500
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-02-08 05:47:00 -0500
commit68c94b40b31926f627573a7f656b903f6644744e (patch)
tree72e5a275ddaf6a2a62aff502b1675f7fd8642756 /arch/arm/mach-mx2
parente27bf72465f4d867a2aea33cad5e9e255c4d92ff (diff)
arm/mx2: use cpp magic to create spi_imx 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')
-rw-r--r--arch/arm/mach-mx2/devices.c78
-rw-r--r--arch/arm/mach-mx2/devices.h2
2 files changed, 24 insertions, 56 deletions
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c
index 3d398ce09b31..ce164a315ee7 100644
--- a/arch/arm/mach-mx2/devices.c
+++ b/arch/arm/mach-mx2/devices.c
@@ -46,65 +46,31 @@
46 * - i.MX21: 2 channel 46 * - i.MX21: 2 channel
47 * - i.MX27: 3 channel 47 * - i.MX27: 3 channel
48 */ 48 */
49static struct resource mxc_spi_resources0[] = { 49#define DEFINE_IMX_SPI_DEVICE(n, baseaddr, irq) \
50 { 50 static struct resource mxc_spi_resources ## n[] = { \
51 .start = CSPI1_BASE_ADDR, 51 { \
52 .end = CSPI1_BASE_ADDR + SZ_4K - 1, 52 .start = baseaddr, \
53 .flags = IORESOURCE_MEM, 53 .end = baseaddr + SZ_4K - 1, \
54 }, { 54 .flags = IORESOURCE_MEM, \
55 .start = MXC_INT_CSPI1, 55 }, { \
56 .end = MXC_INT_CSPI1, 56 .start = irq, \
57 .flags = IORESOURCE_IRQ, 57 .end = irq, \
58 }, 58 .flags = IORESOURCE_IRQ, \
59}; 59 }, \
60 60 }; \
61static struct resource mxc_spi_resources1[] = { 61 \
62 { 62 struct platform_device mxc_spi_device ## n = { \
63 .start = CSPI2_BASE_ADDR, 63 .name = "spi_imx", \
64 .end = CSPI2_BASE_ADDR + SZ_4K - 1, 64 .id = n, \
65 .flags = IORESOURCE_MEM, 65 .num_resources = ARRAY_SIZE(mxc_spi_resources ## n), \
66 }, { 66 .resource = mxc_spi_resources ## n, \
67 .start = MXC_INT_CSPI2, 67 }
68 .end = MXC_INT_CSPI2,
69 .flags = IORESOURCE_IRQ,
70 },
71};
72
73#ifdef CONFIG_MACH_MX27
74static struct resource mxc_spi_resources2[] = {
75 {
76 .start = CSPI3_BASE_ADDR,
77 .end = CSPI3_BASE_ADDR + SZ_4K - 1,
78 .flags = IORESOURCE_MEM,
79 }, {
80 .start = MXC_INT_CSPI3,
81 .end = MXC_INT_CSPI3,
82 .flags = IORESOURCE_IRQ,
83 },
84};
85#endif
86
87struct platform_device mxc_spi_device0 = {
88 .name = "spi_imx",
89 .id = 0,
90 .num_resources = ARRAY_SIZE(mxc_spi_resources0),
91 .resource = mxc_spi_resources0,
92};
93 68
94struct platform_device mxc_spi_device1 = { 69DEFINE_IMX_SPI_DEVICE(0, MX2x_CSPI1_BASE_ADDR, MX2x_INT_CSPI1);
95 .name = "spi_imx", 70DEFINE_IMX_SPI_DEVICE(1, MX2x_CSPI2_BASE_ADDR, MX2x_INT_CSPI2);
96 .id = 1,
97 .num_resources = ARRAY_SIZE(mxc_spi_resources1),
98 .resource = mxc_spi_resources1,
99};
100 71
101#ifdef CONFIG_MACH_MX27 72#ifdef CONFIG_MACH_MX27
102struct platform_device mxc_spi_device2 = { 73DEFINE_IMX_SPI_DEVICE(2, MX27_CSPI3_BASE_ADDR, MX27_INT_CSPI3);
103 .name = "spi_imx",
104 .id = 2,
105 .num_resources = ARRAY_SIZE(mxc_spi_resources2),
106 .resource = mxc_spi_resources2,
107};
108#endif 74#endif
109 75
110/* 76/*
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h
index 97306aa18f1c..e13a352f0b8a 100644
--- a/arch/arm/mach-mx2/devices.h
+++ b/arch/arm/mach-mx2/devices.h
@@ -25,6 +25,8 @@ extern struct platform_device mxc_usbh1;
25extern struct platform_device mxc_usbh2; 25extern struct platform_device mxc_usbh2;
26extern struct platform_device mxc_spi_device0; 26extern struct platform_device mxc_spi_device0;
27extern struct platform_device mxc_spi_device1; 27extern struct platform_device mxc_spi_device1;
28#ifdef CONFIG_MACH_MX27
28extern struct platform_device mxc_spi_device2; 29extern struct platform_device mxc_spi_device2;
30#endif
29extern struct platform_device imx_ssi_device0; 31extern struct platform_device imx_ssi_device0;
30extern struct platform_device imx_ssi_device1; 32extern struct platform_device imx_ssi_device1;