fdtdec: encapsulate dtb_dt_embedded() within

  Patch keeps the access to dtb_dt_embedded() within fdtdec API,
by means of new API function introduction. This new function is a
common place for updating appropriate global_data fields for
OF_EMBED case.

  Also, the consequence of the patch is movement of '___dtb_dt_*begin'
symbols' declaration from header file, because nobody used symbols
outside the lib/fdtdec.c.

Signed-off-by: Evgeny Bachinin <EABachinin@salutedevices.com>
Suggested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/common/board_r.c b/common/board_r.c
index 88dc756..3c6a4c1 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -155,11 +155,11 @@
 
 	/*
 	 * 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
 	/*
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 555c952..88eeb51 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -136,23 +136,6 @@
 	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.
  *
@@ -1156,6 +1139,13 @@
 			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
  */
 int fdtdec_setup(void);
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index b065598..9cb94a1 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -93,6 +93,23 @@
 	[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)
+{
+#ifdef CONFIG_OF_EMBED
+# ifdef CONFIG_XPL_BUILD
+	return __dtb_dt_spl_begin;
+# else
+	return __dtb_dt_begin;
+# endif
+#else
+	return NULL;
+#endif
+}
+
 const char *fdtdec_get_srcname(void)
 {
 	return fdt_src_name[gd->fdt_src];
@@ -1664,6 +1681,12 @@
 	}
 }
 
+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 @@
 			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();
 		}
 	}