Lines Matching full:gate
3 * mmp gate clock operation source file
26 struct mmp_clk_gate *gate = to_clk_mmp_gate(hw); in mmp_clk_gate_enable() local
31 if (gate->lock) in mmp_clk_gate_enable()
32 spin_lock_irqsave(gate->lock, flags); in mmp_clk_gate_enable()
34 tmp = readl(gate->reg); in mmp_clk_gate_enable()
35 tmp &= ~gate->mask; in mmp_clk_gate_enable()
36 tmp |= gate->val_enable; in mmp_clk_gate_enable()
37 writel(tmp, gate->reg); in mmp_clk_gate_enable()
39 if (gate->lock) in mmp_clk_gate_enable()
40 spin_unlock_irqrestore(gate->lock, flags); in mmp_clk_gate_enable()
42 if (gate->flags & MMP_CLK_GATE_NEED_DELAY) { in mmp_clk_gate_enable()
53 struct mmp_clk_gate *gate = to_clk_mmp_gate(hw); in mmp_clk_gate_disable() local
57 if (gate->lock) in mmp_clk_gate_disable()
58 spin_lock_irqsave(gate->lock, flags); in mmp_clk_gate_disable()
60 tmp = readl(gate->reg); in mmp_clk_gate_disable()
61 tmp &= ~gate->mask; in mmp_clk_gate_disable()
62 tmp |= gate->val_disable; in mmp_clk_gate_disable()
63 writel(tmp, gate->reg); in mmp_clk_gate_disable()
65 if (gate->lock) in mmp_clk_gate_disable()
66 spin_unlock_irqrestore(gate->lock, flags); in mmp_clk_gate_disable()
71 struct mmp_clk_gate *gate = to_clk_mmp_gate(hw); in mmp_clk_gate_is_enabled() local
75 if (gate->lock) in mmp_clk_gate_is_enabled()
76 spin_lock_irqsave(gate->lock, flags); in mmp_clk_gate_is_enabled()
78 tmp = readl(gate->reg); in mmp_clk_gate_is_enabled()
80 if (gate->lock) in mmp_clk_gate_is_enabled()
81 spin_unlock_irqrestore(gate->lock, flags); in mmp_clk_gate_is_enabled()
83 return (tmp & gate->mask) == gate->val_enable; in mmp_clk_gate_is_enabled()
97 struct mmp_clk_gate *gate; in mmp_clk_register_gate() local
101 /* allocate the gate */ in mmp_clk_register_gate()
102 gate = kzalloc(sizeof(*gate), GFP_KERNEL); in mmp_clk_register_gate()
103 if (!gate) in mmp_clk_register_gate()
113 gate->reg = reg; in mmp_clk_register_gate()
114 gate->mask = mask; in mmp_clk_register_gate()
115 gate->val_enable = val_enable; in mmp_clk_register_gate()
116 gate->val_disable = val_disable; in mmp_clk_register_gate()
117 gate->flags = gate_flags; in mmp_clk_register_gate()
118 gate->lock = lock; in mmp_clk_register_gate()
119 gate->hw.init = &init; in mmp_clk_register_gate()
121 clk = clk_register(dev, &gate->hw); in mmp_clk_register_gate()
124 kfree(gate); in mmp_clk_register_gate()