ARM: imx: dynamically register fec devices
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 6 Oct 2010 10:00:18 +0000 (12:00 +0200)
committerSascha Hauer <s.hauer@pengutronix.de>
Mon, 11 Oct 2010 13:31:37 +0000 (15:31 +0200)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
32 files changed:
arch/arm/mach-imx/devices-imx27.h
arch/arm/mach-imx/devices.c
arch/arm/mach-imx/devices.h
arch/arm/mach-imx/mach-cpuimx27.c
arch/arm/mach-imx/mach-imx27_visstrim_m10.c
arch/arm/mach-imx/mach-imx27lite.c
arch/arm/mach-imx/mach-mx27_3ds.c
arch/arm/mach-imx/mach-mx27ads.c
arch/arm/mach-imx/mach-mxt_td60.c
arch/arm/mach-imx/mach-pca100.c
arch/arm/mach-imx/mach-pcm038.c
arch/arm/mach-mx25/devices-imx25.h
arch/arm/mach-mx25/devices.c
arch/arm/mach-mx25/devices.h
arch/arm/mach-mx25/mach-cpuimx25.c
arch/arm/mach-mx25/mach-mx25_3ds.c
arch/arm/mach-mx3/devices-imx35.h
arch/arm/mach-mx3/devices.c
arch/arm/mach-mx3/devices.h
arch/arm/mach-mx3/mach-cpuimx35.c
arch/arm/mach-mx3/mach-mx35_3ds.c
arch/arm/mach-mx3/mach-pcm043.c
arch/arm/mach-mx5/board-cpuimx51.c
arch/arm/mach-mx5/board-mx51_babbage.c
arch/arm/mach-mx5/devices-imx51.h
arch/arm/mach-mx5/devices.c
arch/arm/mach-mx5/devices.h
arch/arm/plat-mxc/devices/Kconfig
arch/arm/plat-mxc/devices/Makefile
arch/arm/plat-mxc/devices/platform-fec.c [new file with mode: 0644]
arch/arm/plat-mxc/include/mach/devices-common.h
arch/arm/plat-mxc/include/mach/mx51.h

index e11606b4d31caf09b23b468c3a3a7f55ce38d296..7011690364f270286b8e4bc06d3c58edc868c434 100644 (file)
@@ -9,6 +9,10 @@
 #include <mach/mx27.h>
 #include <mach/devices-common.h>
 
+extern const struct imx_fec_data imx27_fec_data __initconst;
+#define imx27_add_fec(pdata)   \
+       imx_add_fec(&imx27_fec_data, pdata)
+
 extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst;
 #define imx27_add_imx_i2c(id, pdata)   \
        imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata)
index 423fa05dabd0ff531089ae276d96693e83eb5635..fba5047de8b1fde5ee532f6291bcfee700257a66 100644 (file)
@@ -314,27 +314,6 @@ struct platform_device mxc_fb_device = {
        },
 };
 
