Lines Matching +full:ma35d1 +full:- +full:clk

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Author: Chi-Fang Li <cfli0@nuvoton.com>
8 #include <linux/clk-provider.h>
16 #include <dt-bindings/clock/nuvoton,ma35d1-clk.h>
18 #include "clk-ma35d1.h"
133 return -EINVAL; in ma35d1_pll_find_closest()
135 if (pll->mode == PLL_MODE_INT) { in ma35d1_pll_find_closest()
155 if (pll->mode != PLL_MODE_INT) in ma35d1_pll_find_closest()
167 diff = abs(rate - fout); in ma35d1_pll_find_closest()
181 return -EINVAL; /* cannot find even one valid setting */ in ma35d1_pll_find_closest()
194 return -EINVAL; in ma35d1_clk_pll_set_rate()
200 switch (pll->mode) { in ma35d1_clk_pll_set_rate()
215 writel_relaxed(reg_ctl[0], pll->ctl0_base); in ma35d1_clk_pll_set_rate()
216 writel_relaxed(reg_ctl[1], pll->ctl1_base); in ma35d1_clk_pll_set_rate()
217 writel_relaxed(reg_ctl[2], pll->ctl2_base); in ma35d1_clk_pll_set_rate()
230 switch (pll->id) { in ma35d1_clk_pll_recalc_rate()
232 reg_ctl[0] = readl_relaxed(pll->ctl0_base); in ma35d1_clk_pll_recalc_rate()
239 reg_ctl[0] = readl_relaxed(pll->ctl0_base); in ma35d1_clk_pll_recalc_rate()
240 reg_ctl[1] = readl_relaxed(pll->ctl1_base); in ma35d1_clk_pll_recalc_rate()
241 pll_freq = ma35d1_calc_pll_freq(pll->mode, reg_ctl, parent_rate); in ma35d1_clk_pll_recalc_rate()
256 return -EINVAL; in ma35d1_clk_pll_round_rate()
262 switch (pll->id) { in ma35d1_clk_pll_round_rate()
264 reg_ctl[0] = readl_relaxed(pll->ctl0_base); in ma35d1_clk_pll_round_rate()
271 reg_ctl[0] = readl_relaxed(pll->ctl0_base); in ma35d1_clk_pll_round_rate()
272 reg_ctl[1] = readl_relaxed(pll->ctl1_base); in ma35d1_clk_pll_round_rate()
273 pll_freq = ma35d1_calc_pll_freq(pll->mode, reg_ctl, *parent_rate); in ma35d1_clk_pll_round_rate()
282 u32 val = readl_relaxed(pll->ctl1_base); in ma35d1_clk_pll_is_prepared()
292 val = readl_relaxed(pll->ctl1_base); in ma35d1_clk_pll_prepare()
294 writel_relaxed(val, pll->ctl1_base); in ma35d1_clk_pll_prepare()
303 val = readl_relaxed(pll->ctl1_base); in ma35d1_clk_pll_unprepare()
305 writel_relaxed(val, pll->ctl1_base); in ma35d1_clk_pll_unprepare()
333 return ERR_PTR(-ENOMEM); in ma35d1_reg_clk_pll()
335 pll->id = id; in ma35d1_reg_clk_pll()
336 pll->mode = u8mode; in ma35d1_reg_clk_pll()
337 pll->ctl0_base = base + REG_PLL_CTL0_OFFSET; in ma35d1_reg_clk_pll()
338 pll->ctl1_base = base + REG_PLL_CTL1_OFFSET; in ma35d1_reg_clk_pll()
339 pll->ctl2_base = base + REG_PLL_CTL2_OFFSET; in ma35d1_reg_clk_pll()
352 pll->hw.init = &init; in ma35d1_reg_clk_pll()
353 hw = &pll->hw; in ma35d1_reg_clk_pll()