Commit 13e91e45 authored by Maxime Ripard's avatar Maxime Ripard

clk: sunxi-ng: mux: Add mux table macro

Add a new macro to declare muxes based on a table and a gate.
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: default avatarChen-Yu Tsai <wens@csie.org>
parent 87ba9e59
...@@ -43,9 +43,12 @@ struct ccu_mux { ...@@ -43,9 +43,12 @@ struct ccu_mux {
struct ccu_common common; struct ccu_common common;
}; };
#define SUNXI_CCU_MUX(_struct, _name, _parents, _reg, _shift, _width, _flags) \ #define SUNXI_CCU_MUX_TABLE_WITH_GATE(_struct, _name, _parents, _table, \
_reg, _shift, _width, _gate, \
_flags) \
struct ccu_mux _struct = { \ struct ccu_mux _struct = { \
.mux = _SUNXI_CCU_MUX(_shift, _width), \ .enable = _gate, \
.mux = _SUNXI_CCU_MUX_TABLE(_shift, _width, _table), \
.common = { \ .common = { \
.reg = _reg, \ .reg = _reg, \
.hw.init = CLK_HW_INIT_PARENTS(_name, \ .hw.init = CLK_HW_INIT_PARENTS(_name, \
...@@ -57,17 +60,14 @@ struct ccu_mux { ...@@ -57,17 +60,14 @@ struct ccu_mux {
#define SUNXI_CCU_MUX_WITH_GATE(_struct, _name, _parents, _reg, \ #define SUNXI_CCU_MUX_WITH_GATE(_struct, _name, _parents, _reg, \
_shift, _width, _gate, _flags) \ _shift, _width, _gate, _flags) \
struct ccu_mux _struct = { \ SUNXI_CCU_MUX_TABLE_WITH_GATE(_struct, _name, _parents, NULL, \
.enable = _gate, \ _reg, _shift, _width, _gate, \
.mux = _SUNXI_CCU_MUX(_shift, _width), \ _flags)
.common = { \
.reg = _reg, \ #define SUNXI_CCU_MUX(_struct, _name, _parents, _reg, _shift, _width, \
.hw.init = CLK_HW_INIT_PARENTS(_name, \ _flags) \
_parents, \ SUNXI_CCU_MUX_TABLE_WITH_GATE(_struct, _name, _parents, NULL, \
&ccu_mux_ops, \ _reg, _shift, _width, 0, _flags)
_flags), \
} \
}
static inline struct ccu_mux *hw_to_ccu_mux(struct clk_hw *hw) static inline struct ccu_mux *hw_to_ccu_mux(struct clk_hw *hw)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment