diff options
| author | Tom Rini <trini@konsulko.com> | 2024-01-08 12:00:18 -0500 | 
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2024-01-08 12:00:18 -0500 | 
| commit | 93d91e9485d902a1836a22e72d1a545b587adf36 (patch) | |
| tree | f368b4e3c2220e7cd34c83bf192d8b674158d16b /lib/fdtdec.c | |
| parent | 866ca972d6c3cabeaf6dbac431e8e08bb30b3c8e (diff) | |
| parent | f28a77589e7505535a4eebdc7269df98f67dbe68 (diff) | |
Merge branch 'next'
Diffstat (limited to 'lib/fdtdec.c')
| -rw-r--r-- | lib/fdtdec.c | 45 | 
1 files changed, 34 insertions, 11 deletions
| diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 7a691676483..b2c59ab3818 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -7,7 +7,10 @@   */  #ifndef USE_HOSTCC -#include <common.h> + +#define LOG_CATEGORY	LOGC_DT + +#include <bloblist.h>  #include <boot_fit.h>  #include <display_options.h>  #include <dm.h> @@ -87,6 +90,7 @@ static const char *const fdt_src_name[] = {  	[FDTSRC_BOARD] = "board",  	[FDTSRC_EMBED] = "embed",  	[FDTSRC_ENV] = "env", +	[FDTSRC_BLOBLIST] = "bloblist",  };  const char *fdtdec_get_srcname(void) @@ -1663,23 +1667,42 @@ static void setup_multi_dtb_fit(void)  int fdtdec_setup(void)  { -	int ret; +	int ret = -ENOENT; + +	/* If allowing a bloblist, check that first */ +	if (CONFIG_IS_ENABLED(BLOBLIST)) { +		ret = bloblist_maybe_init(); +		if (!ret) { +			gd->fdt_blob = bloblist_find(BLOBLISTT_CONTROL_FDT, 0); +			if (gd->fdt_blob) { +				gd->fdt_src = FDTSRC_BLOBLIST; +				log_debug("Devicetree is in bloblist at %p\n", +					  gd->fdt_blob); +			} else { +				log_debug("No FDT found in bloblist\n"); +				ret = -ENOENT; +			} +		} +	} -	/* The devicetree is typically appended to U-Boot */ -	if (IS_ENABLED(CONFIG_OF_SEPARATE)) { -		gd->fdt_blob = fdt_find_separate(); -		gd->fdt_src = FDTSRC_SEPARATE; -	} else { /* embed dtb in ELF file for testing / development */ -		gd->fdt_blob = dtb_dt_embedded(); -		gd->fdt_src = FDTSRC_EMBED; +	/* Otherwise, the devicetree is typically appended to U-Boot */ +	if (ret) { +		if (IS_ENABLED(CONFIG_OF_SEPARATE)) { +			gd->fdt_blob = fdt_find_separate(); +			gd->fdt_src = FDTSRC_SEPARATE; +		} else { /* embed dtb in ELF file for testing / development */ +			gd->fdt_blob = dtb_dt_embedded(); +			gd->fdt_src = FDTSRC_EMBED; +		}  	}  	/* Allow the board to override the fdt address. */  	if (IS_ENABLED(CONFIG_OF_BOARD)) {  		gd->fdt_blob = board_fdt_blob_setup(&ret); -		if (ret) +		if (!ret) +			gd->fdt_src = FDTSRC_BOARD; +		else if (ret != -EEXIST)  			return ret; -		gd->fdt_src = FDTSRC_BOARD;  	}  	/* Allow the early environment to override the fdt address */ | 
