]> Git Repo - linux.git/commitdiff
clk: ingenic: Read bypass register only when there is one
authorPaul Cercueil <[email protected]>
Sun, 30 May 2021 16:49:20 +0000 (17:49 +0100)
committerStephen Boyd <[email protected]>
Mon, 28 Jun 2021 02:49:17 +0000 (19:49 -0700)
Rework the clock code so that the bypass register is only read when
there is actually a bypass functionality.

Signed-off-by: Paul Cercueil <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Tested-by: 周琰杰 (Zhou Yanjie)<[email protected]> # on CU1830-neo/X1830
Signed-off-by: Stephen Boyd <[email protected]>
drivers/clk/ingenic/cgu.c

index 0619d45a950c0f2d3899696e4e9e74b56f0349a6..7686072aff8f75dbf43b7d21b2daccb81ba1582f 100644 (file)
@@ -99,13 +99,14 @@ ingenic_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
        od_enc = ctl >> pll_info->od_shift;
        od_enc &= GENMASK(pll_info->od_bits - 1, 0);
 
-       ctl = readl(cgu->base + pll_info->bypass_reg);
+       if (!pll_info->no_bypass_bit) {
+               ctl = readl(cgu->base + pll_info->bypass_reg);
 
-       bypass = !pll_info->no_bypass_bit &&
-                !!(ctl & BIT(pll_info->bypass_bit));
+               bypass = !!(ctl & BIT(pll_info->bypass_bit));
 
-       if (bypass)
-               return parent_rate;
+               if (bypass)
+                       return parent_rate;
+       }
 
        for (od = 0; od < pll_info->od_max; od++) {
                if (pll_info->od_encoding[od] == od_enc)
@@ -225,11 +226,13 @@ static int ingenic_pll_enable(struct clk_hw *hw)
        u32 ctl;
 
        spin_lock_irqsave(&cgu->lock, flags);
-       ctl = readl(cgu->base + pll_info->bypass_reg);
+       if (!pll_info->no_bypass_bit) {
+               ctl = readl(cgu->base + pll_info->bypass_reg);
 
-       ctl &= ~BIT(pll_info->bypass_bit);
+               ctl &= ~BIT(pll_info->bypass_bit);
 
-       writel(ctl, cgu->base + pll_info->bypass_reg);
+               writel(ctl, cgu->base + pll_info->bypass_reg);
+       }
 
        ctl = readl(cgu->base + pll_info->reg);
 
This page took 0.058487 seconds and 4 git commands to generate.