Skip to content

Commit bac7f4c

Browse files
masahir0yLinus Walleij
authored andcommitted
pinctrl: uniphier: set input-enable before pin-muxing
While IECTRL is disabled, input signals are pulled-down internally. If pin-muxing is set up first, glitch signals (Low to High transition) might be input to hardware blocks. Bad case scenario: [1] The hardware block is already running before pinctrl is handled. (the reset is de-asserted by default or by a firmware, for example) [2] The pin-muxing is set up. The input signals to hardware block are pulled-down by the chip-internal biasing. [3] The pins are input-enabled. The signals from the board reach the hardware block. Actually, one invalid character is input to the UART blocks for such SoCs as PH1-LD4, PH1-sLD8, where UART devices start to run at the power on reset. To avoid such problems, pins should be input-enabled before muxing. Fixes: 6e90889 ("pinctrl: UniPhier: add UniPhier pinctrl core support") Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reported-by: Dai Okamura <okamura.dai@socionext.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent e054800 commit bac7f4c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎drivers/pinctrl/uniphier/pinctrl-uniphier-core.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,12 @@ static int uniphier_pmx_set_one_mux(struct pinctrl_dev *pctldev, unsigned pin,
539539
unsigned reg, reg_end, shift, mask;
540540
int ret;
541541

542+
/* some pins need input-enabling */
543+
ret = uniphier_conf_pin_input_enable(pctldev,
544+
&pctldev->desc->pins[pin], 1);
545+
if (ret)
546+
return ret;
547+
542548
reg = UNIPHIER_PINCTRL_PINMUX_BASE + pin * mux_bits / 32 * reg_stride;
543549
reg_end = reg + reg_stride;
544550
shift = pin * mux_bits % 32;
@@ -563,9 +569,7 @@ static int uniphier_pmx_set_one_mux(struct pinctrl_dev *pctldev, unsigned pin,
563569
return ret;
564570
}
565571

566-
/* some pins need input-enabling */
567-
return uniphier_conf_pin_input_enable(pctldev,
568-
&pctldev->desc->pins[pin], 1);
572+
return 0;
569573
}
570574

571575
static int uniphier_pmx_set_mux(struct pinctrl_dev *pctldev,

0 commit comments

Comments
 (0)