2010-10-06 14:00:18 +04:00
/*
* Copyright ( C ) 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 .
*/
2011-06-16 15:01:34 +04:00
# include <linux/dma-mapping.h>
2010-10-06 14:00:18 +04:00
# 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-10-06 14:00:18 +04:00
2011-07-01 14:11:22 +04:00
# define imx_fec_data_entry_single(soc, _devid) \
2010-10-06 14:00:18 +04:00
{ \
2011-07-01 14:11:22 +04:00
. devid = _devid , \
2010-10-06 14:00:18 +04:00
. iobase = soc # # _FEC_BASE_ADDR , \
. irq = soc # # _INT_FEC , \
}
2010-11-11 20:35:01 +03:00
# ifdef CONFIG_SOC_IMX25
2010-10-06 14:00:18 +04:00
const struct imx_fec_data imx25_fec_data __initconst =
2011-07-01 14:11:22 +04:00
imx_fec_data_entry_single ( MX25 , " imx25-fec " ) ;
2010-11-11 20:35:01 +03:00
# endif /* ifdef CONFIG_SOC_IMX25 */
2010-10-06 14:00:18 +04:00
# ifdef CONFIG_SOC_IMX27
const struct imx_fec_data imx27_fec_data __initconst =
2011-07-01 14:11:22 +04:00
imx_fec_data_entry_single ( MX27 , " imx27-fec " ) ;
2010-10-06 14:00:18 +04:00
# endif /* ifdef CONFIG_SOC_IMX27 */
2010-11-12 12:11:42 +03:00
# ifdef CONFIG_SOC_IMX35
2011-07-01 14:11:22 +04:00
/* i.mx35 has the i.mx27 type fec */
2010-10-06 14:00:18 +04:00
const struct imx_fec_data imx35_fec_data __initconst =
2011-07-01 14:11:22 +04:00
imx_fec_data_entry_single ( MX35 , " imx27-fec " ) ;
2010-10-06 14:00:18 +04:00
# endif
2011-01-14 12:48:03 +03:00
# ifdef CONFIG_SOC_IMX50
2011-07-01 14:11:22 +04:00
/* i.mx50 has the i.mx25 type fec */
2011-01-14 12:48:03 +03:00
const struct imx_fec_data imx50_fec_data __initconst =
2011-07-01 14:11:22 +04:00
imx_fec_data_entry_single ( MX50 , " imx25-fec " ) ;
2011-01-14 12:48:03 +03:00
# endif
2010-11-26 17:25:58 +03:00
# ifdef CONFIG_SOC_IMX51
2011-07-01 14:11:22 +04:00
/* i.mx51 has the i.mx27 type fec */
2010-10-06 14:00:18 +04:00
const struct imx_fec_data imx51_fec_data __initconst =
2011-07-01 14:11:22 +04:00
imx_fec_data_entry_single ( MX51 , " imx27-fec " ) ;
2010-10-06 14:00:18 +04:00
# endif
2011-01-07 07:25:32 +03:00
# ifdef CONFIG_SOC_IMX53
2011-07-01 14:11:22 +04:00
/* i.mx53 has the i.mx25 type fec */
2011-01-07 07:25:32 +03:00
const struct imx_fec_data imx53_fec_data __initconst =
2011-07-01 14:11:22 +04:00
imx_fec_data_entry_single ( MX53 , " imx25-fec " ) ;
2011-01-07 07:25:32 +03:00
# endif
2010-10-06 14:00:18 +04:00
struct platform_device * __init imx_add_fec (
const struct imx_fec_data * data ,
const struct fec_platform_data * pdata )
{
struct resource res [ ] = {
{
. start = data - > iobase ,
2011-03-20 06:17:59 +03:00
. end = data - > iobase + SZ_4K - 1 ,
2010-10-06 14:00:18 +04:00
. flags = IORESOURCE_MEM ,
} , {
. start = data - > irq ,
. end = data - > irq ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2011-07-01 14:11:22 +04:00
return imx_add_platform_device_dmamask ( data - > devid , 0 ,
2010-10-06 14:00:18 +04:00
res , ARRAY_SIZE ( res ) ,
2011-01-19 13:37:10 +03:00
pdata , sizeof ( * pdata ) , DMA_BIT_MASK ( 32 ) ) ;
2010-10-06 14:00:18 +04:00
}