summaryrefslogtreecommitdiff
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2021-12-23 17:56:24 +0300
committerGeert Uytterhoeven <geert+renesas@glider.be>2022-02-22 11:57:19 +0300
commit8d1c50b80139fd742a6a3ec851efbc849e731994 (patch)
treeb485249319fe847e42984409e3ea6d426b708217 /drivers/pinctrl
parent854476b8562a1567fe640360e03d8e3a4d6b8d80 (diff)
downloadlinux-8d1c50b80139fd742a6a3ec851efbc849e731994.tar.xz
pinctrl: renesas: checker: Validate I/O voltage configs consistency
Validate consistency of the pin control tables for pins with I/O voltage capabilities. If a pin has I/O voltage register bits declarations through .pin_to_pocctrl(), the SH_PFC_PIN_CFG_IO_VOLTAGE flag should be set in the pin's configs, and vice versa. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/de81cced01ae3f26d341177d66d4b8e918fbfb76.1640270559.git.geert+renesas@glider.be
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/renesas/core.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/pinctrl/renesas/core.c b/drivers/pinctrl/renesas/core.c
index 1789c96ad2aa..ef88359ddf5c 100644
--- a/drivers/pinctrl/renesas/core.c
+++ b/drivers/pinctrl/renesas/core.c
@@ -747,6 +747,7 @@ static unsigned int sh_pfc_errors __initdata;
static unsigned int sh_pfc_warnings __initdata;
static bool sh_pfc_bias_done __initdata;
static bool sh_pfc_drive_done __initdata;
+static bool sh_pfc_power_done __initdata;
static struct {
u32 reg;
u32 bits;
@@ -1009,6 +1010,7 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
sh_pfc_num_enums = 0;
sh_pfc_bias_done = false;
sh_pfc_drive_done = false;
+ sh_pfc_power_done = false;
/* Check pins */
for (i = 0; i < info->nr_pins; i++) {
@@ -1082,6 +1084,18 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
pin->name);
}
}
+
+ if (pin->configs & SH_PFC_PIN_CFG_IO_VOLTAGE) {
+ if (!info->ops || !info->ops->pin_to_pocctrl)
+ sh_pfc_err_once(power, "SH_PFC_PIN_CFG_IO_VOLTAGE flag set but .pin_to_pocctrl() not implemented\n");
+ else if (info->ops->pin_to_pocctrl(pin->pin, &x) < 0)
+ sh_pfc_err("pin %s: SH_PFC_PIN_CFG_IO_VOLTAGE set but invalid pin_to_pocctrl()\n",
+ pin->name);
+ } else if (info->ops && info->ops->pin_to_pocctrl &&
+ info->ops->pin_to_pocctrl(pin->pin, &x) >= 0) {
+ sh_pfc_warn("pin %s: SH_PFC_PIN_CFG_IO_VOLTAGE not set but valid pin_to_pocctrl()\n",
+ pin->name);
+ }
}
/* Check groups and functions */