Lines Matching +full:mem +full:- +full:io

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Tero Kristo <t-kristo@ti.com>
11 #include <linux/clk-provider.h>
14 #include <linux/io.h>
36 void __iomem *mem; member
43 struct clk_iomap *io = clk_memmaps[reg->index]; in clk_memmap_writel() local
45 if (reg->ptr) in clk_memmap_writel()
46 writel_relaxed(val, reg->ptr); in clk_memmap_writel()
47 else if (io->regmap) in clk_memmap_writel()
48 regmap_write(io->regmap, reg->offset, val); in clk_memmap_writel()
50 writel_relaxed(val, io->mem + reg->offset); in clk_memmap_writel()
65 struct clk_iomap *io = clk_memmaps[reg->index]; in clk_memmap_rmw() local
67 if (reg->ptr) { in clk_memmap_rmw()
68 _clk_rmw(val, mask, reg->ptr); in clk_memmap_rmw()
69 } else if (io->regmap) { in clk_memmap_rmw()
70 regmap_update_bits(io->regmap, reg->offset, mask, val); in clk_memmap_rmw()
72 _clk_rmw(val, mask, io->mem + reg->offset); in clk_memmap_rmw()
79 struct clk_iomap *io = clk_memmaps[reg->index]; in clk_memmap_readl() local
81 if (reg->ptr) in clk_memmap_readl()
82 val = readl_relaxed(reg->ptr); in clk_memmap_readl()
83 else if (io->regmap) in clk_memmap_readl()
84 regmap_read(io->regmap, reg->offset, &val); in clk_memmap_readl()
86 val = readl_relaxed(io->mem + reg->offset); in clk_memmap_readl()
92 * ti_clk_setup_ll_ops - setup low level clock operations
97 * specific code. Returns 0 on success, -EBUSY if ll_ops have been
104 return -EBUSY; in ti_clk_setup_ll_ops()
108 ops->clk_readl = clk_memmap_readl; in ti_clk_setup_ll_ops()
109 ops->clk_writel = clk_memmap_writel; in ti_clk_setup_ll_ops()
110 ops->clk_rmw = clk_memmap_rmw; in ti_clk_setup_ll_ops()
116 * Eventually we could standardize to using '_' for clk-*.c files to follow the
127 tmp = kstrdup_and_replace(name, '-', '_', GFP_KERNEL); in ti_find_clock_provider()
131 /* Node named "clock" with "clock-output-names" */ in ti_find_clock_provider()
133 if (of_property_read_string_index(np, "clock-output-names", in ti_find_clock_provider()
155 * ti_dt_clocks_register - register DT alias clocks during boot
158 * Register alias or non-standard DT clock entries during boot. By
159 * default, DT clocks are found based on their clock-output-names
161 * additional con-id / dev-id -> clock mapping is required, use this
180 compat_mode = ti_clk_get_features()->flags & TI_CLK_CLKCTRL_COMPAT; in ti_dt_clocks_register()
182 for (c = oclks; c->node_name != NULL; c++) { in ti_dt_clocks_register()
183 strcpy(buf, c->node_name); in ti_dt_clocks_register()
192 c->node_name); in ti_dt_clocks_register()
222 c->node_name, i, tags[i]); in ti_dt_clocks_register()
230 c->lk.clk = clk; in ti_dt_clocks_register()
231 clkdev_add(&c->lk); in ti_dt_clocks_register()
250 c->node_name, PTR_ERR(clk)); in ti_dt_clocks_register()
265 * ti_clk_retry_init - retries a failed clock init at later phase
281 return -ENOMEM; in ti_clk_retry_init()
283 retry->node = node; in ti_clk_retry_init()
284 retry->func = func; in ti_clk_retry_init()
285 retry->user = user; in ti_clk_retry_init()
286 list_add(&retry->link, &retry_list); in ti_clk_retry_init()
292 * ti_clk_get_reg_addr - get register address for a clock register
308 if (clocks_node_ptr[i] == node->parent) in ti_clk_get_reg_addr()
310 if (clocks_node_ptr[i] == node->parent->parent) in ti_clk_get_reg_addr()
315 pr_err("clk-provider not found for %pOFn!\n", node); in ti_clk_get_reg_addr()
316 return -ENOENT; in ti_clk_get_reg_addr()
319 reg->index = i; in ti_clk_get_reg_addr()
322 if (of_property_read_u32_index(node->parent, "reg", in ti_clk_get_reg_addr()
326 return -EINVAL; in ti_clk_get_reg_addr()
330 reg->offset = val; in ti_clk_get_reg_addr()
331 reg->ptr = NULL; in ti_clk_get_reg_addr()
345 ti_clk_ll_ops->clk_rmw(latch, latch, reg); in ti_clk_latch()
346 ti_clk_ll_ops->clk_rmw(0, latch, reg); in ti_clk_latch()
347 ti_clk_ll_ops->clk_readl(reg); /* OCP barrier */ in ti_clk_latch()
351 * omap2_clk_provider_init - init master clock provider
355 * @mem: iomem pointer for the clock provider memory area, only used if
365 struct regmap *syscon, void __iomem *mem) in omap2_clk_provider_init() argument
368 struct clk_iomap *io; in omap2_clk_provider_init() local
374 return -EINVAL; in omap2_clk_provider_init()
380 io = kzalloc(sizeof(*io), GFP_KERNEL); in omap2_clk_provider_init()
381 if (!io) in omap2_clk_provider_init()
382 return -ENOMEM; in omap2_clk_provider_init()
384 io->regmap = syscon; in omap2_clk_provider_init()
385 io->mem = mem; in omap2_clk_provider_init()
387 clk_memmaps[index] = io; in omap2_clk_provider_init()
393 * omap2_clk_legacy_provider_init - initialize a legacy clock provider
395 * @mem: iomem pointer for the clock provider memory area
399 void __init omap2_clk_legacy_provider_init(int index, void __iomem *mem) in omap2_clk_legacy_provider_init() argument
401 struct clk_iomap *io; in omap2_clk_legacy_provider_init() local
403 io = memblock_alloc(sizeof(*io), SMP_CACHE_BYTES); in omap2_clk_legacy_provider_init()
404 if (!io) in omap2_clk_legacy_provider_init()
406 sizeof(*io)); in omap2_clk_legacy_provider_init()
408 io->mem = mem; in omap2_clk_legacy_provider_init()
410 clk_memmaps[index] = io; in omap2_clk_legacy_provider_init()
414 * ti_dt_clk_init_retry_clks - init clocks from the retry list
429 pr_debug("retry-init: %pOFn\n", retry->node); in ti_dt_clk_init_retry_clks()
430 retry->func(retry->user, retry->node); in ti_dt_clk_init_retry_clks()
431 list_del(&retry->link); in ti_dt_clk_init_retry_clks()
434 retries--; in ti_dt_clk_init_retry_clks()
439 { .compatible = "fixed-clock" },
440 { .compatible = "fixed-factor-clock" },
445 * ti_dt_clk_name - init clock name from first output name or node name
448 * Use the first clock-output-name for the clock name if found. Fall back
455 if (!of_property_read_string_index(np, "clock-output-names", 0, in ti_dt_clk_name()
459 return np->name; in ti_dt_clk_name()
463 * ti_clk_add_aliases - setup clock aliases
483 * ti_clk_setup_features - setup clock features flags
495 * ti_clk_get_features - get clock driver features flags
506 * omap2_clk_enable_init_clocks - prepare & enable a list of clocks
530 * ti_clk_add_alias - add a clock alias for a TI clock
550 return -ENOMEM; in ti_clk_add_alias()
552 cl->con_id = con; in ti_clk_add_alias()
553 cl->clk = clk; in ti_clk_add_alias()
561 * of_ti_clk_register - register a TI clock to the common clock framework
580 clk = hw->clk; in of_ti_clk_register()
591 * of_ti_clk_register_omap_hw - register a clk_hw_omap to the clock framework
613 list_add(&oclk->node, &clk_hw_omap_clocks); in of_ti_clk_register_omap_hw()
619 * omap2_clk_for_each - call function for each registered clk_hw_omap
624 * failure. If @fn returns non-zero, the iteration across clocks
625 * will stop and the non-zero return value will be passed to the
643 * omap2_clk_is_hw_omap - check if the provided clk_hw is OMAP clock
654 if (&oclk->hw == hw) in omap2_clk_is_hw_omap()