aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-19 10:40:16 -0700
committerSimon Glass <sjg@chromium.org>2021-01-05 12:24:41 -0700
commit49bbe6eab5babbc353f1dc76e6275671c69dffb2 (patch)
tree5ccc5e8a05feaf648d55b94833b6f2f94a5b2caa /drivers
parent84a42ae3668313e72b5056940f4f8e6f5c78e399 (diff)
downloadu-boot-49bbe6eab5babbc353f1dc76e6275671c69dffb2.zip
u-boot-49bbe6eab5babbc353f1dc76e6275671c69dffb2.tar.gz
u-boot-49bbe6eab5babbc353f1dc76e6275671c69dffb2.tar.bz2
dm: core: Split out scanning code to dm_scan()
Move the code related to scanning for devices to bind, into a new function. This will make it easier to skip this step with the new of-platdata improvements. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/core/root.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/drivers/core/root.c b/drivers/core/root.c
index fe73594..2a5ebec 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -296,39 +296,60 @@ __weak int dm_scan_other(bool pre_reloc_only)
return 0;
}
-int dm_init_and_scan(bool pre_reloc_only)
+/**
+ * dm_scan() - Scan tables to bind devices
+ *
+ * Runs through the driver_info tables and binds the devices it finds. Then runs
+ * through the devicetree nodes. Finally calls dm_scan_other() to add any
+ * special devices
+ *
+ * @pre_reloc_only: If true, bind only nodes with special devicetree properties,
+ * or drivers with the DM_FLAG_PRE_RELOC flag. If false bind all drivers.
+ */
+static int dm_scan(bool pre_reloc_only)
{
int ret;
- if (CONFIG_IS_ENABLED(OF_PLATDATA))
- dm_populate_phandle_data();
-
- ret = dm_init(CONFIG_IS_ENABLED(OF_LIVE));
- if (ret) {
- debug("dm_init() failed: %d\n", ret);
- return ret;
- }
ret = dm_scan_plat(pre_reloc_only);
if (ret) {
debug("dm_scan_plat() failed: %d\n", ret);
- goto fail;
+ return ret;
}
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
ret = dm_extended_scan(pre_reloc_only);
if (ret) {
debug("dm_extended_scan() failed: %d\n", ret);
- goto fail;
+ return ret;
}
}
ret = dm_scan_other(pre_reloc_only);
if (ret)
- goto fail;
+ return ret;
+
+ return 0;
+}
+
+int dm_init_and_scan(bool pre_reloc_only)
+{
+ int ret;
+
+ if (CONFIG_IS_ENABLED(OF_PLATDATA))
+ dm_populate_phandle_data();
+
+ ret = dm_init(CONFIG_IS_ENABLED(OF_LIVE));
+ if (ret) {
+ debug("dm_init() failed: %d\n", ret);
+ return ret;
+ }
+ ret = dm_scan(pre_reloc_only);
+ if (ret) {
+ log_debug("dm_scan() failed: %d\n", ret);
+ return ret;
+ }
return 0;
-fail:
- return ret;
}
#ifdef CONFIG_ACPIGEN