[PATCH 6/7] mach-snapdragon: board interface to enforce fdt

Jorge Ramirez jorge.ramirez at oss.qualcomm.com
Mon Apr 7 11:52:54 CEST 2025


On 07/04/25 11:04:30, neil.armstrong at linaro.org wrote:
> 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.

on the db820c, the device tree that u-boot builds is passed to the LK
appendeded with the image via fastboot: the LK, processes it, ammends
the device tree and then hands it back to u-boot.

see the boot trace:

[2830] Only one appended non-skales DTB, select it.                                                                                                                                        
[2850] cmdline:  androidboot.bootdevice=624000.ufshc androidboot.verifiedbootstate=orange androidboot.veritymode=enforcing androidboot.serialno=2f490ecf androidboot.baseband=apq mdss_mdp0
[2860] Updating device tree: start                                                                                                                                                         
[2860] Updating device tree: done                                                                                                                                                          
[2870] Return value from recv_data: 14                                                                                                                                                     
[2880] RPM GLINK UnInit                                                                                                                                                                    
[2880] Qseecom De-Init Done in Appsbl                                                                                                                                                      
[2880] booting linux @ 0x80080000, ramdisk @ 0x82200000 (0), tags/device tree @ 0x82000000                                                                                                 
[2890] Jumping to kernel via monitor                                                                                                                                                       
                                                                                                                                                                                           
                                                                                                                                                                                           
U-Boot 2025.04-rc5-00022-gccd064439bc2 (Apr 07 2025 - 10:06:51 +0200)                                                                                                                      
Qualcomm-DragonBoard 820C                                                                                                                                                                  
                              

It is this external fdt that we need; so I thought allowing the board to
request the external fdt explicitily might make sense.

if you have some other idea/suggestion, please let me know, happy to abide.

> 
> > 
> > This change provides a mechanism to the board initializaion code to make
> > the requet explicit.
> > 
> > Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez at 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.
> 


More information about the U-Boot mailing list