diff options
author | Lee Jones <lee.jones@linaro.org> | 2015-10-26 11:56:09 +0100 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2015-11-16 09:23:47 +0100 |
commit | 9a4cc897fd8459b1cc04d90ca19e36aff38ba506 (patch) | |
tree | 1e2f1f7cb900870bfe088895a0051519423c4aff /drivers/reset/sti | |
parent | reset: sti: Add support for resetting co-processors (diff) | |
download | linux-9a4cc897fd8459b1cc04d90ca19e36aff38ba506.tar.xz linux-9a4cc897fd8459b1cc04d90ca19e36aff38ba506.zip |
reset: sti: Provide ops .status() call-back
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/reset/sti')
-rw-r--r-- | drivers/reset/sti/reset-syscfg.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c index a145cc066d4a..a78e09c7825e 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, |