aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-10-06 06:00:18 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2010-10-11 09:31:37 -0400
commit6bd96f3c332d422c0dda302f1b32c8e21dd75ee3 (patch)
tree5a885aac1d005df8d0dc51896d4dfe9ef03e62df
parent8a8d20600dce01553c8505b7c576f8d4307e4ba8 (diff)
ARM: imx: dynamically register fec devices
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-imx/devices-imx27.h4
-rw-r--r--arch/arm/mach-imx/devices.c21
-rw-r--r--arch/arm/mach-imx/devices.h1
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c2
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c2
-rw-r--r--arch/arm/mach-imx/mach-imx27lite.c6
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c6
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c2
-rw-r--r--arch/arm/mach-imx/mach-mxt_td60.c7
-rw-r--r--arch/arm/mach-imx/mach-pca100.c2
-rw-r--r--arch/arm/mach-imx/mach-pcm038.c2
-rw-r--r--arch/arm/mach-mx25/devices-imx25.h4
-rw-r--r--arch/arm/mach-mx25/devices.c20
-rw-r--r--arch/arm/mach-mx25/devices.h1
-rw-r--r--arch/arm/mach-mx25/mach-cpuimx25.c5
-rw-r--r--arch/arm/mach-mx25/mach-mx25_3ds.c5
-rw-r--r--arch/arm/mach-mx3/devices-imx35.h4
-rw-r--r--arch/arm/mach-mx3/devices.c21
-rw-r--r--arch/arm/mach-mx3/devices.h1
-rw-r--r--arch/arm/mach-mx3/mach-cpuimx35.c2
-rw-r--r--arch/arm/mach-mx3/mach-mx35_3ds.c2
-rw-r--r--arch/arm/mach-mx3/mach-pcm043.c2
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51.c2
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c6
-rw-r--r--arch/arm/mach-mx5/devices-imx51.h4
-rw-r--r--arch/arm/mach-mx5/devices.c19
-rw-r--r--arch/arm/mach-mx5/devices.h1
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig4
-rw-r--r--arch/arm/plat-mxc/devices/Makefile1
-rw-r--r--arch/arm/plat-mxc/devices/platform-fec.c58
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h9
-rw-r--r--arch/arm/plat-mxc/include/mach/mx51.h4
32 files changed, 107 insertions, 123 deletions
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
index e11606b4d31c..7011690364f2 100644
--- a/arch/arm/mach-imx/devices-imx27.h
+++ b/arch/arm/mach-imx/devices-imx27.h
@@ -9,6 +9,10 @@
9#include <mach/mx27.h> 9#include <mach/mx27.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12extern const struct imx_fec_data imx27_fec_data __initconst;
13#define imx27_add_fec(pdata) \
14 imx_add_fec(&imx27_fec_data, pdata)
15
12extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst; 16extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst;
13#define imx27_add_imx_i2c(id, pdata) \ 17#define imx27_add_imx_i2c(id, pdata) \
14 imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata) 18 imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata)
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c
index 423fa05dabd0..fba5047de8b1 100644
--- a/arch/arm/mach-imx/devices.c
+++ b/arch/arm/mach-imx/devices.c
@@ -314,27 +314,6 @@ struct platform_device mxc_fb_device = {
314 }, 314 },
315}; 315};
316 316
317#ifdef CONFIG_MACH_MX27
318static struct resource mxc_fec_resources[] = {
319 {
320 .start = MX27_FEC_BASE_ADDR,
321 .end = MX27_FEC_BASE_ADDR + SZ_4K - 1,
322 .flags = IORESOURCE_MEM,
323 }, {
324 .start = MX27_INT_FEC,
325 .end = MX27_INT_FEC,
326 .flags = IORESOURCE_IRQ,
327 },
328};
329
330struct platform_device mxc_fec_device = {
331 .name = "fec",
332 .id = 0,
333 .num_resources = ARRAY_SIZE(mxc_fec_resources),
334 .resource = mxc_fec_resources,
335};
336#endif
337
338static struct resource mxc_pwm_resources[] = { 317static struct resource mxc_pwm_resources[] = {
339 { 318 {
340 .start = MX2x_PWM_BASE_ADDR, 319 .start = MX2x_PWM_BASE_ADDR,
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h
index 57d4b1cac039..807f02a031c9 100644
--- a/arch/arm/mach-imx/devices.h
+++ b/arch/arm/mach-imx/devices.h
@@ -16,7 +16,6 @@ extern struct platform_device mxc_gpt5;
16extern struct platform_device mxc_wdt; 16extern struct platform_device mxc_wdt;
17extern struct platform_device mxc_w1_master_device; 17extern struct platform_device mxc_w1_master_device;
18extern struct platform_device mxc_fb_device; 18extern struct platform_device mxc_fb_device;
19extern struct platform_device mxc_fec_device;
20extern struct platform_device mxc_pwm_device; 19extern struct platform_device mxc_pwm_device;
21extern struct platform_device mxc_sdhc_device0; 20extern struct platform_device mxc_sdhc_device0;
22extern struct platform_device mxc_sdhc_device1; 21extern struct platform_device mxc_sdhc_device1;
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index d4cb592ffaed..28f73a1c79f7 100644
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -157,7 +157,6 @@ cpuimx27_nand_board_info __initconst = {
157 157
158static struct platform_device *platform_devices[] __initdata = { 158static struct platform_device *platform_devices[] __initdata = {
159 &eukrea_cpuimx27_nor_mtd_device, 159 &eukrea_cpuimx27_nor_mtd_device,
160 &mxc_fec_device,
161 &mxc_wdt, 160 &mxc_wdt,
162 &mxc_w1_master_device, 161 &mxc_w1_master_device,
163}; 162};
@@ -261,6 +260,7 @@ static void __init eukrea_cpuimx27_init(void)
261 260
262 imx27_add_imx_i2c(1, &cpuimx27_i2c1_data); 261 imx27_add_imx_i2c(1, &cpuimx27_i2c1_data);
263 262
263 imx27_add_fec(NULL);
264 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 264 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
265 265
266#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2) 266#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index 21904f32740c..a0d78faa08e8 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -185,7 +185,6 @@ static struct platform_device visstrim_m10_nor_mtd_device = {
185static struct platform_device *platform_devices[] __initdata = { 185static struct platform_device *platform_devices[] __initdata = {
186 &visstrim_gpio_keys_device, 186 &visstrim_gpio_keys_device,
187 &visstrim_m10_nor_mtd_device, 187 &visstrim_m10_nor_mtd_device,
188 &mxc_fec_device,
189}; 188};
190 189
191/* Visstrim_M10 uses UART0 as console */ 190/* Visstrim_M10 uses UART0 as console */
@@ -240,6 +239,7 @@ static void __init visstrim_m10_board_init(void)
240 imx27_add_imx_i2c(1, &visstrim_m10_i2c_data); 239 imx27_add_imx_i2c(1, &visstrim_m10_i2c_data);
241 mxc_register_device(&mxc_sdhc_device0, &visstrim_m10_sdhc_pdata); 240 mxc_register_device(&mxc_sdhc_device0, &visstrim_m10_sdhc_pdata);
242 mxc_register_device(&mxc_otg_host, &visstrim_m10_usbotg_pdata); 241 mxc_register_device(&mxc_otg_host, &visstrim_m10_usbotg_pdata);
242 imx27_add_fec(NULL);
243 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 243 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
244} 244}
245 245
diff --git a/arch/arm/mach-imx/mach-imx27lite.c b/arch/arm/mach-imx/mach-imx27lite.c
index 67480b639e2c..60d4d0ac4939 100644
--- a/arch/arm/mach-imx/mach-imx27lite.c
+++ b/arch/arm/mach-imx/mach-imx27lite.c
@@ -58,16 +58,12 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
58 .flags = IMXUART_HAVE_RTSCTS, 58 .flags = IMXUART_HAVE_RTSCTS,
59}; 59};
60 60
61static struct platform_device *platform_devices[] __initdata = {
62 &mxc_fec_device,
63};
64
65static void __init mx27lite_init(void) 61static void __init mx27lite_init(void)
66{ 62{
67 mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins), 63 mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins),
68 "imx27lite"); 64 "imx27lite");
69 imx27_add_imx_uart0(&uart_pdata); 65 imx27_add_imx_uart0(&uart_pdata);
70 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 66 imx27_add_fec(NULL);
71} 67}
72 68
73static void __init mx27lite_timer_init(void) 69static void __init mx27lite_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 9f6832d5f7f7..a69dba252658 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -64,10 +64,6 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
64 .flags = IMXUART_HAVE_RTSCTS, 64 .flags = IMXUART_HAVE_RTSCTS,
65}; 65};
66 66
67static struct platform_device *platform_devices[] __initdata = {
68 &mxc_fec_device,
69};
70
71/* 67/*
72 * Matrix keyboard 68 * Matrix keyboard
73 */ 69 */
@@ -94,7 +90,7 @@ static void __init mx27pdk_init(void)
94 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), 90 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
95 "mx27pdk"); 91 "mx27pdk");
96 imx27_add_imx_uart0(&uart_pdata); 92 imx27_add_imx_uart0(&uart_pdata);
97 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 93 imx27_add_fec(NULL);
98 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data); 94 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data);
99} 95}
100 96
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index 1a33288787a8..ffb39a42f240 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -284,7 +284,6 @@ static struct imxmmc_platform_data sdhc2_pdata = {
284 284
285static struct platform_device *platform_devices[] __initdata = { 285static struct platform_device *platform_devices[] __initdata = {
286 &mx27ads_nor_mtd_device, 286 &mx27ads_nor_mtd_device,
287 &mxc_fec_device,
288 &mxc_w1_master_device, 287 &mxc_w1_master_device,
289}; 288};
290 289
@@ -313,6 +312,7 @@ static void __init mx27ads_board_init(void)
313 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 312 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
314 mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata); 313 mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata);
315 314
315 imx27_add_fec(NULL);
316 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 316 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
317} 317}
318 318
diff --git a/arch/arm/mach-imx/mach-mxt_td60.c b/arch/arm/mach-imx/mach-mxt_td60.c
index 58fb0d653981..f4c397dec794 100644
--- a/arch/arm/mach-imx/mach-mxt_td60.c
+++ b/arch/arm/mach-imx/mach-mxt_td60.c
@@ -231,10 +231,6 @@ static struct imxmmc_platform_data sdhc1_pdata = {
231 .exit = mxt_td60_sdhc1_exit, 231 .exit = mxt_td60_sdhc1_exit,
232}; 232};
233 233
234static struct platform_device *platform_devices[] __initdata = {
235 &mxc_fec_device,
236};
237
238static const struct imxuart_platform_data uart_pdata __initconst = { 234static const struct imxuart_platform_data uart_pdata __initconst = {
239 .flags = IMXUART_HAVE_RTSCTS, 235 .flags = IMXUART_HAVE_RTSCTS,
240}; 236};
@@ -259,8 +255,7 @@ static void __init mxt_td60_board_init(void)
259 imx27_add_imx_i2c(1, &mxt_td60_i2c1_data); 255 imx27_add_imx_i2c(1, &mxt_td60_i2c1_data);
260 mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data); 256 mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data);
261 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 257 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
262 258 imx27_add_fec(NULL);
263 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
264} 259}
265 260
266static void __init mxt_td60_timer_init(void) 261static void __init mxt_td60_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index 1247ce9dabad..223c31c48db6 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -173,7 +173,6 @@ pca100_nand_board_info __initconst = {
173 173
174static struct platform_device *platform_devices[] __initdata = { 174static struct platform_device *platform_devices[] __initdata = {
175 &mxc_w1_master_device, 175 &mxc_w1_master_device,
176 &mxc_fec_device,
177 &mxc_wdt, 176 &mxc_wdt,
178}; 177};
179 178
@@ -433,6 +432,7 @@ static void __init pca100_init(void)
433 432
434 mxc_register_device(&mxc_fb_device, &pca100_fb_data); 433 mxc_register_device(&mxc_fb_device, &pca100_fb_data);
435 434
435 imx27_add_fec(NULL);
436 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 436 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
437} 437}
438 438
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index 3fbed661f612..b9888a8defc1 100644
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -173,7 +173,6 @@ pcm038_nand_board_info __initconst = {
173static struct platform_device *platform_devices[] __initdata = { 173static struct platform_device *platform_devices[] __initdata = {
174 &pcm038_nor_mtd_device, 174 &pcm038_nor_mtd_device,
175 &mxc_w1_master_device, 175 &mxc_w1_master_device,
176 &mxc_fec_device,
177 &pcm038_sram_mtd_device, 176 &pcm038_sram_mtd_device,
178 &mxc_wdt, 177 &mxc_wdt,
179}; 178};
@@ -325,6 +324,7 @@ static void __init pcm038_init(void)
325 324
326 mxc_register_device(&mxc_usbh2, &usbh2_pdata); 325 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
327 326
327 imx27_add_fec(NULL);
328 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 328 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
329 329
330#ifdef CONFIG_MACH_PCM970_BASEBOARD 330#ifdef CONFIG_MACH_PCM970_BASEBOARD
diff --git a/arch/arm/mach-mx25/devices-imx25.h b/arch/arm/mach-mx25/devices-imx25.h
index fa7e05088e25..733aaee5bae8 100644
--- a/arch/arm/mach-mx25/devices-imx25.h
+++ b/arch/arm/mach-mx25/devices-imx25.h
@@ -9,6 +9,10 @@
9#include <mach/mx25.h> 9#include <mach/mx25.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12extern const struct imx_fec_data imx25_fec_data __initconst;
13#define imx25_add_fec(pdata) \
14 imx_add_fec(&imx25_fec_data, pdata)
15
12#define imx25_add_flexcan0(pdata) \ 16#define imx25_add_flexcan0(pdata) \
13 imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata) 17 imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata)
14#define imx25_add_flexcan1(pdata) \ 18#define imx25_add_flexcan1(pdata) \
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c
index bc19e8cc26df..1d0eb3e85941 100644
--- a/arch/arm/mach-mx25/devices.c
+++ b/arch/arm/mach-mx25/devices.c
@@ -208,26 +208,6 @@ int __init imx25_register_gpios(void)
208 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); 208 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
209} 209}
210 210
211static struct resource mx25_fec_resources[] = {
212 {
213 .start = MX25_FEC_BASE_ADDR,
214 .end = MX25_FEC_BASE_ADDR + 0xfff,
215 .flags = IORESOURCE_MEM,
216 },
217 {
218 .start = MX25_INT_FEC,
219 .end = MX25_INT_FEC,
220 .flags = IORESOURCE_IRQ,
221 },
222};
223
224struct platform_device mx25_fec_device = {
225 .name = "fec",
226 .id = 0,
227 .num_resources = ARRAY_SIZE(mx25_fec_resources),
228 .resource = mx25_fec_resources,
229};
230
231static struct resource mx25_rtc_resources[] = { 211static struct resource mx25_rtc_resources[] = {
232 { 212 {
233 .start = MX25_DRYICE_BASE_ADDR, 213 .start = MX25_DRYICE_BASE_ADDR,
diff --git a/arch/arm/mach-mx25/devices.h b/arch/arm/mach-mx25/devices.h
index f6e6d3a5f640..7b70a43c3a4b 100644
--- a/arch/arm/mach-mx25/devices.h
+++ b/arch/arm/mach-mx25/devices.h
@@ -6,7 +6,6 @@ extern struct platform_device mxc_pwm_device1;
6extern struct platform_device mxc_pwm_device2; 6extern struct platform_device mxc_pwm_device2;
7extern struct platform_device mxc_pwm_device3; 7extern struct platform_device mxc_pwm_device3;
8extern struct platform_device mxc_keypad_device; 8extern struct platform_device mxc_keypad_device;
9extern struct platform_device mx25_fec_device;
10extern struct platform_device mx25_rtc_device; 9extern struct platform_device mx25_rtc_device;
11extern struct platform_device mx25_fb_device; 10extern struct platform_device mx25_fb_device;
12extern struct platform_device mxc_wdt; 11extern struct platform_device mxc_wdt;
diff --git a/arch/arm/mach-mx25/mach-cpuimx25.c b/arch/arm/mach-mx25/mach-cpuimx25.c
index e064bb3d6919..21d9b9e9c92c 100644
--- a/arch/arm/mach-mx25/mach-cpuimx25.c
+++ b/arch/arm/mach-mx25/mach-cpuimx25.c
@@ -23,7 +23,6 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/fec.h>
27#include <linux/platform_device.h> 26#include <linux/platform_device.h>
28#include <linux/usb/otg.h> 27#include <linux/usb/otg.h>
29#include <linux/usb/ulpi.h> 28#include <linux/usb/ulpi.h>
@@ -67,7 +66,7 @@ static struct pad_desc eukrea_cpuimx25_pads[] = {
67 MX25_PAD_I2C1_DAT__I2C1_DAT, 66 MX25_PAD_I2C1_DAT__I2C1_DAT,
68}; 67};
69 68
70static struct fec_platform_data mx25_fec_pdata = { 69static const struct fec_platform_data mx25_fec_pdata __initconst = {
71 .phy = PHY_INTERFACE_MODE_RMII, 70 .phy = PHY_INTERFACE_MODE_RMII,
72}; 71};
73 72
@@ -129,7 +128,7 @@ static void __init eukrea_cpuimx25_init(void)
129 imx25_add_imx_uart0(&uart_pdata); 128 imx25_add_imx_uart0(&uart_pdata);
130 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info); 129 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info);
131 mxc_register_device(&mx25_rtc_device, NULL); 130 mxc_register_device(&mx25_rtc_device, NULL);
132 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata); 131 imx25_add_fec(&mx25_fec_pdata);
133 132
134 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices, 133 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
135 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices)); 134 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices));
diff --git a/arch/arm/mach-mx25/mach-mx25_3ds.c b/arch/arm/mach-mx25/mach-mx25_3ds.c
index 62bc21f11a71..bd1805698631 100644
--- a/arch/arm/mach-mx25/mach-mx25_3ds.c
+++ b/arch/arm/mach-mx25/mach-mx25_3ds.c
@@ -28,7 +28,6 @@
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/gpio.h> 30#include <linux/gpio.h>
31#include <linux/fec.h>
32#include <linux/platform_device.h> 31#include <linux/platform_device.h>
33#include <linux/input/matrix_keypad.h> 32#include <linux/input/matrix_keypad.h>
34 33
@@ -99,7 +98,7 @@ static struct pad_desc mx25pdk_pads[] = {
99 MX25_PAD_KPP_COL3__KPP_COL3, 98 MX25_PAD_KPP_COL3__KPP_COL3,
100}; 99};
101 100
102static struct fec_platform_data mx25_fec_pdata = { 101static const struct fec_platform_data mx25_fec_pdata __initconst = {
103 .phy = PHY_INTERFACE_MODE_RMII, 102 .phy = PHY_INTERFACE_MODE_RMII,
104}; 103};
105 104
@@ -192,7 +191,7 @@ static void __init mx25pdk_init(void)
192 mxc_register_device(&mxc_wdt, NULL); 191 mxc_register_device(&mxc_wdt, NULL);
193 192
194 mx25pdk_fec_reset(); 193 mx25pdk_fec_reset();
195 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata); 194 imx25_add_fec(&mx25_fec_pdata);
196 mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data); 195 mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data);
197} 196}
198 197
diff --git a/arch/arm/mach-mx3/devices-imx35.h b/arch/arm/mach-mx3/devices-imx35.h
index 766008451ccd..509b346b7fef 100644
--- a/arch/arm/mach-mx3/devices-imx35.h
+++ b/arch/arm/mach-mx3/devices-imx35.h
@@ -9,6 +9,10 @@
9#include <mach/mx35.h> 9#include <mach/mx35.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12extern const struct imx_fec_data imx35_fec_data __initconst;
13#define imx35_add_fec(pdata) \
14 imx_add_fec(&imx35_fec_data, pdata)
15
12#define imx35_add_flexcan0(pdata) \ 16#define imx35_add_flexcan0(pdata) \
13 imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata) 17 imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata)
14#define imx35_add_flexcan1(pdata) \ 18#define imx35_add_flexcan1(pdata) \
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index 87a9a21457b9..f4dff11aaee7 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -281,27 +281,6 @@ struct platform_device mxc_usbh2 = {
281 .num_resources = ARRAY_SIZE(mxc_usbh2_resources), 281 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
282}; 282};
283 283
284#if defined(CONFIG_ARCH_MX35)
285static struct resource mxc_fec_resources[] = {
286 {
287 .start = MXC_FEC_BASE_ADDR,
288 .end = MXC_FEC_BASE_ADDR + 0xfff,
289 .flags = IORESOURCE_MEM,
290 }, {
291 .start = MXC_INT_FEC,
292 .end = MXC_INT_FEC,
293 .flags = IORESOURCE_IRQ,
294 },
295};
296
297struct platform_device mxc_fec_device = {
298 .name = "fec",
299 .id = 0,
300 .num_resources = ARRAY_SIZE(mxc_fec_resources),
301 .resource = mxc_fec_resources,
302};
303#endif
304
305static struct resource imx_wdt_resources[] = { 284static struct resource imx_wdt_resources[] = {
306 { 285 {
307 .flags = IORESOURCE_MEM, 286 .flags = IORESOURCE_MEM,
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index 2a69465bc542..585f814473d5 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -2,7 +2,6 @@ extern struct platform_device mxc_w1_master_device;
2extern struct platform_device mx3_ipu; 2extern struct platform_device mx3_ipu;
3extern struct platform_device mx3_fb; 3extern struct platform_device mx3_fb;
4extern struct platform_device mx3_camera; 4extern struct platform_device mx3_camera;
5extern struct platform_device mxc_fec_device;
6extern struct platform_device mxcsdhc_device0; 5extern struct platform_device mxcsdhc_device0;
7extern struct platform_device mxcsdhc_device1; 6extern struct platform_device mxcsdhc_device1;
8extern struct platform_device mxc_otg_udc_device; 7extern struct platform_device mxc_otg_udc_device;
diff --git a/arch/arm/mach-mx3/mach-cpuimx35.c b/arch/arm/mach-mx3/mach-cpuimx35.c
index ea0a85f1c9aa..781ab4694a0f 100644
--- a/arch/arm/mach-mx3/mach-cpuimx35.c
+++ b/arch/arm/mach-mx3/mach-cpuimx35.c
@@ -76,7 +76,6 @@ static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
76}; 76};
77 77
78static struct platform_device *devices[] __initdata = { 78static struct platform_device *devices[] __initdata = {
79 &mxc_fec_device,
80 &imx_wdt_device0, 79 &imx_wdt_device0,
81}; 80};
82 81
@@ -158,6 +157,7 @@ static void __init mxc_board_init(void)
158 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads, 157 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads,
159 ARRAY_SIZE(eukrea_cpuimx35_pads)); 158 ARRAY_SIZE(eukrea_cpuimx35_pads));
160 159
160 imx35_add_fec(NULL);
161 platform_add_devices(devices, ARRAY_SIZE(devices)); 161 platform_add_devices(devices, ARRAY_SIZE(devices));
162 162
163 imx35_add_imx_uart0(&uart_pdata); 163 imx35_add_imx_uart0(&uart_pdata);
diff --git a/arch/arm/mach-mx3/mach-mx35_3ds.c b/arch/arm/mach-mx3/mach-mx35_3ds.c
index 1dd7baae4507..91bb06552af1 100644
--- a/arch/arm/mach-mx3/mach-mx35_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx35_3ds.c
@@ -74,7 +74,6 @@ static const struct mxc_nand_platform_data mx35pdk_nand_board_info __initconst =
74}; 74};
75 75
76static struct platform_device *devices[] __initdata = { 76static struct platform_device *devices[] __initdata = {
77 &mxc_fec_device,
78 &mx35pdk_flash, 77 &mx35pdk_flash,
79}; 78};
80 79
@@ -131,6 +130,7 @@ static void __init mxc_board_init(void)
131{ 130{
132 mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads)); 131 mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads));
133 132
133 imx35_add_fec(NULL);
134 platform_add_devices(devices, ARRAY_SIZE(devices)); 134 platform_add_devices(devices, ARRAY_SIZE(devices));
135 135
136 imx35_add_imx_uart0(&uart_pdata); 136 imx35_add_imx_uart0(&uart_pdata);
diff --git a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
index c427b3c35ca7..e790a00cf99f 100644
--- a/arch/arm/mach-mx3/mach-pcm043.c
+++ b/arch/arm/mach-mx3/mach-pcm043.c
@@ -140,7 +140,6 @@ static struct i2c_board_info pcm043_i2c_devices[] = {
140 140
141static struct platform_device *devices[] __initdata = { 141static struct platform_device *devices[] __initdata = {
142 &pcm043_flash, 142 &pcm043_flash,
143 &mxc_fec_device,
144 &imx_wdt_device0, 143 &imx_wdt_device0,
145}; 144};
146 145
@@ -363,6 +362,7 @@ static void __init mxc_board_init(void)
363 MXC_AUDMUX_V2_PTCR_TCLKDIR, /* clock is output */ 362 MXC_AUDMUX_V2_PTCR_TCLKDIR, /* clock is output */
364 MXC_AUDMUX_V2_PDCR_RXDSEL(3)); 363 MXC_AUDMUX_V2_PDCR_RXDSEL(3));
365 364
365 imx35_add_fec(NULL);
366 platform_add_devices(devices, ARRAY_SIZE(devices)); 366 platform_add_devices(devices, ARRAY_SIZE(devices));
367 367
368 imx35_add_imx_uart0(&uart_pdata); 368 imx35_add_imx_uart0(&uart_pdata);
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index a6c09c7ff728..61f051043bbc 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -108,7 +108,6 @@ static struct platform_device serial_device = {
108#endif 108#endif
109 109
110static struct platform_device *devices[] __initdata = { 110static struct platform_device *devices[] __initdata = {
111 &mxc_fec_device,
112#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) 111#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
113 &serial_device, 112 &serial_device,
114#endif 113#endif
@@ -253,6 +252,7 @@ static void __init eukrea_cpuimx51_init(void)
253 gpio_direction_input(CPUIMX51_QUARTD_GPIO); 252 gpio_direction_input(CPUIMX51_QUARTD_GPIO);
254 gpio_free(CPUIMX51_QUARTD_GPIO); 253 gpio_free(CPUIMX51_QUARTD_GPIO);
255 254
255 imx51_add_fec(NULL);
256 platform_add_devices(devices, ARRAY_SIZE(devices)); 256 platform_add_devices(devices, ARRAY_SIZE(devices));
257 257
258 imx51_add_imx_i2c(1, &eukrea_cpuimx51_i2c_data); 258 imx51_add_imx_i2c(1, &eukrea_cpuimx51_i2c_data);
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 7c0b6618a164..23ee4a447406 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -46,10 +46,6 @@
46#define MX51_USB_PLL_DIV_19_2_MHZ 0x01 46#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
47#define MX51_USB_PLL_DIV_24_MHZ 0x02 47#define MX51_USB_PLL_DIV_24_MHZ 0x02
48 48
49static struct platform_device *devices[] __initdata = {
50 &mxc_fec_device,
51};
52
53static struct pad_desc mx51babbage_pads[] = { 49static struct pad_desc mx51babbage_pads[] = {
54 /* UART1 */ 50 /* UART1 */
55 MX51_PAD_UART1_RXD__UART1_RXD, 51 MX51_PAD_UART1_RXD__UART1_RXD,
@@ -290,7 +286,7 @@ static void __init mxc_board_init(void)
290 ARRAY_SIZE(mx51babbage_pads)); 286 ARRAY_SIZE(mx51babbage_pads));
291 mxc_init_imx_uart(); 287 mxc_init_imx_uart();
292 babbage_fec_reset(); 288 babbage_fec_reset();
293 platform_add_devices(devices, ARRAY_SIZE(devices)); 289 imx51_add_fec(NULL);
294 290
295 imx51_add_imx_i2c(0, &babbage_i2c_data); 291 imx51_add_imx_i2c(0, &babbage_i2c_data);
296 imx51_add_imx_i2c(1, &babbage_i2c_data); 292 imx51_add_imx_i2c(1, &babbage_i2c_data);
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
index 41d93c3d7d0b..c233379256b8 100644
--- a/arch/arm/mach-mx5/devices-imx51.h
+++ b/arch/arm/mach-mx5/devices-imx51.h
@@ -9,6 +9,10 @@
9#include <mach/mx51.h> 9#include <mach/mx51.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12extern const struct imx_fec_data imx51_fec_data __initconst;
13#define imx51_add_fec(pdata) \
14 imx_add_fec(&imx51_fec_data, pdata)
15
12extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst; 16extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst;
13#define imx51_add_imx_i2c(id, pdata) \ 17#define imx51_add_imx_i2c(id, pdata) \
14 imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata) 18 imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index 5f40082d9e61..4c7be87a7c9d 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -17,25 +17,6 @@
17#include <mach/imx-uart.h> 17#include <mach/imx-uart.h>
18#include <mach/irqs.h> 18#include <mach/irqs.h>
19 19
20static struct resource mxc_fec_resources[] = {
21 {
22 .start = MX51_MXC_FEC_BASE_ADDR,
23 .end = MX51_MXC_FEC_BASE_ADDR + 0xfff,
24 .flags = IORESOURCE_MEM,
25 }, {
26 .start = MX51_MXC_INT_FEC,
27 .end = MX51_MXC_INT_FEC,
28 .flags = IORESOURCE_IRQ,
29 },
30};
31
32struct platform_device mxc_fec_device = {
33 .name = "fec",
34 .id = 0,
35 .num_resources = ARRAY_SIZE(mxc_fec_resources),
36 .resource = mxc_fec_resources,
37};
38
39static struct resource mxc_hsi2c_resources[] = { 20static struct resource mxc_hsi2c_resources[] = {
40 { 21 {
41 .start = MX51_HSI2C_DMA_BASE_ADDR, 22 .start = MX51_HSI2C_DMA_BASE_ADDR,
diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
index 67a6d6910530..af1d07c0bbc1 100644
--- a/arch/arm/mach-mx5/devices.h
+++ b/arch/arm/mach-mx5/devices.h
@@ -1,4 +1,3 @@
1extern struct platform_device mxc_fec_device;
2extern struct platform_device mxc_usbdr_host_device; 1extern struct platform_device mxc_usbdr_host_device;
3extern struct platform_device mxc_usbh1_device; 2extern struct platform_device mxc_usbh1_device;
4extern struct platform_device mxc_usbdr_udc_device; 3extern struct platform_device mxc_usbdr_udc_device;
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index 8266ecb6933e..404799487f17 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -1,6 +1,10 @@
1config IMX_HAVE_PLATFORM_ESDHC 1config IMX_HAVE_PLATFORM_ESDHC
2 bool 2 bool
3 3
4config IMX_HAVE_PLATFORM_FEC
5 bool
6 default y if ARCH_MX25 || SOC_IMX27 || ARCH_MX35 || ARCH_MX51
7
4config IMX_HAVE_PLATFORM_FLEXCAN 8config IMX_HAVE_PLATFORM_FLEXCAN
5 select HAVE_CAN_FLEXCAN 9 select HAVE_CAN_FLEXCAN
6 bool 10 bool
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index cd0bf756c3f8..0a3c1f089413 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -1,4 +1,5 @@
1obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o 1obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o
2obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
2obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o 3obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
3obj-y += platform-imx-dma.o 4obj-y += platform-imx-dma.o
4obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o 5obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
diff --git a/arch/arm/plat-mxc/devices/platform-fec.c b/arch/arm/plat-mxc/devices/platform-fec.c
new file mode 100644
index 000000000000..11d087f4e219
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-fec.c
@@ -0,0 +1,58 @@
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 <asm/sizes.h>
10#include <mach/hardware.h>
11#include <mach/devices-common.h>
12
13#define imx_fec_data_entry_single(soc) \
14 { \
15 .iobase = soc ## _FEC_BASE_ADDR, \
16 .irq = soc ## _INT_FEC, \
17 }
18
19#ifdef CONFIG_ARCH_MX25
20const struct imx_fec_data imx25_fec_data __initconst =
21 imx_fec_data_entry_single(MX25);
22#endif /* ifdef CONFIG_ARCH_MX25 */
23
24#ifdef CONFIG_SOC_IMX27
25const struct imx_fec_data imx27_fec_data __initconst =
26 imx_fec_data_entry_single(MX27);
27#endif /* ifdef CONFIG_SOC_IMX27 */
28
29#ifdef CONFIG_ARCH_MX35
30const struct imx_fec_data imx35_fec_data __initconst =
31 imx_fec_data_entry_single(MX35);
32#endif
33
34#ifdef CONFIG_ARCH_MX51
35const struct imx_fec_data imx51_fec_data __initconst =
36 imx_fec_data_entry_single(MX51);
37#endif
38
39struct platform_device *__init imx_add_fec(
40 const struct imx_fec_data *data,
41 const struct fec_platform_data *pdata)
42{
43 struct resource res[] = {
44 {
45 .start = data->iobase,
46 .end = data->iobase + SZ_4K,
47 .flags = IORESOURCE_MEM,
48 }, {
49 .start = data->irq,
50 .end = data->irq,
51 .flags = IORESOURCE_IRQ,
52 },
53 };
54
55 return imx_add_platform_device("fec", 0 /* -1? */,
56 res, ARRAY_SIZE(res),
57 pdata, sizeof(*pdata));
58}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index f75446fa97eb..049897880403 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -14,6 +14,15 @@ struct platform_device *imx_add_platform_device(const char *name, int id,
14 const struct resource *res, unsigned int num_resources, 14 const struct resource *res, unsigned int num_resources,
15 const void *data, size_t size_data); 15 const void *data, size_t size_data);
16 16
17#include <linux/fec.h>
18struct imx_fec_data {
19 resource_size_t iobase;
20 resource_size_t irq;
21};
22struct platform_device *__init imx_add_fec(
23 const struct imx_fec_data *data,
24 const struct fec_platform_data *pdata);
25
17#include <linux/can/platform/flexcan.h> 26#include <linux/can/platform/flexcan.h>
18struct platform_device *__init imx_add_flexcan(int id, 27struct platform_device *__init imx_add_flexcan(int id,
19 resource_size_t iobase, resource_size_t iosize, 28 resource_size_t iobase, resource_size_t iosize,
diff --git a/arch/arm/plat-mxc/include/mach/mx51.h b/arch/arm/plat-mxc/include/mach/mx51.h
index 1906ee5a5497..c54b5c32d82e 100644
--- a/arch/arm/plat-mxc/include/mach/mx51.h
+++ b/arch/arm/plat-mxc/include/mach/mx51.h
@@ -140,7 +140,7 @@
140#define MX51_ATA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe0000) 140#define MX51_ATA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe0000)
141#define MX51_SIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe4000) 141#define MX51_SIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe4000)
142#define MX51_SSI3BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe8000) 142#define MX51_SSI3BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe8000)
143#define MX51_MXC_FEC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xec000) 143#define MX51_FEC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xec000)
144#define MX51_TVE_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf0000) 144#define MX51_TVE_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf0000)
145#define MX51_VPU_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf4000) 145#define MX51_VPU_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf4000)
146#define MX51_SAHARA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf8000) 146#define MX51_SAHARA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf8000)
@@ -366,7 +366,7 @@
366#define MX51_MXC_INT_GPU2_IRQ 84 366#define MX51_MXC_INT_GPU2_IRQ 84
367#define MX51_MXC_INT_GPU2_BUSY 85 367#define MX51_MXC_INT_GPU2_BUSY 85
368#define MX51_MXC_INT_RESV86 86 368#define MX51_MXC_INT_RESV86 86
369#define MX51_MXC_INT_FEC 87 369#define MX51_INT_FEC 87
370#define MX51_MXC_INT_OWIRE 88 370#define MX51_MXC_INT_OWIRE 88
371#define MX51_MXC_INT_CTI1_TG2 89 371#define MX51_MXC_INT_CTI1_TG2 89
372#define MX51_MXC_INT_SJC 90 372#define MX51_MXC_INT_SJC 90