blob: 605c0af5851d1274831fa12670fb5b25272d5f3e [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>
Masahiro Yamada87dfb312019-05-14 15:46:51 -070010#include <linux/sizes.h>
Shawn Guo50f2de62012-09-14 14:14:45 +080011
12#include "../hardware.h"
Shawn Guoe0557c02012-09-13 15:51:15 +080013#include "devices-common.h"
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020014
Shawn Guo0ca1e292011-07-01 18:11:22 +080015#define imx_fec_data_entry_single(soc, _devid) \
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020016 { \
Shawn Guo0ca1e292011-07-01 18:11:22 +080017 .devid = _devid, \
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020018 .iobase = soc ## _FEC_BASE_ADDR, \
19 .irq = soc ## _INT_FEC, \
20 }
21
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020022#ifdef CONFIG_SOC_IMX27
23const struct imx_fec_data imx27_fec_data __initconst =
Shawn Guo0ca1e292011-07-01 18:11:22 +080024 imx_fec_data_entry_single(MX27, "imx27-fec");
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020025#endif /* ifdef CONFIG_SOC_IMX27 */
26
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010027#ifdef CONFIG_SOC_IMX35
Shawn Guo0ca1e292011-07-01 18:11:22 +080028/* i.mx35 has the i.mx27 type fec */
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020029const struct imx_fec_data imx35_fec_data __initconst =
Shawn Guo0ca1e292011-07-01 18:11:22 +080030 imx_fec_data_entry_single(MX35, "imx27-fec");
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020031#endif
32
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020033struct platform_device *__init imx_add_fec(
34 const struct imx_fec_data *data,
35 const struct fec_platform_data *pdata)
36{
37 struct resource res[] = {
38 {
39 .start = data->iobase,
Shawn Guo5d187242011-03-20 11:17:59 +080040 .end = data->iobase + SZ_4K - 1,
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020041 .flags = IORESOURCE_MEM,
42 }, {
43 .start = data->irq,
44 .end = data->irq,
45 .flags = IORESOURCE_IRQ,
46 },
47 };
48
Shawn Guo0ca1e292011-07-01 18:11:22 +080049 return imx_add_platform_device_dmamask(data->devid, 0,
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020050 res, ARRAY_SIZE(res),
Uwe Kleine-König78159562011-01-19 11:37:10 +010051 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020052}