Lines Matching full:gate

49 	struct imx93_clk_gate *gate = to_imx93_clk_gate(hw);  in imx93_clk_gate_do_hardware()  local
52 val = readl(gate->reg + AUTHEN_OFFSET); in imx93_clk_gate_do_hardware()
55 writel(val, gate->reg + LPM_CUR_OFFSET); in imx93_clk_gate_do_hardware()
57 val = readl(gate->reg + DIRECT_OFFSET); in imx93_clk_gate_do_hardware()
58 val &= ~(gate->mask << gate->bit_idx); in imx93_clk_gate_do_hardware()
60 val |= (gate->val & gate->mask) << gate->bit_idx; in imx93_clk_gate_do_hardware()
61 writel(val, gate->reg + DIRECT_OFFSET); in imx93_clk_gate_do_hardware()
67 struct imx93_clk_gate *gate = to_imx93_clk_gate(hw); in imx93_clk_gate_enable() local
70 spin_lock_irqsave(gate->lock, flags); in imx93_clk_gate_enable()
72 if (gate->share_count && (*gate->share_count)++ > 0) in imx93_clk_gate_enable()
77 spin_unlock_irqrestore(gate->lock, flags); in imx93_clk_gate_enable()
84 struct imx93_clk_gate *gate = to_imx93_clk_gate(hw); in imx93_clk_gate_disable() local
87 spin_lock_irqsave(gate->lock, flags); in imx93_clk_gate_disable()
89 if (gate->share_count) { in imx93_clk_gate_disable()
90 if (WARN_ON(*gate->share_count == 0)) in imx93_clk_gate_disable()
92 else if (--(*gate->share_count) > 0) in imx93_clk_gate_disable()
98 spin_unlock_irqrestore(gate->lock, flags); in imx93_clk_gate_disable()
101 static int imx93_clk_gate_reg_is_enabled(struct imx93_clk_gate *gate) in imx93_clk_gate_reg_is_enabled() argument
103 u32 val = readl(gate->reg + AUTHEN_OFFSET); in imx93_clk_gate_reg_is_enabled()
106 val = readl(gate->reg + LPM_CUR_OFFSET); in imx93_clk_gate_reg_is_enabled()
110 val = readl(gate->reg); in imx93_clk_gate_reg_is_enabled()
111 if (((val >> gate->bit_idx) & gate->mask) == gate->val) in imx93_clk_gate_reg_is_enabled()
120 struct imx93_clk_gate *gate = to_imx93_clk_gate(hw); in imx93_clk_gate_is_enabled() local
124 spin_lock_irqsave(gate->lock, flags); in imx93_clk_gate_is_enabled()
126 ret = imx93_clk_gate_reg_is_enabled(gate); in imx93_clk_gate_is_enabled()
128 spin_unlock_irqrestore(gate->lock, flags); in imx93_clk_gate_is_enabled()
135 struct imx93_clk_gate *gate = to_imx93_clk_gate(hw); in imx93_clk_gate_disable_unused() local
138 spin_lock_irqsave(gate->lock, flags); in imx93_clk_gate_disable_unused()
140 if (!gate->share_count || *gate->share_count == 0) in imx93_clk_gate_disable_unused()
143 spin_unlock_irqrestore(gate->lock, flags); in imx93_clk_gate_disable_unused()
161 struct imx93_clk_gate *gate; in imx93_clk_gate() local
167 gate = kzalloc(sizeof(struct imx93_clk_gate), GFP_KERNEL); in imx93_clk_gate()
168 if (!gate) in imx93_clk_gate()
171 gate->reg = reg; in imx93_clk_gate()
172 gate->lock = &imx_ccm_lock; in imx93_clk_gate()
173 gate->bit_idx = bit_idx; in imx93_clk_gate()
174 gate->val = val; in imx93_clk_gate()
175 gate->mask = mask; in imx93_clk_gate()
176 gate->share_count = share_count; in imx93_clk_gate()
184 gate->hw.init = &init; in imx93_clk_gate()
185 hw = &gate->hw; in imx93_clk_gate()
193 kfree(gate); in imx93_clk_gate()