Lines Matching full:gate
19 * DOC: basic gateable clock which can gate and ungate its output
42 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_enable() local
47 spin_lock_irqsave(gate->lock, flags); in clk_gate2_enable()
49 if (gate->share_count && (*gate->share_count)++ > 0) in clk_gate2_enable()
52 if (gate->flags & IMX_CLK_GATE2_SINGLE_BIT) { in clk_gate2_enable()
55 reg = readl(gate->reg); in clk_gate2_enable()
56 reg &= ~(3 << gate->bit_idx); in clk_gate2_enable()
57 reg |= gate->cgr_val << gate->bit_idx; in clk_gate2_enable()
58 writel(reg, gate->reg); in clk_gate2_enable()
62 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_enable()
69 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_disable() local
73 spin_lock_irqsave(gate->lock, flags); in clk_gate2_disable()
75 if (gate->share_count) { in clk_gate2_disable()
76 if (WARN_ON(*gate->share_count == 0)) in clk_gate2_disable()
78 else if (--(*gate->share_count) > 0) in clk_gate2_disable()
82 if (gate->flags & IMX_CLK_GATE2_SINGLE_BIT) { in clk_gate2_disable()
85 reg = readl(gate->reg); in clk_gate2_disable()
86 reg &= ~(3 << gate->bit_idx); in clk_gate2_disable()
87 writel(reg, gate->reg); in clk_gate2_disable()
91 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_disable()
106 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_is_enabled() local
108 if (gate->flags & IMX_CLK_GATE2_SINGLE_BIT) in clk_gate2_is_enabled()
111 return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); in clk_gate2_is_enabled()
116 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_disable_unused() local
120 if (gate->flags & IMX_CLK_GATE2_SINGLE_BIT) in clk_gate2_disable_unused()
123 spin_lock_irqsave(gate->lock, flags); in clk_gate2_disable_unused()
125 if (!gate->share_count || *gate->share_count == 0) { in clk_gate2_disable_unused()
126 reg = readl(gate->reg); in clk_gate2_disable_unused()
127 reg &= ~(3 << gate->bit_idx); in clk_gate2_disable_unused()
128 writel(reg, gate->reg); in clk_gate2_disable_unused()
131 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_disable_unused()
147 struct clk_gate2 *gate; in clk_hw_register_gate2() local
152 gate = kzalloc(sizeof(struct clk_gate2), GFP_KERNEL); in clk_hw_register_gate2()
153 if (!gate) in clk_hw_register_gate2()
157 gate->reg = reg; in clk_hw_register_gate2()
158 gate->bit_idx = bit_idx; in clk_hw_register_gate2()
159 gate->cgr_val = cgr_val; in clk_hw_register_gate2()
160 gate->flags = clk_gate2_flags; in clk_hw_register_gate2()
161 gate->lock = lock; in clk_hw_register_gate2()
162 gate->share_count = share_count; in clk_hw_register_gate2()
170 gate->hw.init = &init; in clk_hw_register_gate2()
171 hw = &gate->hw; in clk_hw_register_gate2()
175 kfree(gate); in clk_hw_register_gate2()