Lines Matching refs:gate

357 __is_clk_gate_enabled(struct ccu_data *ccu, struct bcm_clk_gate *gate)  in __is_clk_gate_enabled()  argument
363 if (!gate_exists(gate)) in __is_clk_gate_enabled()
366 bit_mask = 1 << gate->status_bit; in __is_clk_gate_enabled()
367 reg_val = __ccu_read(ccu, gate->offset); in __is_clk_gate_enabled()
374 is_clk_gate_enabled(struct ccu_data *ccu, struct bcm_clk_gate *gate) in is_clk_gate_enabled() argument
380 if (!gate_exists(gate)) in is_clk_gate_enabled()
384 ret = __is_clk_gate_enabled(ccu, gate); in is_clk_gate_enabled()
395 __gate_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate) in __gate_commit() argument
401 BUG_ON(!gate_exists(gate)); in __gate_commit()
402 if (!gate_is_sw_controllable(gate)) in __gate_commit()
405 reg_val = __ccu_read(ccu, gate->offset); in __gate_commit()
408 if (gate_is_hw_controllable(gate)) { in __gate_commit()
409 mask = (u32)1 << gate->hw_sw_sel_bit; in __gate_commit()
410 if (gate_is_sw_managed(gate)) in __gate_commit()
423 mask = (u32)1 << gate->en_bit; in __gate_commit()
424 if (gate_is_sw_managed(gate) && (enabled = gate_is_enabled(gate)) && in __gate_commit()
425 !gate_is_no_disable(gate)) in __gate_commit()
430 __ccu_write(ccu, gate->offset, reg_val); in __gate_commit()
433 if (!gate_is_sw_managed(gate)) in __gate_commit()
437 return __ccu_wait_bit(ccu, gate->offset, gate->status_bit, enabled); in __gate_commit()
446 static bool gate_init(struct ccu_data *ccu, struct bcm_clk_gate *gate) in gate_init() argument
448 if (!gate_exists(gate)) in gate_init()
450 return __gate_commit(ccu, gate); in gate_init()
460 __clk_gate(struct ccu_data *ccu, struct bcm_clk_gate *gate, bool enable) in __clk_gate() argument
464 if (!gate_exists(gate) || !gate_is_sw_managed(gate)) in __clk_gate()
467 if (!enable && gate_is_no_disable(gate)) { in __clk_gate()
473 if (enable == gate_is_enabled(gate)) in __clk_gate()
476 gate_flip_enabled(gate); in __clk_gate()
477 ret = __gate_commit(ccu, gate); in __clk_gate()
479 gate_flip_enabled(gate); /* Revert the change */ in __clk_gate()
486 struct bcm_clk_gate *gate, bool enable) in clk_gate() argument
495 if (!gate_exists(gate) || !gate_is_sw_managed(gate)) in clk_gate()
497 if (!enable && gate_is_no_disable(gate)) in clk_gate()
503 success = __clk_gate(ccu, gate, enable); in clk_gate()
590 static int __div_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate, in __div_commit() argument
618 enabled = __is_clk_gate_enabled(ccu, gate); in __div_commit()
619 if (!enabled && !__clk_gate(ccu, gate, true)) { in __div_commit()
635 if (!enabled && !__clk_gate(ccu, gate, false)) in __div_commit()
646 static bool div_init(struct ccu_data *ccu, struct bcm_clk_gate *gate, in div_init() argument
651 return !__div_commit(ccu, gate, div, trig); in div_init()
654 static int divider_write(struct ccu_data *ccu, struct bcm_clk_gate *gate, in divider_write() argument
673 ret = __div_commit(ccu, gate, div, trig); in divider_write()
873 __sel_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate, in __sel_commit() argument
905 enabled = __is_clk_gate_enabled(ccu, gate); in __sel_commit()
906 if (!enabled && !__clk_gate(ccu, gate, true)) in __sel_commit()
919 if (!enabled && !__clk_gate(ccu, gate, false)) in __sel_commit()
930 static bool sel_init(struct ccu_data *ccu, struct bcm_clk_gate *gate, in sel_init() argument
935 return !__sel_commit(ccu, gate, sel, trig); in sel_init()
943 static int selector_write(struct ccu_data *ccu, struct bcm_clk_gate *gate, in selector_write() argument
960 ret = __sel_commit(ccu, gate, sel, trig); in selector_write()
976 struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate; in kona_peri_clk_enable() local
978 return clk_gate(bcm_clk->ccu, bcm_clk->init_data.name, gate, true); in kona_peri_clk_enable()
984 struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate; in kona_peri_clk_disable() local
986 (void)clk_gate(bcm_clk->ccu, bcm_clk->init_data.name, gate, false); in kona_peri_clk_disable()
992 struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate; in kona_peri_clk_is_enabled() local
994 return is_clk_gate_enabled(bcm_clk->ccu, gate) ? 1 : 0; in kona_peri_clk_is_enabled()
1103 ret = selector_write(bcm_clk->ccu, &data->gate, sel, trig, index); in kona_peri_clk_set_parent()
1167 ret = divider_write(bcm_clk->ccu, &data->gate, &data->div, in kona_peri_clk_set_rate()
1207 if (!gate_init(ccu, &peri->gate)) { in __peri_clk_init()
1215 if (!div_init(ccu, &peri->gate, &peri->div, &peri->trig)) { in __peri_clk_init()
1228 if (!div_init(ccu, &peri->gate, &peri->pre_div, trig)) { in __peri_clk_init()
1234 if (!sel_init(ccu, &peri->gate, &peri->sel, trig)) { in __peri_clk_init()