blob: 6561c9df5f0de604628925a0331e3297b90ea5a8 [file] [log] [blame]
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +02001/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <asm/sizes.h>
10#include <mach/hardware.h>
11#include <mach/devices-common.h>
12
13#define imx_fec_data_entry_single(soc) \
14 { \
15 .iobase = soc ## _FEC_BASE_ADDR, \
16 .irq = soc ## _INT_FEC, \
17 }
18
Uwe Kleine-König972cc482010-11-11 18:35:01 +010019#ifdef CONFIG_SOC_IMX25
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020020const struct imx_fec_data imx25_fec_data __initconst =
21 imx_fec_data_entry_single(MX25);
Uwe Kleine-König972cc482010-11-11 18:35:01 +010022#endif /* ifdef CONFIG_SOC_IMX25 */
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020023
24#ifdef CONFIG_SOC_IMX27
25const struct imx_fec_data imx27_fec_data __initconst =
26 imx_fec_data_entry_single(MX27);
27#endif /* ifdef CONFIG_SOC_IMX27 */
28
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010029#ifdef CONFIG_SOC_IMX35
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020030const struct imx_fec_data imx35_fec_data __initconst =
31 imx_fec_data_entry_single(MX35);
32#endif
33
Richard Zhao82c520d2011-01-14 17:48:03 +080034#ifdef CONFIG_SOC_IMX50
35const struct imx_fec_data imx50_fec_data __initconst =
36 imx_fec_data_entry_single(MX50);
37#endif
38
Fabio Estevamd94ed122010-11-26 12:25:58 -020039#ifdef CONFIG_SOC_IMX51
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020040const struct imx_fec_data imx51_fec_data __initconst =
41 imx_fec_data_entry_single(MX51);
42#endif
43
Yong Shen63904762011-01-07 12:25:32 +080044#ifdef CONFIG_SOC_IMX53
45const struct imx_fec_data imx53_fec_data __initconst =
46 imx_fec_data_entry_single(MX53);
47#endif
48
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020049struct platform_device *__init imx_add_fec(
50 const struct imx_fec_data *data,
51 const struct fec_platform_data *pdata)
52{
53 struct resource res[] = {
54 {
55 .start = data->iobase,
56 .end = data->iobase + SZ_4K,
57 .flags = IORESOURCE_MEM,
58 }, {
59 .start = data->irq,
60 .end = data->irq,
61 .flags = IORESOURCE_IRQ,
62 },
63 };
64
Uwe Kleine-König78159562011-01-19 11:37:10 +010065 return imx_add_platform_device_dmamask("fec", 0,
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020066 res, ARRAY_SIZE(res),
Uwe Kleine-König78159562011-01-19 11:37:10 +010067 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020068}