From 51fc57a50c19674b86510ceffd4c2d18a8cc0817 Mon Sep 17 00:00:00 2001 From: kettenis Date: Tue, 23 Aug 2016 21:30:18 +0000 Subject: [PATCH] Add functions to assert/deassert all reset signals for a device. --- sys/dev/ofw/ofw_clock.c | 14 +++++++++++++- sys/dev/ofw/ofw_clock.h | 16 +++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/sys/dev/ofw/ofw_clock.c b/sys/dev/ofw/ofw_clock.c index 34ed1342609..ad81356e115 100644 --- a/sys/dev/ofw/ofw_clock.c +++ b/sys/dev/ofw/ofw_clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofw_clock.c,v 1.5 2016/08/22 22:06:59 kettenis Exp $ */ +/* $OpenBSD: ofw_clock.c,v 1.6 2016/08/23 21:30:18 kettenis Exp $ */ /* * Copyright (c) 2016 Mark Kettenis * @@ -415,12 +415,24 @@ reset_do_assert(int node, const char *name, int assert) reset_do_assert_idx(node, idx, assert); } +void +reset_assert_idx(int node, int idx) +{ + reset_do_assert_idx(node, idx, 1); +} + void reset_assert(int node, const char *name) { reset_do_assert(node, name, 1); } +void +reset_deassert_idx(int node, int idx) +{ + reset_do_assert_idx(node, idx, 0); +} + void reset_deassert(int node, const char *name) { diff --git a/sys/dev/ofw/ofw_clock.h b/sys/dev/ofw/ofw_clock.h index 3e56a8ceefb..10848422096 100644 --- a/sys/dev/ofw/ofw_clock.h +++ b/sys/dev/ofw/ofw_clock.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ofw_clock.h,v 1.4 2016/08/22 19:28:27 kettenis Exp $ */ +/* $OpenBSD: ofw_clock.h,v 1.5 2016/08/23 21:30:18 kettenis Exp $ */ /* * Copyright (c) 2016 Mark Kettenis * @@ -65,6 +65,20 @@ struct reset_device { void reset_register(struct reset_device *); void reset_assert(int, const char *); +void reset_assert_idx(int, int); void reset_deassert(int, const char *); +void reset_deassert_idx(int, int); + +static inline void +reset_assert_all(int node) +{ + reset_assert_idx(node, -1); +} + +static inline void +reset_deassert_all(int node) +{ + reset_deassert_idx(node, -1); +} #endif /* _DEV_OFW_CLOCK_H_ */ -- 2.20.1