Merge branch 'r6040-next'
[linux/fpc-iii.git] / drivers / clk / ti / dpll.c
blob9fc8754a6e6160081c067a5a96b364b8bf0ec40a
1 /*
2 * OMAP DPLL clock support
4 * Copyright (C) 2013 Texas Instruments, Inc.
6 * Tero Kristo <t-kristo@ti.com>
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.
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.
18 #include <linux/clk.h>
19 #include <linux/clk-provider.h>
20 #include <linux/slab.h>
21 #include <linux/err.h>
22 #include <linux/of.h>
23 #include <linux/of_address.h>
24 #include <linux/clk/ti.h>
25 #include "clock.h"
27 #undef pr_fmt
28 #define pr_fmt(fmt) "%s: " fmt, __func__
30 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
31 defined(CONFIG_SOC_DRA7XX)
32 static const struct clk_ops dpll_m4xen_ck_ops = {
33 .enable = &omap3_noncore_dpll_enable,
34 .disable = &omap3_noncore_dpll_disable,
35 .recalc_rate = &omap4_dpll_regm4xen_recalc,
36 .round_rate = &omap4_dpll_regm4xen_round_rate,
37 .set_rate = &omap3_noncore_dpll_set_rate,
38 .set_parent = &omap3_noncore_dpll_set_parent,
39 .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
40 .determine_rate = &omap4_dpll_regm4xen_determine_rate,
41 .get_parent = &omap2_init_dpll_parent,
43 #else
44 static const struct clk_ops dpll_m4xen_ck_ops = {};
45 #endif
47 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) || \
48 defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX) || \
49 defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
50 static const struct clk_ops dpll_core_ck_ops = {
51 .recalc_rate = &omap3_dpll_recalc,
52 .get_parent = &omap2_init_dpll_parent,
55 static const struct clk_ops dpll_ck_ops = {
56 .enable = &omap3_noncore_dpll_enable,
57 .disable = &omap3_noncore_dpll_disable,
58 .recalc_rate = &omap3_dpll_recalc,
59 .round_rate = &omap2_dpll_round_rate,
60 .set_rate = &omap3_noncore_dpll_set_rate,
61 .set_parent = &omap3_noncore_dpll_set_parent,
62 .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
63 .determine_rate = &omap3_noncore_dpll_determine_rate,
64 .get_parent = &omap2_init_dpll_parent,
67 static const struct clk_ops dpll_no_gate_ck_ops = {
68 .recalc_rate = &omap3_dpll_recalc,
69 .get_parent = &omap2_init_dpll_parent,
70 .round_rate = &omap2_dpll_round_rate,
71 .set_rate = &omap3_noncore_dpll_set_rate,
72 .set_parent = &omap3_noncore_dpll_set_parent,
73 .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
74 .determine_rate = &omap3_noncore_dpll_determine_rate,
76 #else
77 static const struct clk_ops dpll_core_ck_ops = {};
78 static const struct clk_ops dpll_ck_ops = {};
79 static const struct clk_ops dpll_no_gate_ck_ops = {};
80 const struct clk_hw_omap_ops clkhwops_omap3_dpll = {};
81 #endif
83 #ifdef CONFIG_ARCH_OMAP2
84 static const struct clk_ops omap2_dpll_core_ck_ops = {
85 .get_parent = &omap2_init_dpll_parent,
86 .recalc_rate = &omap2_dpllcore_recalc,
87 .round_rate = &omap2_dpll_round_rate,
88 .set_rate = &omap2_reprogram_dpllcore,
90 #else
91 static const struct clk_ops omap2_dpll_core_ck_ops = {};
92 #endif
94 #ifdef CONFIG_ARCH_OMAP3
95 static const struct clk_ops omap3_dpll_core_ck_ops = {
96 .get_parent = &omap2_init_dpll_parent,
97 .recalc_rate = &omap3_dpll_recalc,
98 .round_rate = &omap2_dpll_round_rate,
100 #else
101 static const struct clk_ops omap3_dpll_core_ck_ops = {};
102 #endif
104 #ifdef CONFIG_ARCH_OMAP3
105 static const struct clk_ops omap3_dpll_ck_ops = {
106 .enable = &omap3_noncore_dpll_enable,
107 .disable = &omap3_noncore_dpll_disable,
108 .get_parent = &omap2_init_dpll_parent,
109 .recalc_rate = &omap3_dpll_recalc,
110 .set_rate = &omap3_noncore_dpll_set_rate,
111 .set_parent = &omap3_noncore_dpll_set_parent,
112 .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
113 .determine_rate = &omap3_noncore_dpll_determine_rate,
114 .round_rate = &omap2_dpll_round_rate,
117 static const struct clk_ops omap3_dpll_per_ck_ops = {
118 .enable = &omap3_noncore_dpll_enable,
119 .disable = &omap3_noncore_dpll_disable,
120 .get_parent = &omap2_init_dpll_parent,
121 .recalc_rate = &omap3_dpll_recalc,
122 .set_rate = &omap3_dpll4_set_rate,
123 .set_parent = &omap3_noncore_dpll_set_parent,
124 .set_rate_and_parent = &omap3_dpll4_set_rate_and_parent,
125 .determine_rate = &omap3_noncore_dpll_determine_rate,
126 .round_rate = &omap2_dpll_round_rate,
128 #endif
130 static const struct clk_ops dpll_x2_ck_ops = {
131 .recalc_rate = &omap3_clkoutx2_recalc,
135 * _register_dpll - low level registration of a DPLL clock
136 * @hw: hardware clock definition for the clock
137 * @node: device node for the clock
139 * Finalizes DPLL registration process. In case a failure (clk-ref or
140 * clk-bypass is missing), the clock is added to retry list and
141 * the initialization is retried on later stage.
143 static void __init _register_dpll(struct clk_hw *hw,
144 struct device_node *node)
146 struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
147 struct dpll_data *dd = clk_hw->dpll_data;
148 struct clk *clk;
150 clk = of_clk_get(node, 0);
151 if (IS_ERR(clk)) {
152 pr_debug("clk-ref missing for %s, retry later\n",
153 node->name);
154 if (!ti_clk_retry_init(node, hw, _register_dpll))
155 return;
157 goto cleanup;
160 dd->clk_ref = __clk_get_hw(clk);
162 clk = of_clk_get(node, 1);
164 if (IS_ERR(clk)) {
165 pr_debug("clk-bypass missing for %s, retry later\n",
166 node->name);
167 if (!ti_clk_retry_init(node, hw, _register_dpll))
168 return;
170 goto cleanup;
173 dd->clk_bypass = __clk_get_hw(clk);
175 /* register the clock */
176 clk = clk_register(NULL, &clk_hw->hw);
178 if (!IS_ERR(clk)) {
179 omap2_init_clk_hw_omap_clocks(&clk_hw->hw);
180 of_clk_add_provider(node, of_clk_src_simple_get, clk);
181 kfree(clk_hw->hw.init->parent_names);
182 kfree(clk_hw->hw.init);
183 return;
186 cleanup:
187 kfree(clk_hw->dpll_data);
188 kfree(clk_hw->hw.init->parent_names);
189 kfree(clk_hw->hw.init);
190 kfree(clk_hw);
193 #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS)
194 static void __iomem *_get_reg(u8 module, u16 offset)
196 u32 reg;
197 struct clk_omap_reg *reg_setup;
199 reg_setup = (struct clk_omap_reg *)&reg;
201 reg_setup->index = module;
202 reg_setup->offset = offset;
204 return (void __iomem *)reg;
207 struct clk *ti_clk_register_dpll(struct ti_clk *setup)
209 struct clk_hw_omap *clk_hw;
210 struct clk_init_data init = { NULL };
211 struct dpll_data *dd;
212 struct clk *clk;
213 struct ti_clk_dpll *dpll;
214 const struct clk_ops *ops = &omap3_dpll_ck_ops;
215 struct clk *clk_ref;
216 struct clk *clk_bypass;
218 dpll = setup->data;
220 if (dpll->num_parents < 2)
221 return ERR_PTR(-EINVAL);
223 clk_ref = clk_get_sys(NULL, dpll->parents[0]);
224 clk_bypass = clk_get_sys(NULL, dpll->parents[1]);
226 if (IS_ERR_OR_NULL(clk_ref) || IS_ERR_OR_NULL(clk_bypass))
227 return ERR_PTR(-EAGAIN);
229 dd = kzalloc(sizeof(*dd), GFP_KERNEL);
230 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
231 if (!dd || !clk_hw) {
232 clk = ERR_PTR(-ENOMEM);
233 goto cleanup;
236 clk_hw->dpll_data = dd;
237 clk_hw->ops = &clkhwops_omap3_dpll;
238 clk_hw->hw.init = &init;
239 clk_hw->flags = MEMMAP_ADDRESSING;
241 init.name = setup->name;
242 init.ops = ops;
244 init.num_parents = dpll->num_parents;
245 init.parent_names = dpll->parents;
247 dd->control_reg = _get_reg(dpll->module, dpll->control_reg);
248 dd->idlest_reg = _get_reg(dpll->module, dpll->idlest_reg);
249 dd->mult_div1_reg = _get_reg(dpll->module, dpll->mult_div1_reg);
250 dd->autoidle_reg = _get_reg(dpll->module, dpll->autoidle_reg);
252 dd->modes = dpll->modes;
253 dd->div1_mask = dpll->div1_mask;
254 dd->idlest_mask = dpll->idlest_mask;
255 dd->mult_mask = dpll->mult_mask;
256 dd->autoidle_mask = dpll->autoidle_mask;
257 dd->enable_mask = dpll->enable_mask;
258 dd->sddiv_mask = dpll->sddiv_mask;
259 dd->dco_mask = dpll->dco_mask;
260 dd->max_divider = dpll->max_divider;
261 dd->min_divider = dpll->min_divider;
262 dd->max_multiplier = dpll->max_multiplier;
263 dd->auto_recal_bit = dpll->auto_recal_bit;
264 dd->recal_en_bit = dpll->recal_en_bit;
265 dd->recal_st_bit = dpll->recal_st_bit;
267 dd->clk_ref = __clk_get_hw(clk_ref);
268 dd->clk_bypass = __clk_get_hw(clk_bypass);
270 if (dpll->flags & CLKF_CORE)
271 ops = &omap3_dpll_core_ck_ops;
273 if (dpll->flags & CLKF_PER)
274 ops = &omap3_dpll_per_ck_ops;
276 if (dpll->flags & CLKF_J_TYPE)
277 dd->flags |= DPLL_J_TYPE;
279 clk = clk_register(NULL, &clk_hw->hw);
281 if (!IS_ERR(clk))
282 return clk;
284 cleanup:
285 kfree(dd);
286 kfree(clk_hw);
287 return clk;
289 #endif
291 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
292 defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) || \
293 defined(CONFIG_SOC_AM43XX)
295 * _register_dpll_x2 - Registers a DPLLx2 clock
296 * @node: device node for this clock
297 * @ops: clk_ops for this clock
298 * @hw_ops: clk_hw_ops for this clock
300 * Initializes a DPLL x 2 clock from device tree data.
302 static void _register_dpll_x2(struct device_node *node,
303 const struct clk_ops *ops,
304 const struct clk_hw_omap_ops *hw_ops)
306 struct clk *clk;
307 struct clk_init_data init = { NULL };
308 struct clk_hw_omap *clk_hw;
309 const char *name = node->name;
310 const char *parent_name;
312 parent_name = of_clk_get_parent_name(node, 0);
313 if (!parent_name) {
314 pr_err("%s must have parent\n", node->name);
315 return;
318 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
319 if (!clk_hw)
320 return;
322 clk_hw->ops = hw_ops;
323 clk_hw->hw.init = &init;
325 init.name = name;
326 init.ops = ops;
327 init.parent_names = &parent_name;
328 init.num_parents = 1;
330 /* register the clock */
331 clk = clk_register(NULL, &clk_hw->hw);
333 if (IS_ERR(clk)) {
334 kfree(clk_hw);
335 } else {
336 omap2_init_clk_hw_omap_clocks(&clk_hw->hw);
337 of_clk_add_provider(node, of_clk_src_simple_get, clk);
340 #endif
343 * of_ti_dpll_setup - Setup function for OMAP DPLL clocks
344 * @node: device node containing the DPLL info
345 * @ops: ops for the DPLL
346 * @ddt: DPLL data template to use
348 * Initializes a DPLL clock from device tree data.
350 static void __init of_ti_dpll_setup(struct device_node *node,
351 const struct clk_ops *ops,
352 const struct dpll_data *ddt)
354 struct clk_hw_omap *clk_hw = NULL;
355 struct clk_init_data *init = NULL;
356 const char **parent_names = NULL;
357 struct dpll_data *dd = NULL;
358 u8 dpll_mode = 0;
360 dd = kzalloc(sizeof(*dd), GFP_KERNEL);
361 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
362 init = kzalloc(sizeof(*init), GFP_KERNEL);
363 if (!dd || !clk_hw || !init)
364 goto cleanup;
366 memcpy(dd, ddt, sizeof(*dd));
368 clk_hw->dpll_data = dd;
369 clk_hw->ops = &clkhwops_omap3_dpll;
370 clk_hw->hw.init = init;
371 clk_hw->flags = MEMMAP_ADDRESSING;
373 init->name = node->name;
374 init->ops = ops;
376 init->num_parents = of_clk_get_parent_count(node);
377 if (!init->num_parents) {
378 pr_err("%s must have parent(s)\n", node->name);
379 goto cleanup;
382 parent_names = kzalloc(sizeof(char *) * init->num_parents, GFP_KERNEL);
383 if (!parent_names)
384 goto cleanup;
386 of_clk_parent_fill(node, parent_names, init->num_parents);
388 init->parent_names = parent_names;
390 dd->control_reg = ti_clk_get_reg_addr(node, 0);
393 * Special case for OMAP2 DPLL, register order is different due to
394 * missing idlest_reg, also clkhwops is different. Detected from
395 * missing idlest_mask.
397 if (!dd->idlest_mask) {
398 dd->mult_div1_reg = ti_clk_get_reg_addr(node, 1);
399 #ifdef CONFIG_ARCH_OMAP2
400 clk_hw->ops = &clkhwops_omap2xxx_dpll;
401 omap2xxx_clkt_dpllcore_init(&clk_hw->hw);
402 #endif
403 } else {
404 dd->idlest_reg = ti_clk_get_reg_addr(node, 1);
405 if (IS_ERR(dd->idlest_reg))
406 goto cleanup;
408 dd->mult_div1_reg = ti_clk_get_reg_addr(node, 2);
411 if (IS_ERR(dd->control_reg) || IS_ERR(dd->mult_div1_reg))
412 goto cleanup;
414 if (dd->autoidle_mask) {
415 dd->autoidle_reg = ti_clk_get_reg_addr(node, 3);
416 if (IS_ERR(dd->autoidle_reg))
417 goto cleanup;
420 if (of_property_read_bool(node, "ti,low-power-stop"))
421 dpll_mode |= 1 << DPLL_LOW_POWER_STOP;
423 if (of_property_read_bool(node, "ti,low-power-bypass"))
424 dpll_mode |= 1 << DPLL_LOW_POWER_BYPASS;
426 if (of_property_read_bool(node, "ti,lock"))
427 dpll_mode |= 1 << DPLL_LOCKED;
429 if (dpll_mode)
430 dd->modes = dpll_mode;
432 _register_dpll(&clk_hw->hw, node);
433 return;
435 cleanup:
436 kfree(dd);
437 kfree(parent_names);
438 kfree(init);
439 kfree(clk_hw);
442 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
443 defined(CONFIG_SOC_DRA7XX)
444 static void __init of_ti_omap4_dpll_x2_setup(struct device_node *node)
446 _register_dpll_x2(node, &dpll_x2_ck_ops, &clkhwops_omap4_dpllmx);
448 CLK_OF_DECLARE(ti_omap4_dpll_x2_clock, "ti,omap4-dpll-x2-clock",
449 of_ti_omap4_dpll_x2_setup);
450 #endif
452 #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
453 static void __init of_ti_am3_dpll_x2_setup(struct device_node *node)
455 _register_dpll_x2(node, &dpll_x2_ck_ops, NULL);
457 CLK_OF_DECLARE(ti_am3_dpll_x2_clock, "ti,am3-dpll-x2-clock",
458 of_ti_am3_dpll_x2_setup);
459 #endif
461 #ifdef CONFIG_ARCH_OMAP3
462 static void __init of_ti_omap3_dpll_setup(struct device_node *node)
464 const struct dpll_data dd = {
465 .idlest_mask = 0x1,
466 .enable_mask = 0x7,
467 .autoidle_mask = 0x7,
468 .mult_mask = 0x7ff << 8,
469 .div1_mask = 0x7f,
470 .max_multiplier = 2047,
471 .max_divider = 128,
472 .min_divider = 1,
473 .freqsel_mask = 0xf0,
474 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
477 of_ti_dpll_setup(node, &omap3_dpll_ck_ops, &dd);
479 CLK_OF_DECLARE(ti_omap3_dpll_clock, "ti,omap3-dpll-clock",
480 of_ti_omap3_dpll_setup);
482 static void __init of_ti_omap3_core_dpll_setup(struct device_node *node)
484 const struct dpll_data dd = {
485 .idlest_mask = 0x1,
486 .enable_mask = 0x7,
487 .autoidle_mask = 0x7,
488 .mult_mask = 0x7ff << 16,
489 .div1_mask = 0x7f << 8,
490 .max_multiplier = 2047,
491 .max_divider = 128,
492 .min_divider = 1,
493 .freqsel_mask = 0xf0,
496 of_ti_dpll_setup(node, &omap3_dpll_core_ck_ops, &dd);
498 CLK_OF_DECLARE(ti_omap3_core_dpll_clock, "ti,omap3-dpll-core-clock",
499 of_ti_omap3_core_dpll_setup);
501 static void __init of_ti_omap3_per_dpll_setup(struct device_node *node)
503 const struct dpll_data dd = {
504 .idlest_mask = 0x1 << 1,
505 .enable_mask = 0x7 << 16,
506 .autoidle_mask = 0x7 << 3,
507 .mult_mask = 0x7ff << 8,
508 .div1_mask = 0x7f,
509 .max_multiplier = 2047,
510 .max_divider = 128,
511 .min_divider = 1,
512 .freqsel_mask = 0xf00000,
513 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
516 of_ti_dpll_setup(node, &omap3_dpll_per_ck_ops, &dd);
518 CLK_OF_DECLARE(ti_omap3_per_dpll_clock, "ti,omap3-dpll-per-clock",
519 of_ti_omap3_per_dpll_setup);
521 static void __init of_ti_omap3_per_jtype_dpll_setup(struct device_node *node)
523 const struct dpll_data dd = {
524 .idlest_mask = 0x1 << 1,
525 .enable_mask = 0x7 << 16,
526 .autoidle_mask = 0x7 << 3,
527 .mult_mask = 0xfff << 8,
528 .div1_mask = 0x7f,
529 .max_multiplier = 4095,
530 .max_divider = 128,
531 .min_divider = 1,
532 .sddiv_mask = 0xff << 24,
533 .dco_mask = 0xe << 20,
534 .flags = DPLL_J_TYPE,
535 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
538 of_ti_dpll_setup(node, &omap3_dpll_per_ck_ops, &dd);
540 CLK_OF_DECLARE(ti_omap3_per_jtype_dpll_clock, "ti,omap3-dpll-per-j-type-clock",
541 of_ti_omap3_per_jtype_dpll_setup);
542 #endif
544 static void __init of_ti_omap4_dpll_setup(struct device_node *node)
546 const struct dpll_data dd = {
547 .idlest_mask = 0x1,
548 .enable_mask = 0x7,
549 .autoidle_mask = 0x7,
550 .mult_mask = 0x7ff << 8,
551 .div1_mask = 0x7f,
552 .max_multiplier = 2047,
553 .max_divider = 128,
554 .min_divider = 1,
555 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
558 of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
560 CLK_OF_DECLARE(ti_omap4_dpll_clock, "ti,omap4-dpll-clock",
561 of_ti_omap4_dpll_setup);
563 static void __init of_ti_omap5_mpu_dpll_setup(struct device_node *node)
565 const struct dpll_data dd = {
566 .idlest_mask = 0x1,
567 .enable_mask = 0x7,
568 .autoidle_mask = 0x7,
569 .mult_mask = 0x7ff << 8,
570 .div1_mask = 0x7f,
571 .max_multiplier = 2047,
572 .max_divider = 128,
573 .dcc_mask = BIT(22),
574 .dcc_rate = 1400000000, /* DCC beyond 1.4GHz */
575 .min_divider = 1,
576 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
579 of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
581 CLK_OF_DECLARE(of_ti_omap5_mpu_dpll_clock, "ti,omap5-mpu-dpll-clock",
582 of_ti_omap5_mpu_dpll_setup);
584 static void __init of_ti_omap4_core_dpll_setup(struct device_node *node)
586 const struct dpll_data dd = {
587 .idlest_mask = 0x1,
588 .enable_mask = 0x7,
589 .autoidle_mask = 0x7,
590 .mult_mask = 0x7ff << 8,
591 .div1_mask = 0x7f,
592 .max_multiplier = 2047,
593 .max_divider = 128,
594 .min_divider = 1,
595 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
598 of_ti_dpll_setup(node, &dpll_core_ck_ops, &dd);
600 CLK_OF_DECLARE(ti_omap4_core_dpll_clock, "ti,omap4-dpll-core-clock",
601 of_ti_omap4_core_dpll_setup);
603 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
604 defined(CONFIG_SOC_DRA7XX)
605 static void __init of_ti_omap4_m4xen_dpll_setup(struct device_node *node)
607 const struct dpll_data dd = {
608 .idlest_mask = 0x1,
609 .enable_mask = 0x7,
610 .autoidle_mask = 0x7,
611 .mult_mask = 0x7ff << 8,
612 .div1_mask = 0x7f,
613 .max_multiplier = 2047,
614 .max_divider = 128,
615 .min_divider = 1,
616 .m4xen_mask = 0x800,
617 .lpmode_mask = 1 << 10,
618 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
621 of_ti_dpll_setup(node, &dpll_m4xen_ck_ops, &dd);
623 CLK_OF_DECLARE(ti_omap4_m4xen_dpll_clock, "ti,omap4-dpll-m4xen-clock",
624 of_ti_omap4_m4xen_dpll_setup);
626 static void __init of_ti_omap4_jtype_dpll_setup(struct device_node *node)
628 const struct dpll_data dd = {
629 .idlest_mask = 0x1,
630 .enable_mask = 0x7,
631 .autoidle_mask = 0x7,
632 .mult_mask = 0xfff << 8,
633 .div1_mask = 0xff,
634 .max_multiplier = 4095,
635 .max_divider = 256,
636 .min_divider = 1,
637 .sddiv_mask = 0xff << 24,
638 .flags = DPLL_J_TYPE,
639 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
642 of_ti_dpll_setup(node, &dpll_m4xen_ck_ops, &dd);
644 CLK_OF_DECLARE(ti_omap4_jtype_dpll_clock, "ti,omap4-dpll-j-type-clock",
645 of_ti_omap4_jtype_dpll_setup);
646 #endif
648 static void __init of_ti_am3_no_gate_dpll_setup(struct device_node *node)
650 const struct dpll_data dd = {
651 .idlest_mask = 0x1,
652 .enable_mask = 0x7,
653 .mult_mask = 0x7ff << 8,
654 .div1_mask = 0x7f,
655 .max_multiplier = 2047,
656 .max_divider = 128,
657 .min_divider = 1,
658 .max_rate = 1000000000,
659 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
662 of_ti_dpll_setup(node, &dpll_no_gate_ck_ops, &dd);
664 CLK_OF_DECLARE(ti_am3_no_gate_dpll_clock, "ti,am3-dpll-no-gate-clock",
665 of_ti_am3_no_gate_dpll_setup);
667 static void __init of_ti_am3_jtype_dpll_setup(struct device_node *node)
669 const struct dpll_data dd = {
670 .idlest_mask = 0x1,
671 .enable_mask = 0x7,
672 .mult_mask = 0x7ff << 8,
673 .div1_mask = 0x7f,
674 .max_multiplier = 4095,
675 .max_divider = 256,
676 .min_divider = 2,
677 .flags = DPLL_J_TYPE,
678 .max_rate = 2000000000,
679 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
682 of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
684 CLK_OF_DECLARE(ti_am3_jtype_dpll_clock, "ti,am3-dpll-j-type-clock",
685 of_ti_am3_jtype_dpll_setup);
687 static void __init of_ti_am3_no_gate_jtype_dpll_setup(struct device_node *node)
689 const struct dpll_data dd = {
690 .idlest_mask = 0x1,
691 .enable_mask = 0x7,
692 .mult_mask = 0x7ff << 8,
693 .div1_mask = 0x7f,
694 .max_multiplier = 2047,
695 .max_divider = 128,
696 .min_divider = 1,
697 .max_rate = 2000000000,
698 .flags = DPLL_J_TYPE,
699 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
702 of_ti_dpll_setup(node, &dpll_no_gate_ck_ops, &dd);
704 CLK_OF_DECLARE(ti_am3_no_gate_jtype_dpll_clock,
705 "ti,am3-dpll-no-gate-j-type-clock",
706 of_ti_am3_no_gate_jtype_dpll_setup);
708 static void __init of_ti_am3_dpll_setup(struct device_node *node)
710 const struct dpll_data dd = {
711 .idlest_mask = 0x1,
712 .enable_mask = 0x7,
713 .mult_mask = 0x7ff << 8,
714 .div1_mask = 0x7f,
715 .max_multiplier = 2047,
716 .max_divider = 128,
717 .min_divider = 1,
718 .max_rate = 1000000000,
719 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
722 of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
724 CLK_OF_DECLARE(ti_am3_dpll_clock, "ti,am3-dpll-clock", of_ti_am3_dpll_setup);
726 static void __init of_ti_am3_core_dpll_setup(struct device_node *node)
728 const struct dpll_data dd = {
729 .idlest_mask = 0x1,
730 .enable_mask = 0x7,
731 .mult_mask = 0x7ff << 8,
732 .div1_mask = 0x7f,
733 .max_multiplier = 2047,
734 .max_divider = 128,
735 .min_divider = 1,
736 .max_rate = 1000000000,
737 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
740 of_ti_dpll_setup(node, &dpll_core_ck_ops, &dd);
742 CLK_OF_DECLARE(ti_am3_core_dpll_clock, "ti,am3-dpll-core-clock",
743 of_ti_am3_core_dpll_setup);
745 static void __init of_ti_omap2_core_dpll_setup(struct device_node *node)
747 const struct dpll_data dd = {
748 .enable_mask = 0x3,
749 .mult_mask = 0x3ff << 12,
750 .div1_mask = 0xf << 8,
751 .max_divider = 16,
752 .min_divider = 1,
755 of_ti_dpll_setup(node, &omap2_dpll_core_ck_ops, &dd);
757 CLK_OF_DECLARE(ti_omap2_core_dpll_clock, "ti,omap2-dpll-core-clock",
758 of_ti_omap2_core_dpll_setup);