diff options
Diffstat (limited to 'arch/arm/plat-omap/gpio.c')
-rw-r--r-- | arch/arm/plat-omap/gpio.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 424049d83fbe..66e364738fbb 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c | |||
@@ -152,6 +152,7 @@ struct gpio_bank { | |||
152 | u32 level_mask; | 152 | u32 level_mask; |
153 | spinlock_t lock; | 153 | spinlock_t lock; |
154 | struct gpio_chip chip; | 154 | struct gpio_chip chip; |
155 | struct clk *dbck; | ||
155 | }; | 156 | }; |
156 | 157 | ||
157 | #define METHOD_MPUIO 0 | 158 | #define METHOD_MPUIO 0 |
@@ -484,10 +485,15 @@ void omap_set_gpio_debounce(int gpio, int enable) | |||
484 | reg += OMAP24XX_GPIO_DEBOUNCE_EN; | 485 | reg += OMAP24XX_GPIO_DEBOUNCE_EN; |
485 | val = __raw_readl(reg); | 486 | val = __raw_readl(reg); |
486 | 487 | ||
487 | if (enable) | 488 | if (enable && !(val & l)) |
488 | val |= l; | 489 | val |= l; |
489 | else | 490 | else if (!enable && val & l) |
490 | val &= ~l; | 491 | val &= ~l; |
492 | else | ||
493 | return; | ||
494 | |||
495 | if (cpu_is_omap34xx()) | ||
496 | enable ? clk_enable(bank->dbck) : clk_disable(bank->dbck); | ||
491 | 497 | ||
492 | __raw_writel(val, reg); | 498 | __raw_writel(val, reg); |
493 | } | 499 | } |
@@ -1296,7 +1302,6 @@ static struct clk * gpio5_fck; | |||
1296 | #endif | 1302 | #endif |
1297 | 1303 | ||
1298 | #if defined(CONFIG_ARCH_OMAP3) | 1304 | #if defined(CONFIG_ARCH_OMAP3) |
1299 | static struct clk *gpio_fclks[OMAP34XX_NR_GPIOS]; | ||
1300 | static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS]; | 1305 | static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS]; |
1301 | #endif | 1306 | #endif |
1302 | 1307 | ||
@@ -1310,9 +1315,7 @@ static int __init _omap_gpio_init(void) | |||
1310 | int i; | 1315 | int i; |
1311 | int gpio = 0; | 1316 | int gpio = 0; |
1312 | struct gpio_bank *bank; | 1317 | struct gpio_bank *bank; |
1313 | #if defined(CONFIG_ARCH_OMAP3) | ||
1314 | char clk_name[11]; | 1318 | char clk_name[11]; |
1315 | #endif | ||
1316 | 1319 | ||
1317 | initialized = 1; | 1320 | initialized = 1; |
1318 | 1321 | ||
@@ -1367,12 +1370,6 @@ static int __init _omap_gpio_init(void) | |||
1367 | printk(KERN_ERR "Could not get %s\n", clk_name); | 1370 | printk(KERN_ERR "Could not get %s\n", clk_name); |
1368 | else | 1371 | else |
1369 | clk_enable(gpio_iclks[i]); | 1372 | clk_enable(gpio_iclks[i]); |
1370 | sprintf(clk_name, "gpio%d_fck", i + 1); | ||
1371 | gpio_fclks[i] = clk_get(NULL, clk_name); | ||
1372 | if (IS_ERR(gpio_fclks[i])) | ||
1373 | printk(KERN_ERR "Could not get %s\n", clk_name); | ||
1374 | else | ||
1375 | clk_enable(gpio_fclks[i]); | ||
1376 | } | 1373 | } |
1377 | } | 1374 | } |
1378 | #endif | 1375 | #endif |
@@ -1511,6 +1508,13 @@ static int __init _omap_gpio_init(void) | |||
1511 | } | 1508 | } |
1512 | set_irq_chained_handler(bank->irq, gpio_irq_handler); | 1509 | set_irq_chained_handler(bank->irq, gpio_irq_handler); |
1513 | set_irq_data(bank->irq, bank); | 1510 | set_irq_data(bank->irq, bank); |
1511 | |||
1512 | if (cpu_is_omap34xx()) { | ||
1513 | sprintf(clk_name, "gpio%d_dbck", i + 1); | ||
1514 | bank->dbck = clk_get(NULL, clk_name); | ||
1515 | if (IS_ERR(bank->dbck)) | ||
1516 | printk(KERN_ERR "Could not get %s\n", clk_name); | ||
1517 | } | ||
1514 | } | 1518 | } |
1515 | 1519 | ||
1516 | /* Enable system clock for GPIO module. | 1520 | /* Enable system clock for GPIO module. |