Lines Matching refs:fd
76 struct fapll_data *fd; member
84 static bool ti_fapll_clock_is_bypass(struct fapll_data *fd) in ti_fapll_clock_is_bypass() argument
86 u32 v = readl_relaxed(fd->base); in ti_fapll_clock_is_bypass()
88 if (fd->bypass_bit_inverted) in ti_fapll_clock_is_bypass()
94 static void ti_fapll_set_bypass(struct fapll_data *fd) in ti_fapll_set_bypass() argument
96 u32 v = readl_relaxed(fd->base); in ti_fapll_set_bypass()
98 if (fd->bypass_bit_inverted) in ti_fapll_set_bypass()
102 writel_relaxed(v, fd->base); in ti_fapll_set_bypass()
105 static void ti_fapll_clear_bypass(struct fapll_data *fd) in ti_fapll_clear_bypass() argument
107 u32 v = readl_relaxed(fd->base); in ti_fapll_clear_bypass()
109 if (fd->bypass_bit_inverted) in ti_fapll_clear_bypass()
113 writel_relaxed(v, fd->base); in ti_fapll_clear_bypass()
116 static int ti_fapll_wait_lock(struct fapll_data *fd) in ti_fapll_wait_lock() argument
121 while ((v = readl_relaxed(fd->base))) { in ti_fapll_wait_lock()
131 pr_err("%s failed to lock\n", fd->name); in ti_fapll_wait_lock()
138 struct fapll_data *fd = to_fapll(hw); in ti_fapll_enable() local
139 u32 v = readl_relaxed(fd->base); in ti_fapll_enable()
142 writel_relaxed(v, fd->base); in ti_fapll_enable()
143 ti_fapll_wait_lock(fd); in ti_fapll_enable()
150 struct fapll_data *fd = to_fapll(hw); in ti_fapll_disable() local
151 u32 v = readl_relaxed(fd->base); in ti_fapll_disable()
154 writel_relaxed(v, fd->base); in ti_fapll_disable()
159 struct fapll_data *fd = to_fapll(hw); in ti_fapll_is_enabled() local
160 u32 v = readl_relaxed(fd->base); in ti_fapll_is_enabled()
168 struct fapll_data *fd = to_fapll(hw); in ti_fapll_recalc_rate() local
172 if (ti_fapll_clock_is_bypass(fd)) in ti_fapll_recalc_rate()
178 v = readl_relaxed(fd->base); in ti_fapll_recalc_rate()
191 struct fapll_data *fd = to_fapll(hw); in ti_fapll_get_parent() local
193 if (ti_fapll_clock_is_bypass(fd)) in ti_fapll_get_parent()
245 struct fapll_data *fd = to_fapll(hw); in ti_fapll_set_rate() local
257 ti_fapll_set_bypass(fd); in ti_fapll_set_rate()
258 v = readl_relaxed(fd->base); in ti_fapll_set_rate()
262 writel_relaxed(v, fd->base); in ti_fapll_set_rate()
264 ti_fapll_wait_lock(fd); in ti_fapll_set_rate()
265 ti_fapll_clear_bypass(fd); in ti_fapll_set_rate()
283 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_enable()
286 writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_enable()
294 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_disable()
297 writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_disable()
303 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_is_enabled()
327 if (ti_fapll_clock_is_bypass(synth->fd)) in ti_fapll_synth_recalc_rate()
411 struct fapll_data *fd = synth->fd; in ti_fapll_synth_round_rate() local
414 if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) in ti_fapll_synth_round_rate()
445 struct fapll_data *fd = synth->fd; in ti_fapll_synth_set_rate() local
449 if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) in ti_fapll_synth_set_rate()
489 static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, in ti_fapll_synth_setup() argument
513 synth->fd = fd; in ti_fapll_synth_setup()
532 struct fapll_data *fd; in ti_fapll_setup() local
538 fd = kzalloc(sizeof(*fd), GFP_KERNEL); in ti_fapll_setup()
539 if (!fd) in ti_fapll_setup()
542 fd->outputs.clks = kzalloc(sizeof(struct clk *) * in ti_fapll_setup()
545 if (!fd->outputs.clks) in ti_fapll_setup()
565 fd->clk_ref = of_clk_get(node, 0); in ti_fapll_setup()
566 if (IS_ERR(fd->clk_ref)) { in ti_fapll_setup()
571 fd->clk_bypass = of_clk_get(node, 1); in ti_fapll_setup()
572 if (IS_ERR(fd->clk_bypass)) { in ti_fapll_setup()
577 fd->base = of_iomap(node, 0); in ti_fapll_setup()
578 if (!fd->base) { in ti_fapll_setup()
583 if (fapll_is_ddr_pll(fd->base)) in ti_fapll_setup()
584 fd->bypass_bit_inverted = true; in ti_fapll_setup()
586 fd->name = node->name; in ti_fapll_setup()
587 fd->hw.init = init; in ti_fapll_setup()
590 pll_clk = clk_register(NULL, &fd->hw); in ti_fapll_setup()
594 fd->outputs.clks[0] = pll_clk; in ti_fapll_setup()
595 fd->outputs.clk_num++; in ti_fapll_setup()
619 freq = fd->base + (output_instance * 8); in ti_fapll_setup()
632 synth_clk = ti_fapll_synth_setup(fd, freq, div, output_instance, in ti_fapll_setup()
638 fd->outputs.clks[output_instance] = synth_clk; in ti_fapll_setup()
639 fd->outputs.clk_num++; in ti_fapll_setup()
645 of_clk_add_provider(node, of_clk_src_onecell_get, &fd->outputs); in ti_fapll_setup()
653 iounmap(fd->base); in ti_fapll_setup()
655 if (fd->clk_bypass) in ti_fapll_setup()
656 clk_put(fd->clk_bypass); in ti_fapll_setup()
657 if (fd->clk_ref) in ti_fapll_setup()
658 clk_put(fd->clk_ref); in ti_fapll_setup()
659 kfree(fd->outputs.clks); in ti_fapll_setup()
660 kfree(fd); in ti_fapll_setup()