Lines Matching refs:osc
70 struct clk_slow_osc *osc = to_clk_slow_osc(hw); in clk_slow_osc_prepare() local
71 void __iomem *sckcr = osc->sckcr; in clk_slow_osc_prepare()
74 if (tmp & (osc->bits->cr_osc32byp | osc->bits->cr_osc32en)) in clk_slow_osc_prepare()
77 writel(tmp | osc->bits->cr_osc32en, sckcr); in clk_slow_osc_prepare()
80 udelay(osc->startup_usec); in clk_slow_osc_prepare()
82 usleep_range(osc->startup_usec, osc->startup_usec + 1); in clk_slow_osc_prepare()
89 struct clk_slow_osc *osc = to_clk_slow_osc(hw); in clk_slow_osc_unprepare() local
90 void __iomem *sckcr = osc->sckcr; in clk_slow_osc_unprepare()
93 if (tmp & osc->bits->cr_osc32byp) in clk_slow_osc_unprepare()
96 writel(tmp & ~osc->bits->cr_osc32en, sckcr); in clk_slow_osc_unprepare()
101 struct clk_slow_osc *osc = to_clk_slow_osc(hw); in clk_slow_osc_is_prepared() local
102 void __iomem *sckcr = osc->sckcr; in clk_slow_osc_is_prepared()
105 if (tmp & osc->bits->cr_osc32byp) in clk_slow_osc_is_prepared()
108 return !!(tmp & osc->bits->cr_osc32en); in clk_slow_osc_is_prepared()
125 struct clk_slow_osc *osc; in at91_clk_register_slow_osc() local
133 osc = kzalloc(sizeof(*osc), GFP_KERNEL); in at91_clk_register_slow_osc()
134 if (!osc) in at91_clk_register_slow_osc()
143 osc->hw.init = &init; in at91_clk_register_slow_osc()
144 osc->sckcr = sckcr; in at91_clk_register_slow_osc()
145 osc->startup_usec = startup; in at91_clk_register_slow_osc()
146 osc->bits = bits; in at91_clk_register_slow_osc()
149 writel((readl(sckcr) & ~osc->bits->cr_osc32en) | in at91_clk_register_slow_osc()
150 osc->bits->cr_osc32byp, sckcr); in at91_clk_register_slow_osc()
152 hw = &osc->hw; in at91_clk_register_slow_osc()
153 ret = clk_hw_register(NULL, &osc->hw); in at91_clk_register_slow_osc()
155 kfree(osc); in at91_clk_register_slow_osc()
164 struct clk_slow_osc *osc = to_clk_slow_osc(hw); in at91_clk_unregister_slow_osc() local
167 kfree(osc); in at91_clk_unregister_slow_osc()
173 struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw); in clk_slow_rc_osc_recalc_rate() local
175 return osc->frequency; in clk_slow_rc_osc_recalc_rate()
181 struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw); in clk_slow_rc_osc_recalc_accuracy() local
183 return osc->accuracy; in clk_slow_rc_osc_recalc_accuracy()
188 struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw); in clk_slow_rc_osc_prepare() local
189 void __iomem *sckcr = osc->sckcr; in clk_slow_rc_osc_prepare()
191 writel(readl(sckcr) | osc->bits->cr_rcen, sckcr); in clk_slow_rc_osc_prepare()
194 udelay(osc->startup_usec); in clk_slow_rc_osc_prepare()
196 usleep_range(osc->startup_usec, osc->startup_usec + 1); in clk_slow_rc_osc_prepare()
203 struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw); in clk_slow_rc_osc_unprepare() local
204 void __iomem *sckcr = osc->sckcr; in clk_slow_rc_osc_unprepare()
206 writel(readl(sckcr) & ~osc->bits->cr_rcen, sckcr); in clk_slow_rc_osc_unprepare()
211 struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw); in clk_slow_rc_osc_is_prepared() local
213 return !!(readl(osc->sckcr) & osc->bits->cr_rcen); in clk_slow_rc_osc_is_prepared()
232 struct clk_slow_rc_osc *osc; in at91_clk_register_slow_rc_osc() local
240 osc = kzalloc(sizeof(*osc), GFP_KERNEL); in at91_clk_register_slow_rc_osc()
241 if (!osc) in at91_clk_register_slow_rc_osc()
250 osc->hw.init = &init; in at91_clk_register_slow_rc_osc()
251 osc->sckcr = sckcr; in at91_clk_register_slow_rc_osc()
252 osc->bits = bits; in at91_clk_register_slow_rc_osc()
253 osc->frequency = frequency; in at91_clk_register_slow_rc_osc()
254 osc->accuracy = accuracy; in at91_clk_register_slow_rc_osc()
255 osc->startup_usec = startup; in at91_clk_register_slow_rc_osc()
257 hw = &osc->hw; in at91_clk_register_slow_rc_osc()
258 ret = clk_hw_register(NULL, &osc->hw); in at91_clk_register_slow_rc_osc()
260 kfree(osc); in at91_clk_register_slow_rc_osc()
269 struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw); in at91_clk_unregister_slow_rc_osc() local
272 kfree(osc); in at91_clk_unregister_slow_rc_osc()
545 struct clk_sama5d4_slow_osc *osc = to_clk_sama5d4_slow_osc(hw); in clk_sama5d4_slow_osc_prepare() local
547 if (osc->prepared) in clk_sama5d4_slow_osc_prepare()
554 if ((readl(osc->sckcr) & osc->bits->cr_oscsel)) { in clk_sama5d4_slow_osc_prepare()
555 osc->prepared = true; in clk_sama5d4_slow_osc_prepare()
560 udelay(osc->startup_usec); in clk_sama5d4_slow_osc_prepare()
562 usleep_range(osc->startup_usec, osc->startup_usec + 1); in clk_sama5d4_slow_osc_prepare()
563 osc->prepared = true; in clk_sama5d4_slow_osc_prepare()
570 struct clk_sama5d4_slow_osc *osc = to_clk_sama5d4_slow_osc(hw); in clk_sama5d4_slow_osc_is_prepared() local
572 return osc->prepared; in clk_sama5d4_slow_osc_is_prepared()
588 struct clk_sama5d4_slow_osc *osc; in of_sama5d4_sckc_setup() local
612 osc = kzalloc(sizeof(*osc), GFP_KERNEL); in of_sama5d4_sckc_setup()
613 if (!osc) in of_sama5d4_sckc_setup()
622 osc->hw.init = &init; in of_sama5d4_sckc_setup()
623 osc->sckcr = regbase; in of_sama5d4_sckc_setup()
624 osc->startup_usec = 1200000; in of_sama5d4_sckc_setup()
625 osc->bits = &at91sama5d4_bits; in of_sama5d4_sckc_setup()
627 ret = clk_hw_register(NULL, &osc->hw); in of_sama5d4_sckc_setup()
632 parent_hws[1] = &osc->hw; in of_sama5d4_sckc_setup()
648 clk_hw_unregister(&osc->hw); in of_sama5d4_sckc_setup()
650 kfree(osc); in of_sama5d4_sckc_setup()