diff options
author | Rajeev Kulkarni <rajeevk@ti.com> | 2011-10-14 14:29:18 -0500 |
---|---|---|
committer | Todd Poynor <toddpoynor@google.com> | 2011-10-14 16:10:42 -0700 |
commit | 7dda06594aea2f29a66793e56f46471871e1b6cd (patch) | |
tree | 86a7bb854a6d9eeffa63ba1c088f05b326fb8b18 /drivers/gpio | |
parent | d4253a81faf3717685e23cc09f44fea19b556525 (diff) | |
download | kernel_samsung_tuna-7dda06594aea2f29a66793e56f46471871e1b6cd.zip kernel_samsung_tuna-7dda06594aea2f29a66793e56f46471871e1b6cd.tar.gz kernel_samsung_tuna-7dda06594aea2f29a66793e56f46471871e1b6cd.tar.bz2 |
OMAP4: Enable/Disable GPIO clocks before/after Regiter access.
On 4430 system was crashing in idle path while accessing
GPIO regiters w/o its clocks enabled. In Many platforms some banks
may not be used at all. Before acessing any GPIO bank register ensure
that the clocks are active. Once accessing is done disable the clocks.
Signed-off-by: Axel Haslem <axelhaslam@ti.com>
Signed-off-by: Rajeev Kulkarni <rajeevk@ti.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-omap.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 26231e2..71f4628 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1394,6 +1394,12 @@ void omap2_gpio_set_edge_wakeup(void) u32 level_high = 0; u32 wkup_status = 0; + if (IS_ERR_VALUE(pm_runtime_get_sync(bank->dev) < 0)) { + dev_err(bank->dev, "%s: GPIO bank %d pm_runtime_get_sync " + "failed\n", __func__, bank->id); + return; + } + level_low = __raw_readl(bank->base + bank->regs->leveldetect0); level_high = __raw_readl(bank->base + @@ -1411,10 +1417,15 @@ void omap2_gpio_set_edge_wakeup(void) * even if they are set for level detection only. */ __raw_writel(bank->context.edge_falling | (level_low & wkup_status), - (bank->base + bank->regs->fallingdetect)); + (bank->base + bank->regs->fallingdetect)); __raw_writel(bank->context.edge_rising | (level_high & wkup_status), - (bank->base + bank->regs->risingdetect)); + (bank->base + bank->regs->risingdetect)); + if (IS_ERR_VALUE(pm_runtime_put_sync_suspend(bank->dev) < 0)) { + dev_err(bank->dev, "%s: GPIO bank %d pm_runtime_put_sync " + "failed\n", __func__, bank->id); + return; + } } } @@ -1424,10 +1435,22 @@ void omap2_gpio_restore_edge_wakeup(void) list_for_each_entry(bank, &omap_gpio_list, node) { /* restore edge setting */ + if (IS_ERR_VALUE(pm_runtime_get_sync(bank->dev) < 0)) { + dev_err(bank->dev, "%s: GPIO bank %d pm_runtime_get_sync " + "failed\n", __func__, bank->id); + return; + } + __raw_writel(bank->context.edge_falling, - (bank->base + bank->regs->fallingdetect)); + (bank->base + bank->regs->fallingdetect)); __raw_writel(bank->context.edge_rising, - (bank->base + bank->regs->risingdetect)); + (bank->base + bank->regs->risingdetect)); + + if (IS_ERR_VALUE(pm_runtime_put_sync_suspend(bank->dev) < 0)) { + dev_err(bank->dev, "%s: GPIO bank %d pm_runtime_put_sync " + "failed\n", __func__, bank->id); + return; + } } } |