1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2009-2010 Pengutronix
4 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
6 #include <linux/sizes.h>
8 #include "../hardware.h"
9 #include "devices-common.h"
11 #define imx_mxc_nand_data_entry_single(soc, _devid, _size) \
14 .iobase = soc ## _NFC_BASE_ADDR, \
16 .irq = soc ## _INT_NFC \
19 #define imx_mxc_nandv3_data_entry_single(soc, _devid, _size) \
23 .iobase = soc ## _NFC_BASE_ADDR, \
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, "imx21-nand", SZ_4K);
32 #endif /* ifdef CONFIG_SOC_IMX21 */
34 #ifdef CONFIG_SOC_IMX27
35 const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
36 imx_mxc_nand_data_entry_single(MX27, "imx27-nand", SZ_4K);
37 #endif /* ifdef CONFIG_SOC_IMX27 */
39 #ifdef CONFIG_SOC_IMX31
40 const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
41 imx_mxc_nand_data_entry_single(MX31, "imx27-nand", SZ_4K);
44 #ifdef CONFIG_SOC_IMX35
45 const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
46 imx_mxc_nand_data_entry_single(MX35, "imx25-nand", SZ_8K);
49 struct platform_device *__init imx_add_mxc_nand(
50 const struct imx_mxc_nand_data *data,
51 const struct mxc_nand_platform_data *pdata)
53 /* AXI has to come first, that's how the mxc_nand driver expect it */
54 struct resource res[] = {
56 .start = data->iobase,
57 .end = data->iobase + data->iosize - 1,
58 .flags = IORESOURCE_MEM,
62 .flags = IORESOURCE_IRQ,
64 .start = data->axibase,
65 .end = data->axibase + SZ_16K - 1,
66 .flags = IORESOURCE_MEM,
69 return imx_add_platform_device(data->devid, data->id,
70 res, ARRAY_SIZE(res) - !data->axibase,
71 pdata, sizeof(*pdata));