diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-02-04 16:13:52 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-02-08 05:47:01 -0500 |
commit | 9309b2ba54d9082b8eb2ce641ad395cf5d9929f4 (patch) | |
tree | 175d4e867b9266d0f8c322ba2e63ac67315a933a /arch/arm/mach-mx2 | |
parent | 2b84a3640ffdebbbea3ec004eae963e920c16e1a (diff) |
arm/mx2: use cpp magic to create imx-i2c 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.c | 54 | ||||
-rw-r--r-- | arch/arm/mach-mx2/devices.h | 2 |
2 files changed, 22 insertions, 34 deletions
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c index 6efd86242630..b32dfa045088 100644 --- a/arch/arm/mach-mx2/devices.c +++ b/arch/arm/mach-mx2/devices.c | |||
@@ -213,44 +213,30 @@ struct platform_device mxc_fec_device = { | |||
213 | }; | 213 | }; |
214 | #endif | 214 | #endif |
215 | 215 | ||
216 | static struct resource mxc_i2c_1_resources[] = { | 216 | #define DEFINE_IMX_I2C_DEVICE(n, baseaddr, irq) \ |
217 | { | 217 | static struct resource mxc_i2c_resources ## n[] = { \ |
218 | .start = I2C_BASE_ADDR, | 218 | { \ |
219 | .end = I2C_BASE_ADDR + 0x0fff, | 219 | .start = baseaddr, \ |
220 | .flags = IORESOURCE_MEM, | 220 | .end = baseaddr + SZ_4K - 1, \ |
221 | }, { | 221 | .flags = IORESOURCE_MEM, \ |
222 | .start = MXC_INT_I2C, | 222 | }, { \ |
223 | .end = MXC_INT_I2C, | 223 | .start = irq, \ |
224 | .flags = IORESOURCE_IRQ, | 224 | .end = irq, \ |
225 | .flags = IORESOURCE_IRQ, \ | ||
226 | } \ | ||
227 | }; \ | ||
228 | \ | ||
229 | struct platform_device mxc_i2c_device ## n = { \ | ||
230 | .name = "imx-i2c", \ | ||
231 | .id = n, \ | ||
232 | .num_resources = ARRAY_SIZE(mxc_i2c_resources ## n), \ | ||
233 | .resource = mxc_i2c_resources ## n, \ | ||
225 | } | 234 | } |
226 | }; | ||
227 | 235 | ||
228 | struct platform_device mxc_i2c_device0 = { | 236 | DEFINE_IMX_I2C_DEVICE(0, MX2x_I2C_BASE_ADDR, MX2x_INT_I2C); |
229 | .name = "imx-i2c", | ||
230 | .id = 0, | ||
231 | .num_resources = ARRAY_SIZE(mxc_i2c_1_resources), | ||
232 | .resource = mxc_i2c_1_resources, | ||
233 | }; | ||
234 | 237 | ||
235 | #ifdef CONFIG_MACH_MX27 | 238 | #ifdef CONFIG_MACH_MX27 |
236 | static struct resource mxc_i2c_2_resources[] = { | 239 | DEFINE_IMX_I2C_DEVICE(1, MX27_I2C2_BASE_ADDR, MX27_INT_I2C2); |
237 | { | ||
238 | .start = I2C2_BASE_ADDR, | ||
239 | .end = I2C2_BASE_ADDR + 0x0fff, | ||
240 | .flags = IORESOURCE_MEM, | ||
241 | }, { | ||
242 | .start = MXC_INT_I2C2, | ||
243 | .end = MXC_INT_I2C2, | ||
244 | .flags = IORESOURCE_IRQ, | ||
245 | } | ||
246 | }; | ||
247 | |||
248 | struct platform_device mxc_i2c_device1 = { | ||
249 | .name = "imx-i2c", | ||
250 | .id = 1, | ||
251 | .num_resources = ARRAY_SIZE(mxc_i2c_2_resources), | ||
252 | .resource = mxc_i2c_2_resources, | ||
253 | }; | ||
254 | #endif | 240 | #endif |
255 | 241 | ||
256 | static struct resource mxc_pwm_resources[] = { | 242 | static struct resource mxc_pwm_resources[] = { |
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h index a0c6e1ad22d2..0dee0f5e681c 100644 --- a/arch/arm/mach-mx2/devices.h +++ b/arch/arm/mach-mx2/devices.h | |||
@@ -18,7 +18,9 @@ extern struct platform_device mxc_fb_device; | |||
18 | extern struct platform_device mxc_fec_device; | 18 | extern struct platform_device mxc_fec_device; |
19 | extern struct platform_device mxc_pwm_device; | 19 | extern struct platform_device mxc_pwm_device; |
20 | extern struct platform_device mxc_i2c_device0; | 20 | extern struct platform_device mxc_i2c_device0; |
21 | #ifdef CONFIG_MACH_MX27 | ||
21 | extern struct platform_device mxc_i2c_device1; | 22 | extern struct platform_device mxc_i2c_device1; |
23 | #endif | ||
22 | extern struct platform_device mxc_sdhc_device0; | 24 | extern struct platform_device mxc_sdhc_device0; |
23 | extern struct platform_device mxc_sdhc_device1; | 25 | extern struct platform_device mxc_sdhc_device1; |
24 | extern struct platform_device mxc_otg_udc_device; | 26 | extern struct platform_device mxc_otg_udc_device; |