diff mbox series

[2/2] Revert "pinctrl: sh-pfc: r8a77990: Add support for pull-up only pins"

Message ID 20190111115744.29685-3-geert+renesas@glider.be
State New
Headers show
Series pinctrl: sh-pfc: r8a77990: Rework GP6_9 no pull down handling | expand

Commit Message

Geert Uytterhoeven Jan. 11, 2019, 11:57 a.m. UTC
This reverts commit f4caa6ee736fa8a46c806ba4382c16f7e5a20248.

The same can be expressed better by dropping the
SH_PFC_PIN_CFG_PULL_DOWN flag from the GPIO description, as it includes
returning an error to the caller when trying to configure the pin for
pull-down, causing:

    sh-pfc e6060000.pin-controller: pin_config_set op failed for pin 201
    sh-pfc e6060000.pin-controller: Error applying setting, reverse things back
    sh-pfc e6060000.pin-controller: failed to select default state

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/pinctrl/sh-pfc/pfc-r8a77990.c | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

Comments

Simon Horman Jan. 11, 2019, 12:49 p.m. UTC | #1
On Fri, Jan 11, 2019 at 12:57:44PM +0100, Geert Uytterhoeven wrote:
> This reverts commit f4caa6ee736fa8a46c806ba4382c16f7e5a20248.
> 
> The same can be expressed better by dropping the
> SH_PFC_PIN_CFG_PULL_DOWN flag from the GPIO description, as it includes
> returning an error to the caller when trying to configure the pin for
> pull-down, causing:
> 
>     sh-pfc e6060000.pin-controller: pin_config_set op failed for pin 201
>     sh-pfc e6060000.pin-controller: Error applying setting, reverse things back
>     sh-pfc e6060000.pin-controller: failed to select default state
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
diff mbox series

Patch

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c
index a1d99980788ac1cb..967b3fec45f516d1 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c
@@ -4927,17 +4927,6 @@  static const struct pinmux_bias_reg pinmux_bias_regs[] = {
 	{ /* 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,
 					     unsigned int pin)
 {
@@ -4950,7 +4939,7 @@  static unsigned int r8a77990_pinmux_get_bias(struct sh_pfc *pfc,
 
 	if (!(sh_pfc_read(pfc, reg->puen) & BIT(bit)))
 		return PIN_CONFIG_BIAS_DISABLE;
-	else if (!pin_has_pud(pin) || (sh_pfc_read(pfc, reg->pud) & BIT(bit)))
+	else if (sh_pfc_read(pfc, reg->pud) & BIT(bit))
 		return PIN_CONFIG_BIAS_PULL_UP;
 	else
 		return PIN_CONFIG_BIAS_PULL_DOWN;
@@ -4971,13 +4960,11 @@  static void r8a77990_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
 	if (bias != PIN_CONFIG_BIAS_DISABLE)
 		enable |= BIT(bit);
 
-	if (pin_has_pud(pin)) {
-		updown = sh_pfc_read(pfc, reg->pud) & ~BIT(bit);
-		if (bias == PIN_CONFIG_BIAS_PULL_UP)
-			updown |= BIT(bit);
+	updown = sh_pfc_read(pfc, reg->pud) & ~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);
 }