Lines Matching +full:fixed +full:- +full:rate
1 // SPDX-License-Identifier: GPL-2.0-only
6 #include <linux/clk-provider.h>
19 struct tegra_clk_periph_fixed *fixed = to_tegra_clk_periph_fixed(hw); in tegra_clk_periph_fixed_is_enabled() local
20 u32 mask = 1 << (fixed->num % 32), value; in tegra_clk_periph_fixed_is_enabled()
22 value = readl(fixed->base + fixed->regs->enb_reg); in tegra_clk_periph_fixed_is_enabled()
24 value = readl(fixed->base + fixed->regs->rst_reg); in tegra_clk_periph_fixed_is_enabled()
34 struct tegra_clk_periph_fixed *fixed = to_tegra_clk_periph_fixed(hw); in tegra_clk_periph_fixed_enable() local
35 u32 mask = 1 << (fixed->num % 32); in tegra_clk_periph_fixed_enable()
37 writel(mask, fixed->base + fixed->regs->enb_set_reg); in tegra_clk_periph_fixed_enable()
44 struct tegra_clk_periph_fixed *fixed = to_tegra_clk_periph_fixed(hw); in tegra_clk_periph_fixed_disable() local
45 u32 mask = 1 << (fixed->num % 32); in tegra_clk_periph_fixed_disable()
47 writel(mask, fixed->base + fixed->regs->enb_clr_reg); in tegra_clk_periph_fixed_disable()
54 struct tegra_clk_periph_fixed *fixed = to_tegra_clk_periph_fixed(hw); in tegra_clk_periph_fixed_recalc_rate() local
55 unsigned long long rate; in tegra_clk_periph_fixed_recalc_rate() local
57 rate = (unsigned long long)parent_rate * fixed->mul; in tegra_clk_periph_fixed_recalc_rate()
58 do_div(rate, fixed->div); in tegra_clk_periph_fixed_recalc_rate()
60 return (unsigned long)rate; in tegra_clk_periph_fixed_recalc_rate()
79 struct tegra_clk_periph_fixed *fixed; in tegra_clk_register_periph_fixed() local
85 return ERR_PTR(-EINVAL); in tegra_clk_register_periph_fixed()
87 fixed = kzalloc(sizeof(*fixed), GFP_KERNEL); in tegra_clk_register_periph_fixed()
88 if (!fixed) in tegra_clk_register_periph_fixed()
89 return ERR_PTR(-ENOMEM); in tegra_clk_register_periph_fixed()
97 fixed->base = base; in tegra_clk_register_periph_fixed()
98 fixed->regs = regs; in tegra_clk_register_periph_fixed()
99 fixed->mul = mul; in tegra_clk_register_periph_fixed()
100 fixed->div = div; in tegra_clk_register_periph_fixed()
101 fixed->num = num; in tegra_clk_register_periph_fixed()
103 fixed->hw.init = &init; in tegra_clk_register_periph_fixed()
105 clk = clk_register(NULL, &fixed->hw); in tegra_clk_register_periph_fixed()
107 kfree(fixed); in tegra_clk_register_periph_fixed()