Skip to content

Commit b30fc68

Browse files
smaeulmripard
authored andcommitted
clk: sunxi-ng: gate: Add macros for gates with fixed dividers
It is possible to declare a gate with a fixed divider, by using the CCU_FEATURE_ALL_PREDIV flag. Since this is not obvious, add a macro for declaring this type of clock. Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8107c85 commit b30fc68

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

drivers/clk/sunxi-ng/ccu_gate.h

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct ccu_gate {
5353
}
5454

5555
/*
56-
* The following two macros allow the re-use of the data structure
56+
* The following macros allow the re-use of the data structure
5757
* holding the parent info.
5858
*/
5959
#define SUNXI_CCU_GATE_HWS(_struct, _name, _parent, _reg, _gate, _flags) \
@@ -68,6 +68,21 @@ struct ccu_gate {
6868
} \
6969
}
7070

71+
#define SUNXI_CCU_GATE_HWS_WITH_PREDIV(_struct, _name, _parent, _reg, \
72+
_gate, _prediv, _flags) \
73+
struct ccu_gate _struct = { \
74+
.enable = _gate, \
75+
.common = { \
76+
.reg = _reg, \
77+
.prediv = _prediv, \
78+
.features = CCU_FEATURE_ALL_PREDIV, \
79+
.hw.init = CLK_HW_INIT_HWS(_name, \
80+
_parent, \
81+
&ccu_gate_ops, \
82+
_flags), \
83+
} \
84+
}
85+
7186
#define SUNXI_CCU_GATE_DATA(_struct, _name, _data, _reg, _gate, _flags) \
7287
struct ccu_gate _struct = { \
7388
.enable = _gate, \
@@ -81,6 +96,21 @@ struct ccu_gate {
8196
} \
8297
}
8398

99+
#define SUNXI_CCU_GATE_DATA_WITH_PREDIV(_struct, _name, _parent, _reg, \
100+
_gate, _prediv, _flags) \
101+
struct ccu_gate _struct = { \
102+
.enable = _gate, \
103+
.common = { \
104+
.reg = _reg, \
105+
.prediv = _prediv, \
106+
.features = CCU_FEATURE_ALL_PREDIV, \
107+
.hw.init = CLK_HW_INIT_PARENTS_DATA(_name, \
108+
_parent, \
109+
&ccu_gate_ops, \
110+
_flags), \
111+
} \
112+
}
113+
84114
static inline struct ccu_gate *hw_to_ccu_gate(struct clk_hw *hw)
85115
{
86116
struct ccu_common *common = hw_to_ccu_common(hw);

0 commit comments

Comments
 (0)