summaryrefslogtreecommitdiff
path: root/common/console.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-06-23 21:38:33 (GMT)
committerSimon Glass <sjg@chromium.org>2015-07-21 23:39:22 (GMT)
commitd6ea5307daf200c0c1f80d241e10bb69a1da2c8c (patch)
treea72358342ed59930faf1c711c986cb89b12d90d3 /common/console.c
parentd0d7361462914cee66f97792bc314bdca67a3ea6 (diff)
downloadu-boot-d6ea5307daf200c0c1f80d241e10bb69a1da2c8c.tar.xz
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 <sjg@chromium.org>
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c19
1 files changed, 19 insertions, 0 deletions
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 <common.h>
+#include <debug_uart.h>
#include <stdarg.h>
#include <iomux.h>
#include <malloc.h>
@@ -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;