[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240516150842.705844-6-jbrunet@baylibre.com>
Date: Thu, 16 May 2024 17:08:35 +0200
From: Jerome Brunet <jbrunet@...libre.com>
To: Philipp Zabel <p.zabel@...gutronix.de>,
Stephen Boyd <sboyd@...nel.org>,
Neil Armstrong <neil.armstrong@...aro.org>
Cc: Jerome Brunet <jbrunet@...libre.com>,
Jan Dakinevich <jan.dakinevich@...utedevices.com>,
linux-kernel@...r.kernel.org,
linux-amlogic@...ts.infradead.org,
linux-clk@...r.kernel.org
Subject: [RFC PATCH 5/9] reset: amlogic: add reset status support
Add the callback to check the status of the level reset, as done in
the reset driver of the audio clock controller.
Signed-off-by: Jerome Brunet <jbrunet@...libre.com>
---
drivers/reset/reset-meson.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c
index 3e0447366ba6..65ba9190cb53 100644
--- a/drivers/reset/reset-meson.c
+++ b/drivers/reset/reset-meson.c
@@ -69,6 +69,23 @@ static int meson_reset_level(struct reset_controller_dev *rcdev,
BIT(bit), assert ? BIT(bit) : 0);
}
+static int meson_reset_status(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ struct meson_reset *data =
+ container_of(rcdev, struct meson_reset, rcdev);
+ unsigned int val, offset, bit;
+
+ meson_reset_offset_and_bit(data, id, &offset, &bit);
+ offset += data->param->level_offset;
+
+ regmap_read(data->map, offset, &val);
+ val = !!(BIT(bit) & val);
+
+
+ return val ^ data->param->level_low_reset;
+}
+
static int meson_reset_assert(struct reset_controller_dev *rcdev,
unsigned long id)
{
@@ -85,6 +102,7 @@ static const struct reset_control_ops meson_reset_ops = {
.reset = meson_reset_reset,
.assert = meson_reset_assert,
.deassert = meson_reset_deassert,
+ .status = meson_reset_status,
};
static int meson_reset_probe(struct device *dev, struct regmap *map,
--
2.43.0
Powered by blists - more mailing lists