Merge tag 'trace-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[linux/fpc-iii.git] / drivers / clk / actions / owl-divider.h
blob083be6d80954d78fbbb39fce8aceab28f1e31a5d
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 //
3 // OWL divider clock driver
4 //
5 // Copyright (c) 2014 Actions Semi Inc.
6 // Author: David Liu <liuwei@actions-semi.com>
7 //
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 {
17 u32 reg;
18 u8 shift;
19 u8 width;
20 u8 div_flags;
21 struct clk_div_table *table;
24 struct owl_divider {
25 struct owl_divider_hw div_hw;
26 struct owl_clk_common common;
29 #define OWL_DIVIDER_HW(_reg, _shift, _width, _div_flags, _table) \
30 { \
31 .reg = _reg, \
32 .shift = _shift, \
33 .width = _width, \
34 .div_flags = _div_flags, \
35 .table = _table, \
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), \
43 .common = { \
44 .regmap = NULL, \
45 .hw.init = CLK_HW_INIT(_name, \
46 _parent, \
47 &owl_divider_ops, \
48 _flags), \
49 }, \
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,
61 unsigned long rate,
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,
70 unsigned long rate,
71 unsigned long parent_rate);
73 extern const struct clk_ops owl_divider_ops;
75 #endif /* _OWL_DIVIDER_H_ */