Skip to content

Commit a94737a

Browse files
laura-naobebarino
authored andcommitted
clk: mediatek: clk-mtk: Add MUX_DIV_GATE macro
On MT8196, some clocks use one register for parent selection and gating, and a separate register for frequency division. Since composite clocks can combine a mux, divider, and gate in a single entity, add a macro to simplify registration of such clocks by combining parent selection, frequency scaling, and enable control into one definition. Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Signed-off-by: Laura Nao <laura.nao@collabora.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent e504d3b commit a94737a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

drivers/clk/mediatek/clk-mtk.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,25 @@ struct mtk_composite {
175175
.flags = 0, \
176176
}
177177

178+
#define MUX_DIV_GATE(_id, _name, _parents, \
179+
_mux_reg, _mux_shift, _mux_width, \
180+
_div_reg, _div_shift, _div_width, \
181+
_gate_reg, _gate_shift) { \
182+
.id = _id, \
183+
.name = _name, \
184+
.parent_names = _parents, \
185+
.num_parents = ARRAY_SIZE(_parents), \
186+
.mux_reg = _mux_reg, \
187+
.mux_shift = _mux_shift, \
188+
.mux_width = _mux_width, \
189+
.divider_reg = _div_reg, \
190+
.divider_shift = _div_shift, \
191+
.divider_width = _div_width, \
192+
.gate_reg = _gate_reg, \
193+
.gate_shift = _gate_shift, \
194+
.flags = CLK_SET_RATE_PARENT, \
195+
}
196+
178197
int mtk_clk_register_composites(struct device *dev,
179198
const struct mtk_composite *mcs, int num,
180199
void __iomem *base, spinlock_t *lock,

0 commit comments

Comments
 (0)