Lines Matching refs:fd
255 struct xgene_clk_pmd *fd = to_xgene_clk_pmd(hw); in xgene_clk_pmd_recalc_rate() local
260 if (fd->lock) in xgene_clk_pmd_recalc_rate()
261 spin_lock_irqsave(fd->lock, flags); in xgene_clk_pmd_recalc_rate()
263 __acquire(fd->lock); in xgene_clk_pmd_recalc_rate()
265 val = clk_readl(fd->reg); in xgene_clk_pmd_recalc_rate()
267 if (fd->lock) in xgene_clk_pmd_recalc_rate()
268 spin_unlock_irqrestore(fd->lock, flags); in xgene_clk_pmd_recalc_rate()
270 __release(fd->lock); in xgene_clk_pmd_recalc_rate()
274 scale = (val & fd->mask) >> fd->shift; in xgene_clk_pmd_recalc_rate()
275 if (fd->flags & XGENE_CLK_PMD_SCALE_INVERTED) in xgene_clk_pmd_recalc_rate()
276 scale = fd->denom - scale; in xgene_clk_pmd_recalc_rate()
281 do_div(ret, fd->denom); in xgene_clk_pmd_recalc_rate()
292 struct xgene_clk_pmd *fd = to_xgene_clk_pmd(hw); in xgene_clk_pmd_round_rate() local
299 ret = rate * fd->denom; in xgene_clk_pmd_round_rate()
303 do_div(ret, fd->denom); in xgene_clk_pmd_round_rate()
311 struct xgene_clk_pmd *fd = to_xgene_clk_pmd(hw); in xgene_clk_pmd_set_rate() local
322 ret = rate * fd->denom; in xgene_clk_pmd_set_rate()
326 if (fd->flags & XGENE_CLK_PMD_SCALE_INVERTED) in xgene_clk_pmd_set_rate()
327 scale = fd->denom - scale; in xgene_clk_pmd_set_rate()
331 if (fd->lock) in xgene_clk_pmd_set_rate()
332 spin_lock_irqsave(fd->lock, flags); in xgene_clk_pmd_set_rate()
334 __acquire(fd->lock); in xgene_clk_pmd_set_rate()
336 val = clk_readl(fd->reg); in xgene_clk_pmd_set_rate()
337 val &= ~fd->mask; in xgene_clk_pmd_set_rate()
338 val |= (scale << fd->shift); in xgene_clk_pmd_set_rate()
339 clk_writel(val, fd->reg); in xgene_clk_pmd_set_rate()
341 if (fd->lock) in xgene_clk_pmd_set_rate()
342 spin_unlock_irqrestore(fd->lock, flags); in xgene_clk_pmd_set_rate()
344 __release(fd->lock); in xgene_clk_pmd_set_rate()
361 struct xgene_clk_pmd *fd; in xgene_register_clk_pmd() local
365 fd = kzalloc(sizeof(*fd), GFP_KERNEL); in xgene_register_clk_pmd()
366 if (!fd) in xgene_register_clk_pmd()
375 fd->reg = reg; in xgene_register_clk_pmd()
376 fd->shift = shift; in xgene_register_clk_pmd()
377 fd->mask = (BIT(width) - 1) << shift; in xgene_register_clk_pmd()
378 fd->denom = denom; in xgene_register_clk_pmd()
379 fd->flags = clk_flags; in xgene_register_clk_pmd()
380 fd->lock = lock; in xgene_register_clk_pmd()
381 fd->hw.init = &init; in xgene_register_clk_pmd()
383 clk = clk_register(dev, &fd->hw); in xgene_register_clk_pmd()
386 kfree(fd); in xgene_register_clk_pmd()