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 03/03] dm: core: parse chosen node
Date: Wed, 10 Jan 2018 11:33:30 +0100	[thread overview]
Message-ID: <1515580410-25890-3-git-send-email-jorge.ramirez.ortiz@gmail.com> (raw)
In-Reply-To: <1515580410-25890-1-git-send-email-jorge.ramirez.ortiz@gmail.com>

From: Rob Clark <robdclark@gmail.com>

This is the node that would contain, for example, the framebuffer setup
by an earlier stage.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 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(-)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index e67d428..3f9e788 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -478,6 +478,13 @@
 	wdt0: wdt at 0 {
 		compatible = "sandbox,wdt";
 	};
+
+	chosen {
+		chosen-test {
+			compatible = "denx,u-boot-fdt-test";
+			reg = <9 1>;
+		};
+	};
 };
 
 #include "sandbox_pmic.dtsi"
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 976e2c4..5a1c599 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -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)) {
+
+		/* "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");
+
+			err = dm_scan_fdt_node(parent, blob, offset,
+					       pre_reloc_only);
+			if (err && !ret)
+				ret = err;
+			continue;
+		}
+
 		if (pre_reloc_only &&
 		    !dm_fdt_pre_reloc(blob, offset))
 			continue;
diff --git a/test/dm/bus.c b/test/dm/bus.c
index 7006d41..1da398a 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 dcc2ef8..920ccbf 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;
-- 
2.7.4

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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 10:33 [U-Boot] [PATCH v1 01/03] spmi: msm: display the PMIC Arb version (debug) Jorge Ramirez-Ortiz
2018-01-10 10:33 ` [U-Boot] [PATCH v1 02/03] poplar: configs: increase gunzip buffer size for the kernel Jorge Ramirez-Ortiz
2018-01-15 21:42   ` [U-Boot] [U-Boot, v1, " Tom Rini
2018-01-10 10:33 ` Jorge Ramirez-Ortiz [this message]
2018-01-15 21:43   ` [U-Boot] [U-Boot,v1,03/03] dm: core: parse chosen node Tom Rini
2018-01-15 21:42 ` [U-Boot] [U-Boot, v1, 01/03] spmi: msm: display the PMIC Arb version (debug) 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=1515580410-25890-3-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