-#ifdef CONFIG_MACH_MX27
-static struct resource mxc_fec_resources[] = {
-       {
-               .start = MX27_FEC_BASE_ADDR,
-               .end = MX27_FEC_BASE_ADDR + SZ_4K - 1,
-               .flags = IORESOURCE_MEM,
-       }, {
-               .start = MX27_INT_FEC,
-               .end = MX27_INT_FEC,
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-struct platform_device mxc_fec_device = {
-       .name = "fec",
-       .id = 0,
-       .num_resources = ARRAY_SIZE(mxc_fec_resources),
-       .resource = mxc_fec_resources,
-};
-#endif
-
 static struct resource mxc_pwm_resources[] = {
        {
                .start = MX2x_PWM_BASE_ADDR,
index 57d4b1cac039850f409c289a777ff333d4b784b9..807f02a031c9454ce3534e26f508cd34fdc2b36e 100644 (file)
@@ -16,7 +16,6 @@ extern struct platform_device mxc_gpt5;
 extern struct platform_device mxc_wdt;
 extern struct platform_device mxc_w1_master_device;
 extern struct platform_device mxc_fb_device;
-extern struct platform_device mxc_fec_device;
 extern struct platform_device mxc_pwm_device;
 extern struct platform_device mxc_sdhc_device0;
 extern struct platform_device mxc_sdhc_device1;
index d4cb592ffaed1127dffabb40345f389e9323d9c4..28f73a1c79f7c24c1f17d7e71a307dc7e1eb0fd7 100644 (file)
@@ -157,7 +157,6 @@ cpuimx27_nand_board_info __initconst = {
 
 static struct platform_device *platform_devices[] __initdata = {
        &eukrea_cpuimx27_nor_mtd_device,
-       &mxc_fec_device,
        &mxc_wdt,
        &mxc_w1_master_device,
 };
@@ -261,6 +260,7 @@ static void __init eukrea_cpuimx27_init(void)
 
        imx27_add_imx_i2c(1, &cpuimx27_i2c1_data);
 
+       imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 
 #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
index 21904f32740c98bc92e00bc5d1af27df25b98599..a0d78faa08e83b49c405c03f18a8f146884278e7 100644 (file)
@@ -185,7 +185,6 @@ static struct platform_device visstrim_m10_nor_mtd_device = {
 static struct platform_device *platform_devices[] __initdata = {
        &visstrim_gpio_keys_device,
        &visstrim_m10_nor_mtd_device,
-       &mxc_fec_device,
 };
 
 /* Visstrim_M10 uses UART0 as console */
@@ -240,6 +239,7 @@ static void __init visstrim_m10_board_init(void)
        imx27_add_imx_i2c(1, &visstrim_m10_i2c_data);
        mxc_register_device(&mxc_sdhc_device0, &visstrim_m10_sdhc_pdata);
        mxc_register_device(&mxc_otg_host, &visstrim_m10_usbotg_pdata);
+       imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 }
 
index 67480b639e2cc3f29be61a72b2fcc82f2377a713..60d4d0ac493914d9f3c105f25813ab3f81f0b8ac 100644 (file)
@@ -58,16 +58,12 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
 
-static struct platform_device *platform_devices[] __initdata = {
-       &mxc_fec_device,
-};
-
 static void __init mx27lite_init(void)
 {
        mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins),
                "imx27lite");
        imx27_add_imx_uart0(&uart_pdata);
-       platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+       imx27_add_fec(NULL);
 }
 
 static void __init mx27lite_timer_init(void)
index 9f6832d5f7f7be68769c97f0427edb3d17530185..a69dba2526584fb73b6ecd1a6e3eb3eac0780727 100644 (file)
@@ -64,10 +64,6 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
 
-static struct platform_device *platform_devices[] __initdata = {
-       &mxc_fec_device,
-};
-
 /*
  * Matrix keyboard
  */
@@ -94,7 +90,7 @@ static void __init mx27pdk_init(void)
        mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
                "mx27pdk");
        imx27_add_imx_uart0(&uart_pdata);
-       platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+       imx27_add_fec(NULL);
        mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data);
 }
 
index 1a33288787a88a4dddd461e737f2c98b15b05a0a..ffb39a42f2408a8cfc2dc05b7b2705494efddba0 100644 (file)
@@ -284,7 +284,6 @@ static struct imxmmc_platform_data sdhc2_pdata = {
 
 static struct platform_device *platform_devices[] __initdata = {
        &mx27ads_nor_mtd_device,
-       &mxc_fec_device,
        &mxc_w1_master_device,
 };
 
@@ -313,6 +312,7 @@ static void __init mx27ads_board_init(void)
        mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
        mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata);
 
+       imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 }
 
