Lines Matching +full:integratorcp +full:- +full:cm +full:- +full:core
1 // SPDX-License-Identifier: GPL-2.0-only
7 * Copyright (C) 2012-2015 Linus Walleij
17 #include <linux/clk-provider.h>
23 #include "clk-icst.h"
37 * struct clk_icst - ICST VCO clock wrapper
58 * vco_get() - get ICST VCO settings from a certain ICST
67 ret = regmap_read(icst->map, icst->vcoreg_off, &val); in vco_get()
72 * The Integrator/AP core clock can only access the low eight in vco_get()
76 * "Integrator CM926EJ-S, CM946E-S, CM966E-S, CM1026EJ-S and in vco_get()
77 * CM1136JF-S User Guide" ARM DUI 0138E, page 3-13 thru 3-14. in vco_get()
79 if (icst->ctype == ICST_INTEGRATOR_AP_CM) { in vco_get()
80 vco->v = val & INTEGRATOR_AP_CM_BITS; in vco_get()
81 vco->r = 22; in vco_get()
82 vco->s = 1; in vco_get()
92 * page 3-16. in vco_get()
94 if (icst->ctype == ICST_INTEGRATOR_AP_SYS) { in vco_get()
95 vco->v = val & INTEGRATOR_AP_SYS_BITS; in vco_get()
96 vco->r = 46; in vco_get()
97 vco->s = 3; in vco_get()
109 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) { in vco_get()
112 vco->v = divxy ? 17 : 14; in vco_get()
113 vco->r = divxy ? 22 : 14; in vco_get()
114 vco->s = 1; in vco_get()
119 * The Integrator/CP core clock can access the low eight bits in vco_get()
124 * ARM DUI 0157A, page 3-20 thru 3-23 and 4-10. in vco_get()
126 if (icst->ctype == ICST_INTEGRATOR_CP_CM_CORE) { in vco_get()
127 vco->v = val & 0xFF; in vco_get()
128 vco->r = 22; in vco_get()
129 vco->s = (val >> 8) & 7; in vco_get()
133 if (icst->ctype == ICST_INTEGRATOR_CP_CM_MEM) { in vco_get()
134 vco->v = (val >> 12) & 0xFF; in vco_get()
135 vco->r = 22; in vco_get()
136 vco->s = (val >> 20) & 7; in vco_get()
140 vco->v = val & 0x1ff; in vco_get()
141 vco->r = (val >> 9) & 0x7f; in vco_get()
142 vco->s = (val >> 16) & 03; in vco_get()
147 * vco_set() - commit changes to an ICST VCO
158 switch (icst->ctype) { in vco_set()
205 ret = regmap_write(icst->map, icst->lockreg_off, VERSATILE_LOCK_VAL); in vco_set()
208 ret = regmap_update_bits(icst->map, icst->vcoreg_off, mask, val); in vco_set()
212 ret = regmap_write(icst->map, icst->lockreg_off, 0); in vco_set()
226 icst->params->ref = parent_rate; in icst_recalc_rate()
232 icst->rate = icst_hz(icst->params, vco); in icst_recalc_rate()
233 return icst->rate; in icst_recalc_rate()
242 if (icst->ctype == ICST_INTEGRATOR_AP_CM || in icst_round_rate()
243 icst->ctype == ICST_INTEGRATOR_CP_CM_CORE) { in icst_round_rate()
252 if (icst->ctype == ICST_INTEGRATOR_CP_CM_MEM) { in icst_round_rate()
261 if (icst->ctype == ICST_INTEGRATOR_AP_SYS) { in icst_round_rate()
271 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) { in icst_round_rate()
282 vco = icst_hz_to_vco(icst->params, rate); in icst_round_rate()
283 return icst_hz(icst->params, vco); in icst_round_rate()
292 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) { in icst_set_rate()
304 return -EINVAL; in icst_set_rate()
306 ret = regmap_write(icst->map, icst->lockreg_off, in icst_set_rate()
310 ret = regmap_update_bits(icst->map, icst->vcoreg_off, in icst_set_rate()
316 ret = regmap_write(icst->map, icst->lockreg_off, 0); in icst_set_rate()
323 icst->params->ref = parent_rate; in icst_set_rate()
324 vco = icst_hz_to_vco(icst->params, rate); in icst_set_rate()
325 icst->rate = icst_hz(icst->params, vco); in icst_set_rate()
349 return ERR_PTR(-ENOMEM); in icst_clk_setup()
351 pclone = kmemdup(desc->params, sizeof(*pclone), GFP_KERNEL); in icst_clk_setup()
354 return ERR_PTR(-ENOMEM); in icst_clk_setup()
362 icst->map = map; in icst_clk_setup()
363 icst->hw.init = &init; in icst_clk_setup()
364 icst->params = pclone; in icst_clk_setup()
365 icst->vcoreg_off = desc->vco_offset; in icst_clk_setup()
366 icst->lockreg_off = desc->lock_offset; in icst_clk_setup()
367 icst->ctype = ctype; in icst_clk_setup()
369 clk = clk_register(dev, &icst->hw); in icst_clk_setup()
404 * In a device tree, an memory-mapped ICST clock appear as a child
432 * The core modules on the Integrator/AP and Integrator/CP have
441 * Maximum 160 MHz, VDW = 152 for all core modules, but
442 * CM926EJ-S, CM1026EJ-S and CM1136JF-S can actually
486 const char *name = np->name; in of_syscon_icst_setup()
503 if (of_property_read_u32(np, "vco-offset", &icst_desc.vco_offset)) { in of_syscon_icst_setup()
507 if (of_property_read_u32(np, "lock-offset", &icst_desc.lock_offset)) { in of_syscon_icst_setup()
512 if (of_device_is_compatible(np, "arm,syscon-icst525")) { in of_syscon_icst_setup()
515 } else if (of_device_is_compatible(np, "arm,syscon-icst307")) { in of_syscon_icst_setup()
518 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorap-cm")) { in of_syscon_icst_setup()
521 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorap-sys")) { in of_syscon_icst_setup()
524 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorap-pci")) { in of_syscon_icst_setup()
527 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorcp-cm-core")) { in of_syscon_icst_setup()
530 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorcp-cm-mem")) { in of_syscon_icst_setup()
551 "arm,syscon-icst525", of_syscon_icst_setup);
553 "arm,syscon-icst307", of_syscon_icst_setup);
555 "arm,syscon-icst525-integratorap-cm", of_syscon_icst_setup);
557 "arm,syscon-icst525-integratorap-sys", of_syscon_icst_setup);
559 "arm,syscon-icst525-integratorap-pci", of_syscon_icst_setup);
561 "arm,syscon-icst525-integratorcp-cm-core", of_syscon_icst_setup);
563 "arm,syscon-icst525-integratorcp-cm-mem", of_syscon_icst_setup);