Lines Matching full:gate
17 * DOC: basic gatable clock which can gate and ungate it's ouput
26 static inline u32 clk_gate_readl(struct clk_gate *gate) in clk_gate_readl() argument
28 if (gate->flags & CLK_GATE_BIG_ENDIAN) in clk_gate_readl()
29 return ioread32be(gate->reg); in clk_gate_readl()
31 return readl(gate->reg); in clk_gate_readl()
34 static inline void clk_gate_writel(struct clk_gate *gate, u32 val) in clk_gate_writel() argument
36 if (gate->flags & CLK_GATE_BIG_ENDIAN) in clk_gate_writel()
37 iowrite32be(val, gate->reg); in clk_gate_writel()
39 writel(val, gate->reg); in clk_gate_writel()
57 struct clk_gate *gate = to_clk_gate(hw); in clk_gate_endisable() local
58 int set = gate->flags & CLK_GATE_SET_TO_DISABLE ? 1 : 0; in clk_gate_endisable()
64 if (gate->lock) in clk_gate_endisable()
65 spin_lock_irqsave(gate->lock, flags); in clk_gate_endisable()
67 __acquire(gate->lock); in clk_gate_endisable()
69 if (gate->flags & CLK_GATE_HIWORD_MASK) { in clk_gate_endisable()
70 reg = BIT(gate->bit_idx + 16); in clk_gate_endisable()
72 reg |= BIT(gate->bit_idx); in clk_gate_endisable()
74 reg = clk_gate_readl(gate); in clk_gate_endisable()
77 reg |= BIT(gate->bit_idx); in clk_gate_endisable()
79 reg &= ~BIT(gate->bit_idx); in clk_gate_endisable()
82 clk_gate_writel(gate, reg); in clk_gate_endisable()
84 if (gate->lock) in clk_gate_endisable()
85 spin_unlock_irqrestore(gate->lock, flags); in clk_gate_endisable()
87 __release(gate->lock); in clk_gate_endisable()
105 struct clk_gate *gate = to_clk_gate(hw); in clk_gate_is_enabled() local
107 reg = clk_gate_readl(gate); in clk_gate_is_enabled()
110 if (gate->flags & CLK_GATE_SET_TO_DISABLE) in clk_gate_is_enabled()
111 reg ^= BIT(gate->bit_idx); in clk_gate_is_enabled()
113 reg &= BIT(gate->bit_idx); in clk_gate_is_enabled()
134 struct clk_gate *gate; in __clk_hw_register_gate() local
141 pr_err("gate bit exceeds LOWORD field\n"); in __clk_hw_register_gate()
146 /* allocate the gate */ in __clk_hw_register_gate()
147 gate = kzalloc(sizeof(*gate), GFP_KERNEL); in __clk_hw_register_gate()
148 if (!gate) in __clk_hw_register_gate()
163 gate->reg = reg; in __clk_hw_register_gate()
164 gate->bit_idx = bit_idx; in __clk_hw_register_gate()
165 gate->flags = clk_gate_flags; in __clk_hw_register_gate()
166 gate->lock = lock; in __clk_hw_register_gate()
167 gate->hw.init = &init; in __clk_hw_register_gate()
169 hw = &gate->hw; in __clk_hw_register_gate()
175 kfree(gate); in __clk_hw_register_gate()
201 struct clk_gate *gate; in clk_unregister_gate() local
208 gate = to_clk_gate(hw); in clk_unregister_gate()
211 kfree(gate); in clk_unregister_gate()
217 struct clk_gate *gate; in clk_hw_unregister_gate() local
219 gate = to_clk_gate(hw); in clk_hw_unregister_gate()
222 kfree(gate); in clk_hw_unregister_gate()