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

Commit 04e601f

Browse files
committed
Merge tag 'renesas-pinctrl-fixes-for-v6.5-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into fixes
pinctrl: renesas: Fixes for v6.5 - Fix handling of non-unique pin control configuration subnode names on the RZ/V2M and RZ/G2L SoC families. Signed-off-by: Linus Walleij <[email protected]>
2 parents 283c5ce + bfc374a commit 04e601f

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
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;

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)