Lines Matching +full:integratorap +full:- +full:cm
6 * Copyright (C) 2012-2015 Linus Walleij
20 #include <linux/clk-provider.h>
26 #include "clk-icst.h"
40 * enum icst_control_type - the type of ICST control register
52 * struct clk_icst - ICST VCO clock wrapper
73 * vco_get() - get ICST VCO settings from a certain ICST
82 ret = regmap_read(icst->map, icst->vcoreg_off, &val); in vco_get()
91 * "Integrator CM926EJ-S, CM946E-S, CM966E-S, CM1026EJ-S and in vco_get()
92 * CM1136JF-S User Guide" ARM DUI 0138E, page 3-13 thru 3-14. in vco_get()
94 if (icst->ctype == ICST_INTEGRATOR_AP_CM) { in vco_get()
95 vco->v = val & INTEGRATOR_AP_CM_BITS; in vco_get()
96 vco->r = 22; in vco_get()
97 vco->s = 1; in vco_get()
107 * page 3-16. in vco_get()
109 if (icst->ctype == ICST_INTEGRATOR_AP_SYS) { in vco_get()
110 vco->v = val & INTEGRATOR_AP_SYS_BITS; in vco_get()
111 vco->r = 46; in vco_get()
112 vco->s = 3; in vco_get()
124 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) { in vco_get()
127 vco->v = divxy ? 17 : 14; in vco_get()
128 vco->r = divxy ? 22 : 14; in vco_get()
129 vco->s = 1; in vco_get()
139 * ARM DUI 0157A, page 3-20 thru 3-23 and 4-10. in vco_get()
141 if (icst->ctype == ICST_INTEGRATOR_CP_CM_CORE) { in vco_get()
142 vco->v = val & 0xFF; in vco_get()
143 vco->r = 22; in vco_get()
144 vco->s = (val >> 8) & 7; in vco_get()
148 if (icst->ctype == ICST_INTEGRATOR_CP_CM_MEM) { in vco_get()
149 vco->v = (val >> 12) & 0xFF; in vco_get()
150 vco->r = 22; in vco_get()
151 vco->s = (val >> 20) & 7; in vco_get()
155 vco->v = val & 0x1ff; in vco_get()
156 vco->r = (val >> 9) & 0x7f; in vco_get()
157 vco->s = (val >> 16) & 03; in vco_get()
162 * vco_set() - commit changes to an ICST VCO
173 switch (icst->ctype) { in vco_set()
220 ret = regmap_write(icst->map, icst->lockreg_off, VERSATILE_LOCK_VAL); in vco_set()
223 ret = regmap_update_bits(icst->map, icst->vcoreg_off, mask, val); in vco_set()
227 ret = regmap_write(icst->map, icst->lockreg_off, 0); in vco_set()
241 icst->params->ref = parent_rate; in icst_recalc_rate()
247 icst->rate = icst_hz(icst->params, vco); in icst_recalc_rate()
248 return icst->rate; in icst_recalc_rate()
257 if (icst->ctype == ICST_INTEGRATOR_AP_CM || in icst_round_rate()
258 icst->ctype == ICST_INTEGRATOR_CP_CM_CORE) { in icst_round_rate()
267 if (icst->ctype == ICST_INTEGRATOR_CP_CM_MEM) { in icst_round_rate()
276 if (icst->ctype == ICST_INTEGRATOR_AP_SYS) { in icst_round_rate()
286 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) { in icst_round_rate()
297 vco = icst_hz_to_vco(icst->params, rate); in icst_round_rate()
298 return icst_hz(icst->params, vco); in icst_round_rate()
307 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) { in icst_set_rate()
319 return -EINVAL; in icst_set_rate()
321 ret = regmap_write(icst->map, icst->lockreg_off, in icst_set_rate()
325 ret = regmap_update_bits(icst->map, icst->vcoreg_off, in icst_set_rate()
331 ret = regmap_write(icst->map, icst->lockreg_off, 0); in icst_set_rate()
338 icst->params->ref = parent_rate; in icst_set_rate()
339 vco = icst_hz_to_vco(icst->params, rate); in icst_set_rate()
340 icst->rate = icst_hz(icst->params, vco); in icst_set_rate()
364 return ERR_PTR(-ENOMEM); in icst_clk_setup()
366 pclone = kmemdup(desc->params, sizeof(*pclone), GFP_KERNEL); in icst_clk_setup()
369 return ERR_PTR(-ENOMEM); in icst_clk_setup()
377 icst->map = map; in icst_clk_setup()
378 icst->hw.init = &init; in icst_clk_setup()
379 icst->params = pclone; in icst_clk_setup()
380 icst->vcoreg_off = desc->vco_offset; in icst_clk_setup()
381 icst->lockreg_off = desc->lock_offset; in icst_clk_setup()
382 icst->ctype = ctype; in icst_clk_setup()
384 clk = clk_register(dev, &icst->hw); in icst_clk_setup()
418 * In a device tree, an memory-mapped ICST clock appear as a child
456 * CM926EJ-S, CM1026EJ-S and CM1136JF-S can actually
500 const char *name = np->name; in of_syscon_icst_setup()
517 if (of_property_read_u32(np, "vco-offset", &icst_desc.vco_offset)) { in of_syscon_icst_setup()
521 if (of_property_read_u32(np, "lock-offset", &icst_desc.lock_offset)) { in of_syscon_icst_setup()
526 if (of_device_is_compatible(np, "arm,syscon-icst525")) { in of_syscon_icst_setup()
529 } else if (of_device_is_compatible(np, "arm,syscon-icst307")) { in of_syscon_icst_setup()
532 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorap-cm")) { in of_syscon_icst_setup()
535 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorap-sys")) { in of_syscon_icst_setup()
538 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorap-pci")) { in of_syscon_icst_setup()
541 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorcp-cm-core")) { in of_syscon_icst_setup()
544 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorcp-cm-mem")) { in of_syscon_icst_setup()
565 "arm,syscon-icst525", of_syscon_icst_setup);
567 "arm,syscon-icst307", of_syscon_icst_setup);
569 "arm,syscon-icst525-integratorap-cm", of_syscon_icst_setup);
571 "arm,syscon-icst525-integratorap-sys", of_syscon_icst_setup);
573 "arm,syscon-icst525-integratorap-pci", of_syscon_icst_setup);
575 "arm,syscon-icst525-integratorcp-cm-core", of_syscon_icst_setup);
577 "arm,syscon-icst525-integratorcp-cm-mem", of_syscon_icst_setup);