Lines Matching refs:gate

41 	struct clk_gate2 *gate = to_clk_gate2(hw);  in clk_gate2_enable()  local
45 spin_lock_irqsave(gate->lock, flags); in clk_gate2_enable()
47 if (gate->share_count && (*gate->share_count)++ > 0) in clk_gate2_enable()
50 reg = readl(gate->reg); in clk_gate2_enable()
51 reg &= ~(3 << gate->bit_idx); in clk_gate2_enable()
52 reg |= gate->cgr_val << gate->bit_idx; in clk_gate2_enable()
53 writel(reg, gate->reg); in clk_gate2_enable()
56 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_enable()
63 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_disable() local
67 spin_lock_irqsave(gate->lock, flags); in clk_gate2_disable()
69 if (gate->share_count) { in clk_gate2_disable()
70 if (WARN_ON(*gate->share_count == 0)) in clk_gate2_disable()
72 else if (--(*gate->share_count) > 0) in clk_gate2_disable()
76 reg = readl(gate->reg); in clk_gate2_disable()
77 reg &= ~(3 << gate->bit_idx); in clk_gate2_disable()
78 writel(reg, gate->reg); in clk_gate2_disable()
81 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_disable()
96 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_is_enabled() local
98 return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); in clk_gate2_is_enabled()
103 struct clk_gate2 *gate = to_clk_gate2(hw); in clk_gate2_disable_unused() local
107 spin_lock_irqsave(gate->lock, flags); in clk_gate2_disable_unused()
109 if (!gate->share_count || *gate->share_count == 0) { in clk_gate2_disable_unused()
110 reg = readl(gate->reg); in clk_gate2_disable_unused()
111 reg &= ~(3 << gate->bit_idx); in clk_gate2_disable_unused()
112 writel(reg, gate->reg); in clk_gate2_disable_unused()
115 spin_unlock_irqrestore(gate->lock, flags); in clk_gate2_disable_unused()
131 struct clk_gate2 *gate; in clk_hw_register_gate2() local
136 gate = kzalloc(sizeof(struct clk_gate2), GFP_KERNEL); in clk_hw_register_gate2()
137 if (!gate) in clk_hw_register_gate2()
141 gate->reg = reg; in clk_hw_register_gate2()
142 gate->bit_idx = bit_idx; in clk_hw_register_gate2()
143 gate->cgr_val = cgr_val; in clk_hw_register_gate2()
144 gate->flags = clk_gate2_flags; in clk_hw_register_gate2()
145 gate->lock = lock; in clk_hw_register_gate2()
146 gate->share_count = share_count; in clk_hw_register_gate2()
154 gate->hw.init = &init; in clk_hw_register_gate2()
155 hw = &gate->hw; in clk_hw_register_gate2()
159 kfree(gate); in clk_hw_register_gate2()