summaryrefslogtreecommitdiff
path: root/include/dm
diff options
context:
space:
mode:
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/device-internal.h38
-rw-r--r--include/dm/device.h23
-rw-r--r--include/dm/uclass-internal.h11
3 files changed, 68 insertions, 4 deletions
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index f4af15448f..02ac4c7952 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -131,6 +131,44 @@ static inline void device_free(struct udevice *dev) {}
#endif
/**
+ * device_chld_unbind() - Unbind all device's children from the device if bound
+ * to drv
+ *
+ * On error, the function continues to unbind all children, and reports the
+ * first error.
+ *
+ * @dev: The device that is to be stripped of its children
+ * @drv: The targeted driver
+ * @return 0 on success, -ve on error
+ */
+#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
+int device_chld_unbind(struct udevice *dev, struct driver *drv);
+#else
+static inline int device_chld_unbind(struct udevice *dev, struct driver *drv)
+{
+ return 0;
+}
+#endif
+
+/**
+ * device_chld_remove() - Stop all device's children
+ * @dev: The device whose children are to be removed
+ * @drv: The targeted driver
+ * @flags: Flag, if this functions is called in the pre-OS stage
+ * @return 0 on success, -ve on error
+ */
+#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
+int device_chld_remove(struct udevice *dev, struct driver *drv,
+ uint flags);
+#else
+static inline int device_chld_remove(struct udevice *dev, struct driver *drv,
+ uint flags)
+{
+ return 0;
+}
+#endif
+
+/**
* simple_bus_translate() - translate a bus address to a system address
*
* This handles the 'ranges' property in a simple bus. It translates the
diff --git a/include/dm/device.h b/include/dm/device.h
index 49078bc6b3..3120b68fcc 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -473,18 +473,33 @@ int device_get_child_by_of_offset(struct udevice *parent, int of_offset,
struct udevice **devp);
/**
- * device_get_global_by_of_offset() - Get a device based on FDT offset
+ * device_find_global_by_ofnode() - Get a device based on ofnode
*
- * Locates a device by its device tree offset, searching globally throughout
+ * Locates a device by its device tree ofnode, searching globally throughout
+ * the all driver model devices.
+ *
+ * The device is NOT probed
+ *
+ * @node: Device tree ofnode to find
+ * @devp: Returns pointer to device if found, otherwise this is set to NULL
+ * @return 0 if OK, -ve on error
+ */
+
+int device_find_global_by_ofnode(ofnode node, struct udevice **devp);
+
+/**
+ * device_get_global_by_ofnode() - Get a device based on ofnode
+ *
+ * Locates a device by its device tree ofnode, searching globally throughout
* the all driver model devices.
*
* The device is probed to activate it ready for use.
*
- * @of_offset: Device tree offset to find
+ * @node: Device tree ofnode to find
* @devp: Returns pointer to device if found, otherwise this is set to NULL
* @return 0 if OK, -ve on error
*/
-int device_get_global_by_of_offset(int of_offset, struct udevice **devp);
+int device_get_global_by_ofnode(ofnode node, struct udevice **devp);
/**
* device_find_first_child() - Find the first child of a device
diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h
index 7ba064bd53..30d5a4fb9b 100644
--- a/include/dm/uclass-internal.h
+++ b/include/dm/uclass-internal.h
@@ -24,6 +24,17 @@
int uclass_get_device_tail(struct udevice *dev, int ret, struct udevice **devp);
/**
+ * dev_get_uclass_index() - Get uclass and index of device
+ * @dev: - in - Device that we want the uclass/index of
+ * @ucp: - out - A pointer to the uclass the device belongs to
+ *
+ * The device is not prepared for use - this is an internal function.
+ *
+ * @return the index of the device in the uclass list or -ENODEV if not found.
+ */
+int dev_get_uclass_index(struct udevice *dev, struct uclass **ucp);
+
+/**
* uclass_find_device() - Return n-th child of uclass
* @id: Id number of the uclass
* @index: Position of the child in uclass's list