clk: clk-gate: Create clk_gate_endisable()
authorViresh Kumar <viresh.kumar@st.com>
Tue, 17 Apr 2012 11:15:37 +0000 (16:45 +0530)
committerMike Turquette <mturquette@linaro.org>
Tue, 24 Apr 2012 23:37:40 +0000 (16:37 -0700)
commitfbc42aab543307e9bfc1dfb029db929f3fafcacd
treea9d86234545e39a1ce8fd69302c2b1ff85d292c7
parent1f73f31ad6e37df0679f6842b7405d96515ec8b1
clk: clk-gate: Create clk_gate_endisable()

This patch tries to remove duplicate code for clk_gate clocks. This creates
another routine clk_gate_endisable() which will take care of enable/disable
clock with knowledge of CLK_GATE_SET_TO_DISABLE flag.

It works on following logic:

For enabling clock, enable = 1
set2dis = 1 -> clear bit -> set = 0
set2dis = 0 -> set bit -> set = 1

For disabling clock, enable = 0
set2dis = 1 -> set bit -> set = 1
set2dis = 0 -> clear bit -> set = 0

So, result is always: enable xor set2dis.

Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
drivers/clk/clk-gate.c