[U-Boot] [PATCH 2/2] ARM: tegra: don't enable GPIOs until direction is set

Simon Glass sjg at chromium.org
Fri Oct 2 01:00:00 CEST 2015


On Wednesday, 23 September 2015, Stephen Warren <swarren at wwwdotorg.org> wrote:
>
> From: Stephen Warren <swarren at nvidia.com>
>
> Tegra's GPIO driver currently enables pins as GPIO as soon as they're
> requested. This is not safe, since the desired direction and output value
> are not yet known. This could cause a glitch on the output pins between
> gpio_request() and gpio_direction_*(), depending on what values happen to
> be in the GPIO controller's in/out and out-value registers vs. the final
> desired configuration.
>
> To solve this, defer enabling pins as GPIOs until some gpio_direction_*()
> is invoked, and the desired configuration is explicitly programmed.
>
> In theory this change could cause regressions, if code exists that claims
> a GPIO, never explicitly sets a direction, and then gets/sets the GPIO
> value based on that assumption. However, I've read through all the Tegra-
> related board files and device drivers that touch GPIOs and I do not see
> such buggy code anywhere.
>
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
> ---
>  drivers/gpio/tegra_gpio.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
>

Reviewed-by: Simon Glass <sjg at chromium.org>
>
>


More information about the U-Boot mailing list