1 // SPDX-License-Identifier: GPL-2.0
3 // Spreadtrum pll clock driver
5 // Copyright (C) 2015~2017 Spreadtrum, Inc.
6 // Author: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
18 struct clk_bit_field
{
40 * struct sprd_pll - definition of adjustable pll clock
42 * @reg: registers used to set the configuration of pll clock,
43 * reg[0] shows how many registers this pll clock uses.
44 * @itable: pll ibias table, itable[0] means how many items this
46 * @udelay delay time after setting rate
47 * @factors used to calculate the pll clock rate
48 * @fvco: fvco threshold rate
54 const struct clk_bit_field
*factors
;
61 struct sprd_clk_common common
;
64 #define SPRD_PLL_WITH_ITABLE_K_FVCO(_struct, _name, _parent, _reg, \
65 _regs_num, _itable, _factors, \
66 _udelay, _k1, _k2, _fflag, _fvco) \
67 struct sprd_pll _struct = { \
68 .regs_num = _regs_num, \
70 .factors = _factors, \
79 .hw.init = CLK_HW_INIT(_name, \
86 #define SPRD_PLL_WITH_ITABLE_K(_struct, _name, _parent, _reg, \
87 _regs_num, _itable, _factors, \
89 SPRD_PLL_WITH_ITABLE_K_FVCO(_struct, _name, _parent, _reg, \
90 _regs_num, _itable, _factors, \
91 _udelay, _k1, _k2, 0, 0)
93 #define SPRD_PLL_WITH_ITABLE_1K(_struct, _name, _parent, _reg, \
94 _regs_num, _itable, _factors, _udelay) \
95 SPRD_PLL_WITH_ITABLE_K_FVCO(_struct, _name, _parent, _reg, \
96 _regs_num, _itable, _factors, \
97 _udelay, 1000, 1000, 0, 0)
99 static inline struct sprd_pll
*hw_to_sprd_pll(struct clk_hw
*hw
)
101 struct sprd_clk_common
*common
= hw_to_sprd_clk_common(hw
);
103 return container_of(common
, struct sprd_pll
, common
);
106 extern const struct clk_ops sprd_pll_ops
;
108 #endif /* _SPRD_PLL_H_ */