rk30: add debug uart port configuration
author黄涛 <huangtao@rock-chips.com>
Fri, 9 Mar 2012 12:31:37 +0000 (20:31 +0800)
committer黄涛 <huangtao@rock-chips.com>
Fri, 9 Mar 2012 12:31:37 +0000 (20:31 +0800)
arch/arm/mach-rk30/devices.c
arch/arm/mach-rk30/include/mach/debug-macro.S
arch/arm/mach-rk30/include/mach/io.h
arch/arm/mach-rk30/include/mach/uncompress.h
arch/arm/mach-rk30/io.c
arch/arm/mach-rk30/pm.c
arch/arm/plat-rk/Kconfig

index dc608b7aee2b4d827329900d8f4c8ac7e0fcc03a..98ecfb42eb4a357a6bfaf45bf355b005e0c148f5 100755 (executable)
@@ -999,8 +999,8 @@ static int __init rk30_init_devices(void)
        platform_device_register(&device_tsadc);
 #endif
        rk30_init_sdmmc();
-#ifdef CONFIG_FIQ_DEBUGGER
-       rk_serial_debug_init(RK30_UART1_PHYS, IRQ_UART1, IRQ_UART_SIGNAL, -1);
+#if defined(CONFIG_FIQ_DEBUGGER) && defined(DEBUG_UART_PHYS)
+       rk_serial_debug_init(DEBUG_UART_PHYS, IRQ_UART0 + CONFIG_RK_DEBUG_UART, IRQ_UART_SIGNAL, -1);
 #endif
        rk30_init_i2s();
 
index d6da9a518d23723b09dbe29fed2920e6d8b8f84e..2a57cc79fa7e96482186f41d929ab92fe5de9a23 100644 (file)
 
 #include <mach/io.h>
 
+#ifdef DEBUG_UART_PHYS
        .macro addruart, rp, rv
-               ldr     \rp, = RK30_UART1_PHYS
-               ldr     \rv, = RK30_UART1_BASE
+               ldr     \rp, = DEBUG_UART_PHYS
+               ldr     \rv, = DEBUG_UART_BASE
        .endm
 
 #define UART_SHIFT     2
 #include <asm/hardware/debug-8250.S>
+#else
+       .macro addruart, rp, rv
+       .endm
+       .macro senduart, rd, rx
+       .endm
+       .macro busyuart, rd, rx
+       .endm
+       .macro waituart, rd, rx
+       .endm
+#endif
index 99ccf481a53a714815676047bc63790274c3cf4f..3cbcf6e1432d9f100b1dcce69dc45f6b6aa17a91 100644 (file)
 #define RK30_TSADC_PHYS         0x20060000
 #define RK30_TSADC_SIZE         SZ_16K
 #define RK30_UART2_PHYS         0x20064000
+#define RK30_UART2_BASE         RK30_IO_TO_VIRT1(RK30_UART2_PHYS)
 #define RK30_UART2_SIZE         SZ_16K
 #define RK30_UART3_PHYS         0x20068000
+#define RK30_UART3_BASE         RK30_IO_TO_VIRT1(RK30_UART3_PHYS)
 #define RK30_UART3_SIZE         SZ_16K
 #define RK30_SARADC_PHYS        0x2006c000
 #define RK30_SARADC_SIZE        SZ_16K
 #define RK30_GPIO4_BASE         RK30_IO_TO_VIRT1(RK30_GPIO4_PHYS)
 #define RK30_GPIO4_SIZE         SZ_16K
 
+#if CONFIG_RK_DEBUG_UART == 0
+#define DEBUG_UART_PHYS         RK30_UART0_PHYS
+#define DEBUG_UART_BASE         RK30_UART0_BASE
+#elif CONFIG_RK_DEBUG_UART == 1
+#define DEBUG_UART_PHYS         RK30_UART1_PHYS
+#define DEBUG_UART_BASE         RK30_UART1_BASE
+#elif CONFIG_RK_DEBUG_UART == 2
+#define DEBUG_UART_PHYS         RK30_UART2_PHYS
+#define DEBUG_UART_BASE         RK30_UART2_BASE
+#elif CONFIG_RK_DEBUG_UART == 3
+#define DEBUG_UART_PHYS         RK30_UART3_PHYS
+#define DEBUG_UART_BASE         RK30_UART3_BASE
+#endif
+
 #endif
index a83b2440c39c1c8f66c91e212b007bbe6b47bb1d..f165f074ee0170267eec69922af2f8522e9a372b 100644 (file)
@@ -4,7 +4,8 @@
 #include <linux/serial_reg.h>
 #include <mach/io.h>
 
-static volatile u32 *UART = (u32 *)RK30_UART1_PHYS;
+#ifdef DEBUG_UART_PHYS
+static volatile u32 *UART = (u32 *)DEBUG_UART_PHYS;
 
 static void putc(int c)
 {
@@ -12,6 +13,11 @@ static void putc(int c)
                barrier();
        UART[UART_TX] = c;
 }
+#else
+static inline void putc(int c)
+{
+}
+#endif
 
 static inline void flush(void)
 {
index cf6b0b2cdfbf850bd6bf7f51e60be3a570c3d400..b370cd6e803587d8cfd33c75faf87ffc98ea921b 100644 (file)
 
 static struct map_desc rk30_io_desc[] __initdata = {
        RK30_DEVICE(CORE),
+#if CONFIG_RK_DEBUG_UART == 0
        RK30_DEVICE(UART0),
+#elif CONFIG_RK_DEBUG_UART == 1
        RK30_DEVICE(UART1),
+#elif CONFIG_RK_DEBUG_UART == 2
+       RK30_DEVICE(UART2),
+#elif CONFIG_RK_DEBUG_UART == 3
+       RK30_DEVICE(UART3),
+#endif
        RK30_DEVICE(GRF),
        RK30_DEVICE(CRU),
        RK30_DEVICE(PMU),
index e2363719eac820888735634216576b7a728e144d..6e5bfe4d94b34124136505ed5ccc193c73048351 100755 (executable)
 
 void __sramfunc sram_printch(char byte)
 {
-       writel_relaxed(byte, RK30_UART1_BASE);
+#ifdef DEBUG_UART_BASE
+       writel_relaxed(byte, DEBUG_UART_BASE);
        dsb();
 
        /* loop check LSR[6], Transmitter Empty bit */
-       while (!(readl_relaxed(RK30_UART1_BASE + 0x14) & 0x40))
+       while (!(readl_relaxed(DEBUG_UART_BASE + 0x14) & 0x40))
                barrier();
 
        if (byte == '\n')
                sram_printch('\r');
+#endif
 }
 
 #ifdef CONFIG_DDR_TEST
index 845bb9f230133da0c565a418ba15e00a5ba01b9b..9ba0b4d7c71a45427c81564967b3fffef4bb38d5 100644 (file)
@@ -120,4 +120,11 @@ config RK_EARLY_PRINTK
          Say Y here if you want to have an early console using the
          kernel low-level debugging functions.
 
+config RK_DEBUG_UART
+       int "Debug UART"
+       default 1 if ARCH_RK29
+       default 2 if ARCH_RK30
+       help
+         Select a UART for debugging. -1 disable.
+
 endif