• Home
  • Raw
  • Download

Lines Matching refs:gate

358 __is_clk_gate_enabled(struct ccu_data *ccu, struct bcm_clk_gate *gate)  in __is_clk_gate_enabled()  argument
364 if (!gate_exists(gate)) in __is_clk_gate_enabled()
367 bit_mask = 1 << gate->status_bit; in __is_clk_gate_enabled()
368 reg_val = __ccu_read(ccu, gate->offset); in __is_clk_gate_enabled()
375 is_clk_gate_enabled(struct ccu_data *ccu, struct bcm_clk_gate *gate) in is_clk_gate_enabled() argument
381 if (!gate_exists(gate)) in is_clk_gate_enabled()
385 ret = __is_clk_gate_enabled(ccu, gate); in is_clk_gate_enabled()
396 __gate_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate) in __gate_commit() argument
402 BUG_ON(!gate_exists(gate)); in __gate_commit()
403 if (!gate_is_sw_controllable(gate)) in __gate_commit()
406 reg_val = __ccu_read(ccu, gate->offset); in __gate_commit()
409 if (gate_is_hw_controllable(gate)) { in __gate_commit()
410 mask = (u32)1 << gate->hw_sw_sel_bit; in __gate_commit()
411 if (gate_is_sw_managed(gate)) in __gate_commit()
424 mask = (u32)1 << gate->en_bit; in __gate_commit()
425 if (gate_is_sw_managed(gate) && (enabled = gate_is_enabled(gate)) && in __gate_commit()
426 !gate_is_no_disable(gate)) in __gate_commit()
431 __ccu_write(ccu, gate->offset, reg_val); in __gate_commit()
434 if (!gate_is_sw_managed(gate)) in __gate_commit()
438 return __ccu_wait_bit(ccu, gate->offset, gate->status_bit, enabled); in __gate_commit()
447 static bool gate_init(struct ccu_data *ccu, struct bcm_clk_gate *gate) in gate_init() argument
449 if (!gate_exists(gate)) in gate_init()
451 return __gate_commit(ccu, gate); in gate_init()
461 __clk_gate(struct ccu_data *ccu, struct bcm_clk_gate *gate, bool enable) in __clk_gate() argument
465 if (!gate_exists(gate) || !gate_is_sw_managed(gate)) in __clk_gate()
468 if (!enable && gate_is_no_disable(gate)) { in __clk_gate()
474 if (enable == gate_is_enabled(gate)) in __clk_gate()
477 gate_flip_enabled(gate); in __clk_gate()
478 ret = __gate_commit(ccu, gate); in __clk_gate()
480 gate_flip_enabled(gate); /* Revert the change */ in __clk_gate()
487 struct bcm_clk_gate *gate, bool enable) in clk_gate() argument
496 if (!gate_exists(gate) || !gate_is_sw_managed(gate)) in clk_gate()
498 if (!enable && gate_is_no_disable(gate)) in clk_gate()
504 success = __clk_gate(ccu, gate, enable); in clk_gate()
591 static int __div_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate, in __div_commit() argument
619 enabled = __is_clk_gate_enabled(ccu, gate); in __div_commit()
620 if (!enabled && !__clk_gate(ccu, gate, true)) { in __div_commit()
636 if (!enabled && !__clk_gate(ccu, gate, false)) in __div_commit()
647 static bool div_init(struct ccu_data *ccu, struct bcm_clk_gate *gate, in div_init() argument
652 return !__div_commit(ccu, gate, div, trig); in div_init()
655 static int divider_write(struct ccu_data *ccu, struct bcm_clk_gate *gate, in divider_write() argument
674 ret = __div_commit(ccu, gate, div, trig); in divider_write()
874 __sel_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate, in __sel_commit() argument
906 enabled = __is_clk_gate_enabled(ccu, gate); in __sel_commit()
907 if (!enabled && !__clk_gate(ccu, gate, true)) in __sel_commit()
920 if (!enabled && !__clk_gate(ccu, gate, false)) in __sel_commit()
931 static bool sel_init(struct ccu_data *ccu, struct bcm_clk_gate *gate, in sel_init() argument
936 return !__sel_commit(ccu, gate, sel, trig); in sel_init()
944 static int selector_write(struct ccu_data *ccu, struct bcm_clk_gate *gate, in selector_write() argument
961 ret = __sel_commit(ccu, gate, sel, trig); in selector_write()
977 struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate; in kona_peri_clk_enable() local
979 return clk_gate(bcm_clk->ccu, bcm_clk->init_data.name, gate, true); in kona_peri_clk_enable()
985 struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate; in kona_peri_clk_disable() local
987 (void)clk_gate(bcm_clk->ccu, bcm_clk->init_data.name, gate, false); in kona_peri_clk_disable()
993 struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate; in kona_peri_clk_is_enabled() local
995 return is_clk_gate_enabled(bcm_clk->ccu, gate) ? 1 : 0; in kona_peri_clk_is_enabled()
1104 ret = selector_write(bcm_clk->ccu, &data->gate, sel, trig, index); in kona_peri_clk_set_parent()
1168 ret = divider_write(bcm_clk->ccu, &data->gate, &data->div, in kona_peri_clk_set_rate()
1208 if (!gate_init(ccu, &peri->gate)) { in __peri_clk_init()
1216 if (!div_init(ccu, &peri->gate, &peri->div, &peri->trig)) { in __peri_clk_init()
1229 if (!div_init(ccu, &peri->gate, &peri->pre_div, trig)) { in __peri_clk_init()
1235 if (!sel_init(ccu, &peri->gate, &peri->sel, trig)) { in __peri_clk_init()