Lines Matching refs:gate

356 __is_clk_gate_enabled(struct ccu_data *ccu, struct bcm_clk_gate *gate)  in __is_clk_gate_enabled()  argument
362 if (!gate_exists(gate)) in __is_clk_gate_enabled()
365 bit_mask = 1 << gate->status_bit; in __is_clk_gate_enabled()
366 reg_val = __ccu_read(ccu, gate->offset); in __is_clk_gate_enabled()
373 is_clk_gate_enabled(struct ccu_data *ccu, struct bcm_clk_gate *gate) in is_clk_gate_enabled() argument
379 if (!gate_exists(gate)) in is_clk_gate_enabled()
383 ret = __is_clk_gate_enabled(ccu, gate); in is_clk_gate_enabled()
394 __gate_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate) in __gate_commit() argument
400 BUG_ON(!gate_exists(gate)); in __gate_commit()
401 if (!gate_is_sw_controllable(gate)) in __gate_commit()
404 reg_val = __ccu_read(ccu, gate->offset); in __gate_commit()
407 if (gate_is_hw_controllable(gate)) { in __gate_commit()
408 mask = (u32)1 << gate->hw_sw_sel_bit; in __gate_commit()
409 if (gate_is_sw_managed(gate)) in __gate_commit()
422 mask = (u32)1 << gate->en_bit; in __gate_commit()
423 if (gate_is_sw_managed(gate) && (enabled = gate_is_enabled(gate)) && in __gate_commit()
424 !gate_is_no_disable(gate)) in __gate_commit()
429 __ccu_write(ccu, gate->offset, reg_val); in __gate_commit()
432 if (!gate_is_sw_managed(gate)) in __gate_commit()
436 return __ccu_wait_bit(ccu, gate->offset, gate->status_bit, enabled); in __gate_commit()
445 static bool gate_init(struct ccu_data *ccu, struct bcm_clk_gate *gate) in gate_init() argument
447 if (!gate_exists(gate)) in gate_init()
449 return __gate_commit(ccu, gate); in gate_init()
459 __clk_gate(struct ccu_data *ccu, struct bcm_clk_gate *gate, bool enable) in __clk_gate() argument
463 if (!gate_exists(gate) || !gate_is_sw_managed(gate)) in __clk_gate()
466 if (!enable && gate_is_no_disable(gate)) { in __clk_gate()
472 if (enable == gate_is_enabled(gate)) in __clk_gate()
475 gate_flip_enabled(gate); in __clk_gate()
476 ret = __gate_commit(ccu, gate); in __clk_gate()
478 gate_flip_enabled(gate); /* Revert the change */ in __clk_gate()
485 struct bcm_clk_gate *gate, bool enable) in clk_gate() argument
494 if (!gate_exists(gate) || !gate_is_sw_managed(gate)) in clk_gate()
496 if (!enable && gate_is_no_disable(gate)) in clk_gate()
502 success = __clk_gate(ccu, gate, enable); in clk_gate()
589 static int __div_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate, in __div_commit() argument
617 enabled = __is_clk_gate_enabled(ccu, gate); in __div_commit()
618 if (!enabled && !__clk_gate(ccu, gate, true)) { in __div_commit()
634 if (!enabled && !__clk_gate(ccu, gate, false)) in __div_commit()
645 static bool div_init(struct ccu_data *ccu, struct bcm_clk_gate *gate, in div_init() argument
650 return !__div_commit(ccu, gate, div, trig); in div_init()
653 static int divider_write(struct ccu_data *ccu, struct bcm_clk_gate *gate, in divider_write() argument
672 ret = __div_commit(ccu, gate, div, trig); in divider_write()
872 __sel_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate, in __sel_commit() argument
904 enabled = __is_clk_gate_enabled(ccu, gate); in __sel_commit()
905 if (!enabled && !__clk_gate(ccu, gate, true)) in __sel_commit()
918 if (!enabled && !__clk_gate(ccu, gate, false)) in __sel_commit()
929 static bool sel_init(struct ccu_data *ccu, struct bcm_clk_gate *gate, in sel_init() argument
934 return !__sel_commit(ccu, gate, sel, trig); in sel_init()
942 static int selector_write(struct ccu_data *ccu, struct bcm_clk_gate *gate, in selector_write() argument
959 ret = __sel_commit(ccu, gate, sel, trig); in selector_write()
975 struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate; in kona_peri_clk_enable() local
977 return clk_gate(bcm_clk->ccu, bcm_clk->init_data.name, gate, true); in kona_peri_clk_enable()
983 struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate; in kona_peri_clk_disable() local
985 (void)clk_gate(bcm_clk->ccu, bcm_clk->init_data.name, gate, false); in kona_peri_clk_disable()
991 struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate; in kona_peri_clk_is_enabled() local
993 return is_clk_gate_enabled(bcm_clk->ccu, gate) ? 1 : 0; in kona_peri_clk_is_enabled()
1095 ret = selector_write(bcm_clk->ccu, &data->gate, sel, trig, index); in kona_peri_clk_set_parent()
1159 ret = divider_write(bcm_clk->ccu, &data->gate, &data->div, in kona_peri_clk_set_rate()
1199 if (!gate_init(ccu, &peri->gate)) { in __peri_clk_init()
1207 if (!div_init(ccu, &peri->gate, &peri->div, &peri->trig)) { in __peri_clk_init()
1220 if (!div_init(ccu, &peri->gate, &peri->pre_div, trig)) { in __peri_clk_init()
1226 if (!sel_init(ccu, &peri->gate, &peri->sel, trig)) { in __peri_clk_init()