Lines Matching refs:fd

71 	struct fapll_data *fd;  member
79 static bool ti_fapll_clock_is_bypass(struct fapll_data *fd) in ti_fapll_clock_is_bypass() argument
81 u32 v = readl_relaxed(fd->base); in ti_fapll_clock_is_bypass()
83 if (fd->bypass_bit_inverted) in ti_fapll_clock_is_bypass()
89 static void ti_fapll_set_bypass(struct fapll_data *fd) in ti_fapll_set_bypass() argument
91 u32 v = readl_relaxed(fd->base); in ti_fapll_set_bypass()
93 if (fd->bypass_bit_inverted) in ti_fapll_set_bypass()
97 writel_relaxed(v, fd->base); in ti_fapll_set_bypass()
100 static void ti_fapll_clear_bypass(struct fapll_data *fd) in ti_fapll_clear_bypass() argument
102 u32 v = readl_relaxed(fd->base); in ti_fapll_clear_bypass()
104 if (fd->bypass_bit_inverted) in ti_fapll_clear_bypass()
108 writel_relaxed(v, fd->base); in ti_fapll_clear_bypass()
111 static int ti_fapll_wait_lock(struct fapll_data *fd) in ti_fapll_wait_lock() argument
116 while ((v = readl_relaxed(fd->base))) { in ti_fapll_wait_lock()
126 pr_err("%s failed to lock\n", fd->name); in ti_fapll_wait_lock()
133 struct fapll_data *fd = to_fapll(hw); in ti_fapll_enable() local
134 u32 v = readl_relaxed(fd->base); in ti_fapll_enable()
137 writel_relaxed(v, fd->base); in ti_fapll_enable()
138 ti_fapll_wait_lock(fd); in ti_fapll_enable()
145 struct fapll_data *fd = to_fapll(hw); in ti_fapll_disable() local
146 u32 v = readl_relaxed(fd->base); in ti_fapll_disable()
149 writel_relaxed(v, fd->base); in ti_fapll_disable()
154 struct fapll_data *fd = to_fapll(hw); in ti_fapll_is_enabled() local
155 u32 v = readl_relaxed(fd->base); in ti_fapll_is_enabled()
163 struct fapll_data *fd = to_fapll(hw); in ti_fapll_recalc_rate() local
167 if (ti_fapll_clock_is_bypass(fd)) in ti_fapll_recalc_rate()
173 v = readl_relaxed(fd->base); in ti_fapll_recalc_rate()
186 struct fapll_data *fd = to_fapll(hw); in ti_fapll_get_parent() local
188 if (ti_fapll_clock_is_bypass(fd)) in ti_fapll_get_parent()
240 struct fapll_data *fd = to_fapll(hw); in ti_fapll_set_rate() local
252 ti_fapll_set_bypass(fd); in ti_fapll_set_rate()
253 v = readl_relaxed(fd->base); in ti_fapll_set_rate()
257 writel_relaxed(v, fd->base); in ti_fapll_set_rate()
259 ti_fapll_wait_lock(fd); in ti_fapll_set_rate()
260 ti_fapll_clear_bypass(fd); in ti_fapll_set_rate()
278 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_enable()
281 writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_enable()
289 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_disable()
292 writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_disable()
298 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_is_enabled()
322 if (ti_fapll_clock_is_bypass(synth->fd)) in ti_fapll_synth_recalc_rate()
406 struct fapll_data *fd = synth->fd; in ti_fapll_synth_round_rate() local
409 if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) in ti_fapll_synth_round_rate()
440 struct fapll_data *fd = synth->fd; in ti_fapll_synth_set_rate() local
444 if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) in ti_fapll_synth_set_rate()
484 static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, in ti_fapll_synth_setup() argument
509 synth->fd = fd; in ti_fapll_synth_setup()
534 struct fapll_data *fd; in ti_fapll_setup() local
541 fd = kzalloc(sizeof(*fd), GFP_KERNEL); in ti_fapll_setup()
542 if (!fd) in ti_fapll_setup()
545 fd->outputs.clks = kzalloc(sizeof(struct clk *) * in ti_fapll_setup()
548 if (!fd->outputs.clks) in ti_fapll_setup()
568 fd->clk_ref = of_clk_get(node, 0); in ti_fapll_setup()
569 if (IS_ERR(fd->clk_ref)) { in ti_fapll_setup()
574 fd->clk_bypass = of_clk_get(node, 1); in ti_fapll_setup()
575 if (IS_ERR(fd->clk_bypass)) { in ti_fapll_setup()
580 fd->base = of_iomap(node, 0); in ti_fapll_setup()
581 if (!fd->base) { in ti_fapll_setup()
586 if (fapll_is_ddr_pll(fd->base)) in ti_fapll_setup()
587 fd->bypass_bit_inverted = true; in ti_fapll_setup()
589 fd->name = name; in ti_fapll_setup()
590 fd->hw.init = init; in ti_fapll_setup()
593 pll_clk = clk_register(NULL, &fd->hw); in ti_fapll_setup()
597 fd->outputs.clks[0] = pll_clk; in ti_fapll_setup()
598 fd->outputs.clk_num++; in ti_fapll_setup()
622 freq = fd->base + (output_instance * 8); in ti_fapll_setup()
635 synth_clk = ti_fapll_synth_setup(fd, freq, div, output_instance, in ti_fapll_setup()
640 fd->outputs.clks[output_instance] = synth_clk; in ti_fapll_setup()
641 fd->outputs.clk_num++; in ti_fapll_setup()
647 of_clk_add_provider(node, of_clk_src_onecell_get, &fd->outputs); in ti_fapll_setup()
655 iounmap(fd->base); in ti_fapll_setup()
657 if (fd->clk_bypass) in ti_fapll_setup()
658 clk_put(fd->clk_bypass); in ti_fapll_setup()
659 if (fd->clk_ref) in ti_fapll_setup()
660 clk_put(fd->clk_ref); in ti_fapll_setup()
661 kfree(fd->outputs.clks); in ti_fapll_setup()
662 kfree(fd); in ti_fapll_setup()