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

Commit bfc374a

Browse files
bijudasgeertu
authored andcommitted
pinctrl: renesas: rzg2l: Handle non-unique subnode names
Currently, sd1 and sd0 have unique subnode names 'sd1_mux' and 'sd0_mux'. If we change these to non-unique subnode names such as 'mux' this can lead to the below conflict as the RZ/G2L pin control driver considers only the names of the subnodes. pinctrl-rzg2l 11030000.pinctrl: pin P47_0 already requested by 11c00000.mmc; cannot claim for 11c10000.mmc pinctrl-rzg2l 11030000.pinctrl: pin-376 (11c10000.mmc) status -22 pinctrl-rzg2l 11030000.pinctrl: could not request pin 376 (P47_0) from group mux on device pinctrl-rzg2l renesas_sdhi_internal_dmac 11c10000.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. Based on the work done by Geert for the RZ/V2M pinctrl driver. Fixes: c4c4637 ("pinctrl: renesas: Add RZ/G2L pin and gpio controller driver") Signed-off-by: Biju Das <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent f46a0b4 commit bfc374a

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

drivers/pinctrl/renesas/pinctrl-rzg2l.c

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

250250
static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,
251251
struct device_node *np,
252+
struct device_node *parent,
252253
struct pinctrl_map **map,
253254
unsigned int *num_maps,
254255
unsigned int *index)
@@ -266,6 +267,7 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,
266267
struct property *prop;
267268
int ret, gsel, fsel;
268269
const char **pin_fn;
270+
const char *name;
269271
const char *pin;
270272

271273
pinmux = of_find_property(np, "pinmux", NULL);
@@ -349,8 +351,19 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,
349351
psel_val[i] = MUX_FUNC(value);
350352
}
351353

354+
if (parent) {
355+
name = devm_kasprintf(pctrl->dev, GFP_KERNEL, "%pOFn.%pOFn",
356+
parent, np);
357+
if (!name) {
358+
ret = -ENOMEM;
359+
goto done;
360+
}
361+
} else {
362+
name = np->name;
363+
}
364+
352365
/* Register a single pin group listing all the pins we read from DT */
353-
gsel = pinctrl_generic_add_group(pctldev, np->name, pins, num_pinmux, NULL);
366+
gsel = pinctrl_generic_add_group(pctldev, name, pins, num_pinmux, NULL);
354367
if (gsel < 0) {
355368
ret = gsel;
356369
goto done;
@@ -360,17 +373,16 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,
360373
* Register a single group function where the 'data' is an array PSEL
361374
* register values read from DT.
362375
*/
363-
pin_fn[0] = np->name;
364-
fsel = pinmux_generic_add_function(pctldev, np->name, pin_fn, 1,
365-
psel_val);
376+
pin_fn[0] = name;
377+
fsel = pinmux_generic_add_function(pctldev, name, pin_fn, 1, psel_val);
366378
if (fsel < 0) {
367379
ret = fsel;
368380
goto remove_group;
369381
}
370382

371383
maps[idx].type = PIN_MAP_TYPE_MUX_GROUP;
372-
maps[idx].data.mux.group = np->name;
373-
maps[idx].data.mux.function = np->name;
384+
maps[idx].data.mux.group = name;
385+
maps[idx].data.mux.function = name;
374386
idx++;
375387

376388
dev_dbg(pctrl->dev, "Parsed %pOF with %d pins\n", np, num_pinmux);
@@ -417,7 +429,7 @@ static int rzg2l_dt_node_to_map(struct pinctrl_dev *pctldev,
417429
index = 0;
418430

419431
for_each_child_of_node(np, child) {
420-
ret = rzg2l_dt_subnode_to_map(pctldev, child, map,
432+
ret = rzg2l_dt_subnode_to_map(pctldev, child, np, map,
421433
num_maps, &index);
422434
if (ret < 0) {
423435
of_node_put(child);
@@ -426,7 +438,7 @@ static int rzg2l_dt_node_to_map(struct pinctrl_dev *pctldev,
426438
}
427439

428440
if (*num_maps == 0) {
429-
ret = rzg2l_dt_subnode_to_map(pctldev, np, map,
441+
ret = rzg2l_dt_subnode_to_map(pctldev, np, NULL, map,
430442
num_maps, &index);
431443
if (ret < 0)
432444
goto done;

0 commit comments

Comments
 (0)