Lines Matching full:gate

18  * DOC: basic gatable clock which can gate and ungate its output
27 static inline u32 clk_gate_readl(struct clk_gate *gate) in clk_gate_readl() argument
29 if (gate->flags & CLK_GATE_BIG_ENDIAN) in clk_gate_readl()
30 return ioread32be(gate->reg); in clk_gate_readl()
32 return readl(gate->reg); in clk_gate_readl()
35 static inline void clk_gate_writel(struct clk_gate *gate, u32 val) in clk_gate_writel() argument
37 if (gate->flags & CLK_GATE_BIG_ENDIAN) in clk_gate_writel()
38 iowrite32be(val, gate->reg); in clk_gate_writel()
40 writel(val, gate->reg); in clk_gate_writel()
58 struct clk_gate *gate = to_clk_gate(hw); in clk_gate_endisable() local
59 int set = gate->flags & CLK_GATE_SET_TO_DISABLE ? 1 : 0; in clk_gate_endisable()
65 if (gate->lock) in clk_gate_endisable()
66 spin_lock_irqsave(gate->lock, flags); in clk_gate_endisable()
68 __acquire(gate->lock); in clk_gate_endisable()
70 if (gate->flags & CLK_GATE_HIWORD_MASK) { in clk_gate_endisable()
71 reg = BIT(gate->bit_idx + 16); in clk_gate_endisable()
73 reg |= BIT(gate->bit_idx); in clk_gate_endisable()
75 reg = clk_gate_readl(gate); in clk_gate_endisable()
78 reg |= BIT(gate->bit_idx); in clk_gate_endisable()
80 reg &= ~BIT(gate->bit_idx); in clk_gate_endisable()
83 clk_gate_writel(gate, reg); in clk_gate_endisable()
85 if (gate->lock) in clk_gate_endisable()
86 spin_unlock_irqrestore(gate->lock, flags); in clk_gate_endisable()
88 __release(gate->lock); in clk_gate_endisable()
106 struct clk_gate *gate = to_clk_gate(hw); in clk_gate_is_enabled() local
108 reg = clk_gate_readl(gate); in clk_gate_is_enabled()
111 if (gate->flags & CLK_GATE_SET_TO_DISABLE) in clk_gate_is_enabled()
112 reg ^= BIT(gate->bit_idx); in clk_gate_is_enabled()
114 reg &= BIT(gate->bit_idx); in clk_gate_is_enabled()
135 struct clk_gate *gate; in __clk_hw_register_gate() local
142 pr_err("gate bit exceeds LOWORD field\n"); in __clk_hw_register_gate()
147 /* allocate the gate */ in __clk_hw_register_gate()
148 gate = kzalloc(sizeof(*gate), GFP_KERNEL); in __clk_hw_register_gate()
149 if (!gate) in __clk_hw_register_gate()
164 gate->reg = reg; in __clk_hw_register_gate()
165 gate->bit_idx = bit_idx; in __clk_hw_register_gate()
166 gate->flags = clk_gate_flags; in __clk_hw_register_gate()
167 gate->lock = lock; in __clk_hw_register_gate()
168 gate->hw.init = &init; in __clk_hw_register_gate()
170 hw = &gate->hw; in __clk_hw_register_gate()
176 kfree(gate); in __clk_hw_register_gate()
202 struct clk_gate *gate; in clk_unregister_gate() local
209 gate = to_clk_gate(hw); in clk_unregister_gate()
212 kfree(gate); in clk_unregister_gate()
218 struct clk_gate *gate; in clk_hw_unregister_gate() local
220 gate = to_clk_gate(hw); in clk_hw_unregister_gate()
223 kfree(gate); in clk_hw_unregister_gate()