RE: [PATCH 1/3] soc: renesas: rz-sysc: Register auxiliary device for PWRRDY power sequencer
Biju Das <[email protected]> Mon, 27 Jul 2026 10:41:35 +0000
| Newsgroups | org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <TY3PR01MB11346AC79033CC33D30245B4F86CC2@TY3PR01MB11346.jpnprd01.prod.outlook.com> |
Hi Philipp Zabel, Thanks for the feedback. > -----Original Message----- > From: Philipp Zabel <[email protected]> > Sent: 27 July 2026 08:58 > Subject: Re: [PATCH 1/3] soc: renesas: rz-sysc: Register auxiliary device for PWRRDY power sequencer > > On Sa, 2026-07-25 at 13:34 +0100, Biju wrote: > > 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, with automatic > > teardown via devm_add_action_or_reset(). > > > > Signed-off-by: Biju Das <[email protected]> > > --- > > drivers/soc/renesas/r9a08g046-sysc.c | 1 + > > drivers/soc/renesas/rz-sysc.c | 40 ++++++++++++++++++++++++++++ > > drivers/soc/renesas/rz-sysc.h | 2 ++ > > 3 files changed, 43 insertions(+) > > > > 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..ea49ca51e740 > > 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,41 @@ static int rz_sysc_soc_init(struct rz_sysc *sysc, const struct of_device_id *mat > > return 0; > > } > > > > +static void rz_sysc_pwrrdy_pwrseq_unregister_adev(void *adev) { > > + auxiliary_device_delete(adev); > > + auxiliary_device_uninit(adev); > > +} > > + > > +static int rz_sysc_pwrrdy_pwrseq_init(struct device *dev, 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; > > + int ret; > > + > > + if (!soc_data->pwrrdy_pwrseq) > > + return 0; > > + > > + adev = devm_kzalloc(dev, sizeof(*adev), GFP_KERNEL); > > The lifetime of this allocation should be tied to adev->dev, not its parent. Can't you just use > devm_auxiliary_device_create() though? Agreed. Will switch to devm_auxiliary_device_create(). Cheers, Biju