16 #include <linux/slab.h>
36 #define to_clk_pfd(_hw) container_of(_hw, struct clk_pfd, hw)
42 static int clk_pfd_enable(
struct clk_hw *
hw)
46 writel_relaxed(1 << ((pfd->
idx + 1) * 8 - 1), pfd->
reg +
CLR);
51 static void clk_pfd_disable(
struct clk_hw *
hw)
55 writel_relaxed(1 << ((pfd->
idx + 1) * 8 - 1), pfd->
reg +
SET);
58 static unsigned long clk_pfd_recalc_rate(
struct clk_hw *hw,
59 unsigned long parent_rate)
71 static long clk_pfd_round_rate(
struct clk_hw *hw,
unsigned long rate,
77 tmp = tmp * 18 + rate / 2;
91 static int clk_pfd_set_rate(
struct clk_hw *hw,
unsigned long rate,
92 unsigned long parent_rate)
95 u64 tmp = parent_rate;
98 tmp = tmp * 18 + rate / 2;
106 writel_relaxed(0x3f << (pfd->
idx * 8), pfd->
reg +
CLR);
107 writel_relaxed(frac << (pfd->
idx * 8), pfd->
reg +
SET);
112 static const struct clk_ops clk_pfd_ops = {
113 .enable = clk_pfd_enable,
114 .disable = clk_pfd_disable,
115 .recalc_rate = clk_pfd_recalc_rate,
116 .round_rate = clk_pfd_round_rate,
117 .set_rate = clk_pfd_set_rate,
125 struct clk_init_data init;
135 init.ops = &clk_pfd_ops;
137 init.parent_names = &parent_name;
138 init.num_parents = 1;