summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/core/uclass.c19
-rw-r--r--include/dm/uclass.h11
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index cdb975d5b3..f38122d54b 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -757,6 +757,25 @@ int uclass_pre_remove_device(struct udevice *dev)
}
#endif
+int uclass_probe_all(enum uclass_id id)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = uclass_first_device(id, &dev);
+ if (ret || !dev)
+ return ret;
+
+ /* Scanning uclass to probe all devices */
+ while (dev) {
+ ret = uclass_next_device(&dev);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
UCLASS_DRIVER(nop) = {
.id = UCLASS_NOP,
.name = "nop",
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index b5f066dbf4..d95683740c 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -377,6 +377,17 @@ int uclass_first_device_drvdata(enum uclass_id id, ulong driver_data,
struct udevice **devp);
/**
+ * uclass_probe_all() - Probe all devices based on an uclass ID
+ *
+ * This function probes all devices associated with a uclass by
+ * looking for its ID.
+ *
+ * @id: uclass ID to look up
+ * @return 0 if OK, other -ve on error
+ */
+int uclass_probe_all(enum uclass_id id);
+
+/**
* uclass_id_foreach_dev() - Helper function to iteration through devices
*
* This creates a for() loop which works through the available devices in