dm: Allow serial output during the relocation process
authorSimon Glass <sjg@chromium.org>
Sun, 15 Jan 2023 21:15:41 +0000 (14:15 -0700)
committerTom Rini <trini@konsulko.com>
Sat, 11 Feb 2023 17:22:34 +0000 (12:22 -0500)
Reset the serial flags so that the debug UART can be used (if enabled)
in the small window where there is no serial device. This can avoid a hang
in some cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/board_r.c

index c6c0c1a..e450033 100644 (file)
@@ -797,6 +797,15 @@ static init_fnc_t init_sequence_r[] = {
 void board_init_r(gd_t *new_gd, ulong dest_addr)
 {
        /*
+        * The pre-relocation drivers may be using memory that has now gone
+        * away. Mark serial as unavailable - this will fall back to the debug
+        * UART if available.
+        *
+        * Do the same with log drivers since the memory may not be available.
+        */
+       gd->flags &= ~(GD_FLG_SERIAL_READY | GD_FLG_LOG_READY);
+
+       /*
         * Set up the new global data pointer. So far only x86 does this
         * here.
         * TODO(sjg@chromium.org): Consider doing this for all archs, or