Lines Matching refs:fd
78 struct fapll_data *fd; member
86 static bool ti_fapll_clock_is_bypass(struct fapll_data *fd) in ti_fapll_clock_is_bypass() argument
88 u32 v = readl_relaxed(fd->base); in ti_fapll_clock_is_bypass()
90 if (fd->bypass_bit_inverted) in ti_fapll_clock_is_bypass()
96 static void ti_fapll_set_bypass(struct fapll_data *fd) in ti_fapll_set_bypass() argument
98 u32 v = readl_relaxed(fd->base); in ti_fapll_set_bypass()
100 if (fd->bypass_bit_inverted) in ti_fapll_set_bypass()
104 writel_relaxed(v, fd->base); in ti_fapll_set_bypass()
107 static void ti_fapll_clear_bypass(struct fapll_data *fd) in ti_fapll_clear_bypass() argument
109 u32 v = readl_relaxed(fd->base); in ti_fapll_clear_bypass()
111 if (fd->bypass_bit_inverted) in ti_fapll_clear_bypass()
115 writel_relaxed(v, fd->base); in ti_fapll_clear_bypass()
118 static int ti_fapll_wait_lock(struct fapll_data *fd) in ti_fapll_wait_lock() argument
123 while ((v = readl_relaxed(fd->base))) { in ti_fapll_wait_lock()
133 pr_err("%s failed to lock\n", fd->name); in ti_fapll_wait_lock()
140 struct fapll_data *fd = to_fapll(hw); in ti_fapll_enable() local
141 u32 v = readl_relaxed(fd->base); in ti_fapll_enable()
144 writel_relaxed(v, fd->base); in ti_fapll_enable()
145 ti_fapll_wait_lock(fd); in ti_fapll_enable()
152 struct fapll_data *fd = to_fapll(hw); in ti_fapll_disable() local
153 u32 v = readl_relaxed(fd->base); in ti_fapll_disable()
156 writel_relaxed(v, fd->base); in ti_fapll_disable()
161 struct fapll_data *fd = to_fapll(hw); in ti_fapll_is_enabled() local
162 u32 v = readl_relaxed(fd->base); in ti_fapll_is_enabled()
170 struct fapll_data *fd = to_fapll(hw); in ti_fapll_recalc_rate() local
174 if (ti_fapll_clock_is_bypass(fd)) in ti_fapll_recalc_rate()
180 v = readl_relaxed(fd->base); in ti_fapll_recalc_rate()
193 struct fapll_data *fd = to_fapll(hw); in ti_fapll_get_parent() local
195 if (ti_fapll_clock_is_bypass(fd)) in ti_fapll_get_parent()
247 struct fapll_data *fd = to_fapll(hw); in ti_fapll_set_rate() local
259 ti_fapll_set_bypass(fd); in ti_fapll_set_rate()
260 v = readl_relaxed(fd->base); in ti_fapll_set_rate()
264 writel_relaxed(v, fd->base); in ti_fapll_set_rate()
266 ti_fapll_wait_lock(fd); in ti_fapll_set_rate()
267 ti_fapll_clear_bypass(fd); in ti_fapll_set_rate()
285 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_enable()
288 writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_enable()
296 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_disable()
299 writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_disable()
305 u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); in ti_fapll_synth_is_enabled()
329 if (ti_fapll_clock_is_bypass(synth->fd)) in ti_fapll_synth_recalc_rate()
413 struct fapll_data *fd = synth->fd; in ti_fapll_synth_round_rate() local
416 if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) in ti_fapll_synth_round_rate()
447 struct fapll_data *fd = synth->fd; in ti_fapll_synth_set_rate() local
451 if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) in ti_fapll_synth_set_rate()
491 static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, in ti_fapll_synth_setup() argument
516 synth->fd = fd; in ti_fapll_synth_setup()
541 struct fapll_data *fd; in ti_fapll_setup() local
547 fd = kzalloc(sizeof(*fd), GFP_KERNEL); in ti_fapll_setup()
548 if (!fd) in ti_fapll_setup()
551 fd->outputs.clks = kzalloc(sizeof(struct clk *) * in ti_fapll_setup()
554 if (!fd->outputs.clks) in ti_fapll_setup()
573 fd->clk_ref = of_clk_get(node, 0); in ti_fapll_setup()
574 if (IS_ERR(fd->clk_ref)) { in ti_fapll_setup()
579 fd->clk_bypass = of_clk_get(node, 1); in ti_fapll_setup()
580 if (IS_ERR(fd->clk_bypass)) { in ti_fapll_setup()
585 fd->base = of_iomap(node, 0); in ti_fapll_setup()
586 if (!fd->base) { in ti_fapll_setup()
591 if (fapll_is_ddr_pll(fd->base)) in ti_fapll_setup()
592 fd->bypass_bit_inverted = true; in ti_fapll_setup()
594 fd->name = node->name; in ti_fapll_setup()
595 fd->hw.init = init; in ti_fapll_setup()
598 pll_clk = clk_register(NULL, &fd->hw); in ti_fapll_setup()
602 fd->outputs.clks[0] = pll_clk; in ti_fapll_setup()
603 fd->outputs.clk_num++; in ti_fapll_setup()
627 freq = fd->base + (output_instance * 8); in ti_fapll_setup()
640 synth_clk = ti_fapll_synth_setup(fd, freq, div, output_instance, in ti_fapll_setup()
646 fd->outputs.clks[output_instance] = synth_clk; in ti_fapll_setup()
647 fd->outputs.clk_num++; in ti_fapll_setup()
653 of_clk_add_provider(node, of_clk_src_onecell_get, &fd->outputs); in ti_fapll_setup()
661 iounmap(fd->base); in ti_fapll_setup()
663 if (fd->clk_bypass) in ti_fapll_setup()
664 clk_put(fd->clk_bypass); in ti_fapll_setup()
665 if (fd->clk_ref) in ti_fapll_setup()
666 clk_put(fd->clk_ref); in ti_fapll_setup()
667 kfree(fd->outputs.clks); in ti_fapll_setup()
668 kfree(fd); in ti_fapll_setup()