[PATCH v3 5/8] reset: starfive: Introduce active_low
Changhuang Liang
changhuang.liang at starfivetech.com
Wed May 20 18:29:29 PDT 2026
The JHB100 SoC supports inverted operations for reset
assertion/deassertion, introducing an active_low field to distinguish
between different operation logics.
Signed-off-by: Changhuang Liang <changhuang.liang at starfivetech.com>
---
drivers/reset/starfive/reset-starfive-common.c | 5 ++++-
drivers/reset/starfive/reset-starfive-common.h | 6 ++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/reset/starfive/reset-starfive-common.c b/drivers/reset/starfive/reset-starfive-common.c
index 8ea142ecbd15..c9911aec8b35 100644
--- a/drivers/reset/starfive/reset-starfive-common.c
+++ b/drivers/reset/starfive/reset-starfive-common.c
@@ -59,6 +59,9 @@ static int starfive_reset_update(struct reset_controller_dev *rcdev,
u32 mask, done, value;
int ret;
+ if (data->info && data->info->active_low)
+ assert = !assert;
+
if (data->info && data->info->discontigous)
id = starfive_reset_id_to_hw_id(data->info->map, data->info->nr_resets, id);
@@ -68,7 +71,7 @@ static int starfive_reset_update(struct reset_controller_dev *rcdev,
reg_status = data->status + offset * sizeof(u32);
done = data->asserted ? data->asserted[offset] & mask : 0;
- if (!assert)
+ if (data->info && data->info->active_low == assert)
done ^= mask;
spin_lock_irqsave(&data->lock, flags);
diff --git a/drivers/reset/starfive/reset-starfive-common.h b/drivers/reset/starfive/reset-starfive-common.h
index ee457d9b90a3..a48c266e5e2e 100644
--- a/drivers/reset/starfive/reset-starfive-common.h
+++ b/drivers/reset/starfive/reset-starfive-common.h
@@ -15,6 +15,12 @@ struct starfive_reset_info {
unsigned int nr_resets;
unsigned int assert_offset;
unsigned int status_offset;
+
+ /* If active_low is false, setting the bit to 1 asserts
+ * the signal while clearing it to 0 deasserts it, and vice
+ * versa.
+ */
+ bool active_low;
bool discontigous;
struct starfive_reset_map *map;
};
--
2.25.1
More information about the linux-riscv
mailing list