diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2018-06-18 01:58:19 +0300 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.co.uk> | 2018-07-06 17:34:01 +0300 |
commit | ada1de89f34ea338fb4406e61dc1a95edcf65213 (patch) | |
tree | 7681518f0e847564245601a2c3fdbb4c697a1b2e /drivers/power/reset/gemini-poweroff.c | |
parent | 09bebb1adb21ecd04adf7ccb3b06f73e3a851e93 (diff) | |
download | linux-ada1de89f34ea338fb4406e61dc1a95edcf65213.tar.xz |
power: gemini-poweroff: Avoid more spurious poweroffs
Even after the previous fix I have experienced more spurious
poweroffs on the gemini SoC. After this fix it finally seems
to go away.
Fixes: f7a388d6cd1c ("power: reset: Add a driver for the Gemini poweroff")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/power/reset/gemini-poweroff.c')
-rw-r--r-- | drivers/power/reset/gemini-poweroff.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/power/reset/gemini-poweroff.c b/drivers/power/reset/gemini-poweroff.c index 2ac291af1265..90e35c07240a 100644 --- a/drivers/power/reset/gemini-poweroff.c +++ b/drivers/power/reset/gemini-poweroff.c @@ -130,7 +130,17 @@ static int gemini_poweroff_probe(struct platform_device *pdev) val |= GEMINI_CTRL_ENABLE; writel(val, gpw->base + GEMINI_PWC_CTRLREG); - /* Now that the state machine is active, clear the IRQ */ + /* Clear the IRQ */ + val = readl(gpw->base + GEMINI_PWC_CTRLREG); + val |= GEMINI_CTRL_IRQ_CLR; + writel(val, gpw->base + GEMINI_PWC_CTRLREG); + + /* Wait for this to clear */ + val = readl(gpw->base + GEMINI_PWC_STATREG); + while (val & 0x70U) + val = readl(gpw->base + GEMINI_PWC_STATREG); + + /* Clear the IRQ again */ val = readl(gpw->base + GEMINI_PWC_CTRLREG); val |= GEMINI_CTRL_IRQ_CLR; writel(val, gpw->base + GEMINI_PWC_CTRLREG); |