msm: clock: Add hardware gating support to branch clocks
Add support for hardware clock gating on branch clocks. Do this
in a few steps:
o At clock registration time, check to see if the branch is not
in hardware gated mode and fix up the branch data structure
as appropriate
o When a clk_reset() is asserted take the branch out of
hardware control so the reset can propagate if the clock
is enabled
o When a clk_reset() is deasserted put the branch back into
hardware control
Add three new ops to the clk_ops structure to support the above.
void (*enable_hwcg)(struct clk *clk);
void (*disable_hwcg)(struct clk *clk);
int (*in_hwcg_mode)(struct clk *clk);
{enable,disable}_hwcg() should enable and disable hardware clock
gating if possible. in_hwcg_mode() should return either a
non-zero value or a zero indicating whether the clock is
currently in hardware gating mode or not in hardware gating mode
respectively.
Use in_hwcg_mode() to detect when to skip the halt checks for a
branch and when to disable/enable hardware gating mode while
measuring clocks. This is particularly important for measurement
because we don't want to put a clock into hardware gating mode
accidentally after we measure the clock if the clock wasn't in
hardware gating mode to begin with.
Also expose a debugfs node indicating whether or not this clock
supports hardware gating. This should aid in debugging problems
due to hardware gating.
Change-Id: Id9b2d83adcc6dabe2544f48ef0b4d752d9a5c5c1
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
5 files changed