Lines Matching +full:protected +full:- +full:clocks
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
10 #include <linux/clk-provider.h>
11 #include <linux/reset-controller.h>
15 #include "clk-rcg.h"
16 #include "clk-regmap.h"
32 if (!f->freq) in qcom_find_freq()
35 for (; f->freq; f++) in qcom_find_freq()
36 if (rate <= f->freq) in qcom_find_freq()
40 return f - 1; in qcom_find_freq()
49 for ( ; f->freq; f++) { in qcom_find_freq_floor()
50 if (rate >= f->freq) in qcom_find_freq_floor()
68 return -ENOENT; in qcom_find_src_index()
80 return -ENOENT; in qcom_find_cfg_index()
89 struct device *dev = &pdev->dev; in qcom_cc_map()
96 return devm_regmap_init_mmio(dev, base, desc->config); in qcom_cc_map()
106 /* De-assert reset to FSM */ in qcom_pll_set_fsm_mode()
127 * Backwards compatibility with old DTs. Register a pass-through factor 1/1
142 clocks_node = of_find_node_by_path("/clocks"); in _qcom_cc_register_board_clk()
151 return -EINVAL; in _qcom_cc_register_board_clk()
153 fixed->fixed_rate = rate; in _qcom_cc_register_board_clk()
154 fixed->hw.init = &init_data; in _qcom_cc_register_board_clk()
159 ret = devm_clk_hw_register(dev, &fixed->hw); in _qcom_cc_register_board_clk()
168 return -EINVAL; in _qcom_cc_register_board_clk()
170 factor->mult = factor->div = 1; in _qcom_cc_register_board_clk()
171 factor->hw.init = &init_data; in _qcom_cc_register_board_clk()
179 ret = devm_clk_hw_register(dev, &factor->hw); in _qcom_cc_register_board_clk()
195 * function to skip registration of xo factor clocks. in qcom_cc_register_board_clk()
209 /* Drop 'protected-clocks' from the list of clocks to register */
212 struct device_node *np = dev->of_node; in qcom_cc_drop_protected()
217 of_property_for_each_u32(np, "protected-clocks", prop, p, i) { in qcom_cc_drop_protected()
218 if (i >= cc->num_rclks) in qcom_cc_drop_protected()
221 cc->rclks[i] = NULL; in qcom_cc_drop_protected()
229 unsigned int idx = clkspec->args[0]; in qcom_cc_clk_hw_get()
231 if (idx >= cc->num_rclks) { in qcom_cc_clk_hw_get()
233 return ERR_PTR(-EINVAL); in qcom_cc_clk_hw_get()
236 return cc->rclks[idx] ? &cc->rclks[idx]->hw : NULL; in qcom_cc_clk_hw_get()
243 struct device *dev = &pdev->dev; in qcom_cc_really_probe()
247 size_t num_clks = desc->num_clks; in qcom_cc_really_probe()
248 struct clk_regmap **rclks = desc->clks; in qcom_cc_really_probe()
249 size_t num_clk_hws = desc->num_clk_hws; in qcom_cc_really_probe()
250 struct clk_hw **clk_hws = desc->clk_hws; in qcom_cc_really_probe()
254 return -ENOMEM; in qcom_cc_really_probe()
256 reset = &cc->reset; in qcom_cc_really_probe()
257 reset->rcdev.of_node = dev->of_node; in qcom_cc_really_probe()
258 reset->rcdev.ops = &qcom_reset_ops; in qcom_cc_really_probe()
259 reset->rcdev.owner = dev->driver->owner; in qcom_cc_really_probe()
260 reset->rcdev.nr_resets = desc->num_resets; in qcom_cc_really_probe()
261 reset->regmap = regmap; in qcom_cc_really_probe()
262 reset->reset_map = desc->resets; in qcom_cc_really_probe()
264 ret = devm_reset_controller_register(dev, &reset->rcdev); in qcom_cc_really_probe()
268 if (desc->gdscs && desc->num_gdscs) { in qcom_cc_really_probe()
271 return -ENOMEM; in qcom_cc_really_probe()
272 scd->dev = dev; in qcom_cc_really_probe()
273 scd->scs = desc->gdscs; in qcom_cc_really_probe()
274 scd->num = desc->num_gdscs; in qcom_cc_really_probe()
275 ret = gdsc_register(scd, &reset->rcdev, regmap); in qcom_cc_really_probe()
284 cc->rclks = rclks; in qcom_cc_really_probe()
285 cc->num_rclks = num_clks; in qcom_cc_really_probe()
332 base = devm_ioremap_resource(&pdev->dev, res); in qcom_cc_probe_by_index()
334 return -ENOMEM; in qcom_cc_probe_by_index()
336 regmap = devm_regmap_init_mmio(&pdev->dev, base, desc->config); in qcom_cc_probe_by_index()