0001
0002
0003
0004
0005
0006 #ifndef _CCU_NK_H_
0007 #define _CCU_NK_H_
0008
0009 #include <linux/clk-provider.h>
0010
0011 #include "ccu_common.h"
0012 #include "ccu_div.h"
0013 #include "ccu_mult.h"
0014
0015
0016
0017
0018
0019
0020 struct ccu_nk {
0021 u16 reg;
0022 u32 enable;
0023 u32 lock;
0024
0025 struct ccu_mult_internal n;
0026 struct ccu_mult_internal k;
0027
0028 unsigned int fixed_post_div;
0029
0030 struct ccu_common common;
0031 };
0032
0033 #define SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(_struct, _name, _parent, _reg, \
0034 _nshift, _nwidth, \
0035 _kshift, _kwidth, \
0036 _gate, _lock, _postdiv, \
0037 _flags) \
0038 struct ccu_nk _struct = { \
0039 .enable = _gate, \
0040 .lock = _lock, \
0041 .k = _SUNXI_CCU_MULT(_kshift, _kwidth), \
0042 .n = _SUNXI_CCU_MULT(_nshift, _nwidth), \
0043 .fixed_post_div = _postdiv, \
0044 .common = { \
0045 .reg = _reg, \
0046 .features = CCU_FEATURE_FIXED_POSTDIV, \
0047 .hw.init = CLK_HW_INIT(_name, \
0048 _parent, \
0049 &ccu_nk_ops, \
0050 _flags), \
0051 }, \
0052 }
0053
0054 static inline struct ccu_nk *hw_to_ccu_nk(struct clk_hw *hw)
0055 {
0056 struct ccu_common *common = hw_to_ccu_common(hw);
0057
0058 return container_of(common, struct ccu_nk, common);
0059 }
0060
0061 extern const struct clk_ops ccu_nk_ops;
0062
0063 #endif