Mark A. Greer wrote:

Currently, there is one set of platform_device and platform_data
structures for all DaVinci SoCs.  The differences in the data
between the various SoCs is handled by davinci_serial_init()
by checking the SoC type.  However, as new SoCs appear, this
routine will become more & more cluttered.

To clean up the routine and make it easier to add support for new
SoCs, move the platform_device and platform_data structures into the
SoC-specific code and use the SoC infrastructure to provide access
to the data.

In the process, fix a bug where the wrong irq is used for uart2
of the dm646x.

Signed-off-by: Mark A. Greer <[email protected]>

[...]

diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 83f86e5..5a88772 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -11,6 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/clk.h>
+#include <linux/serial_8250.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
@@ -27,6 +28,7 @@
 #include <mach/irqs.h>
 #include <mach/time.h>
 #include <mach/gpio.h>
+#include <mach/serial.h>
 #include <mach/common.h>
#include "clock.h"
@@ -631,6 +633,44 @@ struct davinci_timer_info dm355_timer_info = {
        .clocksource_id = T0_TOP,
 };
+static struct plat_serial8250_port dm355_serial_platform_data[] = {
+       {
+               .mapbase        = DAVINCI_UART0_BASE,
+               .irq            = IRQ_UARTINT0,
+               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
+                                 UPF_IOREMAP,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+       },
+       {
+               .mapbase        = DAVINCI_UART1_BASE,
+               .irq            = IRQ_UARTINT1,
+               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
+                                 UPF_IOREMAP,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+       },
+       {
+               .mapbase        = DM355_UART2_BASE,
+               .irq            = IRQ_DM355_UARTINT2,
+               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
+                                 UPF_IOREMAP,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+       },
+       {
+               .flags          = 0
+       },
+};
+
+static struct platform_device dm355_serial_device = {
+       .name                   = "serial8250",
+       .id                     = PLAT8250_DEV_PLATFORM,
+       .dev                    = {
+               .platform_data  = dm355_serial_platform_data,
+       },
+};
+
 static struct davinci_soc_info davinci_soc_info_dm355 = {
        .io_desc                = dm355_io_desc,
        .io_desc_num            = ARRAY_SIZE(dm355_io_desc),
@@ -654,6 +694,7 @@ static struct davinci_soc_info davinci_soc_info_dm355 = {
        .gpio_base              = IO_ADDRESS(DAVINCI_GPIO_BASE),
        .gpio_num               = 104,
        .gpio_irq               = IRQ_DM355_GPIOBNK0,
+       .serial_dev             = &dm355_serial_device,
 };
struct davinci_soc_info *dm355_get_soc_info(void)

You actually *need* to move only the platform data I think. The pointer to it can then be set in the 'struct platform_device'.

WBR, Sergei

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to