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>
This commit is contained in:
@@ -203,22 +203,30 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
|
|||||||
|
|
||||||
l = GPIO_BIT(bank, gpio);
|
l = GPIO_BIT(bank, gpio);
|
||||||
|
|
||||||
|
clk_enable(bank->dbck);
|
||||||
reg = bank->base + bank->regs->debounce;
|
reg = bank->base + bank->regs->debounce;
|
||||||
__raw_writel(debounce, reg);
|
__raw_writel(debounce, reg);
|
||||||
|
|
||||||
reg = bank->base + bank->regs->debounce_en;
|
reg = bank->base + bank->regs->debounce_en;
|
||||||
val = __raw_readl(reg);
|
val = __raw_readl(reg);
|
||||||
|
|
||||||
if (debounce) {
|
if (debounce)
|
||||||
val |= l;
|
val |= l;
|
||||||
clk_enable(bank->dbck);
|
else
|
||||||
} else {
|
|
||||||
val &= ~l;
|
val &= ~l;
|
||||||
clk_disable(bank->dbck);
|
|
||||||
}
|
|
||||||
bank->dbck_enable_mask = val;
|
bank->dbck_enable_mask = val;
|
||||||
|
|
||||||
__raw_writel(val, reg);
|
__raw_writel(val, reg);
|
||||||
|
clk_disable(bank->dbck);
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
_gpio_dbck_enable(bank);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio,
|
static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio,
|
||||||
|
Reference in New Issue
Block a user