Lines Matching refs:gate
43 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 reg = readl(gate->reg); in clk_gate2_enable()
53 reg |= 3 << gate->bit_idx; in clk_gate2_enable()
54 writel(reg, gate->reg); in clk_gate2_enable()
57 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_enable()
64 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_disable() local
68 spin_lock_irqsave(gate->lock, flags); in clk_gate2_disable()
70 if (gate->share_count) { in clk_gate2_disable()
71 if (WARN_ON(*gate->share_count == 0)) in clk_gate2_disable()
73 else if (--(*gate->share_count) > 0) in clk_gate2_disable()
77 reg = readl(gate->reg); in clk_gate2_disable()
78 reg &= ~(3 << gate->bit_idx); in clk_gate2_disable()
79 writel(reg, gate->reg); in clk_gate2_disable()
82 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_disable()
97 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_is_enabled() local
99 return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); in clk_gate2_is_enabled()
104 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_disable_unused() local
108 spin_lock_irqsave(gate->lock, flags); in clk_gate2_disable_unused()
110 if (!gate->share_count || *gate->share_count == 0) { in clk_gate2_disable_unused()
111 reg = readl(gate->reg); in clk_gate2_disable_unused()
112 reg &= ~(3 << gate->bit_idx); in clk_gate2_disable_unused()
113 writel(reg, gate->reg); in clk_gate2_disable_unused()
116 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_disable_unused()
132 struct clk_gate2 *gate; in clk_register_gate2() local
136 gate = kzalloc(sizeof(struct clk_gate2), GFP_KERNEL); in clk_register_gate2()
137 if (!gate) in clk_register_gate2()
141 gate->reg = reg; in clk_register_gate2()
142 gate->bit_idx = bit_idx; in clk_register_gate2()
143 gate->flags = clk_gate2_flags; in clk_register_gate2()
144 gate->lock = lock; in clk_register_gate2()
145 gate->share_count = share_count; in clk_register_gate2()
153 gate->hw.init = &init; in clk_register_gate2()
155 clk = clk_register(dev, &gate->hw); in clk_register_gate2()
157 kfree(gate); in clk_register_gate2()