From patchwork Fri Jul 26 09:15:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Lo X-Patchwork-Id: 2833921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9385F9F4E2 for ; Fri, 26 Jul 2013 09:17:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DDF6020143 for ; Fri, 26 Jul 2013 09:17:26 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94CCD20142 for ; Fri, 26 Jul 2013 09:17:25 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V2e8p-0004T5-Rc; Fri, 26 Jul 2013 09:16:52 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V2e8a-0002W0-Hd; Fri, 26 Jul 2013 09:16:36 +0000 Received: from hqemgate15.nvidia.com ([216.228.121.64]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V2e7x-0002Qp-8u for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2013 09:15:59 +0000 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com id ; Fri, 26 Jul 2013 02:15:24 -0700 Received: from hqemhub02.nvidia.com ([172.20.12.94]) by hqnvupgp07.nvidia.com (PGP Universal service); Fri, 26 Jul 2013 02:15:36 -0700 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Fri, 26 Jul 2013 02:15:36 -0700 Received: from jlo-ubuntu-64.nvidia.com (172.20.144.16) by hqemhub02.nvidia.com (172.20.150.31) with Microsoft SMTP Server (TLS) id 8.3.298.1; Fri, 26 Jul 2013 02:15:35 -0700 From: Joseph Lo To: Stephen Warren Subject: [PATCH 3/8] clk: tegra114: add LP1 suspend/resume support Date: Fri, 26 Jul 2013 17:15:05 +0800 Message-ID: <1374830110-30685-4-git-send-email-josephl@nvidia.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1374830110-30685-1-git-send-email-josephl@nvidia.com> References: <1374830110-30685-1-git-send-email-josephl@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130726_051557_621747_83476AB5 X-CRM114-Status: GOOD ( 11.71 ) X-Spam-Score: -3.4 (---) Cc: linux-tegra@vger.kernel.org, Mike Turquette , linux-arm-kernel@lists.infradead.org, Joseph Lo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the system suspends to LP1, the clock of the CPU would be switched to CLK_M (12MHz Oscillator) during suspend/resume flow. The clock driver needs to restore the clock of CPU after LP1 resume. Cc: Mike Turquette Signed-off-by: Joseph Lo --- drivers/clk/tegra/clk-tegra114.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c index f74ed19..b0e745a 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "clk.h" @@ -2332,6 +2333,33 @@ void tegra114_clock_deassert_dfll_dvco_reset(void) } EXPORT_SYMBOL(tegra114_clock_deassert_dfll_dvco_reset); +#ifdef CONFIG_PM_SLEEP +static u32 clk_rst_suspend[2]; + +static int tegra114_clk_suspend(void) +{ + u32 *ctx = clk_rst_suspend; + + *ctx++ = readl_relaxed(clk_base + CCLKG_BURST_POLICY); + *ctx++ = readl_relaxed(clk_base + CCLKG_BURST_POLICY + 4); + + return 0; +} + +static void tegra114_clk_resume(void) +{ + u32 *ctx = clk_rst_suspend; + + writel_relaxed(*ctx++, clk_base + CCLKG_BURST_POLICY); + writel_relaxed(*ctx++, clk_base + CCLKG_BURST_POLICY + 4); +} + +static struct syscore_ops tegra114_clk_syscore_ops = { + .suspend = tegra114_clk_suspend, + .resume = tegra114_clk_resume, +}; +#endif + static void __init tegra114_clock_init(struct device_node *np) { struct device_node *node; @@ -2384,5 +2412,9 @@ static void __init tegra114_clock_init(struct device_node *np) tegra_clk_apply_init_table = tegra114_clock_apply_init_table; tegra_cpu_car_ops = &tegra114_cpu_car_ops; + +#ifdef CONFIG_PM_SLEEP + register_syscore_ops(&tegra114_clk_syscore_ops); +#endif } CLK_OF_DECLARE(tegra114, "nvidia,tegra114-car", tegra114_clock_init);