diff mbox

[U-Boot,1/2] ARM: tegra: fix GPIO init table programming

Message ID 1443031980-13042-1-git-send-email-swarren@wwwdotorg.org
State Accepted
Delegated to: Tom Warren
Headers show

Commit Message

Stephen Warren Sept. 23, 2015, 6:12 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

Tegra's gpio_config_table() currently uses common GPIO APIs. These used
to work without requesting the GPIO, but since commit 2fccd2d96bad "tegra:
Convert tegra GPIO driver to use driver model" no longer do so. This
prevents any of the GPIO initialization table from being applied to HW.
Fix gpio_config_table() to directly program the HW to solve this.

Fixes: 2fccd2d96bad ("tegra: Convert tegra GPIO driver to use driver model")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/gpio/tegra_gpio.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Simon Glass Oct. 1, 2015, 10:59 p.m. UTC | #1
On Wednesday, 23 September 2015, Stephen Warren <swarren@wwwdotorg.org> wrote:
>
> From: Stephen Warren <swarren@nvidia.com>
>
> Tegra's gpio_config_table() currently uses common GPIO APIs. These used
> to work without requesting the GPIO, but since commit 2fccd2d96bad "tegra:
> Convert tegra GPIO driver to use driver model" no longer do so. This
> prevents any of the GPIO initialization table from being applied to HW.
> Fix gpio_config_table() to directly program the HW to solve this.
>
> Fixes: 2fccd2d96bad ("tegra: Convert tegra GPIO driver to use driver model")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  drivers/gpio/tegra_gpio.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
>
>
 Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox

Patch

diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c
index 4921f0ff42e9..c0ae7719e2c9 100644
--- a/drivers/gpio/tegra_gpio.c
+++ b/drivers/gpio/tegra_gpio.c
@@ -211,13 +211,15 @@  void gpio_config_table(const struct tegra_gpio_config *config, int len)
 	for (i = 0; i < len; i++) {
 		switch (config[i].init) {
 		case TEGRA_GPIO_INIT_IN:
-			gpio_direction_input(config[i].gpio);
+			set_direction(config[i].gpio, 0);
 			break;
 		case TEGRA_GPIO_INIT_OUT0:
-			gpio_direction_output(config[i].gpio, 0);
+			set_level(config[i].gpio, 0);
+			set_direction(config[i].gpio, 1);
 			break;
 		case TEGRA_GPIO_INIT_OUT1:
-			gpio_direction_output(config[i].gpio, 1);
+			set_level(config[i].gpio, 1);
+			set_direction(config[i].gpio, 1);
 			break;
 		}
 		set_config(config[i].gpio, 1);