Hi Kevin,

On Mon, May 12, 2008 at 12:07 PM,  <[EMAIL PROTECTED]> wrote:
> From: Trilok Soni <[EMAIL PROTECTED]>
>
>  - Update clock.c to add three UART clocks.
>  - Update serial.[ch] for using DAVINCI_TAG_UART
>   support.
>
>  Signed-off-by: Trilok Soni <[EMAIL PROTECTED]>
>  ---
>   arch/arm/mach-davinci/clock.c         |   12 +++++-
>   arch/arm/mach-davinci/serial.c        |   66 
> ++++++++++++++++++++++++++++----
>   include/asm-arm/arch-davinci/common.h |    1 +
>   include/asm-arm/arch-davinci/serial.h |    1 +
>   4 files changed, 70 insertions(+), 10 deletions(-)
>
>  diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
>  index b3092c1..14dac52 100644
>  --- a/arch/arm/mach-davinci/clock.c
>  +++ b/arch/arm/mach-davinci/clock.c
>  @@ -191,11 +191,21 @@ static struct clk davinci_clks[] = {
>                 .flags = ALWAYS_ENABLED,
>         },
>         {
>  -               .name = "UART",
>  +               .name = "UART0",
>                 .rate = &fixedrate,
>                 .lpsc = DAVINCI_LPSC_UART0,
>         },
>         {
>  +               .name = "UART1",
>  +               .rate = &fixedrate,
>  +               .lpsc = DAVINCI_LPSC_UART1,
>  +       },
>  +       {
>  +               .name = "UART2",
>  +               .rate = &fixedrate,
>  +               .lpsc = DAVINCI_LPSC_UART2,
>  +       },
>  +       {
>                 .name = "EMACCLK",
>                 .rate = &commonrate,
>                 .lpsc = DAVINCI_LPSC_EMAC_WRAPPER,
>  diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c
>  index 99f133b..75fbd96 100644
>  --- a/arch/arm/mach-davinci/serial.c
>  +++ b/arch/arm/mach-davinci/serial.c
>  @@ -31,6 +31,7 @@
>   #include <asm/irq.h>
>   #include <asm/hardware.h>
>   #include <asm/arch/serial.h>
>  +#include <asm/arch/board.h>
>   #include <asm/arch/irqs.h>
>
>   #define UART_DAVINCI_PWREMU 0x0c
>  @@ -67,6 +68,24 @@ static struct plat_serial8250_port serial_platform_data[] 
> = {
>                 .uartclk        = 27000000,
>         },
>         {
>  +               .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,
>  +       },
>  +       {
>  +               .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,
>  +       },
>  +       {
>                 .flags          = 0
>         },
>   };
>  @@ -78,7 +97,7 @@ static struct platform_device serial_device = {
>                 .platform_data  = serial_platform_data,
>         },
>   };
>  -
>  +
>   static void __init davinci_serial_reset(struct plat_serial8250_port *p)
>   {
>         /* reset both transmitter and receiver: bits 14,13 = UTRST, URRST */
>  @@ -94,19 +113,48 @@ static void __init davinci_serial_reset(struct 
> plat_serial8250_port *p)
>         davinci_serial_outs(p, UART_DAVINCI_PWREMU, pwremu);
>   }
>
>  -static int __init davinci_init(void)
>  +void __init davinci_serial_init(void)
>   {
>  +       int i;
>  +       const struct davinci_uart_config *info;
>  +       char name[16];
>         struct clk *uart_clk;
>         struct device *dev = &serial_device.dev;
>
>  -       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);
>  +       /*
>  +        * Make sure the serial ports are muxed on at this point.
>  +        * You have to mux them off in device drivers later on
>  +        * if not needed.
>  +        */
>  +
>  +       info = davinci_get_config(DAVINCI_TAG_UART, struct 
> davinci_uart_config);
>  +
>  +       if (info == NULL)
>  +               return;
>  +
>  +       for (i = 0; i < DAVINCI_MAX_NR_UARTS; i++) {
>  +               struct plat_serial8250_port *p = serial_platform_data + i;
>
>  -       davinci_serial_reset(&serial_platform_data[0]);
>  +               if (!(info->enabled_uarts & (1 << i))) {
>  +                       p->membase = 0;
>  +                       p->mapbase = 0;
>  +                       continue;
>  +               }
>  +
>  +               sprintf(name, "UART%d\n", i);
>  +               uart_clk = clk_get(dev, "UART");

Please don't take these three patches, as you can see that I forgot to
put "name" as second argument of clk_get. Discovered this while adding
clk_disable_unused functionalities in clock.c :). I post this patches
again :).

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

Reply via email to