diff mbox series

[U-Boot,08/25] dm: reset: Update uclass to allow querying reset status

Message ID 20180821143203.29142-9-lokeshvutla@ti.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series Initial support Texas Instrument's AM654 Platform | expand

Commit Message

Lokesh Vutla Aug. 21, 2018, 2:31 p.m. UTC
From: Andreas Dannenberg <dannenberg@ti.com>

Add a reset operations function pointer to support querying the current
status of a reset control.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/reset/reset-uclass.c |  9 +++++++++
 include/reset-uclass.h       |  8 ++++++++
 include/reset.h              | 14 ++++++++++++++
 3 files changed, 31 insertions(+)

Comments

Tom Rini Aug. 24, 2018, 2:11 p.m. UTC | #1
On Tue, Aug 21, 2018 at 08:01:46PM +0530, Lokesh Vutla wrote:

> From: Andreas Dannenberg <dannenberg@ti.com>
> 
> Add a reset operations function pointer to support querying the current
> status of a reset control.
> 
> Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox series

Patch

diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c
index 3899537635..89e39c6b5a 100644
--- a/drivers/reset/reset-uclass.c
+++ b/drivers/reset/reset-uclass.c
@@ -192,6 +192,15 @@  int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
 	return 0;
 }
 
+int reset_status(struct reset_ctl *reset_ctl)
+{
+	struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+
+	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
+
+	return ops->rst_status(reset_ctl);
+}
+
 int reset_release_all(struct reset_ctl *reset_ctl, int count)
 {
 	int i, ret;
diff --git a/include/reset-uclass.h b/include/reset-uclass.h
index c17d738b31..7b5cc3cb3b 100644
--- a/include/reset-uclass.h
+++ b/include/reset-uclass.h
@@ -76,6 +76,14 @@  struct reset_ops {
 	 * @return 0 if OK, or a negative error code.
 	 */
 	int (*rst_deassert)(struct reset_ctl *reset_ctl);
+	/**
+	 * rst_status - Check reset signal status.
+	 *
+	 * @reset_ctl:	The reset signal to check.
+	 * @return 0 if deasserted, positive if asserted, or a negative
+	 *           error code.
+	 */
+	int (*rst_status)(struct reset_ctl *reset_ctl);
 };
 
 #endif
diff --git a/include/reset.h b/include/reset.h
index a7bbc1c331..34ebb096dd 100644
--- a/include/reset.h
+++ b/include/reset.h
@@ -206,6 +206,15 @@  int reset_deassert(struct reset_ctl *reset_ctl);
  */
 int reset_deassert_bulk(struct reset_ctl_bulk *bulk);
 
+/**
+ * rst_status - Check reset signal status.
+ *
+ * @reset_ctl:	The reset signal to check.
+ * @return 0 if deasserted, positive if asserted, or a negative
+ *           error code.
+ */
+int reset_status(struct reset_ctl *reset_ctl);
+
 /**
  * reset_release_all - Assert/Free an array of previously requested resets.
  *
@@ -279,6 +288,11 @@  static inline int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
 	return 0;
 }
 
+static inline int reset_status(struct reset_ctl *reset_ctl)
+{
+	return -ENOTSUPP;
+}
+
 static inline int reset_release_all(struct reset_ctl *reset_ctl, int count)
 {
 	return 0;