blob: 269ec78aba77fdb54f52782e114d9adf430d7c00 [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
Fabio Estevamd94ed122010-11-26 12:25:58 -020034#ifdef CONFIG_SOC_IMX51
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020035const struct imx_fec_data imx51_fec_data __initconst =
36 imx_fec_data_entry_single(MX51);
37#endif
38
39struct platform_device *__init imx_add_fec(
40 const struct imx_fec_data *data,
41 const struct fec_platform_data *pdata)
42{
43 struct resource res[] = {
44 {
45 .start = data->iobase,
46 .end = data->iobase + SZ_4K,
47 .flags = IORESOURCE_MEM,
48 }, {
49 .start = data->irq,
50 .end = data->irq,
51 .flags = IORESOURCE_IRQ,
52 },
53 };
54
55 return imx_add_platform_device("fec", 0 /* -1? */,
56 res, ARRAY_SIZE(res),
57 pdata, sizeof(*pdata));
58}