linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] reset: sti: Provide ops .status() call-back
Date: Mon, 26 Oct 2015 10:56:09 +0000	[thread overview]
Message-ID: <1445856969-19424-3-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1445856969-19424-1-git-send-email-lee.jones@linaro.org>

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/reset/sti/reset-syscfg.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c
index a145cc0..4453412 100644
--- a/drivers/reset/sti/reset-syscfg.c
+++ b/drivers/reset/sti/reset-syscfg.c
@@ -110,10 +110,33 @@ static int syscfg_reset_dev(struct reset_controller_dev *rcdev,
 	return syscfg_reset_deassert(rcdev, idx);
 }
 
+static int syscfg_reset_status(struct reset_controller_dev *rcdev,
+			      unsigned long idx)
+{
+       struct syscfg_reset_controller *rst = to_syscfg_reset_controller(rcdev);
+       const struct syscfg_reset_channel *ch;
+       u32 ret_val = 0;
+       int err;
+
+       if (idx >= rcdev->nr_resets)
+	       return -EINVAL;
+
+       ch = &rst->channels[idx];
+       if (ch->ack)
+	       err = regmap_field_read(ch->ack, &ret_val);
+       else
+	       err = regmap_field_read(ch->reset, &ret_val);
+       if (err)
+	       return err;
+
+       return rst->active_low ? !ret_val : !!ret_val;
+}
+
 static struct reset_control_ops syscfg_reset_ops = {
 	.reset    = syscfg_reset_dev,
 	.assert   = syscfg_reset_assert,
 	.deassert = syscfg_reset_deassert,
+	.status   = syscfg_reset_status,
 };
 
 static int syscfg_reset_controller_register(struct device *dev,
-- 
1.9.1

  parent reply	other threads:[~2015-10-26 10:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26 10:56 [PATCH 1/3] ARM: STi: Add DT defines for co-processor reset lines Lee Jones
2015-10-26 10:56 ` [PATCH 2/3] reset: sti: Add support for resetting co-processors Lee Jones
2015-10-26 10:56 ` Lee Jones [this message]
2016-01-12 13:34 ` [PATCH 1/3] ARM: STi: Add DT defines for co-processor reset lines Lee Jones
2016-01-12 13:41   ` Philipp Zabel
2016-01-12 14:26     ` Lee Jones
2016-01-12 15:56       ` Philipp Zabel
2016-01-12 16:25         ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445856969-19424-3-git-send-email-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).