2010-06-15 20:14:19 +04: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>
2012-09-14 10:14:45 +04:00
# include "../hardware.h"
2012-09-13 11:51:15 +04:00
# include "devices-common.h"
2010-06-15 20:14:19 +04:00
2012-09-15 09:34:09 +04:00
# define imx_mxc_nand_data_entry_single(soc, _devid, _size) \
2010-08-23 13:25:52 +04:00
{ \
2012-09-15 09:34:09 +04:00
. devid = _devid , \
2010-08-23 13:25:52 +04:00
. iobase = soc # # _NFC_BASE_ADDR , \
. iosize = _size , \
. irq = soc # # _INT_NFC \
}
2012-09-15 09:34:09 +04:00
# define imx_mxc_nandv3_data_entry_single(soc, _devid, _size) \
2010-08-03 13:59:46 +04:00
{ \
2012-09-15 09:34:09 +04:00
. devid = _devid , \
2010-08-03 13:59:46 +04:00
. id = - 1 , \
. iobase = soc # # _NFC_BASE_ADDR , \
. iosize = _size , \
. axibase = soc # # _NFC_AXI_BASE_ADDR , \
. irq = soc # # _INT_NFC \
}
2010-08-23 13:25:52 +04:00
# ifdef CONFIG_SOC_IMX21
const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
2012-09-15 09:34:09 +04:00
imx_mxc_nand_data_entry_single ( MX21 , " imx21-nand " , SZ_4K ) ;
2010-08-23 13:25:52 +04:00
# endif /* ifdef CONFIG_SOC_IMX21 */
2010-11-11 20:35:01 +03:00
# ifdef CONFIG_SOC_IMX25
2010-08-23 13:25:52 +04:00
const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
2012-09-15 09:34:09 +04:00
imx_mxc_nand_data_entry_single ( MX25 , " imx25-nand " , SZ_8K ) ;
2010-11-11 20:35:01 +03:00
# endif /* ifdef CONFIG_SOC_IMX25 */
2010-08-23 13:25:52 +04:00
# ifdef CONFIG_SOC_IMX27
const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
2012-09-15 09:34:09 +04:00
imx_mxc_nand_data_entry_single ( MX27 , " imx27-nand " , SZ_4K ) ;
2010-08-23 13:25:52 +04:00
# endif /* ifdef CONFIG_SOC_IMX27 */
2010-11-12 12:11:42 +03:00
# ifdef CONFIG_SOC_IMX31
2010-08-23 13:25:52 +04:00
const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
2012-09-15 09:34:09 +04:00
imx_mxc_nand_data_entry_single ( MX31 , " imx27-nand " , SZ_4K ) ;
2010-08-23 13:25:52 +04:00
# endif
2010-11-12 12:11:42 +03:00
# ifdef CONFIG_SOC_IMX35
2010-08-23 13:25:52 +04:00
const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
2012-09-15 09:34:09 +04:00
imx_mxc_nand_data_entry_single ( MX35 , " imx25-nand " , SZ_8K ) ;
2010-08-23 13:25:52 +04:00
# endif
2010-11-26 17:25:58 +03:00
# ifdef CONFIG_SOC_IMX51
2010-08-03 13:59:46 +04:00
const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst =
2012-09-15 09:34:09 +04:00
imx_mxc_nandv3_data_entry_single ( MX51 , " imx51-nand " , SZ_16K ) ;
2010-08-03 13:59:46 +04:00
# endif
2010-08-23 13:25:52 +04: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-15 20:14:19 +04:00
{
2010-08-03 13:59:46 +04:00
/* AXI has to come first, that's how the mxc_nand driver expect it */
2010-06-15 20:14:19 +04:00
struct resource res [ ] = {
{
2010-08-23 13:25:52 +04:00
. start = data - > iobase ,
. end = data - > iobase + data - > iosize - 1 ,
2010-06-15 20:14:19 +04:00
. flags = IORESOURCE_MEM ,
} , {
2010-08-23 13:25:52 +04:00
. start = data - > irq ,
. end = data - > irq ,
2010-06-15 20:14:19 +04:00
. flags = IORESOURCE_IRQ ,
2012-06-06 14:33:14 +04:00
} , {
. start = data - > axibase ,
. end = data - > axibase + SZ_16K - 1 ,
. flags = IORESOURCE_MEM ,
2010-06-15 20:14:19 +04:00
} ,
} ;
2012-09-15 09:34:09 +04:00
return imx_add_platform_device ( data - > devid , data - > id ,
2012-06-06 14:33:14 +04:00
res , ARRAY_SIZE ( res ) - ! data - > axibase ,
2010-06-15 20:14:19 +04:00
pdata , sizeof ( * pdata ) ) ;
}