Signed-off-by: Eric Nelson (Boundary Devices) <[EMAIL PROTECTED]>
---
 arch/arm/mach-davinci/Kconfig  |   25 +++++++++++++++++
 arch/arm/mach-davinci/clock.c  |   18 ++++++++++++-
 arch/arm/mach-davinci/serial.c |   57 +++++++++++++++++++++++++++++++++++-----
 3 files changed, 92 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 0514c85..7b58b84 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -27,6 +27,31 @@ config DAVINCI_I2C_EXPANDER
          Configure this option to specify whether the board used
          has I2C exapnder with ATA, USB, CF.
 
+config DAVINCI_UART0
+       bool "Enable UART0"
+       default y if MACH_DAVINCI_EVM
+       depends on ARCH_DAVINCI644x
+       help
+         Choose this to include support for UART0
+
+config DAVINCI_UART1
+       bool "Enable UART1"
+       default n if MACH_DAVINCI_EVM
+       depends on ARCH_DAVINCI644x
+       help
+         Choose this to include support for UART1. Note that the 
+          board-specific startup will need to set up the pin 
+          multiplexing.
+
+config DAVINCI_UART2
+       bool "Enable UART2"
+       default n if MACH_DAVINCI_EVM
+       depends on ARCH_DAVINCI644x
+       help
+         Choose this to include support for UART2. Note that the 
+          board-specific startup will need to set up the pin 
+          multiplexing.
+
 config DAVINCI_MCBSP
        bool
         prompt "DaVinci McBSP Driver" if SOUND_DAVINCI=n
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index b3092c1..0446149 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -190,11 +190,27 @@ static struct clk davinci_clks[] = {
                .lpsc = -1,
                .flags = ALWAYS_ENABLED,
        },
+#ifdef CONFIG_DAVINCI_UART0
        {
-               .name = "UART",
+               .name = "UART0",
                .rate = &fixedrate,
                .lpsc = DAVINCI_LPSC_UART0,
        },
+#endif
+#ifdef CONFIG_DAVINCI_UART1
+       {
+               .name = "UART1",
+               .rate = &fixedrate,
+               .lpsc = DAVINCI_LPSC_UART1,
+       },
+#endif
+#ifdef CONFIG_DAVINCI_UART2
+       {
+               .name = "UART2",
+               .rate = &fixedrate,
+               .lpsc = DAVINCI_LPSC_UART2,
+       },
+#endif
        {
                .name = "EMACCLK",
                .rate = &commonrate,
diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c
index d0e7c52..6684a8f 100644
--- a/arch/arm/mach-davinci/serial.c
+++ b/arch/arm/mach-davinci/serial.c
@@ -50,6 +50,7 @@ static inline void davinci_serial_outp(struct 
plat_serial8250_port *p,
 }
 
 static struct plat_serial8250_port serial_platform_data[] = {
+#ifdef CONFIG_DAVINCI_UART0
        {
                .membase        = (char *)IO_ADDRESS(DAVINCI_UART0_BASE),
                .mapbase        = (unsigned long)DAVINCI_UART0_BASE,
@@ -59,11 +60,48 @@ static struct plat_serial8250_port serial_platform_data[] = 
{
                .regshift       = 2,
                .uartclk        = 27000000,
        },
+#endif
+#ifdef CONFIG_DAVINCI_UART1
+       {
+               .membase        = (char *)IO_ADDRESS(DAVINCI_UART1_BASE),
+               .mapbase        = (unsigned long)DAVINCI_UART1_BASE,
+               .irq            = IRQ_UARTINT1,
+               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+               .uartclk        = 27000000,
+       },
+#endif
+#ifdef CONFIG_DAVINCI_UART2
+       {
+               .membase        = (char *)IO_ADDRESS(DAVINCI_UART2_BASE),
+               .mapbase        = (unsigned long)DAVINCI_UART2_BASE,
+               .irq            = IRQ_UARTINT2,
+               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+               .uartclk        = 27000000,
+       },
+#endif
        {
                .flags          = 0
        },
 };
 
+static char const * const clocknames[] = {
+#ifdef CONFIG_DAVINCI_UART0
+       "UART0",
+#endif
+#ifdef CONFIG_DAVINCI_UART1
+       "UART1",
+#endif
+#ifdef CONFIG_DAVINCI_UART2
+       "UART2",
+#endif
+};
+
+#define NUM_UARTS (ARRAY_SIZE(clocknames))
+
 static struct platform_device serial_device = {
        .name                   = "serial8250",
        .id                     = PLAT8250_DEV_PLATFORM,
@@ -91,15 +129,20 @@ static int __init davinci_init(void)
 {
        struct clk *uart_clk;
        struct device *dev = &serial_device.dev;
+       int i ;
 
-       uart_clk = clk_get(dev, "UART");
-       if (IS_ERR(uart_clk))
-               printk(KERN_ERR "%s:%d: failed to get UART clock\n",
-                      __FUNCTION__, __LINE__);
-       else
-               clk_enable(uart_clk);
+       for (i = 0 ; i < NUM_UARTS ; i++) {
+               uart_clk = clk_get(dev, clocknames[i]);
+               if (IS_ERR(uart_clk))
+                       printk(KERN_ERR "%s:%d: failed to get %s clock\n",
+                              __func__, __LINE__, clocknames[i]);
+               else {
+                       printk(KERN_ERR "initclk %s\n", clocknames[i]);
+                       clk_enable(uart_clk);
+                       davinci_serial_reset(&serial_platform_data[i]);
+               }
+       }
 
-       davinci_serial_reset(&serial_platform_data[0]);
        return platform_device_register(&serial_device);
 }
 
-- 
1.5.4

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

Reply via email to