public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 1/2] gpio: omap_gpio: Fix valid gpio range for AM33XX
@ 2013-06-21  7:54 Axel Lin
  2013-06-21  7:56 ` [U-Boot] [PATCH v3 2/2] gpio: omap_gpio: Fix valid GPIO range for OMAP5 Axel Lin
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-06-21  7:54 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Stefan Roese <sr@denx.de>
---
v2: define OMAP_MAX_GPIO and use it.
v3: no change, just for adding patch 2/2.
 drivers/gpio/omap_gpio.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index a30d7f0..6fa57c9 100644
--- a/drivers/gpio/omap_gpio.c
+++ b/drivers/gpio/omap_gpio.c
@@ -40,6 +40,12 @@
 #include <asm/io.h>
 #include <asm/errno.h>
 
+#if defined(CONFIG_AM33XX)
+#define OMAP_MAX_GPIO		128
+#else
+#define OMAP_MAX_GPIO		192
+#endif
+
 #define OMAP_GPIO_DIR_OUT	0
 #define OMAP_GPIO_DIR_IN	1
 
@@ -55,7 +61,7 @@ static inline int get_gpio_index(int gpio)
 
 int gpio_is_valid(int gpio)
 {
-	return (gpio >= 0) && (gpio < 192);
+	return (gpio >= 0) && (gpio < OMAP_MAX_GPIO);
 }
 
 static int check_gpio(int gpio)
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-21  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-21  7:54 [U-Boot] [PATCH v3 1/2] gpio: omap_gpio: Fix valid gpio range for AM33XX Axel Lin
2013-06-21  7:56 ` [U-Boot] [PATCH v3 2/2] gpio: omap_gpio: Fix valid GPIO range for OMAP5 Axel Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox