Lines Matching +full:- +full:clk

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Tero Kristo <t-kristo@ti.com>
10 #include <linux/clk-provider.h>
15 #include <linux/clk/ti.h>
32 * we have some non-atomic read/write
39 static int _omap2_clk_deny_idle(struct clk_hw_omap *clk) in _omap2_clk_deny_idle() argument
41 if (clk->ops && clk->ops->deny_idle) { in _omap2_clk_deny_idle()
45 clk->autoidle_count++; in _omap2_clk_deny_idle()
46 if (clk->autoidle_count == 1) in _omap2_clk_deny_idle()
47 clk->ops->deny_idle(clk); in _omap2_clk_deny_idle()
54 static int _omap2_clk_allow_idle(struct clk_hw_omap *clk) in _omap2_clk_allow_idle() argument
56 if (clk->ops && clk->ops->allow_idle) { in _omap2_clk_allow_idle()
60 clk->autoidle_count--; in _omap2_clk_allow_idle()
61 if (clk->autoidle_count == 0) in _omap2_clk_allow_idle()
62 clk->ops->allow_idle(clk); in _omap2_clk_allow_idle()
70 * omap2_clk_deny_idle - disable autoidle on an OMAP clock
71 * @clk: struct clk * to disable autoidle for
75 int omap2_clk_deny_idle(struct clk *clk) in omap2_clk_deny_idle() argument
79 if (!clk) in omap2_clk_deny_idle()
80 return -EINVAL; in omap2_clk_deny_idle()
82 hw = __clk_get_hw(clk); in omap2_clk_deny_idle()
90 return -EINVAL; in omap2_clk_deny_idle()
94 * omap2_clk_allow_idle - enable autoidle on an OMAP clock
95 * @clk: struct clk * to enable autoidle for
99 int omap2_clk_allow_idle(struct clk *clk) in omap2_clk_allow_idle() argument
103 if (!clk) in omap2_clk_allow_idle()
104 return -EINVAL; in omap2_clk_allow_idle()
106 hw = __clk_get_hw(clk); in omap2_clk_allow_idle()
114 return -EINVAL; in omap2_clk_allow_idle()
117 static void _allow_autoidle(struct clk_ti_autoidle *clk) in _allow_autoidle() argument
121 val = ti_clk_ll_ops->clk_readl(&clk->reg); in _allow_autoidle()
123 if (clk->flags & AUTOIDLE_LOW) in _allow_autoidle()
124 val &= ~(1 << clk->shift); in _allow_autoidle()
126 val |= (1 << clk->shift); in _allow_autoidle()
128 ti_clk_ll_ops->clk_writel(val, &clk->reg); in _allow_autoidle()
131 static void _deny_autoidle(struct clk_ti_autoidle *clk) in _deny_autoidle() argument
135 val = ti_clk_ll_ops->clk_readl(&clk->reg); in _deny_autoidle()
137 if (clk->flags & AUTOIDLE_LOW) in _deny_autoidle()
138 val |= (1 << clk->shift); in _deny_autoidle()
140 val &= ~(1 << clk->shift); in _deny_autoidle()
142 ti_clk_ll_ops->clk_writel(val, &clk->reg); in _deny_autoidle()
146 * _clk_generic_allow_autoidle_all - enable autoidle for all clocks
160 * _clk_generic_deny_autoidle_all - disable autoidle for all clocks
174 * of_ti_clk_autoidle_setup - sets up hardware autoidle for a clock
178 * for presence of 'ti,autoidle-shift' property in the device tree
187 struct clk_ti_autoidle *clk; in of_ti_clk_autoidle_setup() local
191 if (of_property_read_u32(node, "ti,autoidle-shift", &shift)) in of_ti_clk_autoidle_setup()
194 clk = kzalloc(sizeof(*clk), GFP_KERNEL); in of_ti_clk_autoidle_setup()
196 if (!clk) in of_ti_clk_autoidle_setup()
197 return -ENOMEM; in of_ti_clk_autoidle_setup()
199 clk->shift = shift; in of_ti_clk_autoidle_setup()
200 clk->name = ti_dt_clk_name(node); in of_ti_clk_autoidle_setup()
201 ret = ti_clk_get_reg_addr(node, 0, &clk->reg); in of_ti_clk_autoidle_setup()
203 kfree(clk); in of_ti_clk_autoidle_setup()
207 if (of_property_read_bool(node, "ti,invert-autoidle-bit")) in of_ti_clk_autoidle_setup()
208 clk->flags |= AUTOIDLE_LOW; in of_ti_clk_autoidle_setup()
210 list_add(&clk->node, &autoidle_clks); in of_ti_clk_autoidle_setup()
216 * omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that
238 * omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that