[PATCH 3/3] bsps/shared/: Use device tree blob

Padmarao Begari padmarao.begari at microchip.com
Thu Sep 8 15:43:32 UTC 2022


If the bsp is integrated and supported a device tree
blob(dtb) then use dtb instead of using it from the U-Boot.
---
 bsps/shared/start/bsp-fdt.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/bsps/shared/start/bsp-fdt.c b/bsps/shared/start/bsp-fdt.c
index 75a1ea41c9..7e1a698896 100644
--- a/bsps/shared/start/bsp-fdt.c
+++ b/bsps/shared/start/bsp-fdt.c
@@ -32,6 +32,10 @@
 #include <bsp/fdt.h>
 #include <bsp/linker-symbols.h>
 
+#ifdef BSP_DTB_IS_SUPPORTED
+#include BSP_DTB_HEADER_PATH
+#endif
+
 #ifndef BSP_FDT_IS_SUPPORTED
 #warning "BSP FDT support indication not defined"
 #endif
@@ -51,7 +55,12 @@ bsp_fdt_blob[BSP_FDT_BLOB_SIZE_MAX / sizeof(uint32_t)];
 
 void bsp_fdt_copy(const void *src)
 {
+#ifdef BSP_DTB_IS_SUPPORTED
+const volatile uint32_t *s = (const uint32_t *) system_dtb;
+#else
   const volatile uint32_t *s = (const uint32_t *) src;
+#endif
+
 #ifdef BSP_FDT_BLOB_COPY_TO_READ_ONLY_LOAD_AREA
   uint32_t *d = (uint32_t *) ((uintptr_t) &bsp_fdt_blob[0]
     - (uintptr_t) bsp_section_rodata_begin
@@ -61,7 +70,7 @@ void bsp_fdt_copy(const void *src)
 #endif
 
   if (s != d) {
-    size_t m = MIN(sizeof(bsp_fdt_blob), fdt_totalsize(src));
+    size_t m = MIN(sizeof(bsp_fdt_blob), fdt_totalsize(s));
     size_t aligned_size = roundup2(m, CPU_CACHE_LINE_BYTES);
     size_t n = (m + sizeof(*d) - 1) / sizeof(*d);
     size_t i;
-- 
2.25.1



More information about the devel mailing list