board_f: Simplify use of fdt_fixup

There are three options for the ordering of calls to fix_fdt() and
reloc_fdt() which is quite confusing:

1. OF_BOARD_FIXUP && !OF_INITIAL_DTB_READONLY
   - call fix_fdt() as soon as setup_dest_addr() is finished;
   - call reloc_fdt() after all reserve_...() calls

2. OF_BOARD_FIXUP && OF_INITIAL_DTB_READONLY
   - call reloc_fdt() and fix_fdt() immediately after reserve_fdt()

3. !OF_BOARD_FIXUP || !INITIAL_DTB_READONLY
   - call reloc_fdt() after all reserve_...() calls

It doesn't seem necessary to do things this way. Instead, we can wait
until the FDT is relocated, then do fixups if needed.

Note that OF_INITIAL_DTB_READONLY is enabled by only one board
(turris_1x_nor)

Move

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-06-05 05:50:48 -06:00
parent f8c8b7da77
commit fec6fa7ead

View File

@@ -947,10 +947,6 @@ static void initcall_run_f(void)
* - board info struct
*/
INITCALL(setup_dest_addr);
#if CONFIG_IS_ENABLED(OF_BOARD_FIXUP) && \
!CONFIG_IS_ENABLED(OF_INITIAL_DTB_READONLY)
INITCALL(fix_fdt);
#endif
#ifdef CFG_PRAM
INITCALL(reserve_pram);
#endif
@@ -964,11 +960,6 @@ static void initcall_run_f(void)
INITCALL(reserve_board);
INITCALL(reserve_global_data);
INITCALL(reserve_fdt);
#if CONFIG_IS_ENABLED(OF_BOARD_FIXUP) && \
CONFIG_IS_ENABLED(OF_INITIAL_DTB_READONLY)
INITCALL(reloc_fdt);
INITCALL(fix_fdt);
#endif
INITCALL(reserve_bootstage);
INITCALL(reserve_bloblist);
INITCALL(reserve_arch);
@@ -979,9 +970,9 @@ static void initcall_run_f(void)
INITCALL(setup_bdinfo);
INITCALL(display_new_sp);
WATCHDOG_RESET();
#if !CONFIG_IS_ENABLED(OF_BOARD_FIXUP) || \
!CONFIG_IS_ENABLED(INITIAL_DTB_READONLY)
INITCALL(reloc_fdt);
#if CONFIG_IS_ENABLED(OF_BOARD_FIXUP)
INITCALL(fix_fdt);
#endif
INITCALL(reloc_bootstage);
INITCALL(reloc_bloblist);