Lines Matching +full:latch +full:- +full:bit

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Tero Kristo <t-kristo@ti.com>
12 #include <linux/clk-provider.h>
45 struct clk_iomap *io = clk_memmaps[reg->index];
47 if (reg->ptr)
48 writel_relaxed(val, reg->ptr);
49 else if (io->regmap)
50 regmap_write(io->regmap, reg->offset, val);
52 writel_relaxed(val, io->mem + reg->offset);
67 struct clk_iomap *io = clk_memmaps[reg->index];
69 if (reg->ptr) {
70 _clk_rmw(val, mask, reg->ptr);
71 } else if (io->regmap) {
72 regmap_update_bits(io->regmap, reg->offset, mask, val);
74 _clk_rmw(val, mask, io->mem + reg->offset);
81 struct clk_iomap *io = clk_memmaps[reg->index];
83 if (reg->ptr)
84 val = readl_relaxed(reg->ptr);
85 else if (io->regmap)
86 regmap_read(io->regmap, reg->offset, &val);
88 val = readl_relaxed(io->mem + reg->offset);
94 * ti_clk_setup_ll_ops - setup low level clock operations
99 * specific code. Returns 0 on success, -EBUSY if ll_ops have been
106 return -EBUSY;
110 ops->clk_readl = clk_memmap_readl;
111 ops->clk_writel = clk_memmap_writel;
112 ops->clk_rmw = clk_memmap_rmw;
118 * Eventually we could standardize to using '_' for clk-*.c files to follow the
130 tmp = kstrdup_and_replace(name, '-', '_', GFP_KERNEL);
139 /* Node named "clock" with "clock-output-names" */
141 if (of_property_read_string_index(np, "clock-output-names",
162 * ti_dt_clocks_register - register DT alias clocks during boot
165 * Register alias or non-standard DT clock entries during boot. By
166 * default, DT clocks are found based on their clock-output-names
168 * additional con-id / dev-id -> clock mapping is required, use this
187 compat_mode = ti_clk_get_features()->flags & TI_CLK_CLKCTRL_COMPAT;
189 for (c = oclks; c->node_name != NULL; c++) {
190 strcpy(buf, c->node_name);
199 c->node_name);
229 c->node_name, i, tags[i]);
237 c->lk.clk = clk;
238 clkdev_add(&c->lk);
257 c->node_name, PTR_ERR(clk));
272 * ti_clk_retry_init - retries a failed clock init at later phase
288 return -ENOMEM;
290 retry->node = node;
291 retry->func = func;
292 retry->user = user;
293 list_add(&retry->link, &retry_list);
299 * ti_clk_get_reg_addr - get register address for a clock register
316 if (clocks_node_ptr[i] == node->parent)
318 if (clocks_node_ptr[i] == node->parent->parent)
323 pr_err("clk-provider not found for %pOFn!\n", node);
324 return -ENOENT;
327 reg->index = i;
329 if (of_device_is_compatible(node->parent, "ti,clksel")) {
330 err = of_property_read_u32_index(node->parent, "reg", index, &clksel_addr);
333 return -EINVAL;
340 /* Legacy clksel with no reg and a possible ti,bit-shift property */
341 reg->offset = clksel_addr;
342 reg->bit = ti_clk_get_legacy_bit_shift(node);
343 reg->ptr = NULL;
350 reg->offset = clksel_addr;
351 reg->bit = val;
352 reg->ptr = NULL;
356 /* Other clocks that may or may not have ti,bit-shift property */
357 reg->offset = val;
358 reg->bit = ti_clk_get_legacy_bit_shift(node);
359 reg->ptr = NULL;
365 * ti_clk_get_legacy_bit_shift - get bit shift for a clock register
368 * Gets the clock register bit shift using the legacy ti,bit-shift
378 err = of_property_read_u32(node, "ti,bit-shift", &val);
387 u32 latch;
392 latch = 1 << shift;
394 ti_clk_ll_ops->clk_rmw(latch, latch, reg);
395 ti_clk_ll_ops->clk_rmw(0, latch, reg);
396 ti_clk_ll_ops->clk_readl(reg); /* OCP barrier */
400 * omap2_clk_provider_init - init master clock provider
423 return -EINVAL;
431 return -ENOMEM;
433 io->regmap = syscon;
434 io->mem = mem;
442 * omap2_clk_legacy_provider_init - initialize a legacy clock provider
454 io->mem = mem;
460 * ti_dt_clk_init_retry_clks - init clocks from the retry list
475 pr_debug("retry-init: %pOFn\n", retry->node);
476 retry->func(retry->user, retry->node);
477 list_del(&retry->link);
480 retries--;
485 { .compatible = "fixed-clock" },
486 { .compatible = "fixed-factor-clock" },
491 * ti_dt_clk_name - init clock name from first output name or node name
494 * Use the first clock-output-name for the clock name if found. Fall back
501 if (!of_property_read_string_index(np, "clock-output-names", 0,
505 return np->name;
509 * ti_clk_add_aliases - setup clock aliases
529 * ti_clk_setup_features - setup clock features flags
541 * ti_clk_get_features - get clock driver features flags
552 * omap2_clk_enable_init_clocks - prepare & enable a list of clocks
576 * ti_clk_add_alias - add a clock alias for a TI clock
596 return -ENOMEM;
598 cl->con_id = con;
599 cl->clk = clk;
607 * of_ti_clk_register - register a TI clock to the common clock framework
626 clk = hw->clk;
637 * of_ti_clk_register_omap_hw - register a clk_hw_omap to the clock framework
659 list_add(&oclk->node, &clk_hw_omap_clocks);
665 * omap2_clk_for_each - call function for each registered clk_hw_omap
670 * failure. If @fn returns non-zero, the iteration across clocks
671 * will stop and the non-zero return value will be passed to the
689 * omap2_clk_is_hw_omap - check if the provided clk_hw is OMAP clock
700 if (&oclk->hw == hw)