Commit f4caa6ee authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

pinctrl: sh-pfc: r8a77990: Add support for pull-up only pins

The R-Car Gen3 HardWare Manual Errata for Rev. 1.00 (Jul 2, 2018) states
that the USB30_OVC pin supports pull-up only.  It has a bit assigned in
the pull-enable register (PUEN5), but not in the pull-up/down control
register (PUD5).

Add a check for this, to prevent configuring a prohibited setting.
Reported-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Fixes: 83f6941a ("pinctrl: sh-pfc: r8a77990: Add bias pinconf support")
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
parent 3f3327db
...@@ -4914,6 +4914,17 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = { ...@@ -4914,6 +4914,17 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
{ /* sentinel */ }, { /* sentinel */ },
}; };
static bool pin_has_pud(unsigned int pin)
{
/* Some pins are pull-up only */
switch (pin) {
case RCAR_GP_PIN(6, 9): /* USB30_OVC */
return false;
}
return true;
}
static unsigned int r8a77990_pinmux_get_bias(struct sh_pfc *pfc, static unsigned int r8a77990_pinmux_get_bias(struct sh_pfc *pfc,
unsigned int pin) unsigned int pin)
{ {
...@@ -4926,7 +4937,7 @@ static unsigned int r8a77990_pinmux_get_bias(struct sh_pfc *pfc, ...@@ -4926,7 +4937,7 @@ static unsigned int r8a77990_pinmux_get_bias(struct sh_pfc *pfc,
if (!(sh_pfc_read(pfc, reg->puen) & BIT(bit))) if (!(sh_pfc_read(pfc, reg->puen) & BIT(bit)))
return PIN_CONFIG_BIAS_DISABLE; return PIN_CONFIG_BIAS_DISABLE;
else if (sh_pfc_read(pfc, reg->pud) & BIT(bit)) else if (!pin_has_pud(pin) || (sh_pfc_read(pfc, reg->pud) & BIT(bit)))
return PIN_CONFIG_BIAS_PULL_UP; return PIN_CONFIG_BIAS_PULL_UP;
else else
return PIN_CONFIG_BIAS_PULL_DOWN; return PIN_CONFIG_BIAS_PULL_DOWN;
...@@ -4947,11 +4958,13 @@ static void r8a77990_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, ...@@ -4947,11 +4958,13 @@ static void r8a77990_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
if (bias != PIN_CONFIG_BIAS_DISABLE) if (bias != PIN_CONFIG_BIAS_DISABLE)
enable |= BIT(bit); enable |= BIT(bit);
updown = sh_pfc_read(pfc, reg->pud) & ~BIT(bit); if (pin_has_pud(pin)) {
if (bias == PIN_CONFIG_BIAS_PULL_UP) updown = sh_pfc_read(pfc, reg->pud) & ~BIT(bit);
updown |= BIT(bit); if (bias == PIN_CONFIG_BIAS_PULL_UP)
updown |= BIT(bit);
sh_pfc_write(pfc, reg->pud, updown); sh_pfc_write(pfc, reg->pud, updown);
}
sh_pfc_write(pfc, reg->puen, enable); sh_pfc_write(pfc, reg->puen, enable);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment