diff options
Diffstat (limited to 'drivers/pinctrl/sh-pfc/core.c')
-rw-r--r-- | drivers/pinctrl/sh-pfc/core.c | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c index 65e52688f091..82209116955b 100644 --- a/drivers/pinctrl/sh-pfc/core.c +++ b/drivers/pinctrl/sh-pfc/core.c @@ -23,6 +23,7 @@ #include <linux/platform_device.h> #include <linux/psci.h> #include <linux/slab.h> +#include <linux/sys_soc.h> #include "core.h" @@ -568,18 +569,18 @@ static const struct of_device_id sh_pfc_of_table[] = { .data = &r8a7794_pinmux_info, }, #endif -#ifdef CONFIG_PINCTRL_PFC_R8A7795 +/* Both r8a7795 entries must be present to make sanity checks work */ +#ifdef CONFIG_PINCTRL_PFC_R8A77950 { .compatible = "renesas,pfc-r8a7795", - .data = &r8a7795_pinmux_info, + .data = &r8a77950_pinmux_info, }, -#ifdef DEBUG +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A77951 { - /* For sanity checks only (nothing matches against this) */ - .compatible = "renesas,pfc-r8a77950", /* R-Car H3 ES1.0 */ - .data = &r8a7795es1_pinmux_info, + .compatible = "renesas,pfc-r8a7795", + .data = &r8a77951_pinmux_info, }, -#endif /* DEBUG */ #endif #ifdef CONFIG_PINCTRL_PFC_R8A77960 { @@ -886,19 +887,49 @@ static void __init sh_pfc_check_driver(const struct platform_driver *pdrv) static inline void sh_pfc_check_driver(struct platform_driver *pdrv) {} #endif /* !DEBUG */ +#ifdef CONFIG_OF +static const void *sh_pfc_quirk_match(void) +{ +#if defined(CONFIG_PINCTRL_PFC_R8A77950) || \ + defined(CONFIG_PINCTRL_PFC_R8A77951) + const struct soc_device_attribute *match; + static const struct soc_device_attribute quirks[] = { + { + .soc_id = "r8a7795", .revision = "ES1.*", + .data = &r8a77950_pinmux_info, + }, + { + .soc_id = "r8a7795", + .data = &r8a77951_pinmux_info, + }, + + { /* sentinel */ } + }; + + match = soc_device_match(quirks); + if (match) + return match->data ?: ERR_PTR(-ENODEV); +#endif /* CONFIG_PINCTRL_PFC_R8A77950 || CONFIG_PINCTRL_PFC_R8A77951 */ + + return NULL; +} +#endif /* CONFIG_OF */ + static int sh_pfc_probe(struct platform_device *pdev) { -#ifdef CONFIG_OF - struct device_node *np = pdev->dev.of_node; -#endif const struct sh_pfc_soc_info *info; struct sh_pfc *pfc; int ret; #ifdef CONFIG_OF - if (np) - info = of_device_get_match_data(&pdev->dev); - else + if (pdev->dev.of_node) { + info = sh_pfc_quirk_match(); + if (IS_ERR(info)) + return PTR_ERR(info); + + if (!info) + info = of_device_get_match_data(&pdev->dev); + } else #endif info = (const void *)platform_get_device_id(pdev)->driver_data; |