diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-09-09 12:19:41 +0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-09-09 12:19:41 +0400 |
commit | 7e90534a8fde3a528606ada5dedfa244d8e0452d (patch) | |
tree | 98d17fafc1c882d80af25258cec14f7bb4b91517 /arch/arm/mach-mx2 | |
parent | 5cf0942123bcacf8af8922eaf3fef70bce6078e6 (diff) | |
download | linux-7e90534a8fde3a528606ada5dedfa244d8e0452d.tar.xz |
i.MX2: make SoC devices globally available
Make SoC devices globally available to boards rather than using
a device specific init function.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx2')
-rw-r--r-- | arch/arm/mach-mx2/devices.h | 15 | ||||
-rw-r--r-- | arch/arm/mach-mx2/mx27ads.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-mx2/pcm038.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-mx2/serial.c | 51 |
4 files changed, 34 insertions, 52 deletions
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h new file mode 100644 index 000000000000..c77a4b8f73b4 --- /dev/null +++ b/arch/arm/mach-mx2/devices.h @@ -0,0 +1,15 @@ + +extern struct platform_device mxc_gpt1; +extern struct platform_device mxc_gpt2; +extern struct platform_device mxc_gpt3; +extern struct platform_device mxc_gpt4; +extern struct platform_device mxc_gpt5; +extern struct platform_device mxc_wdt; +extern struct platform_device mxc_irda_device; +extern struct platform_device mxc_uart_device0; +extern struct platform_device mxc_uart_device1; +extern struct platform_device mxc_uart_device2; +extern struct platform_device mxc_uart_device3; +extern struct platform_device mxc_uart_device4; +extern struct platform_device mxc_uart_device5; + diff --git a/arch/arm/mach-mx2/mx27ads.c b/arch/arm/mach-mx2/mx27ads.c index 4ce56ef4d8d3..56e22d3ca075 100644 --- a/arch/arm/mach-mx2/mx27ads.c +++ b/arch/arm/mach-mx2/mx27ads.c @@ -34,6 +34,8 @@ #include <mach/iomux-mx1-mx2.h> #include <mach/board-mx27ads.h> +#include "devices.h" + /* ADS's NOR flash */ static struct physmap_flash_data mx27ads_flash_data = { .width = 2, @@ -251,12 +253,14 @@ static struct imxuart_platform_data uart_pdata[] = { static void __init mx27ads_board_init(void) { - int i; - gpio_fec_active(); - for (i = 0; i < 6; i++) - imx_init_uart(i, &uart_pdata[i]); + mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); + mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); + mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); + mxc_register_device(&mxc_uart_device3, &uart_pdata[3]); + mxc_register_device(&mxc_uart_device4, &uart_pdata[4]); + mxc_register_device(&mxc_uart_device5, &uart_pdata[5]); platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); } diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c index 1028f453cfc8..7f55746e2591 100644 --- a/arch/arm/mach-mx2/pcm038.c +++ b/arch/arm/mach-mx2/pcm038.c @@ -28,6 +28,8 @@ #include <mach/imx-uart.h> #include <mach/board-pcm038.h> +#include "devices.h" + /* * Phytec's phyCORE-i.MX27 comes with 32MiB flash, * 16 bit width @@ -170,11 +172,11 @@ static struct platform_device *platform_devices[] __initdata = { static void __init pcm038_init(void) { - int i; gpio_fec_active(); - for (i = 0; i < 3; i++) - imx_init_uart(i, &uart_pdata[i]); + mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); + mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); + mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); diff --git a/arch/arm/mach-mx2/serial.c b/arch/arm/mach-mx2/serial.c index e31fd44f7941..16debc296dad 100644 --- a/arch/arm/mach-mx2/serial.c +++ b/arch/arm/mach-mx2/serial.c @@ -35,7 +35,7 @@ static struct resource uart0[] = { }, }; -static struct platform_device mxc_uart_device0 = { +struct platform_device mxc_uart_device0 = { .name = "imx-uart", .id = 0, .resource = uart0, @@ -54,7 +54,7 @@ static struct resource uart1[] = { }, }; -static struct platform_device mxc_uart_device1 = { +struct platform_device mxc_uart_device1 = { .name = "imx-uart", .id = 1, .resource = uart1, @@ -73,7 +73,7 @@ static struct resource uart2[] = { }, }; -static struct platform_device mxc_uart_device2 = { +struct platform_device mxc_uart_device2 = { .name = "imx-uart", .id = 2, .resource = uart2, @@ -92,7 +92,7 @@ static struct resource uart3[] = { }, }; -static struct platform_device mxc_uart_device3 = { +struct platform_device mxc_uart_device3 = { .name = "imx-uart", .id = 3, .resource = uart3, @@ -111,7 +111,7 @@ static struct resource uart4[] = { }, }; -static struct platform_device mxc_uart_device4 = { +struct platform_device mxc_uart_device4 = { .name = "imx-uart", .id = 4, .resource = uart4, @@ -130,48 +130,9 @@ static struct resource uart5[] = { }, }; -static struct platform_device mxc_uart_device5 = { +struct platform_device mxc_uart_device5 = { .name = "imx-uart", .id = 5, .resource = uart5, .num_resources = ARRAY_SIZE(uart5), }; - -/* - * Register only those UARTs that physically exists - */ -int __init imx_init_uart(int uart_no, struct imxuart_platform_data *pdata) -{ - switch (uart_no) { - case 0: - mxc_uart_device0.dev.platform_data = pdata; - platform_device_register(&mxc_uart_device0); - break; - case 1: - mxc_uart_device1.dev.platform_data = pdata; - platform_device_register(&mxc_uart_device1); - break; -#ifndef CONFIG_MXC_IRDA - case 2: - mxc_uart_device2.dev.platform_data = pdata; - platform_device_register(&mxc_uart_device2); - break; -#endif - case 3: - mxc_uart_device3.dev.platform_data = pdata; - platform_device_register(&mxc_uart_device3); - break; - case 4: - mxc_uart_device4.dev.platform_data = pdata; - platform_device_register(&mxc_uart_device4); - break; - case 5: - mxc_uart_device5.dev.platform_data = pdata; - platform_device_register(&mxc_uart_device5); - break; - default: - return -ENODEV; - } - - return 0; -} |