Lines Matching full:pll

66 static unsigned int __get_fid(struct iproc_arm_pll *pll)  in __get_fid()  argument
71 val = readl(pll->base + IPROC_CLK_ARM_DIV_OFFSET); in __get_fid()
80 val = readl(pll->base + IPROC_CLK_POLICY_FREQ_OFFSET); in __get_fid()
84 val = readl(pll->base + IPROC_CLK_POLICY_DBG_OFFSET); in __get_fid()
103 * - PLL channel 0 (slow clock)
104 * - PLL channel 1 (fast clock)
106 static int __get_mdiv(struct iproc_arm_pll *pll) in __get_mdiv() argument
112 fid = __get_fid(pll); in __get_mdiv()
121 val = readl(pll->base + IPROC_CLK_PLLARMC_OFFSET); in __get_mdiv()
128 val = readl(pll->base + IPROC_CLK_PLLARMCTL5_OFFSET); in __get_mdiv()
141 static unsigned int __get_ndiv(struct iproc_arm_pll *pll) in __get_ndiv() argument
146 val = readl(pll->base + IPROC_CLK_PLLARM_OFFSET_OFFSET); in __get_ndiv()
160 val = readl(pll->base + IPROC_CLK_PLLARMA_OFFSET); in __get_ndiv()
166 val = readl(pll->base + IPROC_CLK_PLLARMB_OFFSET); in __get_ndiv()
176 * The output frequency of the ARM PLL is calculated based on the ARM PLL
178 * pdiv = ARM PLL pre-divider
179 * ndiv = ARM PLL multiplier
180 * mdiv = ARM PLL post divider
188 struct iproc_arm_pll *pll = to_iproc_arm_pll(hw); in iproc_arm_pll_recalc_rate() local
195 val = readl(pll->base + IPROC_CLK_PLLARMC_OFFSET); in iproc_arm_pll_recalc_rate()
197 pll->rate = parent_rate; in iproc_arm_pll_recalc_rate()
198 return pll->rate; in iproc_arm_pll_recalc_rate()
201 /* PLL needs to be locked */ in iproc_arm_pll_recalc_rate()
202 val = readl(pll->base + IPROC_CLK_PLLARMA_OFFSET); in iproc_arm_pll_recalc_rate()
204 pll->rate = 0; in iproc_arm_pll_recalc_rate()
213 ndiv = __get_ndiv(pll); in iproc_arm_pll_recalc_rate()
214 mdiv = __get_mdiv(pll); in iproc_arm_pll_recalc_rate()
216 pll->rate = 0; in iproc_arm_pll_recalc_rate()
219 pll->rate = (ndiv * parent_rate) >> 20; in iproc_arm_pll_recalc_rate()
220 pll->rate = (pll->rate / pdiv) / mdiv; in iproc_arm_pll_recalc_rate()
222 pr_debug("%s: ARM PLL rate: %lu. parent rate: %lu\n", __func__, in iproc_arm_pll_recalc_rate()
223 pll->rate, parent_rate); in iproc_arm_pll_recalc_rate()
227 return pll->rate; in iproc_arm_pll_recalc_rate()
237 struct iproc_arm_pll *pll; in iproc_armpll_setup() local
241 pll = kzalloc(sizeof(*pll), GFP_KERNEL); in iproc_armpll_setup()
242 if (WARN_ON(!pll)) in iproc_armpll_setup()
245 pll->base = of_iomap(node, 0); in iproc_armpll_setup()
246 if (WARN_ON(!pll->base)) in iproc_armpll_setup()
255 pll->hw.init = &init; in iproc_armpll_setup()
257 ret = clk_hw_register(NULL, &pll->hw); in iproc_armpll_setup()
261 ret = of_clk_add_hw_provider(node, of_clk_hw_simple_get, &pll->hw); in iproc_armpll_setup()
268 clk_hw_unregister(&pll->hw); in iproc_armpll_setup()
270 iounmap(pll->base); in iproc_armpll_setup()
272 kfree(pll); in iproc_armpll_setup()