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