Skip to content

Commit

Permalink
ARM: imx: dynamically register fec devices
Browse files Browse the repository at this point in the history
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
  • Loading branch information
Uwe Kleine-König authored and Sascha Hauer committed Oct 11, 2010
1 parent 8a8d206 commit 6bd96f3
Show file tree
Hide file tree
Showing 32 changed files with 107 additions and 123 deletions.
4 changes: 4 additions & 0 deletions arch/arm/mach-imx/devices-imx27.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 0 additions & 21 deletions arch/arm/mach-imx/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-imx/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/mach-cpuimx27.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/mach-imx27_visstrim_m10.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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));
}

Expand Down
6 changes: 1 addition & 5 deletions arch/arm/mach-imx/mach-imx27lite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 1 addition & 5 deletions arch/arm/mach-imx/mach-mx27_3ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/mach-mx27ads.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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));
}

Expand Down
7 changes: 1 addition & 6 deletions arch/arm/mach-imx/mach-mxt_td60.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/mach-pca100.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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));
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/mach-pcm038.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-mx25/devices-imx25.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
20 changes: 0 additions & 20 deletions arch/arm/mach-mx25/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-mx25/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions arch/arm/mach-mx25/mach-cpuimx25.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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));
Expand Down
5 changes: 2 additions & 3 deletions arch/arm/mach-mx25/mach-mx25_3ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-mx3/devices-imx35.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
21 changes: 0 additions & 21 deletions arch/arm/mach-mx3/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-mx3/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mx3/mach-cpuimx35.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mx3/mach-mx35_3ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mx3/mach-pcm043.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mx5/board-cpuimx51.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 6bd96f3

Please sign in to comment.