pinctrl: renesas: rcar: Avoid changing PUDn when disabling bias
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 30 Jun 2021 14:50:42 +0000 (16:50 +0200)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 13 Jul 2021 07:43:23 +0000 (09:43 +0200)
When disabling pin bias, there is no need to touch the LSI pin
pull-up/down control register (PUDn), which selects between pull-up and
pull-down.  Just disabling the pull-up/down function through the LSI pin
pull-enable register (PUENn) is sufficient.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Link: https://lore.kernel.org/r/071ec644de2555da593a4531ef5d3e4d79cf997d.1625064076.git.geert+renesas@glider.be
drivers/pinctrl/renesas/pinctrl.c

index bb488af298623407d5bba9465d87bc3e2cbe4de0..85cb78cfcfa6c37dd2500adf3b3c77c2d0197c19 100644 (file)
@@ -898,17 +898,17 @@ void rcar_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
 
        if (reg->puen) {
                enable = sh_pfc_read(pfc, reg->puen) & ~BIT(bit);
-               if (bias != PIN_CONFIG_BIAS_DISABLE)
+               if (bias != PIN_CONFIG_BIAS_DISABLE) {
                        enable |= BIT(bit);
 
-               if (reg->pud) {
-                       updown = sh_pfc_read(pfc, reg->pud) & ~BIT(bit);
-                       if (bias == PIN_CONFIG_BIAS_PULL_UP)
-                               updown |= BIT(bit);
+                       if (reg->pud) {
+                               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);
        } else {
                enable = sh_pfc_read(pfc, reg->pud) & ~BIT(bit);