Re: [PATCH v4 5/8] reset: starfive: Introduce active_low

Conor Dooley <[email protected]>
Newsgroups org.kernel.vger.linux-clk,org.infradead.lists.linux-riscv,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <20260810-overhead-seventy-cdab37ccb66d@spud>
On Sat, Aug 08, 2026 at 06:50:51PM -0700, Changhuang Liang wrote:
> 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 <[email protected]>

Can you please get Hal to review this and the other reset patch?

Thanks,
Conor.

> ---
>  drivers/reset/starfive/reset-starfive-common.c | 6 +++++-
>  drivers/reset/starfive/reset-starfive-common.h | 6 ++++++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/reset/starfive/reset-starfive-common.c b/drivers/reset/starfive/reset-starfive-common.c
> index 86dbb33bb216..7723520637ca 100644
> --- a/drivers/reset/starfive/reset-starfive-common.c
> +++ b/drivers/reset/starfive/reset-starfive-common.c
> @@ -52,12 +52,16 @@ static int starfive_reset_update(struct reset_controller_dev *rcdev,
>  				 unsigned long id, bool assert)
>  {
>  	struct starfive_reset *data = starfive_reset_from(rcdev);
> +	bool active_low = data->info && data->info->active_low;
>  	unsigned long offset, flags;
>  	void __iomem *reg_assert;
>  	void __iomem *reg_status;
>  	u32 mask, done, value;
>  	int ret;
>  
> +	if (active_low)
> +		assert = !assert;
> +
>  	if (data->info && data->info->discontiguous) {
>  		id = starfive_reset_id_to_hw_id(data->info->map, data->info->nr_resets, id);
>  		if (id == STARFIVE_RESET_ID_INVALID)
> @@ -70,7 +74,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 (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 0d4e634de58e..c7f80e744700 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 discontiguous;
>  	const struct starfive_reset_map *map;
>  };
> -- 
> 2.25.1
>
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCann6qwAKCRB4tDGHoIJi
0mrFAQCe6LL/fNbn7QcGbEMfuYIdu5/9Lnk4y7bNCihQwEi53QEAtJ3dYCnVEcBf
Y2xL1pYCAab8CXAAayqFSqes8TJLFQQ=
=v9a5
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.