16 #include <linux/slab.h>
33 struct clk_divider
div;
46 static unsigned long clk_busy_divider_recalc_rate(
struct clk_hw *
hw,
47 unsigned long parent_rate)
51 return busy->
div_ops->recalc_rate(&busy->
div.hw, parent_rate);
54 static long clk_busy_divider_round_rate(
struct clk_hw *hw,
unsigned long rate,
59 return busy->
div_ops->round_rate(&busy->
div.hw, rate, prate);
62 static int clk_busy_divider_set_rate(
struct clk_hw *hw,
unsigned long rate,
63 unsigned long parent_rate)
68 ret = busy->
div_ops->set_rate(&busy->
div.hw, rate, parent_rate);
70 ret = clk_busy_wait(busy->
reg, busy->
shift);
75 static struct clk_ops clk_busy_divider_ops = {
76 .recalc_rate = clk_busy_divider_recalc_rate,
77 .round_rate = clk_busy_divider_round_rate,
78 .set_rate = clk_busy_divider_set_rate,
87 struct clk_init_data init;
94 busy->shift = busy_shift;
97 busy->div.shift = shift;
98 busy->div.width =
width;
103 init.ops = &clk_busy_divider_ops;
104 init.flags = CLK_SET_RATE_PARENT;
105 init.parent_names = &parent_name;
106 init.num_parents = 1;
124 static inline struct clk_busy_mux *to_clk_busy_mux(
struct clk_hw *hw)
126 struct clk_mux *mux =
container_of(hw,
struct clk_mux, hw);
131 static u8 clk_busy_mux_get_parent(
struct clk_hw *hw)
135 return busy->
mux_ops->get_parent(&busy->
mux.hw);
138 static int clk_busy_mux_set_parent(
struct clk_hw *hw,
u8 index)
143 ret = busy->
mux_ops->set_parent(&busy->
mux.hw, index);
145 ret = clk_busy_wait(busy->
reg, busy->
shift);
151 .get_parent = clk_busy_mux_get_parent,
152 .set_parent = clk_busy_mux_set_parent,
157 const char **parent_names,
int num_parents)
161 struct clk_init_data init;
167 busy->reg = busy_reg;
168 busy->shift = busy_shift;
171 busy->mux.shift = shift;
172 busy->mux.width =
width;
179 init.parent_names = parent_names;
180 init.num_parents = num_parents;
182 busy->mux.hw.init = &
init;