]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: core: parse chosen node
authorRob Clark <robdclark@gmail.com>
Wed, 10 Jan 2018 10:33:30 +0000 (11:33 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 15 Jan 2018 16:35:38 +0000 (11:35 -0500)
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
drivers/core/root.c
test/dm/bus.c
test/dm/test-fdt.c

index e67d428eb2f725a70d72c41259f57188dd8efd0c..3f9e788e6c36022129383e994ce2224eade16a95 100644 (file)
        wdt0: wdt@0 {
                compatible = "sandbox,wdt";
        };
+
+       chosen {
+               chosen-test {
+                       compatible = "denx,u-boot-fdt-test";
+                       reg = <9 1>;
+               };
+       };
 };
 
 #include "sandbox_pmic.dtsi"
index 976e2c4fdd9d6b3842f7db8a2781306a3739690f..36336b65b6cbfd8e6ba2b88d9b27f48a08280692 100644 (file)
@@ -266,6 +266,17 @@ 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;
index 7006d4163db832632662c9214333d2cc939b46af..1da398ae3a8c79bdc513d4981a3edc268320001e 100644 (file)
@@ -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;
 
index dcc2ef8b652b76456020b204b56e6068aadf9fbe..920ccbf016dc291e93c2bf5ea2c1a4123d60381c 100644 (file)
@@ -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;