Lines Matching refs:ccu

26 static bool ccu_data_offsets_valid(struct ccu_data *ccu)  in ccu_data_offsets_valid()  argument
28 struct ccu_policy *ccu_policy = &ccu->policy; in ccu_data_offsets_valid()
31 limit = ccu->range - sizeof(u32); in ccu_data_offsets_valid()
37 ccu->name, ccu_policy->enable.offset, limit); in ccu_data_offsets_valid()
43 ccu->name, ccu_policy->control.offset, limit); in ccu_data_offsets_valid()
93 range = bcm_clk->ccu->range; in peri_clk_data_offsets_valid()
747 static void ccu_clks_teardown(struct ccu_data *ccu) in ccu_clks_teardown() argument
751 for (i = 0; i < ccu->clk_num; i++) in ccu_clks_teardown()
752 kona_clk_teardown(&ccu->kona_clks[i].hw); in ccu_clks_teardown()
755 static void kona_ccu_teardown(struct ccu_data *ccu) in kona_ccu_teardown() argument
757 if (!ccu->base) in kona_ccu_teardown()
760 of_clk_del_provider(ccu->node); /* safe if never added */ in kona_ccu_teardown()
761 ccu_clks_teardown(ccu); in kona_ccu_teardown()
762 of_node_put(ccu->node); in kona_ccu_teardown()
763 ccu->node = NULL; in kona_ccu_teardown()
764 iounmap(ccu->base); in kona_ccu_teardown()
765 ccu->base = NULL; in kona_ccu_teardown()
768 static bool ccu_data_valid(struct ccu_data *ccu) in ccu_data_valid() argument
772 if (!ccu_data_offsets_valid(ccu)) in ccu_data_valid()
775 ccu_policy = &ccu->policy; in ccu_data_valid()
777 if (!ccu_policy_valid(ccu_policy, ccu->name)) in ccu_data_valid()
786 struct ccu_data *ccu = data; in of_clk_kona_onecell_get() local
789 if (idx >= ccu->clk_num) { in of_clk_kona_onecell_get()
794 return &ccu->kona_clks[idx].hw; in of_clk_kona_onecell_get()
801 void __init kona_dt_ccu_setup(struct ccu_data *ccu, in kona_dt_ccu_setup() argument
823 ccu->range = (u32)range; in kona_dt_ccu_setup()
825 if (!ccu_data_valid(ccu)) { in kona_dt_ccu_setup()
830 ccu->base = ioremap(res.start, ccu->range); in kona_dt_ccu_setup()
831 if (!ccu->base) { in kona_dt_ccu_setup()
836 ccu->node = of_node_get(node); in kona_dt_ccu_setup()
843 for (i = 0; i < ccu->clk_num; i++) { in kona_dt_ccu_setup()
844 if (!ccu->kona_clks[i].ccu) in kona_dt_ccu_setup()
846 kona_clk_setup(&ccu->kona_clks[i]); in kona_dt_ccu_setup()
849 ret = of_clk_add_hw_provider(node, of_clk_kona_onecell_get, ccu); in kona_dt_ccu_setup()
856 if (!kona_ccu_init(ccu)) in kona_dt_ccu_setup()
861 kona_ccu_teardown(ccu); in kona_dt_ccu_setup()