[U-Boot] [PATCH v1 03/03] dm: core: parse chosen node
Jorge Ramirez-Ortiz
jorge.ramirez.ortiz at gmail.com
Wed Jan 10 10:33:30 UTC 2018
From: Rob Clark <robdclark at gmail.com>
This is the node that would contain, for example, the framebuffer setup
by an earlier stage.
Signed-off-by: Rob Clark <robdclark at 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
More information about the U-Boot
mailing list