Lines Matching +full:composite +full:- +full:divider +full:- +full:clock

1 // SPDX-License-Identifier: GPL-2.0-only
3 * TI composite clock support
7 * Tero Kristo <t-kristo@ti.com>
10 #include <linux/clk-provider.h>
18 #include "clock.h"
32 return -EINVAL; in ti_composite_round_rate()
38 return -EINVAL; in ti_composite_set_rate()
63 "gate", "divider", "mux"
73 rc = of_parse_phandle_with_args(node, "clocks", "#clock-cells", i, in _get_component_node()
86 if (comp->node == node) in _lookup_component()
103 if (!clk->comp_clks[idx]) in _get_hw()
106 return clk->comp_clks[idx]->hw; in _get_hw()
124 /* Check for presence of each component clock */ in _register_composite()
126 if (!cclk->comp_nodes[i]) in _register_composite()
129 comp = _lookup_component(cclk->comp_nodes[i]); in _register_composite()
132 cclk->comp_nodes[i]->name, node); in _register_composite()
139 if (cclk->comp_clks[comp->type] != NULL) { in _register_composite()
141 node, component_clk_types[comp->type]); in _register_composite()
145 cclk->comp_clks[comp->type] = comp; in _register_composite()
148 cclk->comp_nodes[i] = NULL; in _register_composite()
152 for (i = CLK_COMPONENT_TYPE_MAX - 1; i >= 0; i--) { in _register_composite()
153 comp = cclk->comp_clks[i]; in _register_composite()
156 if (comp->num_parents) { in _register_composite()
157 num_parents = comp->num_parents; in _register_composite()
158 parent_names = comp->parent_names; in _register_composite()
188 /* Free component clock list entries */ in _register_composite()
190 if (!cclk->comp_clks[i]) in _register_composite()
192 list_del(&cclk->comp_clks[i]->link); in _register_composite()
193 kfree(cclk->comp_clks[i]->parent_names); in _register_composite()
194 kfree(cclk->comp_clks[i]); in _register_composite()
206 /* Number of component clocks to be put inside this clock */ in of_ti_composite_clk_setup()
210 pr_err("composite clk %pOFn must have component(s)\n", node); in of_ti_composite_clk_setup()
218 /* Get device node pointers for each component clock */ in of_ti_composite_clk_setup()
220 cclk->comp_nodes[i] = _get_component_node(node, i); in of_ti_composite_clk_setup()
222 _register_composite(&cclk->hw, node); in of_ti_composite_clk_setup()
224 CLK_OF_DECLARE(ti_composite_clock, "ti,composite-clock",
228 * ti_clk_add_component - add a component clock to the pool
229 * @node: device node of the component clock
230 * @hw: hardware clock definition for the component clock
231 * @type: type of the component clock
233 * Adds a component clock to the list of available components, so that
234 * it can be registered by a composite clock.
246 pr_err("component-clock %pOFn must have parent(s)\n", node); in ti_clk_add_component()
247 return -EINVAL; in ti_clk_add_component()
252 return -ENOMEM; in ti_clk_add_component()
259 return -ENOMEM; in ti_clk_add_component()
262 clk->num_parents = num_parents; in ti_clk_add_component()
263 clk->parent_names = parent_names; in ti_clk_add_component()
264 clk->hw = hw; in ti_clk_add_component()
265 clk->node = node; in ti_clk_add_component()
266 clk->type = type; in ti_clk_add_component()
267 list_add(&clk->link, &component_clks); in ti_clk_add_component()