blob: e62114f1f4f48c829f83249c0fafae28482f0679 [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 */
Alexey Dobriyanb7f080c2011-06-16 11:01:34 +00009#include <linux/dma-mapping.h>
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020010#include <asm/sizes.h>
11#include <mach/hardware.h>
Shawn Guoe0557c02012-09-13 15:51:15 +080012#include "devices-common.h"
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020013
Shawn Guo0ca1e292011-07-01 18:11:22 +080014#define imx_fec_data_entry_single(soc, _devid) \
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020015 { \
Shawn Guo0ca1e292011-07-01 18:11:22 +080016 .devid = _devid, \
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020017 .iobase = soc ## _FEC_BASE_ADDR, \
18 .irq = soc ## _INT_FEC, \
19 }
20
Uwe Kleine-König972cc482010-11-11 18:35:01 +010021#ifdef CONFIG_SOC_IMX25
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020022const struct imx_fec_data imx25_fec_data __initconst =
Shawn Guo0ca1e292011-07-01 18:11:22 +080023 imx_fec_data_entry_single(MX25, "imx25-fec");
Uwe Kleine-König972cc482010-11-11 18:35:01 +010024#endif /* ifdef CONFIG_SOC_IMX25 */
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020025
26#ifdef CONFIG_SOC_IMX27
27const struct imx_fec_data imx27_fec_data __initconst =
Shawn Guo0ca1e292011-07-01 18:11:22 +080028 imx_fec_data_entry_single(MX27, "imx27-fec");
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020029#endif /* ifdef CONFIG_SOC_IMX27 */
30
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010031#ifdef CONFIG_SOC_IMX35
Shawn Guo0ca1e292011-07-01 18:11:22 +080032/* i.mx35 has the i.mx27 type fec */
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020033const struct imx_fec_data imx35_fec_data __initconst =
Shawn Guo0ca1e292011-07-01 18:11:22 +080034 imx_fec_data_entry_single(MX35, "imx27-fec");
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020035#endif
36
Richard Zhao82c520d2011-01-14 17:48:03 +080037#ifdef CONFIG_SOC_IMX50
Shawn Guo0ca1e292011-07-01 18:11:22 +080038/* i.mx50 has the i.mx25 type fec */
Richard Zhao82c520d2011-01-14 17:48:03 +080039const struct imx_fec_data imx50_fec_data __initconst =
Shawn Guo0ca1e292011-07-01 18:11:22 +080040 imx_fec_data_entry_single(MX50, "imx25-fec");
Richard Zhao82c520d2011-01-14 17:48:03 +080041#endif
42
Fabio Estevamd94ed122010-11-26 12:25:58 -020043#ifdef CONFIG_SOC_IMX51
Shawn Guo0ca1e292011-07-01 18:11:22 +080044/* i.mx51 has the i.mx27 type fec */
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020045const struct imx_fec_data imx51_fec_data __initconst =
Shawn Guo0ca1e292011-07-01 18:11:22 +080046 imx_fec_data_entry_single(MX51, "imx27-fec");
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020047#endif
48
Yong Shen63904762011-01-07 12:25:32 +080049#ifdef CONFIG_SOC_IMX53
Shawn Guo0ca1e292011-07-01 18:11:22 +080050/* i.mx53 has the i.mx25 type fec */
Yong Shen63904762011-01-07 12:25:32 +080051const struct imx_fec_data imx53_fec_data __initconst =
Shawn Guo0ca1e292011-07-01 18:11:22 +080052 imx_fec_data_entry_single(MX53, "imx25-fec");
Yong Shen63904762011-01-07 12:25:32 +080053#endif
54
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020055struct platform_device *__init imx_add_fec(
56 const struct imx_fec_data *data,
57 const struct fec_platform_data *pdata)
58{
59 struct resource res[] = {
60 {
61 .start = data->iobase,
Shawn Guo5d187242011-03-20 11:17:59 +080062 .end = data->iobase + SZ_4K - 1,
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020063 .flags = IORESOURCE_MEM,
64 }, {
65 .start = data->irq,
66 .end = data->irq,
67 .flags = IORESOURCE_IRQ,
68 },
69 };
70
Shawn Guo0ca1e292011-07-01 18:11:22 +080071 return imx_add_platform_device_dmamask(data->devid, 0,
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020072 res, ARRAY_SIZE(res),
Uwe Kleine-König78159562011-01-19 11:37:10 +010073 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020074}