* [PATCH v2] pinctrl: renesas: r906g032: handle pin subgroups
@ 2026-08-14 18:26 Ralph Siemsen
2026-08-14 22:00 ` Marek Vasut via U-Boot
0 siblings, 1 reply; 4+ messages in thread
From: Ralph Siemsen @ 2026-08-14 18:26 UTC (permalink / raw)
To: Marek Vasut, u-boot; +Cc: Nobuhiro Iwamatsu, Tom Rini, Ralph Siemsen
Add simple recursion support to the .set_state method. This makes it
possible to use subgroups in the device tree, which in turn allows
setting multiple pins with different bias/drive-strength properties.
Fixes: e4aea57fa773 ("pinctrl: renesas: add R906G032 driver")
Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
---
Changes in v2:
- split out of the series "Renesas RZ/N1 additional drivers"
https://lore.kernel.org/u-boot/20260731-rzn1-2026-07-v1-1-af2ce80db9d8@linaro.org/
- fix typos in commit message
- use device_foreach_child() to iterate child nodes
- move recursion to top of function, ahead of the early return in the
case of no direct pinmux entries, instead of removing early return.
- dev_err() in case of failure during recursion
---
drivers/pinctrl/renesas/pinctrl-rzn1.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/pinctrl/renesas/pinctrl-rzn1.c
index fdc43c8e714..6c8d40e9639 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzn1.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c
@@ -298,11 +298,24 @@ static int rzn1_pinconf_set(struct rzn1_pinctrl_priv *priv, unsigned int pin,
static int rzn1_pinctrl_set_state(struct udevice *dev, struct udevice *config)
{
struct rzn1_pinctrl_priv *priv = dev_get_priv(dev);
+ struct udevice *child;
int size;
int ret;
u32 val;
u32 bias;
+ /*
+ * Handle subnodes recursively, so that pin groups work.
+ * Note that properties are *NOT* inherited from parent.
+ */
+ device_foreach_child(child, config) {
+ ret = rzn1_pinctrl_set_state(dev, child);
+ if (ret) {
+ dev_err(dev, "failed node '%s'\n", child->name);
+ return ret;
+ }
+ }
+
/* Pullup/down bias, common to all pins in group */
bias = PIN_CONFIG_BIAS_PULL_UP;
if (dev_read_bool(config, "bias-disable"))
---
base-commit: 36c377b9859ffb53eb1e39ea31e8d96d1e0fe1e5
change-id: 20260810-rzn1-2026-10-pinctrl-cf97d3baf307
Best regards,
--
Ralph Siemsen <ralph.siemsen@linaro.org>
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] pinctrl: renesas: r906g032: handle pin subgroups
2026-08-14 18:26 [PATCH v2] pinctrl: renesas: r906g032: handle pin subgroups Ralph Siemsen
@ 2026-08-14 22:00 ` Marek Vasut via U-Boot
2026-08-15 13:53 ` Ralph Siemsen
0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut via U-Boot @ 2026-08-14 22:00 UTC (permalink / raw)
To: Ralph Siemsen, u-boot; +Cc: Nobuhiro Iwamatsu, Tom Rini
On 8/14/26 8:26 PM, Ralph Siemsen wrote:
> Add simple recursion support to the .set_state method. This makes it
> possible to use subgroups in the device tree, which in turn allows
> setting multiple pins with different bias/drive-strength properties.
>
> Fixes: e4aea57fa773 ("pinctrl: renesas: add R906G032 driver")
> Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
> ---
> Changes in v2:
> - split out of the series "Renesas RZ/N1 additional drivers"
> https://lore.kernel.org/u-boot/20260731-rzn1-2026-07-v1-1-af2ce80db9d8@linaro.org/
> - fix typos in commit message
> - use device_foreach_child() to iterate child nodes
> - move recursion to top of function, ahead of the early return in the
> case of no direct pinmux entries, instead of removing early return.
> - dev_err() in case of failure during recursion
> ---
> drivers/pinctrl/renesas/pinctrl-rzn1.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/pinctrl/renesas/pinctrl-rzn1.c
> index fdc43c8e714..6c8d40e9639 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rzn1.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c
> @@ -298,11 +298,24 @@ static int rzn1_pinconf_set(struct rzn1_pinctrl_priv *priv, unsigned int pin,
> static int rzn1_pinctrl_set_state(struct udevice *dev, struct udevice *config)
> {
> struct rzn1_pinctrl_priv *priv = dev_get_priv(dev);
> + struct udevice *child;
> int size;
> int ret;
> u32 val;
> u32 bias;
>
> + /*
> + * Handle subnodes recursively, so that pin groups work.
> + * Note that properties are *NOT* inherited from parent.
> + */
> + device_foreach_child(child, config) {
> + ret = rzn1_pinctrl_set_state(dev, child);
Can there really be infinite nested subgroups , or are there always only
groups with subgroups and that is where it ends ? Linux
Documentation/devicetree/bindings/pinctrl/renesas,rzn1-pinctrl.yaml
makes it look like the later, so maybe the recursion is not necessary
here, instead call device_foreach_child() { device_foreach_child() { ..
} } to prevent the possibility of infinite recursion ?
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] pinctrl: renesas: r906g032: handle pin subgroups
2026-08-14 22:00 ` Marek Vasut via U-Boot
@ 2026-08-15 13:53 ` Ralph Siemsen
2026-08-16 12:07 ` Marek Vasut via U-Boot
0 siblings, 1 reply; 4+ messages in thread
From: Ralph Siemsen @ 2026-08-15 13:53 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Nobuhiro Iwamatsu, Tom Rini
On Sat, Aug 15, 2026 at 12:00:23AM +0200, Marek Vasut wrote:
>>diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c
>>b/drivers/pinctrl/renesas/pinctrl-rzn1.c
>>index fdc43c8e714..6c8d40e9639 100644
>>--- a/drivers/pinctrl/renesas/pinctrl-rzn1.c
>>+++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c
>>@@ -298,11 +298,24 @@ static int rzn1_pinconf_set(struct rzn1_pinctrl_priv *priv, unsigned int pin,
>> static int rzn1_pinctrl_set_state(struct udevice *dev, struct udevice *config)
>> {
>> struct rzn1_pinctrl_priv *priv = dev_get_priv(dev);
>>+ struct udevice *child;
>> int size;
>> int ret;
>> u32 val;
>> u32 bias;
>>+ /*
>>+ * Handle subnodes recursively, so that pin groups work.
>>+ * Note that properties are *NOT* inherited from parent.
>>+ */
>>+ device_foreach_child(child, config) {
>>+ ret = rzn1_pinctrl_set_state(dev, child);
>Can there really be infinite nested subgroups , or are there always
>only groups with subgroups and that is where it ends ? Linux
>Documentation/devicetree/bindings/pinctrl/renesas,rzn1-pinctrl.yaml
>makes it look like the later, so maybe the recursion is not necessary
>here, instead call device_foreach_child() { device_foreach_child() { ..
>} } to prevent the possibility of infinite recursion ?
Realistically there will only be groups with one level of subgroups.
Perhaps if there was a phandle it could go a few levels deeper.
Unbounded recursion is not really possible here unless:
- the device tree is infinitely deep, or
- there is a very serious bug in device_foreach_child()
As these both seem unlikely, I opted for the simple recursive call, but
I am happy to change it if you feel it is better.
Ralph
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] pinctrl: renesas: r906g032: handle pin subgroups
2026-08-15 13:53 ` Ralph Siemsen
@ 2026-08-16 12:07 ` Marek Vasut via U-Boot
0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut via U-Boot @ 2026-08-16 12:07 UTC (permalink / raw)
To: Ralph Siemsen; +Cc: u-boot, Nobuhiro Iwamatsu, Tom Rini
On 8/15/26 3:53 PM, Ralph Siemsen wrote:
> On Sat, Aug 15, 2026 at 12:00:23AM +0200, Marek Vasut wrote:
>>> diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/
>>> pinctrl/renesas/pinctrl-rzn1.c
>>> index fdc43c8e714..6c8d40e9639 100644
>>> --- a/drivers/pinctrl/renesas/pinctrl-rzn1.c
>>> +++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c
>>> @@ -298,11 +298,24 @@ static int rzn1_pinconf_set(struct
>>> rzn1_pinctrl_priv *priv, unsigned int pin,
>>> static int rzn1_pinctrl_set_state(struct udevice *dev, struct
>>> udevice *config)
>>> {
>>> struct rzn1_pinctrl_priv *priv = dev_get_priv(dev);
>>> + struct udevice *child;
>>> int size;
>>> int ret;
>>> u32 val;
>>> u32 bias;
>>> + /*
>>> + * Handle subnodes recursively, so that pin groups work.
>>> + * Note that properties are *NOT* inherited from parent.
>>> + */
>>> + device_foreach_child(child, config) {
>>> + ret = rzn1_pinctrl_set_state(dev, child);
>
>> Can there really be infinite nested subgroups , or are there always
>> only groups with subgroups and that is where it ends ? Linux
>> Documentation/devicetree/bindings/pinctrl/renesas,rzn1-pinctrl.yaml
>> makes it look like the later, so maybe the recursion is not necessary
>> here, instead call device_foreach_child() { device_foreach_child()
>> { .. } } to prevent the possibility of infinite recursion ?
>
> Realistically there will only be groups with one level of subgroups.
> Perhaps if there was a phandle it could go a few levels deeper.
>
> Unbounded recursion is not really possible here unless:
> - the device tree is infinitely deep, or
> - there is a very serious bug in device_foreach_child()
>
> As these both seem unlikely, I opted for the simple recursive call, but
> I am happy to change it if you feel it is better.
Let's go with bounded one-level-deep parsing, that's what the bindings
describe too.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-16 23:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 18:26 [PATCH v2] pinctrl: renesas: r906g032: handle pin subgroups Ralph Siemsen
2026-08-14 22:00 ` Marek Vasut via U-Boot
2026-08-15 13:53 ` Ralph Siemsen
2026-08-16 12:07 ` Marek Vasut via U-Boot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox