Linux 5.7.7
[linux/fpc-iii.git] / arch / arm / mach-imx / devices / platform-mxc_nand.c
blob0f5f741f897fdf1692833de913ad088c61302888
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2009-2010 Pengutronix
4 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5 */
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) \
12 { \
13 .devid = _devid, \
14 .iobase = soc ## _NFC_BASE_ADDR, \
15 .iosize = _size, \
16 .irq = soc ## _INT_NFC \
19 #define imx_mxc_nandv3_data_entry_single(soc, _devid, _size) \
20 { \
21 .devid = _devid, \
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, "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);
42 #endif
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);
47 #endif
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,
59 }, {
60 .start = data->irq,
61 .end = data->irq,
62 .flags = IORESOURCE_IRQ,
63 }, {
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));