• Home
  • Raw
  • Download

Lines Matching +full:mux +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0
10 #include <linux/clk-provider.h>
13 #include <asm/krait-l2-accessors.h>
15 #include "clk-krait.h"
21 static void __krait_mux_set_sel(struct krait_mux_clk *mux, int sel) in __krait_mux_set_sel() argument
27 regval = krait_get_l2_indirect_reg(mux->offset); in __krait_mux_set_sel()
28 regval &= ~(mux->mask << mux->shift); in __krait_mux_set_sel()
29 regval |= (sel & mux->mask) << mux->shift; in __krait_mux_set_sel()
30 if (mux->lpl) { in __krait_mux_set_sel()
31 regval &= ~(mux->mask << (mux->shift + LPL_SHIFT)); in __krait_mux_set_sel()
32 regval |= (sel & mux->mask) << (mux->shift + LPL_SHIFT); in __krait_mux_set_sel()
34 krait_set_l2_indirect_reg(mux->offset, regval); in __krait_mux_set_sel()
41 * Unlock now to make sure the mux register is not in __krait_mux_set_sel()
49 struct krait_mux_clk *mux = to_krait_mux_clk(hw); in krait_mux_set_parent() local
52 sel = clk_mux_index_to_val(mux->parent_map, 0, index); in krait_mux_set_parent()
53 mux->en_mask = sel; in krait_mux_set_parent()
54 /* Don't touch mux if CPU is off as it won't work */ in krait_mux_set_parent()
55 if (__clk_is_enabled(hw->clk)) in krait_mux_set_parent()
56 __krait_mux_set_sel(mux, sel); in krait_mux_set_parent()
58 mux->reparent = true; in krait_mux_set_parent()
65 struct krait_mux_clk *mux = to_krait_mux_clk(hw); in krait_mux_get_parent() local
68 sel = krait_get_l2_indirect_reg(mux->offset); in krait_mux_get_parent()
69 sel >>= mux->shift; in krait_mux_get_parent()
70 sel &= mux->mask; in krait_mux_get_parent()
71 mux->en_mask = sel; in krait_mux_get_parent()
73 return clk_mux_val_to_index(hw, mux->parent_map, 0, sel); in krait_mux_get_parent()
83 /* The divider can divide by 2, 4, 6 and 8. But we only really need div-2. */
97 u32 mask = BIT(d->width) - 1; in krait_div2_set_rate() local
99 if (d->lpl) in krait_div2_set_rate()
100 mask = mask << (d->shift + LPL_SHIFT) | mask << d->shift; in krait_div2_set_rate()
102 mask <<= d->shift; in krait_div2_set_rate()
105 val = krait_get_l2_indirect_reg(d->offset); in krait_div2_set_rate()
106 val &= ~mask; in krait_div2_set_rate()
107 krait_set_l2_indirect_reg(d->offset, val); in krait_div2_set_rate()
117 u32 mask = BIT(d->width) - 1; in krait_div2_recalc_rate() local
120 div = krait_get_l2_indirect_reg(d->offset); in krait_div2_recalc_rate()
121 div >>= d->shift; in krait_div2_recalc_rate()
122 div &= mask; in krait_div2_recalc_rate()