[U-Boot] [PATCH] gpio: omap_gpio: Fix valid gpio range for AM33XX

Axel Lin
2013-06-20T15:26:56Z

AM33XX has 4 gpio banks, thus the valid gpio range should be 0 ... 127.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/gpio/omap_gpio.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index a30d7f0..9aa6d41 100644
--- a/drivers/gpio/omap_gpio.c
+++ b/drivers/gpio/omap_gpio.c
@@ -55,7 +55,11 @@ static inline int get_gpio_index(int gpio)

int gpio_is_valid(int gpio)
{
+#if defined(CONFIG_AM33XX)
+ return (gpio >= 0) && (gpio < 128);
+#else
return (gpio >= 0) && (gpio < 192);
+#endif
}

static int check_gpio(int gpio)
--
1.8.1.2