msm: clock: Rewrite clock handoff support
The previous handoff implementation had two limitations:
1) Handed-off clocks are left in the prepared state forever since
only the enable count is handed-off during clk_enable().
2) The clock will turn off when the first driver that uses it
calls clk_disable(). This is a problem if two drivers share
a clock and both depend on it being enabled they have
initialized and asserted their own votes for it.
Resolve both of these with a new handoff implementation that
leaves all clocks that were handed off (ex. handoff functions
returned HANDOFF_ENABLED_CLK) both prepared and enabled until
lateinit. As a consequence, handed-off clocks cannot be disabled
until then.
To avoid causing problems for the GFX2D cores, CLKFLAG_SKIP_HANDOFF
is introduced to prevent handoff of GFX2D clocks. This is required
because the footswitch-8x60 driver requires these clocks be off at
some points during boot while it asserts asynchronous resets to
the cores. If handoff was allowed to hold these clocks on, these
resets would fail.
Change-Id: I1ca7af6bed58e595cdad77923ea0614f456617ab
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-8x60.c b/arch/arm/mach-msm/clock-8x60.c
index 975587d..74d71a2 100644
--- a/arch/arm/mach-msm/clock-8x60.c
+++ b/arch/arm/mach-msm/clock-8x60.c
@@ -700,6 +700,7 @@
.c = {
.dbg_name = "gfx2d0_p_clk",
.ops = &clk_ops_branch,
+ .flags = CLKFLAG_SKIP_HANDOFF,
CLK_INIT(gfx2d0_p_clk.c),
},
};
@@ -716,6 +717,7 @@
.c = {
.dbg_name = "gfx2d1_p_clk",
.ops = &clk_ops_branch,
+ .flags = CLKFLAG_SKIP_HANDOFF,
CLK_INIT(gfx2d1_p_clk.c),
},
};
@@ -2178,6 +2180,7 @@
.c = {
.dbg_name = "gfx2d0_clk",
.ops = &clk_ops_rcg,
+ .flags = CLKFLAG_SKIP_HANDOFF,
VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
HIGH, 228571000),
CLK_INIT(gfx2d0_clk.c),
@@ -2222,6 +2225,7 @@
.c = {
.dbg_name = "gfx2d1_clk",
.ops = &clk_ops_rcg,
+ .flags = CLKFLAG_SKIP_HANDOFF,
VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
HIGH, 228571000),
CLK_INIT(gfx2d1_clk.c),