summaryrefslogtreecommitdiff
path: root/drivers/gpio/tegra_gpio.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-02-19 09:25:09 -0500
committerTom Rini <trini@konsulko.com>2016-02-19 09:25:09 -0500
commitcf432dd5953e9ddf06759565c80fed470882da6d (patch)
treef0b5ee32047f37eb87e6e5ba537a50fb0babc1cb /drivers/gpio/tegra_gpio.c
parenta8c3eca43393cffef16a40e683f7a4d45b37e6ed (diff)
parent5589bc2770a7d7fe346f5972596f26d1ddf57bba (diff)
Merge branch 'master' of git://git.denx.de/u-boot-tegra
Diffstat (limited to 'drivers/gpio/tegra_gpio.c')
-rw-r--r--drivers/gpio/tegra_gpio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c
index 8e880e276f..5a031159ca 100644
--- a/drivers/gpio/tegra_gpio.c
+++ b/drivers/gpio/tegra_gpio.c
@@ -177,7 +177,10 @@ static int tegra_gpio_get_value(struct udevice *dev, unsigned offset)
debug("%s: pin = %d (port %d:bit %d)\n", __func__,
gpio, GPIO_FULLPORT(gpio), GPIO_BIT(gpio));
- val = readl(&state->bank->gpio_in[GPIO_PORT(gpio)]);
+ if (get_direction(gpio) == DIRECTION_INPUT)
+ val = readl(&state->bank->gpio_in[GPIO_PORT(gpio)]);
+ else
+ val = readl(&state->bank->gpio_out[GPIO_PORT(gpio)]);
return (val >> GPIO_BIT(gpio)) & 1;
}