ARM: imx: reorganize nand registration to use a struct
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / plat-mxc / devices / platform-mxc_nand.c
blob6d3a4785f95bce45a7ff0b13a601927dc4c60074
1 /*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9 #include <asm/sizes.h>
10 #include <mach/hardware.h>
11 #include <mach/devices-common.h>
13 #define imx_mxc_nand_data_entry_single(soc, _size) \
14 { \
15 .iobase = soc ## _NFC_BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_NFC \
20 #ifdef CONFIG_SOC_IMX21
21 const 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 */
25 #ifdef CONFIG_ARCH_MX25
26 const 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 */
30 #ifdef CONFIG_SOC_IMX27
31 const 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 */
35 #ifdef CONFIG_ARCH_MX31
36 const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
37 imx_mxc_nand_data_entry_single(MX31, SZ_4K);
38 #endif
40 #ifdef CONFIG_ARCH_MX35
41 const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
42 imx_mxc_nand_data_entry_single(MX35, SZ_8K);
43 #endif
45 struct platform_device *__init imx_add_mxc_nand(
46 const struct imx_mxc_nand_data *data,
47 const struct mxc_nand_platform_data *pdata)
49 struct resource res[] = {
51 .start = data->iobase,
52 .end = data->iobase + data->iosize - 1,
53 .flags = IORESOURCE_MEM,
54 }, {
55 .start = data->irq,
56 .end = data->irq,
57 .flags = IORESOURCE_IRQ,
60 return imx_add_platform_device("mxc_nand", 0, res, ARRAY_SIZE(res),
61 pdata, sizeof(*pdata));