summaryrefslogtreecommitdiff
path: root/drivers/reset/sandbox-reset.c
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2020-09-09 15:37:04 +0530
committerTom Rini <trini@konsulko.com>2020-09-30 11:55:22 -0400
commitbad2433151021315e04bcbb72c6c5bd2b938656b (patch)
tree25fc8a95b0446f808c9869997c60ad7ebe60bc69 /drivers/reset/sandbox-reset.c
parent139e4a1cbe60de96d4febbc6db5882929801ca46 (diff)
downloadu-boot-bad2433151021315e04bcbb72c6c5bd2b938656b.tar.gz
test: reset: Add tests for the managed API
The tests are basically the same as for the regular API. Except that the reset are initialized using the managed API, and no freed manually. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Diffstat (limited to 'drivers/reset/sandbox-reset.c')
-rw-r--r--drivers/reset/sandbox-reset.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/reset/sandbox-reset.c b/drivers/reset/sandbox-reset.c
index 7a6f7f676c..08008d875a 100644
--- a/drivers/reset/sandbox-reset.c
+++ b/drivers/reset/sandbox-reset.c
@@ -15,6 +15,7 @@
struct sandbox_reset_signal {
bool asserted;
+ bool requested;
};
struct sandbox_reset {
@@ -23,18 +24,24 @@ struct sandbox_reset {
static int sandbox_reset_request(struct reset_ctl *reset_ctl)
{
+ struct sandbox_reset *sbr = dev_get_priv(reset_ctl->dev);
+
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
if (reset_ctl->id >= SANDBOX_RESET_SIGNALS)
return -EINVAL;
+ sbr->signals[reset_ctl->id].requested = true;
return 0;
}
static int sandbox_reset_free(struct reset_ctl *reset_ctl)
{
+ struct sandbox_reset *sbr = dev_get_priv(reset_ctl->dev);
+
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
+ sbr->signals[reset_ctl->id].requested = false;
return 0;
}
@@ -107,3 +114,15 @@ int sandbox_reset_query(struct udevice *dev, unsigned long id)
return sbr->signals[id].asserted;
}
+
+int sandbox_reset_is_requested(struct udevice *dev, unsigned long id)
+{
+ struct sandbox_reset *sbr = dev_get_priv(dev);
+
+ debug("%s(dev=%p, id=%ld)\n", __func__, dev, id);
+
+ if (id >= SANDBOX_RESET_SIGNALS)
+ return -EINVAL;
+
+ return sbr->signals[id].requested;
+}