1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef _CCU_NKMP_H_
15#define _CCU_NKMP_H_
16
17#include <linux/clk-provider.h>
18
19#include "ccu_common.h"
20#include "ccu_div.h"
21#include "ccu_mult.h"
22
23
24
25
26
27
28struct ccu_nkmp {
29 u32 enable;
30 u32 lock;
31
32 struct ccu_mult_internal n;
33 struct ccu_mult_internal k;
34 struct ccu_div_internal m;
35 struct ccu_div_internal p;
36
37 unsigned int fixed_post_div;
38
39 struct ccu_common common;
40};
41
42#define SUNXI_CCU_NKMP_WITH_GATE_LOCK(_struct, _name, _parent, _reg, \
43 _nshift, _nwidth, \
44 _kshift, _kwidth, \
45 _mshift, _mwidth, \
46 _pshift, _pwidth, \
47 _gate, _lock, _flags) \
48 struct ccu_nkmp _struct = { \
49 .enable = _gate, \
50 .lock = _lock, \
51 .n = _SUNXI_CCU_MULT(_nshift, _nwidth), \
52 .k = _SUNXI_CCU_MULT(_kshift, _kwidth), \
53 .m = _SUNXI_CCU_DIV(_mshift, _mwidth), \
54 .p = _SUNXI_CCU_DIV(_pshift, _pwidth), \
55 .common = { \
56 .reg = _reg, \
57 .hw.init = CLK_HW_INIT(_name, \
58 _parent, \
59 &ccu_nkmp_ops, \
60 _flags), \
61 }, \
62 }
63
64static inline struct ccu_nkmp *hw_to_ccu_nkmp(struct clk_hw *hw)
65{
66 struct ccu_common *common = hw_to_ccu_common(hw);
67
68 return container_of(common, struct ccu_nkmp, common);
69}
70
71extern const struct clk_ops ccu_nkmp_ops;
72
73#endif
74