i.MX3: make SoC devices globally available
authorSascha Hauer <s.hauer@pengutronix.de>
Tue, 9 Sep 2008 08:19:41 +0000 (10:19 +0200)
committerSascha Hauer <s.hauer@pengutronix.de>
Tue, 9 Sep 2008 08:19:41 +0000 (10:19 +0200)
Make SoC devices globally available to boards rather than using
a device specific init function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
arch/arm/mach-mx3/devices.c
arch/arm/mach-mx3/devices.h [new file with mode: 0644]
arch/arm/mach-mx3/pcm037.c

index e08c6a8..a6bdcc0 100644 (file)
@@ -36,7 +36,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,
@@ -55,7 +55,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,
@@ -74,7 +74,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,
@@ -93,7 +93,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,
@@ -112,46 +112,13 @@ static struct resource uart4[] = {
        },
 };
 
-static struct platform_device mxc_uart_device4 = {
+struct platform_device mxc_uart_device4 = {
        .name = "imx-uart",
        .id = 4,
        .resource = uart4,
        .num_resources = ARRAY_SIZE(uart4),
 };
 
-/*
- * Register only those UARTs that physically exist
- */
-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;
-       case 2:
-               mxc_uart_device2.dev.platform_data = pdata;
-               platform_device_register(&mxc_uart_device2);
-               break;
-       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;
-       default:
-               return -ENODEV;
-       }
-
-       return 0;
-}
-
 /* GPIO port description */
 static struct mxc_gpio_port imx_gpio_ports[] = {
        [0] = {
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
new file mode 100644 (file)
index 0000000..4dc03f9
--- /dev/null
@@ -0,0 +1,6 @@
+
+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;
index 0a152ed..03374f9 100644 (file)
@@ -33,6 +33,8 @@
 #include <mach/iomux-mx3.h>
 #include <mach/board-pcm037.h>
 
+#include "devices.h"
+
 static struct physmap_flash_data pcm037_flash_data = {
        .width  = 2,
 };
@@ -73,12 +75,12 @@ static void __init mxc_board_init(void)
        mxc_iomux_mode(MX31_PIN_TXD1__TXD1);
        mxc_iomux_mode(MX31_PIN_RXD1__RXD1);
 
-       imx_init_uart(0, &uart_pdata);
+       mxc_register_device(&mxc_uart_device0, &uart_pdata);
 
        mxc_iomux_mode(MX31_PIN_CSPI3_MOSI__RXD3);
        mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3);
 
-       imx_init_uart(2, &uart_pdata);
+       mxc_register_device(&mxc_uart_device2, &uart_pdata);
 }
 
 /*