1 // SPDX-License-Identifier: GPL-2.0+
3 // OWL divider clock driver
5 // Copyright (c) 2014 Actions Semi Inc.
6 // Author: David Liu <liuwei@actions-semi.com>
8 // Copyright (c) 2018 Linaro Ltd.
9 // Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
11 #ifndef _OWL_DIVIDER_H_
12 #define _OWL_DIVIDER_H_
14 #include "owl-common.h"
16 struct owl_divider_hw {
21 struct clk_div_table *table;
25 struct owl_divider_hw div_hw;
26 struct owl_clk_common common;
29 #define OWL_DIVIDER_HW(_reg, _shift, _width, _div_flags, _table) \
34 .div_flags = _div_flags, \
38 #define OWL_DIVIDER(_struct, _name, _parent, _reg, \
39 _shift, _width, _table, _div_flags, _flags) \
40 struct owl_divider _struct = { \
41 .div_hw = OWL_DIVIDER_HW(_reg, _shift, _width, \
42 _div_flags, _table), \
45 .hw.init = CLK_HW_INIT(_name, \
52 static inline struct owl_divider *hw_to_owl_divider(const struct clk_hw *hw)
54 struct owl_clk_common *common = hw_to_owl_clk_common(hw);
56 return container_of(common, struct owl_divider, common);
59 long owl_divider_helper_round_rate(struct owl_clk_common *common,
60 const struct owl_divider_hw *div_hw,
62 unsigned long *parent_rate);
64 unsigned long owl_divider_helper_recalc_rate(struct owl_clk_common *common,
65 const struct owl_divider_hw *div_hw,
66 unsigned long parent_rate);
68 int owl_divider_helper_set_rate(const struct owl_clk_common *common,
69 const struct owl_divider_hw *div_hw,
71 unsigned long parent_rate);
73 extern const struct clk_ops owl_divider_ops;
75 #endif /* _OWL_DIVIDER_H_ */