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

Commit 91d1be9

Browse files
committed
pinctrl: renesas: Fix pin control matching on R-Car H3e-2G
As R-Car H3 ES1.x (R8A77950) and R-Car ES2.0+ (R8A77951) use the same compatible value, the pin control driver relies on soc_device_match() with soc_id = "r8a7795" and the (non)matching of revision = "ES1.*" to match with and distinguish between the two SoC variants. The corresponding entries in the normal of_match_table are present only to make the optional sanity checks work. The R-Car H3e-2G (R8A779M1) SoC is a different grading of the R-Car H3 ES3.0 (R8A77951) SoC. It uses the same compatible values for individual devices, but has an additional compatible value for the root node. When running on an R-Car H3e-2G SoC, soc_device_match() with soc_id = "r8a7795" does not return a match. Hence the pin control driver falls back to the normal of_match_table, and, as the R8A77950 entry is listed first, incorrectly uses the sub-driver for R-Car H3 ES1.x. Fix this by moving the entry for R8A77951 before the entry for R8A77950. Simplify sh_pfc_quirk_match() to only handle R-Car H3 ES1,x, as R-Car H3 ES2.0+ can now be matched using the normal of_match_table as well. Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Yoshihiro Shimoda <[email protected]> Link: https://lore.kernel.org/r/6cdc5bfa424461105779b56f455387e03560cf66.1626707688.git.geert+renesas@glider.be
1 parent e9d66bd commit 91d1be9

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

drivers/pinctrl/renesas/core.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -571,17 +571,21 @@ static const struct of_device_id sh_pfc_of_table[] = {
571571
.data = &r8a7794_pinmux_info,
572572
},
573573
#endif
574-
/* Both r8a7795 entries must be present to make sanity checks work */
575-
#ifdef CONFIG_PINCTRL_PFC_R8A77950
574+
/*
575+
* Both r8a7795 entries must be present to make sanity checks work, but only
576+
* the first entry is actually used.
577+
* R-Car H3 ES1.x is matched using soc_device_match() instead.
578+
*/
579+
#ifdef CONFIG_PINCTRL_PFC_R8A77951
576580
{
577581
.compatible = "renesas,pfc-r8a7795",
578-
.data = &r8a77950_pinmux_info,
582+
.data = &r8a77951_pinmux_info,
579583
},
580584
#endif
581-
#ifdef CONFIG_PINCTRL_PFC_R8A77951
585+
#ifdef CONFIG_PINCTRL_PFC_R8A77950
582586
{
583587
.compatible = "renesas,pfc-r8a7795",
584-
.data = &r8a77951_pinmux_info,
588+
.data = &r8a77950_pinmux_info,
585589
},
586590
#endif
587591
#ifdef CONFIG_PINCTRL_PFC_R8A77960
@@ -1085,26 +1089,20 @@ static inline void sh_pfc_check_driver(struct platform_driver *pdrv) {}
10851089
#ifdef CONFIG_OF
10861090
static const void *sh_pfc_quirk_match(void)
10871091
{
1088-
#if defined(CONFIG_PINCTRL_PFC_R8A77950) || \
1089-
defined(CONFIG_PINCTRL_PFC_R8A77951)
1092+
#ifdef CONFIG_PINCTRL_PFC_R8A77950
10901093
const struct soc_device_attribute *match;
10911094
static const struct soc_device_attribute quirks[] = {
10921095
{
10931096
.soc_id = "r8a7795", .revision = "ES1.*",
10941097
.data = &r8a77950_pinmux_info,
10951098
},
1096-
{
1097-
.soc_id = "r8a7795",
1098-
.data = &r8a77951_pinmux_info,
1099-
},
1100-
11011099
{ /* sentinel */ }
11021100
};
11031101

11041102
match = soc_device_match(quirks);
11051103
if (match)
1106-
return match->data ?: ERR_PTR(-ENODEV);
1107-
#endif /* CONFIG_PINCTRL_PFC_R8A77950 || CONFIG_PINCTRL_PFC_R8A77951 */
1104+
return match->data;
1105+
#endif /* CONFIG_PINCTRL_PFC_R8A77950 */
11081106

11091107
return NULL;
11101108
}
@@ -1119,9 +1117,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
11191117
#ifdef CONFIG_OF
11201118
if (pdev->dev.of_node) {
11211119
info = sh_pfc_quirk_match();
1122-
if (IS_ERR(info))
1123-
return PTR_ERR(info);
1124-
11251120
if (!info)
11261121
info = of_device_get_match_data(&pdev->dev);
11271122
} else

drivers/pinctrl/renesas/sh_pfc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ extern const struct sh_pfc_soc_info r8a7791_pinmux_info;
332332
extern const struct sh_pfc_soc_info r8a7792_pinmux_info;
333333
extern const struct sh_pfc_soc_info r8a7793_pinmux_info;
334334
extern const struct sh_pfc_soc_info r8a7794_pinmux_info;
335-
extern const struct sh_pfc_soc_info r8a77950_pinmux_info __weak;
336-
extern const struct sh_pfc_soc_info r8a77951_pinmux_info __weak;
335+
extern const struct sh_pfc_soc_info r8a77950_pinmux_info;
336+
extern const struct sh_pfc_soc_info r8a77951_pinmux_info;
337337
extern const struct sh_pfc_soc_info r8a77960_pinmux_info;
338338
extern const struct sh_pfc_soc_info r8a77961_pinmux_info;
339339
extern const struct sh_pfc_soc_info r8a77965_pinmux_info;

0 commit comments

Comments
 (0)