Lines Matching +full:clk +full:- +full:gate
1 // SPDX-License-Identifier: GPL-2.0-only
11 #include <linux/clk-provider.h>
30 struct visconti_clk_gate *gate = to_visconti_clk_gate(hw); in visconti_gate_clk_is_enabled() local
31 u32 clk = BIT(gate->ck_idx); in visconti_gate_clk_is_enabled() local
34 regmap_read(gate->regmap, gate->ckon_offset, &val); in visconti_gate_clk_is_enabled()
35 return (val & clk) ? 1 : 0; in visconti_gate_clk_is_enabled()
40 struct visconti_clk_gate *gate = to_visconti_clk_gate(hw); in visconti_gate_clk_disable() local
41 u32 clk = BIT(gate->ck_idx); in visconti_gate_clk_disable() local
44 spin_lock_irqsave(gate->lock, flags); in visconti_gate_clk_disable()
47 spin_unlock_irqrestore(gate->lock, flags); in visconti_gate_clk_disable()
51 regmap_update_bits(gate->regmap, gate->ckoff_offset, clk, clk); in visconti_gate_clk_disable()
52 spin_unlock_irqrestore(gate->lock, flags); in visconti_gate_clk_disable()
57 struct visconti_clk_gate *gate = to_visconti_clk_gate(hw); in visconti_gate_clk_enable() local
58 u32 clk = BIT(gate->ck_idx); in visconti_gate_clk_enable() local
61 spin_lock_irqsave(gate->lock, flags); in visconti_gate_clk_enable()
62 regmap_update_bits(gate->regmap, gate->ckon_offset, clk, clk); in visconti_gate_clk_enable()
63 spin_unlock_irqrestore(gate->lock, flags); in visconti_gate_clk_enable()
84 struct visconti_clk_gate *gate; in visconti_clk_register_gate() local
92 return ERR_PTR(-ENOMEM); in visconti_clk_register_gate()
94 pdata->name = pdata->fw_name = parent_name; in visconti_clk_register_gate()
96 gate = devm_kzalloc(dev, sizeof(*gate), GFP_KERNEL); in visconti_clk_register_gate()
97 if (!gate) in visconti_clk_register_gate()
98 return ERR_PTR(-ENOMEM); in visconti_clk_register_gate()
102 init.flags = clks->flags; in visconti_clk_register_gate()
106 gate->regmap = regmap; in visconti_clk_register_gate()
107 gate->ckon_offset = clks->ckon_offset; in visconti_clk_register_gate()
108 gate->ckoff_offset = clks->ckoff_offset; in visconti_clk_register_gate()
109 gate->ck_idx = clks->ck_idx; in visconti_clk_register_gate()
110 gate->rson_offset = rson_offset; in visconti_clk_register_gate()
111 gate->rsoff_offset = rsoff_offset; in visconti_clk_register_gate()
112 gate->rs_idx = rs_idx; in visconti_clk_register_gate()
113 gate->lock = lock; in visconti_clk_register_gate()
114 gate->hw.init = &init; in visconti_clk_register_gate()
116 hw = &gate->hw; in visconti_clk_register_gate()
130 struct device *dev = ctx->dev; in visconti_clk_register_gates()
144 return -ENOMEM; in visconti_clk_register_gates()
148 return -ENOMEM; in visconti_clk_register_gates()
155 rson_offset = rsoff_offset = rs_idx = -1; in visconti_clk_register_gates()
169 ctx->regmap, in visconti_clk_register_gates()
181 ctx->clk_data.hws[clks[i].id] = gate_clk; in visconti_clk_register_gates()
196 return ERR_PTR(-ENOMEM); in visconti_init_clk()
199 ctx->clk_data.hws[i] = ERR_PTR(-ENOENT); in visconti_init_clk()
200 ctx->clk_data.num = nr_clks; in visconti_init_clk()
202 ctx->dev = dev; in visconti_init_clk()
203 ctx->regmap = regmap; in visconti_init_clk()