ARM: mx51: dynamically register imx-uart devices
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 11 Aug 2010 20:23:06 +0000 (22:23 +0200)
committerSascha Hauer <s.hauer@pengutronix.de>
Fri, 1 Oct 2010 07:32:55 +0000 (09:32 +0200)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
arch/arm/mach-mx5/Kconfig
arch/arm/mach-mx5/board-cpuimx51.c
arch/arm/mach-mx5/board-mx51_3ds.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/mach-mx5/eukrea_mbimx51-baseboard.c
arch/arm/plat-mxc/devices/platform-imx-uart.c
arch/arm/plat-mxc/include/mach/mx51.h

index 2735314a78e00849c8040daebfddcf686bf77355..65bf34e1a4f6ee518e451f99589719d25fcbee32 100644 (file)
@@ -11,6 +11,7 @@ comment "MX5 platforms:"
 config MACH_MX51_BABBAGE
        bool "Support MX51 BABBAGE platforms"
        select IMX_HAVE_PLATFORM_IMX_I2C
+       select IMX_HAVE_PLATFORM_IMX_UART
        help
          Include support for MX51 Babbage platform, also known as MX51EVK in
          u-boot. This includes specific configurations for the board and its
@@ -18,6 +19,7 @@ config MACH_MX51_BABBAGE
 
 config MACH_MX51_3DS
        bool "Support MX51PDK (3DS)"
+       select IMX_HAVE_PLATFORM_IMX_UART
        select IMX_HAVE_PLATFORM_SPI_IMX
        select MXC_DEBUG_BOARD
        help
@@ -27,6 +29,7 @@ config MACH_MX51_3DS
 config MACH_EUKREA_CPUIMX51
        bool "Support Eukrea CPUIMX51 module"
        select IMX_HAVE_PLATFORM_IMX_I2C
+       select IMX_HAVE_PLATFORM_IMX_UART
        help
          Include support for Eukrea CPUIMX51 platform. This includes
          specific configurations for the module and its peripherals.
index d52f2527f6bfa7fb653cbba4b265c90397eea3dd..a6c09c7ff728ca399bf12044a556491b654a9850 100644 (file)
@@ -28,7 +28,6 @@
 #include <mach/eukrea-baseboards.h>
 #include <mach/common.h>
 #include <mach/hardware.h>
-#include <mach/imx-uart.h>
 #include <mach/iomux-mx51.h>
 #include <mach/mxc_ehci.h>
 
@@ -38,6 +37,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
+#include "devices-imx51.h"
 #include "devices.h"
 
 #define CPUIMX51_USBH1_STP     (0*32 + 27)
@@ -147,7 +147,7 @@ static struct pad_desc eukrea_cpuimx51_pads[] = {
        MX51_PAD_USBH1_STP__USBH1_STP,
 };
 
-static struct imxuart_platform_data uart_pdata = {
+static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
 
@@ -239,7 +239,7 @@ static void __init eukrea_cpuimx51_init(void)
        mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads,
                                        ARRAY_SIZE(eukrea_cpuimx51_pads));
 
-       mxc_register_device(&mxc_uart_device0, &uart_pdata);
+       imx51_add_imx_uart(0, &uart_pdata);
        gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq");
        gpio_direction_input(CPUIMX51_QUARTA_GPIO);
        gpio_free(CPUIMX51_QUARTA_GPIO);
index b9d3331ba308f4fd03432c55012c46dd76de87b9..ed08a2352a1a20b9b05eeef9298763e48c45c484 100644 (file)
@@ -22,7 +22,6 @@
 #include <mach/hardware.h>
 #include <mach/common.h>
 #include <mach/iomux-mx51.h>
-#include <mach/imx-uart.h>
 #include <mach/3ds_debugboard.h>
 
 #include "devices-imx51.h"
