+
+static int dm_scan_fdt_ofnode_path(const void *blob, const char *path,
+ bool pre_reloc_only)
+{
+ ofnode node;
+
+ node = ofnode_path(path);
+ if (!ofnode_valid(node))
+ return 0;
+
+#if CONFIG_IS_ENABLED(OF_LIVE)
+ if (of_live_active())
+ return dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only);
+#endif
+ return dm_scan_fdt_node(gd->dm_root, blob, node.of_offset,
+ pre_reloc_only);
+}
+
+int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
+{
+ int ret, i;
+ const char * const nodes[] = {
+ "/chosen",
+ "/clocks",
+ "/firmware"
+ };
+
+ ret = dm_scan_fdt(blob, pre_reloc_only);
+ if (ret) {
+ debug("dm_scan_fdt() failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Some nodes aren't devices themselves but may contain some */
+ for (i = 0; i < ARRAY_SIZE(nodes); i++) {
+ ret = dm_scan_fdt_ofnode_path(blob, nodes[i], pre_reloc_only);
+ if (ret) {
+ debug("dm_scan_fdt() scan for %s failed: %d\n",
+ nodes[i], ret);
+ return ret;
+ }
+ }
+
+ return ret;
+}