clk: qcom: Support to add hardware clocks to of_clk_provider
Currently the hardware clocks are added from each clock controller individually and are not added to the of_clk_provider. But there could be clocks which are required by clients to be used. Add the hardware clocks to the of_clk_provider list. Change-Id: I9a36a52c77672fba13813656a58f7b8cc14a4c27 Signed-off-by: Taniya Das <tdas@codeaurora.org>
This commit is contained in:
parent
4f983fd1aa
commit
55d4764dee
2 changed files with 26 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2014, 2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
|
@ -177,7 +177,7 @@ EXPORT_SYMBOL_GPL(qcom_cc_register_sleep_clk);
|
|||
int qcom_cc_really_probe(struct platform_device *pdev,
|
||||
const struct qcom_cc_desc *desc, struct regmap *regmap)
|
||||
{
|
||||
int i, ret;
|
||||
int i = 0, ret, j = 0;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct clk *clk;
|
||||
struct clk_onecell_data *data;
|
||||
|
@ -187,8 +187,10 @@ int qcom_cc_really_probe(struct platform_device *pdev,
|
|||
struct gdsc_desc *scd;
|
||||
size_t num_clks = desc->num_clks;
|
||||
struct clk_regmap **rclks = desc->clks;
|
||||
struct clk_hw **hw_clks = desc->hwclks;
|
||||
|
||||
cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*clks) * num_clks,
|
||||
cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*clks) *
|
||||
(num_clks + desc->num_hwclks),
|
||||
GFP_KERNEL);
|
||||
if (!cc)
|
||||
return -ENOMEM;
|
||||
|
@ -196,17 +198,32 @@ int qcom_cc_really_probe(struct platform_device *pdev,
|
|||
clks = cc->clks;
|
||||
data = &cc->data;
|
||||
data->clks = clks;
|
||||
data->clk_num = num_clks;
|
||||
data->clk_num = num_clks + desc->num_hwclks;
|
||||
|
||||
for (i = 0; i < num_clks; i++) {
|
||||
if (!rclks[i]) {
|
||||
for (i = 0; i < desc->num_hwclks; i++) {
|
||||
if (!hw_clks[i]) {
|
||||
clks[i] = ERR_PTR(-ENOENT);
|
||||
continue;
|
||||
}
|
||||
clk = devm_clk_register_regmap(dev, rclks[i]);
|
||||
clk = devm_clk_register(dev, hw_clks[i]);
|
||||
if (IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
clks[i] = clk;
|
||||
pr_debug("Index for hw_clocks %d added %s\n", i,
|
||||
__clk_get_name(clk));
|
||||
}
|
||||
|
||||
for (j = i; j < num_clks; j++) {
|
||||
if (!rclks[j]) {
|
||||
clks[j] = ERR_PTR(-ENOENT);
|
||||
continue;
|
||||
}
|
||||
clk = devm_clk_register_regmap(dev, rclks[j]);
|
||||
if (IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
clks[j] = clk;
|
||||
pr_debug("Index for Regmap clocks %d added %s\n", j,
|
||||
__clk_get_name(clk));
|
||||
}
|
||||
|
||||
ret = of_clk_add_provider(dev->of_node, of_clk_src_onecell_get, data);
|
||||
|
|
|
@ -25,7 +25,9 @@ struct parent_map;
|
|||
struct qcom_cc_desc {
|
||||
const struct regmap_config *config;
|
||||
struct clk_regmap **clks;
|
||||
struct clk_hw **hwclks;
|
||||
size_t num_clks;
|
||||
size_t num_hwclks;
|
||||
const struct qcom_reset_map *resets;
|
||||
size_t num_resets;
|
||||
struct gdsc **gdscs;
|
||||
|
|
Loading…
Add table
Reference in a new issue