2017-10-17 12:20:54 +00:00
|
|
|
From 6a09f5e80038570b15f81fdb1e5bde897e01868a Mon Sep 17 00:00:00 2001
|
2017-10-17 12:10:24 +00:00
|
|
|
From: Rob Clark <robdclark@gmail.com>
|
|
|
|
Date: Fri, 23 Jun 2017 15:36:33 -0400
|
2017-10-17 12:20:54 +00:00
|
|
|
Subject: [PATCH] dm: core: also parse chosen node
|
2017-10-17 12:10:24 +00:00
|
|
|
|
|
|
|
This is the node that would contain, for example, the framebuffer setup
|
|
|
|
by an earlier stage.
|
|
|
|
|
|
|
|
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
|
|
|
---
|
2017-10-17 12:20:54 +00:00
|
|
|
arch/sandbox/dts/test.dts | 7 +++++++
|
|
|
|
drivers/core/root.c | 12 ++++++++++++
|
|
|
|
test/dm/bus.c | 2 +-
|
|
|
|
test/dm/test-fdt.c | 2 +-
|
|
|
|
4 files changed, 21 insertions(+), 2 deletions(-)
|
2017-10-17 12:10:24 +00:00
|
|
|
|
2017-10-17 12:20:54 +00:00
|
|
|
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
|
|
|
|
index e67d428eb2..3f9e788e6c 100644
|
|
|
|
--- a/arch/sandbox/dts/test.dts
|
|
|
|
+++ b/arch/sandbox/dts/test.dts
|
|
|
|
@@ -478,6 +478,13 @@
|
|
|
|
wdt0: wdt@0 {
|
|
|
|
compatible = "sandbox,wdt";
|
|
|
|
};
|
|
|
|
+
|
|
|
|
+ chosen {
|
|
|
|
+ chosen-test {
|
|
|
|
+ compatible = "denx,u-boot-fdt-test";
|
|
|
|
+ reg = <9 1>;
|
|
|
|
+ };
|
|
|
|
+ };
|
|
|
|
};
|
|
|
|
|
|
|
|
#include "sandbox_pmic.dtsi"
|
2017-10-17 12:10:24 +00:00
|
|
|
diff --git a/drivers/core/root.c b/drivers/core/root.c
|
2017-10-17 12:20:54 +00:00
|
|
|
index 976e2c4fdd..5a1c5994f6 100644
|
2017-10-17 12:10:24 +00:00
|
|
|
--- a/drivers/core/root.c
|
|
|
|
+++ b/drivers/core/root.c
|
2017-10-17 12:20:54 +00:00
|
|
|
@@ -266,6 +266,18 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
|
|
|
|
for (offset = fdt_first_subnode(blob, offset);
|
|
|
|
offset > 0;
|
|
|
|
offset = fdt_next_subnode(blob, offset)) {
|
2017-10-17 12:10:24 +00:00
|
|
|
+
|
2017-10-17 12:20:54 +00:00
|
|
|
+ /* "chosen" node isn't a device itself but may contain some: */
|
|
|
|
+ if (!strcmp(fdt_get_name(blob, offset, NULL), "chosen")) {
|
|
|
|
+ pr_debug("parsing subnodes of \"chosen\"\n");
|
2017-10-17 12:10:24 +00:00
|
|
|
+
|
2017-10-17 12:20:54 +00:00
|
|
|
+ err = dm_scan_fdt_node(parent, blob, offset,
|
|
|
|
+ pre_reloc_only);
|
|
|
|
+ if (err && !ret)
|
|
|
|
+ ret = err;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
2017-10-17 12:10:24 +00:00
|
|
|
+
|
2017-10-17 12:20:54 +00:00
|
|
|
if (pre_reloc_only &&
|
|
|
|
!dm_fdt_pre_reloc(blob, offset))
|
|
|
|
continue;
|
|
|
|
diff --git a/test/dm/bus.c b/test/dm/bus.c
|
|
|
|
index 7006d4163d..1da398ae3a 100644
|
|
|
|
--- a/test/dm/bus.c
|
|
|
|
+++ b/test/dm/bus.c
|
|
|
|
@@ -105,7 +105,7 @@ UCLASS_DRIVER(testbus) = {
|
|
|
|
/* Test that we can probe for children */
|
|
|
|
static int dm_test_bus_children(struct unit_test_state *uts)
|
|
|
|
{
|
|
|
|
- int num_devices = 6;
|
|
|
|
+ int num_devices = 7;
|
|
|
|
struct udevice *bus;
|
|
|
|
struct uclass *uc;
|
|
|
|
|
|
|
|
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
|
|
|
|
index dcc2ef8b65..920ccbf016 100644
|
|
|
|
--- a/test/dm/test-fdt.c
|
|
|
|
+++ b/test/dm/test-fdt.c
|
|
|
|
@@ -167,7 +167,7 @@ int dm_check_devices(struct unit_test_state *uts, int num_devices)
|
|
|
|
/* Test that FDT-based binding works correctly */
|
|
|
|
static int dm_test_fdt(struct unit_test_state *uts)
|
|
|
|
{
|
|
|
|
- const int num_devices = 6;
|
|
|
|
+ const int num_devices = 7;
|
|
|
|
struct udevice *dev;
|
|
|
|
struct uclass *uc;
|
|
|
|
int ret;
|
2017-10-17 12:10:24 +00:00
|
|
|
|
2017-10-17 12:20:54 +00:00
|
|
|
From 310feda7f7f40afbb26a158183e16c2c46eea28a Mon Sep 17 00:00:00 2001
|
2017-10-17 12:10:24 +00:00
|
|
|
From: Rob Clark <robdclark@gmail.com>
|
|
|
|
Date: Thu, 3 Aug 2017 09:52:14 -0400
|
2017-10-17 12:20:54 +00:00
|
|
|
Subject: [PATCH] fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE
|
2017-10-17 12:10:24 +00:00
|
|
|
|
|
|
|
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 ++-
|
2017-10-17 12:20:54 +00:00
|
|
|
lib/fdtdec.c | 35 +++++++++++++++++++++++------------
|
|
|
|
2 files changed, 25 insertions(+), 13 deletions(-)
|
2017-10-17 12:10:24 +00:00
|
|
|
|
|
|
|
diff --git a/include/fdtdec.h b/include/fdtdec.h
|
2017-10-17 12:20:54 +00:00
|
|
|
index 1ba02be8e1..c5acb8dae1 100644
|
2017-10-17 12:10:24 +00:00
|
|
|
--- a/include/fdtdec.h
|
|
|
|
+++ b/include/fdtdec.h
|
|
|
|
@@ -988,7 +988,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
|
2017-10-17 12:20:54 +00:00
|
|
|
index 45f3fe7baf..15bd9b2572 100644
|
2017-10-17 12:10:24 +00:00
|
|
|
--- a/lib/fdtdec.c
|
|
|
|
+++ b/lib/fdtdec.c
|
2017-10-17 12:20:54 +00:00
|
|
|
@@ -1258,6 +1258,28 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)
|
|
|
|
# endif
|
2017-10-17 12:10:24 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef CONFIG_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)
|
2017-10-17 12:20:54 +00:00
|
|
|
+{
|
2017-10-17 12:10:24 +00:00
|
|
|
+ void *fdt_blob = NULL;
|
|
|
|
+#ifdef CONFIG_SPL_BUILD
|
2017-10-17 12:20:54 +00:00
|
|
|
+ /* FDT is at end of BSS unless it is in a different memory region */
|
|
|
|
+ if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
|
2017-10-17 12:10:24 +00:00
|
|
|
+ fdt_blob = (ulong *)&_image_binary_end;
|
2017-10-17 12:20:54 +00:00
|
|
|
+ else
|
2017-10-17 12:10:24 +00:00
|
|
|
+ fdt_blob = (ulong *)&__bss_end;
|
|
|
|
+#else
|
2017-10-17 12:20:54 +00:00
|
|
|
+ /* FDT is at end of image */
|
2017-10-17 12:10:24 +00:00
|
|
|
+ fdt_blob = (ulong *)&_end;
|
2017-10-17 12:20:54 +00:00
|
|
|
+#endif
|
2017-10-17 12:10:24 +00:00
|
|
|
+ return fdt_blob;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
2017-10-17 12:20:54 +00:00
|
|
|
int fdtdec_setup(void)
|
|
|
|
{
|
|
|
|
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
|
|
|
@@ -1267,18 +1289,7 @@ int fdtdec_setup(void)
|
|
|
|
# ifdef CONFIG_OF_EMBED
|
|
|
|
/* Get a pointer to the FDT */
|
|
|
|
gd->fdt_blob = __dtb_dt_begin;
|
|
|
|
-# 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)
|
2017-10-17 12:10:24 +00:00
|
|
|
+# elif defined(CONFIG_OF_SEPARATE) || defined(CONFIG_OF_BOARD)
|
2017-10-17 12:20:54 +00:00
|
|
|
/* Allow the board to override the fdt address. */
|
2017-10-17 12:10:24 +00:00
|
|
|
gd->fdt_blob = board_fdt_blob_setup();
|
|
|
|
# elif defined(CONFIG_OF_HOSTFILE)
|
|
|
|
|