Lines Matching full:gate
21 * DOC: basic gatable clock which can gate and ungate it's ouput
44 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_enable() local
48 spin_lock_irqsave(gate->lock, flags); in clk_gate2_enable()
50 if (gate->share_count && (*gate->share_count)++ > 0) in clk_gate2_enable()
53 reg = readl(gate->reg); in clk_gate2_enable()
54 reg &= ~(3 << gate->bit_idx); in clk_gate2_enable()
55 reg |= gate->cgr_val << gate->bit_idx; in clk_gate2_enable()
56 writel(reg, gate->reg); in clk_gate2_enable()
59 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_enable()
66 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_disable() local
70 spin_lock_irqsave(gate->lock, flags); in clk_gate2_disable()
72 if (gate->share_count) { in clk_gate2_disable()
73 if (WARN_ON(*gate->share_count == 0)) in clk_gate2_disable()
75 else if (--(*gate->share_count) > 0) in clk_gate2_disable()
79 reg = readl(gate->reg); in clk_gate2_disable()
80 reg &= ~(3 << gate->bit_idx); in clk_gate2_disable()
81 writel(reg, gate->reg); in clk_gate2_disable()
84 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_disable()
99 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_is_enabled() local
101 return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); in clk_gate2_is_enabled()
106 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_disable_unused() local
110 spin_lock_irqsave(gate->lock, flags); in clk_gate2_disable_unused()
112 if (!gate->share_count || *gate->share_count == 0) { in clk_gate2_disable_unused()
113 reg = readl(gate->reg); in clk_gate2_disable_unused()
114 reg &= ~(3 << gate->bit_idx); in clk_gate2_disable_unused()
115 writel(reg, gate->reg); in clk_gate2_disable_unused()
118 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_disable_unused()
134 struct clk_gate2 *gate; in clk_register_gate2() local
138 gate = kzalloc(sizeof(struct clk_gate2), GFP_KERNEL); in clk_register_gate2()
139 if (!gate) in clk_register_gate2()
143 gate->reg = reg; in clk_register_gate2()
144 gate->bit_idx = bit_idx; in clk_register_gate2()
145 gate->cgr_val = cgr_val; in clk_register_gate2()
146 gate->flags = clk_gate2_flags; in clk_register_gate2()
147 gate->lock = lock; in clk_register_gate2()
148 gate->share_count = share_count; in clk_register_gate2()
156 gate->hw.init = &init; in clk_register_gate2()
158 clk = clk_register(dev, &gate->hw); in clk_register_gate2()
160 kfree(gate); in clk_register_gate2()