Skip to content

Commit cdbb9d0

Browse files
Andre-ARMwens
authored andcommitted
clk: sunxi-ng: mp: provide wrappers for setting feature flags
So far our sunxi clock instantiation macros set the required clock features depending on the clock type, but the new "dual divider MP clock" requires us to pass that piece of information in by the user. Add new wrapper macros that allow to specify a "features" field, to allow marking those dual-divider clocks accordingly. Also add two convenience macros that deal with the most common cases. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://patch.msgid.link/20250307002628.10684-3-andre.przywara@arm.com Signed-off-by: Chen-Yu Tsai <wens@csie.org>
1 parent 4571780 commit cdbb9d0

File tree

1 file changed

+53
-5
lines changed

1 file changed

+53
-5
lines changed

drivers/clk/sunxi-ng/ccu_mp.h

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,73 @@ struct ccu_mp {
8282
_muxshift, _muxwidth, \
8383
0, _flags)
8484

85-
#define SUNXI_CCU_MP_DATA_WITH_MUX_GATE(_struct, _name, _parents, _reg, \
86-
_mshift, _mwidth, \
87-
_pshift, _pwidth, \
88-
_muxshift, _muxwidth, \
89-
_gate, _flags) \
85+
#define SUNXI_CCU_MP_MUX_GATE_POSTDIV_DUALDIV(_struct, _name, _parents, _reg, \
86+
_mshift, _mwidth, \
87+
_pshift, _pwidth, \
88+
_muxshift, _muxwidth, \
89+
_gate, _postdiv, \
90+
_flags) \
91+
struct ccu_mp _struct = { \
92+
.enable = _gate, \
93+
.m = _SUNXI_CCU_DIV(_mshift, _mwidth), \
94+
.p = _SUNXI_CCU_DIV(_pshift, _pwidth), \
95+
.mux = _SUNXI_CCU_MUX(_muxshift, _muxwidth), \
96+
.fixed_post_div = _postdiv, \
97+
.common = { \
98+
.reg = _reg, \
99+
.features = CCU_FEATURE_FIXED_POSTDIV | \
100+
CCU_FEATURE_DUAL_DIV, \
101+
.hw.init = CLK_HW_INIT_PARENTS_DATA(_name, \
102+
_parents, \
103+
&ccu_mp_ops, \
104+
_flags), \
105+
} \
106+
}
107+
108+
#define SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(_struct, _name, _parents, _reg, \
109+
_mshift, _mwidth, \
110+
_pshift, _pwidth, \
111+
_muxshift, _muxwidth, \
112+
_gate, _features, \
113+
_flags) \
90114
struct ccu_mp _struct = { \
91115
.enable = _gate, \
92116
.m = _SUNXI_CCU_DIV(_mshift, _mwidth), \
93117
.p = _SUNXI_CCU_DIV(_pshift, _pwidth), \
94118
.mux = _SUNXI_CCU_MUX(_muxshift, _muxwidth), \
95119
.common = { \
96120
.reg = _reg, \
121+
.features = _features, \
97122
.hw.init = CLK_HW_INIT_PARENTS_DATA(_name, \
98123
_parents, \
99124
&ccu_mp_ops, \
100125
_flags), \
101126
} \
102127
}
103128

129+
#define SUNXI_CCU_MP_DATA_WITH_MUX_GATE(_struct, _name, _parents, _reg, \
130+
_mshift, _mwidth, \
131+
_pshift, _pwidth, \
132+
_muxshift, _muxwidth, \
133+
_gate, _flags) \
134+
SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(_struct, _name, _parents, \
135+
_reg, _mshift, _mwidth, \
136+
_pshift, _pwidth, \
137+
_muxshift, _muxwidth, \
138+
_gate, _flags, 0)
139+
140+
#define SUNXI_CCU_DUALDIV_MUX_GATE(_struct, _name, _parents, _reg, \
141+
_mshift, _mwidth, \
142+
_pshift, _pwidth, \
143+
_muxshift, _muxwidth, \
144+
_gate, _flags) \
145+
SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(_struct, _name, _parents, \
146+
_reg, _mshift, _mwidth, \
147+
_pshift, _pwidth, \
148+
_muxshift, _muxwidth, \
149+
_gate, _flags, \
150+
CCU_FEATURE_DUAL_DIV)
151+
104152
#define SUNXI_CCU_MP_DATA_WITH_MUX(_struct, _name, _parents, _reg, \
105153
_mshift, _mwidth, \
106154
_pshift, _pwidth, \

0 commit comments

Comments
 (0)