]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
common: add an option to skip DM pre-relocation
authorCasey Connolly <casey.connolly@linaro.org>
Wed, 1 Apr 2026 14:15:18 +0000 (16:15 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 21 Apr 2026 17:19:49 +0000 (11:19 -0600)
For some platforms like Qualcomm, it isn't necessary to perform a full
DM init and scan prior to relocation, it's also particularly slow since
it runs with dcache disabled and prior to building the livetree.

The only device which needs to be probed pre-reloc is the serial
port (otherwise U-Boot will panic), however this can be found through
/chosen/stdout-path.

Therefore we can avoid scanning the entire FDT and binding devices,
instead just binding the serial port and clock driver on-demand.

This decreases the total time from power on to reaching the interactive
U-Boot shell be about 50% (from ~2.8s to 1.8s).

Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
Kconfig
common/board_f.c

diff --git a/Kconfig b/Kconfig
index ce25ea24a60f8e081c805fb17f61e62305367fc1..2f7677f47f1691f49567efac9406e98e59c1f7dc 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -474,6 +474,18 @@ config SKIP_RELOCATE
          Skips relocation of U-Boot allowing for systems that have extremely
          limited RAM to run U-Boot.
 
+config SKIP_EARLY_DM
+       bool "Skips initialising device model pre-relocation"
+       help
+         Enable this option to skip scanning and probing devices prior to
+         U-Boot relocation (during board_f). Unless console support is disabled
+         a serial port is still required, however this can be found through
+         /chosen/stdout-path in FDT. If the serial port relies on other devices
+         like clocks these will also be bound and probed on demand.
+
+         This can speed up time to interactive console by about 50%, particularly
+         when combined with OF_LIVE.
+
 endif # EXPERT
 
 config PHYS_64BIT
index df2b0dc899bf28e05e4594c9f9e95eebd1559157..2713438cc18fae7d6c0f7781e70503f3791be47e 100644 (file)
@@ -814,7 +814,16 @@ static int initf_dm(void)
                return 0;
 
        bootstage_start(BOOTSTAGE_ID_ACCUM_DM_F, "dm_f");
-       ret = dm_init_and_scan(true);
+
+       /*
+        * If SKIP_EARLY_DM is set then we just create an empty device
+        * model, the serial port will still be bound later through
+        * serial_find_console_or_panic() via /chosen/stdout-path
+        */
+       if (!CONFIG_IS_ENABLED(SKIP_EARLY_DM))
+               ret = dm_init_and_scan(true);
+       else
+               ret = dm_init(false);
        if (ret)
                return ret;