Lines Matching +full:bt1 +full:- +full:ccu +full:- +full:pll
1 // SPDX-License-Identifier: GPL-2.0-only
9 * Baikal-T1 CCU PLL clocks driver
12 #define pr_fmt(fmt) "bt1-ccu-pll: " fmt
18 #include <linux/clk-provider.h>
25 #include <dt-bindings/clock/bt1-ccu.h>
27 #include "ccu-pll.h"
59 * shouldn't be ever gated. SATA and PCIe PLLs are the parents of APB-bus and
60 * DDR controller AXI-bus clocks. If they are gated the system will be
62 * of the corresponding subsystems. So until we aren't ready to re-initialize
93 return data->plls[idx]; in ccu_pll_find_desc()
96 return ERR_PTR(-EINVAL); in ccu_pll_find_desc()
105 return ERR_PTR(-ENOMEM); in ccu_pll_create_data()
107 data->np = np; in ccu_pll_create_data()
119 data->sys_regs = syscon_node_to_regmap(data->np->parent); in ccu_pll_find_sys_regs()
120 if (IS_ERR(data->sys_regs)) { in ccu_pll_find_sys_regs()
122 of_node_full_name(data->np)); in ccu_pll_find_sys_regs()
123 return PTR_ERR(data->sys_regs); in ccu_pll_find_sys_regs()
133 struct ccu_pll *pll; in ccu_pll_of_clk_hw_get() local
136 clk_id = clkspec->args[0]; in ccu_pll_of_clk_hw_get()
137 pll = ccu_pll_find_desc(data, clk_id); in ccu_pll_of_clk_hw_get()
138 if (IS_ERR(pll)) { in ccu_pll_of_clk_hw_get()
139 if (pll != ERR_PTR(-EPROBE_DEFER)) in ccu_pll_of_clk_hw_get()
140 pr_info("Invalid PLL clock ID %d specified\n", clk_id); in ccu_pll_of_clk_hw_get()
142 return ERR_CAST(pll); in ccu_pll_of_clk_hw_get()
145 return ccu_pll_get_clk_hw(pll); in ccu_pll_of_clk_hw_get()
156 /* Defer non-basic PLLs allocation for the probe stage */ in ccu_pll_clk_register()
157 if (!!(info->features & CCU_PLL_BASIC) ^ defer) { in ccu_pll_clk_register()
158 if (!data->plls[idx]) in ccu_pll_clk_register()
159 data->plls[idx] = ERR_PTR(-EPROBE_DEFER); in ccu_pll_clk_register()
164 init.id = info->id; in ccu_pll_clk_register()
165 init.name = info->name; in ccu_pll_clk_register()
166 init.parent_name = info->parent_name; in ccu_pll_clk_register()
167 init.base = info->base; in ccu_pll_clk_register()
168 init.sys_regs = data->sys_regs; in ccu_pll_clk_register()
169 init.np = data->np; in ccu_pll_clk_register()
170 init.flags = info->flags; in ccu_pll_clk_register()
171 init.features = info->features; in ccu_pll_clk_register()
173 data->plls[idx] = ccu_pll_hw_register(&init); in ccu_pll_clk_register()
174 if (IS_ERR(data->plls[idx])) { in ccu_pll_clk_register()
175 ret = PTR_ERR(data->plls[idx]); in ccu_pll_clk_register()
176 pr_err("Couldn't register PLL hw '%s'\n", in ccu_pll_clk_register()
185 for (--idx; idx >= 0; --idx) { in ccu_pll_clk_register()
189 ccu_pll_hw_unregister(data->plls[idx]); in ccu_pll_clk_register()
204 ccu_pll_hw_unregister(data->plls[idx]); in ccu_pll_clk_unregister()
212 ret = of_clk_add_hw_provider(data->np, ccu_pll_of_clk_hw_get, data); in ccu_pll_of_register()
214 pr_err("Couldn't register PLL provider of '%s'\n", in ccu_pll_of_register()
215 of_node_full_name(data->np)); in ccu_pll_of_register()
226 return -EINVAL; in ccu_pll_probe()
232 { .compatible = "baikal,bt1-ccu-pll" },
239 .name = "clk-ccu-pll",
277 CLK_OF_DECLARE_DRIVER(ccu_pll, "baikal,bt1-ccu-pll", ccu_pll_init);