msm: make debugging UART (for DEBUG_LL) configurable
authorPavel Machek <pavel@ucw.cz>
Mon, 2 Nov 2009 10:48:29 +0000 (11:48 +0100)
committerDaniel Walker <dwalker@fifo99.com>
Fri, 20 Nov 2009 14:40:05 +0000 (06:40 -0800)
Provides options to select one of the three "lowspeed" UARTs
on MSM7k SoCs for DEBUG_LL output from the zImage decompressor
and kernel.

Signed-off-by: Brian Swetland <swetland@google.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
arch/arm/mach-msm/Kconfig
arch/arm/mach-msm/include/mach/debug-macro.S
arch/arm/mach-msm/include/mach/msm_iomap.h
arch/arm/mach-msm/include/mach/uncompress.h
arch/arm/mach-msm/io.c

index d140abc..35f2a90 100644 (file)
@@ -3,6 +3,30 @@ if ARCH_MSM
 comment "MSM Board Type"
        depends on ARCH_MSM
 
+config MSM_DEBUG_UART
+       int
+       default 1 if MSM_DEBUG_UART1
+       default 2 if MSM_DEBUG_UART2
+       default 3 if MSM_DEBUG_UART3
+
+choice
+       prompt "Debug UART"
+
+       default MSM_DEBUG_UART_NONE
+
+       config MSM_DEBUG_UART_NONE
+               bool "None"
+
+       config MSM_DEBUG_UART1
+               bool "UART1"
+
+       config MSM_DEBUG_UART2
+               bool "UART2"
+
+       config MSM_DEBUG_UART3
+               bool "UART3"
+endchoice
+
 config MACH_HALIBUT
        depends on ARCH_MSM
        default y
index 1db3c97..d48747e 100644 (file)
  *
  */
 
+
+
 #include <mach/hardware.h>
 #include <mach/msm_iomap.h>
 
+#ifdef CONFIG_MSM_DEBUG_UART
        .macro  addruart,rx
        @ see if the MMU is enabled and select appropriate base address
        mrc     p15, 0, \rx, c1, c0
        tst     \rx, #1
-       ldreq   \rx, =MSM_UART1_PHYS
-       movne   \rx, #0
+       ldreq   \rx, =MSM_DEBUG_UART_PHYS
+       ldrne   \rx, =MSM_DEBUG_UART_BASE
        .endm
 
        .macro  senduart,rd,rx
 
        .macro  waituart,rd,rx
        @ wait for TX_READY
-       teq     \rx, #0
-       bne     2f
-1:     ldr     \rd, [\rx, #0x08]
+1001:  ldr     \rd, [\rx, #0x08]
        tst     \rd, #0x04
-       beq     1b
-2:
+       beq     1001b
+       .endm
+#else
+       .macro  addruart,rx
+       .endm
+
+       .macro  senduart,rd,rx
+       .endm
+
+       .macro  waituart,rd,rx
        .endm
+#endif
 
        .macro  busyuart,rd,rx
        .endm
index 2f7b4c8..9dae1a9 100644 (file)
 #define MSM_UART3_PHYS        0xA9C00000
 #define MSM_UART3_SIZE        SZ_4K
 
+#ifdef CONFIG_MSM_DEBUG_UART
+#define MSM_DEBUG_UART_BASE   0xE1000000
+#if CONFIG_MSM_DEBUG_UART == 1
+#define MSM_DEBUG_UART_PHYS   MSM_UART1_PHYS
+#elif CONFIG_MSM_DEBUG_UART == 2
+#define MSM_DEBUG_UART_PHYS   MSM_UART2_PHYS
+#elif CONFIG_MSM_DEBUG_UART == 3
+#define MSM_DEBUG_UART_PHYS   MSM_UART3_PHYS
+#endif
+#define MSM_DEBUG_UART_SIZE   SZ_4K
+#endif
+
 #define MSM_SDC1_PHYS         0xA0400000
 #define MSM_SDC1_SIZE         SZ_4K
 
index 026e895..d94292c 100644 (file)
 #ifndef __ASM_ARCH_MSM_UNCOMPRESS_H
 
 #include "hardware.h"
+#include "linux/io.h"
+#include "mach/msm_iomap.h"
 
 static void putc(int c)
 {
+#if defined(MSM_DEBUG_UART_PHYS)
+       unsigned base = MSM_DEBUG_UART_PHYS;
+       while (!(readl(base + 0x08) & 0x04)) ;
+       writel(c, base + 0x0c);
+#endif
 }
 
 static inline void flush(void)
index 6e7692f..1c5e7da 100644 (file)
@@ -42,6 +42,9 @@ static struct map_desc msm_io_desc[] __initdata = {
        MSM_DEVICE(GPIO1),
        MSM_DEVICE(GPIO2),
        MSM_DEVICE(CLK_CTL),
+#ifdef CONFIG_MSM_DEBUG_UART
+       MSM_DEVICE(DEBUG_UART),
+#endif
        {
                .virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
                .pfn =      __phys_to_pfn(MSM_SHARED_RAM_PHYS),