packaging: release out (3.8.3)
[profile/ivi/kernel-adaptation-intel-automotive.git] / arch / arm / mach-imx / devices / platform-fec.c
1 /*
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 <linux/dma-mapping.h>
10 #include <asm/sizes.h>
11
12 #include "../hardware.h"
13 #include "devices-common.h"
14
15 #define imx_fec_data_entry_single(soc, _devid)                          \
16         {                                                               \
17                 .devid = _devid,                                        \
18                 .iobase = soc ## _FEC_BASE_ADDR,                        \
19                 .irq = soc ## _INT_FEC,                                 \
20         }
21
22 #ifdef CONFIG_SOC_IMX25
23 const struct imx_fec_data imx25_fec_data __initconst =
24         imx_fec_data_entry_single(MX25, "imx25-fec");
25 #endif /* ifdef CONFIG_SOC_IMX25 */
26
27 #ifdef CONFIG_SOC_IMX27
28 const struct imx_fec_data imx27_fec_data __initconst =
29         imx_fec_data_entry_single(MX27, "imx27-fec");
30 #endif /* ifdef CONFIG_SOC_IMX27 */
31
32 #ifdef CONFIG_SOC_IMX35
33 /* i.mx35 has the i.mx27 type fec */
34 const struct imx_fec_data imx35_fec_data __initconst =
35         imx_fec_data_entry_single(MX35, "imx27-fec");
36 #endif
37
38 #ifdef CONFIG_SOC_IMX50
39 /* i.mx50 has the i.mx25 type fec */
40 const struct imx_fec_data imx50_fec_data __initconst =
41         imx_fec_data_entry_single(MX50, "imx25-fec");
42 #endif
43
44 #ifdef CONFIG_SOC_IMX51
45 /* i.mx51 has the i.mx27 type fec */
46 const struct imx_fec_data imx51_fec_data __initconst =
47         imx_fec_data_entry_single(MX51, "imx27-fec");
48 #endif
49
50 #ifdef CONFIG_SOC_IMX53
51 /* i.mx53 has the i.mx25 type fec */
52 const struct imx_fec_data imx53_fec_data __initconst =
53         imx_fec_data_entry_single(MX53, "imx25-fec");
54 #endif
55
56 struct platform_device *__init imx_add_fec(
57                 const struct imx_fec_data *data,
58                 const struct fec_platform_data *pdata)
59 {
60         struct resource res[] = {
61                 {
62                         .start = data->iobase,
63                         .end = data->iobase + SZ_4K - 1,
64                         .flags = IORESOURCE_MEM,
65                 }, {
66                         .start = data->irq,
67                         .end = data->irq,
68                         .flags = IORESOURCE_IRQ,
69                 },
70         };
71
72         return imx_add_platform_device_dmamask(data->devid, 0,
73                         res, ARRAY_SIZE(res),
74                         pdata, sizeof(*pdata), DMA_BIT_MASK(32));
75 }