]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Add a flag indicating when the serial console is ready
authorSimon Glass <sjg@chromium.org>
Wed, 23 Jul 2014 12:55:07 +0000 (06:55 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 23 Jul 2014 13:07:25 +0000 (14:07 +0100)
For sandbox we have a fallback console which is used very early in
U-Boot, before serial drivers are available. Rather than try to guess
when to switch to the real console, add a flag so we can be sure. This
makes sure that sandbox can always output a panic() message, for example,
and avoids silent failure (which is very annoying in sandbox).

Signed-off-by: Simon Glass <sjg@chromium.org>
common/console.c
drivers/serial/serial.c
include/asm-generic/global_data.h

index 5576dfd94ae3ed3db5d3532de1b895ade291680d..898da3935ef21c101b674174f80fb21c622942d0 100644 (file)
@@ -417,7 +417,7 @@ static inline void print_pre_console_buffer(void) {}
 void putc(const char c)
 {
 #ifdef CONFIG_SANDBOX
-       if (!gd) {
+       if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
                os_putc(c);
                return;
        }
@@ -447,7 +447,7 @@ void putc(const char c)
 void puts(const char *s)
 {
 #ifdef CONFIG_SANDBOX
-       if (!gd) {
+       if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
                os_puts(s);
                return;
        }
index 803d8506d90e295be0d18b3a298d12bbee4e7946..d2eb7520d03886748c7d0130a0851c51eca8d997 100644 (file)
@@ -418,6 +418,7 @@ static struct serial_device *get_current(void)
  */
 int serial_init(void)
 {
+       gd->flags |= GD_FLG_SERIAL_READY;
        return get_current()->start();
 }
 
index edde9d7dd0ee1a119f1b21094642df493e9b4dbe..74df21003363305e98a7b84d27275612df1a98fe 100644 (file)
@@ -106,5 +106,6 @@ typedef struct global_data {
 #define GD_FLG_LOGINIT         0x00020 /* Log Buffer has been initialized */
 #define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out)      */
 #define GD_FLG_ENV_READY       0x00080 /* Env. imported into hash table   */
+#define GD_FLG_SERIAL_READY    0x00100 /* Pre-reloc serial console ready  */
 
 #endif /* __ASM_GENERIC_GBL_DATA_H */