linux-mips
[Top] [All Lists]

[PATCH v4 03/15] clk: ingenic: support PLLs with no bypass bit

To: Ralf Baechle <ralf@linux-mips.org>, Rob Herring <robh+dt@kernel.org>, Michael Turquette <mturquette@baylibre.com>
Subject: [PATCH v4 03/15] clk: ingenic: support PLLs with no bypass bit
From: Paul Cercueil <paul@crapouillou.net>
Date: Thu, 28 Dec 2017 14:56:22 +0100
Cc: Mark Rutland <mark.rutland@arm.com>, Stephen Boyd <sboyd@codeaurora.org>, Maarten ter Huurne <maarten@treewalker.org>, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, linux-clk@vger.kernel.org, Paul Cercueil <paul@crapouillou.net>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1514469410; bh=vMNAxnQny7vBBmJU4DxDwrvfvcuEMVbIQ33gGQ8XT98=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=jIcEDRMg3aLen/k3QtZo2qveYmFr1ipqKpwXSuzS92brTYf8RCmE9vEYonEM31wTDlayKVjCljcZsIIsXVTSwJeblhK8p2GY3B+nQz0tCQCGj0qJ0pRMRmEebn7XCuM1o5vg1bVEr1DH2Fgjwrf1+SWH/L3Zz+9eY21CagklV3M=
In-reply-to: <20171228135634.30000-1-paul@crapouillou.net>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20170702163016.6714-2-paul@crapouillou.net> <20171228135634.30000-1-paul@crapouillou.net>
Sender: linux-mips-bounce@linux-mips.org
The second PLL of the JZ4770 does not have a bypass bit.
This commit makes it possible to support it with the current common CGU
code.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/clk/ingenic/cgu.c | 3 ++-
 drivers/clk/ingenic/cgu.h | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

 v2: No change
 v3: No change
 v4: No change

diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
index a2e73a6d60fd..381c4a17a1fc 100644
--- a/drivers/clk/ingenic/cgu.c
+++ b/drivers/clk/ingenic/cgu.c
@@ -100,7 +100,8 @@ ingenic_pll_recalc_rate(struct clk_hw *hw, unsigned long 
parent_rate)
        n += pll_info->n_offset;
        od_enc = ctl >> pll_info->od_shift;
        od_enc &= GENMASK(pll_info->od_bits - 1, 0);
-       bypass = !!(ctl & BIT(pll_info->bypass_bit));
+       bypass = !pll_info->no_bypass_bit &&
+                !!(ctl & BIT(pll_info->bypass_bit));
        enable = !!(ctl & BIT(pll_info->enable_bit));
 
        if (bypass)
diff --git a/drivers/clk/ingenic/cgu.h b/drivers/clk/ingenic/cgu.h
index f1527cf75b3f..9da34910bd80 100644
--- a/drivers/clk/ingenic/cgu.h
+++ b/drivers/clk/ingenic/cgu.h
@@ -48,6 +48,7 @@
  * @bypass_bit: the index of the bypass bit in the PLL control register
  * @enable_bit: the index of the enable bit in the PLL control register
  * @stable_bit: the index of the stable bit in the PLL control register
+ * @no_bypass_bit: if set, the PLL has no bypass functionality
  */
 struct ingenic_cgu_pll_info {
        unsigned reg;
@@ -58,6 +59,7 @@ struct ingenic_cgu_pll_info {
        u8 bypass_bit;
        u8 enable_bit;
        u8 stable_bit;
+       bool no_bypass_bit;
 };
 
 /**
-- 
2.11.0


<Prev in Thread] Current Thread [Next in Thread>