Hi,

On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
Some platforms might require the external fdt to boot.
Why ? we may want to build the fdt in, and discard the external fdt for some 
reasons.

This change provides a mechanism to the board initializaion code to make
the requet explicit.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.rami...@oss.qualcomm.com>
---
  arch/arm/mach-snapdragon/board.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)

diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
index 2ef936aab75..1bca9dce20f 100644
--- a/arch/arm/mach-snapdragon/board.c
+++ b/arch/arm/mach-snapdragon/board.c
@@ -150,7 +150,13 @@ static void show_psci_version(void)
  /* We support booting U-Boot with an internal DT when running as a 
first-stage bootloader
   * or for supporting quirky devices where it's easier to leave the downstream 
DT in place
   * to improve ABL compatibility. Otherwise, we use the DT provided by ABL.
+ *
+ * Alternatively the board can enforce the external fdt.
   */
+bool __weak qcom_board_fdt_external(void)
+{
+       return false;
+}
  int board_fdt_blob_setup(void **fdtp)
  {
        struct fdt_header *fdt;
@@ -161,6 +167,12 @@ int board_fdt_blob_setup(void **fdtp)
        external_valid = fdt && !fdt_check_header(fdt);
        internal_valid = !fdt_check_header(*fdtp);
+ if (qcom_board_fdt_external() && external_valid) {
+               debug("Using external FDT\n");
+               *fdtp = fdt;
+               goto out;
+       }
+
        /*
         * There is no point returning an error here, U-Boot can't do anything 
useful in this situation.
         * Bail out while we can still print a useful error message.
@@ -178,6 +190,7 @@ int board_fdt_blob_setup(void **fdtp)
                *fdtp = fdt;
        }
+out:
        /*
         * Parse the /memory node while we're here,
         * this makes it easy to do other things early.


Reply via email to