aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-omap.c
diff options
context:
space:
mode:
authorTarun Kanti DebBarma <tarun.kanti@ti.com>2011-11-23 17:28:54 -0500
committerTarun Kanti DebBarma <tarun.kanti@ti.com>2012-02-06 06:11:45 -0500
commit6fd9c421649961a9d6d30b149e0128dde1b806b4 (patch)
tree52f347eb9d42eb1445a506443a6f1f25ee9ec0db /drivers/gpio/gpio-omap.c
parent72f83af99838bb663f85b65386db5b875748f379 (diff)
gpio/omap: fix incorrect access of debounce module
Enable debounce clock before writing/reading debounce registers. Disable the clock at the end so that it is synchronized with the pm_runtime_get/put_sync calls. Enable debounce clock per module. This call is mandatory because in omap_gpio_request() when *_runtime_get_sync() is called, _gpio_dbck_enable() within runtime callbck fails to turn on dbck because dbck_enable_mask used within _gpio_dbck_enable() is still not initialized at that point. Therefore we have to enable dbck here. Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Reviewed-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r--drivers/gpio/gpio-omap.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 69e61aecab71..8aeb8dd4342b 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -203,22 +203,30 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
203 203
204 l = GPIO_BIT(bank, gpio); 204 l = GPIO_BIT(bank, gpio);
205 205
206 clk_enable(bank->dbck);
206 reg = bank->base + bank->regs->debounce; 207 reg = bank->base + bank->regs->debounce;
207 __raw_writel(debounce, reg); 208 __raw_writel(debounce, reg);
208 209
209 reg = bank->base + bank->regs->debounce_en; 210 reg = bank->base + bank->regs->debounce_en;
210 val = __raw_readl(reg); 211 val = __raw_readl(reg);
211 212
212 if (debounce) { 213 if (debounce)
213 val |= l; 214 val |= l;
214 clk_enable(bank->dbck); 215 else
215 } else {
216 val &= ~l; 216 val &= ~l;
217 clk_disable(bank->dbck);
218 }
219 bank->dbck_enable_mask = val; 217 bank->dbck_enable_mask = val;
220 218
221 __raw_writel(val, reg); 219 __raw_writel(val, reg);
220 clk_disable(bank->dbck);
221 /*
222 * Enable debounce clock per module.
223 * This call is mandatory because in omap_gpio_request() when
224 * *_runtime_get_sync() is called, _gpio_dbck_enable() within
225 * runtime callbck fails to turn on dbck because dbck_enable_mask
226 * used within _gpio_dbck_enable() is still not initialized at
227 * that point. Therefore we have to enable dbck here.
228 */
229 _gpio_dbck_enable(bank);
222} 230}
223 231
224static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, 232static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio,