Lines Matching +full:reg +full:- +full:init

1 // SPDX-License-Identifier: GPL-2.0
6 #include <linux/clk-provider.h>
9 #include "stratix10-clk.h"
23 unsigned long shift = socfpgaclk->shift; in n5x_clk_peri_c_clk_recalc_rate()
26 val = readl(socfpgaclk->hw.reg); in n5x_clk_peri_c_clk_recalc_rate()
40 val = readl(socfpgaclk->hw.reg); in clk_peri_c_clk_recalc_rate()
41 val &= GENMASK(SWCTRLBTCLKSEN_SHIFT - 1, 0); in clk_peri_c_clk_recalc_rate()
53 if (socfpgaclk->fixed_div) { in clk_peri_cnt_clk_recalc_rate()
54 div = socfpgaclk->fixed_div; in clk_peri_cnt_clk_recalc_rate()
56 if (socfpgaclk->hw.reg) in clk_peri_cnt_clk_recalc_rate()
57 div = ((readl(socfpgaclk->hw.reg) & 0x7ff) + 1); in clk_peri_cnt_clk_recalc_rate()
70 if (socfpgaclk->bypass_reg) { in clk_periclk_get_parent()
71 mask = (0x1 << socfpgaclk->bypass_shift); in clk_periclk_get_parent()
72 parent = ((readl(socfpgaclk->bypass_reg) & mask) >> in clk_periclk_get_parent()
73 socfpgaclk->bypass_shift); in clk_periclk_get_parent()
78 if (socfpgaclk->hw.reg) { in clk_periclk_get_parent()
79 clk_src = readl(socfpgaclk->hw.reg); in clk_periclk_get_parent()
102 void __iomem *reg) in s10_register_periph() argument
106 struct clk_init_data init; in s10_register_periph() local
107 const char *name = clks->name; in s10_register_periph()
108 const char *parent_name = clks->parent_name; in s10_register_periph()
115 periph_clk->hw.reg = reg + clks->offset; in s10_register_periph()
117 init.name = name; in s10_register_periph()
118 init.ops = &peri_c_clk_ops; in s10_register_periph()
119 init.flags = clks->flags; in s10_register_periph()
121 init.num_parents = clks->num_parents; in s10_register_periph()
122 init.parent_names = parent_name ? &parent_name : NULL; in s10_register_periph()
123 if (init.parent_names == NULL) in s10_register_periph()
124 init.parent_data = clks->parent_data; in s10_register_periph()
126 periph_clk->hw.hw.init = &init; in s10_register_periph()
127 hw_clk = &periph_clk->hw.hw; in s10_register_periph()
142 struct clk_init_data init; in n5x_register_periph() local
143 const char *name = clks->name; in n5x_register_periph()
144 const char *parent_name = clks->parent_name; in n5x_register_periph()
151 periph_clk->hw.reg = regbase + clks->offset; in n5x_register_periph()
152 periph_clk->shift = clks->shift; in n5x_register_periph()
154 init.name = name; in n5x_register_periph()
155 init.ops = &n5x_peri_c_clk_ops; in n5x_register_periph()
156 init.flags = clks->flags; in n5x_register_periph()
158 init.num_parents = clks->num_parents; in n5x_register_periph()
159 init.parent_names = parent_name ? &parent_name : NULL; in n5x_register_periph()
161 periph_clk->hw.hw.init = &init; in n5x_register_periph()
162 hw_clk = &periph_clk->hw.hw; in n5x_register_periph()
177 struct clk_init_data init; in s10_register_cnt_periph() local
178 const char *name = clks->name; in s10_register_cnt_periph()
179 const char *parent_name = clks->parent_name; in s10_register_cnt_periph()
186 if (clks->offset) in s10_register_cnt_periph()
187 periph_clk->hw.reg = regbase + clks->offset; in s10_register_cnt_periph()
189 periph_clk->hw.reg = NULL; in s10_register_cnt_periph()
191 if (clks->bypass_reg) in s10_register_cnt_periph()
192 periph_clk->bypass_reg = regbase + clks->bypass_reg; in s10_register_cnt_periph()
194 periph_clk->bypass_reg = NULL; in s10_register_cnt_periph()
195 periph_clk->bypass_shift = clks->bypass_shift; in s10_register_cnt_periph()
196 periph_clk->fixed_div = clks->fixed_divider; in s10_register_cnt_periph()
198 init.name = name; in s10_register_cnt_periph()
199 init.ops = &peri_cnt_clk_ops; in s10_register_cnt_periph()
200 init.flags = clks->flags; in s10_register_cnt_periph()
202 init.num_parents = clks->num_parents; in s10_register_cnt_periph()
203 init.parent_names = parent_name ? &parent_name : NULL; in s10_register_cnt_periph()
204 if (init.parent_names == NULL) in s10_register_cnt_periph()
205 init.parent_data = clks->parent_data; in s10_register_cnt_periph()
207 periph_clk->hw.hw.init = &init; in s10_register_cnt_periph()
208 hw_clk = &periph_clk->hw.hw; in s10_register_cnt_periph()