Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 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 | */ |
Alexey Dobriyan | b7f080c | 2011-06-16 11:01:34 +0000 | [diff] [blame] | 9 | #include <linux/dma-mapping.h> |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 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) \ |
| 15 | { \ |
| 16 | .iobase = soc ## _FEC_BASE_ADDR, \ |
| 17 | .irq = soc ## _INT_FEC, \ |
| 18 | } |
| 19 | |
Uwe Kleine-König | 972cc48 | 2010-11-11 18:35:01 +0100 | [diff] [blame] | 20 | #ifdef CONFIG_SOC_IMX25 |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 21 | const struct imx_fec_data imx25_fec_data __initconst = |
| 22 | imx_fec_data_entry_single(MX25); |
Uwe Kleine-König | 972cc48 | 2010-11-11 18:35:01 +0100 | [diff] [blame] | 23 | #endif /* ifdef CONFIG_SOC_IMX25 */ |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 24 | |
| 25 | #ifdef CONFIG_SOC_IMX27 |
| 26 | const struct imx_fec_data imx27_fec_data __initconst = |
| 27 | imx_fec_data_entry_single(MX27); |
| 28 | #endif /* ifdef CONFIG_SOC_IMX27 */ |
| 29 | |
Uwe Kleine-König | a528bc8 | 2010-11-12 10:11:42 +0100 | [diff] [blame] | 30 | #ifdef CONFIG_SOC_IMX35 |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 31 | const struct imx_fec_data imx35_fec_data __initconst = |
| 32 | imx_fec_data_entry_single(MX35); |
| 33 | #endif |
| 34 | |
Richard Zhao | 82c520d | 2011-01-14 17:48:03 +0800 | [diff] [blame] | 35 | #ifdef CONFIG_SOC_IMX50 |
| 36 | const struct imx_fec_data imx50_fec_data __initconst = |
| 37 | imx_fec_data_entry_single(MX50); |
| 38 | #endif |
| 39 | |
Fabio Estevam | d94ed12 | 2010-11-26 12:25:58 -0200 | [diff] [blame] | 40 | #ifdef CONFIG_SOC_IMX51 |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 41 | const struct imx_fec_data imx51_fec_data __initconst = |
| 42 | imx_fec_data_entry_single(MX51); |
| 43 | #endif |
| 44 | |
Yong Shen | 6390476 | 2011-01-07 12:25:32 +0800 | [diff] [blame] | 45 | #ifdef CONFIG_SOC_IMX53 |
| 46 | const struct imx_fec_data imx53_fec_data __initconst = |
| 47 | imx_fec_data_entry_single(MX53); |
| 48 | #endif |
| 49 | |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 50 | struct platform_device *__init imx_add_fec( |
| 51 | const struct imx_fec_data *data, |
| 52 | const struct fec_platform_data *pdata) |
| 53 | { |
| 54 | struct resource res[] = { |
| 55 | { |
| 56 | .start = data->iobase, |
Shawn Guo | 5d18724 | 2011-03-20 11:17:59 +0800 | [diff] [blame] | 57 | .end = data->iobase + SZ_4K - 1, |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 58 | .flags = IORESOURCE_MEM, |
| 59 | }, { |
| 60 | .start = data->irq, |
| 61 | .end = data->irq, |
| 62 | .flags = IORESOURCE_IRQ, |
| 63 | }, |
| 64 | }; |
| 65 | |
Uwe Kleine-König | 7815956 | 2011-01-19 11:37:10 +0100 | [diff] [blame] | 66 | return imx_add_platform_device_dmamask("fec", 0, |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 67 | res, ARRAY_SIZE(res), |
Uwe Kleine-König | 7815956 | 2011-01-19 11:37:10 +0100 | [diff] [blame] | 68 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 69 | } |