From patchwork Mon Aug 5 11:20:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Lo X-Patchwork-Id: 264638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id AFC5A2C008A for ; Mon, 5 Aug 2013 21:21:43 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754676Ab3HELVl (ORCPT ); Mon, 5 Aug 2013 07:21:41 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:6101 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754603Ab3HELVl (ORCPT ); Mon, 5 Aug 2013 07:21:41 -0400 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Mon, 05 Aug 2013 04:21:09 -0700 Received: from hqemhub03.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Mon, 05 Aug 2013 04:20:03 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Mon, 05 Aug 2013 04:20:03 -0700 Received: from jlo-ubuntu-64.nvidia.com (172.20.144.16) by hqemhub03.nvidia.com (172.20.150.15) with Microsoft SMTP Server (TLS) id 8.3.298.1; Mon, 5 Aug 2013 04:21:40 -0700 From: Joseph Lo To: Stephen Warren CC: , , Joseph Lo , Mike Turquette Subject: [PATCH V2 3/8] clk: tegra114: add LP1 suspend/resume support Date: Mon, 5 Aug 2013 19:20:59 +0800 Message-ID: <1375701664-14965-4-git-send-email-josephl@nvidia.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1375701664-14965-1-git-send-email-josephl@nvidia.com> References: <1375701664-14965-1-git-send-email-josephl@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org When the system suspends to LP1, the CPU clock source is switched to CLK_M (12MHz Oscillator) during suspend/resume flow. The CPU clock source is controlled by the CCLKG_BURST_POLICY register, and hence this register must be restored during LP1 resume. Cc: Mike Turquette Signed-off-by: Joseph Lo --- V2: * update the commit message --- 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);