diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-02-04 16:04:32 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-02-08 05:47:00 -0500 |
commit | 68c94b40b31926f627573a7f656b903f6644744e (patch) | |
tree | 72e5a275ddaf6a2a62aff502b1675f7fd8642756 /arch | |
parent | e27bf72465f4d867a2aea33cad5e9e255c4d92ff (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')
-rw-r--r-- | arch/arm/mach-mx2/devices.c | 78 | ||||
-rw-r--r-- | arch/arm/mach-mx2/devices.h | 2 |
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 | */ |
49 | static 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 | }; \ | |
61 | static 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 | ||
74 | static 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 | |||
87 | struct 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 | ||
94 | struct platform_device mxc_spi_device1 = { | 69 | DEFINE_IMX_SPI_DEVICE(0, MX2x_CSPI1_BASE_ADDR, MX2x_INT_CSPI1); |
95 | .name = "spi_imx", | 70 | DEFINE_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 |
102 | struct platform_device mxc_spi_device2 = { | 73 | DEFINE_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; | |||
25 | extern struct platform_device mxc_usbh2; | 25 | extern struct platform_device mxc_usbh2; |
26 | extern struct platform_device mxc_spi_device0; | 26 | extern struct platform_device mxc_spi_device0; |
27 | extern struct platform_device mxc_spi_device1; | 27 | extern struct platform_device mxc_spi_device1; |
28 | #ifdef CONFIG_MACH_MX27 | ||
28 | extern struct platform_device mxc_spi_device2; | 29 | extern struct platform_device mxc_spi_device2; |
30 | #endif | ||
29 | extern struct platform_device imx_ssi_device0; | 31 | extern struct platform_device imx_ssi_device0; |
30 | extern struct platform_device imx_ssi_device1; | 32 | extern struct platform_device imx_ssi_device1; |