index 58fb0d6539814541bbad256a2cf6e5468cb5640b..f4c397dec79465f8bf5a1089722e10589e05a88d 100644 (file)
@@ -231,10 +231,6 @@ static struct imxmmc_platform_data sdhc1_pdata = {
        .exit = mxt_td60_sdhc1_exit,
 };
 
-static struct platform_device *platform_devices[] __initdata = {
-       &mxc_fec_device,
-};
-
 static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
@@ -259,8 +255,7 @@ static void __init mxt_td60_board_init(void)
        imx27_add_imx_i2c(1, &mxt_td60_i2c1_data);
        mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data);
        mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
-
-       platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+       imx27_add_fec(NULL);
 }
 
 static void __init mxt_td60_timer_init(void)
index 1247ce9dabade1e9aa772b7971812c9a73fef891..223c31c48db629c73360c00b92633810f47a934e 100644 (file)
@@ -173,7 +173,6 @@ pca100_nand_board_info __initconst = {
 
 static struct platform_device *platform_devices[] __initdata = {
        &mxc_w1_master_device,
-       &mxc_fec_device,
        &mxc_wdt,
 };
 
@@ -433,6 +432,7 @@ static void __init pca100_init(void)
 
        mxc_register_device(&mxc_fb_device, &pca100_fb_data);
 
+       imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 }
 
index 3fbed661f612933438369b4676e0eb619a2b2c61..b9888a8defc1df11834f5717830903598ea7eeed 100644 (file)
@@ -173,7 +173,6 @@ pcm038_nand_board_info __initconst = {
 static struct platform_device *platform_devices[] __initdata = {
        &pcm038_nor_mtd_device,
        &mxc_w1_master_device,
-       &mxc_fec_device,
        &pcm038_sram_mtd_device,
        &mxc_wdt,
 };
@@ -325,6 +324,7 @@ static void __init pcm038_init(void)
 
        mxc_register_device(&mxc_usbh2, &usbh2_pdata);
 
+       imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 
 #ifdef CONFIG_MACH_PCM970_BASEBOARD
index fa7e05088e259f9c1f0a75f3dc134a9e0e6cae25..733aaee5bae8adcd82b884baa7d22af01403eecd 100644 (file)
@@ -9,6 +9,10 @@
 #include <mach/mx25.h>
 #include <mach/devices-common.h>
 
+extern const struct imx_fec_data imx25_fec_data __initconst;
+#define imx25_add_fec(pdata)   \
+       imx_add_fec(&imx25_fec_data, pdata)
+
 #define imx25_add_flexcan0(pdata)      \
        imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata)
 #define imx25_add_flexcan1(pdata)      \
index bc19e8cc26dfe9ca37b1f916380da2b391e89ffd..1d0eb3e85941030d091fc6094bc955ae40035128 100644 (file)
@@ -208,26 +208,6 @@ int __init imx25_register_gpios(void)
        return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
 }
 
