]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
ARM: OMAP: GPIO: Fix valid range and enable usage of all GPIOs on OMAP5
authorAxel Lin <axel.lin@ingics.com>
Fri, 21 Jun 2013 10:54:25 +0000 (18:54 +0800)
committerTom Rini <trini@ti.com>
Tue, 2 Jul 2013 13:21:16 +0000 (09:21 -0400)
The omap_gpio driver is used by AM33XX, OMAP3/4, OMAP54XX and DRA7XX SoCs.
These SoCs have different gpio count but currently omap_gpio driver uses hard
coded 192 which is wrong.

This patch fixes this issue by:
1. Move define of OMAP_MAX_GPIO to all arch/arm/include/asm/arch-omap*/gpio.h.
2. Update gpio bank settings and enable GPIO modules 7 & 8 clocks for OMAP5.

Thanks for Lubomir Popov to provide valuable comments to fix this issue.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Lubomir Popov <lpopov@mm-sol.com>
Acked-by: Heiko Schocher <hs@denx.de>
arch/arm/cpu/armv7/omap5/hw_data.c
arch/arm/cpu/armv7/omap5/hwinit.c
arch/arm/include/asm/arch-am33xx/gpio.h
arch/arm/include/asm/arch-omap3/gpio.h
arch/arm/include/asm/arch-omap4/gpio.h
arch/arm/include/asm/arch-omap5/gpio.h
drivers/gpio/omap_gpio.c

index 56cf1f8c60d09b10e3879201b3e2362ebab80863..07b1108e0e55a70f02ee740a6f39e55aa4dc4544 100644 (file)
@@ -412,6 +412,8 @@ void enable_basic_clocks(void)
                (*prcm)->cm_l4per_gpio4_clkctrl,
                (*prcm)->cm_l4per_gpio5_clkctrl,
                (*prcm)->cm_l4per_gpio6_clkctrl,
+               (*prcm)->cm_l4per_gpio7_clkctrl,
+               (*prcm)->cm_l4per_gpio8_clkctrl,
                0
        };
 
index daf124e99cb034403bed4c765b331b3cb83db3f9..11ba36b8756d5d4e1fef312ada3879fbcccf741f 100644 (file)
@@ -43,13 +43,15 @@ DECLARE_GLOBAL_DATA_PTR;
 
 u32 *const omap_si_rev = (u32 *)OMAP_SRAM_SCRATCH_OMAP_REV;
 
-static struct gpio_bank gpio_bank_54xx[6] = {
+static struct gpio_bank gpio_bank_54xx[8] = {
        { (void *)OMAP54XX_GPIO1_BASE, METHOD_GPIO_24XX },
        { (void *)OMAP54XX_GPIO2_BASE, METHOD_GPIO_24XX },
        { (void *)OMAP54XX_GPIO3_BASE, METHOD_GPIO_24XX },
        { (void *)OMAP54XX_GPIO4_BASE, METHOD_GPIO_24XX },
        { (void *)OMAP54XX_GPIO5_BASE, METHOD_GPIO_24XX },
        { (void *)OMAP54XX_GPIO6_BASE, METHOD_GPIO_24XX },
+       { (void *)OMAP54XX_GPIO7_BASE, METHOD_GPIO_24XX },
+       { (void *)OMAP54XX_GPIO8_BASE, METHOD_GPIO_24XX },
 };
 
 const struct gpio_bank *const omap_gpio_bank = gpio_bank_54xx;
index 1a211e95e8e67b18891165482becdedf06c8f723..834697977123ef65a2112f81b92cea76db8099a1 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <asm/omap_gpio.h>
 
+#define OMAP_MAX_GPIO          128
+
 #define AM33XX_GPIO0_BASE       0x44E07000
 #define AM33XX_GPIO1_BASE       0x4804C000
 #define AM33XX_GPIO2_BASE       0x481AC000
index 8bba3b030bf9ba61dc7911ebb394a466c87903ea..d72f5e50ad6b89e6b3ea09ce34573e338c3a1359 100644 (file)
@@ -40,6 +40,8 @@
 
 #include <asm/omap_gpio.h>
 
+#define OMAP_MAX_GPIO                  192
+
 #define OMAP34XX_GPIO1_BASE            0x48310000
 #define OMAP34XX_GPIO2_BASE            0x49050000
 #define OMAP34XX_GPIO3_BASE            0x49052000
index 26f19d19a51b744831fa7336d0c06788c255ff48..fdf65edab8a6426b7e9512d44d14df9a1e999ec6 100644 (file)
@@ -40,6 +40,8 @@
 
 #include <asm/omap_gpio.h>
 
+#define OMAP_MAX_GPIO                  192
+
 #define OMAP44XX_GPIO1_BASE            0x4A310000
 #define OMAP44XX_GPIO2_BASE            0x48055000
 #define OMAP44XX_GPIO3_BASE            0x48057000
index c14dff0f3229bfb661e6b8e7cbd80d9956d05234..7c82f9036075117524b5221585bf7010bf272f32 100644 (file)
 
 #include <asm/omap_gpio.h>
 
+#define OMAP_MAX_GPIO                  256
+
 #define OMAP54XX_GPIO1_BASE            0x4Ae10000
 #define OMAP54XX_GPIO2_BASE            0x48055000
 #define OMAP54XX_GPIO3_BASE            0x48057000
 #define OMAP54XX_GPIO4_BASE            0x48059000
 #define OMAP54XX_GPIO5_BASE            0x4805B000
 #define OMAP54XX_GPIO6_BASE            0x4805D000
+#define OMAP54XX_GPIO7_BASE            0x48051000
+#define OMAP54XX_GPIO8_BASE            0x48053000
 
 #endif /* _GPIO_OMAP5_H */
index a30d7f0603e9b5da4c8280896ae00289e4874b57..f16e9ae4d2b3765533fd937e813cc60488fae528 100644 (file)
@@ -55,7 +55,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)