Lines Matching +full:sys +full:- +full:syscon
1 // SPDX-License-Identifier: GPL-2.0-only
7 * Copyright (C) 2012-2015 Linus Walleij
17 #include <linux/clk-provider.h>
20 #include <linux/mfd/syscon.h>
23 #include "clk-icst.h"
37 * struct clk_icst - ICST VCO clock wrapper
59 * vco_get() - get ICST VCO settings from a certain ICST
68 ret = regmap_read(icst->map, icst->vcoreg_off, &val);
77 * "Integrator CM926EJ-S, CM946E-S, CM966E-S, CM1026EJ-S and
78 * CM1136JF-S User Guide" ARM DUI 0138E, page 3-13 thru 3-14.
80 if (icst->ctype == ICST_INTEGRATOR_AP_CM) {
81 vco->v = val & INTEGRATOR_AP_CM_BITS;
82 vco->r = 22;
83 vco->s = 1;
93 * page 3-16.
95 if (icst->ctype == ICST_INTEGRATOR_AP_SYS) {
96 vco->v = val & INTEGRATOR_AP_SYS_BITS;
97 vco->r = 46;
98 vco->s = 3;
110 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) {
113 vco->v = divxy ? 17 : 14;
114 vco->r = divxy ? 22 : 14;
115 vco->s = 1;
125 * ARM DUI 0157A, page 3-20 thru 3-23 and 4-10.
127 if (icst->ctype == ICST_INTEGRATOR_CP_CM_CORE) {
128 vco->v = val & 0xFF;
129 vco->r = 22;
130 vco->s = (val >> 8) & 7;
134 if (icst->ctype == ICST_INTEGRATOR_CP_CM_MEM) {
135 vco->v = (val >> 12) & 0xFF;
136 vco->r = 22;
137 vco->s = (val >> 20) & 7;
141 vco->v = val & 0x1ff;
142 vco->r = (val >> 9) & 0x7f;
143 vco->s = (val >> 16) & 03;
148 * vco_set() - commit changes to an ICST VCO
159 switch (icst->ctype) {
206 ret = regmap_write(icst->map, icst->lockreg_off, VERSATILE_LOCK_VAL);
209 ret = regmap_update_bits(icst->map, icst->vcoreg_off, mask, val);
213 ret = regmap_write(icst->map, icst->lockreg_off, 0);
227 icst->params->ref = parent_rate;
233 icst->rate = icst_hz(icst->params, vco);
234 return icst->rate;
243 if (icst->ctype == ICST_INTEGRATOR_AP_CM ||
244 icst->ctype == ICST_INTEGRATOR_CP_CM_CORE) {
253 if (icst->ctype == ICST_INTEGRATOR_CP_CM_MEM) {
262 if (icst->ctype == ICST_INTEGRATOR_AP_SYS) {
272 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) {
283 vco = icst_hz_to_vco(icst->params, rate);
284 return icst_hz(icst->params, vco);
293 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) {
305 return -EINVAL;
307 ret = regmap_write(icst->map, icst->lockreg_off,
311 ret = regmap_update_bits(icst->map, icst->vcoreg_off,
317 ret = regmap_write(icst->map, icst->lockreg_off, 0);
324 icst->params->ref = parent_rate;
325 vco = icst_hz_to_vco(icst->params, rate);
326 icst->rate = icst_hz(icst->params, vco);
350 return ERR_PTR(-ENOMEM);
352 pclone = kmemdup(desc->params, sizeof(*pclone), GFP_KERNEL);
355 return ERR_PTR(-ENOMEM);
363 icst->map = map;
364 icst->hw.init = &init;
365 icst->params = pclone;
366 icst->vcoreg_off = desc->vco_offset;
367 icst->lockreg_off = desc->lock_offset;
368 icst->ctype = ctype;
370 clk = clk_register(dev, &icst->hw);
405 * In a device tree, an memory-mapped ICST clock appear as a child
406 * of a syscon node. Assume this and probe it only as a child of a
407 * syscon.
443 * CM926EJ-S, CM1026EJ-S and CM1136JF-S can actually
495 pr_err("no parent node for syscon ICST clock\n");
500 pr_err("no regmap for syscon ICST clock parent\n");
505 of_property_read_u32(np, "vco-offset", &icst_desc.vco_offset)) {
509 if (of_property_read_u32(np, "lock-offset", &icst_desc.lock_offset)) {
514 if (of_device_is_compatible(np, "arm,syscon-icst525")) {
517 } else if (of_device_is_compatible(np, "arm,syscon-icst307")) {
520 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorap-cm")) {
523 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorap-sys")) {
526 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorap-pci")) {
529 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorcp-cm-core")) {
532 } else if (of_device_is_compatible(np, "arm,syscon-icst525-integratorcp-cm-mem")) {
546 pr_err("error setting up syscon ICST clock %s\n", name);
551 pr_debug("registered syscon ICST clock %s\n", name);
555 "arm,syscon-icst525", of_syscon_icst_setup);
557 "arm,syscon-icst307", of_syscon_icst_setup);
559 "arm,syscon-icst525-integratorap-cm", of_syscon_icst_setup);
561 "arm,syscon-icst525-integratorap-sys", of_syscon_icst_setup);
563 "arm,syscon-icst525-integratorap-pci", of_syscon_icst_setup);
565 "arm,syscon-icst525-integratorcp-cm-core", of_syscon_icst_setup);
567 "arm,syscon-icst525-integratorcp-cm-mem", of_syscon_icst_setup);