1 // SPDX-License-Identifier: GPL-2.0+
3 // OWL pll 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>
14 #include "owl-common.h"
16 /* last entry should have rate = 0 */
17 struct clk_pll_table
{
30 const struct clk_pll_table
*table
;
34 struct owl_pll_hw pll_hw
;
35 struct owl_clk_common common
;
38 #define OWL_PLL_HW(_reg, _bfreq, _bit_idx, _shift, \
39 _width, _min_mul, _max_mul, _table) \
43 .bit_idx = _bit_idx, \
46 .min_mul = _min_mul, \
47 .max_mul = _max_mul, \
51 #define OWL_PLL(_struct, _name, _parent, _reg, _bfreq, _bit_idx, \
52 _shift, _width, _min_mul, _max_mul, _table, _flags) \
53 struct owl_pll _struct = { \
54 .pll_hw = OWL_PLL_HW(_reg, _bfreq, _bit_idx, _shift, \
59 .hw.init = CLK_HW_INIT(_name, \
66 #define OWL_PLL_NO_PARENT(_struct, _name, _reg, _bfreq, _bit_idx, \
67 _shift, _width, _min_mul, _max_mul, _table, _flags) \
68 struct owl_pll _struct = { \
69 .pll_hw = OWL_PLL_HW(_reg, _bfreq, _bit_idx, _shift, \
74 .hw.init = CLK_HW_INIT_NO_PARENT(_name, \
80 #define mul_mask(m) ((1 << ((m)->width)) - 1)
81 #define PLL_STABILITY_WAIT_US (50)
83 static inline struct owl_pll
*hw_to_owl_pll(const struct clk_hw
*hw
)
85 struct owl_clk_common
*common
= hw_to_owl_clk_common(hw
);
87 return container_of(common
, struct owl_pll
, common
);
90 extern const struct clk_ops owl_pll_ops
;
92 #endif /* _OWL_PLL_H_ */