1
2
3
4
5
6
7
8
9#include <linux/dma-mapping.h>
10#include <asm/sizes.h>
11#include <mach/hardware.h>
12#include <mach/devices-common.h>
13
14#define imx_fec_data_entry_single(soc, _devid) \
15 { \
16 .devid = _devid, \
17 .iobase = soc ## _FEC_BASE_ADDR, \
18 .irq = soc ## _INT_FEC, \
19 }
20
21#ifdef CONFIG_SOC_IMX25
22const struct imx_fec_data imx25_fec_data __initconst =
23 imx_fec_data_entry_single(MX25, "imx25-fec");
24#endif
25
26#ifdef CONFIG_SOC_IMX27
27const struct imx_fec_data imx27_fec_data __initconst =
28 imx_fec_data_entry_single(MX27, "imx27-fec");
29#endif
30
31#ifdef CONFIG_SOC_IMX35
32
33const struct imx_fec_data imx35_fec_data __initconst =
34 imx_fec_data_entry_single(MX35, "imx27-fec");
35#endif
36
37#ifdef CONFIG_SOC_IMX50
38
39const struct imx_fec_data imx50_fec_data __initconst =
40 imx_fec_data_entry_single(MX50, "imx25-fec");
41#endif
42
43#ifdef CONFIG_SOC_IMX51
44
45const struct imx_fec_data imx51_fec_data __initconst =
46 imx_fec_data_entry_single(MX51, "imx27-fec");
47#endif
48
49#ifdef CONFIG_SOC_IMX53
50
51const struct imx_fec_data imx53_fec_data __initconst =
52 imx_fec_data_entry_single(MX53, "imx25-fec");
53#endif
54
55struct 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,
62 .end = data->iobase + SZ_4K - 1,
63 .flags = IORESOURCE_MEM,
64 }, {
65 .start = data->irq,
66 .end = data->irq,
67 .flags = IORESOURCE_IRQ,
68 },
69 };
70
71 return imx_add_platform_device_dmamask(data->devid, 0,
72 res, ARRAY_SIZE(res),
73 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
74}
75