@@ -74,15 +73,15 @@ static struct pad_desc mx51_3ds_pads[] = {
 
 /* Serial ports */
 #if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
-static struct imxuart_platform_data uart_pdata = {
+static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
 
 static inline void mxc_init_imx_uart(void)
 {
-       mxc_register_device(&mxc_uart_device0, &uart_pdata);
-       mxc_register_device(&mxc_uart_device1, &uart_pdata);
-       mxc_register_device(&mxc_uart_device2, &uart_pdata);
+       imx51_add_imx_uart(0, &uart_pdata);
+       imx51_add_imx_uart(1, &uart_pdata);
+       imx51_add_imx_uart(2, &uart_pdata);
 }
 #else /* !SERIAL_IMX */
 static inline void mxc_init_imx_uart(void)
index 3f3075d7768f5072ead441ca271d8e143b8bac2a..7c0b6618a164c6c2c674cbec9f8d9efc989d5c82 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <mach/common.h>
 #include <mach/hardware.h>
-#include <mach/imx-uart.h>
 #include <mach/iomux-mx51.h>
 #include <mach/mxc_ehci.h>
 
@@ -31,6 +30,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
+#include "devices-imx51.h"
 #include "devices.h"
 
 #define BABBAGE_USB_HUB_RESET  (0*32 + 7)      /* GPIO_1_7 */
@@ -120,15 +120,15 @@ static struct pad_desc mx51babbage_pads[] = {
 
 /* Serial ports */
 #if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
-static struct imxuart_platform_data uart_pdata = {
+static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
 
 static inline void mxc_init_imx_uart(void)
 {
-       mxc_register_device(&mxc_uart_device0, &uart_pdata);
-       mxc_register_device(&mxc_uart_device1, &uart_pdata);
-       mxc_register_device(&mxc_uart_device2, &uart_pdata);
+       imx51_add_imx_uart(0, &uart_pdata);
+       imx51_add_imx_uart(1, &uart_pdata);
+       imx51_add_imx_uart(2, &uart_pdata);
 }
 #else /* !SERIAL_IMX */
 static inline void mxc_init_imx_uart(void)
index 09d2b5c8b4f59af80456de9ea2bc5196351e1017..8235b8c6729bb3d426d63cc306508791d160bfbf 100644 (file)
@@ -13,6 +13,10 @@ 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)
 
+extern const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst;
+#define imx51_add_imx_uart(id, pdata)  \
+       imx_add_imx_uart_1irq(&imx51_imx_uart_data[id], pdata)
+
 extern const struct imx_spi_imx_data imx51_cspi_data __initconst;
 #define imx51_add_cspi(pdata)  \
        imx_add_spi_imx(&imx51_cspi_data, pdata)
index 70b76d16391c8db9ea956a79c7034d67ddf9c7f4..5f40082d9e61643963740cdab71c845a3e59ca0f 100644 (file)
 #include <mach/imx-uart.h>
 #include <mach/irqs.h>
 
-static struct resource uart0[] = {
-       {
-               .start = MX51_UART1_BASE_ADDR,
-               .end = MX51_UART1_BASE_ADDR + 0xfff,
-               .flags = IORESOURCE_MEM,
-       }, {
-               .start = MX51_MXC_INT_UART1,
-               .end = MX51_MXC_INT_UART1,
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-struct platform_device mxc_uart_device0 = {
-       .name = "imx-uart",
-       .id = 0,
-       .resource = uart0,
-       .num_resources = ARRAY_SIZE(uart0),
-};
-
-static struct resource uart1[] = {
-       {
-               .start = MX51_UART2_BASE_ADDR,
-               .end = MX51_UART2_BASE_ADDR + 0xfff,
-               .flags = IORESOURCE_MEM,
-       }, {
-               .start = MX51_MXC_INT_UART2,
-               .end = MX51_MXC_INT_UART2,
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-struct platform_device mxc_uart_device1 = {
-       .name = "imx-uart",
-       .id = 1,
-       .resource = uart1,
-       .num_resources = ARRAY_SIZE(uart1),
-};
-
-static struct resource uart2[] = {
-       {
-               .start = MX51_UART3_BASE_ADDR,
-               .end = MX51_UART3_BASE_ADDR + 0xfff,
-               .flags = IORESOURCE_MEM,
-       }, {
-               .start = MX51_MXC_INT_UART3,
-               .end = MX51_MXC_INT_UART3,
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-struct platform_device mxc_uart_device2 = {
-       .name = "imx-uart",
-       .id = 2,
-       .resource = uart2,
-       .num_resources = ARRAY_SIZE(uart2),
-};
-
 static struct resource mxc_fec_resources[] = {
        {
                .start  = MX51_MXC_FEC_BASE_ADDR,
index 5c2918fcec0d263dd3c4f302557a206d81c21237..67a6d6910530c4716a38cb3526ece21773856890 100644 (file)
@@ -1,6 +1,3 @@
-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_fec_device;
 extern struct platform_device mxc_usbdr_host_device;
 extern struct platform_device mxc_usbh1_device;
index ffa93d1d6ef8e30eca983fc2d11f7487ce570c61..d0e417ce2c08cb21318bf9e19115378ec4c875ae 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <asm/mach/arch.h>
 
+#include "devices-imx51.h"
 #include "devices.h"
 
 #define MBIMX51_TSC2007_GPIO   (2*32 + 30)
@@ -114,7 +115,7 @@ static struct pad_desc mbimx51_pads[] = {
        MX51_PAD_KEY_COL3__KEY_COL3,
 };
 
-static struct imxuart_platform_data uart_pdata = {
+static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
 
@@ -172,8 +173,8 @@ void __init eukrea_mbimx51_baseboard_init(void)
        mxc_iomux_v3_setup_multiple_pads(mbimx51_pads,
                                        ARRAY_SIZE(mbimx51_pads));
 
-       mxc_register_device(&mxc_uart_device1, NULL);
-       mxc_register_device(&mxc_uart_device2, &uart_pdata);
+       imx51_add_imx_uart(1, NULL);
+       imx51_add_imx_uart(2, &uart_pdata);
 
        gpio_request(MBIMX51_LED0, "LED0");
        gpio_direction_output(MBIMX51_LED0, 1);
index af7fabba4e710313412d3b24f71d15417e631ef1..2039640adf27ffa8b126788754570ccf81355c24 100644 (file)
@@ -94,6 +94,16 @@ const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
 };
 #endif /* ifdef CONFIG_ARCH_MX35 */
 
+#ifdef CONFIG_ARCH_MX51
+const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst = {
+#define imx51_imx_uart_data_entry(_id, _hwid)                          \
+       imx_imx_uart_1irq_data_entry(MX51, _id, _hwid, SZ_4K)
+       imx51_imx_uart_data_entry(0, 1),
+       imx51_imx_uart_data_entry(1, 2),
+       imx51_imx_uart_data_entry(2, 3),
+};
+#endif /* ifdef CONFIG_ARCH_MX51 */
+
 struct platform_device *__init imx_add_imx_uart_3irq(
                const struct imx_imx_uart_3irq_data *data,
                const struct imxuart_platform_data *pdata)
index b919235768a07fdf931a01abb77a7c36b490bd15..b7359d7d54e2a63626dd2802962c7268464990b2 100644 (file)
 #define MX51_MXC_INT_SLIM_B            28
 #define MX51_MXC_INT_SSI1              29
 #define MX51_MXC_INT_SSI2              30
-#define MX51_MXC_INT_UART1             31
-#define MX51_MXC_INT_UART2             32
-#define MX51_MXC_INT_UART3             33
+#define MX51_INT_UART1                 31
+#define MX51_INT_UART2                 32
+#define MX51_INT_UART3                 33
 #define MX51_MXC_INT_RESV34            34
 #define MX51_MXC_INT_RESV35            35
 #define MX51_INT_ECSPI1                        36