From: Simon Glass Date: Tue, 23 Jun 2015 21:38:33 +0000 (-0600) Subject: dm: Allow debug UART to support an early console X-Git-Tag: v2015.10-rc1~172 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6ea5307daf200c0c1f80d241e10bb69a1da2c8c;p=platform%2Fkernel%2Fu-boot.git dm: Allow debug UART to support an early console When there is no console ready, allow the debug UART to be used for output. This makes debugging of early code considerably easier. Signed-off-by: Simon Glass --- diff --git a/common/console.c b/common/console.c index 0058222..acad8bd 100644 --- a/common/console.c +++ b/common/console.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -460,6 +461,13 @@ void putc(const char c) return; } #endif +#ifdef CONFIG_DEBUG_UART + /* if we don't have a console yet, use the debug UART */ + if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) { + printch(c); + return; + } +#endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) return; @@ -491,7 +499,18 @@ void puts(const char *s) return; } #endif +#ifdef CONFIG_DEBUG_UART + if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) { + while (*s) { + int ch = *s++; + printch(ch); + if (ch == '\n') + printch('\r'); + } + return; + } +#endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) return;