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();
#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
#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
#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)
{
barrier();
UART[UART_TX] = c;
}
+#else
+static inline void putc(int c)
+{
+}
+#endif
static inline void flush(void)
{
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),
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
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