* [PATCH] pinctrl: uniphier: set input-enable before pin-muxing
@ 2015-10-20 8:25 Masahiro Yamada
2015-10-27 10:09 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2015-10-20 8:25 UTC (permalink / raw)
To: linux-gpio; +Cc: Masahiro Yamada, Linus Walleij, linux-arm-kernel, linux-kernel
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: 6e9088920258 ("pinctrl: UniPhier: add UniPhier pinctrl core support")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reported-by: Dai Okamura <okamura.dai@socionext.com>
---
Hi Linus,
If it is not too late, please apply this fix for Linux 4.3.
Thanks,
Masahiro
drivers/pinctrl/uniphier/pinctrl-uniphier-core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
index 918f3b6..589872c 100644
--- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
+++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
@@ -539,6 +539,12 @@ static int uniphier_pmx_set_one_mux(struct pinctrl_dev *pctldev, unsigned pin,
unsigned reg, reg_end, shift, mask;
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_end = reg + reg_stride;
shift = pin * mux_bits % 32;
@@ -563,9 +569,7 @@ static int uniphier_pmx_set_one_mux(struct pinctrl_dev *pctldev, unsigned pin,
return ret;
}
- /* some pins need input-enabling */
- return uniphier_conf_pin_input_enable(pctldev,
- &pctldev->desc->pins[pin], 1);
+ return 0;
}
static int uniphier_pmx_set_mux(struct pinctrl_dev *pctldev,
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pinctrl: uniphier: set input-enable before pin-muxing
2015-10-20 8:25 [PATCH] pinctrl: uniphier: set input-enable before pin-muxing Masahiro Yamada
@ 2015-10-27 10:09 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2015-10-27 10:09 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-gpio, linux-arm-kernel, linux-kernel
On Tue, Oct 20, 2015 at 10:25 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> 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: 6e9088920258 ("pinctrl: UniPhier: add UniPhier pinctrl core support")
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Reported-by: Dai Okamura <okamura.dai@socionext.com>
> ---
>
> Hi Linus,
>
> If it is not too late, please apply this fix for Linux 4.3.
It's too late at this point.
Patch is applied for devel and will come into v4.4 and from there
to -stable.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-27 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-20 8:25 [PATCH] pinctrl: uniphier: set input-enable before pin-muxing Masahiro Yamada
2015-10-27 10:09 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).