Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit f46a0b4

Browse files
committed
pinctrl: renesas: rzv2m: Handle non-unique subnode names
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 8500000.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 <[email protected]> Fixes: 92a9b82 ("pinctrl: renesas: Add RZ/V2M pin and gpio controller driver") Signed-off-by: Geert Uytterhoeven <[email protected]> Tested-by: Fabrizio Castro <[email protected]> Link: https://lore.kernel.org/r/607bd6ab4905b0b1b119a06ef953fa1184505777.1688396717.git.geert+renesas@glider.be
1 parent 06c2afb commit f46a0b4

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

drivers/pinctrl/renesas/pinctrl-rzv2m.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ static int rzv2m_map_add_config(struct pinctrl_map *map,
209209

210210
static int rzv2m_dt_subnode_to_map(struct pinctrl_dev *pctldev,
211211
struct device_node *np,
212+
struct device_node *parent,
212213
struct pinctrl_map **map,
213214
unsigned int *num_maps,
214215
unsigned int *index)
@@ -226,6 +227,7 @@ static int rzv2m_dt_subnode_to_map(struct pinctrl_dev *pctldev,
226227
struct property *prop;
227228
int ret, gsel, fsel;
228229
const char **pin_fn;
230+
const char *name;
229231
const char *pin;
230232

231233
pinmux = of_find_property(np, "pinmux", NULL);
@@ -309,8 +311,19 @@ static int rzv2m_dt_subnode_to_map(struct pinctrl_dev *pctldev,
309311
psel_val[i] = MUX_FUNC(value);
310312
}
311313

314+
if (parent) {
315+
name = devm_kasprintf(pctrl->dev, GFP_KERNEL, "%pOFn.%pOFn",
316+
parent, np);
317+
if (!name) {
318+
ret = -ENOMEM;
319+
goto done;
320+
}
321+
} else {
322+
name = np->name;
323+
}
324+
312325
/* Register a single pin group listing all the pins we read from DT */
313-
gsel = pinctrl_generic_add_group(pctldev, np->name, pins, num_pinmux, NULL);
326+
gsel = pinctrl_generic_add_group(pctldev, name, pins, num_pinmux, NULL);
314327
if (gsel < 0) {
315328
ret = gsel;
316329
goto done;
@@ -320,17 +333,16 @@ static int rzv2m_dt_subnode_to_map(struct pinctrl_dev *pctldev,
320333
* Register a single group function where the 'data' is an array PSEL
321334
* register values read from DT.
322335
*/
323-
pin_fn[0] = np->name;
324-
fsel = pinmux_generic_add_function(pctldev, np->name, pin_fn, 1,
325-
psel_val);
336+
pin_fn[0] = name;
337+
fsel = pinmux_generic_add_function(pctldev, name, pin_fn, 1, psel_val);
326338
if (fsel < 0) {
327339
ret = fsel;
328340
goto remove_group;
329341
}
330342

331343
maps[idx].type = PIN_MAP_TYPE_MUX_GROUP;
332-
maps[idx].data.mux.group = np->name;
333-
maps[idx].data.mux.function = np->name;
344+
maps[idx].data.mux.group = name;
345+
maps[idx].data.mux.function = name;
334346
idx++;
335347

336348
dev_dbg(pctrl->dev, "Parsed %pOF with %d pins\n", np, num_pinmux);
@@ -377,7 +389,7 @@ static int rzv2m_dt_node_to_map(struct pinctrl_dev *pctldev,
377389
index = 0;
378390

379391
for_each_child_of_node(np, child) {
380-
ret = rzv2m_dt_subnode_to_map(pctldev, child, map,
392+
ret = rzv2m_dt_subnode_to_map(pctldev, child, np, map,
381393
num_maps, &index);
382394
if (ret < 0) {
383395
of_node_put(child);
@@ -386,7 +398,7 @@ static int rzv2m_dt_node_to_map(struct pinctrl_dev *pctldev,
386398
}
387399

388400
if (*num_maps == 0) {
389-
ret = rzv2m_dt_subnode_to_map(pctldev, np, map,
401+
ret = rzv2m_dt_subnode_to_map(pctldev, np, NULL, map,
390402
num_maps, &index);
391403
if (ret < 0)
392404
goto done;

0 commit comments

Comments
 (0)