Commit bac7f4c1 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Linus Walleij

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: 6e908892 ("pinctrl: UniPhier: add UniPhier pinctrl core support")
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reported-by: default avatarDai Okamura <okamura.dai@socionext.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent e0548004
...@@ -539,6 +539,12 @@ static int uniphier_pmx_set_one_mux(struct pinctrl_dev *pctldev, unsigned pin, ...@@ -539,6 +539,12 @@ static int uniphier_pmx_set_one_mux(struct pinctrl_dev *pctldev, unsigned pin,
unsigned reg, reg_end, shift, mask; unsigned reg, reg_end, shift, mask;
int ret; int ret;
/* some pins need input-enabling */
ret = uniphier_conf_pin_input_enable(pctldev,
&pctldev->desc->pins[pin], 1);
if (ret)
return ret;
reg = UNIPHIER_PINCTRL_PINMUX_BASE + pin * mux_bits / 32 * reg_stride; reg = UNIPHIER_PINCTRL_PINMUX_BASE + pin * mux_bits / 32 * reg_stride;
reg_end = reg + reg_stride; reg_end = reg + reg_stride;
shift = pin * mux_bits % 32; shift = pin * mux_bits % 32;
...@@ -563,9 +569,7 @@ static int uniphier_pmx_set_one_mux(struct pinctrl_dev *pctldev, unsigned pin, ...@@ -563,9 +569,7 @@ static int uniphier_pmx_set_one_mux(struct pinctrl_dev *pctldev, unsigned pin,
return ret; return ret;
} }
/* some pins need input-enabling */ return 0;
return uniphier_conf_pin_input_enable(pctldev,
&pctldev->desc->pins[pin], 1);
} }
static int uniphier_pmx_set_mux(struct pinctrl_dev *pctldev, static int uniphier_pmx_set_mux(struct pinctrl_dev *pctldev,
......
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