aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap/gpio.c')
-rw-r--r--arch/arm/plat-omap/gpio.c76
1 files changed, 63 insertions, 13 deletions
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index f0a882b8ab3a..1da7a5d1ddd9 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -85,10 +85,17 @@
85/* 85/*
86 * omap24xx specific GPIO registers 86 * omap24xx specific GPIO registers
87 */ 87 */
88#define OMAP24XX_GPIO1_BASE (void __iomem *)0x48018000 88#define OMAP242X_GPIO1_BASE (void __iomem *)0x48018000
89#define OMAP24XX_GPIO2_BASE (void __iomem *)0x4801a000 89#define OMAP242X_GPIO2_BASE (void __iomem *)0x4801a000
90#define OMAP24XX_GPIO3_BASE (void __iomem *)0x4801c000 90#define OMAP242X_GPIO3_BASE (void __iomem *)0x4801c000
91#define OMAP24XX_GPIO4_BASE (void __iomem *)0x4801e000 91#define OMAP242X_GPIO4_BASE (void __iomem *)0x4801e000
92
93#define OMAP243X_GPIO1_BASE (void __iomem *)0x4900C000
94#define OMAP243X_GPIO2_BASE (void __iomem *)0x4900E000
95#define OMAP243X_GPIO3_BASE (void __iomem *)0x49010000
96#define OMAP243X_GPIO4_BASE (void __iomem *)0x49012000
97#define OMAP243X_GPIO5_BASE (void __iomem *)0x480B6000
98
92#define OMAP24XX_GPIO_REVISION 0x0000 99#define OMAP24XX_GPIO_REVISION 0x0000
93#define OMAP24XX_GPIO_SYSCONFIG 0x0010 100#define OMAP24XX_GPIO_SYSCONFIG 0x0010
94#define OMAP24XX_GPIO_SYSSTATUS 0x0014 101#define OMAP24XX_GPIO_SYSSTATUS 0x0014
@@ -168,12 +175,22 @@ static struct gpio_bank gpio_bank_730[7] = {
168#endif 175#endif
169 176
170#ifdef CONFIG_ARCH_OMAP24XX 177#ifdef CONFIG_ARCH_OMAP24XX
171static struct gpio_bank gpio_bank_24xx[4] = { 178
172 { OMAP24XX_GPIO1_BASE, INT_24XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_24XX }, 179static struct gpio_bank gpio_bank_242x[4] = {
173 { OMAP24XX_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX }, 180 { OMAP242X_GPIO1_BASE, INT_24XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_24XX },
174 { OMAP24XX_GPIO3_BASE, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_24XX }, 181 { OMAP242X_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX },
175 { OMAP24XX_GPIO4_BASE, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX }, 182 { OMAP242X_GPIO3_BASE, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_24XX },
183 { OMAP242X_GPIO4_BASE, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX },
176}; 184};
185
186static struct gpio_bank gpio_bank_243x[5] = {
187 { OMAP243X_GPIO1_BASE, INT_24XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_24XX },
188 { OMAP243X_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX },
189 { OMAP243X_GPIO3_BASE, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_24XX },
190 { OMAP243X_GPIO4_BASE, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX },
191 { OMAP243X_GPIO5_BASE, INT_24XX_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_24XX },
192};
193
177#endif 194#endif
178 195
179static struct gpio_bank *gpio_bank; 196static struct gpio_bank *gpio_bank;
@@ -1113,6 +1130,11 @@ static int initialized;
1113static struct clk * gpio_ick; 1130static struct clk * gpio_ick;
1114static struct clk * gpio_fck; 1131static struct clk * gpio_fck;
1115 1132
1133#ifdef CONFIG_ARCH_OMAP2430
1134static struct clk * gpio5_ick;
1135static struct clk * gpio5_fck;
1136#endif
1137
1116static int __init _omap_gpio_init(void) 1138static int __init _omap_gpio_init(void)
1117{ 1139{
1118 int i; 1140 int i;
@@ -1138,7 +1160,25 @@ static int __init _omap_gpio_init(void)
1138 printk("Could not get gpios_fck\n"); 1160 printk("Could not get gpios_fck\n");
1139 else 1161 else
1140 clk_enable(gpio_fck); 1162 clk_enable(gpio_fck);
1141 } 1163
1164 /*
1165 * On 2430 GPIO 5 uses CORE L4 ICLK
1166 */
1167#ifdef CONFIG_ARCH_OMAP2430
1168 if (cpu_is_omap2430()) {
1169 gpio5_ick = clk_get(NULL, "gpio5_ick");
1170 if (IS_ERR(gpio5_ick))
1171 printk("Could not get gpio5_ick\n");
1172 else
1173 clk_enable(gpio5_ick);
1174 gpio5_fck = clk_get(NULL, "gpio5_fck");
1175 if (IS_ERR(gpio5_fck))
1176 printk("Could not get gpio5_fck\n");
1177 else
1178 clk_enable(gpio5_fck);
1179 }
1180#endif
1181}
1142 1182
1143#ifdef CONFIG_ARCH_OMAP15XX 1183#ifdef CONFIG_ARCH_OMAP15XX
1144 if (cpu_is_omap15xx()) { 1184 if (cpu_is_omap15xx()) {
@@ -1165,14 +1205,24 @@ static int __init _omap_gpio_init(void)
1165 gpio_bank = gpio_bank_730; 1205 gpio_bank = gpio_bank_730;
1166 } 1206 }
1167#endif 1207#endif
1208
1168#ifdef CONFIG_ARCH_OMAP24XX 1209#ifdef CONFIG_ARCH_OMAP24XX
1169 if (cpu_is_omap24xx()) { 1210 if (cpu_is_omap242x()) {
1170 int rev; 1211 int rev;
1171 1212
1172 gpio_bank_count = 4; 1213 gpio_bank_count = 4;
1173 gpio_bank = gpio_bank_24xx; 1214 gpio_bank = gpio_bank_242x;
1215 rev = omap_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
1216 printk(KERN_INFO "OMAP242x GPIO hardware version %d.%d\n",
1217 (rev >> 4) & 0x0f, rev & 0x0f);
1218 }
1219 if (cpu_is_omap243x()) {
1220 int rev;
1221
1222 gpio_bank_count = 5;
1223 gpio_bank = gpio_bank_243x;
1174 rev = omap_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION); 1224 rev = omap_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
1175 printk(KERN_INFO "OMAP24xx GPIO hardware version %d.%d\n", 1225 printk(KERN_INFO "OMAP243x GPIO hardware version %d.%d\n",
1176 (rev >> 4) & 0x0f, rev & 0x0f); 1226 (rev >> 4) & 0x0f, rev & 0x0f);
1177 } 1227 }
1178#endif 1228#endif