* [PATCH 5.10.y-cip] pinctrl: renesas: rzv2m: Handle non-unique subnode names
@ 2023-07-18 16:16 Fabrizio Castro
2023-07-20 10:05 ` nobuhiro1.iwamatsu
0 siblings, 1 reply; 3+ messages in thread
From: Fabrizio Castro @ 2023-07-18 16:16 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, Fabrizio Castro
From: Geert Uytterhoeven <geert+renesas@glider.be>
Commit f46a0b47cc0829acd050213194c5a77351e619b2 upstream.
The eMMC and SDHI pin control configuration nodes in DT have subnodes
with the same names ("data" and "ctrl"). As the RZ/V2M pin control
driver considers only the names of the subnodes, this leads to
conflicts:
pinctrl-rzv2m b6250000.pinctrl: pin P8_2 already requested by 85000000.mmc; cannot claim for 85020000.mmc
pinctrl-rzv2m b6250000.pinctrl: pin-130 (85020000.mmc) status -22
renesas_sdhi_internal_dmac 85020000.mmc: Error applying setting, reverse things back
Fix this by constructing unique names from the node names of both the
pin control configuration node and its child node, where appropriate.
Reported by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Fixes: 92a9b825257614af ("pinctrl: renesas: Add RZ/V2M pin and gpio controller driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Link: https://lore.kernel.org/r/607bd6ab4905b0b1b119a06ef953fa1184505777.1688396717.git.geert+renesas@glider.be
Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
---
drivers/pinctrl/renesas/pinctrl-rzv2m.c | 28 ++++++++++++++++++-------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzv2m.c b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
index e8c18198bebd..35f382b055e8 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzv2m.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
@@ -207,6 +207,7 @@ static int rzv2m_map_add_config(struct pinctrl_map *map,
static int rzv2m_dt_subnode_to_map(struct pinctrl_dev *pctldev,
struct device_node *np,
+ struct device_node *parent,
struct pinctrl_map **map,
unsigned int *num_maps,
unsigned int *index)
@@ -224,6 +225,7 @@ static int rzv2m_dt_subnode_to_map(struct pinctrl_dev *pctldev,
struct property *prop;
int ret, gsel, fsel;
const char **pin_fn;
+ const char *name;
const char *pin;
pinmux = of_find_property(np, "pinmux", NULL);
@@ -307,8 +309,19 @@ static int rzv2m_dt_subnode_to_map(struct pinctrl_dev *pctldev,
psel_val[i] = MUX_FUNC(value);
}
+ if (parent) {
+ name = devm_kasprintf(pctrl->dev, GFP_KERNEL, "%pOFn.%pOFn",
+ parent, np);
+ if (!name) {
+ ret = -ENOMEM;
+ goto done;
+ }
+ } else {
+ name = np->name;
+ }
+
/* Register a single pin group listing all the pins we read from DT */
- gsel = pinctrl_generic_add_group(pctldev, np->name, pins, num_pinmux, NULL);
+ gsel = pinctrl_generic_add_group(pctldev, name, pins, num_pinmux, NULL);
if (gsel < 0) {
ret = gsel;
goto done;
@@ -318,17 +331,16 @@ static int rzv2m_dt_subnode_to_map(struct pinctrl_dev *pctldev,
* Register a single group function where the 'data' is an array PSEL
* register values read from DT.
*/
- pin_fn[0] = np->name;
- fsel = pinmux_generic_add_function(pctldev, np->name, pin_fn, 1,
- psel_val);
+ pin_fn[0] = name;
+ fsel = pinmux_generic_add_function(pctldev, name, pin_fn, 1, psel_val);
if (fsel < 0) {
ret = fsel;
goto remove_group;
}
maps[idx].type = PIN_MAP_TYPE_MUX_GROUP;
- maps[idx].data.mux.group = np->name;
- maps[idx].data.mux.function = np->name;
+ maps[idx].data.mux.group = name;
+ maps[idx].data.mux.function = name;
idx++;
dev_dbg(pctrl->dev, "Parsed %pOF with %d pins\n", np, num_pinmux);
@@ -375,7 +387,7 @@ static int rzv2m_dt_node_to_map(struct pinctrl_dev *pctldev,
index = 0;
for_each_child_of_node(np, child) {
- ret = rzv2m_dt_subnode_to_map(pctldev, child, map,
+ ret = rzv2m_dt_subnode_to_map(pctldev, child, np, map,
num_maps, &index);
if (ret < 0) {
of_node_put(child);
@@ -384,7 +396,7 @@ static int rzv2m_dt_node_to_map(struct pinctrl_dev *pctldev,
}
if (*num_maps == 0) {
- ret = rzv2m_dt_subnode_to_map(pctldev, np, map,
+ ret = rzv2m_dt_subnode_to_map(pctldev, np, NULL, map,
num_maps, &index);
if (ret < 0)
goto done;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [PATCH 5.10.y-cip] pinctrl: renesas: rzv2m: Handle non-unique subnode names
2023-07-18 16:16 [PATCH 5.10.y-cip] pinctrl: renesas: rzv2m: Handle non-unique subnode names Fabrizio Castro
@ 2023-07-20 10:05 ` nobuhiro1.iwamatsu
2023-07-20 18:27 ` Pavel Machek
0 siblings, 1 reply; 3+ messages in thread
From: nobuhiro1.iwamatsu @ 2023-07-20 10:05 UTC (permalink / raw)
To: fabrizio.castro.jz, cip-dev, pavel; +Cc: biju.das, prabhakar.mahadev-lad.rj
HI all,
> -----Original Message-----
> From: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> Sent: Wednesday, July 19, 2023 1:17 AM
> To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 ○DITC□
> DIT○OST) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>
> Cc: Biju Das <biju.das@bp.renesas.com>; Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com>; Fabrizio Castro
> <fabrizio.castro.jz@renesas.com>
> Subject: [PATCH 5.10.y-cip] pinctrl: renesas: rzv2m: Handle non-unique
> subnode names
>
> From: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Commit f46a0b47cc0829acd050213194c5a77351e619b2 upstream.
>
> The eMMC and SDHI pin control configuration nodes in DT have subnodes
> with the same names ("data" and "ctrl"). As the RZ/V2M pin control driver
> considers only the names of the subnodes, this leads to
> conflicts:
>
> pinctrl-rzv2m b6250000.pinctrl: pin P8_2 already requested by
> 85000000.mmc; cannot claim for 85020000.mmc
> pinctrl-rzv2m b6250000.pinctrl: pin-130 (85020000.mmc) status -22
> renesas_sdhi_internal_dmac 85020000.mmc: Error applying setting,
> reverse things back
>
> Fix this by constructing unique names from the node names of both the pin
> control configuration node and its child node, where appropriate.
>
> Reported by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
>
> Fixes: 92a9b825257614af ("pinctrl: renesas: Add RZ/V2M pin and gpio
> controller driver")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Tested-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> Link:
> https://lore.kernel.org/r/607bd6ab4905b0b1b119a06ef953fa1184505777.1688
> 396717.git.geert+renesas@glider.be
> Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Looks good to me. I can apply if there are no comments.
Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Best regards,
Nobuhiro
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 5.10.y-cip] pinctrl: renesas: rzv2m: Handle non-unique subnode names
2023-07-20 10:05 ` nobuhiro1.iwamatsu
@ 2023-07-20 18:27 ` Pavel Machek
0 siblings, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2023-07-20 18:27 UTC (permalink / raw)
To: nobuhiro1.iwamatsu
Cc: fabrizio.castro.jz, cip-dev, pavel, biju.das,
prabhakar.mahadev-lad.rj
[-- Attachment #1: Type: text/plain, Size: 921 bytes --]
Hi!
> > Reported by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> >
> > Fixes: 92a9b825257614af ("pinctrl: renesas: Add RZ/V2M pin and gpio
> > controller driver")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > Tested-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> > Link:
> > https://lore.kernel.org/r/607bd6ab4905b0b1b119a06ef953fa1184505777.1688
> > 396717.git.geert+renesas@glider.be
> > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
>
> Looks good to me. I can apply if there are no comments.
> Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Thank you, it looks okay to me, too, and passed testing, so I applied
it with your Reviewed-by: tag.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-20 18:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-18 16:16 [PATCH 5.10.y-cip] pinctrl: renesas: rzv2m: Handle non-unique subnode names Fabrizio Castro
2023-07-20 10:05 ` nobuhiro1.iwamatsu
2023-07-20 18:27 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox