Lines Matching full:icst
4 * We wrap the custom interface from <asm/hardware/icst.h> into the generic
10 * ICST clock code from the ARM tree should probably be merged into this
22 #include "icst.h"
23 #include "clk-icst.h"
37 * struct clk_icst - ICST VCO clock wrapper
42 * @params: parameters for this ICST instance
44 * @ctype: the type of control register for the ICST
59 * vco_get() - get ICST VCO settings from a certain ICST
60 * @icst: the ICST clock to get
63 static int vco_get(struct clk_icst *icst, struct icst_vco *vco) in vco_get() argument
68 ret = regmap_read(icst->map, icst->vcoreg_off, &val); in vco_get()
80 if (icst->ctype == ICST_INTEGRATOR_AP_CM) { in vco_get()
95 if (icst->ctype == ICST_INTEGRATOR_AP_SYS) { in vco_get()
110 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) { in vco_get()
127 if (icst->ctype == ICST_INTEGRATOR_CP_CM_CORE) { in vco_get()
134 if (icst->ctype == ICST_INTEGRATOR_CP_CM_MEM) { in vco_get()
148 * vco_set() - commit changes to an ICST VCO
149 * @icst: the ICST clock to set
152 static int vco_set(struct clk_icst *icst, struct icst_vco vco) in vco_set() argument
159 switch (icst->ctype) { in vco_set()
164 pr_err("ICST error: tried to set bit 8 of VDW\n"); in vco_set()
166 pr_err("ICST error: tried to use VOD != 1\n"); in vco_set()
168 pr_err("ICST error: tried to use RDW != 22\n"); in vco_set()
174 pr_err("ICST error: tried to set bit 8 of VDW\n"); in vco_set()
176 pr_err("ICST error: tried to use VOD != 1\n"); in vco_set()
178 pr_err("ICST error: tried to use RDW != 22\n"); in vco_set()
184 pr_err("ICST error: tried to set bit 8 of VDW\n"); in vco_set()
186 pr_err("ICST error: tried to use RDW != 22\n"); in vco_set()
192 pr_err("ICST error: tried to set bit 8 of VDW\n"); in vco_set()
194 pr_err("ICST error: tried to use RDW != 22\n"); in vco_set()
203 pr_debug("ICST: new val = 0x%08x\n", val); in vco_set()
206 ret = regmap_write(icst->map, icst->lockreg_off, VERSATILE_LOCK_VAL); in vco_set()
209 ret = regmap_update_bits(icst->map, icst->vcoreg_off, mask, val); in vco_set()
213 ret = regmap_write(icst->map, icst->lockreg_off, 0); in vco_set()
222 struct clk_icst *icst = to_icst(hw); in icst_recalc_rate() local
227 icst->params->ref = parent_rate; in icst_recalc_rate()
228 ret = vco_get(icst, &vco); in icst_recalc_rate()
230 pr_err("ICST: could not get VCO setting\n"); in icst_recalc_rate()
233 icst->rate = icst_hz(icst->params, vco); in icst_recalc_rate()
234 return icst->rate; in icst_recalc_rate()
240 struct clk_icst *icst = to_icst(hw); in icst_round_rate() local
243 if (icst->ctype == ICST_INTEGRATOR_AP_CM || in icst_round_rate()
244 icst->ctype == ICST_INTEGRATOR_CP_CM_CORE) { in icst_round_rate()
253 if (icst->ctype == ICST_INTEGRATOR_CP_CM_MEM) { in icst_round_rate()
262 if (icst->ctype == ICST_INTEGRATOR_AP_SYS) { in icst_round_rate()
272 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) { in icst_round_rate()
283 vco = icst_hz_to_vco(icst->params, rate); in icst_round_rate()
284 return icst_hz(icst->params, vco); in icst_round_rate()
290 struct clk_icst *icst = to_icst(hw); in icst_set_rate() local
293 if (icst->ctype == ICST_INTEGRATOR_AP_PCI) { in icst_set_rate()
303 pr_err("ICST: cannot set PCI frequency %lu\n", in icst_set_rate()
307 ret = regmap_write(icst->map, icst->lockreg_off, in icst_set_rate()
311 ret = regmap_update_bits(icst->map, icst->vcoreg_off, in icst_set_rate()
317 ret = regmap_write(icst->map, icst->lockreg_off, 0); in icst_set_rate()
324 icst->params->ref = parent_rate; in icst_set_rate()
325 vco = icst_hz_to_vco(icst->params, rate); in icst_set_rate()
326 icst->rate = icst_hz(icst->params, vco); in icst_set_rate()
327 return vco_set(icst, vco); in icst_set_rate()
344 struct clk_icst *icst; in icst_clk_setup() local
348 icst = kzalloc(sizeof(*icst), GFP_KERNEL); in icst_clk_setup()
349 if (!icst) in icst_clk_setup()
354 kfree(icst); in icst_clk_setup()
363 icst->map = map; in icst_clk_setup()
364 icst->hw.init = &init; in icst_clk_setup()
365 icst->params = pclone; in icst_clk_setup()
366 icst->vcoreg_off = desc->vco_offset; in icst_clk_setup()
367 icst->lockreg_off = desc->lock_offset; in icst_clk_setup()
368 icst->ctype = ctype; in icst_clk_setup()
370 clk = clk_register(dev, &icst->hw); in icst_clk_setup()
373 kfree(icst); in icst_clk_setup()
395 pr_err("could not initialize ICST regmap\n"); in icst_clk_register()
405 * In a device tree, an memory-mapped ICST clock appear as a child
495 pr_err("no parent node for syscon ICST clock\n"); in of_syscon_icst_setup()
500 pr_err("no regmap for syscon ICST clock parent\n"); in of_syscon_icst_setup()
506 pr_err("no VCO register offset for ICST clock\n"); in of_syscon_icst_setup()
510 pr_err("no lock register offset for ICST clock\n"); in of_syscon_icst_setup()
536 pr_err("unknown ICST clock %pOF\n", np); in of_syscon_icst_setup()
546 pr_err("error setting up syscon ICST clock %s\n", name); in of_syscon_icst_setup()
551 pr_debug("registered syscon ICST clock %s\n", name); in of_syscon_icst_setup()