Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-btrfs-devel.git] / arch / arm / plat-mxc / devices / platform-mxc_nand.c
blob1568f39fba8bec5ee2b67e459bf861c62d406d29
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 #define imx_mxc_nandv3_data_entry_single(soc, _size) \
21 { \
22 .id = -1, \
23 .iobase = soc ## _NFC_BASE_ADDR, \
24 .iosize = _size, \
25 .axibase = soc ## _NFC_AXI_BASE_ADDR, \
26 .irq = soc ## _INT_NFC \
29 #ifdef CONFIG_SOC_IMX21
30 const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
31 imx_mxc_nand_data_entry_single(MX21, SZ_4K);
32 #endif /* ifdef CONFIG_SOC_IMX21 */
34 #ifdef CONFIG_SOC_IMX25
35 const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
36 imx_mxc_nand_data_entry_single(MX25, SZ_8K);
37 #endif /* ifdef CONFIG_SOC_IMX25 */
39 #ifdef CONFIG_SOC_IMX27
40 const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
41 imx_mxc_nand_data_entry_single(MX27, SZ_4K);
42 #endif /* ifdef CONFIG_SOC_IMX27 */
44 #ifdef CONFIG_SOC_IMX31
45 const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
46 imx_mxc_nand_data_entry_single(MX31, SZ_4K);
47 #endif
49 #ifdef CONFIG_SOC_IMX35
50 const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
51 imx_mxc_nand_data_entry_single(MX35, SZ_8K);
52 #endif
54 #ifdef CONFIG_SOC_IMX51
55 const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst =
56 imx_mxc_nandv3_data_entry_single(MX51, SZ_16K);
57 #endif
59 struct platform_device *__init imx_add_mxc_nand(
60 const struct imx_mxc_nand_data *data,
61 const struct mxc_nand_platform_data *pdata)
63 /* AXI has to come first, that's how the mxc_nand driver expect it */
64 struct resource res[] = {
66 .start = data->axibase,
67 .end = data->axibase + SZ_16K - 1,
68 .flags = IORESOURCE_MEM,
69 }, {
70 .start = data->iobase,
71 .end = data->iobase + data->iosize - 1,
72 .flags = IORESOURCE_MEM,
73 }, {
74 .start = data->irq,
75 .end = data->irq,
76 .flags = IORESOURCE_IRQ,
79 return imx_add_platform_device("mxc_nand", data->id,
80 res + !data->axibase,
81 ARRAY_SIZE(res) - !data->axibase,
82 pdata, sizeof(*pdata));