Lines Matching refs:mux
23 struct clk_omap_mux *mux = to_clk_omap_mux(hw); in ti_clk_mux_get_parent() local
34 val = ti_clk_ll_ops->clk_readl(&mux->reg) >> mux->shift; in ti_clk_mux_get_parent()
35 val &= mux->mask; in ti_clk_mux_get_parent()
37 if (mux->table) { in ti_clk_mux_get_parent()
41 if (mux->table[i] == val) in ti_clk_mux_get_parent()
46 if (val && (mux->flags & CLK_MUX_INDEX_BIT)) in ti_clk_mux_get_parent()
49 if (val && (mux->flags & CLK_MUX_INDEX_ONE)) in ti_clk_mux_get_parent()
60 struct clk_omap_mux *mux = to_clk_omap_mux(hw); in ti_clk_mux_set_parent() local
63 if (mux->table) { in ti_clk_mux_set_parent()
64 index = mux->table[index]; in ti_clk_mux_set_parent()
66 if (mux->flags & CLK_MUX_INDEX_BIT) in ti_clk_mux_set_parent()
69 if (mux->flags & CLK_MUX_INDEX_ONE) in ti_clk_mux_set_parent()
73 if (mux->flags & CLK_MUX_HIWORD_MASK) { in ti_clk_mux_set_parent()
74 val = mux->mask << (mux->shift + 16); in ti_clk_mux_set_parent()
76 val = ti_clk_ll_ops->clk_readl(&mux->reg); in ti_clk_mux_set_parent()
77 val &= ~(mux->mask << mux->shift); in ti_clk_mux_set_parent()
79 val |= index << mux->shift; in ti_clk_mux_set_parent()
80 ti_clk_ll_ops->clk_writel(val, &mux->reg); in ti_clk_mux_set_parent()
81 ti_clk_latch(&mux->reg, mux->latch); in ti_clk_mux_set_parent()
94 struct clk_omap_mux *mux = to_clk_omap_mux(hw); in clk_mux_save_context() local
96 mux->saved_parent = ti_clk_mux_get_parent(hw); in clk_mux_save_context()
108 struct clk_omap_mux *mux = to_clk_omap_mux(hw); in clk_mux_restore_context() local
110 ti_clk_mux_set_parent(hw, mux->saved_parent); in clk_mux_restore_context()
127 struct clk_omap_mux *mux; in _register_mux() local
132 mux = kzalloc(sizeof(*mux), GFP_KERNEL); in _register_mux()
133 if (!mux) in _register_mux()
143 memcpy(&mux->reg, reg, sizeof(*reg)); in _register_mux()
144 mux->shift = shift; in _register_mux()
145 mux->mask = mask; in _register_mux()
146 mux->latch = latch; in _register_mux()
147 mux->flags = clk_mux_flags; in _register_mux()
148 mux->table = table; in _register_mux()
149 mux->hw.init = &init; in _register_mux()
151 clk = ti_clk_register(dev, &mux->hw, name); in _register_mux()
154 kfree(mux); in _register_mux()
224 struct clk_omap_mux *mux; in ti_clk_build_component_mux() local
230 mux = kzalloc(sizeof(*mux), GFP_KERNEL); in ti_clk_build_component_mux()
231 if (!mux) in ti_clk_build_component_mux()
234 mux->shift = setup->bit_shift; in ti_clk_build_component_mux()
235 mux->latch = -EINVAL; in ti_clk_build_component_mux()
237 mux->reg.index = setup->module; in ti_clk_build_component_mux()
238 mux->reg.offset = setup->reg; in ti_clk_build_component_mux()
241 mux->flags |= CLK_MUX_INDEX_ONE; in ti_clk_build_component_mux()
245 mux->mask = num_parents - 1; in ti_clk_build_component_mux()
246 mux->mask = (1 << fls(mux->mask)) - 1; in ti_clk_build_component_mux()
248 return &mux->hw; in ti_clk_build_component_mux()
253 struct clk_omap_mux *mux; in of_ti_composite_mux_clk_setup() local
257 mux = kzalloc(sizeof(*mux), GFP_KERNEL); in of_ti_composite_mux_clk_setup()
258 if (!mux) in of_ti_composite_mux_clk_setup()
261 if (ti_clk_get_reg_addr(node, 0, &mux->reg)) in of_ti_composite_mux_clk_setup()
265 mux->shift = val; in of_ti_composite_mux_clk_setup()
268 mux->flags |= CLK_MUX_INDEX_ONE; in of_ti_composite_mux_clk_setup()
277 mux->mask = num_parents - 1; in of_ti_composite_mux_clk_setup()
278 mux->mask = (1 << fls(mux->mask)) - 1; in of_ti_composite_mux_clk_setup()
280 if (!ti_clk_add_component(node, &mux->hw, CLK_COMPONENT_TYPE_MUX)) in of_ti_composite_mux_clk_setup()
284 kfree(mux); in of_ti_composite_mux_clk_setup()