linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: vf610: don't stop enabled clocks in suspend
@ 2015-10-16 14:51 Sergei Miroshnichenko
  2015-10-16 19:46 ` Stefan Agner
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Miroshnichenko @ 2015-10-16 14:51 UTC (permalink / raw)
  To: linux-arm-kernel

Currently Vybrid Clock Gating is configured to turn off all clocks in stop
mode, while kernel assumes them enabled unless explicitly disabled. This
behavior prevents waking up from wakeup sources.

Fix this by replacing Clock Gating Register bitmask 3 (Clock is on during
all modes, except stop mode) with bitmask 2 (Clock is on during all modes,
even stop mode): refer to Vybrid Reference Manual Chapter 10 "Clock
Controller Module (CCM)".

Tested on a VF610-based board.

Signed-off-by: Sergei Miroshnichenko <sergeimir@emcraft.com>
---
 drivers/clk/imx/clk-gate2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/imx/clk-gate2.c b/drivers/clk/imx/clk-gate2.c
index 8935bff..ac35d75 100644
--- a/drivers/clk/imx/clk-gate2.c
+++ b/drivers/clk/imx/clk-gate2.c
@@ -50,7 +50,8 @@ static int clk_gate2_enable(struct clk_hw *hw)
 		goto out;
 
 	reg = readl(gate->reg);
-	reg |= 3 << gate->bit_idx;
+	reg &= ~(3 << gate->bit_idx);
+	reg |= 2 << gate->bit_idx;
 	writel(reg, gate->reg);
 
 out:
@@ -86,7 +87,7 @@ static int clk_gate2_reg_is_enabled(void __iomem *reg, u8 bit_idx)
 {
 	u32 val = readl(reg);
 
-	if (((val >> bit_idx) & 1) == 1)
+	if (((val >> bit_idx) & 3) == 2)
 		return 1;
 
 	return 0;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-26  7:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-16 14:51 [PATCH] clk: vf610: don't stop enabled clocks in suspend Sergei Miroshnichenko
2015-10-16 19:46 ` Stefan Agner
2015-10-19  5:53   ` Sergei Miroshnichenko
2015-10-23 23:53     ` Stefan Agner
2015-10-26  7:07       ` Sergei Miroshnichenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).