Re: [PATCH v3 1/3] soc: renesas: rz-sysc: Register auxiliary device for PWRRDY power sequencer

Bartosz Golaszewski <[email protected]>
Newsgroups org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-kernel
Message-ID <CAMRc=MeSC2KTdFSX7dNJN_1zUH9+N3A3ctHgHuweW=e7yAV-JA@mail.gmail.com>
On Wed, 12 Aug 2026 13:50:03 +0200, Biju <[email protected]> said:
> From: Biju Das <[email protected]>
>
> Some RZ SoCs (e.g. RZ/G3L) have a PWRRDY register that is controlled
> through a power sequencer rather than directly by the SYSC driver.
>
> Add a pwrrdy_pwrseq flag to struct rz_sysc_soc_id_init_data to mark
> SoCs with this property, and set it for RZ/G3L. When set,
> rz_sysc_probe() registers a "pwrseq-pwrrdy" auxiliary device so a
> dedicated driver can handle the PWRRDY sequencing.
>
> Signed-off-by: Biju Das <[email protected]>
> ---
> v2->v3:
>  * Updated commit description by dropping devm_add_action_or_reset().
>  * Config now selects AUXILIARY_BUS to avoid compilation issues.
>  * Dropped the cast in devm_auxiliary_device_create().
> v1->v2:
>  * Switched to devm_auxiliary_device_create().
>  * Added regmap parameter to rz_sysc_pwrrdy_pwrseq_init(),so that regmap
>    can be passed as platform data.
> ---
>  drivers/soc/renesas/Kconfig          |  1 +
>  drivers/soc/renesas/r9a08g046-sysc.c |  1 +
>  drivers/soc/renesas/rz-sysc.c        | 21 +++++++++++++++++++++
>  drivers/soc/renesas/rz-sysc.h        |  2 ++
>  4 files changed, 25 insertions(+)
>
> diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig
> index fdf18ed2dfc2..ab1c25fc2656 100644
> --- a/drivers/soc/renesas/Kconfig
> +++ b/drivers/soc/renesas/Kconfig
> @@ -485,6 +485,7 @@ config RZN1_IRQMUX
>  config SYSC_RZ
>  	bool "System controller for RZ SoCs" if COMPILE_TEST
>  	select MFD_SYSCON
> +	select AUXILIARY_BUS
>
>  config SYSC_R9A08G045
>  	bool "Renesas System controller support for R9A08G045 (RZ/G3S)" if COMPILE_TEST
> diff --git a/drivers/soc/renesas/r9a08g046-sysc.c b/drivers/soc/renesas/r9a08g046-sysc.c
> index 90db9d383539..cd129c727461 100644
> --- a/drivers/soc/renesas/r9a08g046-sysc.c
> +++ b/drivers/soc/renesas/r9a08g046-sysc.c
> @@ -76,6 +76,7 @@ static const struct rz_sysc_soc_id_init_data rzg3l_sysc_soc_id_init_data __initc
>  	.devid_offset = 0xa04,
>  	.revision_mask = GENMASK(31, 28),
>  	.specific_id_mask = GENMASK(27, 0),
> +	.pwrrdy_pwrseq = true,
>  };
>
>  const struct rz_sysc_init_data rzg3l_sysc_init_data __initconst = {
> diff --git a/drivers/soc/renesas/rz-sysc.c b/drivers/soc/renesas/rz-sysc.c
> index 161e8c38eea6..79c6af934721 100644
> --- a/drivers/soc/renesas/rz-sysc.c
> +++ b/drivers/soc/renesas/rz-sysc.c
> @@ -5,6 +5,7 @@
>   * Copyright (C) 2024 Renesas Electronics Corp.
>   */
>
> +#include <linux/auxiliary_bus.h>
>  #include <linux/bitfield.h>
>  #include <linux/cleanup.h>
>  #include <linux/io.h>
> @@ -84,6 +85,22 @@ static int rz_sysc_soc_init(struct rz_sysc *sysc, const struct of_device_id *mat
>  	return 0;
>  }
>
> +static int rz_sysc_pwrrdy_pwrseq_init(struct device *dev, struct regmap *regmap,
> +				      const struct rz_sysc_init_data *data)
> +{
> +	const struct rz_sysc_soc_id_init_data *soc_data = data->soc_id_init_data;
> +	struct auxiliary_device *adev;
> +
> +	if (!soc_data->pwrrdy_pwrseq)
> +		return 0;
> +
> +	adev = devm_auxiliary_device_create(dev, "pwrseq-pwrrdy", regmap);
> +	if (!adev)
> +		return -ENODEV;
> +
> +	return 0;
> +}
> +
>  static const struct of_device_id rz_sysc_match[] = {
>  #ifdef CONFIG_SYSC_R9A08G045
>  	{ .compatible = "renesas,r9a08g045-sysc", .data = &rzg3s_sysc_init_data },
> @@ -149,6 +166,10 @@ static int rz_sysc_probe(struct platform_device *pdev)
>  	if (IS_ERR(regmap))
>  		return PTR_ERR(regmap);
>
> +	ret = rz_sysc_pwrrdy_pwrseq_init(dev, regmap, match->data);
> +	if (ret)
> +		return ret;

Honestly I don't think this is worth a separate function, could have as well
been:

	if (match->data->soc_data->pwrrdy_pwrseq) {
		adev = ...
	}

But I won't die on that hill.

Bart

> +
>  	return of_syscon_register_regmap(dev->of_node, regmap);
>  }
>
> diff --git a/drivers/soc/renesas/rz-sysc.h b/drivers/soc/renesas/rz-sysc.h
> index 921ee0d26c47..e55f3258d703 100644
> --- a/drivers/soc/renesas/rz-sysc.h
> +++ b/drivers/soc/renesas/rz-sysc.h
> @@ -20,6 +20,7 @@
>   * @revision_mask: SYSC SoC ID revision mask
>   * @specific_id_mask: SYSC SoC ID specific ID mask
>   * @print_id: print SoC-specific extended device identification
> + * @pwrrdy_pwrseq: has pwrrdy register controlled through power sequencer
>   */
>  struct rz_sysc_soc_id_init_data {
>  	const char * const family;
> @@ -29,6 +30,7 @@ struct rz_sysc_soc_id_init_data {
>  	u32 specific_id_mask;
>  	void (*print_id)(struct device *dev, void __iomem *sysc_base,
>  			 struct soc_device_attribute *soc_dev_attr);
> +	bool pwrrdy_pwrseq;
>  };
>
>  /**
> --
> 2.43.0
>
>
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.