Lines Matching full:mux
23 struct clk_omap_mux *mux = to_clk_omap_mux(hw); in ti_clk_mux_get_parent() local
28 * FIXME need a mux-specific flag to determine if val is bitwise or in ti_clk_mux_get_parent()
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()
87 * clk_mux_save_context - Save the parent selcted in the mux
90 * Save the parent mux value.
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()
101 * clk_mux_restore_context - Restore the parent in the mux
104 * Restore the saved parent mux value.
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
131 /* allocate the mux */ in _register_mux()
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 = of_ti_clk_register(node, &mux->hw, name); in _register_mux()
154 kfree(mux); in _register_mux()
160 * of_mux_clk_setup - Setup function for simple mux rate clock
180 pr_err("mux-clock %pOFn must have parents\n", node); in of_mux_clk_setup()
220 CLK_OF_DECLARE(mux_clk, "ti,mux-clock", of_mux_clk_setup);
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
256 mux = kzalloc(sizeof(*mux), GFP_KERNEL); in of_ti_composite_mux_clk_setup()
257 if (!mux) in of_ti_composite_mux_clk_setup()
260 if (ti_clk_get_reg_addr(node, 0, &mux->reg)) in of_ti_composite_mux_clk_setup()
263 mux->shift = mux->reg.bit; in of_ti_composite_mux_clk_setup()
266 mux->flags |= CLK_MUX_INDEX_ONE; in of_ti_composite_mux_clk_setup()
275 mux->mask = num_parents - 1; in of_ti_composite_mux_clk_setup()
276 mux->mask = (1 << fls(mux->mask)) - 1; in of_ti_composite_mux_clk_setup()
278 if (!ti_clk_add_component(node, &mux->hw, CLK_COMPONENT_TYPE_MUX)) in of_ti_composite_mux_clk_setup()
282 kfree(mux); in of_ti_composite_mux_clk_setup()
284 CLK_OF_DECLARE(ti_composite_mux_clk_setup, "ti,composite-mux-clock",