2 * Copyright (c) 2016 Maxime Ripard. All rights reserved.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
17 #include <linux/clk-provider.h>
19 #include "ccu_common.h"
28 struct clk_div_table
*table
;
31 #define _SUNXI_CCU_DIV_TABLE_FLAGS(_shift, _width, _table, _flags) \
39 #define _SUNXI_CCU_DIV_FLAGS(_shift, _width, _flags) \
40 _SUNXI_CCU_DIV_TABLE_FLAGS(_shift, _width, NULL, _flags)
42 #define _SUNXI_CCU_DIV_TABLE(_shift, _width, _table) \
43 _SUNXI_CCU_DIV_TABLE_FLAGS(_shift, _width, _table, 0)
45 #define _SUNXI_CCU_DIV(_shift, _width) \
46 _SUNXI_CCU_DIV_TABLE_FLAGS(_shift, _width, NULL, 0)
52 struct ccu_mux_internal mux
;
53 struct ccu_common common
;
56 #define SUNXI_CCU_DIV_TABLE_WITH_GATE(_struct, _name, _parent, _reg, \
58 _table, _gate, _flags) \
59 struct ccu_div _struct = { \
60 .div = _SUNXI_CCU_DIV_TABLE(_shift, _width, \
65 .hw.init = CLK_HW_INIT(_name, \
73 #define SUNXI_CCU_DIV_TABLE(_struct, _name, _parent, _reg, \
76 SUNXI_CCU_DIV_TABLE_WITH_GATE(_struct, _name, _parent, _reg, \
77 _shift, _width, _table, 0, \
80 #define SUNXI_CCU_M_WITH_MUX_TABLE_GATE(_struct, _name, \
84 _muxshift, _muxwidth, \
86 struct ccu_div _struct = { \
88 .div = _SUNXI_CCU_DIV(_mshift, _mwidth), \
89 .mux = _SUNXI_CCU_MUX_TABLE(_muxshift, _muxwidth, _table), \
92 .hw.init = CLK_HW_INIT_PARENTS(_name, \
99 #define SUNXI_CCU_M_WITH_MUX_GATE(_struct, _name, _parents, _reg, \
100 _mshift, _mwidth, _muxshift, _muxwidth, \
102 SUNXI_CCU_M_WITH_MUX_TABLE_GATE(_struct, _name, \
104 _reg, _mshift, _mwidth, \
105 _muxshift, _muxwidth, \
108 #define SUNXI_CCU_M_WITH_MUX(_struct, _name, _parents, _reg, \
109 _mshift, _mwidth, _muxshift, _muxwidth, \
111 SUNXI_CCU_M_WITH_MUX_TABLE_GATE(_struct, _name, \
113 _reg, _mshift, _mwidth, \
114 _muxshift, _muxwidth, \
118 #define SUNXI_CCU_M_WITH_GATE(_struct, _name, _parent, _reg, \
119 _mshift, _mwidth, _gate, \
121 struct ccu_div _struct = { \
123 .div = _SUNXI_CCU_DIV(_mshift, _mwidth), \
126 .hw.init = CLK_HW_INIT(_name, \
133 #define SUNXI_CCU_M(_struct, _name, _parent, _reg, _mshift, _mwidth, \
135 SUNXI_CCU_M_WITH_GATE(_struct, _name, _parent, _reg, \
136 _mshift, _mwidth, 0, _flags)
138 static inline struct ccu_div
*hw_to_ccu_div(struct clk_hw
*hw
)
140 struct ccu_common
*common
= hw_to_ccu_common(hw
);
142 return container_of(common
, struct ccu_div
, common
);
145 extern const struct clk_ops ccu_div_ops
;
147 #endif /* _CCU_DIV_H_ */
This page took 0.035348 seconds and 6 git commands to generate.