Skip to content

Commit 8107c85

Browse files
smaeulmripard
authored andcommitted
clk: sunxi-ng: mux: Add macros using clk_parent_data and clk_hw
Referencing parents with clk_hw pointers is more efficient and removes the dependency on global clock names. clk_parent_data is needed when some parent clocks are provided from another driver. Add macros for declaring muxes that take advantage of these. Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 639e1ac commit 8107c85

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

drivers/clk/sunxi-ng/ccu_mux.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,39 @@ struct ccu_mux {
7272
SUNXI_CCU_MUX_TABLE_WITH_GATE(_struct, _name, _parents, NULL, \
7373
_reg, _shift, _width, 0, _flags)
7474

75+
#define SUNXI_CCU_MUX_DATA_WITH_GATE(_struct, _name, _parents, _reg, \
76+
_shift, _width, _gate, _flags) \
77+
struct ccu_mux _struct = { \
78+
.enable = _gate, \
79+
.mux = _SUNXI_CCU_MUX(_shift, _width), \
80+
.common = { \
81+
.reg = _reg, \
82+
.hw.init = CLK_HW_INIT_PARENTS_DATA(_name, \
83+
_parents, \
84+
&ccu_mux_ops, \
85+
_flags), \
86+
} \
87+
}
88+
89+
#define SUNXI_CCU_MUX_DATA(_struct, _name, _parents, _reg, \
90+
_shift, _width, _flags) \
91+
SUNXI_CCU_MUX_DATA_WITH_GATE(_struct, _name, _parents, _reg, \
92+
_shift, _width, 0, _flags)
93+
94+
#define SUNXI_CCU_MUX_HW_WITH_GATE(_struct, _name, _parents, _reg, \
95+
_shift, _width, _gate, _flags) \
96+
struct ccu_mux _struct = { \
97+
.enable = _gate, \
98+
.mux = _SUNXI_CCU_MUX(_shift, _width), \
99+
.common = { \
100+
.reg = _reg, \
101+
.hw.init = CLK_HW_INIT_PARENTS_HW(_name, \
102+
_parents, \
103+
&ccu_mux_ops, \
104+
_flags), \
105+
} \
106+
}
107+
75108
static inline struct ccu_mux *hw_to_ccu_mux(struct clk_hw *hw)
76109
{
77110
struct ccu_common *common = hw_to_ccu_common(hw);

0 commit comments

Comments
 (0)