summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-04-05 12:28:33 (GMT)
committerTom Rini <trini@konsulko.com>2017-04-05 12:28:33 (GMT)
commit433647a7ef9241b963b4636e7f8c3a2159d156f0 (patch)
tree15008cb530f46b5f9711efa2d9fc550b11ce2905 /include
parent7da8680b260b4598d841d9a8432d95d56cb86d9f (diff)
parent239ae4a9129b8b9f24a216e127042b255b07ae59 (diff)
downloadu-boot-fsl-qoriq-433647a7ef9241b963b4636e7f8c3a2159d156f0.tar.xz
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'include')
-rw-r--r--include/dm/device-internal.h5
-rw-r--r--include/dm/device.h26
-rw-r--r--include/dm/root.h16
3 files changed, 45 insertions, 2 deletions
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index 0bf8707..2cabc87 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -96,12 +96,13 @@ int device_probe(struct udevice *dev);
* children are deactivated first.
*
* @dev: Pointer to device to remove
+ * @flags: Flags for selective device removal
* @return 0 if OK, -ve on error (an error here is normally a very bad thing)
*/
#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
-int device_remove(struct udevice *dev);
+int device_remove(struct udevice *dev, uint flags);
#else
-static inline int device_remove(struct udevice *dev) { return 0; }
+static inline int device_remove(struct udevice *dev, uint flags) { return 0; }
#endif
/**
diff --git a/include/dm/device.h b/include/dm/device.h
index 4e95fb7..079ec57 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -46,6 +46,32 @@ struct driver_info;
#define DM_FLAG_OF_PLATDATA (1 << 8)
+/*
+ * Call driver remove function to stop currently active DMA transfers or
+ * give DMA buffers back to the HW / controller. This may be needed for
+ * some drivers to do some final stage cleanup before the OS is called
+ * (U-Boot exit)
+ */
+#define DM_FLAG_ACTIVE_DMA (1 << 9)
+
+/*
+ * One or multiple of these flags are passed to device_remove() so that
+ * a selective device removal as specified by the remove-stage and the
+ * driver flags can be done.
+ */
+enum {
+ /* Normal remove, remove all devices */
+ DM_REMOVE_NORMAL = 1 << 0,
+
+ /* Remove devices with active DMA */
+ DM_REMOVE_ACTIVE_DMA = DM_FLAG_ACTIVE_DMA,
+
+ /* Add more use cases here */
+
+ /* Remove devices with any active flag */
+ DM_REMOVE_ACTIVE_ALL = DM_REMOVE_ACTIVE_DMA,
+};
+
/**
* struct udevice - An instance of a driver
*
diff --git a/include/dm/root.h b/include/dm/root.h
index 3cf730d..058eb98 100644
--- a/include/dm/root.h
+++ b/include/dm/root.h
@@ -115,4 +115,20 @@ int dm_init(void);
*/
int dm_uninit(void);
+#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
+/**
+ * dm_remove_devices_flags - Call remove function of all drivers with
+ * specific removal flags set to selectively
+ * remove drivers
+ *
+ * All devices with the matching flags set will be removed
+ *
+ * @flags: Flags for selective device removal
+ * @return 0 if OK, -ve on error
+ */
+int dm_remove_devices_flags(uint flags);
+#else
+static inline int dm_remove_devices_flags(uint flags) { return 0; }
+#endif
+
#endif