2010-06-16 00:14:19 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2009-2010 Pengutronix
|
|
|
|
* Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License version 2 as published by the
|
|
|
|
* Free Software Foundation.
|
|
|
|
*/
|
|
|
|
#include <asm/sizes.h>
|
2010-08-23 17:25:52 +08:00
|
|
|
#include <mach/hardware.h>
|
2010-06-16 00:14:19 +08:00
|
|
|
#include <mach/devices-common.h>
|
|
|
|
|
2010-08-23 17:25:52 +08:00
|
|
|
#define imx_mxc_nand_data_entry_single(soc, _size) \
|
|
|
|
{ \
|
|
|
|
.iobase = soc ## _NFC_BASE_ADDR, \
|
|
|
|
.iosize = _size, \
|
|
|
|
.irq = soc ## _INT_NFC \
|
|
|
|
}
|
|
|
|
|
2010-08-03 17:59:46 +08:00
|
|
|
#define imx_mxc_nandv3_data_entry_single(soc, _size) \
|
|
|
|
{ \
|
|
|
|
.id = -1, \
|
|
|
|
.iobase = soc ## _NFC_BASE_ADDR, \
|
|
|
|
.iosize = _size, \
|
|
|
|
.axibase = soc ## _NFC_AXI_BASE_ADDR, \
|
|
|
|
.irq = soc ## _INT_NFC \
|
|
|
|
}
|
|
|
|
|
2010-08-23 17:25:52 +08:00
|
|
|
#ifdef CONFIG_SOC_IMX21
|
|
|
|
const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
|
|
|
|
imx_mxc_nand_data_entry_single(MX21, SZ_4K);
|
|
|
|
#endif /* ifdef CONFIG_SOC_IMX21 */
|
|
|
|
|
2010-11-12 01:35:01 +08:00
|
|
|
#ifdef CONFIG_SOC_IMX25
|
2010-08-23 17:25:52 +08:00
|
|
|
const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
|
|
|
|
imx_mxc_nand_data_entry_single(MX25, SZ_8K);
|
2010-11-12 01:35:01 +08:00
|
|
|
#endif /* ifdef CONFIG_SOC_IMX25 */
|
2010-08-23 17:25:52 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_SOC_IMX27
|
|
|
|
const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
|
|
|
|
imx_mxc_nand_data_entry_single(MX27, SZ_4K);
|
|
|
|
#endif /* ifdef CONFIG_SOC_IMX27 */
|
|
|
|
|
2010-11-12 17:11:42 +08:00
|
|
|
#ifdef CONFIG_SOC_IMX31
|
2010-08-23 17:25:52 +08:00
|
|
|
const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
|
|
|
|
imx_mxc_nand_data_entry_single(MX31, SZ_4K);
|
|
|
|
#endif
|
|
|
|
|
2010-11-12 17:11:42 +08:00
|
|
|
#ifdef CONFIG_SOC_IMX35
|
2010-08-23 17:25:52 +08:00
|
|
|
const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
|
|
|
|
imx_mxc_nand_data_entry_single(MX35, SZ_8K);
|
|
|
|
#endif
|
|
|
|
|
2010-11-26 22:25:58 +08:00
|
|
|
#ifdef CONFIG_SOC_IMX51
|
2010-08-03 17:59:46 +08:00
|
|
|
const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst =
|
|
|
|
imx_mxc_nandv3_data_entry_single(MX51, SZ_16K);
|
|
|
|
#endif
|
|
|
|
|
2010-08-23 17:25:52 +08:00
|
|
|
struct platform_device *__init imx_add_mxc_nand(
|
|
|
|
const struct imx_mxc_nand_data *data,
|
|
|
|
const struct mxc_nand_platform_data *pdata)
|
2010-06-16 00:14:19 +08:00
|
|
|
{
|
2010-08-03 17:59:46 +08:00
|
|
|
/* AXI has to come first, that's how the mxc_nand driver expect it */
|
2010-06-16 00:14:19 +08:00
|
|
|
struct resource res[] = {
|
|
|
|
{
|
2010-08-03 17:59:46 +08:00
|
|
|
.start = data->axibase,
|
|
|
|
.end = data->axibase + SZ_16K - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
}, {
|
2010-08-23 17:25:52 +08:00
|
|
|
.start = data->iobase,
|
|
|
|
.end = data->iobase + data->iosize - 1,
|
2010-06-16 00:14:19 +08:00
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
}, {
|
2010-08-23 17:25:52 +08:00
|
|
|
.start = data->irq,
|
|
|
|
.end = data->irq,
|
2010-06-16 00:14:19 +08:00
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
2010-08-03 17:59:46 +08:00
|
|
|
return imx_add_platform_device("mxc_nand", data->id,
|
|
|
|
res + !data->axibase,
|
|
|
|
ARRAY_SIZE(res) - !data->axibase,
|
2010-06-16 00:14:19 +08:00
|
|
|
pdata, sizeof(*pdata));
|
|
|
|
}
|