Lines Matching full:ctrl
68 const struct iproc_pll_ctrl *ctrl; member
76 const struct iproc_clk_ctrl *ctrl; member
150 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in pll_wait_for_lock() local
153 u32 val = readl(pll->status_base + ctrl->status.offset); in pll_wait_for_lock()
155 if (val & (1 << ctrl->status.shift)) in pll_wait_for_lock()
166 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in iproc_pll_write() local
170 if (unlikely(ctrl->flags & IPROC_CLK_NEEDS_READ_BACK && in iproc_pll_write()
177 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in __pll_disable() local
180 if (ctrl->flags & IPROC_CLK_PLL_ASIU) { in __pll_disable()
181 val = readl(pll->asiu_base + ctrl->asiu.offset); in __pll_disable()
182 val &= ~(1 << ctrl->asiu.en_shift); in __pll_disable()
183 iproc_pll_write(pll, pll->asiu_base, ctrl->asiu.offset, val); in __pll_disable()
186 if (ctrl->flags & IPROC_CLK_EMBED_PWRCTRL) { in __pll_disable()
187 val = readl(pll->control_base + ctrl->aon.offset); in __pll_disable()
188 val |= bit_mask(ctrl->aon.pwr_width) << ctrl->aon.pwr_shift; in __pll_disable()
189 iproc_pll_write(pll, pll->control_base, ctrl->aon.offset, val); in __pll_disable()
194 val = readl(pll->pwr_base + ctrl->aon.offset); in __pll_disable()
195 val |= 1 << ctrl->aon.iso_shift; in __pll_disable()
196 iproc_pll_write(pll, pll->pwr_base, ctrl->aon.offset, val); in __pll_disable()
199 val &= ~(bit_mask(ctrl->aon.pwr_width) << ctrl->aon.pwr_shift); in __pll_disable()
200 iproc_pll_write(pll, pll->pwr_base, ctrl->aon.offset, val); in __pll_disable()
206 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in __pll_enable() local
209 if (ctrl->flags & IPROC_CLK_EMBED_PWRCTRL) { in __pll_enable()
210 val = readl(pll->control_base + ctrl->aon.offset); in __pll_enable()
211 val &= ~(bit_mask(ctrl->aon.pwr_width) << ctrl->aon.pwr_shift); in __pll_enable()
212 iproc_pll_write(pll, pll->control_base, ctrl->aon.offset, val); in __pll_enable()
217 val = readl(pll->pwr_base + ctrl->aon.offset); in __pll_enable()
218 val |= bit_mask(ctrl->aon.pwr_width) << ctrl->aon.pwr_shift; in __pll_enable()
219 val &= ~(1 << ctrl->aon.iso_shift); in __pll_enable()
220 iproc_pll_write(pll, pll->pwr_base, ctrl->aon.offset, val); in __pll_enable()
224 if (ctrl->flags & IPROC_CLK_PLL_ASIU) { in __pll_enable()
225 val = readl(pll->asiu_base + ctrl->asiu.offset); in __pll_enable()
226 val |= (1 << ctrl->asiu.en_shift); in __pll_enable()
227 iproc_pll_write(pll, pll->asiu_base, ctrl->asiu.offset, val); in __pll_enable()
236 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in __pll_put_in_reset() local
237 const struct iproc_pll_reset_ctrl *reset = &ctrl->reset; in __pll_put_in_reset()
240 if (ctrl->flags & IPROC_CLK_PLL_RESET_ACTIVE_LOW) in __pll_put_in_reset()
251 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in __pll_bring_out_reset() local
252 const struct iproc_pll_reset_ctrl *reset = &ctrl->reset; in __pll_bring_out_reset()
253 const struct iproc_pll_dig_filter_ctrl *dig_filter = &ctrl->dig_filter; in __pll_bring_out_reset()
264 if (ctrl->flags & IPROC_CLK_PLL_RESET_ACTIVE_LOW) in __pll_bring_out_reset()
279 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in pll_fractional_change_only() local
285 val = readl(pll->status_base + ctrl->status.offset); in pll_fractional_change_only()
286 if ((val & (1 << ctrl->status.shift)) == 0) in pll_fractional_change_only()
289 val = readl(pll->control_base + ctrl->ndiv_int.offset); in pll_fractional_change_only()
290 ndiv_int = (val >> ctrl->ndiv_int.shift) & in pll_fractional_change_only()
291 bit_mask(ctrl->ndiv_int.width); in pll_fractional_change_only()
296 val = readl(pll->control_base + ctrl->pdiv.offset); in pll_fractional_change_only()
297 pdiv = (val >> ctrl->pdiv.shift) & bit_mask(ctrl->pdiv.width); in pll_fractional_change_only()
309 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in pll_set_rate() local
356 if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) { in pll_set_rate()
357 val = readl(pll->control_base + ctrl->ndiv_frac.offset); in pll_set_rate()
358 val &= ~(bit_mask(ctrl->ndiv_frac.width) << in pll_set_rate()
359 ctrl->ndiv_frac.shift); in pll_set_rate()
360 val |= vco->ndiv_frac << ctrl->ndiv_frac.shift; in pll_set_rate()
362 ctrl->ndiv_frac.offset, val); in pll_set_rate()
371 if (ctrl->flags & IPROC_CLK_PLL_USER_MODE_ON) { in pll_set_rate()
372 val = readl(pll->control_base + ctrl->macro_mode.offset); in pll_set_rate()
373 val &= ~(bit_mask(ctrl->macro_mode.width) << in pll_set_rate()
374 ctrl->macro_mode.shift); in pll_set_rate()
375 val |= PLL_USER_MODE << ctrl->macro_mode.shift; in pll_set_rate()
377 ctrl->macro_mode.offset, val); in pll_set_rate()
380 iproc_pll_write(pll, pll->control_base, ctrl->vco_ctrl.u_offset, 0); in pll_set_rate()
382 val = readl(pll->control_base + ctrl->vco_ctrl.l_offset); in pll_set_rate()
392 iproc_pll_write(pll, pll->control_base, ctrl->vco_ctrl.l_offset, val); in pll_set_rate()
395 val = readl(pll->control_base + ctrl->ndiv_int.offset); in pll_set_rate()
396 val &= ~(bit_mask(ctrl->ndiv_int.width) << ctrl->ndiv_int.shift); in pll_set_rate()
397 val |= vco->ndiv_int << ctrl->ndiv_int.shift; in pll_set_rate()
398 iproc_pll_write(pll, pll->control_base, ctrl->ndiv_int.offset, val); in pll_set_rate()
401 if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) { in pll_set_rate()
402 val = readl(pll->control_base + ctrl->ndiv_frac.offset); in pll_set_rate()
403 val &= ~(bit_mask(ctrl->ndiv_frac.width) << in pll_set_rate()
404 ctrl->ndiv_frac.shift); in pll_set_rate()
405 val |= vco->ndiv_frac << ctrl->ndiv_frac.shift; in pll_set_rate()
406 iproc_pll_write(pll, pll->control_base, ctrl->ndiv_frac.offset, in pll_set_rate()
411 val = readl(pll->control_base + ctrl->pdiv.offset); in pll_set_rate()
412 val &= ~(bit_mask(ctrl->pdiv.width) << ctrl->pdiv.shift); in pll_set_rate()
413 val |= vco->pdiv << ctrl->pdiv.shift; in pll_set_rate()
414 iproc_pll_write(pll, pll->control_base, ctrl->pdiv.offset, val); in pll_set_rate()
439 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in iproc_pll_disable() local
441 if (ctrl->flags & IPROC_CLK_AON) in iproc_pll_disable()
452 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in iproc_pll_recalc_rate() local
462 val = readl(pll->status_base + ctrl->status.offset); in iproc_pll_recalc_rate()
463 if ((val & (1 << ctrl->status.shift)) == 0) in iproc_pll_recalc_rate()
471 val = readl(pll->control_base + ctrl->ndiv_int.offset); in iproc_pll_recalc_rate()
472 ndiv_int = (val >> ctrl->ndiv_int.shift) & in iproc_pll_recalc_rate()
473 bit_mask(ctrl->ndiv_int.width); in iproc_pll_recalc_rate()
476 if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) { in iproc_pll_recalc_rate()
477 val = readl(pll->control_base + ctrl->ndiv_frac.offset); in iproc_pll_recalc_rate()
478 ndiv_frac = (val >> ctrl->ndiv_frac.shift) & in iproc_pll_recalc_rate()
479 bit_mask(ctrl->ndiv_frac.width); in iproc_pll_recalc_rate()
483 val = readl(pll->control_base + ctrl->pdiv.offset); in iproc_pll_recalc_rate()
484 pdiv = (val >> ctrl->pdiv.shift) & bit_mask(ctrl->pdiv.width); in iproc_pll_recalc_rate()
502 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in iproc_pll_determine_rate() local
510 if (ctrl->flags & IPROC_CLK_PLL_CALC_PARAM) { in iproc_pll_determine_rate()
547 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in iproc_pll_set_rate() local
551 if (ctrl->flags & IPROC_CLK_PLL_CALC_PARAM) { in iproc_pll_set_rate()
578 const struct iproc_clk_ctrl *ctrl = clk->ctrl; in iproc_clk_enable() local
583 val = readl(pll->control_base + ctrl->enable.offset); in iproc_clk_enable()
584 val &= ~(1 << ctrl->enable.enable_shift); in iproc_clk_enable()
585 iproc_pll_write(pll, pll->control_base, ctrl->enable.offset, val); in iproc_clk_enable()
588 val = readl(pll->control_base + ctrl->enable.offset); in iproc_clk_enable()
589 val &= ~(1 << ctrl->enable.hold_shift); in iproc_clk_enable()
590 iproc_pll_write(pll, pll->control_base, ctrl->enable.offset, val); in iproc_clk_enable()
598 const struct iproc_clk_ctrl *ctrl = clk->ctrl; in iproc_clk_disable() local
602 if (ctrl->flags & IPROC_CLK_AON) in iproc_clk_disable()
605 val = readl(pll->control_base + ctrl->enable.offset); in iproc_clk_disable()
606 val |= 1 << ctrl->enable.enable_shift; in iproc_clk_disable()
607 iproc_pll_write(pll, pll->control_base, ctrl->enable.offset, val); in iproc_clk_disable()
614 const struct iproc_clk_ctrl *ctrl = clk->ctrl; in iproc_clk_recalc_rate() local
623 val = readl(pll->control_base + ctrl->mdiv.offset); in iproc_clk_recalc_rate()
624 mdiv = (val >> ctrl->mdiv.shift) & bit_mask(ctrl->mdiv.width); in iproc_clk_recalc_rate()
628 if (ctrl->flags & IPROC_CLK_MCLK_DIV_BY_2) in iproc_clk_recalc_rate()
662 const struct iproc_clk_ctrl *ctrl = clk->ctrl; in iproc_clk_set_rate() local
671 if (ctrl->flags & IPROC_CLK_MCLK_DIV_BY_2) in iproc_clk_set_rate()
677 val = readl(pll->control_base + ctrl->mdiv.offset); in iproc_clk_set_rate()
679 val &= ~(bit_mask(ctrl->mdiv.width) << ctrl->mdiv.shift); in iproc_clk_set_rate()
681 val &= ~(bit_mask(ctrl->mdiv.width) << ctrl->mdiv.shift); in iproc_clk_set_rate()
682 val |= div << ctrl->mdiv.shift; in iproc_clk_set_rate()
684 iproc_pll_write(pll, pll->control_base, ctrl->mdiv.offset, val); in iproc_clk_set_rate()
703 const struct iproc_pll_ctrl *ctrl = pll->ctrl; in iproc_pll_sw_cfg() local
705 if (ctrl->flags & IPROC_CLK_PLL_NEEDS_SW_CFG) { in iproc_pll_sw_cfg()
708 val = readl(pll->control_base + ctrl->sw_ctrl.offset); in iproc_pll_sw_cfg()
709 val |= BIT(ctrl->sw_ctrl.shift); in iproc_pll_sw_cfg()
710 iproc_pll_write(pll, pll->control_base, ctrl->sw_ctrl.offset, in iproc_pll_sw_cfg()
772 pll->ctrl = pll_ctrl; in iproc_pll_clk_setup()
815 iclk->ctrl = &clk_ctrl[i]; in iproc_pll_clk_setup()