blob: 34e2339902124bd14916b9234b18ed0a95e7d5cf [file] [log] [blame]
Tero Kristof38b0dd2013-06-12 16:04:34 +03001/*
2 * OMAP DPLL clock support
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * Tero Kristo <t-kristo@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/slab.h>
20#include <linux/err.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/clk/ti.h>
24
25#undef pr_fmt
26#define pr_fmt(fmt) "%s: " fmt, __func__
27
Tero Kristof38b0dd2013-06-12 16:04:34 +030028#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
29 defined(CONFIG_SOC_DRA7XX)
30static const struct clk_ops dpll_m4xen_ck_ops = {
31 .enable = &omap3_noncore_dpll_enable,
32 .disable = &omap3_noncore_dpll_disable,
33 .recalc_rate = &omap4_dpll_regm4xen_recalc,
34 .round_rate = &omap4_dpll_regm4xen_round_rate,
35 .set_rate = &omap3_noncore_dpll_set_rate,
36 .get_parent = &omap2_init_dpll_parent,
37};
Tero Kristoaa76fcf2014-02-21 17:36:21 +020038#else
39static const struct clk_ops dpll_m4xen_ck_ops = {};
Tero Kristof38b0dd2013-06-12 16:04:34 +030040#endif
41
Tero Kristoaa76fcf2014-02-21 17:36:21 +020042#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) || \
43 defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX) || \
44 defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
Tero Kristof38b0dd2013-06-12 16:04:34 +030045static const struct clk_ops dpll_core_ck_ops = {
46 .recalc_rate = &omap3_dpll_recalc,
47 .get_parent = &omap2_init_dpll_parent,
48};
49
Tero Kristof38b0dd2013-06-12 16:04:34 +030050static const struct clk_ops dpll_ck_ops = {
51 .enable = &omap3_noncore_dpll_enable,
52 .disable = &omap3_noncore_dpll_disable,
53 .recalc_rate = &omap3_dpll_recalc,
54 .round_rate = &omap2_dpll_round_rate,
55 .set_rate = &omap3_noncore_dpll_set_rate,
56 .get_parent = &omap2_init_dpll_parent,
57};
58
59static const struct clk_ops dpll_no_gate_ck_ops = {
60 .recalc_rate = &omap3_dpll_recalc,
61 .get_parent = &omap2_init_dpll_parent,
62 .round_rate = &omap2_dpll_round_rate,
63 .set_rate = &omap3_noncore_dpll_set_rate,
64};
Tero Kristoaa76fcf2014-02-21 17:36:21 +020065#else
66static const struct clk_ops dpll_core_ck_ops = {};
67static const struct clk_ops dpll_ck_ops = {};
68static const struct clk_ops dpll_no_gate_ck_ops = {};
69const struct clk_hw_omap_ops clkhwops_omap3_dpll = {};
70#endif
71
72#ifdef CONFIG_ARCH_OMAP2
73static const struct clk_ops omap2_dpll_core_ck_ops = {
74 .get_parent = &omap2_init_dpll_parent,
75 .recalc_rate = &omap2_dpllcore_recalc,
76 .round_rate = &omap2_dpll_round_rate,
77 .set_rate = &omap2_reprogram_dpllcore,
78};
79#else
80static const struct clk_ops omap2_dpll_core_ck_ops = {};
81#endif
82
83#ifdef CONFIG_ARCH_OMAP3
84static const struct clk_ops omap3_dpll_core_ck_ops = {
85 .get_parent = &omap2_init_dpll_parent,
86 .recalc_rate = &omap3_dpll_recalc,
87 .round_rate = &omap2_dpll_round_rate,
88};
89#else
90static const struct clk_ops omap3_dpll_core_ck_ops = {};
91#endif
Tero Kristof38b0dd2013-06-12 16:04:34 +030092
93#ifdef CONFIG_ARCH_OMAP3
94static const struct clk_ops omap3_dpll_ck_ops = {
95 .enable = &omap3_noncore_dpll_enable,
96 .disable = &omap3_noncore_dpll_disable,
97 .get_parent = &omap2_init_dpll_parent,
98 .recalc_rate = &omap3_dpll_recalc,
99 .set_rate = &omap3_noncore_dpll_set_rate,
100 .round_rate = &omap2_dpll_round_rate,
101};
102
103static const struct clk_ops omap3_dpll_per_ck_ops = {
104 .enable = &omap3_noncore_dpll_enable,
105 .disable = &omap3_noncore_dpll_disable,
106 .get_parent = &omap2_init_dpll_parent,
107 .recalc_rate = &omap3_dpll_recalc,
108 .set_rate = &omap3_dpll4_set_rate,
109 .round_rate = &omap2_dpll_round_rate,
110};
111#endif
112
113static const struct clk_ops dpll_x2_ck_ops = {
114 .recalc_rate = &omap3_clkoutx2_recalc,
115};
116
117/**
118 * ti_clk_register_dpll - low level registration of a DPLL clock
119 * @hw: hardware clock definition for the clock
120 * @node: device node for the clock
121 *
122 * Finalizes DPLL registration process. In case a failure (clk-ref or
123 * clk-bypass is missing), the clock is added to retry list and
124 * the initialization is retried on later stage.
125 */
126static void __init ti_clk_register_dpll(struct clk_hw *hw,
127 struct device_node *node)
128{
129 struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
130 struct dpll_data *dd = clk_hw->dpll_data;
131 struct clk *clk;
132
133 dd->clk_ref = of_clk_get(node, 0);
134 dd->clk_bypass = of_clk_get(node, 1);
135
136 if (IS_ERR(dd->clk_ref) || IS_ERR(dd->clk_bypass)) {
137 pr_debug("clk-ref or clk-bypass missing for %s, retry later\n",
138 node->name);
139 if (!ti_clk_retry_init(node, hw, ti_clk_register_dpll))
140 return;
141
142 goto cleanup;
143 }
144
145 /* register the clock */
146 clk = clk_register(NULL, &clk_hw->hw);
147
148 if (!IS_ERR(clk)) {
149 omap2_init_clk_hw_omap_clocks(clk);
150 of_clk_add_provider(node, of_clk_src_simple_get, clk);
151 kfree(clk_hw->hw.init->parent_names);
152 kfree(clk_hw->hw.init);
153 return;
154 }
155
156cleanup:
157 kfree(clk_hw->dpll_data);
158 kfree(clk_hw->hw.init->parent_names);
159 kfree(clk_hw->hw.init);
160 kfree(clk_hw);
161}
162
163#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
164 defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX)
165/**
166 * ti_clk_register_dpll_x2 - Registers a DPLLx2 clock
167 * @node: device node for this clock
168 * @ops: clk_ops for this clock
169 * @hw_ops: clk_hw_ops for this clock
170 *
171 * Initializes a DPLL x 2 clock from device tree data.
172 */
173static void ti_clk_register_dpll_x2(struct device_node *node,
174 const struct clk_ops *ops,
175 const struct clk_hw_omap_ops *hw_ops)
176{
177 struct clk *clk;
178 struct clk_init_data init = { NULL };
179 struct clk_hw_omap *clk_hw;
180 const char *name = node->name;
181 const char *parent_name;
182
183 parent_name = of_clk_get_parent_name(node, 0);
184 if (!parent_name) {
185 pr_err("%s must have parent\n", node->name);
186 return;
187 }
188
189 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
190 if (!clk_hw)
191 return;
192
193 clk_hw->ops = hw_ops;
194 clk_hw->hw.init = &init;
195
196 init.name = name;
197 init.ops = ops;
198 init.parent_names = &parent_name;
199 init.num_parents = 1;
200
201 /* register the clock */
202 clk = clk_register(NULL, &clk_hw->hw);
203
204 if (IS_ERR(clk)) {
205 kfree(clk_hw);
206 } else {
207 omap2_init_clk_hw_omap_clocks(clk);
208 of_clk_add_provider(node, of_clk_src_simple_get, clk);
209 }
210}
211#endif
212
213/**
214 * of_ti_dpll_setup - Setup function for OMAP DPLL clocks
215 * @node: device node containing the DPLL info
216 * @ops: ops for the DPLL
217 * @ddt: DPLL data template to use
Tero Kristof38b0dd2013-06-12 16:04:34 +0300218 *
219 * Initializes a DPLL clock from device tree data.
220 */
221static void __init of_ti_dpll_setup(struct device_node *node,
222 const struct clk_ops *ops,
Tero Kristoa6fe3772014-02-21 17:22:32 +0200223 const struct dpll_data *ddt)
Tero Kristof38b0dd2013-06-12 16:04:34 +0300224{
225 struct clk_hw_omap *clk_hw = NULL;
226 struct clk_init_data *init = NULL;
227 const char **parent_names = NULL;
228 struct dpll_data *dd = NULL;
229 int i;
230 u8 dpll_mode = 0;
231
232 dd = kzalloc(sizeof(*dd), GFP_KERNEL);
233 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
234 init = kzalloc(sizeof(*init), GFP_KERNEL);
235 if (!dd || !clk_hw || !init)
236 goto cleanup;
237
238 memcpy(dd, ddt, sizeof(*dd));
239
240 clk_hw->dpll_data = dd;
241 clk_hw->ops = &clkhwops_omap3_dpll;
242 clk_hw->hw.init = init;
243 clk_hw->flags = MEMMAP_ADDRESSING;
244
245 init->name = node->name;
246 init->ops = ops;
247
248 init->num_parents = of_clk_get_parent_count(node);
249 if (init->num_parents < 1) {
250 pr_err("%s must have parent(s)\n", node->name);
251 goto cleanup;
252 }
253
254 parent_names = kzalloc(sizeof(char *) * init->num_parents, GFP_KERNEL);
255 if (!parent_names)
256 goto cleanup;
257
258 for (i = 0; i < init->num_parents; i++)
259 parent_names[i] = of_clk_get_parent_name(node, i);
260
261 init->parent_names = parent_names;
262
263 dd->control_reg = ti_clk_get_reg_addr(node, 0);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300264
Tero Kristoaa76fcf2014-02-21 17:36:21 +0200265 /*
266 * Special case for OMAP2 DPLL, register order is different due to
267 * missing idlest_reg, also clkhwops is different. Detected from
268 * missing idlest_mask.
269 */
270 if (!dd->idlest_mask) {
271 dd->mult_div1_reg = ti_clk_get_reg_addr(node, 1);
272#ifdef CONFIG_ARCH_OMAP2
273 clk_hw->ops = &clkhwops_omap2xxx_dpll;
274 omap2xxx_clkt_dpllcore_init(&clk_hw->hw);
275#endif
276 } else {
277 dd->idlest_reg = ti_clk_get_reg_addr(node, 1);
278 if (!dd->idlest_reg)
279 goto cleanup;
280
281 dd->mult_div1_reg = ti_clk_get_reg_addr(node, 2);
282 }
283
284 if (!dd->control_reg || !dd->mult_div1_reg)
Tero Kristof38b0dd2013-06-12 16:04:34 +0300285 goto cleanup;
286
Tero Kristoa6fe3772014-02-21 17:22:32 +0200287 if (dd->autoidle_mask) {
Tero Kristof38b0dd2013-06-12 16:04:34 +0300288 dd->autoidle_reg = ti_clk_get_reg_addr(node, 3);
289 if (!dd->autoidle_reg)
290 goto cleanup;
291 }
292
293 if (of_property_read_bool(node, "ti,low-power-stop"))
294 dpll_mode |= 1 << DPLL_LOW_POWER_STOP;
295
296 if (of_property_read_bool(node, "ti,low-power-bypass"))
297 dpll_mode |= 1 << DPLL_LOW_POWER_BYPASS;
298
299 if (of_property_read_bool(node, "ti,lock"))
300 dpll_mode |= 1 << DPLL_LOCKED;
301
302 if (dpll_mode)
303 dd->modes = dpll_mode;
304
305 ti_clk_register_dpll(&clk_hw->hw, node);
306 return;
307
308cleanup:
309 kfree(dd);
310 kfree(parent_names);
311 kfree(init);
312 kfree(clk_hw);
313}
314
315#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
316 defined(CONFIG_SOC_DRA7XX)
317static void __init of_ti_omap4_dpll_x2_setup(struct device_node *node)
318{
319 ti_clk_register_dpll_x2(node, &dpll_x2_ck_ops, &clkhwops_omap4_dpllmx);
320}
321CLK_OF_DECLARE(ti_omap4_dpll_x2_clock, "ti,omap4-dpll-x2-clock",
322 of_ti_omap4_dpll_x2_setup);
323#endif
324
325#ifdef CONFIG_SOC_AM33XX
326static void __init of_ti_am3_dpll_x2_setup(struct device_node *node)
327{
328 ti_clk_register_dpll_x2(node, &dpll_x2_ck_ops, NULL);
329}
330CLK_OF_DECLARE(ti_am3_dpll_x2_clock, "ti,am3-dpll-x2-clock",
331 of_ti_am3_dpll_x2_setup);
332#endif
333
334#ifdef CONFIG_ARCH_OMAP3
335static void __init of_ti_omap3_dpll_setup(struct device_node *node)
336{
337 const struct dpll_data dd = {
338 .idlest_mask = 0x1,
339 .enable_mask = 0x7,
340 .autoidle_mask = 0x7,
341 .mult_mask = 0x7ff << 8,
342 .div1_mask = 0x7f,
343 .max_multiplier = 2047,
344 .max_divider = 128,
345 .min_divider = 1,
346 .freqsel_mask = 0xf0,
347 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
348 };
349
Tero Kristoa6fe3772014-02-21 17:22:32 +0200350 of_ti_dpll_setup(node, &omap3_dpll_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300351}
352CLK_OF_DECLARE(ti_omap3_dpll_clock, "ti,omap3-dpll-clock",
353 of_ti_omap3_dpll_setup);
354
355static void __init of_ti_omap3_core_dpll_setup(struct device_node *node)
356{
357 const struct dpll_data dd = {
358 .idlest_mask = 0x1,
359 .enable_mask = 0x7,
360 .autoidle_mask = 0x7,
361 .mult_mask = 0x7ff << 16,
362 .div1_mask = 0x7f << 8,
363 .max_multiplier = 2047,
364 .max_divider = 128,
365 .min_divider = 1,
366 .freqsel_mask = 0xf0,
367 };
368
Tero Kristoa6fe3772014-02-21 17:22:32 +0200369 of_ti_dpll_setup(node, &omap3_dpll_core_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300370}
371CLK_OF_DECLARE(ti_omap3_core_dpll_clock, "ti,omap3-dpll-core-clock",
372 of_ti_omap3_core_dpll_setup);
373
374static void __init of_ti_omap3_per_dpll_setup(struct device_node *node)
375{
376 const struct dpll_data dd = {
377 .idlest_mask = 0x1 << 1,
378 .enable_mask = 0x7 << 16,
379 .autoidle_mask = 0x7 << 3,
380 .mult_mask = 0x7ff << 8,
381 .div1_mask = 0x7f,
382 .max_multiplier = 2047,
383 .max_divider = 128,
384 .min_divider = 1,
385 .freqsel_mask = 0xf00000,
386 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
387 };
388
Tero Kristoa6fe3772014-02-21 17:22:32 +0200389 of_ti_dpll_setup(node, &omap3_dpll_per_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300390}
391CLK_OF_DECLARE(ti_omap3_per_dpll_clock, "ti,omap3-dpll-per-clock",
392 of_ti_omap3_per_dpll_setup);
393
394static void __init of_ti_omap3_per_jtype_dpll_setup(struct device_node *node)
395{
396 const struct dpll_data dd = {
397 .idlest_mask = 0x1 << 1,
398 .enable_mask = 0x7 << 16,
399 .autoidle_mask = 0x7 << 3,
400 .mult_mask = 0xfff << 8,
401 .div1_mask = 0x7f,
402 .max_multiplier = 4095,
403 .max_divider = 128,
404 .min_divider = 1,
405 .sddiv_mask = 0xff << 24,
406 .dco_mask = 0xe << 20,
407 .flags = DPLL_J_TYPE,
408 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
409 };
410
Tero Kristoa6fe3772014-02-21 17:22:32 +0200411 of_ti_dpll_setup(node, &omap3_dpll_per_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300412}
413CLK_OF_DECLARE(ti_omap3_per_jtype_dpll_clock, "ti,omap3-dpll-per-j-type-clock",
414 of_ti_omap3_per_jtype_dpll_setup);
415#endif
416
417static void __init of_ti_omap4_dpll_setup(struct device_node *node)
418{
419 const struct dpll_data dd = {
420 .idlest_mask = 0x1,
421 .enable_mask = 0x7,
422 .autoidle_mask = 0x7,
423 .mult_mask = 0x7ff << 8,
424 .div1_mask = 0x7f,
425 .max_multiplier = 2047,
426 .max_divider = 128,
427 .min_divider = 1,
428 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
429 };
430
Tero Kristoa6fe3772014-02-21 17:22:32 +0200431 of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300432}
433CLK_OF_DECLARE(ti_omap4_dpll_clock, "ti,omap4-dpll-clock",
434 of_ti_omap4_dpll_setup);
435
436static void __init of_ti_omap4_core_dpll_setup(struct device_node *node)
437{
438 const struct dpll_data dd = {
439 .idlest_mask = 0x1,
440 .enable_mask = 0x7,
441 .autoidle_mask = 0x7,
442 .mult_mask = 0x7ff << 8,
443 .div1_mask = 0x7f,
444 .max_multiplier = 2047,
445 .max_divider = 128,
446 .min_divider = 1,
447 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
448 };
449
Tero Kristoa6fe3772014-02-21 17:22:32 +0200450 of_ti_dpll_setup(node, &dpll_core_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300451}
452CLK_OF_DECLARE(ti_omap4_core_dpll_clock, "ti,omap4-dpll-core-clock",
453 of_ti_omap4_core_dpll_setup);
454
455#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
456 defined(CONFIG_SOC_DRA7XX)
457static void __init of_ti_omap4_m4xen_dpll_setup(struct device_node *node)
458{
459 const struct dpll_data dd = {
460 .idlest_mask = 0x1,
461 .enable_mask = 0x7,
462 .autoidle_mask = 0x7,
463 .mult_mask = 0x7ff << 8,
464 .div1_mask = 0x7f,
465 .max_multiplier = 2047,
466 .max_divider = 128,
467 .min_divider = 1,
468 .m4xen_mask = 0x800,
469 .lpmode_mask = 1 << 10,
470 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
471 };
472
Tero Kristoa6fe3772014-02-21 17:22:32 +0200473 of_ti_dpll_setup(node, &dpll_m4xen_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300474}
475CLK_OF_DECLARE(ti_omap4_m4xen_dpll_clock, "ti,omap4-dpll-m4xen-clock",
476 of_ti_omap4_m4xen_dpll_setup);
477
478static void __init of_ti_omap4_jtype_dpll_setup(struct device_node *node)
479{
480 const struct dpll_data dd = {
481 .idlest_mask = 0x1,
482 .enable_mask = 0x7,
483 .autoidle_mask = 0x7,
484 .mult_mask = 0xfff << 8,
485 .div1_mask = 0xff,
486 .max_multiplier = 4095,
487 .max_divider = 256,
488 .min_divider = 1,
489 .sddiv_mask = 0xff << 24,
490 .flags = DPLL_J_TYPE,
491 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
492 };
493
Tero Kristoa6fe3772014-02-21 17:22:32 +0200494 of_ti_dpll_setup(node, &dpll_m4xen_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300495}
496CLK_OF_DECLARE(ti_omap4_jtype_dpll_clock, "ti,omap4-dpll-j-type-clock",
497 of_ti_omap4_jtype_dpll_setup);
498#endif
499
500static void __init of_ti_am3_no_gate_dpll_setup(struct device_node *node)
501{
502 const struct dpll_data dd = {
503 .idlest_mask = 0x1,
504 .enable_mask = 0x7,
Tero Kristof38b0dd2013-06-12 16:04:34 +0300505 .mult_mask = 0x7ff << 8,
506 .div1_mask = 0x7f,
507 .max_multiplier = 2047,
508 .max_divider = 128,
509 .min_divider = 1,
510 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
511 };
512
Tero Kristoa6fe3772014-02-21 17:22:32 +0200513 of_ti_dpll_setup(node, &dpll_no_gate_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300514}
515CLK_OF_DECLARE(ti_am3_no_gate_dpll_clock, "ti,am3-dpll-no-gate-clock",
516 of_ti_am3_no_gate_dpll_setup);
517
518static void __init of_ti_am3_jtype_dpll_setup(struct device_node *node)
519{
520 const struct dpll_data dd = {
521 .idlest_mask = 0x1,
522 .enable_mask = 0x7,
Tero Kristof38b0dd2013-06-12 16:04:34 +0300523 .mult_mask = 0x7ff << 8,
524 .div1_mask = 0x7f,
525 .max_multiplier = 4095,
526 .max_divider = 256,
527 .min_divider = 2,
528 .flags = DPLL_J_TYPE,
529 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
530 };
531
Tero Kristoa6fe3772014-02-21 17:22:32 +0200532 of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300533}
534CLK_OF_DECLARE(ti_am3_jtype_dpll_clock, "ti,am3-dpll-j-type-clock",
535 of_ti_am3_jtype_dpll_setup);
536
537static void __init of_ti_am3_no_gate_jtype_dpll_setup(struct device_node *node)
538{
539 const struct dpll_data dd = {
540 .idlest_mask = 0x1,
541 .enable_mask = 0x7,
Tero Kristof38b0dd2013-06-12 16:04:34 +0300542 .mult_mask = 0x7ff << 8,
543 .div1_mask = 0x7f,
544 .max_multiplier = 2047,
545 .max_divider = 128,
546 .min_divider = 1,
547 .flags = DPLL_J_TYPE,
548 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
549 };
550
Tero Kristoa6fe3772014-02-21 17:22:32 +0200551 of_ti_dpll_setup(node, &dpll_no_gate_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300552}
553CLK_OF_DECLARE(ti_am3_no_gate_jtype_dpll_clock,
554 "ti,am3-dpll-no-gate-j-type-clock",
555 of_ti_am3_no_gate_jtype_dpll_setup);
556
557static void __init of_ti_am3_dpll_setup(struct device_node *node)
558{
559 const struct dpll_data dd = {
560 .idlest_mask = 0x1,
561 .enable_mask = 0x7,
Tero Kristof38b0dd2013-06-12 16:04:34 +0300562 .mult_mask = 0x7ff << 8,
563 .div1_mask = 0x7f,
564 .max_multiplier = 2047,
565 .max_divider = 128,
566 .min_divider = 1,
567 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
568 };
569
Tero Kristoa6fe3772014-02-21 17:22:32 +0200570 of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300571}
572CLK_OF_DECLARE(ti_am3_dpll_clock, "ti,am3-dpll-clock", of_ti_am3_dpll_setup);
573
574static void __init of_ti_am3_core_dpll_setup(struct device_node *node)
575{
576 const struct dpll_data dd = {
577 .idlest_mask = 0x1,
578 .enable_mask = 0x7,
Tero Kristof38b0dd2013-06-12 16:04:34 +0300579 .mult_mask = 0x7ff << 8,
580 .div1_mask = 0x7f,
581 .max_multiplier = 2047,
582 .max_divider = 128,
583 .min_divider = 1,
584 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
585 };
586
Tero Kristoa6fe3772014-02-21 17:22:32 +0200587 of_ti_dpll_setup(node, &dpll_core_ck_ops, &dd);
Tero Kristof38b0dd2013-06-12 16:04:34 +0300588}
589CLK_OF_DECLARE(ti_am3_core_dpll_clock, "ti,am3-dpll-core-clock",
590 of_ti_am3_core_dpll_setup);
Tero Kristoaa76fcf2014-02-21 17:36:21 +0200591
592static void __init of_ti_omap2_core_dpll_setup(struct device_node *node)
593{
594 const struct dpll_data dd = {
595 .enable_mask = 0x3,
596 .mult_mask = 0x3ff << 12,
597 .div1_mask = 0xf << 8,
598 .max_divider = 16,
599 .min_divider = 1,
600 };
601
602 of_ti_dpll_setup(node, &omap2_dpll_core_ck_ops, &dd);
603}
604CLK_OF_DECLARE(ti_omap2_core_dpll_clock, "ti,omap2-dpll-core-clock",
605 of_ti_omap2_core_dpll_setup);