From: Simon Glass <[email protected]>

The RISC-V announce_and_cleanup() duplicates the common pre-boot
steps. Replace it with a call to bootm_final().

Move board_quiesce_devices() into bootm_final() so it is available to
all architectures. Drop the RISC-V weak definition and header
declaration since the generic one in bootm.h is used instead.

Signed-off-by: Simon Glass <[email protected]>

---

Changes in v3:
- Drop udc_disconnect()
- Move board_quiesce_devices() into bootm_final() instead of dropping it
- Squash with the previous riscv patches

 arch/riscv/include/asm/u-boot-riscv.h |  1 -
 arch/riscv/lib/bootm.c                | 24 +-----------------------
 boot/bootm.c                          |  2 ++
 3 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/arch/riscv/include/asm/u-boot-riscv.h 
b/arch/riscv/include/asm/u-boot-riscv.h
index 543a1688db8..3a8fdb57136 100644
--- a/arch/riscv/include/asm/u-boot-riscv.h
+++ b/arch/riscv/include/asm/u-boot-riscv.h
@@ -16,7 +16,6 @@ int cleanup_before_linux(void);
 
 /* board/.../... */
 int board_init(void);
-void board_quiesce_devices(void);
 int riscv_board_reserved_mem_fixup(void *fdt);
 int riscv_fdt_copy_resv_mem_node(const void *src_fdt, void *dest_fdt);
 
diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
index 9544907ab1e..bd47275b52e 100644
--- a/arch/riscv/lib/bootm.c
+++ b/arch/riscv/lib/bootm.c
@@ -25,10 +25,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-__weak void board_quiesce_devices(void)
-{
-}
-
 /**
  * announce_and_cleanup() - Print message and prepare for kernel boot
  *
@@ -36,25 +32,7 @@ __weak void board_quiesce_devices(void)
  */
 static void announce_and_cleanup(int fake)
 {
-       printf("\nStarting kernel ...%s\n\n", fake ?
-               "(fake run for tracing)" : "");
-       bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
-#ifdef CONFIG_BOOTSTAGE_FDT
-       bootstage_fdt_add_report();
-#endif
-#if CONFIG_IS_ENABLED(BOOTSTAGE_REPORT)
-       bootstage_report();
-#endif
-
-       board_quiesce_devices();
-
-       /*
-        * Call remove function of all devices with a removal flag set.
-        * This may be useful for last-stage operations, like cancelling
-        * of DMA operation or releasing device internal buffers.
-        */
-       dm_remove_devices_active();
-
+       bootm_final(fake);
        cleanup_before_linux();
 }
 
diff --git a/boot/bootm.c b/boot/bootm.c
index 3a69cc0deb0..ac521094db7 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -1206,6 +1206,8 @@ void bootm_final(enum bootm_final_t flags)
        if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
                bootstage_report();
 
+       board_quiesce_devices();
+
        /*
         * Call remove function of all devices with a removal flag set.
         * This may be useful for last-stage operations, like cancelling
-- 
2.43.0

Reply via email to