[PATCH v6 4/5] reset: starfive: Introduce active_low

Changhuang Liang changhuang.liang at starfivetech.com
Sat Oct 10 03:58:58 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-jh71x0.c | 3 ++-
 drivers/reset/starfive/reset-starfive-jh71x0.h | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/reset/starfive/reset-starfive-jh71x0.c b/drivers/reset/starfive/reset-starfive-jh71x0.c
index fd1c755a0017..f48959b66f7c 100644
--- a/drivers/reset/starfive/reset-starfive-jh71x0.c
+++ b/drivers/reset/starfive/reset-starfive-jh71x0.c
@@ -52,6 +52,7 @@ static int jh71x0_reset_update(struct reset_controller_dev *rcdev,
 			       unsigned long id, bool assert)
 {
 	struct jh71x0_reset *data = jh71x0_reset_from(rcdev);
+	bool active_low = data->info && data->info->active_low;
 	unsigned long offset, flags;
 	void __iomem *reg_assert;
 	void __iomem *reg_status;
@@ -76,7 +77,7 @@ static int jh71x0_reset_update(struct reset_controller_dev *rcdev,
 	spin_lock_irqsave(&data->lock, flags);
 
 	value = readl(reg_assert);
-	if (assert)
+	if (assert != active_low)
 		value |= mask;
 	else
 		value &= ~mask;
diff --git a/drivers/reset/starfive/reset-starfive-jh71x0.h b/drivers/reset/starfive/reset-starfive-jh71x0.h
index 36f198139602..7a967eeb3181 100644
--- a/drivers/reset/starfive/reset-starfive-jh71x0.h
+++ b/drivers/reset/starfive/reset-starfive-jh71x0.h
@@ -15,6 +15,12 @@ struct jh71x0_reset_info {
 	unsigned int nr_resets;
 	unsigned int assert_offset;
 	unsigned int status_offset;
+
+	/*
+	 * If true, the reset is asserted by clearing the bit and deasserted
+	 * by setting it. If false, it is the other way around.
+	 */
+	bool active_low;
 	bool discontiguous;
 	const struct jh71x0_reset_map *map;
 };
-- 
2.25.1




More information about the linux-riscv mailing list