Lines Matching full:pd

21  * @pd: PRCI context
25 * address of the PRCI register target described by @pd, and return
30 * Return: the contents of the register described by @pd and @offs.
32 static u32 __prci_readl(struct __prci_data *pd, u32 offs) in __prci_readl() argument
34 return readl_relaxed(pd->va + offs); in __prci_readl()
37 static void __prci_writel(u32 v, u32 offs, struct __prci_data *pd) in __prci_writel() argument
39 writel_relaxed(v, pd->va + offs); in __prci_writel()
117 * @pd: PRCI context
121 * the PRCI identified by @pd, and store it into the local configuration
125 * @pd and @pwd from changing during execution.
127 static void __prci_wrpll_read_cfg0(struct __prci_data *pd, in __prci_wrpll_read_cfg0() argument
130 __prci_wrpll_unpack(&pwd->c, __prci_readl(pd, pwd->cfg0_offs)); in __prci_wrpll_read_cfg0()
135 * @pd: PRCI context
145 * @pd and @pwd from changing during execution.
147 static void __prci_wrpll_write_cfg0(struct __prci_data *pd, in __prci_wrpll_write_cfg0() argument
151 __prci_writel(__prci_wrpll_pack(c), pwd->cfg0_offs, pd); in __prci_wrpll_write_cfg0()
159 * @pd: PRCI context
163 static void __prci_wrpll_write_cfg1(struct __prci_data *pd, in __prci_wrpll_write_cfg1() argument
167 __prci_writel(enable, pwd->cfg1_offs, pd); in __prci_wrpll_write_cfg1()
206 struct __prci_data *pd = pc->pd; in sifive_prci_wrpll_set_rate() local
214 pwd->enable_bypass(pd); in sifive_prci_wrpll_set_rate()
216 __prci_wrpll_write_cfg0(pd, pwd, &pwd->c); in sifive_prci_wrpll_set_rate()
227 struct __prci_data *pd = pc->pd; in sifive_clk_is_enabled() local
230 r = __prci_readl(pd, pwd->cfg1_offs); in sifive_clk_is_enabled()
242 struct __prci_data *pd = pc->pd; in sifive_prci_clock_enable() local
247 __prci_wrpll_write_cfg1(pd, pwd, PRCI_COREPLLCFG1_CKE_MASK); in sifive_prci_clock_enable()
250 pwd->disable_bypass(pd); in sifive_prci_clock_enable()
259 struct __prci_data *pd = pc->pd; in sifive_prci_clock_disable() local
263 pwd->enable_bypass(pd); in sifive_prci_clock_disable()
265 r = __prci_readl(pd, pwd->cfg1_offs); in sifive_prci_clock_disable()
268 __prci_wrpll_write_cfg1(pd, pwd, r); in sifive_prci_clock_disable()
277 struct __prci_data *pd = pc->pd; in sifive_prci_tlclksel_recalc_rate() local
281 v = __prci_readl(pd, PRCI_CLKMUXSTATUSREG_OFFSET); in sifive_prci_tlclksel_recalc_rate()
294 struct __prci_data *pd = pc->pd; in sifive_prci_hfpclkplldiv_recalc_rate() local
295 u32 div = __prci_readl(pd, PRCI_HFPCLKPLLDIV_OFFSET); in sifive_prci_hfpclkplldiv_recalc_rate()
306 * @pd: struct __prci_data * for the PRCI containing the CORECLK mux reg
313 void sifive_prci_coreclksel_use_hfclk(struct __prci_data *pd) in sifive_prci_coreclksel_use_hfclk() argument
317 r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET); in sifive_prci_coreclksel_use_hfclk()
319 __prci_writel(r, PRCI_CORECLKSEL_OFFSET, pd); in sifive_prci_coreclksel_use_hfclk()
321 r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET); /* barrier */ in sifive_prci_coreclksel_use_hfclk()
327 * @pd: struct __prci_data * for the PRCI containing the CORECLK mux reg
334 void sifive_prci_coreclksel_use_corepll(struct __prci_data *pd) in sifive_prci_coreclksel_use_corepll() argument
338 r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET); in sifive_prci_coreclksel_use_corepll()
340 __prci_writel(r, PRCI_CORECLKSEL_OFFSET, pd); in sifive_prci_coreclksel_use_corepll()
342 r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET); /* barrier */ in sifive_prci_coreclksel_use_corepll()
348 * @pd: struct __prci_data * for the PRCI containing the CORECLK mux reg
356 void sifive_prci_coreclksel_use_final_corepll(struct __prci_data *pd) in sifive_prci_coreclksel_use_final_corepll() argument
360 r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET); in sifive_prci_coreclksel_use_final_corepll()
362 __prci_writel(r, PRCI_CORECLKSEL_OFFSET, pd); in sifive_prci_coreclksel_use_final_corepll()
364 r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET); /* barrier */ in sifive_prci_coreclksel_use_final_corepll()
370 * @pd: struct __prci_data * for the PRCI containing the COREPLL mux reg
377 void sifive_prci_corepllsel_use_dvfscorepll(struct __prci_data *pd) in sifive_prci_corepllsel_use_dvfscorepll() argument
381 r = __prci_readl(pd, PRCI_COREPLLSEL_OFFSET); in sifive_prci_corepllsel_use_dvfscorepll()
383 __prci_writel(r, PRCI_COREPLLSEL_OFFSET, pd); in sifive_prci_corepllsel_use_dvfscorepll()
385 r = __prci_readl(pd, PRCI_COREPLLSEL_OFFSET); /* barrier */ in sifive_prci_corepllsel_use_dvfscorepll()
391 * @pd: struct __prci_data * for the PRCI containing the COREPLL mux reg
398 void sifive_prci_corepllsel_use_corepll(struct __prci_data *pd) in sifive_prci_corepllsel_use_corepll() argument
402 r = __prci_readl(pd, PRCI_COREPLLSEL_OFFSET); in sifive_prci_corepllsel_use_corepll()
404 __prci_writel(r, PRCI_COREPLLSEL_OFFSET, pd); in sifive_prci_corepllsel_use_corepll()
406 r = __prci_readl(pd, PRCI_COREPLLSEL_OFFSET); /* barrier */ in sifive_prci_corepllsel_use_corepll()
412 * @pd: struct __prci_data * for the PRCI containing the HFPCLKPLL mux reg
419 void sifive_prci_hfpclkpllsel_use_hfclk(struct __prci_data *pd) in sifive_prci_hfpclkpllsel_use_hfclk() argument
423 r = __prci_readl(pd, PRCI_HFPCLKPLLSEL_OFFSET); in sifive_prci_hfpclkpllsel_use_hfclk()
425 __prci_writel(r, PRCI_HFPCLKPLLSEL_OFFSET, pd); in sifive_prci_hfpclkpllsel_use_hfclk()
427 r = __prci_readl(pd, PRCI_HFPCLKPLLSEL_OFFSET); /* barrier */ in sifive_prci_hfpclkpllsel_use_hfclk()
433 * @pd: struct __prci_data * for the PRCI containing the HFPCLKPLL mux reg
440 void sifive_prci_hfpclkpllsel_use_hfpclkpll(struct __prci_data *pd) in sifive_prci_hfpclkpllsel_use_hfpclkpll() argument
444 r = __prci_readl(pd, PRCI_HFPCLKPLLSEL_OFFSET); in sifive_prci_hfpclkpllsel_use_hfpclkpll()
446 __prci_writel(r, PRCI_HFPCLKPLLSEL_OFFSET, pd); in sifive_prci_hfpclkpllsel_use_hfpclkpll()
448 r = __prci_readl(pd, PRCI_HFPCLKPLLSEL_OFFSET); /* barrier */ in sifive_prci_hfpclkpllsel_use_hfpclkpll()
455 struct __prci_data *pd = pc->pd; in sifive_prci_pcie_aux_clock_is_enabled() local
458 r = __prci_readl(pd, PRCI_PCIE_AUX_OFFSET); in sifive_prci_pcie_aux_clock_is_enabled()
469 struct __prci_data *pd = pc->pd; in sifive_prci_pcie_aux_clock_enable() local
475 __prci_writel(1, PRCI_PCIE_AUX_OFFSET, pd); in sifive_prci_pcie_aux_clock_enable()
476 r = __prci_readl(pd, PRCI_PCIE_AUX_OFFSET); /* barrier */ in sifive_prci_pcie_aux_clock_enable()
484 struct __prci_data *pd = pc->pd; in sifive_prci_pcie_aux_clock_disable() local
487 __prci_writel(0, PRCI_PCIE_AUX_OFFSET, pd); in sifive_prci_pcie_aux_clock_disable()
488 r = __prci_readl(pd, PRCI_PCIE_AUX_OFFSET); /* barrier */ in sifive_prci_pcie_aux_clock_disable()
495 * @pd: The pointer for PRCI per-device instance data
503 static int __prci_register_clocks(struct device *dev, struct __prci_data *pd, in __prci_register_clocks() argument
527 pic->pd = pd; in __prci_register_clocks()
530 __prci_wrpll_read_cfg0(pd, pic->pwd); in __prci_register_clocks()
539 pd->hw_clks.hws[i] = &pic->hw; in __prci_register_clocks()
542 pd->hw_clks.num = i; in __prci_register_clocks()
545 &pd->hw_clks); in __prci_register_clocks()
563 struct __prci_data *pd; in sifive_prci_probe() local
569 pd = devm_kzalloc(dev, struct_size(pd, hw_clks.hws, desc->num_clks), GFP_KERNEL); in sifive_prci_probe()
570 if (!pd) in sifive_prci_probe()
573 pd->va = devm_platform_ioremap_resource(pdev, 0); in sifive_prci_probe()
574 if (IS_ERR(pd->va)) in sifive_prci_probe()
575 return PTR_ERR(pd->va); in sifive_prci_probe()
577 pd->reset.rcdev.owner = THIS_MODULE; in sifive_prci_probe()
578 pd->reset.rcdev.nr_resets = PRCI_RST_NR; in sifive_prci_probe()
579 pd->reset.rcdev.ops = &reset_simple_ops; in sifive_prci_probe()
580 pd->reset.rcdev.of_node = pdev->dev.of_node; in sifive_prci_probe()
581 pd->reset.active_low = true; in sifive_prci_probe()
582 pd->reset.membase = pd->va + PRCI_DEVICESRESETREG_OFFSET; in sifive_prci_probe()
583 spin_lock_init(&pd->reset.lock); in sifive_prci_probe()
585 r = devm_reset_controller_register(&pdev->dev, &pd->reset.rcdev); in sifive_prci_probe()
590 r = __prci_register_clocks(dev, pd, desc); in sifive_prci_probe()