aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx2
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-02-05 10:57:59 -0500
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-02-15 11:03:55 -0500
commitf0d3ab49110327516b7f0b6d27fd33d6fa079d6c (patch)
tree7051a360d446e50be6ddb9366f68aa483915ddf4 /arch/arm/mach-mx2
parent58152a16901dfce8662f5ec7e16d06dfce6fd31e (diff)
arm/mx2: define seperate imx_nand devices for imx21 and imx27
As the NFC controller has different addresses on imx21 and imx27 there are two different devices needed if not relying on the overloaded cpp macro NFC_BASE_ADDR. So some cpp magic is added to minimize code duplication. As obviously these two defines need different names, the name of the old device is #defined to the new one when building for only one of imx21 or imx27. 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.c43
-rw-r--r--arch/arm/mach-mx2/devices.h11
2 files changed, 36 insertions, 18 deletions
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c
index 9bf49da53072..cda4aced7a39 100644
--- a/arch/arm/mach-mx2/devices.c
+++ b/arch/arm/mach-mx2/devices.c
@@ -144,24 +144,33 @@ struct platform_device mxc_w1_master_device = {
144 .resource = mxc_w1_master_resources, 144 .resource = mxc_w1_master_resources,
145}; 145};
146 146
147static struct resource mxc_nand_resources[] = { 147#define DEFINE_MXC_NAND_DEVICE(pfx, baseaddr, irq) \
148 { 148 static struct resource pfx ## _nand_resources[] = { \
149 .start = NFC_BASE_ADDR, 149 { \
150 .end = NFC_BASE_ADDR + SZ_4K - 1, 150 .start = baseaddr, \
151 .flags = IORESOURCE_MEM, 151 .end = baseaddr + SZ_4K - 1, \
152 }, { 152 .flags = IORESOURCE_MEM, \
153 .start = MX2x_INT_NANDFC, 153 }, { \
154 .end = MX2x_INT_NANDFC, 154 .start = irq, \
155 .flags = IORESOURCE_IRQ, 155 .end = irq, \
156 }, 156 .flags = IORESOURCE_IRQ, \
157}; 157 }, \
158 }; \
159 \
160 struct platform_device pfx ## _nand_device = { \
161 .name = "mxc_nand", \
162 .id = 0, \
163 .num_resources = ARRAY_SIZE(pfx ## _nand_resources), \
164 .resource = pfx ## _nand_resources, \
165 }
158 166
159struct platform_device mxc_nand_device = { 167#ifdef CONFIG_MACH_MX21
160 .name = "mxc_nand", 168DEFINE_MXC_NAND_DEVICE(imx21, MX21_NFC_BASE_ADDR, MX21_INT_NANDFC);
161 .id = 0, 169#endif
162 .num_resources = ARRAY_SIZE(mxc_nand_resources), 170
163 .resource = mxc_nand_resources, 171#ifdef CONFIG_MACH_MX27
164}; 172DEFINE_MXC_NAND_DEVICE(imx27, MX27_NFC_BASE_ADDR, MX27_INT_NANDFC);
173#endif
165 174
166/* 175/*
167 * lcdc: 176 * lcdc:
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h
index 0dee0f5e681c..02e5dd203095 100644
--- a/arch/arm/mach-mx2/devices.h
+++ b/arch/arm/mach-mx2/devices.h
@@ -13,7 +13,16 @@ extern struct platform_device mxc_uart_device3;
13extern struct platform_device mxc_uart_device4; 13extern struct platform_device mxc_uart_device4;
14extern struct platform_device mxc_uart_device5; 14extern struct platform_device mxc_uart_device5;
15extern struct platform_device mxc_w1_master_device; 15extern struct platform_device mxc_w1_master_device;
16extern struct platform_device mxc_nand_device; 16#ifdef CONFIG_MACH_MX21
17extern struct platform_device imx21_nand_device;
18#define mxc_nand_device imx21_nand_device
19#endif
20#ifdef CONFIG_MACH_MX27
21extern struct platform_device imx27_nand_device;
22#ifndef CONFIG_MACH_MX21
23#define mxc_nand_device imx27_nand_device
24#endif
25#endif
17extern struct platform_device mxc_fb_device; 26extern struct platform_device mxc_fb_device;
18extern struct platform_device mxc_fec_device; 27extern struct platform_device mxc_fec_device;
19extern struct platform_device mxc_pwm_device; 28extern struct platform_device mxc_pwm_device;