1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2016 Maxime Ripard. All rights reserved.
9 #include <linux/clk-provider.h>
11 #include "ccu_common.h"
16 * struct ccu_nkmp - Definition of an N-K-M-P clock
18 * Clocks based on the formula parent * N * K >> P / M
24 struct ccu_mult_internal n
;
25 struct ccu_mult_internal k
;
26 struct ccu_div_internal m
;
27 struct ccu_div_internal p
;
29 unsigned int fixed_post_div
;
30 unsigned int max_rate
;
32 struct ccu_common common
;
35 #define SUNXI_CCU_NKMP_WITH_GATE_LOCK(_struct, _name, _parent, _reg, \
40 _gate, _lock, _flags) \
41 struct ccu_nkmp _struct = { \
44 .n = _SUNXI_CCU_MULT(_nshift, _nwidth), \
45 .k = _SUNXI_CCU_MULT(_kshift, _kwidth), \
46 .m = _SUNXI_CCU_DIV(_mshift, _mwidth), \
47 .p = _SUNXI_CCU_DIV(_pshift, _pwidth), \
50 .hw.init = CLK_HW_INIT(_name, \
57 static inline struct ccu_nkmp
*hw_to_ccu_nkmp(struct clk_hw
*hw
)
59 struct ccu_common
*common
= hw_to_ccu_common(hw
);
61 return container_of(common
, struct ccu_nkmp
, common
);
64 extern const struct clk_ops ccu_nkmp_ops
;
66 #endif /* _CCU_NKMP_H_ */