Lines Matching +full:exynos +full:- +full:bus
1 // SPDX-License-Identifier: GPL-2.0-only
8 * This file contains shared functions used by some arm64 Exynos SoCs,
18 #include "clk-exynos-arm64.h"
42 * exynos_arm64_init_clocks - Set clocks initial configuration
77 * exynos_arm64_enable_bus_clk - Enable parent clock of specified CMU
93 if (!cmu->clk_name) in exynos_arm64_enable_bus_clk()
99 parent_clk = clk_get(dev, cmu->clk_name); in exynos_arm64_enable_bus_clk()
102 data->clk = parent_clk; in exynos_arm64_enable_bus_clk()
104 parent_clk = of_clk_get_by_name(np, cmu->clk_name); in exynos_arm64_enable_bus_clk()
119 data->clk_save = samsung_clk_alloc_reg_dump(cmu->clk_regs, in exynos_arm64_cmu_prepare_pm()
120 cmu->nr_clk_regs); in exynos_arm64_cmu_prepare_pm()
121 if (!data->clk_save) in exynos_arm64_cmu_prepare_pm()
122 return -ENOMEM; in exynos_arm64_cmu_prepare_pm()
124 data->nr_clk_save = cmu->nr_clk_regs; in exynos_arm64_cmu_prepare_pm()
125 data->clk_suspend = cmu->suspend_regs; in exynos_arm64_cmu_prepare_pm()
126 data->nr_clk_suspend = cmu->nr_suspend_regs; in exynos_arm64_cmu_prepare_pm()
127 data->nr_pclks = of_clk_get_parent_count(dev->of_node); in exynos_arm64_cmu_prepare_pm()
128 if (!data->nr_pclks) in exynos_arm64_cmu_prepare_pm()
131 data->pclks = devm_kcalloc(dev, sizeof(struct clk *), data->nr_pclks, in exynos_arm64_cmu_prepare_pm()
133 if (!data->pclks) { in exynos_arm64_cmu_prepare_pm()
134 kfree(data->clk_save); in exynos_arm64_cmu_prepare_pm()
135 return -ENOMEM; in exynos_arm64_cmu_prepare_pm()
138 for (i = 0; i < data->nr_pclks; i++) { in exynos_arm64_cmu_prepare_pm()
139 struct clk *clk = of_clk_get(dev->of_node, i); in exynos_arm64_cmu_prepare_pm()
142 kfree(data->clk_save); in exynos_arm64_cmu_prepare_pm()
143 while (--i >= 0) in exynos_arm64_cmu_prepare_pm()
144 clk_put(data->pclks[i]); in exynos_arm64_cmu_prepare_pm()
147 data->pclks[i] = clk; in exynos_arm64_cmu_prepare_pm()
154 * exynos_arm64_register_cmu - Register specified Exynos CMU domain
177 pr_err("%s: could not enable bus clock %s; err = %d\n", in exynos_arm64_register_cmu()
178 __func__, cmu->clk_name, err); in exynos_arm64_register_cmu()
180 exynos_arm64_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs); in exynos_arm64_register_cmu()
185 * exynos_arm64_register_cmu_pm - Register Exynos CMU domain with PM support
199 struct device *dev = &pdev->dev; in exynos_arm64_register_cmu_pm()
200 struct device_node *np = dev->of_node; in exynos_arm64_register_cmu_pm()
209 return -ENOMEM; in exynos_arm64_register_cmu_pm()
223 dev_err(dev, "%s: could not enable bus clock %s; err = %d\n", in exynos_arm64_register_cmu_pm()
224 __func__, cmu->clk_name, ret); in exynos_arm64_register_cmu_pm()
227 exynos_arm64_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs); in exynos_arm64_register_cmu_pm()
233 data->ctx = samsung_clk_init(dev, reg_base, cmu->nr_clk_ids); in exynos_arm64_register_cmu_pm()
245 samsung_cmu_register_clocks(data->ctx, cmu); in exynos_arm64_register_cmu_pm()
246 samsung_clk_of_add_provider(dev->of_node, data->ctx); in exynos_arm64_register_cmu_pm()
257 samsung_clk_save(data->ctx->reg_base, data->clk_save, in exynos_arm64_cmu_suspend()
258 data->nr_clk_save); in exynos_arm64_cmu_suspend()
260 for (i = 0; i < data->nr_pclks; i++) in exynos_arm64_cmu_suspend()
261 clk_prepare_enable(data->pclks[i]); in exynos_arm64_cmu_suspend()
264 samsung_clk_restore(data->ctx->reg_base, data->clk_suspend, in exynos_arm64_cmu_suspend()
265 data->nr_clk_suspend); in exynos_arm64_cmu_suspend()
267 for (i = 0; i < data->nr_pclks; i++) in exynos_arm64_cmu_suspend()
268 clk_disable_unprepare(data->pclks[i]); in exynos_arm64_cmu_suspend()
270 clk_disable_unprepare(data->clk); in exynos_arm64_cmu_suspend()
280 clk_prepare_enable(data->clk); in exynos_arm64_cmu_resume()
282 for (i = 0; i < data->nr_pclks; i++) in exynos_arm64_cmu_resume()
283 clk_prepare_enable(data->pclks[i]); in exynos_arm64_cmu_resume()
285 samsung_clk_restore(data->ctx->reg_base, data->clk_save, in exynos_arm64_cmu_resume()
286 data->nr_clk_save); in exynos_arm64_cmu_resume()
288 for (i = 0; i < data->nr_pclks; i++) in exynos_arm64_cmu_resume()
289 clk_disable_unprepare(data->pclks[i]); in exynos_arm64_cmu_resume()