Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Laura Nao and committed by
Stephen Boyd
a94737a6 e504d3bd

+19
+19
drivers/clk/mediatek/clk-mtk.h
··· 175 175 .flags = 0, \ 176 176 } 177 177 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 + 178 197 int mtk_clk_register_composites(struct device *dev, 179 198 const struct mtk_composite *mcs, int num, 180 199 void __iomem *base, spinlock_t *lock,