]> Git Repo - J-u-boot.git/blobdiff - lib/fdtdec.c
rockchip: rk3399-gru: Include pinctrl and regulators in SPL
[J-u-boot.git] / lib / fdtdec.c
index 85f4426f9049ece8df806e2f7e4ada397089c63f..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];
@@ -1172,10 +1189,10 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)
        void *dst;
        int rc;
 
-       if (CONFIG_IS_ENABLED(GZIP))
+       if (CONFIG_IS_ENABLED(GZIP) && CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP))
                if (gzip_parse_header(src, sz_in) >= 0)
                        gzip = 1;
-       if (CONFIG_IS_ENABLED(LZO))
+       if (CONFIG_IS_ENABLED(LZO) && CONFIG_IS_ENABLED(MULTI_DTB_FIT_LZO))
                if (!gzip && lzop_is_valid_header(src))
                        lzo = 1;
 
@@ -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;
@@ -1677,7 +1700,7 @@ int fdtdec_setup(void)
         */
        if (CONFIG_IS_ENABLED(BLOBLIST) &&
            (xpl_prev_phase() != PHASE_TPL ||
-            !IS_ENABLED(CONFIG_TPL_BLOBLIST))) {
+            IS_ENABLED(CONFIG_TPL_BLOBLIST))) {
                ret = bloblist_maybe_init();
                if (!ret) {
                        gd->fdt_blob = bloblist_find(BLOBLISTT_CONTROL_FDT, 0);
@@ -1699,18 +1722,23 @@ 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();
                }
        }
 
        /* Allow the board to override the fdt address. */
        if (IS_ENABLED(CONFIG_OF_BOARD)) {
-               gd->fdt_blob = board_fdt_blob_setup(&ret);
-               if (!ret)
+               void *blob;
+
+               blob = (void *)gd->fdt_blob;
+               ret = board_fdt_blob_setup(&blob);
+               if (ret) {
+                       if (ret != -EEXIST)
+                               return ret;
+               } else {
                        gd->fdt_src = FDTSRC_BOARD;
-               else if (ret != -EEXIST)
-                       return ret;
+                       gd->fdt_blob = blob;
+               }
        }
 
        /* Allow the early environment to override the fdt address */
This page took 0.026913 seconds and 4 git commands to generate.