Skip to content

Commit 44293ed

Browse files
committed
clk: sunxi-ng: div: support power-of-two dividers
Some clocks (for timers) on the A523 are mux-divider-gate types with the divider being values of power-of-two. Add a macro for these types of clocks so that we can use the divider types instead of the M-P types without an M divider. Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://patch.msgid.link/20250911174710.3149589-5-wens@kernel.org Signed-off-by: Chen-Yu Tsai <wens@csie.org>
1 parent 828dea3 commit 44293ed

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

drivers/clk/sunxi-ng/ccu_div.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,24 @@ struct ccu_div {
274274
SUNXI_CCU_M_HWS_WITH_GATE(_struct, _name, _parent, _reg, \
275275
_mshift, _mwidth, 0, _flags)
276276

277+
#define SUNXI_CCU_P_DATA_WITH_MUX_GATE(_struct, _name, _parents, _reg, \
278+
_mshift, _mwidth, \
279+
_muxshift, _muxwidth, \
280+
_gate, _flags) \
281+
struct ccu_div _struct = { \
282+
.enable = _gate, \
283+
.div = _SUNXI_CCU_DIV_FLAGS(_mshift, _mwidth, \
284+
CLK_DIVIDER_POWER_OF_TWO), \
285+
.mux = _SUNXI_CCU_MUX(_muxshift, _muxwidth), \
286+
.common = { \
287+
.reg = _reg, \
288+
.hw.init = CLK_HW_INIT_PARENTS_DATA(_name, \
289+
_parents, \
290+
&ccu_div_ops, \
291+
_flags), \
292+
}, \
293+
}
294+
277295
static inline struct ccu_div *hw_to_ccu_div(struct clk_hw *hw)
278296
{
279297
struct ccu_common *common = hw_to_ccu_common(hw);

0 commit comments

Comments
 (0)