]> Git Repo - u-boot.git/commitdiff
Merge patch series "Keep the access to dtb_dt_embedded() within fdtdec"
authorTom Rini <[email protected]>
Tue, 31 Dec 2024 16:57:54 +0000 (10:57 -0600)
committerTom Rini <[email protected]>
Tue, 31 Dec 2024 16:57:54 +0000 (10:57 -0600)
Evgeny Bachinin <[email protected]> says:

The 1st patch addresses comments from the post-review, available by
link [1].

  The 2nd patch fixes problems of dtb_dt_embedded() with checkpatch.

Links:
[1] https://lore.kernel.org/u-boot/CAFLszTgEKamsa6FTnjzrEWQBLkqAR7EBbZqffx09AKgQ7ppuVA@mail.gmail.com/#t

Link: https://lore.kernel.org/r/20241211-dtb_dt_embedded_within_fdtdec-v1-0-7840469f0084@salutedevices.com
common/board_r.c
include/fdtdec.h
lib/fdtdec.c

index 23ebc41868c961524a3de61648cd2192080cd485..f63c6aed4d5d26888ecacc3f38230036e5dc4579 100644 (file)
@@ -155,11 +155,11 @@ static int initr_reloc_global_data(void)
 
        /*
         * For CONFIG_OF_EMBED case the FDT is embedded into ELF, available by
-        * __dtb_dt_begin. After U-boot ELF self-relocation to RAM top address
+        * __dtb_dt_begin. After U-Boot ELF self-relocation to RAM top address
         * it is worth to update fdt_blob in global_data
         */
        if (IS_ENABLED(CONFIG_OF_EMBED))
-               gd->fdt_blob = dtb_dt_embedded();
+               fdtdec_setup_embed();
 
 #ifdef CONFIG_EFI_LOADER
        /*
index 58bbd8f392e462e8fd384a83708c08317a8d157e..d9fcd037ed266f73fa8e693c09a35bf2b32dadfa 100644 (file)
@@ -136,23 +136,6 @@ struct fdt_pci_addr {
        u32     phys_lo;
 };
 
-extern u8 __dtb_dt_begin[];    /* embedded device tree blob */
-extern u8 __dtb_dt_spl_begin[];        /* embedded device tree blob for SPL/TPL */
-
-/* Get a pointer to the embedded devicetree, if there is one, else NULL */
-static inline u8 *dtb_dt_embedded(void)
-{
-#ifdef CONFIG_OF_EMBED
-# ifdef CONFIG_XPL_BUILD
-       return __dtb_dt_spl_begin;
-# else
-       return __dtb_dt_begin;
-# endif
-#else
-       return NULL;
-#endif
-}
-
 /**
  * Compute the size of a resource.
  *
@@ -1155,6 +1138,13 @@ int fdtdec_set_carveout(void *blob, const char *node, const char *prop_name,
                        const char *name, const char **compatibles,
                        unsigned int count, unsigned long flags);
 
+/**
+ * fdtdec_setup_embed - pick up embedded DTS
+ *
+ * Should be invoked under CONFIG_OF_EMBED guard.
+ */
+void fdtdec_setup_embed(void);
+
 /**
  * Set up the device tree ready for use
  */
index c5d29d4385adb2120a4f110dd815a7de93f5c60d..f09c9926a7acf7fe0e81a99a3439f01e422dd06b 100644 (file)
@@ -93,6 +93,23 @@ static const char *const fdt_src_name[] = {
        [FDTSRC_BLOBLIST] = "bloblist",
 };
 
+extern u8 __dtb_dt_begin[];    /* embedded device tree blob */
+extern u8 __dtb_dt_spl_begin[];        /* embedded device tree blob for SPL/TPL */
+
+/* Get a pointer to the embedded devicetree, if there is one, else NULL */
+static u8 *dtb_dt_embedded(void)
+{
+       u8 *addr = NULL;
+
+       if (IS_ENABLED(CONFIG_OF_EMBED)) {
+               addr = __dtb_dt_begin;
+
+               if (IS_ENABLED(CONFIG_XPL_BUILD))
+                       addr = __dtb_dt_spl_begin;
+       }
+       return addr;
+}
+
 const char *fdtdec_get_srcname(void)
 {
        return fdt_src_name[gd->fdt_src];
@@ -1664,6 +1681,12 @@ static void setup_multi_dtb_fit(void)
        }
 }
 
+void fdtdec_setup_embed(void)
+{
+       gd->fdt_blob = dtb_dt_embedded();
+       gd->fdt_src = FDTSRC_EMBED;
+}
+
 int fdtdec_setup(void)
 {
        int ret = -ENOENT;
@@ -1699,8 +1722,7 @@ int fdtdec_setup(void)
                        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;
+                       fdtdec_setup_embed();
                }
        }
 
This page took 0.04867 seconds and 4 git commands to generate.