diff options
author | Jouni Hogander <jouni.hogander@nokia.com> | 2008-12-10 20:35:24 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-12-10 20:35:24 -0500 |
commit | 89db94825447a03f17e03c0a6c8840a0a22cf155 (patch) | |
tree | 4f396a91ac3a8d9e277f88ef7fafa6f3985270ec /arch/arm | |
parent | 8b1fae4e4200388b64dd88065639413cb3f1051c (diff) |
ARM: OMAP: Enable GPIO debounce clock only when debounce is enabled v3
This patch changes gpio "driver" to enable debounce clock for
gpio-bank only when debounce is enabled for some gpio in that bank.
Gpio functional clocks are also renamed in clock tree, gpioX_fck ->
gpioX_dbck.
This patch triggers problem with gpio wake-up and Omap3. Gpios in PER
domain aren't capable to generate wake-up if PER domain is in sleep
state. For this iopad wake-up should be used and needed pad
configuration should be done. Enabling iopad wake-up for gpio pads is
left for bootloader or omap mux configuration in kernel.
Signed-off-by: Jouni Hogander <jouni.hogander@nokia.com>
Acked-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/clock34xx.h | 36 | ||||
-rw-r--r-- | arch/arm/plat-omap/gpio.c | 26 |
2 files changed, 33 insertions, 29 deletions
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h index c38a8a09692f..7217a0824ec4 100644 --- a/arch/arm/mach-omap2/clock34xx.h +++ b/arch/arm/mach-omap2/clock34xx.h | |||
@@ -2280,8 +2280,8 @@ static struct clk wkup_32k_fck = { | |||
2280 | .recalc = &followparent_recalc, | 2280 | .recalc = &followparent_recalc, |
2281 | }; | 2281 | }; |
2282 | 2282 | ||
2283 | static struct clk gpio1_fck = { | 2283 | static struct clk gpio1_dbck = { |
2284 | .name = "gpio1_fck", | 2284 | .name = "gpio1_dbck", |
2285 | .parent = &wkup_32k_fck, | 2285 | .parent = &wkup_32k_fck, |
2286 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | 2286 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), |
2287 | .enable_bit = OMAP3430_EN_GPIO1_SHIFT, | 2287 | .enable_bit = OMAP3430_EN_GPIO1_SHIFT, |
@@ -2527,8 +2527,8 @@ static struct clk per_32k_alwon_fck = { | |||
2527 | .recalc = &followparent_recalc, | 2527 | .recalc = &followparent_recalc, |
2528 | }; | 2528 | }; |
2529 | 2529 | ||
2530 | static struct clk gpio6_fck = { | 2530 | static struct clk gpio6_dbck = { |
2531 | .name = "gpio6_fck", | 2531 | .name = "gpio6_dbck", |
2532 | .parent = &per_32k_alwon_fck, | 2532 | .parent = &per_32k_alwon_fck, |
2533 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | 2533 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), |
2534 | .enable_bit = OMAP3430_EN_GPIO6_SHIFT, | 2534 | .enable_bit = OMAP3430_EN_GPIO6_SHIFT, |
@@ -2537,8 +2537,8 @@ static struct clk gpio6_fck = { | |||
2537 | .recalc = &followparent_recalc, | 2537 | .recalc = &followparent_recalc, |
2538 | }; | 2538 | }; |
2539 | 2539 | ||
2540 | static struct clk gpio5_fck = { | 2540 | static struct clk gpio5_dbck = { |
2541 | .name = "gpio5_fck", | 2541 | .name = "gpio5_dbck", |
2542 | .parent = &per_32k_alwon_fck, | 2542 | .parent = &per_32k_alwon_fck, |
2543 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | 2543 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), |
2544 | .enable_bit = OMAP3430_EN_GPIO5_SHIFT, | 2544 | .enable_bit = OMAP3430_EN_GPIO5_SHIFT, |
@@ -2547,8 +2547,8 @@ static struct clk gpio5_fck = { | |||
2547 | .recalc = &followparent_recalc, | 2547 | .recalc = &followparent_recalc, |
2548 | }; | 2548 | }; |
2549 | 2549 | ||
2550 | static struct clk gpio4_fck = { | 2550 | static struct clk gpio4_dbck = { |
2551 | .name = "gpio4_fck", | 2551 | .name = "gpio4_dbck", |
2552 | .parent = &per_32k_alwon_fck, | 2552 | .parent = &per_32k_alwon_fck, |
2553 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | 2553 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), |
2554 | .enable_bit = OMAP3430_EN_GPIO4_SHIFT, | 2554 | .enable_bit = OMAP3430_EN_GPIO4_SHIFT, |
@@ -2557,8 +2557,8 @@ static struct clk gpio4_fck = { | |||
2557 | .recalc = &followparent_recalc, | 2557 | .recalc = &followparent_recalc, |
2558 | }; | 2558 | }; |
2559 | 2559 | ||
2560 | static struct clk gpio3_fck = { | 2560 | static struct clk gpio3_dbck = { |
2561 | .name = "gpio3_fck", | 2561 | .name = "gpio3_dbck", |
2562 | .parent = &per_32k_alwon_fck, | 2562 | .parent = &per_32k_alwon_fck, |
2563 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | 2563 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), |
2564 | .enable_bit = OMAP3430_EN_GPIO3_SHIFT, | 2564 | .enable_bit = OMAP3430_EN_GPIO3_SHIFT, |
@@ -2567,8 +2567,8 @@ static struct clk gpio3_fck = { | |||
2567 | .recalc = &followparent_recalc, | 2567 | .recalc = &followparent_recalc, |
2568 | }; | 2568 | }; |
2569 | 2569 | ||
2570 | static struct clk gpio2_fck = { | 2570 | static struct clk gpio2_dbck = { |
2571 | .name = "gpio2_fck", | 2571 | .name = "gpio2_dbck", |
2572 | .parent = &per_32k_alwon_fck, | 2572 | .parent = &per_32k_alwon_fck, |
2573 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | 2573 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), |
2574 | .enable_bit = OMAP3430_EN_GPIO2_SHIFT, | 2574 | .enable_bit = OMAP3430_EN_GPIO2_SHIFT, |
@@ -3170,7 +3170,7 @@ static struct clk *onchip_34xx_clks[] __initdata = { | |||
3170 | &usim_fck, | 3170 | &usim_fck, |
3171 | &gpt1_fck, | 3171 | &gpt1_fck, |
3172 | &wkup_32k_fck, | 3172 | &wkup_32k_fck, |
3173 | &gpio1_fck, | 3173 | &gpio1_dbck, |
3174 | &wdt2_fck, | 3174 | &wdt2_fck, |
3175 | &wkup_l4_ick, | 3175 | &wkup_l4_ick, |
3176 | &usim_ick, | 3176 | &usim_ick, |
@@ -3192,11 +3192,11 @@ static struct clk *onchip_34xx_clks[] __initdata = { | |||
3192 | &gpt8_fck, | 3192 | &gpt8_fck, |
3193 | &gpt9_fck, | 3193 | &gpt9_fck, |
3194 | &per_32k_alwon_fck, | 3194 | &per_32k_alwon_fck, |
3195 | &gpio6_fck, | 3195 | &gpio6_dbck, |
3196 | &gpio5_fck, | 3196 | &gpio5_dbck, |
3197 | &gpio4_fck, | 3197 | &gpio4_dbck, |
3198 | &gpio3_fck, | 3198 | &gpio3_dbck, |
3199 | &gpio2_fck, | 3199 | &gpio2_dbck, |
3200 | &wdt3_fck, | 3200 | &wdt3_fck, |
3201 | &per_l4_ick, | 3201 | &per_l4_ick, |
3202 | &gpio6_ick, | 3202 | &gpio6_ick, |
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. |