diff options
author | David S. Miller <davem@davemloft.net> | 2015-02-18 05:48:51 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-18 05:48:51 +0300 |
commit | fece13ca005a5f559147e9424321f4b5e01272b4 (patch) | |
tree | 54e762e70afb664d14152e6bcf89a48be3fb9c13 /arch/arm/mach-imx/clk-gate2.c | |
parent | 855e7e7174bade3f2b63077a81eea5aab525dbf6 (diff) | |
parent | f5af19d10d151c5a2afae3306578f485c244db25 (diff) | |
download | linux-fece13ca005a5f559147e9424321f4b5e01272b4.tar.xz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'arch/arm/mach-imx/clk-gate2.c')
-rw-r--r-- | arch/arm/mach-imx/clk-gate2.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c index 5a75cdc81891..8935bff99fe7 100644 --- a/arch/arm/mach-imx/clk-gate2.c +++ b/arch/arm/mach-imx/clk-gate2.c @@ -96,15 +96,30 @@ static int clk_gate2_is_enabled(struct clk_hw *hw) { struct clk_gate2 *gate = to_clk_gate2(hw); - if (gate->share_count) - return !!__clk_get_enable_count(hw->clk); - else - return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); + return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); +} + +static void clk_gate2_disable_unused(struct clk_hw *hw) +{ + struct clk_gate2 *gate = to_clk_gate2(hw); + unsigned long flags = 0; + u32 reg; + + spin_lock_irqsave(gate->lock, flags); + + if (!gate->share_count || *gate->share_count == 0) { + reg = readl(gate->reg); + reg &= ~(3 << gate->bit_idx); + writel(reg, gate->reg); + } + + spin_unlock_irqrestore(gate->lock, flags); } static struct clk_ops clk_gate2_ops = { .enable = clk_gate2_enable, .disable = clk_gate2_disable, + .disable_unused = clk_gate2_disable_unused, .is_enabled = clk_gate2_is_enabled, }; |