Lines Matching refs:lpsc

108 static void davinci_lpsc_config(struct davinci_lpsc_clk *lpsc,  in davinci_lpsc_config()  argument
113 regmap_write_bits(lpsc->regmap, MDCTL(lpsc->md), MDSTAT_STATE_MASK, in davinci_lpsc_config()
116 if (lpsc->flags & LPSC_FORCE) in davinci_lpsc_config()
117 regmap_write_bits(lpsc->regmap, MDCTL(lpsc->md), MDCTL_FORCE, in davinci_lpsc_config()
120 regmap_read(lpsc->regmap, PDSTAT(lpsc->pd), &pdstat); in davinci_lpsc_config()
122 regmap_write_bits(lpsc->regmap, PDCTL(lpsc->pd), PDCTL_NEXT, in davinci_lpsc_config()
125 regmap_write(lpsc->regmap, PTCMD, BIT(lpsc->pd)); in davinci_lpsc_config()
127 regmap_read_poll_timeout(lpsc->regmap, EPCPR, epcpr, in davinci_lpsc_config()
128 epcpr & BIT(lpsc->pd), 0, 0); in davinci_lpsc_config()
130 regmap_write_bits(lpsc->regmap, PDCTL(lpsc->pd), PDCTL_EPCGOOD, in davinci_lpsc_config()
133 regmap_write(lpsc->regmap, PTCMD, BIT(lpsc->pd)); in davinci_lpsc_config()
136 regmap_read_poll_timeout(lpsc->regmap, PTSTAT, ptstat, in davinci_lpsc_config()
137 !(ptstat & BIT(lpsc->pd)), 0, 0); in davinci_lpsc_config()
139 regmap_read_poll_timeout(lpsc->regmap, MDSTAT(lpsc->md), mdstat, in davinci_lpsc_config()
146 struct davinci_lpsc_clk *lpsc = to_davinci_lpsc_clk(hw); in davinci_lpsc_clk_enable() local
148 davinci_lpsc_config(lpsc, LPSC_STATE_ENABLE); in davinci_lpsc_clk_enable()
155 struct davinci_lpsc_clk *lpsc = to_davinci_lpsc_clk(hw); in davinci_lpsc_clk_disable() local
157 davinci_lpsc_config(lpsc, LPSC_STATE_DISABLE); in davinci_lpsc_clk_disable()
162 struct davinci_lpsc_clk *lpsc = to_davinci_lpsc_clk(hw); in davinci_lpsc_clk_is_enabled() local
165 regmap_read(lpsc->regmap, MDSTAT(lpsc->md), &mdstat); in davinci_lpsc_clk_is_enabled()
179 struct davinci_lpsc_clk *lpsc = to_davinci_lpsc_clk(pm_domain); in davinci_psc_genpd_attach_dev() local
187 clk = clk_get_sys(best_dev_name(lpsc->dev), clk_hw_get_name(&lpsc->hw)); in davinci_psc_genpd_attach_dev()
199 lpsc->genpd_clk = clk; in davinci_psc_genpd_attach_dev()
214 struct davinci_lpsc_clk *lpsc = to_davinci_lpsc_clk(pm_domain); in davinci_psc_genpd_detach_dev() local
216 pm_clk_remove_clk(dev, lpsc->genpd_clk); in davinci_psc_genpd_detach_dev()
219 lpsc->genpd_clk = NULL; in davinci_psc_genpd_detach_dev()
238 struct davinci_lpsc_clk *lpsc; in davinci_lpsc_clk_register() local
242 lpsc = kzalloc(sizeof(*lpsc), GFP_KERNEL); in davinci_lpsc_clk_register()
243 if (!lpsc) in davinci_lpsc_clk_register()
258 lpsc->dev = dev; in davinci_lpsc_clk_register()
259 lpsc->regmap = regmap; in davinci_lpsc_clk_register()
260 lpsc->hw.init = &init; in davinci_lpsc_clk_register()
261 lpsc->md = md; in davinci_lpsc_clk_register()
262 lpsc->pd = pd; in davinci_lpsc_clk_register()
263 lpsc->flags = flags; in davinci_lpsc_clk_register()
265 ret = clk_hw_register(dev, &lpsc->hw); in davinci_lpsc_clk_register()
267 kfree(lpsc); in davinci_lpsc_clk_register()
273 return lpsc; in davinci_lpsc_clk_register()
276 ret = clk_hw_register_clkdev(&lpsc->hw, name, best_dev_name(dev)); in davinci_lpsc_clk_register()
278 lpsc->pm_domain.name = devm_kasprintf(dev, GFP_KERNEL, "%s: %s", in davinci_lpsc_clk_register()
280 lpsc->pm_domain.attach_dev = davinci_psc_genpd_attach_dev; in davinci_lpsc_clk_register()
281 lpsc->pm_domain.detach_dev = davinci_psc_genpd_detach_dev; in davinci_lpsc_clk_register()
282 lpsc->pm_domain.flags = GENPD_FLAG_PM_CLK; in davinci_lpsc_clk_register()
284 is_on = davinci_lpsc_clk_is_enabled(&lpsc->hw); in davinci_lpsc_clk_register()
285 pm_genpd_init(&lpsc->pm_domain, NULL, is_on); in davinci_lpsc_clk_register()
287 return lpsc; in davinci_lpsc_clk_register()
293 struct davinci_lpsc_clk *lpsc = to_davinci_lpsc_clk(hw); in davinci_lpsc_clk_reset() local
296 if (IS_ERR_OR_NULL(lpsc)) in davinci_lpsc_clk_reset()
300 regmap_write_bits(lpsc->regmap, MDCTL(lpsc->md), MDCTL_LRESET, mdctl); in davinci_lpsc_clk_reset()
334 struct davinci_lpsc_clk *lpsc; in davinci_psc_reset_of_xlate() local
342 lpsc = to_davinci_lpsc_clk(hw); in davinci_psc_reset_of_xlate()
346 if (!(lpsc->flags & LPSC_LOCAL_RESET)) in davinci_psc_reset_of_xlate()
349 return lpsc->md; in davinci_psc_reset_of_xlate()
406 struct davinci_lpsc_clk *lpsc; in __davinci_psc_register_clocks() local
408 lpsc = davinci_lpsc_clk_register(dev, info->name, info->parent, in __davinci_psc_register_clocks()
411 if (IS_ERR(lpsc)) { in __davinci_psc_register_clocks()
413 info->name, PTR_ERR(lpsc)); in __davinci_psc_register_clocks()
417 clks[info->md] = lpsc->hw.clk; in __davinci_psc_register_clocks()
418 pm_domains[info->md] = &lpsc->pm_domain; in __davinci_psc_register_clocks()