diff mbox series

[U-Boot] gpio: da8xx_gpio: Fix the _gpio_direction_output function

Message ID 20191024082228.23800-1-j-keerthy@ti.com
State Accepted
Commit 3135022cb4db37ccf7691b03f6a99cfe6afb878d
Delegated to: Tom Rini
Headers show
Series [U-Boot] gpio: da8xx_gpio: Fix the _gpio_direction_output function | expand

Commit Message

Keerthy Oct. 24, 2019, 8:22 a.m. UTC
_gpio_direction_output function currently calls gpio_set_value
with the wrong gpio number. gpio_set_value in the uclass driver
expects a different gpio number and the _gpio_direction_output
is currently providing the number specific to the bank.

Hence fix it by calling the _gpio_set_value function instead.

Reported-by: Faiz Abbas <faiz_abbas@ti.com>
Fixes: 8e51c0f254 ("dm: gpio: Add DM compatibility to GPIO driver for Davinci")
Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/gpio/da8xx_gpio.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Tom Rini Nov. 1, 2019, 1:31 p.m. UTC | #1
On Thu, Oct 24, 2019 at 01:52:28PM +0530, Keerthy wrote:

> _gpio_direction_output function currently calls gpio_set_value
> with the wrong gpio number. gpio_set_value in the uclass driver
> expects a different gpio number and the _gpio_direction_output
> is currently providing the number specific to the bank.
> 
> Hence fix it by calling the _gpio_set_value function instead.
> 
> Reported-by: Faiz Abbas <faiz_abbas@ti.com>
> Fixes: 8e51c0f254 ("dm: gpio: Add DM compatibility to GPIO driver for Davinci")
> Signed-off-by: Keerthy <j-keerthy@ti.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/gpio/da8xx_gpio.c b/drivers/gpio/da8xx_gpio.c
index 0deb034504..86203307db 100644
--- a/drivers/gpio/da8xx_gpio.c
+++ b/drivers/gpio/da8xx_gpio.c
@@ -342,13 +342,6 @@  int gpio_free(unsigned int gpio)
 }
 #endif
 
-static int _gpio_direction_output(struct davinci_gpio *bank, unsigned int gpio, int value)
-{
-	clrbits_le32(&bank->dir, 1U << GPIO_BIT(gpio));
-	gpio_set_value(gpio, value);
-	return 0;
-}
-
 static int _gpio_direction_input(struct davinci_gpio *bank, unsigned int gpio)
 {
 	setbits_le32(&bank->dir, 1U << GPIO_BIT(gpio));
@@ -377,6 +370,13 @@  static int _gpio_get_dir(struct davinci_gpio *bank, unsigned int gpio)
 	return in_le32(&bank->dir) & (1U << GPIO_BIT(gpio));
 }
 
+static int _gpio_direction_output(struct davinci_gpio *bank, unsigned int gpio,
+				  int value)
+{
+	clrbits_le32(&bank->dir, 1U << GPIO_BIT(gpio));
+	_gpio_set_value(bank, gpio, value);
+	return 0;
+}
 #ifndef CONFIG_DM_GPIO
 
 void gpio_info(void)