15a729246SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2f38b0dd6STero Kristo /*
3f38b0dd6STero Kristo * OMAP DPLL clock support
4f38b0dd6STero Kristo *
5f38b0dd6STero Kristo * Copyright (C) 2013 Texas Instruments, Inc.
6f38b0dd6STero Kristo *
7f38b0dd6STero Kristo * Tero Kristo <t-kristo@ti.com>
8f38b0dd6STero Kristo */
9f38b0dd6STero Kristo
101b29e601SStephen Boyd #include <linux/clk.h>
11f38b0dd6STero Kristo #include <linux/clk-provider.h>
12f38b0dd6STero Kristo #include <linux/slab.h>
13f38b0dd6STero Kristo #include <linux/err.h>
14f38b0dd6STero Kristo #include <linux/of.h>
15f38b0dd6STero Kristo #include <linux/of_address.h>
16f38b0dd6STero Kristo #include <linux/clk/ti.h>
17ed405a23STero Kristo #include "clock.h"
18f38b0dd6STero Kristo
19f38b0dd6STero Kristo #undef pr_fmt
20f38b0dd6STero Kristo #define pr_fmt(fmt) "%s: " fmt, __func__
21f38b0dd6STero Kristo
22f38b0dd6STero Kristo #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
23f38b0dd6STero Kristo defined(CONFIG_SOC_DRA7XX)
24f38b0dd6STero Kristo static const struct clk_ops dpll_m4xen_ck_ops = {
25f38b0dd6STero Kristo .enable = &omap3_noncore_dpll_enable,
26f38b0dd6STero Kristo .disable = &omap3_noncore_dpll_disable,
27f38b0dd6STero Kristo .recalc_rate = &omap4_dpll_regm4xen_recalc,
28f38b0dd6STero Kristo .round_rate = &omap4_dpll_regm4xen_round_rate,
29f38b0dd6STero Kristo .set_rate = &omap3_noncore_dpll_set_rate,
302e1a7b01STero Kristo .set_parent = &omap3_noncore_dpll_set_parent,
312e1a7b01STero Kristo .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
322e1a7b01STero Kristo .determine_rate = &omap4_dpll_regm4xen_determine_rate,
33f38b0dd6STero Kristo .get_parent = &omap2_init_dpll_parent,
34d6e7bbc1SRuss Dill .save_context = &omap3_core_dpll_save_context,
35d6e7bbc1SRuss Dill .restore_context = &omap3_core_dpll_restore_context,
36f38b0dd6STero Kristo };
37aa76fcf4STero Kristo #else
38aa76fcf4STero Kristo static const struct clk_ops dpll_m4xen_ck_ops = {};
39f38b0dd6STero Kristo #endif
40f38b0dd6STero Kristo
41aa76fcf4STero Kristo #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) || \
42aa76fcf4STero Kristo defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX) || \
43aa76fcf4STero Kristo defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
44f38b0dd6STero Kristo static const struct clk_ops dpll_core_ck_ops = {
45f38b0dd6STero Kristo .recalc_rate = &omap3_dpll_recalc,
46f38b0dd6STero Kristo .get_parent = &omap2_init_dpll_parent,
47f38b0dd6STero Kristo };
48f38b0dd6STero Kristo
49f38b0dd6STero Kristo static const struct clk_ops dpll_ck_ops = {
50f38b0dd6STero Kristo .enable = &omap3_noncore_dpll_enable,
51f38b0dd6STero Kristo .disable = &omap3_noncore_dpll_disable,
52f38b0dd6STero Kristo .recalc_rate = &omap3_dpll_recalc,
53f38b0dd6STero Kristo .round_rate = &omap2_dpll_round_rate,
54f38b0dd6STero Kristo .set_rate = &omap3_noncore_dpll_set_rate,
552e1a7b01STero Kristo .set_parent = &omap3_noncore_dpll_set_parent,
562e1a7b01STero Kristo .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
572e1a7b01STero Kristo .determine_rate = &omap3_noncore_dpll_determine_rate,
58f38b0dd6STero Kristo .get_parent = &omap2_init_dpll_parent,
59d6e7bbc1SRuss Dill .save_context = &omap3_noncore_dpll_save_context,
60d6e7bbc1SRuss Dill .restore_context = &omap3_noncore_dpll_restore_context,
61f38b0dd6STero Kristo };
62f38b0dd6STero Kristo
63f38b0dd6STero Kristo static const struct clk_ops dpll_no_gate_ck_ops = {
64f38b0dd6STero Kristo .recalc_rate = &omap3_dpll_recalc,
65f38b0dd6STero Kristo .get_parent = &omap2_init_dpll_parent,
66f38b0dd6STero Kristo .round_rate = &omap2_dpll_round_rate,
67f38b0dd6STero Kristo .set_rate = &omap3_noncore_dpll_set_rate,
682e1a7b01STero Kristo .set_parent = &omap3_noncore_dpll_set_parent,
692e1a7b01STero Kristo .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
702e1a7b01STero Kristo .determine_rate = &omap3_noncore_dpll_determine_rate,
71d6e7bbc1SRuss Dill .save_context = &omap3_noncore_dpll_save_context,
72d6e7bbc1SRuss Dill .restore_context = &omap3_noncore_dpll_restore_context
73f38b0dd6STero Kristo };
74aa76fcf4STero Kristo #else
75aa76fcf4STero Kristo static const struct clk_ops dpll_core_ck_ops = {};
76aa76fcf4STero Kristo static const struct clk_ops dpll_ck_ops = {};
77aa76fcf4STero Kristo static const struct clk_ops dpll_no_gate_ck_ops = {};
78aa76fcf4STero Kristo const struct clk_hw_omap_ops clkhwops_omap3_dpll = {};
79aa76fcf4STero Kristo #endif
80aa76fcf4STero Kristo
81aa76fcf4STero Kristo #ifdef CONFIG_ARCH_OMAP2
82aa76fcf4STero Kristo static const struct clk_ops omap2_dpll_core_ck_ops = {
83aa76fcf4STero Kristo .get_parent = &omap2_init_dpll_parent,
84aa76fcf4STero Kristo .recalc_rate = &omap2_dpllcore_recalc,
85aa76fcf4STero Kristo .round_rate = &omap2_dpll_round_rate,
86aa76fcf4STero Kristo .set_rate = &omap2_reprogram_dpllcore,
87aa76fcf4STero Kristo };
88aa76fcf4STero Kristo #else
89aa76fcf4STero Kristo static const struct clk_ops omap2_dpll_core_ck_ops = {};
90aa76fcf4STero Kristo #endif
91aa76fcf4STero Kristo
92aa76fcf4STero Kristo #ifdef CONFIG_ARCH_OMAP3
93aa76fcf4STero Kristo static const struct clk_ops omap3_dpll_core_ck_ops = {
94aa76fcf4STero Kristo .get_parent = &omap2_init_dpll_parent,
95aa76fcf4STero Kristo .recalc_rate = &omap3_dpll_recalc,
96aa76fcf4STero Kristo .round_rate = &omap2_dpll_round_rate,
97aa76fcf4STero Kristo };
98aa76fcf4STero Kristo #else
99aa76fcf4STero Kristo static const struct clk_ops omap3_dpll_core_ck_ops = {};
100aa76fcf4STero Kristo #endif
101f38b0dd6STero Kristo
102f38b0dd6STero Kristo #ifdef CONFIG_ARCH_OMAP3
103f38b0dd6STero Kristo static const struct clk_ops omap3_dpll_ck_ops = {
104f38b0dd6STero Kristo .enable = &omap3_noncore_dpll_enable,
105f38b0dd6STero Kristo .disable = &omap3_noncore_dpll_disable,
106f38b0dd6STero Kristo .get_parent = &omap2_init_dpll_parent,
107f38b0dd6STero Kristo .recalc_rate = &omap3_dpll_recalc,
108f38b0dd6STero Kristo .set_rate = &omap3_noncore_dpll_set_rate,
1092e1a7b01STero Kristo .set_parent = &omap3_noncore_dpll_set_parent,
1102e1a7b01STero Kristo .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
1112e1a7b01STero Kristo .determine_rate = &omap3_noncore_dpll_determine_rate,
112f38b0dd6STero Kristo .round_rate = &omap2_dpll_round_rate,
113f38b0dd6STero Kristo };
114f38b0dd6STero Kristo
115035cd485SRichard Watts static const struct clk_ops omap3_dpll5_ck_ops = {
116035cd485SRichard Watts .enable = &omap3_noncore_dpll_enable,
117035cd485SRichard Watts .disable = &omap3_noncore_dpll_disable,
118035cd485SRichard Watts .get_parent = &omap2_init_dpll_parent,
119035cd485SRichard Watts .recalc_rate = &omap3_dpll_recalc,
120035cd485SRichard Watts .set_rate = &omap3_dpll5_set_rate,
121035cd485SRichard Watts .set_parent = &omap3_noncore_dpll_set_parent,
122035cd485SRichard Watts .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
123035cd485SRichard Watts .determine_rate = &omap3_noncore_dpll_determine_rate,
124035cd485SRichard Watts .round_rate = &omap2_dpll_round_rate,
125035cd485SRichard Watts };
126035cd485SRichard Watts
127f38b0dd6STero Kristo static const struct clk_ops omap3_dpll_per_ck_ops = {
128f38b0dd6STero Kristo .enable = &omap3_noncore_dpll_enable,
129f38b0dd6STero Kristo .disable = &omap3_noncore_dpll_disable,
130f38b0dd6STero Kristo .get_parent = &omap2_init_dpll_parent,
131f38b0dd6STero Kristo .recalc_rate = &omap3_dpll_recalc,
132f38b0dd6STero Kristo .set_rate = &omap3_dpll4_set_rate,
1332e1a7b01STero Kristo .set_parent = &omap3_noncore_dpll_set_parent,
1342e1a7b01STero Kristo .set_rate_and_parent = &omap3_dpll4_set_rate_and_parent,
1352e1a7b01STero Kristo .determine_rate = &omap3_noncore_dpll_determine_rate,
136f38b0dd6STero Kristo .round_rate = &omap2_dpll_round_rate,
137f38b0dd6STero Kristo };
138f38b0dd6STero Kristo #endif
139f38b0dd6STero Kristo
140f38b0dd6STero Kristo static const struct clk_ops dpll_x2_ck_ops = {
141f38b0dd6STero Kristo .recalc_rate = &omap3_clkoutx2_recalc,
142f38b0dd6STero Kristo };
143f38b0dd6STero Kristo
144f38b0dd6STero Kristo /**
145ed405a23STero Kristo * _register_dpll - low level registration of a DPLL clock
146975b3eddSLee Jones * @user: pointer to the hardware clock definition for the clock
147f38b0dd6STero Kristo * @node: device node for the clock
148f38b0dd6STero Kristo *
149f38b0dd6STero Kristo * Finalizes DPLL registration process. In case a failure (clk-ref or
150f38b0dd6STero Kristo * clk-bypass is missing), the clock is added to retry list and
151f38b0dd6STero Kristo * the initialization is retried on later stage.
152f38b0dd6STero Kristo */
_register_dpll(void * user,struct device_node * node)153ffb009b2STero Kristo static void __init _register_dpll(void *user,
154f38b0dd6STero Kristo struct device_node *node)
155f38b0dd6STero Kristo {
156ffb009b2STero Kristo struct clk_hw *hw = user;
157f38b0dd6STero Kristo struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
158f38b0dd6STero Kristo struct dpll_data *dd = clk_hw->dpll_data;
1599e56a7d4STony Lindgren const char *name;
160f38b0dd6STero Kristo struct clk *clk;
161e0e04fc8SStephen Boyd const struct clk_init_data *init = hw->init;
162f38b0dd6STero Kristo
163b6f51284STero Kristo clk = of_clk_get(node, 0);
164b6f51284STero Kristo if (IS_ERR(clk)) {
165e665f029SRob Herring pr_debug("clk-ref missing for %pOFn, retry later\n",
166e665f029SRob Herring node);
167ed405a23STero Kristo if (!ti_clk_retry_init(node, hw, _register_dpll))
168f38b0dd6STero Kristo return;
169f38b0dd6STero Kristo
170f38b0dd6STero Kristo goto cleanup;
171f38b0dd6STero Kristo }
172f38b0dd6STero Kristo
173b6f51284STero Kristo dd->clk_ref = __clk_get_hw(clk);
174b6f51284STero Kristo
175b6f51284STero Kristo clk = of_clk_get(node, 1);
176b6f51284STero Kristo
177b6f51284STero Kristo if (IS_ERR(clk)) {
178e665f029SRob Herring pr_debug("clk-bypass missing for %pOFn, retry later\n",
179e665f029SRob Herring node);
180b6f51284STero Kristo if (!ti_clk_retry_init(node, hw, _register_dpll))
181b6f51284STero Kristo return;
182b6f51284STero Kristo
183b6f51284STero Kristo goto cleanup;
184b6f51284STero Kristo }
185b6f51284STero Kristo
186b6f51284STero Kristo dd->clk_bypass = __clk_get_hw(clk);
187b6f51284STero Kristo
188f38b0dd6STero Kristo /* register the clock */
1899e56a7d4STony Lindgren name = ti_dt_clk_name(node);
190*3400d546SDario Binacchi clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name);
191f38b0dd6STero Kristo
192f38b0dd6STero Kristo if (!IS_ERR(clk)) {
193f38b0dd6STero Kristo of_clk_add_provider(node, of_clk_src_simple_get, clk);
194e0e04fc8SStephen Boyd kfree(init->parent_names);
195e0e04fc8SStephen Boyd kfree(init);
196f38b0dd6STero Kristo return;
197f38b0dd6STero Kristo }
198f38b0dd6STero Kristo
199f38b0dd6STero Kristo cleanup:
200f38b0dd6STero Kristo kfree(clk_hw->dpll_data);
201e0e04fc8SStephen Boyd kfree(init->parent_names);
202e0e04fc8SStephen Boyd kfree(init);
203f38b0dd6STero Kristo kfree(clk_hw);
204f38b0dd6STero Kristo }
205f38b0dd6STero Kristo
206f38b0dd6STero Kristo #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
2074332ec1aSRoger Quadros defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) || \
2084332ec1aSRoger Quadros defined(CONFIG_SOC_AM43XX)
209f38b0dd6STero Kristo /**
210ed405a23STero Kristo * _register_dpll_x2 - Registers a DPLLx2 clock
211f38b0dd6STero Kristo * @node: device node for this clock
212f38b0dd6STero Kristo * @ops: clk_ops for this clock
213f38b0dd6STero Kristo * @hw_ops: clk_hw_ops for this clock
214f38b0dd6STero Kristo *
215f38b0dd6STero Kristo * Initializes a DPLL x 2 clock from device tree data.
216f38b0dd6STero Kristo */
_register_dpll_x2(struct device_node * node,const struct clk_ops * ops,const struct clk_hw_omap_ops * hw_ops)217ed405a23STero Kristo static void _register_dpll_x2(struct device_node *node,
218f38b0dd6STero Kristo const struct clk_ops *ops,
219f38b0dd6STero Kristo const struct clk_hw_omap_ops *hw_ops)
220f38b0dd6STero Kristo {
221f38b0dd6STero Kristo struct clk *clk;
222f38b0dd6STero Kristo struct clk_init_data init = { NULL };
223f38b0dd6STero Kristo struct clk_hw_omap *clk_hw;
2249e56a7d4STony Lindgren const char *name = ti_dt_clk_name(node);
225f38b0dd6STero Kristo const char *parent_name;
226f38b0dd6STero Kristo
227f38b0dd6STero Kristo parent_name = of_clk_get_parent_name(node, 0);
228f38b0dd6STero Kristo if (!parent_name) {
229e665f029SRob Herring pr_err("%pOFn must have parent\n", node);
230f38b0dd6STero Kristo return;
231f38b0dd6STero Kristo }
232f38b0dd6STero Kristo
233f38b0dd6STero Kristo clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
234f38b0dd6STero Kristo if (!clk_hw)
235f38b0dd6STero Kristo return;
236f38b0dd6STero Kristo
237f38b0dd6STero Kristo clk_hw->ops = hw_ops;
238f38b0dd6STero Kristo clk_hw->hw.init = &init;
239f38b0dd6STero Kristo
240f38b0dd6STero Kristo init.name = name;
241f38b0dd6STero Kristo init.ops = ops;
242f38b0dd6STero Kristo init.parent_names = &parent_name;
243f38b0dd6STero Kristo init.num_parents = 1;
244f38b0dd6STero Kristo
2452158a093SArnd Bergmann #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
2462158a093SArnd Bergmann defined(CONFIG_SOC_DRA7XX)
247473adbf4STero Kristo if (hw_ops == &clkhwops_omap4_dpllmx) {
2482158a093SArnd Bergmann int ret;
2492158a093SArnd Bergmann
250473adbf4STero Kristo /* Check if register defined, if not, drop hw-ops */
251473adbf4STero Kristo ret = of_property_count_elems_of_size(node, "reg", 1);
252473adbf4STero Kristo if (ret <= 0) {
2532158a093SArnd Bergmann clk_hw->ops = NULL;
2546c0afb50STero Kristo } else if (ti_clk_get_reg_addr(node, 0, &clk_hw->clksel_reg)) {
255473adbf4STero Kristo kfree(clk_hw);
256473adbf4STero Kristo return;
257473adbf4STero Kristo }
258473adbf4STero Kristo }
2592158a093SArnd Bergmann #endif
260473adbf4STero Kristo
261f38b0dd6STero Kristo /* register the clock */
262*3400d546SDario Binacchi clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name);
263f38b0dd6STero Kristo
264ead47825STero Kristo if (IS_ERR(clk))
265f38b0dd6STero Kristo kfree(clk_hw);
266ead47825STero Kristo else
267f38b0dd6STero Kristo of_clk_add_provider(node, of_clk_src_simple_get, clk);
268f38b0dd6STero Kristo }
269f38b0dd6STero Kristo #endif
270f38b0dd6STero Kristo
271f38b0dd6STero Kristo /**
272f38b0dd6STero Kristo * of_ti_dpll_setup - Setup function for OMAP DPLL clocks
273f38b0dd6STero Kristo * @node: device node containing the DPLL info
274f38b0dd6STero Kristo * @ops: ops for the DPLL
275f38b0dd6STero Kristo * @ddt: DPLL data template to use
276f38b0dd6STero Kristo *
277f38b0dd6STero Kristo * Initializes a DPLL clock from device tree data.
278f38b0dd6STero Kristo */
of_ti_dpll_setup(struct device_node * node,const struct clk_ops * ops,const struct dpll_data * ddt)279f38b0dd6STero Kristo static void __init of_ti_dpll_setup(struct device_node *node,
280f38b0dd6STero Kristo const struct clk_ops *ops,
281a6fe3771STero Kristo const struct dpll_data *ddt)
282f38b0dd6STero Kristo {
283f38b0dd6STero Kristo struct clk_hw_omap *clk_hw = NULL;
284f38b0dd6STero Kristo struct clk_init_data *init = NULL;
285f38b0dd6STero Kristo const char **parent_names = NULL;
286f38b0dd6STero Kristo struct dpll_data *dd = NULL;
2870899431fSDario Binacchi int ssc_clk_index;
288f38b0dd6STero Kristo u8 dpll_mode = 0;
2890899431fSDario Binacchi u32 min_div;
290f38b0dd6STero Kristo
29181b94f14SFuqian Huang dd = kmemdup(ddt, sizeof(*dd), GFP_KERNEL);
292f38b0dd6STero Kristo clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
293f38b0dd6STero Kristo init = kzalloc(sizeof(*init), GFP_KERNEL);
294f38b0dd6STero Kristo if (!dd || !clk_hw || !init)
295f38b0dd6STero Kristo goto cleanup;
296f38b0dd6STero Kristo
297f38b0dd6STero Kristo clk_hw->dpll_data = dd;
298f38b0dd6STero Kristo clk_hw->ops = &clkhwops_omap3_dpll;
299f38b0dd6STero Kristo clk_hw->hw.init = init;
300f38b0dd6STero Kristo
3019e56a7d4STony Lindgren init->name = ti_dt_clk_name(node);
302f38b0dd6STero Kristo init->ops = ops;
303f38b0dd6STero Kristo
304f38b0dd6STero Kristo init->num_parents = of_clk_get_parent_count(node);
305921bacfaSStephen Boyd if (!init->num_parents) {
306e665f029SRob Herring pr_err("%pOFn must have parent(s)\n", node);
307f38b0dd6STero Kristo goto cleanup;
308f38b0dd6STero Kristo }
309f38b0dd6STero Kristo
3106396bb22SKees Cook parent_names = kcalloc(init->num_parents, sizeof(char *), GFP_KERNEL);
311f38b0dd6STero Kristo if (!parent_names)
312f38b0dd6STero Kristo goto cleanup;
313f38b0dd6STero Kristo
3149da9e761SDinh Nguyen of_clk_parent_fill(node, parent_names, init->num_parents);
315f38b0dd6STero Kristo
316f38b0dd6STero Kristo init->parent_names = parent_names;
317f38b0dd6STero Kristo
3186c0afb50STero Kristo if (ti_clk_get_reg_addr(node, 0, &dd->control_reg))
3196c0afb50STero Kristo goto cleanup;
320f38b0dd6STero Kristo
321aa76fcf4STero Kristo /*
322aa76fcf4STero Kristo * Special case for OMAP2 DPLL, register order is different due to
323aa76fcf4STero Kristo * missing idlest_reg, also clkhwops is different. Detected from
324aa76fcf4STero Kristo * missing idlest_mask.
325aa76fcf4STero Kristo */
326aa76fcf4STero Kristo if (!dd->idlest_mask) {
3276c0afb50STero Kristo if (ti_clk_get_reg_addr(node, 1, &dd->mult_div1_reg))
3286c0afb50STero Kristo goto cleanup;
329aa76fcf4STero Kristo #ifdef CONFIG_ARCH_OMAP2
330aa76fcf4STero Kristo clk_hw->ops = &clkhwops_omap2xxx_dpll;
331aa76fcf4STero Kristo omap2xxx_clkt_dpllcore_init(&clk_hw->hw);
332aa76fcf4STero Kristo #endif
333aa76fcf4STero Kristo } else {
3346c0afb50STero Kristo if (ti_clk_get_reg_addr(node, 1, &dd->idlest_reg))
335aa76fcf4STero Kristo goto cleanup;
336aa76fcf4STero Kristo
3376c0afb50STero Kristo if (ti_clk_get_reg_addr(node, 2, &dd->mult_div1_reg))
3386c0afb50STero Kristo goto cleanup;
339aa76fcf4STero Kristo }
340aa76fcf4STero Kristo
341a6fe3771STero Kristo if (dd->autoidle_mask) {
3426c0afb50STero Kristo if (ti_clk_get_reg_addr(node, 3, &dd->autoidle_reg))
343f38b0dd6STero Kristo goto cleanup;
3440899431fSDario Binacchi
3450899431fSDario Binacchi ssc_clk_index = 4;
3460899431fSDario Binacchi } else {
3470899431fSDario Binacchi ssc_clk_index = 3;
3480899431fSDario Binacchi }
3490899431fSDario Binacchi
3500899431fSDario Binacchi if (dd->ssc_deltam_int_mask && dd->ssc_deltam_frac_mask &&
3510899431fSDario Binacchi dd->ssc_modfreq_mant_mask && dd->ssc_modfreq_exp_mask) {
3520899431fSDario Binacchi if (ti_clk_get_reg_addr(node, ssc_clk_index++,
3530899431fSDario Binacchi &dd->ssc_deltam_reg))
3540899431fSDario Binacchi goto cleanup;
3550899431fSDario Binacchi
3560899431fSDario Binacchi if (ti_clk_get_reg_addr(node, ssc_clk_index++,
3570899431fSDario Binacchi &dd->ssc_modfreq_reg))
3580899431fSDario Binacchi goto cleanup;
3590899431fSDario Binacchi
3600899431fSDario Binacchi of_property_read_u32(node, "ti,ssc-modfreq-hz",
3610899431fSDario Binacchi &dd->ssc_modfreq);
3620899431fSDario Binacchi of_property_read_u32(node, "ti,ssc-deltam", &dd->ssc_deltam);
3630899431fSDario Binacchi dd->ssc_downspread =
3640899431fSDario Binacchi of_property_read_bool(node, "ti,ssc-downspread");
365f38b0dd6STero Kristo }
366f38b0dd6STero Kristo
367f38b0dd6STero Kristo if (of_property_read_bool(node, "ti,low-power-stop"))
368f38b0dd6STero Kristo dpll_mode |= 1 << DPLL_LOW_POWER_STOP;
369f38b0dd6STero Kristo
370f38b0dd6STero Kristo if (of_property_read_bool(node, "ti,low-power-bypass"))
371f38b0dd6STero Kristo dpll_mode |= 1 << DPLL_LOW_POWER_BYPASS;
372f38b0dd6STero Kristo
373f38b0dd6STero Kristo if (of_property_read_bool(node, "ti,lock"))
374f38b0dd6STero Kristo dpll_mode |= 1 << DPLL_LOCKED;
375f38b0dd6STero Kristo
3760899431fSDario Binacchi if (!of_property_read_u32(node, "ti,min-div", &min_div) &&
3770899431fSDario Binacchi min_div > dd->min_divider)
3780899431fSDario Binacchi dd->min_divider = min_div;
3790899431fSDario Binacchi
380f38b0dd6STero Kristo if (dpll_mode)
381f38b0dd6STero Kristo dd->modes = dpll_mode;
382f38b0dd6STero Kristo
383ed405a23STero Kristo _register_dpll(&clk_hw->hw, node);
384f38b0dd6STero Kristo return;
385f38b0dd6STero Kristo
386f38b0dd6STero Kristo cleanup:
387f38b0dd6STero Kristo kfree(dd);
388f38b0dd6STero Kristo kfree(parent_names);
389f38b0dd6STero Kristo kfree(init);
390f38b0dd6STero Kristo kfree(clk_hw);
391f38b0dd6STero Kristo }
392f38b0dd6STero Kristo
393f38b0dd6STero Kristo #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
394f38b0dd6STero Kristo defined(CONFIG_SOC_DRA7XX)
of_ti_omap4_dpll_x2_setup(struct device_node * node)395f38b0dd6STero Kristo static void __init of_ti_omap4_dpll_x2_setup(struct device_node *node)
396f38b0dd6STero Kristo {
397ed405a23STero Kristo _register_dpll_x2(node, &dpll_x2_ck_ops, &clkhwops_omap4_dpllmx);
398f38b0dd6STero Kristo }
399f38b0dd6STero Kristo CLK_OF_DECLARE(ti_omap4_dpll_x2_clock, "ti,omap4-dpll-x2-clock",
400f38b0dd6STero Kristo of_ti_omap4_dpll_x2_setup);
401f38b0dd6STero Kristo #endif
402f38b0dd6STero Kristo
4034332ec1aSRoger Quadros #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
of_ti_am3_dpll_x2_setup(struct device_node * node)404f38b0dd6STero Kristo static void __init of_ti_am3_dpll_x2_setup(struct device_node *node)
405f38b0dd6STero Kristo {
406ed405a23STero Kristo _register_dpll_x2(node, &dpll_x2_ck_ops, NULL);
407f38b0dd6STero Kristo }
408f38b0dd6STero Kristo CLK_OF_DECLARE(ti_am3_dpll_x2_clock, "ti,am3-dpll-x2-clock",
409f38b0dd6STero Kristo of_ti_am3_dpll_x2_setup);
410f38b0dd6STero Kristo #endif
411f38b0dd6STero Kristo
412f38b0dd6STero Kristo #ifdef CONFIG_ARCH_OMAP3
of_ti_omap3_dpll_setup(struct device_node * node)413f38b0dd6STero Kristo static void __init of_ti_omap3_dpll_setup(struct device_node *node)
414f38b0dd6STero Kristo {
415f38b0dd6STero Kristo const struct dpll_data dd = {
416f38b0dd6STero Kristo .idlest_mask = 0x1,
417f38b0dd6STero Kristo .enable_mask = 0x7,
418f38b0dd6STero Kristo .autoidle_mask = 0x7,
419f38b0dd6STero Kristo .mult_mask = 0x7ff << 8,
420f38b0dd6STero Kristo .div1_mask = 0x7f,
421f38b0dd6STero Kristo .max_multiplier = 2047,
422f38b0dd6STero Kristo .max_divider = 128,
423f38b0dd6STero Kristo .min_divider = 1,
424f38b0dd6STero Kristo .freqsel_mask = 0xf0,
425f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
426f38b0dd6STero Kristo };
427f38b0dd6STero Kristo
428035cd485SRichard Watts if ((of_machine_is_compatible("ti,omap3630") ||
429035cd485SRichard Watts of_machine_is_compatible("ti,omap36xx")) &&
43087ab1151SRob Herring of_node_name_eq(node, "dpll5_ck"))
431035cd485SRichard Watts of_ti_dpll_setup(node, &omap3_dpll5_ck_ops, &dd);
432035cd485SRichard Watts else
433a6fe3771STero Kristo of_ti_dpll_setup(node, &omap3_dpll_ck_ops, &dd);
434f38b0dd6STero Kristo }
435f38b0dd6STero Kristo CLK_OF_DECLARE(ti_omap3_dpll_clock, "ti,omap3-dpll-clock",
436f38b0dd6STero Kristo of_ti_omap3_dpll_setup);
437f38b0dd6STero Kristo
of_ti_omap3_core_dpll_setup(struct device_node * node)438f38b0dd6STero Kristo static void __init of_ti_omap3_core_dpll_setup(struct device_node *node)
439f38b0dd6STero Kristo {
440f38b0dd6STero Kristo const struct dpll_data dd = {
441f38b0dd6STero Kristo .idlest_mask = 0x1,
442f38b0dd6STero Kristo .enable_mask = 0x7,
443f38b0dd6STero Kristo .autoidle_mask = 0x7,
444f38b0dd6STero Kristo .mult_mask = 0x7ff << 16,
445f38b0dd6STero Kristo .div1_mask = 0x7f << 8,
446f38b0dd6STero Kristo .max_multiplier = 2047,
447f38b0dd6STero Kristo .max_divider = 128,
448f38b0dd6STero Kristo .min_divider = 1,
449f38b0dd6STero Kristo .freqsel_mask = 0xf0,
450f38b0dd6STero Kristo };
451f38b0dd6STero Kristo
452a6fe3771STero Kristo of_ti_dpll_setup(node, &omap3_dpll_core_ck_ops, &dd);
453f38b0dd6STero Kristo }
454f38b0dd6STero Kristo CLK_OF_DECLARE(ti_omap3_core_dpll_clock, "ti,omap3-dpll-core-clock",
455f38b0dd6STero Kristo of_ti_omap3_core_dpll_setup);
456f38b0dd6STero Kristo
of_ti_omap3_per_dpll_setup(struct device_node * node)457f38b0dd6STero Kristo static void __init of_ti_omap3_per_dpll_setup(struct device_node *node)
458f38b0dd6STero Kristo {
459f38b0dd6STero Kristo const struct dpll_data dd = {
460f38b0dd6STero Kristo .idlest_mask = 0x1 << 1,
461f38b0dd6STero Kristo .enable_mask = 0x7 << 16,
462f38b0dd6STero Kristo .autoidle_mask = 0x7 << 3,
463f38b0dd6STero Kristo .mult_mask = 0x7ff << 8,
464f38b0dd6STero Kristo .div1_mask = 0x7f,
465f38b0dd6STero Kristo .max_multiplier = 2047,
466f38b0dd6STero Kristo .max_divider = 128,
467f38b0dd6STero Kristo .min_divider = 1,
468f38b0dd6STero Kristo .freqsel_mask = 0xf00000,
469f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
470f38b0dd6STero Kristo };
471f38b0dd6STero Kristo
472a6fe3771STero Kristo of_ti_dpll_setup(node, &omap3_dpll_per_ck_ops, &dd);
473f38b0dd6STero Kristo }
474f38b0dd6STero Kristo CLK_OF_DECLARE(ti_omap3_per_dpll_clock, "ti,omap3-dpll-per-clock",
475f38b0dd6STero Kristo of_ti_omap3_per_dpll_setup);
476f38b0dd6STero Kristo
of_ti_omap3_per_jtype_dpll_setup(struct device_node * node)477f38b0dd6STero Kristo static void __init of_ti_omap3_per_jtype_dpll_setup(struct device_node *node)
478f38b0dd6STero Kristo {
479f38b0dd6STero Kristo const struct dpll_data dd = {
480f38b0dd6STero Kristo .idlest_mask = 0x1 << 1,
481f38b0dd6STero Kristo .enable_mask = 0x7 << 16,
482f38b0dd6STero Kristo .autoidle_mask = 0x7 << 3,
483f38b0dd6STero Kristo .mult_mask = 0xfff << 8,
484f38b0dd6STero Kristo .div1_mask = 0x7f,
485f38b0dd6STero Kristo .max_multiplier = 4095,
486f38b0dd6STero Kristo .max_divider = 128,
487f38b0dd6STero Kristo .min_divider = 1,
488f38b0dd6STero Kristo .sddiv_mask = 0xff << 24,
489f38b0dd6STero Kristo .dco_mask = 0xe << 20,
490f38b0dd6STero Kristo .flags = DPLL_J_TYPE,
491f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
492f38b0dd6STero Kristo };
493f38b0dd6STero Kristo
494a6fe3771STero Kristo of_ti_dpll_setup(node, &omap3_dpll_per_ck_ops, &dd);
495f38b0dd6STero Kristo }
496f38b0dd6STero Kristo CLK_OF_DECLARE(ti_omap3_per_jtype_dpll_clock, "ti,omap3-dpll-per-j-type-clock",
497f38b0dd6STero Kristo of_ti_omap3_per_jtype_dpll_setup);
498f38b0dd6STero Kristo #endif
499f38b0dd6STero Kristo
of_ti_omap4_dpll_setup(struct device_node * node)500f38b0dd6STero Kristo static void __init of_ti_omap4_dpll_setup(struct device_node *node)
501f38b0dd6STero Kristo {
502f38b0dd6STero Kristo const struct dpll_data dd = {
503f38b0dd6STero Kristo .idlest_mask = 0x1,
504f38b0dd6STero Kristo .enable_mask = 0x7,
505f38b0dd6STero Kristo .autoidle_mask = 0x7,
506f38b0dd6STero Kristo .mult_mask = 0x7ff << 8,
507f38b0dd6STero Kristo .div1_mask = 0x7f,
508f38b0dd6STero Kristo .max_multiplier = 2047,
509f38b0dd6STero Kristo .max_divider = 128,
510f38b0dd6STero Kristo .min_divider = 1,
511f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
512f38b0dd6STero Kristo };
513f38b0dd6STero Kristo
514a6fe3771STero Kristo of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
515f38b0dd6STero Kristo }
516f38b0dd6STero Kristo CLK_OF_DECLARE(ti_omap4_dpll_clock, "ti,omap4-dpll-clock",
517f38b0dd6STero Kristo of_ti_omap4_dpll_setup);
518f38b0dd6STero Kristo
of_ti_omap5_mpu_dpll_setup(struct device_node * node)519b4be0189SNishanth Menon static void __init of_ti_omap5_mpu_dpll_setup(struct device_node *node)
520b4be0189SNishanth Menon {
521b4be0189SNishanth Menon const struct dpll_data dd = {
522b4be0189SNishanth Menon .idlest_mask = 0x1,
523b4be0189SNishanth Menon .enable_mask = 0x7,
524b4be0189SNishanth Menon .autoidle_mask = 0x7,
525b4be0189SNishanth Menon .mult_mask = 0x7ff << 8,
526b4be0189SNishanth Menon .div1_mask = 0x7f,
527b4be0189SNishanth Menon .max_multiplier = 2047,
528b4be0189SNishanth Menon .max_divider = 128,
529b4be0189SNishanth Menon .dcc_mask = BIT(22),
530b4be0189SNishanth Menon .dcc_rate = 1400000000, /* DCC beyond 1.4GHz */
531b4be0189SNishanth Menon .min_divider = 1,
532b4be0189SNishanth Menon .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
533b4be0189SNishanth Menon };
534b4be0189SNishanth Menon
535b4be0189SNishanth Menon of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
536b4be0189SNishanth Menon }
537b4be0189SNishanth Menon CLK_OF_DECLARE(of_ti_omap5_mpu_dpll_clock, "ti,omap5-mpu-dpll-clock",
538b4be0189SNishanth Menon of_ti_omap5_mpu_dpll_setup);
539b4be0189SNishanth Menon
of_ti_omap4_core_dpll_setup(struct device_node * node)540f38b0dd6STero Kristo static void __init of_ti_omap4_core_dpll_setup(struct device_node *node)
541f38b0dd6STero Kristo {
542f38b0dd6STero Kristo const struct dpll_data dd = {
543f38b0dd6STero Kristo .idlest_mask = 0x1,
544f38b0dd6STero Kristo .enable_mask = 0x7,
545f38b0dd6STero Kristo .autoidle_mask = 0x7,
546f38b0dd6STero Kristo .mult_mask = 0x7ff << 8,
547f38b0dd6STero Kristo .div1_mask = 0x7f,
548f38b0dd6STero Kristo .max_multiplier = 2047,
549f38b0dd6STero Kristo .max_divider = 128,
550f38b0dd6STero Kristo .min_divider = 1,
551f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
552f38b0dd6STero Kristo };
553f38b0dd6STero Kristo
554a6fe3771STero Kristo of_ti_dpll_setup(node, &dpll_core_ck_ops, &dd);
555f38b0dd6STero Kristo }
556f38b0dd6STero Kristo CLK_OF_DECLARE(ti_omap4_core_dpll_clock, "ti,omap4-dpll-core-clock",
557f38b0dd6STero Kristo of_ti_omap4_core_dpll_setup);
558f38b0dd6STero Kristo
559f38b0dd6STero Kristo #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
560f38b0dd6STero Kristo defined(CONFIG_SOC_DRA7XX)
of_ti_omap4_m4xen_dpll_setup(struct device_node * node)561f38b0dd6STero Kristo static void __init of_ti_omap4_m4xen_dpll_setup(struct device_node *node)
562f38b0dd6STero Kristo {
563f38b0dd6STero Kristo const struct dpll_data dd = {
564f38b0dd6STero Kristo .idlest_mask = 0x1,
565f38b0dd6STero Kristo .enable_mask = 0x7,
566f38b0dd6STero Kristo .autoidle_mask = 0x7,
567f38b0dd6STero Kristo .mult_mask = 0x7ff << 8,
568f38b0dd6STero Kristo .div1_mask = 0x7f,
569f38b0dd6STero Kristo .max_multiplier = 2047,
570f38b0dd6STero Kristo .max_divider = 128,
571f38b0dd6STero Kristo .min_divider = 1,
572f38b0dd6STero Kristo .m4xen_mask = 0x800,
573f38b0dd6STero Kristo .lpmode_mask = 1 << 10,
574f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
575f38b0dd6STero Kristo };
576f38b0dd6STero Kristo
577a6fe3771STero Kristo of_ti_dpll_setup(node, &dpll_m4xen_ck_ops, &dd);
578f38b0dd6STero Kristo }
579f38b0dd6STero Kristo CLK_OF_DECLARE(ti_omap4_m4xen_dpll_clock, "ti,omap4-dpll-m4xen-clock",
580f38b0dd6STero Kristo of_ti_omap4_m4xen_dpll_setup);
581f38b0dd6STero Kristo
of_ti_omap4_jtype_dpll_setup(struct device_node * node)582f38b0dd6STero Kristo static void __init of_ti_omap4_jtype_dpll_setup(struct device_node *node)
583f38b0dd6STero Kristo {
584f38b0dd6STero Kristo const struct dpll_data dd = {
585f38b0dd6STero Kristo .idlest_mask = 0x1,
586f38b0dd6STero Kristo .enable_mask = 0x7,
587f38b0dd6STero Kristo .autoidle_mask = 0x7,
588f38b0dd6STero Kristo .mult_mask = 0xfff << 8,
589f38b0dd6STero Kristo .div1_mask = 0xff,
590f38b0dd6STero Kristo .max_multiplier = 4095,
591f38b0dd6STero Kristo .max_divider = 256,
592f38b0dd6STero Kristo .min_divider = 1,
593f38b0dd6STero Kristo .sddiv_mask = 0xff << 24,
594f38b0dd6STero Kristo .flags = DPLL_J_TYPE,
595f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
596f38b0dd6STero Kristo };
597f38b0dd6STero Kristo
598a6fe3771STero Kristo of_ti_dpll_setup(node, &dpll_m4xen_ck_ops, &dd);
599f38b0dd6STero Kristo }
600f38b0dd6STero Kristo CLK_OF_DECLARE(ti_omap4_jtype_dpll_clock, "ti,omap4-dpll-j-type-clock",
601f38b0dd6STero Kristo of_ti_omap4_jtype_dpll_setup);
602f38b0dd6STero Kristo #endif
603f38b0dd6STero Kristo
of_ti_am3_no_gate_dpll_setup(struct device_node * node)604f38b0dd6STero Kristo static void __init of_ti_am3_no_gate_dpll_setup(struct device_node *node)
605f38b0dd6STero Kristo {
606f38b0dd6STero Kristo const struct dpll_data dd = {
607f38b0dd6STero Kristo .idlest_mask = 0x1,
608f38b0dd6STero Kristo .enable_mask = 0x7,
6090899431fSDario Binacchi .ssc_enable_mask = 0x1 << 12,
6100899431fSDario Binacchi .ssc_downspread_mask = 0x1 << 14,
611f38b0dd6STero Kristo .mult_mask = 0x7ff << 8,
612f38b0dd6STero Kristo .div1_mask = 0x7f,
6130899431fSDario Binacchi .ssc_deltam_int_mask = 0x3 << 18,
6140899431fSDario Binacchi .ssc_deltam_frac_mask = 0x3ffff,
6150899431fSDario Binacchi .ssc_modfreq_mant_mask = 0x7f,
6160899431fSDario Binacchi .ssc_modfreq_exp_mask = 0x7 << 8,
617f38b0dd6STero Kristo .max_multiplier = 2047,
618f38b0dd6STero Kristo .max_divider = 128,
619f38b0dd6STero Kristo .min_divider = 1,
6203db5ca27STero Kristo .max_rate = 1000000000,
621f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
622f38b0dd6STero Kristo };
623f38b0dd6STero Kristo
624a6fe3771STero Kristo of_ti_dpll_setup(node, &dpll_no_gate_ck_ops, &dd);
625f38b0dd6STero Kristo }
626f38b0dd6STero Kristo CLK_OF_DECLARE(ti_am3_no_gate_dpll_clock, "ti,am3-dpll-no-gate-clock",
627f38b0dd6STero Kristo of_ti_am3_no_gate_dpll_setup);
628f38b0dd6STero Kristo
of_ti_am3_jtype_dpll_setup(struct device_node * node)629f38b0dd6STero Kristo static void __init of_ti_am3_jtype_dpll_setup(struct device_node *node)
630f38b0dd6STero Kristo {
631f38b0dd6STero Kristo const struct dpll_data dd = {
632f38b0dd6STero Kristo .idlest_mask = 0x1,
633f38b0dd6STero Kristo .enable_mask = 0x7,
634f38b0dd6STero Kristo .mult_mask = 0x7ff << 8,
635f38b0dd6STero Kristo .div1_mask = 0x7f,
636f38b0dd6STero Kristo .max_multiplier = 4095,
637f38b0dd6STero Kristo .max_divider = 256,
638f38b0dd6STero Kristo .min_divider = 2,
639f38b0dd6STero Kristo .flags = DPLL_J_TYPE,
6403db5ca27STero Kristo .max_rate = 2000000000,
641f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
642f38b0dd6STero Kristo };
643f38b0dd6STero Kristo
644a6fe3771STero Kristo of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
645f38b0dd6STero Kristo }
646f38b0dd6STero Kristo CLK_OF_DECLARE(ti_am3_jtype_dpll_clock, "ti,am3-dpll-j-type-clock",
647f38b0dd6STero Kristo of_ti_am3_jtype_dpll_setup);
648f38b0dd6STero Kristo
of_ti_am3_no_gate_jtype_dpll_setup(struct device_node * node)649f38b0dd6STero Kristo static void __init of_ti_am3_no_gate_jtype_dpll_setup(struct device_node *node)
650f38b0dd6STero Kristo {
651f38b0dd6STero Kristo const struct dpll_data dd = {
652f38b0dd6STero Kristo .idlest_mask = 0x1,
653f38b0dd6STero Kristo .enable_mask = 0x7,
654f38b0dd6STero Kristo .mult_mask = 0x7ff << 8,
655f38b0dd6STero Kristo .div1_mask = 0x7f,
656f38b0dd6STero Kristo .max_multiplier = 2047,
657f38b0dd6STero Kristo .max_divider = 128,
658f38b0dd6STero Kristo .min_divider = 1,
6593db5ca27STero Kristo .max_rate = 2000000000,
660f38b0dd6STero Kristo .flags = DPLL_J_TYPE,
661f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
662f38b0dd6STero Kristo };
663f38b0dd6STero Kristo
664a6fe3771STero Kristo of_ti_dpll_setup(node, &dpll_no_gate_ck_ops, &dd);
665f38b0dd6STero Kristo }
666f38b0dd6STero Kristo CLK_OF_DECLARE(ti_am3_no_gate_jtype_dpll_clock,
667f38b0dd6STero Kristo "ti,am3-dpll-no-gate-j-type-clock",
668f38b0dd6STero Kristo of_ti_am3_no_gate_jtype_dpll_setup);
669f38b0dd6STero Kristo
of_ti_am3_dpll_setup(struct device_node * node)670f38b0dd6STero Kristo static void __init of_ti_am3_dpll_setup(struct device_node *node)
671f38b0dd6STero Kristo {
672f38b0dd6STero Kristo const struct dpll_data dd = {
673f38b0dd6STero Kristo .idlest_mask = 0x1,
674f38b0dd6STero Kristo .enable_mask = 0x7,
6750899431fSDario Binacchi .ssc_enable_mask = 0x1 << 12,
6760899431fSDario Binacchi .ssc_downspread_mask = 0x1 << 14,
677f38b0dd6STero Kristo .mult_mask = 0x7ff << 8,
678f38b0dd6STero Kristo .div1_mask = 0x7f,
6790899431fSDario Binacchi .ssc_deltam_int_mask = 0x3 << 18,
6800899431fSDario Binacchi .ssc_deltam_frac_mask = 0x3ffff,
6810899431fSDario Binacchi .ssc_modfreq_mant_mask = 0x7f,
6820899431fSDario Binacchi .ssc_modfreq_exp_mask = 0x7 << 8,
683f38b0dd6STero Kristo .max_multiplier = 2047,
684f38b0dd6STero Kristo .max_divider = 128,
685f38b0dd6STero Kristo .min_divider = 1,
6863db5ca27STero Kristo .max_rate = 1000000000,
687f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
688f38b0dd6STero Kristo };
689f38b0dd6STero Kristo
690a6fe3771STero Kristo of_ti_dpll_setup(node, &dpll_ck_ops, &dd);
691f38b0dd6STero Kristo }
692f38b0dd6STero Kristo CLK_OF_DECLARE(ti_am3_dpll_clock, "ti,am3-dpll-clock", of_ti_am3_dpll_setup);
693f38b0dd6STero Kristo
of_ti_am3_core_dpll_setup(struct device_node * node)694f38b0dd6STero Kristo static void __init of_ti_am3_core_dpll_setup(struct device_node *node)
695f38b0dd6STero Kristo {
696f38b0dd6STero Kristo const struct dpll_data dd = {
697f38b0dd6STero Kristo .idlest_mask = 0x1,
698f38b0dd6STero Kristo .enable_mask = 0x7,
699f38b0dd6STero Kristo .mult_mask = 0x7ff << 8,
700f38b0dd6STero Kristo .div1_mask = 0x7f,
701f38b0dd6STero Kristo .max_multiplier = 2047,
702f38b0dd6STero Kristo .max_divider = 128,
703f38b0dd6STero Kristo .min_divider = 1,
7043db5ca27STero Kristo .max_rate = 1000000000,
705f38b0dd6STero Kristo .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
706f38b0dd6STero Kristo };
707f38b0dd6STero Kristo
708a6fe3771STero Kristo of_ti_dpll_setup(node, &dpll_core_ck_ops, &dd);
709f38b0dd6STero Kristo }
710f38b0dd6STero Kristo CLK_OF_DECLARE(ti_am3_core_dpll_clock, "ti,am3-dpll-core-clock",
711f38b0dd6STero Kristo of_ti_am3_core_dpll_setup);
712aa76fcf4STero Kristo
of_ti_omap2_core_dpll_setup(struct device_node * node)713aa76fcf4STero Kristo static void __init of_ti_omap2_core_dpll_setup(struct device_node *node)
714aa76fcf4STero Kristo {
715aa76fcf4STero Kristo const struct dpll_data dd = {
716aa76fcf4STero Kristo .enable_mask = 0x3,
717aa76fcf4STero Kristo .mult_mask = 0x3ff << 12,
718aa76fcf4STero Kristo .div1_mask = 0xf << 8,
719aa76fcf4STero Kristo .max_divider = 16,
720aa76fcf4STero Kristo .min_divider = 1,
721aa76fcf4STero Kristo };
722aa76fcf4STero Kristo
723aa76fcf4STero Kristo of_ti_dpll_setup(node, &omap2_dpll_core_ck_ops, &dd);
724aa76fcf4STero Kristo }
725aa76fcf4STero Kristo CLK_OF_DECLARE(ti_omap2_core_dpll_clock, "ti,omap2-dpll-core-clock",
726aa76fcf4STero Kristo of_ti_omap2_core_dpll_setup);
727