Lines Matching refs:ccu

18 static bool ccu_data_offsets_valid(struct ccu_data *ccu)  in ccu_data_offsets_valid()  argument
20 struct ccu_policy *ccu_policy = &ccu->policy; in ccu_data_offsets_valid()
23 limit = ccu->range - sizeof(u32); in ccu_data_offsets_valid()
29 ccu->name, ccu_policy->enable.offset, limit); in ccu_data_offsets_valid()
35 ccu->name, ccu_policy->control.offset, limit); in ccu_data_offsets_valid()
85 range = bcm_clk->ccu->range; in peri_clk_data_offsets_valid()
739 static void ccu_clks_teardown(struct ccu_data *ccu) in ccu_clks_teardown() argument
743 for (i = 0; i < ccu->clk_num; i++) in ccu_clks_teardown()
744 kona_clk_teardown(&ccu->kona_clks[i].hw); in ccu_clks_teardown()
747 static void kona_ccu_teardown(struct ccu_data *ccu) in kona_ccu_teardown() argument
749 if (!ccu->base) in kona_ccu_teardown()
752 of_clk_del_provider(ccu->node); /* safe if never added */ in kona_ccu_teardown()
753 ccu_clks_teardown(ccu); in kona_ccu_teardown()
754 of_node_put(ccu->node); in kona_ccu_teardown()
755 ccu->node = NULL; in kona_ccu_teardown()
756 iounmap(ccu->base); in kona_ccu_teardown()
757 ccu->base = NULL; in kona_ccu_teardown()
760 static bool ccu_data_valid(struct ccu_data *ccu) in ccu_data_valid() argument
764 if (!ccu_data_offsets_valid(ccu)) in ccu_data_valid()
767 ccu_policy = &ccu->policy; in ccu_data_valid()
769 if (!ccu_policy_valid(ccu_policy, ccu->name)) in ccu_data_valid()
778 struct ccu_data *ccu = data; in of_clk_kona_onecell_get() local
781 if (idx >= ccu->clk_num) { in of_clk_kona_onecell_get()
786 return &ccu->kona_clks[idx].hw; in of_clk_kona_onecell_get()
793 void __init kona_dt_ccu_setup(struct ccu_data *ccu, in kona_dt_ccu_setup() argument
815 ccu->range = (u32)range; in kona_dt_ccu_setup()
817 if (!ccu_data_valid(ccu)) { in kona_dt_ccu_setup()
822 ccu->base = ioremap(res.start, ccu->range); in kona_dt_ccu_setup()
823 if (!ccu->base) { in kona_dt_ccu_setup()
828 ccu->node = of_node_get(node); in kona_dt_ccu_setup()
835 for (i = 0; i < ccu->clk_num; i++) { in kona_dt_ccu_setup()
836 if (!ccu->kona_clks[i].ccu) in kona_dt_ccu_setup()
838 kona_clk_setup(&ccu->kona_clks[i]); in kona_dt_ccu_setup()
841 ret = of_clk_add_hw_provider(node, of_clk_kona_onecell_get, ccu); in kona_dt_ccu_setup()
848 if (!kona_ccu_init(ccu)) in kona_dt_ccu_setup()
853 kona_ccu_teardown(ccu); in kona_dt_ccu_setup()