-static struct resource mx25_fec_resources[] = {
-       {
-               .start  = MX25_FEC_BASE_ADDR,
-               .end    = MX25_FEC_BASE_ADDR + 0xfff,
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               .start  = MX25_INT_FEC,
-               .end    = MX25_INT_FEC,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-struct platform_device mx25_fec_device = {
-       .name   = "fec",
-       .id     = 0,
-       .num_resources  = ARRAY_SIZE(mx25_fec_resources),
-       .resource       = mx25_fec_resources,
-};
-
 static struct resource mx25_rtc_resources[] = {
        {
                .start  = MX25_DRYICE_BASE_ADDR,
index f6e6d3a5f6403f8923e4ca321df53669b6cb93a6..7b70a43c3a4be3bccf692c4dea2e62f2af1615f5 100644 (file)
@@ -6,7 +6,6 @@ extern struct platform_device mxc_pwm_device1;
 extern struct platform_device mxc_pwm_device2;
 extern struct platform_device mxc_pwm_device3;
 extern struct platform_device mxc_keypad_device;
-extern struct platform_device mx25_fec_device;
 extern struct platform_device mx25_rtc_device;
 extern struct platform_device mx25_fb_device;
 extern struct platform_device mxc_wdt;
index e064bb3d69197b8ddee286eda06dee980052712d..21d9b9e9c92c9f9c387c94939d082c2ec487fabd 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/clk.h>
 #include <linux/irq.h>
 #include <linux/gpio.h>
-#include <linux/fec.h>
 #include <linux/platform_device.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
@@ -67,7 +66,7 @@ static struct pad_desc eukrea_cpuimx25_pads[] = {
        MX25_PAD_I2C1_DAT__I2C1_DAT,
 };
 
-static struct fec_platform_data mx25_fec_pdata = {
+static const struct fec_platform_data mx25_fec_pdata __initconst = {
        .phy    = PHY_INTERFACE_MODE_RMII,
 };
 
@@ -129,7 +128,7 @@ static void __init eukrea_cpuimx25_init(void)
        imx25_add_imx_uart0(&uart_pdata);
        imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info);
        mxc_register_device(&mx25_rtc_device, NULL);
-       mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
+       imx25_add_fec(&mx25_fec_pdata);
 
        i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
                                ARRAY_SIZE(eukrea_cpuimx25_i2c_devices));
index 62bc21f11a714aa46df5e439d4965f340d59460a..bd1805698631152c7c42b34a0147490b4798d025 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/clk.h>
 #include <linux/irq.h>
 #include <linux/gpio.h>
-#include <linux/fec.h>
 #include <linux/platform_device.h>
 #include <linux/input/matrix_keypad.h>
 
@@ -99,7 +98,7 @@ static struct pad_desc mx25pdk_pads[] = {
        MX25_PAD_KPP_COL3__KPP_COL3,
 };
 
-static struct fec_platform_data mx25_fec_pdata = {
+static const struct fec_platform_data mx25_fec_pdata __initconst = {
         .phy    = PHY_INTERFACE_MODE_RMII,
 };
 
@@ -192,7 +191,7 @@ static void __init mx25pdk_init(void)
        mxc_register_device(&mxc_wdt, NULL);
 
        mx25pdk_fec_reset();
-       mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
+       imx25_add_fec(&mx25_fec_pdata);
        mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data);
 }
 
index 766008451ccd44940004aedc84a51e93361dbf26..509b346b7fef10203619008aaa89e0f66955b7ff 100644 (file)
@@ -9,6 +9,10 @@
 #include <mach/mx35.h>
 #include <mach/devices-common.h>
 
+extern const struct imx_fec_data imx35_fec_data __initconst;
+#define imx35_add_fec(pdata)   \
+       imx_add_fec(&imx35_fec_data, pdata)
+
 #define imx35_add_flexcan0(pdata)      \
        imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata)
 #define imx35_add_flexcan1(pdata)      \
index 87a9a21457b9df838540fcdc02f3c6e9bae8ac57..f4dff11aaee7a68aa58fb9a07a43aca9662f6856 100644 (file)
@@ -281,27 +281,6 @@ struct platform_device mxc_usbh2 = {
        .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
 };
 
-#if defined(CONFIG_ARCH_MX35)
-static struct resource mxc_fec_resources[] = {
-       {
-               .start  = MXC_FEC_BASE_ADDR,
-               .end    = MXC_FEC_BASE_ADDR + 0xfff,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .start  = MXC_INT_FEC,
-               .end    = MXC_INT_FEC,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-struct platform_device mxc_fec_device = {
-       .name = "fec",
-       .id = 0,
-       .num_resources = ARRAY_SIZE(mxc_fec_resources),
-       .resource = mxc_fec_resources,
-};
-#endif
-
 static struct resource imx_wdt_resources[] = {
        {
                .flags = IORESOURCE_MEM,
index 2a69465bc54212bab3c9d0a6bb54d0f2aaf6db48..585f814473d5f7b857426b8f549bf1512002e9da 100644 (file)
@@ -2,7 +2,6 @@ extern struct platform_device mxc_w1_master_device;
 extern struct platform_device mx3_ipu;
 extern struct platform_device mx3_fb;
 extern struct platform_device mx3_camera;
-extern struct platform_device mxc_fec_device;
 extern struct platform_device mxcsdhc_device0;
 extern struct platform_device mxcsdhc_device1;
 extern struct platform_device mxc_otg_udc_device;
index ea0a85f1c9aa3e51835b193a2e07ebcbfcc6efc2..781ab4694a0f5169a0a75a80097817e2fccd59a2 100644 (file)
@@ -76,7 +76,6 @@ static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
 };
 
 static struct platform_device *devices[] __initdata = {
-       &mxc_fec_device,
        &imx_wdt_device0,
 };
 
@@ -158,6 +157,7 @@ static void __init mxc_board_init(void)
        mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads,
                        ARRAY_SIZE(eukrea_cpuimx35_pads));
 
+       imx35_add_fec(NULL);
        platform_add_devices(devices, ARRAY_SIZE(devices));
 
        imx35_add_imx_uart0(&uart_pdata);
index 1dd7baae4507a0ae12778a7b85c59c6eb00d971c..91bb06552af1295475915c0adfdf726c4f66419d 100644 (file)
@@ -74,7 +74,6 @@ static const struct mxc_nand_platform_data mx35pdk_nand_board_info __initconst =
 };
 
 static struct platform_device *devices[] __initdata = {
-       &mxc_fec_device,
        &mx35pdk_flash,
 };
 
@@ -131,6 +130,7 @@ static void __init mxc_board_init(void)
 {
        mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads));
 
+       imx35_add_fec(NULL);
        platform_add_devices(devices, ARRAY_SIZE(devices));
 
        imx35_add_imx_uart0(&uart_pdata);
index c427b3c35ca743f83e83325eb8f1270b7b3c0483..e790a00cf99f72b80ad93ef97310f1888b5af790 100644 (file)
@@ -140,7 +140,6 @@ static struct i2c_board_info pcm043_i2c_devices[] = {
 
 static struct platform_device *devices[] __initdata = {
        &pcm043_flash,
-       &mxc_fec_device,
        &imx_wdt_device0,
 };
 
@@ -363,6 +362,7 @@ static void __init mxc_board_init(void)
                        MXC_AUDMUX_V2_PTCR_TCLKDIR, /* clock is output */
                        MXC_AUDMUX_V2_PDCR_RXDSEL(3));
 
+       imx35_add_fec(NULL);
        platform_add_devices(devices, ARRAY_SIZE(devices));
 
        imx35_add_imx_uart0(&uart_pdata);
index a6c09c7ff728ca399bf12044a556491b654a9850..61f051043bbc3d3b3443188e4be4755c2885f7d4 100644 (file)
@@ -108,7 +108,6 @@ static struct platform_device serial_device = {
 #endif
 
 static struct platform_device *devices[] __initdata = {
-       &mxc_fec_device,
 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
        &serial_device,
 #endif
@@ -253,6 +252,7 @@ static void __init eukrea_cpuimx51_init(void)
        gpio_direction_input(CPUIMX51_QUARTD_GPIO);
        gpio_free(CPUIMX51_QUARTD_GPIO);
 
+       imx51_add_fec(NULL);
        platform_add_devices(devices, ARRAY_SIZE(devices));
 
        imx51_add_imx_i2c(1, &eukrea_cpuimx51_i2c_data);
index 7c0b6618a164c6c2c674cbec9f8d9efc989d5c82..23ee4a447406a3108b05b4cbeb96349139e70ef7 100644 (file)
 #define        MX51_USB_PLL_DIV_19_2_MHZ       0x01
 #define        MX51_USB_PLL_DIV_24_MHZ 0x02
 
-static struct platform_device *devices[] __initdata = {
-       &mxc_fec_device,
-};
-
 static struct pad_desc mx51babbage_pads[] = {
        /* UART1 */
        MX51_PAD_UART1_RXD__UART1_RXD,
@@ -290,7 +286,7 @@ static void __init mxc_board_init(void)
                                        ARRAY_SIZE(mx51babbage_pads));
        mxc_init_imx_uart();
        babbage_fec_reset();
-       platform_add_devices(devices, ARRAY_SIZE(devices));
+       imx51_add_fec(NULL);
 
        imx51_add_imx_i2c(0, &babbage_i2c_data);
        imx51_add_imx_i2c(1, &babbage_i2c_data);
index 41d93c3d7d0b2d9032ba6d0c3f56877611f63f60..c233379256b8ee3a880fd2f3488a3dd93d193851 100644 (file)
@@ -9,6 +9,10 @@
 #include <mach/mx51.h>
 #include <mach/devices-common.h>
 
+extern const struct imx_fec_data imx51_fec_data __initconst;
+#define imx51_add_fec(pdata)   \
+       imx_add_fec(&imx51_fec_data, pdata)
+
 extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst;
 #define imx51_add_imx_i2c(id, pdata)   \
        imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
index 5f40082d9e61643963740cdab71c845a3e59ca0f..4c7be87a7c9d17e57857e0376ce2ddc9fd53a6e7 100644 (file)
 #include <mach/imx-uart.h>
 #include <mach/irqs.h>
 
-static struct resource mxc_fec_resources[] = {
-       {
-               .start  = MX51_MXC_FEC_BASE_ADDR,
-               .end    = MX51_MXC_FEC_BASE_ADDR + 0xfff,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .start  = MX51_MXC_INT_FEC,
-               .end    = MX51_MXC_INT_FEC,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-struct platform_device mxc_fec_device = {
-       .name = "fec",
-       .id = 0,
-       .num_resources = ARRAY_SIZE(mxc_fec_resources),
-       .resource = mxc_fec_resources,
-};
-
 static struct resource mxc_hsi2c_resources[] = {
        {
                .start = MX51_HSI2C_DMA_BASE_ADDR,
index 67a6d6910530c4716a38cb3526ece21773856890..af1d07c0bbc171822034146034eb1720015e0d3d 100644 (file)
@@ -1,4 +1,3 @@
-extern struct platform_device mxc_fec_device;
 extern struct platform_device mxc_usbdr_host_device;
 extern struct platform_device mxc_usbh1_device;
 extern struct platform_device mxc_usbdr_udc_device;
index 8266ecb6933e6603966c50c9163191cb02673dda..404799487f1760b5eb9cec4e0636753830b54566 100644 (file)
@@ -1,6 +1,10 @@
 config IMX_HAVE_PLATFORM_ESDHC
        bool
 
+config IMX_HAVE_PLATFORM_FEC
+       bool
+       default y if ARCH_MX25 || SOC_IMX27 || ARCH_MX35 || ARCH_MX51
+
 config IMX_HAVE_PLATFORM_FLEXCAN
        select HAVE_CAN_FLEXCAN
        bool
index cd0bf756c3f803ff4537352359fb226fa2a080b3..0a3c1f089413e2e2a896326612e3dd080e02818f 100644 (file)
@@ -1,4 +1,5 @@
 obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
 obj-y += platform-imx-dma.o
 obj-$(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 (file)
index 0000000..11d087f
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010 Pengutronix
+ * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+#include <asm/sizes.h>
+#include <mach/hardware.h>
+#include <mach/devices-common.h>
+
+#define imx_fec_data_entry_single(soc)                                 \
+       {                                                               \
+               .iobase = soc ## _FEC_BASE_ADDR,                        \
+               .irq = soc ## _INT_FEC,                                 \
+       }
+
+#ifdef CONFIG_ARCH_MX25
+const struct imx_fec_data imx25_fec_data __initconst =
+       imx_fec_data_entry_single(MX25);
+#endif /* ifdef CONFIG_ARCH_MX25 */
+
+#ifdef CONFIG_SOC_IMX27
+const struct imx_fec_data imx27_fec_data __initconst =
+       imx_fec_data_entry_single(MX27);
+#endif /* ifdef CONFIG_SOC_IMX27 */
+
+#ifdef CONFIG_ARCH_MX35
+const struct imx_fec_data imx35_fec_data __initconst =
+       imx_fec_data_entry_single(MX35);
+#endif
+
+#ifdef CONFIG_ARCH_MX51
+const struct imx_fec_data imx51_fec_data __initconst =
+       imx_fec_data_entry_single(MX51);
+#endif
+
+struct platform_device *__init imx_add_fec(
+               const struct imx_fec_data *data,
+               const struct fec_platform_data *pdata)
+{
+       struct resource res[] = {
+               {
+                       .start = data->iobase,
+                       .end = data->iobase + SZ_4K,
+                       .flags = IORESOURCE_MEM,
+               }, {
+                       .start = data->irq,
+                       .end = data->irq,
+                       .flags = IORESOURCE_IRQ,
+               },
+       };
+
+       return imx_add_platform_device("fec", 0 /* -1? */,
+                       res, ARRAY_SIZE(res),
+                       pdata, sizeof(*pdata));
+}
index f75446fa97eb540d9a8968e9730d22d5f0539b77..0498978804034eb36bf5ea82f44e87e8a7811941 100644 (file)
@@ -14,6 +14,15 @@ struct platform_device *imx_add_platform_device(const char *name, int id,
                const struct resource *res, unsigned int num_resources,
                const void *data, size_t size_data);
 
+#include <linux/fec.h>
+struct imx_fec_data {
+       resource_size_t iobase;
+       resource_size_t irq;
+};
+struct platform_device *__init imx_add_fec(
+               const struct imx_fec_data *data,
+               const struct fec_platform_data *pdata);
+
 #include <linux/can/platform/flexcan.h>
 struct platform_device *__init imx_add_flexcan(int id,
                resource_size_t iobase, resource_size_t iosize,
index 1906ee5a5497984a16c6312d0d66e96534c84d63..c54b5c32d82ed6b09238d445554d4d4c7a4fc737 100644 (file)
 #define MX51_ATA_BASE_ADDR             (MX51_AIPS2_BASE_ADDR + 0xe0000)
 #define MX51_SIM_BASE_ADDR             (MX51_AIPS2_BASE_ADDR + 0xe4000)
 #define MX51_SSI3BASE_ADDR             (MX51_AIPS2_BASE_ADDR + 0xe8000)
-#define MX51_MXC_FEC_BASE_ADDR         (MX51_AIPS2_BASE_ADDR + 0xec000)
+#define MX51_FEC_BASE_ADDR             (MX51_AIPS2_BASE_ADDR + 0xec000)
 #define MX51_TVE_BASE_ADDR             (MX51_AIPS2_BASE_ADDR + 0xf0000)
 #define MX51_VPU_BASE_ADDR             (MX51_AIPS2_BASE_ADDR + 0xf4000)
 #define MX51_SAHARA_BASE_ADDR          (MX51_AIPS2_BASE_ADDR + 0xf8000)
 #define MX51_MXC_INT_GPU2_IRQ          84
 #define MX51_MXC_INT_GPU2_BUSY         85
 #define MX51_MXC_INT_RESV86            86
-#define MX51_MXC_INT_FEC               87
+#define MX51_INT_FEC                   87
 #define MX51_MXC_INT_OWIRE             88
 #define MX51_MXC_INT_CTI1_TG2          89
 #define MX51_MXC_INT_SJC               90