aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-08-23 05:25:52 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2010-10-01 03:33:02 -0400
commit00b57bf9786ca701508333112c8917d1e0860129 (patch)
treee38e028c40d92da2ffad8154bc6d9352d2672eb3 /arch/arm/plat-mxc
parent40e2eda92178f58fd7da2866d3f346dcd2baafed (diff)
ARM: imx: reorganize nand registration to use a struct
Addiontionally make the interrupt #defines match the base address defines MX.._NFC_BASE_ADDR. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/plat-mxc')
-rw-r--r--arch/arm/plat-mxc/devices/platform-mxc_nand.c64
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h12
-rw-r--r--arch/arm/plat-mxc/include/mach/mx21.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/mx25.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/mx27.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/mx35.h2
7 files changed, 54 insertions, 32 deletions
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_nand.c b/arch/arm/plat-mxc/devices/platform-mxc_nand.c
index 1c286418d123..6d3a4785f95b 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_nand.c
+++ b/arch/arm/plat-mxc/devices/platform-mxc_nand.c
@@ -7,38 +7,56 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <asm/sizes.h> 9#include <asm/sizes.h>
10#include <mach/hardware.h>
10#include <mach/devices-common.h> 11#include <mach/devices-common.h>
11 12
12static struct platform_device *__init imx_add_mxc_nand(resource_size_t iobase, 13#define imx_mxc_nand_data_entry_single(soc, _size) \
13 int irq, const struct mxc_nand_platform_data *pdata, 14 { \
14 resource_size_t iosize) 15 .iobase = soc ## _NFC_BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_NFC \
18 }
19
20#ifdef CONFIG_SOC_IMX21
21const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
22 imx_mxc_nand_data_entry_single(MX21, SZ_4K);
23#endif /* ifdef CONFIG_SOC_IMX21 */
24
25#ifdef CONFIG_ARCH_MX25
26const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
27 imx_mxc_nand_data_entry_single(MX25, SZ_8K);
28#endif /* ifdef CONFIG_ARCH_MX25 */
29
30#ifdef CONFIG_SOC_IMX27
31const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
32 imx_mxc_nand_data_entry_single(MX27, SZ_4K);
33#endif /* ifdef CONFIG_SOC_IMX27 */
34
35#ifdef CONFIG_ARCH_MX31
36const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
37 imx_mxc_nand_data_entry_single(MX31, SZ_4K);
38#endif
39
40#ifdef CONFIG_ARCH_MX35
41const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
42 imx_mxc_nand_data_entry_single(MX35, SZ_8K);
43#endif
44
45struct platform_device *__init imx_add_mxc_nand(
46 const struct imx_mxc_nand_data *data,
47 const struct mxc_nand_platform_data *pdata)
15{ 48{
16 static int id = 0;
17
18 struct resource res[] = { 49 struct resource res[] = {
19 { 50 {
20 .start = iobase, 51 .start = data->iobase,
21 .end = iobase + iosize - 1, 52 .end = data->iobase + data->iosize - 1,
22 .flags = IORESOURCE_MEM, 53 .flags = IORESOURCE_MEM,
23 }, { 54 }, {
24 .start = irq, 55 .start = data->irq,
25 .end = irq, 56 .end = data->irq,
26 .flags = IORESOURCE_IRQ, 57 .flags = IORESOURCE_IRQ,
27 }, 58 },
28 }; 59 };
29 60 return imx_add_platform_device("mxc_nand", 0, res, ARRAY_SIZE(res),
30 return imx_add_platform_device("mxc_nand", id++, res, ARRAY_SIZE(res),
31 pdata, sizeof(*pdata)); 61 pdata, sizeof(*pdata));
32} 62}
33
34struct platform_device *__init imx_add_mxc_nand_v1(resource_size_t iobase,
35 int irq, const struct mxc_nand_platform_data *pdata)
36{
37 return imx_add_mxc_nand(iobase, irq, pdata, SZ_4K);
38}
39
40struct platform_device *__init imx_add_mxc_nand_v21(resource_size_t iobase,
41 int irq, const struct mxc_nand_platform_data *pdata)
42{
43 return imx_add_mxc_nand(iobase, irq, pdata, SZ_8K);
44}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 32b8f3674cc9..371336ee9d7f 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -70,10 +70,14 @@ struct platform_device *__init imx_add_imx_uart_1irq(
70 const struct imxuart_platform_data *pdata); 70 const struct imxuart_platform_data *pdata);
71 71
72#include <mach/mxc_nand.h> 72#include <mach/mxc_nand.h>
73struct platform_device *__init imx_add_mxc_nand_v1(resource_size_t iobase, 73struct imx_mxc_nand_data {
74 int irq, const struct mxc_nand_platform_data *pdata); 74 resource_size_t iobase;
75struct platform_device *__init imx_add_mxc_nand_v21(resource_size_t iobase, 75 resource_size_t iosize;
76 int irq, const struct mxc_nand_platform_data *pdata); 76 resource_size_t irq;
77};
78struct platform_device *__init imx_add_mxc_nand(
79 const struct imx_mxc_nand_data *data,
80 const struct mxc_nand_platform_data *pdata);
77 81
78#include <mach/spi.h> 82#include <mach/spi.h>
79struct imx_spi_imx_data { 83struct imx_spi_imx_data {
diff --git a/arch/arm/plat-mxc/include/mach/mx21.h b/arch/arm/plat-mxc/include/mach/mx21.h
index ed98b9c9f389..8bc59720b6e4 100644
--- a/arch/arm/plat-mxc/include/mach/mx21.h
+++ b/arch/arm/plat-mxc/include/mach/mx21.h
@@ -120,7 +120,7 @@
120#define MX21_INT_GPT1 26 120#define MX21_INT_GPT1 26
121#define MX21_INT_WDOG 27 121#define MX21_INT_WDOG 27
122#define MX21_INT_PCMCIA 28 122#define MX21_INT_PCMCIA 28
123#define MX21_INT_NANDFC 29 123#define MX21_INT_NFC 29
124#define MX21_INT_BMI 30 124#define MX21_INT_BMI 30
125#define MX21_INT_CSI 31 125#define MX21_INT_CSI 31
126#define MX21_INT_DMACH0 32 126#define MX21_INT_DMACH0 32
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h
index 8f809eb084df..a9e1095d7486 100644
--- a/arch/arm/plat-mxc/include/mach/mx25.h
+++ b/arch/arm/plat-mxc/include/mach/mx25.h
@@ -69,7 +69,7 @@
69#define MX25_INT_KPP 24 69#define MX25_INT_KPP 24
70#define MX25_INT_DRYICE 25 70#define MX25_INT_DRYICE 25
71#define MX25_INT_UART2 32 71#define MX25_INT_UART2 32
72#define MX25_INT_NANDFC 33 72#define MX25_INT_NFC 33
73#define MX25_INT_LCDC 39 73#define MX25_INT_LCDC 39
74#define MX25_INT_UART5 40 74#define MX25_INT_UART5 40
75#define MX25_INT_CAN1 43 75#define MX25_INT_CAN1 43
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/plat-mxc/include/mach/mx27.h
index a8ab2e02a8ca..2237ba2e5351 100644
--- a/arch/arm/plat-mxc/include/mach/mx27.h
+++ b/arch/arm/plat-mxc/include/mach/mx27.h
@@ -167,7 +167,7 @@ static inline void mx27_setup_weimcs(size_t cs,
167#define MX27_INT_GPT1 26 167#define MX27_INT_GPT1 26
168#define MX27_INT_WDOG 27 168#define MX27_INT_WDOG 27
169#define MX27_INT_PCMCIA 28 169#define MX27_INT_PCMCIA 28
170#define MX27_INT_NANDFC 29 170#define MX27_INT_NFC 29
171#define MX27_INT_ATA 30 171#define MX27_INT_ATA 30
172#define MX27_INT_CSI 31 172#define MX27_INT_CSI 31
173#define MX27_INT_DMACH0 32 173#define MX27_INT_DMACH0 32
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index eb8bbc7eedfa..03e2afabc9fc 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -168,7 +168,7 @@ static inline void mx31_setup_weimcs(size_t cs,
168#define MX31_INT_POWER_FAIL 30 168#define MX31_INT_POWER_FAIL 30
169#define MX31_INT_CCM_DVFS 31 169#define MX31_INT_CCM_DVFS 31
170#define MX31_INT_UART2 32 170#define MX31_INT_UART2 32
171#define MX31_INT_NANDFC 33 171#define MX31_INT_NFC 33
172#define MX31_INT_SDMA 34 172#define MX31_INT_SDMA 34
173#define MX31_INT_USB1 35 173#define MX31_INT_USB1 35
174#define MX31_INT_USB2 36 174#define MX31_INT_USB2 36
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/plat-mxc/include/mach/mx35.h
index 867b8c0ca105..9f0a1ee126ee 100644
--- a/arch/arm/plat-mxc/include/mach/mx35.h
+++ b/arch/arm/plat-mxc/include/mach/mx35.h
@@ -145,7 +145,7 @@
145#define MX35_INT_GPT 29 145#define MX35_INT_GPT 29
146#define MX35_INT_POWER_FAIL 30 146#define MX35_INT_POWER_FAIL 30
147#define MX35_INT_UART2 32 147#define MX35_INT_UART2 32
148#define MX35_INT_NANDFC 33 148#define MX35_INT_NFC 33
149#define MX35_INT_SDMA 34 149#define MX35_INT_SDMA 34
150#define MX35_INT_USBHS 35 150#define MX35_INT_USBHS 35
151#define MX35_INT_USBOTG 37 151#define MX35_INT_USBOTG 37