Lines Matching +full:reg +full:- +full:mux
1 // SPDX-License-Identifier: GPL-2.0-or-later
7 #include <linux/clk-provider.h>
14 * struct clk_fixup_mux - imx integer fixup multiplexer clock
15 * @mux: the parent class
23 struct clk_mux mux; member
30 struct clk_mux *mux = to_clk_mux(hw); in to_clk_fixup_mux() local
32 return container_of(mux, struct clk_fixup_mux, mux); in to_clk_fixup_mux()
39 return fixup_mux->ops->get_parent(&fixup_mux->mux.hw); in clk_fixup_mux_get_parent()
45 struct clk_mux *mux = to_clk_mux(hw); in clk_fixup_mux_set_parent() local
49 spin_lock_irqsave(mux->lock, flags); in clk_fixup_mux_set_parent()
51 val = readl(mux->reg); in clk_fixup_mux_set_parent()
52 val &= ~(mux->mask << mux->shift); in clk_fixup_mux_set_parent()
53 val |= index << mux->shift; in clk_fixup_mux_set_parent()
54 fixup_mux->fixup(&val); in clk_fixup_mux_set_parent()
55 writel(val, mux->reg); in clk_fixup_mux_set_parent()
57 spin_unlock_irqrestore(mux->lock, flags); in clk_fixup_mux_set_parent()
67 struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg, in imx_clk_hw_fixup_mux() argument
77 return ERR_PTR(-EINVAL); in imx_clk_hw_fixup_mux()
81 return ERR_PTR(-ENOMEM); in imx_clk_hw_fixup_mux()
89 fixup_mux->mux.reg = reg; in imx_clk_hw_fixup_mux()
90 fixup_mux->mux.shift = shift; in imx_clk_hw_fixup_mux()
91 fixup_mux->mux.mask = BIT(width) - 1; in imx_clk_hw_fixup_mux()
92 fixup_mux->mux.lock = &imx_ccm_lock; in imx_clk_hw_fixup_mux()
93 fixup_mux->mux.hw.init = &init; in imx_clk_hw_fixup_mux()
94 fixup_mux->ops = &clk_mux_ops; in imx_clk_hw_fixup_mux()
95 fixup_mux->fixup = fixup; in imx_clk_hw_fixup_mux()
97 hw = &fixup_mux->mux.hw; in imx_clk_hw_fixup_mux()