[PATCH 5/7] clk: thead: th1520-ap: Add macro to define multiplexers with flags

Yao Zi
2025-11-20T13:16:07Z

The new macro, TH_CCU_MUX_FLAGS, extends TH_CCU_MUX macro by adding two
parameters to specify clock flags and multiplexer flags.

Signed-off-by: Yao Zi <ziyao@disroot.org>
---
drivers/clk/thead/clk-th1520-ap.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/thead/clk-th1520-ap.c b/drivers/clk/thead/clk-th1520-ap.c
index bf8e80c39a9e..79f001a047b2 100644
--- a/drivers/clk/thead/clk-th1520-ap.c
+++ b/drivers/clk/thead/clk-th1520-ap.c
@@ -101,17 +101,22 @@ struct ccu_pll {
.flags = _flags, \
}

-#define TH_CCU_MUX(_name, _parents, _shift, _width) \
+#define TH_CCU_MUX_FLAGS(_name, _parents, _shift, _width, _flags, \
+ _mux_flags) \
{ \
.mask = GENMASK(_width - 1, 0), \
.shift = _shift, \
+ .flags = _mux_flags, \
.hw.init = CLK_HW_INIT_PARENTS_DATA( \
_name, \
_parents, \
&clk_mux_ops, \
- 0), \
+ _flags), \
}

+#define TH_CCU_MUX(_name, _parents, _shift, _width) \
+ TH_CCU_MUX_FLAGS(_name, _parents, _shift, _width, 0, 0)
+
#define CCU_GATE(_clkid, _struct, _name, _parent, _reg, _bit, _flags) \
struct ccu_gate _struct = { \
.clkid = _clkid, \
--
2.51.2