summaryrefslogtreecommitdiffstats
path: root/drivers/reset
diff options
context:
space:
mode:
authorDinh Nguyen <dinguyen@opensource.altera.com>2014-10-10 17:21:14 +0200
committerPhilipp Zabel <p.zabel@pengutronix.de>2014-10-20 10:11:29 +0200
commit729de41baf63e2172b9d61de61bbd53f231095ca (patch)
tree8c04f97eb59f6cd90977f87b5476ec6711546730 /drivers/reset
parentLinux 3.18-rc1 (diff)
downloadlinux-729de41baf63e2172b9d61de61bbd53f231095ca.tar.xz
linux-729de41baf63e2172b9d61de61bbd53f231095ca.zip
reset: add reset_control_status helper function
There are cases where a system will want to read a reset status bit before doing any other toggling. Add a reset_control_status helper function to the reset controller API. Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/reset')
-rw-r--r--drivers/reset/core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index baeaf82d40d9..7955e00d04d4 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -126,6 +126,21 @@ int reset_control_deassert(struct reset_control *rstc)
EXPORT_SYMBOL_GPL(reset_control_deassert);
/**
+ * reset_control_status - returns a negative errno if not supported, a
+ * positive value if the reset line is asserted, or zero if the reset
+ * line is not asserted.
+ * @rstc: reset controller
+ */
+int reset_control_status(struct reset_control *rstc)
+{
+ if (rstc->rcdev->ops->status)
+ return rstc->rcdev->ops->status(rstc->rcdev, rstc->id);
+
+ return -ENOSYS;
+}
+EXPORT_SYMBOL_GPL(reset_control_status);
+
+/**
* of_reset_control_get - Lookup and obtain a reference to a reset controller.
* @node: device to be reset by the controller
* @id: reset line name