Lines Matching +full:pll +full:- +full:in
1 // SPDX-License-Identifier: GPL-2.0
5 * This driver supports the fractional plls found in the imx8m SOCs
7 * Documentation for this fractional pll can be found at:
8 * https://www.nxp.com/docs/en/reference-manual/IMX8MDQLQRM.pdf#page=834
11 #include <linux/clk-provider.h>
44 static int clk_wait_lock(struct clk_frac_pll *pll) in clk_wait_lock() argument
48 return readl_poll_timeout(pll->base, val, val & PLL_LOCK_STATUS, 0, in clk_wait_lock()
52 static int clk_wait_ack(struct clk_frac_pll *pll) in clk_wait_ack() argument
56 /* return directly if the pll is in powerdown or in bypass */ in clk_wait_ack()
57 if (readl_relaxed(pll->base) & (PLL_PD_MASK | PLL_BYPASS_MASK)) in clk_wait_ack()
60 /* Wait for the pll's divfi and divff to be reloaded */ in clk_wait_ack()
61 return readl_poll_timeout(pll->base, val, val & PLL_NEWDIV_ACK, 0, in clk_wait_ack()
67 struct clk_frac_pll *pll = to_clk_frac_pll(hw); in clk_pll_prepare() local
70 val = readl_relaxed(pll->base + PLL_CFG0); in clk_pll_prepare()
72 writel_relaxed(val, pll->base + PLL_CFG0); in clk_pll_prepare()
74 return clk_wait_lock(pll); in clk_pll_prepare()
79 struct clk_frac_pll *pll = to_clk_frac_pll(hw); in clk_pll_unprepare() local
82 val = readl_relaxed(pll->base + PLL_CFG0); in clk_pll_unprepare()
84 writel_relaxed(val, pll->base + PLL_CFG0); in clk_pll_unprepare()
89 struct clk_frac_pll *pll = to_clk_frac_pll(hw); in clk_pll_is_prepared() local
92 val = readl_relaxed(pll->base + PLL_CFG0); in clk_pll_is_prepared()
99 struct clk_frac_pll *pll = to_clk_frac_pll(hw); in clk_pll_recalc_rate() local
104 val = readl_relaxed(pll->base + PLL_CFG0); in clk_pll_recalc_rate()
106 val = readl_relaxed(pll->base + PLL_CFG1); in clk_pll_recalc_rate()
134 temp64 = rate - divfi * parent_rate; in clk_pll_round_rate()
150 * (means the PLL output will be divided by 2). So the PLL output can use
158 struct clk_frac_pll *pll = to_clk_frac_pll(hw); in clk_pll_set_rate() local
167 temp64 = rate - temp64; in clk_pll_set_rate()
172 val = readl_relaxed(pll->base + PLL_CFG1); in clk_pll_set_rate()
174 val |= (divff << 7) | (divfi - 1); in clk_pll_set_rate()
175 writel_relaxed(val, pll->base + PLL_CFG1); in clk_pll_set_rate()
177 val = readl_relaxed(pll->base + PLL_CFG0); in clk_pll_set_rate()
179 writel_relaxed(val, pll->base + PLL_CFG0); in clk_pll_set_rate()
182 val = readl_relaxed(pll->base + PLL_CFG0); in clk_pll_set_rate()
184 writel_relaxed(val, pll->base + PLL_CFG0); in clk_pll_set_rate()
186 ret = clk_wait_ack(pll); in clk_pll_set_rate()
189 val = readl_relaxed(pll->base + PLL_CFG0); in clk_pll_set_rate()
191 writel_relaxed(val, pll->base + PLL_CFG0); in clk_pll_set_rate()
210 struct clk_frac_pll *pll; in imx_clk_hw_frac_pll() local
214 pll = kzalloc(sizeof(*pll), GFP_KERNEL); in imx_clk_hw_frac_pll()
215 if (!pll) in imx_clk_hw_frac_pll()
216 return ERR_PTR(-ENOMEM); in imx_clk_hw_frac_pll()
224 pll->base = base; in imx_clk_hw_frac_pll()
225 pll->hw.init = &init; in imx_clk_hw_frac_pll()
227 hw = &pll->hw; in imx_clk_hw_frac_pll()
231 kfree(pll); in imx_clk_hw_frac_pll()