]> git.sur5r.net Git - u-boot/commitdiff
dm: Allow debug UART to support an early console
authorSimon Glass <sjg@chromium.org>
Tue, 23 Jun 2015 21:38:33 +0000 (15:38 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 21 Jul 2015 23:39:22 +0000 (17:39 -0600)
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>
common/console.c

index 00582224d463272b43647af31f8dcba519b2c61c..acad8bdca06f5a9a251d3bce41456204e488f2ce 100644 (file)
@@ -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;