public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jorge Ramirez-Ortiz <jorge.ramirez.ortiz@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 04/07] fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE
Date: Wed, 10 Jan 2018 11:34:37 +0100	[thread overview]
Message-ID: <1515580480-26075-4-git-send-email-jorge.ramirez.ortiz@gmail.com> (raw)
In-Reply-To: <1515580480-26075-1-git-send-email-jorge.ramirez.ortiz@gmail.com>

From: Rob Clark <robdclark@gmail.com>

Similar to CONFIG_OF_BOARD, but in this case the fdt is still built by
u-boot build.  This allows the board to patch the fdt, etc.

In the specific case of dragonboard 410c, we pass the u-boot generated
fdt to the previous stage of bootloader (by embedding it in the
u-boot.img that is loaded by lk/aboot), which patches the fdt and passes
it back to u-boot.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 include/fdtdec.h |  3 ++-
 lib/fdtdec.c     | 35 +++++++++++++++++++++++------------
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index 0fb3e07..4afb9ac 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -990,7 +990,8 @@ int fdtdec_setup(void);
 
 /**
  * Board-specific FDT initialization. Returns the address to a device tree blob.
- * Called when CONFIG_OF_BOARD is defined.
+ * Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined
+ * and the board implements it.
  */
 void *board_fdt_blob_setup(void);
 
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 30ec6b9..cc3dfd6 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1272,6 +1272,28 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)
 # endif
 #endif
 
+#if CONFIG_IS_ENABLED(OF_SEPARATE)
+/*
+ * For CONFIG_OF_SEPARATE, the board may optionally implement this to
+ * provide and/or fixup the fdt.
+ */
+__weak void *board_fdt_blob_setup(void)
+{
+	void *fdt_blob = NULL;
+#ifdef CONFIG_SPL_BUILD
+	/* FDT is at end of BSS unless it is in a different memory region */
+	if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
+		fdt_blob = (ulong *)&_image_binary_end;
+	else
+		fdt_blob = (ulong *)&__bss_end;
+#else
+	/* FDT is at end of image */
+	fdt_blob = (ulong *)&_end;
+#endif
+	return fdt_blob;
+}
+#endif
+
 int fdtdec_setup(void)
 {
 #if CONFIG_IS_ENABLED(OF_CONTROL)
@@ -1285,18 +1307,7 @@ int fdtdec_setup(void)
 #  else
 	gd->fdt_blob = __dtb_dt_begin;
 #  endif
-# elif defined CONFIG_OF_SEPARATE
-#  ifdef CONFIG_SPL_BUILD
-	/* FDT is at end of BSS unless it is in a different memory region */
-	if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
-		gd->fdt_blob = (ulong *)&_image_binary_end;
-	else
-		gd->fdt_blob = (ulong *)&__bss_end;
-#  else
-	/* FDT is at end of image */
-	gd->fdt_blob = (ulong *)&_end;
-#  endif
-# elif defined(CONFIG_OF_BOARD)
+# elif defined(CONFIG_OF_BOARD) || defined (CONFIG_OF_SEPARATE)
 	/* Allow the board to override the fdt address. */
 	gd->fdt_blob = board_fdt_blob_setup();
 # elif defined(CONFIG_OF_HOSTFILE)
-- 
2.7.4

  parent reply	other threads:[~2018-01-10 10:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 10:34 [U-Boot] [PATCH v1 01/07] db410c: configs: increase gunzip buffer size for the kernel Jorge Ramirez-Ortiz
2018-01-10 10:34 ` [U-Boot] [PATCH v1 02/07] db410c: update wlan and bt mac addresses from firmware Jorge Ramirez-Ortiz
2018-01-15 21:43   ` [U-Boot] [U-Boot, v1, " Tom Rini
2018-01-10 10:34 ` [U-Boot] [PATCH v1 03/07] db410c: replace reset driver with psci Jorge Ramirez-Ortiz
2018-01-15 21:43   ` [U-Boot] [U-Boot, v1, " Tom Rini
2018-01-10 10:34 ` Jorge Ramirez-Ortiz [this message]
2018-01-15 21:43   ` [U-Boot] [U-Boot, v1, 04/07] fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE Tom Rini
2018-01-10 10:34 ` [U-Boot] [PATCH v1 05/07] db410c: use the device tree parsed by the lk loader Jorge Ramirez-Ortiz
2018-01-15 21:43   ` [U-Boot] [U-Boot, v1, " Tom Rini
2018-01-10 10:34 ` [U-Boot] [PATCH v1 06/07] db410c: add reserved-memory node to dts Jorge Ramirez-Ortiz
2018-01-15 21:43   ` [U-Boot] [U-Boot, v1, " Tom Rini
2018-01-10 10:34 ` [U-Boot] [PATCH v1 07/07] db410c: on aarch64 the fdtfile is in per-vendor subdirectory Jorge Ramirez-Ortiz
2018-01-15 21:43   ` [U-Boot] [U-Boot, v1, " Tom Rini
2018-01-15 21:43 ` [U-Boot] [U-Boot, v1, 01/07] db410c: configs: increase gunzip buffer size for the kernel Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1515580480-26075-4-git-send-email-jorge.ramirez.ortiz@gmail.com \
    --to=jorge.ramirez.ortiz@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox