Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Linus Walleij and committed by
Sebastian Reichel
ada1de89 09bebb1a

+11 -1
+11 -1
drivers/power/reset/gemini-poweroff.c
··· 130 130 val |= GEMINI_CTRL_ENABLE; 131 131 writel(val, gpw->base + GEMINI_PWC_CTRLREG); 132 132 133 - /* Now that the state machine is active, clear the IRQ */ 133 + /* Clear the IRQ */ 134 + val = readl(gpw->base + GEMINI_PWC_CTRLREG); 135 + val |= GEMINI_CTRL_IRQ_CLR; 136 + writel(val, gpw->base + GEMINI_PWC_CTRLREG); 137 + 138 + /* Wait for this to clear */ 139 + val = readl(gpw->base + GEMINI_PWC_STATREG); 140 + while (val & 0x70U) 141 + val = readl(gpw->base + GEMINI_PWC_STATREG); 142 + 143 + /* Clear the IRQ again */ 134 144 val = readl(gpw->base + GEMINI_PWC_CTRLREG); 135 145 val |= GEMINI_CTRL_IRQ_CLR; 136 146 writel(val, gpw->base + GEMINI_PWC_CTRLREG);