]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
serial: avoid redundant early UART initialization
authorAswin Murugan <aswin.murugan@oss.qualcomm.com>
Wed, 15 Jul 2026 17:30:00 +0000 (23:00 +0530)
committerTom Rini <trini@konsulko.com>
Tue, 28 Jul 2026 18:30:55 +0000 (12:30 -0600)
When DEBUG_UART and SKIP_EARLY_DM are enabled, the serial console
is still probed before relocation even though DEBUG_UART already
configures the UART and provides early console output. The debug
UART configuration is sufficient until relocation, making full
serial driver initialization at this stage unnecessary.
Furthermore, the initialization is slow since it runs with dcache
disabled and is repeated again after relocation.

Skip pre-relocation serial probing in this configuration and
defer full UART initialization until after relocation. Update the
GENI UART probe logic accordingly.

This removes redundant UART initialization and improves boot
performance.

Signed-off-by: Aswin Murugan <aswin.murugan@oss.qualcomm.com>
drivers/serial/serial-uclass.c
drivers/serial/serial_msm_geni.c

index 7b381ca12a09f0705dbddeed6911e18228a5cb20..9be2ad270ade862b3dde554b2742d9c2992bf5be 100644 (file)
@@ -190,6 +190,16 @@ int fetch_baud_from_dtb(void)
 int serial_init(void)
 {
 #if CONFIG_IS_ENABLED(SERIAL_PRESENT)
+       /*
+        * Skip serial device probe before relocation if debug UART is enabled
+        * and early DM is skipped. Debug UART will handle console output during
+        * early boot. Full serial initialization happens in serial_initialize()
+        * after relocation.
+        */
+       if ((CONFIG_IS_ENABLED(DEBUG_UART) && CONFIG_IS_ENABLED(SKIP_EARLY_DM)) &&
+           !(gd->flags & GD_FLG_RELOC))
+               return 0;
+
        serial_find_console_or_panic();
        if (gd->cur_serial_dev)
                gd->flags |= GD_FLG_SERIAL_READY;
index ae4015e0fdc142ad715424caa4af8e100e86c3c9..ff91e0018fa8ab2d974e9be854e7ae1382d04bb7 100644 (file)
@@ -555,8 +555,9 @@ static int msm_serial_probe(struct udevice *dev)
        if (ret < 0)
                return ret;
 
-       /* No need to reinitialize the UART after relocation */
-       if (gd->flags & GD_FLG_RELOC)
+       /* Skip re-init after relocation if debug UART and early DM skip are not enabled */
+       if ((!CONFIG_IS_ENABLED(DEBUG_UART) && !CONFIG_IS_ENABLED(SKIP_EARLY_DM)) &&
+           (gd->flags & GD_FLG_RELOC))
                return 0;
 
        geni_serial_init(dev);