Lines Matching refs:fd

77 	struct fapll_data *fd;  member
85 static bool ti_fapll_clock_is_bypass(struct fapll_data *fd) in ti_fapll_clock_is_bypass() argument
87 u32 v = readl_relaxed(fd->base); in ti_fapll_clock_is_bypass()
89 if (fd->bypass_bit_inverted) in ti_fapll_clock_is_bypass()
95 static void ti_fapll_set_bypass(struct fapll_data *fd) in ti_fapll_set_bypass() argument
97 u32 v = readl_relaxed(fd->base); in ti_fapll_set_bypass()
99 if (fd->bypass_bit_inverted) in ti_fapll_set_bypass()
103 writel_relaxed(v, fd->base); in ti_fapll_set_bypass()
106 static void ti_fapll_clear_bypass(struct fapll_data *fd) in ti_fapll_clear_bypass() argument
108 u32 v = readl_relaxed(fd->base); in ti_fapll_clear_bypass()
110 if (fd->bypass_bit_inverted) in ti_fapll_clear_bypass()
114 writel_relaxed(v, fd->base); in ti_fapll_clear_bypass()
117 static int ti_fapll_wait_lock(struct fapll_data *fd) in ti_fapll_wait_lock() argument
122 while ((v = readl_relaxed(fd->base))) { in ti_fapll_wait_lock()
132 pr_err("%s failed to lock\n", fd->name); in ti_fapll_wait_lock()
139 struct fapll_data *fd = to_fapll(hw); in ti_fapll_enable() local
140 u32 v = readl_relaxed(fd->base); in ti_fapll_enable()
143 writel_relaxed(v, fd->base); in ti_fapll_enable()
144 ti_fapll_wait_lock(fd); in ti_fapll_enable()
151 struct fapll_data *fd = to_fapll(hw); in ti_fapll_disable() local
152 u32 v = readl_relaxed(fd->base); in ti_fapll_disable()
155 writel_relaxed(v, fd->base); in ti_fapll_disable()
160 struct fapll_data *fd = to_fapll(hw); in ti_fapll_is_enabled() local
161 u32 v = readl_relaxed(fd->base); in ti_fapll_is_enabled()
169 struct fapll_data *fd = to_fapll(hw); in ti_fapll_recalc_rate() local
173 if (ti_fapll_clock_is_bypass(fd)) in ti_fapll_recalc_rate()
179 v = readl_relaxed(fd->base); in ti_fapll_recalc_rate()
192 struct fapll_data *fd = to_fapll(hw); in ti_fapll_get_parent() local
194 if (ti_fapll_clock_is_bypass(fd)) in ti_fapll_get_parent()
246 struct fapll_data *fd = to_fapll(hw); in ti_fapll_set_rate() local
258 ti_fapll_set_bypass(fd); in ti_fapll_set_rate()
259 v = readl_relaxed(fd->base); in ti_fapll_set_rate()
263 writel_relaxed(v, fd->base); in ti_fapll_set_rate()
265 ti_fapll_wait_lock(fd); in ti_fapll_set_rate()
266 ti_fapll_clear_bypass(fd); in ti_fapll_set_rate()
284 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_enable()
287 writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_enable()
295 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_disable()
298 writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_disable()
304 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_is_enabled()
328 if (ti_fapll_clock_is_bypass(synth->fd)) in ti_fapll_synth_recalc_rate()
412 struct fapll_data *fd = synth->fd; in ti_fapll_synth_round_rate() local
415 if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) in ti_fapll_synth_round_rate()
446 struct fapll_data *fd = synth->fd; in ti_fapll_synth_set_rate() local
450 if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) in ti_fapll_synth_set_rate()
490 static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, in ti_fapll_synth_setup() argument
514 synth->fd = fd; in ti_fapll_synth_setup()
533 struct fapll_data *fd; in ti_fapll_setup() local
539 fd = kzalloc(sizeof(*fd), GFP_KERNEL); in ti_fapll_setup()
540 if (!fd) in ti_fapll_setup()
543 fd->outputs.clks = kzalloc(sizeof(struct clk *) * in ti_fapll_setup()
546 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()