Lines Matching refs:gate

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