clk: qcom: clk-krait: fix wrong div2 functions
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 8 Nov 2022 21:56:25 +0000 (22:56 +0100)
committerBjorn Andersson <andersson@kernel.org>
Thu, 1 Dec 2022 23:26:37 +0000 (17:26 -0600)
Currently div2 value is applied to the wrong bits. This is caused by a
bug in the code where the shift is done only for lpl, for anything
else the mask is not shifted to the correct bits.

Fix this by correctly shift if lpl is not supported.

Fixes: 4d7dc77babfe ("clk: qcom: Add support for Krait clocks")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20221108215625.30186-1-ansuelsmth@gmail.com
drivers/clk/qcom/clk-krait.c

index 45da736bd5f4cb079d0f043a7c5c29889ed77529..293a9dfa7151aabd484f2a0d1791a7b9404d6259 100644 (file)
@@ -114,6 +114,8 @@ static int krait_div2_set_rate(struct clk_hw *hw, unsigned long rate,
 
        if (d->lpl)
                mask = mask << (d->shift + LPL_SHIFT) | mask << d->shift;
+       else
+               mask <<= d->shift;
 
        spin_lock_irqsave(&krait_clock_reg_lock, flags);
        val = krait_get_l2_indirect_reg(d->offset);