1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * OMAP DPLL clock support
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * Copyright (C) 2013 Texas Instruments, Inc.
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Tero Kristo <t-kristo@ti.com>
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or modify
9*4882a593Smuzhiyun * it under the terms of the GNU General Public License version 2 as
10*4882a593Smuzhiyun * published by the Free Software Foundation.
11*4882a593Smuzhiyun *
12*4882a593Smuzhiyun * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13*4882a593Smuzhiyun * kind, whether express or implied; without even the implied warranty
14*4882a593Smuzhiyun * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15*4882a593Smuzhiyun * GNU General Public License for more details.
16*4882a593Smuzhiyun */
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun #include <linux/clk.h>
19*4882a593Smuzhiyun #include <linux/clk-provider.h>
20*4882a593Smuzhiyun #include <linux/slab.h>
21*4882a593Smuzhiyun #include <linux/err.h>
22*4882a593Smuzhiyun #include <linux/of.h>
23*4882a593Smuzhiyun #include <linux/of_address.h>
24*4882a593Smuzhiyun #include <linux/clk/ti.h>
25*4882a593Smuzhiyun #include "clock.h"
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun #undef pr_fmt
28*4882a593Smuzhiyun #define pr_fmt(fmt) "%s: " fmt, __func__
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
31*4882a593Smuzhiyun defined(CONFIG_SOC_DRA7XX)
32*4882a593Smuzhiyun static const struct clk_ops dpll_m4xen_ck_ops = {
33*4882a593Smuzhiyun .enable = &omap3_noncore_dpll_enable,
34*4882a593Smuzhiyun .disable = &omap3_noncore_dpll_disable,
35*4882a593Smuzhiyun .recalc_rate = &omap4_dpll_regm4xen_recalc,
36*4882a593Smuzhiyun .round_rate = &omap4_dpll_regm4xen_round_rate,
37*4882a593Smuzhiyun .set_rate = &omap3_noncore_dpll_set_rate,
38*4882a593Smuzhiyun .set_parent = &omap3_noncore_dpll_set_parent,
39*4882a593Smuzhiyun .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
40*4882a593Smuzhiyun .determine_rate = &omap4_dpll_regm4xen_determine_rate,
41*4882a593Smuzhiyun .get_parent = &omap2_init_dpll_parent,
42*4882a593Smuzhiyun .save_context = &omap3_core_dpll_save_context,
43*4882a593Smuzhiyun .restore_context = &omap3_core_dpll_restore_context,
44*4882a593Smuzhiyun };
45*4882a593Smuzhiyun #else
46*4882a593Smuzhiyun static const struct clk_ops dpll_m4xen_ck_ops = {};
47*4882a593Smuzhiyun #endif
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) || \
50*4882a593Smuzhiyun defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX) || \
51*4882a593Smuzhiyun defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
52*4882a593Smuzhiyun static const struct clk_ops dpll_core_ck_ops = {
53*4882a593Smuzhiyun .recalc_rate = &omap3_dpll_recalc,
54*4882a593Smuzhiyun .get_parent = &omap2_init_dpll_parent,
55*4882a593Smuzhiyun };
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun static const struct clk_ops dpll_ck_ops = {
58*4882a593Smuzhiyun .enable = &omap3_noncore_dpll_enable,
59*4882a593Smuzhiyun .disable = &omap3_noncore_dpll_disable,
60*4882a593Smuzhiyun .recalc_rate = &omap3_dpll_recalc,
61*4882a593Smuzhiyun .round_rate = &omap2_dpll_round_rate,
62*4882a593Smuzhiyun .set_rate = &omap3_noncore_dpll_set_rate,
63*4882a593Smuzhiyun .set_parent = &omap3_noncore_dpll_set_parent,
64*4882a593Smuzhiyun .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
65*4882a593Smuzhiyun .determine_rate = &omap3_noncore_dpll_determine_rate,
66*4882a593Smuzhiyun .get_parent = &omap2_init_dpll_parent,
67*4882a593Smuzhiyun .save_context = &omap3_noncore_dpll_save_context,
68*4882a593Smuzhiyun .restore_context = &omap3_noncore_dpll_restore_context,
69*4882a593Smuzhiyun };
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun static const struct clk_ops dpll_no_gate_ck_ops = {
72*4882a593Smuzhiyun .recalc_rate = &omap3_dpll_recalc,
73*4882a593Smuzhiyun .get_parent = &omap2_init_dpll_parent,
74*4882a593Smuzhiyun .round_rate = &omap2_dpll_round_rate,
75*4882a593Smuzhiyun .set_rate = &omap3_noncore_dpll_set_rate,
76*4882a593Smuzhiyun .set_parent = &omap3_noncore_dpll_set_parent,
77*4882a593Smuzhiyun .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
78*4882a593Smuzhiyun .determine_rate = &omap3_noncore_dpll_determine_rate,
79*4882a593Smuzhiyun .save_context = &omap3_noncore_dpll_save_context,
80*4882a593Smuzhiyun .restore_context = &omap3_noncore_dpll_restore_context
81*4882a593Smuzhiyun };
82*4882a593Smuzhiyun #else
83*4882a593Smuzhiyun static const struct clk_ops dpll_core_ck_ops = {};
84*4882a593Smuzhiyun static const struct clk_ops dpll_ck_ops = {};
85*4882a593Smuzhiyun static const struct clk_ops dpll_no_gate_ck_ops = {};
86*4882a593Smuzhiyun const struct clk_hw_omap_ops clkhwops_omap3_dpll = {};
87*4882a593Smuzhiyun #endif
88*4882a593Smuzhiyun
89*4882a593Smuzhiyun #ifdef CONFIG_ARCH_OMAP2
90*4882a593Smuzhiyun static const struct clk_ops omap2_dpll_core_ck_ops = {
91*4882a593Smuzhiyun .get_parent = &omap2_init_dpll_parent,
92*4882a593Smuzhiyun .recalc_rate = &omap2_dpllcore_recalc,
93*4882a593Smuzhiyun .round_rate = &omap2_dpll_round_rate,
94*4882a593Smuzhiyun .set_rate = &omap2_reprogram_dpllcore,
95*4882a593Smuzhiyun };
96*4882a593Smuzhiyun #else
97*4882a593Smuzhiyun static const struct clk_ops omap2_dpll_core_ck_ops = {};
98*4882a593Smuzhiyun #endif
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun #ifdef CONFIG_ARCH_OMAP3
101*4882a593Smuzhiyun static const struct clk_ops omap3_dpll_core_ck_ops = {
102*4882a593Smuzhiyun .get_parent = &omap2_init_dpll_parent,
103*4882a593Smuzhiyun .recalc_rate = &omap3_dpll_recalc,
104*4882a593Smuzhiyun .round_rate = &omap2_dpll_round_rate,
105*4882a593Smuzhiyun };
106*4882a593Smuzhiyun #else
107*4882a593Smuzhiyun static const struct clk_ops omap3_dpll_core_ck_ops = {};
108*4882a593Smuzhiyun #endif
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun #ifdef CONFIG_ARCH_OMAP3
111*4882a593Smuzhiyun static const struct clk_ops omap3_dpll_ck_ops = {
112*4882a593Smuzhiyun .enable = &omap3_noncore_dpll_enable,
113*4882a593Smuzhiyun .disable = &omap3_noncore_dpll_disable,
114*4882a593Smuzhiyun .get_parent = &omap2_init_dpll_parent,
115*4882a593Smuzhiyun .recalc_rate = &omap3_dpll_recalc,
116*4882a593Smuzhiyun .set_rate = &omap3_noncore_dpll_set_rate,
117*4882a593Smuzhiyun .set_parent = &omap3_noncore_dpll_set_parent,
118*4882a593Smuzhiyun .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
119*4882a593Smuzhiyun .determine_rate = &omap3_noncore_dpll_determine_rate,
120*4882a593Smuzhiyun .round_rate = &omap2_dpll_round_rate,
121*4882a593Smuzhiyun };
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun static const struct clk_ops omap3_dpll5_ck_ops = {
124*4882a593Smuzhiyun .enable = &omap3_noncore_dpll_enable,
125*4882a593Smuzhiyun .disable = &omap3_noncore_dpll_disable,
126*4882a593Smuzhiyun .get_parent = &omap2_init_dpll_parent,
127*4882a593Smuzhiyun .recalc_rate = &omap3_dpll_recalc,
128*4882a593Smuzhiyun .set_rate = &omap3_dpll5_set_rate,
129*4882a593Smuzhiyun .set_parent = &omap3_noncore_dpll_set_parent,
130*4882a593Smuzhiyun .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
131*4882a593Smuzhiyun .determine_rate = &omap3_noncore_dpll_determine_rate,
132*4882a593Smuzhiyun .round_rate = &omap2_dpll_round_rate,
133*4882a593Smuzhiyun };
134*4882a593Smuzhiyun
135*4882a593Smuzhiyun static const struct clk_ops omap3_dpll_per_ck_ops = {
136*4882a593Smuzhiyun .enable = &omap3_noncore_dpll_enable,
137*4882a593Smuzhiyun .disable = &omap3_noncore_dpll_disable,
138*4882a593Smuzhiyun .get_parent = &omap2_init_dpll_parent,
139*4882a593Smuzhiyun .recalc_rate = &omap3_dpll_recalc,
140*4882a593Smuzhiyun .set_rate = &omap3_dpll4_set_rate,
141*4882a593Smuzhiyun .set_parent = &omap3_noncore_dpll_set_parent,
142*4882a593Smuzhiyun .set_rate_and_parent = &omap3_dpll4_set_rate_and_parent,
143*4882a593Smuzhiyun .determine_rate = &omap3_noncore_dpll_determine_rate,
144*4882a593Smuzhiyun .round_rate = &omap2_dpll_round_rate,
145*4882a593Smuzhiyun };
146*4882a593Smuzhiyun #endif
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun static const struct clk_ops dpll_x2_ck_ops = {
149*4882a593Smuzhiyun .recalc_rate = &omap3_clkoutx2_recalc,
150*4882a593Smuzhiyun };
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun /**
153*4882a593Smuzhiyun * _register_dpll - low level registration of a DPLL clock
154*4882a593Smuzhiyun * @hw: hardware clock definition for the clock
155*4882a593Smuzhiyun * @node: device node for the clock
156*4882a593Smuzhiyun *
157*4882a593Smuzhiyun * Finalizes DPLL registration process. In case a failure (clk-ref or
158*4882a593Smuzhiyun * clk-bypass is missing), the clock is added to retry list and
159*4882a593Smuzhiyun * the initialization is retried on later stage.
160*4882a593Smuzhiyun */
_register_dpll(void * user,struct device_node * node)161*4882a593Smuzhiyun static void __init _register_dpll(void *user,
162*4882a593Smuzhiyun struct device_node *node)
163*4882a593Smuzhiyun {
164*4882a593Smuzhiyun struct clk_hw *hw = user;
165*4882a593Smuzhiyun struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
166*4882a593Smuzhiyun struct dpll_data *dd = clk_hw->dpll_data;
167*4882a593Smuzhiyun struct clk *clk;
168*4882a593Smuzhiyun const struct clk_init_data *init = hw->init;
169*4882a593Smuzhiyun
170*4882a593Smuzhiyun clk = of_clk_get(node, 0);
171*4882a593Smuzhiyun if (IS_ERR(clk)) {
172*4882a593Smuzhiyun pr_debug("clk-ref missing for %pOFn, retry later\n",
173*4882a593Smuzhiyun node);
174*4882a593Smuzhiyun if (!ti_clk_retry_init(node, hw, _register_dpll))
175*4882a593Smuzhiyun return;
176*4882a593Smuzhiyun
177*4882a593Smuzhiyun goto cleanup;
178*4882a593Smuzhiyun }
179*4882a593Smuzhiyun
180*4882a593Smuzhiyun dd->clk_ref = __clk_get_hw(clk);
181*4882a593Smuzhiyun
182*4882a593Smuzhiyun clk = of_clk_get(node, 1);
183*4882a593Smuzhiyun
184*4882a593Smuzhiyun if (IS_ERR(clk)) {
185*4882a593Smuzhiyun pr_debug("clk-bypass missing for %pOFn, retry later\n",
186*4882a593Smuzhiyun node);
187*4882a593Smuzhiyun if (!ti_clk_retry_init(node, hw, _register_dpll))
188*4882a593Smuzhiyun return;
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun goto cleanup;
191*4882a593Smuzhiyun }
192*4882a593Smuzhiyun
193*4882a593Smuzhiyun dd->clk_bypass = __clk_get_hw(clk);
194*4882a593Smuzhiyun
195*4882a593Smuzhiyun /* register the clock */
196*4882a593Smuzhiyun clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name);
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun if (!IS_ERR(clk)) {
199*4882a593Smuzhiyun of_clk_add_provider(node, of_clk_src_simple_get, clk);
200*4882a593Smuzhiyun kfree(init->parent_names);
201*4882a593Smuzhiyun kfree(init);
202*4882a593Smuzhiyun return;
203*4882a593Smuzhiyun }
204*4882a593Smuzhiyun
205*4882a593Smuzhiyun cleanup:
206*4882a593Smuzhiyun kfree(clk_hw->dpll_data);
207*4882a593Smuzhiyun kfree(init->parent_names);
208*4882a593Smuzhiyun kfree(init);
209*4882a593Smuzhiyun kfree(clk_hw);
210*4882a593Smuzhiyun }
211*4882a593Smuzhiyun
212*4882a593Smuzhiyun #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
213*4882a593Smuzhiyun defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) || \
214*4882a593Smuzhiyun defined(CONFIG_SOC_AM43XX)
215*4882a593Smuzhiyun /**
216*4882a593Smuzhiyun * _register_dpll_x2 - Registers a DPLLx2 clock
217*4882a593Smuzhiyun * @node: device node for this clock
218*4882a593Smuzhiyun * @ops: clk_ops for this clock
219*4882a593Smuzhiyun * @hw_ops: clk_hw_ops for this clock
220*4882a593Smuzhiyun *
221*4882a593Smuzhiyun * Initializes a DPLL x 2 clock from device tree data.
222*4882a593Smuzhiyun */
_register_dpll_x2(struct device_node * node,const struct clk_ops * ops,const struct clk_hw_omap_ops * hw_ops)223*4882a593Smuzhiyun static void _register_dpll_x2(struct device_node *node,
224*4882a593Smuzhiyun const struct clk_ops *ops,
225*4882a593Smuzhiyun const struct clk_hw_omap_ops *hw_ops)
226*4882a593Smuzhiyun {
227*4882a593Smuzhiyun struct clk *clk;
228*4882a593Smuzhiyun struct clk_init_data init = { NULL };
229*4882a593Smuzhiyun struct clk_hw_omap *clk_hw;
230*4882a593Smuzhiyun const char *name = node->name;
231*4882a593Smuzhiyun const char *parent_name;
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun parent_name = of_clk_get_parent_name(node, 0);
234*4882a593Smuzhiyun if (!parent_name) {
235*4882a593Smuzhiyun pr_err("%pOFn must have parent\n", node);
236*4882a593Smuzhiyun return;
237*4882a593Smuzhiyun }
238*4882a593Smuzhiyun
239*4882a593Smuzhiyun clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
240*4882a593Smuzhiyun if (!clk_hw)
241*4882a593Smuzhiyun return;
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun clk_hw->ops = hw_ops;
244*4882a593Smuzhiyun clk_hw->hw.init = &init;
245*4882a593Smuzhiyun
246*4882a593Smuzhiyun init.name = name;
247*4882a593Smuzhiyun init.ops = ops;
248*4882a593Smuzhiyun init.parent_names = &parent_name;
249*4882a593Smuzhiyun init.num_parents = 1;
250*4882a593Smuzhiyun
251*4882a593Smuzhiyun #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
252*4882a593Smuzhiyun defined(CONFIG_SOC_DRA7XX)
253*4882a593Smuzhiyun if (hw_ops == &clkhwops_omap4_dpllmx) {
254*4882a593Smuzhiyun int ret;
255*4882a593Smuzhiyun
256*4882a593Smuzhiyun /* Check if register defined, if not, drop hw-ops */
257*4882a593Smuzhiyun ret = of_property_count_elems_of_size(node, "reg", 1);
258*4882a593Smuzhiyun if (ret <= 0) {
259*4882a593Smuzhiyun clk_hw->ops = NULL;
260*4882a593Smuzhiyun } else if (ti_clk_get_reg_addr(node, 0, &clk_hw->clksel_reg)) {
261*4882a593Smuzhiyun kfree(clk_hw);
262*4882a593Smuzhiyun return;
263*4882a593Smuzhiyun }
264*4882a593Smuzhiyun }
265*4882a593Smuzhiyun #endif
266*4882a593Smuzhiyun
267*4882a593Smuzhiyun /* register the clock */
268*4882a593Smuzhiyun clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name);
269*4882a593Smuzhiyun
270*4882a593Smuzhiyun if (IS_ERR(clk))
271*4882a593Smuzhiyun kfree(clk_hw);
272*4882a593Smuzhiyun else
273*4882a593Smuzhiyun of_clk_add_provider(node, of_clk_src_simple_get, clk);
274*4882a593Smuzhiyun }
275*4882a593Smuzhiyun #endif
276*4882a593Smuzhiyun
277*4882a593Smuzhiyun /**
278*4882a593Smuzhiyun * of_ti_dpll_setup - Setup function for OMAP DPLL clocks
279*4882a593Smuzhiyun * @node: device node containing the DPLL info
280*4882a593Smuzhiyun * @ops: ops for the DPLL
281*4882a593Smuzhiyun * @ddt: DPLL data template to use
282*4882a593Smuzhiyun *
283*4882a593Smuzhiyun * Initializes a DPLL clock from device tree data.
284*4882a593Smuzhiyun */
of_ti_dpll_setup(struct device_node * node,const struct clk_ops * ops,const struct dpll_data * ddt)285*4882a593Smuzhiyun static void __init of_ti_dpll_setup(struct device_node *node,
286*4882a593Smuzhiyun const struct clk_ops *ops,
287*4882a593Smuzhiyun const struct dpll_data *ddt)
288*4882a593Smuzhiyun {
289*4882a593Smuzhiyun struct clk_hw_omap *clk_hw = NULL;
290*4882a593Smuzhiyun struct clk_init_data *init = NULL;
291*4882a593Smuzhiyun const char **parent_names = NULL;
292*4882a593Smuzhiyun struct dpll_data *dd = NULL;
293*4882a593Smuzhiyun u8 dpll_mode = 0;
294*4882a593Smuzhiyun
295*4882a593Smuzhiyun dd = kmemdup(ddt, sizeof(*dd), GFP_KERNEL);
296*4882a593Smuzhiyun clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
297*4882a593Smuzhiyun init = kzalloc(sizeof(*init), GFP_KERNEL);
298*4882a593Smuzhiyun if (!dd || !clk_hw || !init)
299*4882a593Smuzhiyun goto cleanup;
300*4882a593Smuzhiyun
301*4882a593Smuzhiyun clk_hw->dpll_data = dd;
302*4882a593Smuzhiyun clk_hw->ops = &clkhwops_omap3_dpll;
303*4882a593Smuzhiyun clk_hw->hw.init = init;
304*4882a593Smuzhiyun
305*4882a593Smuzhiyun init->name = node->name;
306*4882a593Smuzhiyun init->ops = ops;
307*4882a593Smuzhiyun
308*4882a593Smuzhiyun init->num_parents = of_clk_get_parent_count(node);
309*4882a593Smuzhiyun if (!init->num_parents) {
310*4882a593Smuzhiyun pr_err("%pOFn must have parent(s)\n", node);
311*4882a593Smuzhiyun goto cleanup;
312*4882a593Smuzhiyun }
313*4882a593Smuzhiyun
314*4882a593Smuzhiyun parent_names = kcalloc(init->num_parents, sizeof(char *), GFP_KERNEL);
315*4882a593Smuzhiyun if (!parent_names)
316*4882a593Smuzhiyun goto cleanup;
317*4882a593Smuzhiyun
318*4882a593Smuzhiyun of_clk_parent_fill(node, parent_names, init->num_parents);
319*4882a593Smuzhiyun
320*4882a593Smuzhiyun init->parent_names = parent_names;
321*4882a593Smuzhiyun
322*4882a593Smuzhiyun if (ti_clk_get_reg_addr(node, 0, &dd->control_reg))
323*4882a593Smuzhiyun goto cleanup;
324*4882a593Smuzhiyun
325*4882a593Smuzhiyun /*
326*4882a593Smuzhiyun * Special case for OMAP2 DPLL, register order is different due to
327*4882a593Smuzhiyun * missing idlest_reg, also clkhwops is different. Detected from
328*4882a593Smuzhiyun * missing idlest_mask.
329*4882a593Smuzhiyun */
330*4882a593Smuzhiyun if (!dd->idlest_mask) {
331*4882a593Smuzhiyun if (ti_clk_get_reg_addr(node, 1, &dd->mult_div1_reg))
332*4882a593Smuzhiyun goto cleanup;
333*4882a593Smuzhiyun #ifdef CONFIG_ARCH_OMAP2
334*4882a593Smuzhiyun clk_hw->ops = &clkhwops_omap2xxx_dpll;
335*4882a593Smuzhiyun omap2xxx_clkt_dpllcore_init(&clk_hw->hw);
336*4882a593Smuzhiyun #endif
337*4882a593Smuzhiyun } else {
338*4882a593Smuzhiyun if (ti_clk_get_reg_addr(node, 1, &dd->idlest_reg))
339*4882a593Smuzhiyun goto cleanup;
340*4882a593Smuzhiyun
341*4882a593Smuzhiyun if (ti_clk_get_reg_addr(node, 2, &dd->mult_div1_reg))
342*4882a593Smuzhiyun goto cleanup;
343*4882a593Smuzhiyun }
344*4882a593Smuzhiyun
345*4882a593Smuzhiyun if (dd->autoidle_mask) {
346*4882a593Smuzhiyun if (ti_clk_get_reg_addr(node, 3, &dd->autoidle_reg))
347*4882a593Smuzhiyun goto cleanup;
348*4882a593Smuzhiyun }
349*4882a593Smuzhiyun
350*4882a593Smuzhiyun if (of_property_read_bool(node, "ti,low-power-stop"))
351*4882a593Smuzhiyun dpll_mode |= 1 << DPLL_LOW_POWER_STOP;
352*4882a593Smuzhiyun
353*4882a593Smuzhiyun if (of_property_read_bool(node, "ti,low-power-bypass"))
354*4882a593Smuzhiyun dpll_mode |= 1 << DPLL_LOW_POWER_BYPASS;
355*4882a593Smuzhiyun
356*4882a593Smuzhiyun if (of_property_read_bool(node, "ti,lock"))
357*4882a593Smuzhiyun dpll_mode |= 1 << DPLL_LOCKED;
358*4882a593Smuzhiyun
359*4882a593Smuzhiyun if (dpll_mode)
360*4882a593Smuzhiyun dd->modes = dpll_mode;
361*4882a593Smuzhiyun
362*4882a593Smuzhiyun _register_dpll(&clk_hw->hw, node);
363*4882a593Smuzhiyun return;
364*4882a593Smuzhiyun
365*4882a593Smuzhiyun cleanup:
366*4882a593Smuzhiyun kfree(dd);
367*4882a593Smuzhiyun kfree(parent_names);
368*4882a593Smuzhiyun kfree(init);
369*4882a593Smuzhiyun kfree(clk_hw);
370*4882a593Smuzhiyun }
371*4882a593Smuzhiyun
372*4882a593Smuzhiyun #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
373*4882a593Smuzhiyun defined(CONFIG_SOC_DRA7XX)
of_ti_omap4_dpll_x2_setup(struct device_node * node)374*4882a593Smuzhiyun static void __init of_ti_omap4_dpll_x2_setup(struct device_node *node)
375*4882a593Smuzhiyun {
376*4882a593Smuzhiyun _register_dpll_x2(node, &dpll_x2_ck_ops, &clkhwops_omap4_dpllmx);
377*4882a593Smuzhiyun }
378*4882a593Smuzhiyun CLK_OF_DECLARE(ti_omap4_dpll_x2_clock, "ti,omap4-dpll-x2-clock",
379*4882a593Smuzhiyun of_ti_omap4_dpll_x2_setup);
380*4882a593Smuzhiyun #endif
381*4882a593Smuzhiyun
382*4882a593Smuzhiyun #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
of_ti_am3_dpll_x2_setup(struct device_node * node)383*4882a593Smuzhiyun static void __init of_ti_am3_dpll_x2_setup(struct device_node *node)
384*4882a593Smuzhiyun {
385*4882a593Smuzhiyun _register_dpll_x2(node, &dpll_x2_ck_ops, NULL);
386*4882a593Smuzhiyun }
387*4882a593Smuzhiyun CLK_OF_DECLARE(ti_am3_dpll_x2_clock, "ti,am3-dpll-x2-clock",
388*4882a593Smuzhiyun of_ti_am3_dpll_x2_setup);
389*4882a593Smuzhiyun #endif
390*4882a593Smuzhiyun
391*4882a593Smuzhiyun #ifdef CONFIG_ARCH_OMAP3
of_ti_omap3_dpll_setup(struct device_node * node)392*4882a593Smuzhiyun static void __init of_ti_omap3_dpll_setup(struct device_node *node)
393*4882a593Smuzhiyun {
394*4882a593Smuzhiyun const struct dpll_data dd = {
395*4882a593Smuzhiyun .idlest_mask = 0x1,
396*4882a593Smuzhiyun .enable_mask = 0x7,
397*4882a593Smuzhiyun .autoidle_mask = 0x7,
398*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
399*4882a593Smuzhiyun .div1_mask = 0x7f,
400*4882a593Smuzhiyun .max_multiplier = 2047,
401*4882a593Smuzhiyun .max_divider = 128,
402*4882a593Smuzhiyun .min_divider = 1,
403*4882a593Smuzhiyun .freqsel_mask = 0xf0,
404*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
405*4882a593Smuzhiyun };
406*4882a593Smuzhiyun
407*4882a593Smuzhiyun if ((of_machine_is_compatible("ti,omap3630") ||
408*4882a593Smuzhiyun of_machine_is_compatible("ti,omap36xx")) &&
409*4882a593Smuzhiyun of_node_name_eq(node, "dpll5_ck"))
410*4882a593Smuzhiyun of_ti_dpll_setup(node, &omap3_dpll5_ck_ops, &dd);
411*4882a593Smuzhiyun else
412*4882a593Smuzhiyun of_ti_dpll_setup(node, &omap3_dpll_ck_ops, &dd);
413*4882a593Smuzhiyun }
414*4882a593Smuzhiyun CLK_OF_DECLARE(ti_omap3_dpll_clock, "ti,omap3-dpll-clock",
415*4882a593Smuzhiyun of_ti_omap3_dpll_setup);
416*4882a593Smuzhiyun
of_ti_omap3_core_dpll_setup(struct device_node * node)417*4882a593Smuzhiyun static void __init of_ti_omap3_core_dpll_setup(struct device_node *node)
418*4882a593Smuzhiyun {
419*4882a593Smuzhiyun const struct dpll_data dd = {
420*4882a593Smuzhiyun .idlest_mask = 0x1,
421*4882a593Smuzhiyun .enable_mask = 0x7,
422*4882a593Smuzhiyun .autoidle_mask = 0x7,
423*4882a593Smuzhiyun .mult_mask = 0x7ff << 16,
424*4882a593Smuzhiyun .div1_mask = 0x7f << 8,
425*4882a593Smuzhiyun .max_multiplier = 2047,
426*4882a593Smuzhiyun .max_divider = 128,
427*4882a593Smuzhiyun .min_divider = 1,
428*4882a593Smuzhiyun .freqsel_mask = 0xf0,
429*4882a593Smuzhiyun };
430*4882a593Smuzhiyun
431*4882a593Smuzhiyun of_ti_dpll_setup(node, &omap3_dpll_core_ck_ops, &dd);
432*4882a593Smuzhiyun }
433*4882a593Smuzhiyun CLK_OF_DECLARE(ti_omap3_core_dpll_clock, "ti,omap3-dpll-core-clock",
434*4882a593Smuzhiyun of_ti_omap3_core_dpll_setup);
435*4882a593Smuzhiyun
of_ti_omap3_per_dpll_setup(struct device_node * node)436*4882a593Smuzhiyun static void __init of_ti_omap3_per_dpll_setup(struct device_node *node)
437*4882a593Smuzhiyun {
438*4882a593Smuzhiyun const struct dpll_data dd = {
439*4882a593Smuzhiyun .idlest_mask = 0x1 << 1,
440*4882a593Smuzhiyun .enable_mask = 0x7 << 16,
441*4882a593Smuzhiyun .autoidle_mask = 0x7 << 3,
442*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
443*4882a593Smuzhiyun .div1_mask = 0x7f,
444*4882a593Smuzhiyun .max_multiplier = 2047,
445*4882a593Smuzhiyun .max_divider = 128,
446*4882a593Smuzhiyun .min_divider = 1,
447*4882a593Smuzhiyun .freqsel_mask = 0xf00000,
448*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
449*4882a593Smuzhiyun };
450*4882a593Smuzhiyun
451*4882a593Smuzhiyun of_ti_dpll_setup(node, &omap3_dpll_per_ck_ops, &dd);
452*4882a593Smuzhiyun }
453*4882a593Smuzhiyun CLK_OF_DECLARE(ti_omap3_per_dpll_clock, "ti,omap3-dpll-per-clock",
454*4882a593Smuzhiyun of_ti_omap3_per_dpll_setup);
455*4882a593Smuzhiyun
of_ti_omap3_per_jtype_dpll_setup(struct device_node * node)456*4882a593Smuzhiyun static void __init of_ti_omap3_per_jtype_dpll_setup(struct device_node *node)
457*4882a593Smuzhiyun {
458*4882a593Smuzhiyun const struct dpll_data dd = {
459*4882a593Smuzhiyun .idlest_mask = 0x1 << 1,
460*4882a593Smuzhiyun .enable_mask = 0x7 << 16,
461*4882a593Smuzhiyun .autoidle_mask = 0x7 << 3,
462*4882a593Smuzhiyun .mult_mask = 0xfff << 8,
463*4882a593Smuzhiyun .div1_mask = 0x7f,
464*4882a593Smuzhiyun .max_multiplier = 4095,
465*4882a593Smuzhiyun .max_divider = 128,
466*4882a593Smuzhiyun .min_divider = 1,
467*4882a593Smuzhiyun .sddiv_mask = 0xff << 24,
468*4882a593Smuzhiyun .dco_mask = 0xe << 20,
469*4882a593Smuzhiyun .flags = DPLL_J_TYPE,
470*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
471*4882a593Smuzhiyun };
472*4882a593Smuzhiyun
473*4882a593Smuzhiyun of_ti_dpll_setup(node, &omap3_dpll_per_ck_ops, &dd);
474*4882a593Smuzhiyun }
475*4882a593Smuzhiyun CLK_OF_DECLARE(ti_omap3_per_jtype_dpll_clock, "ti,omap3-dpll-per-j-type-clock",
476*4882a593Smuzhiyun of_ti_omap3_per_jtype_dpll_setup);
477*4882a593Smuzhiyun #endif
478*4882a593Smuzhiyun
of_ti_omap4_dpll_setup(struct device_node * node)479*4882a593Smuzhiyun static void __init of_ti_omap4_dpll_setup(struct device_node *node)
480*4882a593Smuzhiyun {
481*4882a593Smuzhiyun const struct dpll_data dd = {
482*4882a593Smuzhiyun .idlest_mask = 0x1,
483*4882a593Smuzhiyun .enable_mask = 0x7,
484*4882a593Smuzhiyun .autoidle_mask = 0x7,
485*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
486*4882a593Smuzhiyun .div1_mask = 0x7f,
487*4882a593Smuzhiyun .max_multiplier = 2047,
488*4882a593Smuzhiyun .max_divider = 128,
489*4882a593Smuzhiyun .min_divider = 1,
490*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
491*4882a593Smuzhiyun };
492*4882a593Smuzhiyun
493*4882a593Smuzhiyun of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
494*4882a593Smuzhiyun }
495*4882a593Smuzhiyun CLK_OF_DECLARE(ti_omap4_dpll_clock, "ti,omap4-dpll-clock",
496*4882a593Smuzhiyun of_ti_omap4_dpll_setup);
497*4882a593Smuzhiyun
of_ti_omap5_mpu_dpll_setup(struct device_node * node)498*4882a593Smuzhiyun static void __init of_ti_omap5_mpu_dpll_setup(struct device_node *node)
499*4882a593Smuzhiyun {
500*4882a593Smuzhiyun const struct dpll_data dd = {
501*4882a593Smuzhiyun .idlest_mask = 0x1,
502*4882a593Smuzhiyun .enable_mask = 0x7,
503*4882a593Smuzhiyun .autoidle_mask = 0x7,
504*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
505*4882a593Smuzhiyun .div1_mask = 0x7f,
506*4882a593Smuzhiyun .max_multiplier = 2047,
507*4882a593Smuzhiyun .max_divider = 128,
508*4882a593Smuzhiyun .dcc_mask = BIT(22),
509*4882a593Smuzhiyun .dcc_rate = 1400000000, /* DCC beyond 1.4GHz */
510*4882a593Smuzhiyun .min_divider = 1,
511*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
512*4882a593Smuzhiyun };
513*4882a593Smuzhiyun
514*4882a593Smuzhiyun of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
515*4882a593Smuzhiyun }
516*4882a593Smuzhiyun CLK_OF_DECLARE(of_ti_omap5_mpu_dpll_clock, "ti,omap5-mpu-dpll-clock",
517*4882a593Smuzhiyun of_ti_omap5_mpu_dpll_setup);
518*4882a593Smuzhiyun
of_ti_omap4_core_dpll_setup(struct device_node * node)519*4882a593Smuzhiyun static void __init of_ti_omap4_core_dpll_setup(struct device_node *node)
520*4882a593Smuzhiyun {
521*4882a593Smuzhiyun const struct dpll_data dd = {
522*4882a593Smuzhiyun .idlest_mask = 0x1,
523*4882a593Smuzhiyun .enable_mask = 0x7,
524*4882a593Smuzhiyun .autoidle_mask = 0x7,
525*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
526*4882a593Smuzhiyun .div1_mask = 0x7f,
527*4882a593Smuzhiyun .max_multiplier = 2047,
528*4882a593Smuzhiyun .max_divider = 128,
529*4882a593Smuzhiyun .min_divider = 1,
530*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
531*4882a593Smuzhiyun };
532*4882a593Smuzhiyun
533*4882a593Smuzhiyun of_ti_dpll_setup(node, &dpll_core_ck_ops, &dd);
534*4882a593Smuzhiyun }
535*4882a593Smuzhiyun CLK_OF_DECLARE(ti_omap4_core_dpll_clock, "ti,omap4-dpll-core-clock",
536*4882a593Smuzhiyun of_ti_omap4_core_dpll_setup);
537*4882a593Smuzhiyun
538*4882a593Smuzhiyun #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
539*4882a593Smuzhiyun defined(CONFIG_SOC_DRA7XX)
of_ti_omap4_m4xen_dpll_setup(struct device_node * node)540*4882a593Smuzhiyun static void __init of_ti_omap4_m4xen_dpll_setup(struct device_node *node)
541*4882a593Smuzhiyun {
542*4882a593Smuzhiyun const struct dpll_data dd = {
543*4882a593Smuzhiyun .idlest_mask = 0x1,
544*4882a593Smuzhiyun .enable_mask = 0x7,
545*4882a593Smuzhiyun .autoidle_mask = 0x7,
546*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
547*4882a593Smuzhiyun .div1_mask = 0x7f,
548*4882a593Smuzhiyun .max_multiplier = 2047,
549*4882a593Smuzhiyun .max_divider = 128,
550*4882a593Smuzhiyun .min_divider = 1,
551*4882a593Smuzhiyun .m4xen_mask = 0x800,
552*4882a593Smuzhiyun .lpmode_mask = 1 << 10,
553*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
554*4882a593Smuzhiyun };
555*4882a593Smuzhiyun
556*4882a593Smuzhiyun of_ti_dpll_setup(node, &dpll_m4xen_ck_ops, &dd);
557*4882a593Smuzhiyun }
558*4882a593Smuzhiyun CLK_OF_DECLARE(ti_omap4_m4xen_dpll_clock, "ti,omap4-dpll-m4xen-clock",
559*4882a593Smuzhiyun of_ti_omap4_m4xen_dpll_setup);
560*4882a593Smuzhiyun
of_ti_omap4_jtype_dpll_setup(struct device_node * node)561*4882a593Smuzhiyun static void __init of_ti_omap4_jtype_dpll_setup(struct device_node *node)
562*4882a593Smuzhiyun {
563*4882a593Smuzhiyun const struct dpll_data dd = {
564*4882a593Smuzhiyun .idlest_mask = 0x1,
565*4882a593Smuzhiyun .enable_mask = 0x7,
566*4882a593Smuzhiyun .autoidle_mask = 0x7,
567*4882a593Smuzhiyun .mult_mask = 0xfff << 8,
568*4882a593Smuzhiyun .div1_mask = 0xff,
569*4882a593Smuzhiyun .max_multiplier = 4095,
570*4882a593Smuzhiyun .max_divider = 256,
571*4882a593Smuzhiyun .min_divider = 1,
572*4882a593Smuzhiyun .sddiv_mask = 0xff << 24,
573*4882a593Smuzhiyun .flags = DPLL_J_TYPE,
574*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
575*4882a593Smuzhiyun };
576*4882a593Smuzhiyun
577*4882a593Smuzhiyun of_ti_dpll_setup(node, &dpll_m4xen_ck_ops, &dd);
578*4882a593Smuzhiyun }
579*4882a593Smuzhiyun CLK_OF_DECLARE(ti_omap4_jtype_dpll_clock, "ti,omap4-dpll-j-type-clock",
580*4882a593Smuzhiyun of_ti_omap4_jtype_dpll_setup);
581*4882a593Smuzhiyun #endif
582*4882a593Smuzhiyun
of_ti_am3_no_gate_dpll_setup(struct device_node * node)583*4882a593Smuzhiyun static void __init of_ti_am3_no_gate_dpll_setup(struct device_node *node)
584*4882a593Smuzhiyun {
585*4882a593Smuzhiyun const struct dpll_data dd = {
586*4882a593Smuzhiyun .idlest_mask = 0x1,
587*4882a593Smuzhiyun .enable_mask = 0x7,
588*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
589*4882a593Smuzhiyun .div1_mask = 0x7f,
590*4882a593Smuzhiyun .max_multiplier = 2047,
591*4882a593Smuzhiyun .max_divider = 128,
592*4882a593Smuzhiyun .min_divider = 1,
593*4882a593Smuzhiyun .max_rate = 1000000000,
594*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
595*4882a593Smuzhiyun };
596*4882a593Smuzhiyun
597*4882a593Smuzhiyun of_ti_dpll_setup(node, &dpll_no_gate_ck_ops, &dd);
598*4882a593Smuzhiyun }
599*4882a593Smuzhiyun CLK_OF_DECLARE(ti_am3_no_gate_dpll_clock, "ti,am3-dpll-no-gate-clock",
600*4882a593Smuzhiyun of_ti_am3_no_gate_dpll_setup);
601*4882a593Smuzhiyun
of_ti_am3_jtype_dpll_setup(struct device_node * node)602*4882a593Smuzhiyun static void __init of_ti_am3_jtype_dpll_setup(struct device_node *node)
603*4882a593Smuzhiyun {
604*4882a593Smuzhiyun const struct dpll_data dd = {
605*4882a593Smuzhiyun .idlest_mask = 0x1,
606*4882a593Smuzhiyun .enable_mask = 0x7,
607*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
608*4882a593Smuzhiyun .div1_mask = 0x7f,
609*4882a593Smuzhiyun .max_multiplier = 4095,
610*4882a593Smuzhiyun .max_divider = 256,
611*4882a593Smuzhiyun .min_divider = 2,
612*4882a593Smuzhiyun .flags = DPLL_J_TYPE,
613*4882a593Smuzhiyun .max_rate = 2000000000,
614*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
615*4882a593Smuzhiyun };
616*4882a593Smuzhiyun
617*4882a593Smuzhiyun of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
618*4882a593Smuzhiyun }
619*4882a593Smuzhiyun CLK_OF_DECLARE(ti_am3_jtype_dpll_clock, "ti,am3-dpll-j-type-clock",
620*4882a593Smuzhiyun of_ti_am3_jtype_dpll_setup);
621*4882a593Smuzhiyun
of_ti_am3_no_gate_jtype_dpll_setup(struct device_node * node)622*4882a593Smuzhiyun static void __init of_ti_am3_no_gate_jtype_dpll_setup(struct device_node *node)
623*4882a593Smuzhiyun {
624*4882a593Smuzhiyun const struct dpll_data dd = {
625*4882a593Smuzhiyun .idlest_mask = 0x1,
626*4882a593Smuzhiyun .enable_mask = 0x7,
627*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
628*4882a593Smuzhiyun .div1_mask = 0x7f,
629*4882a593Smuzhiyun .max_multiplier = 2047,
630*4882a593Smuzhiyun .max_divider = 128,
631*4882a593Smuzhiyun .min_divider = 1,
632*4882a593Smuzhiyun .max_rate = 2000000000,
633*4882a593Smuzhiyun .flags = DPLL_J_TYPE,
634*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
635*4882a593Smuzhiyun };
636*4882a593Smuzhiyun
637*4882a593Smuzhiyun of_ti_dpll_setup(node, &dpll_no_gate_ck_ops, &dd);
638*4882a593Smuzhiyun }
639*4882a593Smuzhiyun CLK_OF_DECLARE(ti_am3_no_gate_jtype_dpll_clock,
640*4882a593Smuzhiyun "ti,am3-dpll-no-gate-j-type-clock",
641*4882a593Smuzhiyun of_ti_am3_no_gate_jtype_dpll_setup);
642*4882a593Smuzhiyun
of_ti_am3_dpll_setup(struct device_node * node)643*4882a593Smuzhiyun static void __init of_ti_am3_dpll_setup(struct device_node *node)
644*4882a593Smuzhiyun {
645*4882a593Smuzhiyun const struct dpll_data dd = {
646*4882a593Smuzhiyun .idlest_mask = 0x1,
647*4882a593Smuzhiyun .enable_mask = 0x7,
648*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
649*4882a593Smuzhiyun .div1_mask = 0x7f,
650*4882a593Smuzhiyun .max_multiplier = 2047,
651*4882a593Smuzhiyun .max_divider = 128,
652*4882a593Smuzhiyun .min_divider = 1,
653*4882a593Smuzhiyun .max_rate = 1000000000,
654*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
655*4882a593Smuzhiyun };
656*4882a593Smuzhiyun
657*4882a593Smuzhiyun of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
658*4882a593Smuzhiyun }
659*4882a593Smuzhiyun CLK_OF_DECLARE(ti_am3_dpll_clock, "ti,am3-dpll-clock", of_ti_am3_dpll_setup);
660*4882a593Smuzhiyun
of_ti_am3_core_dpll_setup(struct device_node * node)661*4882a593Smuzhiyun static void __init of_ti_am3_core_dpll_setup(struct device_node *node)
662*4882a593Smuzhiyun {
663*4882a593Smuzhiyun const struct dpll_data dd = {
664*4882a593Smuzhiyun .idlest_mask = 0x1,
665*4882a593Smuzhiyun .enable_mask = 0x7,
666*4882a593Smuzhiyun .mult_mask = 0x7ff << 8,
667*4882a593Smuzhiyun .div1_mask = 0x7f,
668*4882a593Smuzhiyun .max_multiplier = 2047,
669*4882a593Smuzhiyun .max_divider = 128,
670*4882a593Smuzhiyun .min_divider = 1,
671*4882a593Smuzhiyun .max_rate = 1000000000,
672*4882a593Smuzhiyun .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
673*4882a593Smuzhiyun };
674*4882a593Smuzhiyun
675*4882a593Smuzhiyun of_ti_dpll_setup(node, &dpll_core_ck_ops, &dd);
676*4882a593Smuzhiyun }
677*4882a593Smuzhiyun CLK_OF_DECLARE(ti_am3_core_dpll_clock, "ti,am3-dpll-core-clock",
678*4882a593Smuzhiyun of_ti_am3_core_dpll_setup);
679*4882a593Smuzhiyun
of_ti_omap2_core_dpll_setup(struct device_node * node)680*4882a593Smuzhiyun static void __init of_ti_omap2_core_dpll_setup(struct device_node *node)
681*4882a593Smuzhiyun {
682*4882a593Smuzhiyun const struct dpll_data dd = {
683*4882a593Smuzhiyun .enable_mask = 0x3,
684*4882a593Smuzhiyun .mult_mask = 0x3ff << 12,
685*4882a593Smuzhiyun .div1_mask = 0xf << 8,
686*4882a593Smuzhiyun .max_divider = 16,
687*4882a593Smuzhiyun .min_divider = 1,
688*4882a593Smuzhiyun };
689*4882a593Smuzhiyun
690*4882a593Smuzhiyun of_ti_dpll_setup(node, &omap2_dpll_core_ck_ops, &dd);
691*4882a593Smuzhiyun }
692*4882a593Smuzhiyun CLK_OF_DECLARE(ti_omap2_core_dpll_clock, "ti,omap2-dpll-core-clock",
693*4882a593Smuzhiyun of_ti_omap2_core_dpll_setup);
694