15 #include <linux/slab.h>
35 static inline struct clk_div *to_clk_div(
struct clk_hw *
hw)
37 struct clk_divider *divider =
container_of(hw,
struct clk_divider, hw);
42 static unsigned long clk_div_recalc_rate(
struct clk_hw *
hw,
43 unsigned long parent_rate)
47 return div->
ops->recalc_rate(&div->
divider.hw, parent_rate);
50 static long clk_div_round_rate(
struct clk_hw *hw,
unsigned long rate,
53 struct clk_div *div = to_clk_div(hw);
55 return div->
ops->round_rate(&div->
divider.hw, rate, prate);
58 static int clk_div_set_rate(
struct clk_hw *hw,
unsigned long rate,
59 unsigned long parent_rate)
61 struct clk_div *div = to_clk_div(hw);
64 ret = div->
ops->set_rate(&div->
divider.hw, rate, parent_rate);
71 static struct clk_ops clk_div_ops = {
72 .recalc_rate = clk_div_recalc_rate,
73 .round_rate = clk_div_round_rate,
74 .set_rate = clk_div_set_rate,
82 struct clk_init_data init;
89 init.ops = &clk_div_ops;
90 init.flags = CLK_SET_RATE_PARENT;
91 init.parent_names = (parent_name ? &parent_name:
NULL);
92 init.num_parents = (parent_name ? 1 : 0);
97 div->divider.reg =
reg;
98 div->divider.shift = shift;
99 div->divider.width =
width;
100 div->divider.flags = CLK_DIVIDER_ONE_BASED;
102 div->divider.hw.init = &
init;