Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1317664ybl; Fri, 16 Aug 2019 12:44:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPWmj72kP2p3G7EuuSs3jv5HJrhZXyBIG3o8P0lIYo9sKx+mu5GOYbVDQ2U5HuntYQDY8X X-Received: by 2002:a17:90a:3082:: with SMTP id h2mr8842877pjb.53.1565984674112; Fri, 16 Aug 2019 12:44:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565984674; cv=none; d=google.com; s=arc-20160816; b=Zr/GC/56rgNLaMw/Lg4BriMjFD7iGoer9sZ0i5baVxB8R+1/dV4QlT5uveuVD+niu8 GknrnzBTY3kL0horH8v3ZA+GsviG/7CImw8klx3sTuCdOW0GYQzmxeOobXgVcvulxAVL lYglMPEL4NDKBYIzb1pOK2k4hoBVLz/we6ZGYHirZ9jFTSswS013RDUh4jdeEtLtzyqE PJoKHiTk37NlhFSKu0PMLyLzO2FY8gwO2xRL1sPznjfxgtUtIT+CpPd+tOYzOMIlVn1z WwPXtgFkURusCFQVbl4M1/GyGcBSaMYm8dATs2+BvNfK46ibnMrRSRuZn2k684CRr92J 2/nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=g3u+sp12QfQwVSGZjC7LJissAjUDGtipxhhHXKacplg=; b=NnsdSHYO2UQOYD17C8gtA500Q8O5Kyo6AKbcoWEaU2q3B40c02+UFZ04Crkyso3ljw NZ8XF15kdQesix76z+IdcS3x75iqirw76DjsyKfjqOCiQtdyf+CC0yz4MSUjqcLbGK6f FPLdKyRwND9S2Q+/L1B3rOMakuCesxSOdnw0wsTkIyak5dHJhs6ZDMDyiizWtD+SQkq/ grswILHX6MNqfWCBa2edwqr9QJxI5dvz+RauQJUULeEt8+3w47oA/gpbLUI7SKyF9t8i uRj6rID/XfD/UIbvzEnqKO8PjfeXxiRWbDJ3peaZdptqsbsP9dbJat+DEtt6Xs3UX/hr Nvxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=SkRngtzI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5si3487874pjk.57.2019.08.16.12.44.18; Fri, 16 Aug 2019 12:44:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=SkRngtzI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727981AbfHPTnZ (ORCPT + 99 others); Fri, 16 Aug 2019 15:43:25 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:13340 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727908AbfHPTnJ (ORCPT ); Fri, 16 Aug 2019 15:43:09 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 16 Aug 2019 12:43:11 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 16 Aug 2019 12:43:08 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 16 Aug 2019 12:43:08 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 16 Aug 2019 19:43:07 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 16 Aug 2019 19:43:07 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 16 Aug 2019 19:43:07 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.2.166.126]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 16 Aug 2019 12:43:07 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH v9 20/22] soc/tegra: pmc: Configure deep sleep control settings Date: Fri, 16 Aug 2019 12:42:05 -0700 Message-ID: <1565984527-5272-21-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565984527-5272-1-git-send-email-skomatineni@nvidia.com> References: <1565984527-5272-1-git-send-email-skomatineni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1565984591; bh=g3u+sp12QfQwVSGZjC7LJissAjUDGtipxhhHXKacplg=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=SkRngtzIZuTY/P1m/fzR34xsvp61H+LQTewT2Xb0N61+z5Xpl8MgkeEmQ9CF53NLe ppiPDDQ/nUZV4gDH5pGyZEXK7SLA4HxBpkXpcwrewe85a9IFPDHpyfZSI7pKetkijB fVlm6lV2YUPBWBNWvG00HjvMxUKo0xcESWdMAkx3FYiQrbbE9alyLFsV354W0z2iiQ G/mczV8+1zpEY4m63gExkAF0zAjOh6iBXc2hlnQi7vz9MEXHjCtQbotDp2PTpJT6cD C+BLPgezdrlmcV30GtwkoZb6HUgEPCNQuEoiRFLjnA3Ib7TWLaHfjhC9gPDYinfGmP Qfg9Mgh3hdl7A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tegra210 and prior Tegra chips have deep sleep entry and wakeup related timings which are platform specific that should be configured before entering into deep sleep. Below are the timing specific configurations for deep sleep entry and wakeup. - Core rail power-on stabilization timer - OSC clock stabilization timer after SOC rail power is stabilized. - Core power off time is the minimum wake delay to keep the system in deep sleep state irrespective of any quick wake event. These values depends on the discharge time of regulators and turn OFF time of the PMIC to allow the complete system to finish entering into deep sleep state. These values vary based on the platform design and are specified through the device tree. This patch has implementation to configure these timings which are must to have for proper deep sleep and wakeup operations. Signed-off-by: Sowjanya Komatineni --- drivers/soc/tegra/pmc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index 53ed70773872..710969043668 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -88,6 +88,8 @@ #define PMC_CPUPWRGOOD_TIMER 0xc8 #define PMC_CPUPWROFF_TIMER 0xcc +#define PMC_COREPWRGOOD_TIMER 0x3c +#define PMC_COREPWROFF_TIMER 0xe0 #define PMC_PWR_DET_VALUE 0xe4 @@ -2277,7 +2279,7 @@ static const struct tegra_pmc_regs tegra20_pmc_regs = { static void tegra20_pmc_init(struct tegra_pmc *pmc) { - u32 value; + u32 value, osc, pmu, off; /* Always enable CPU power request */ value = tegra_pmc_readl(pmc, PMC_CNTRL); @@ -2303,6 +2305,16 @@ static void tegra20_pmc_init(struct tegra_pmc *pmc) value = tegra_pmc_readl(pmc, PMC_CNTRL); value |= PMC_CNTRL_SYSCLK_OE; tegra_pmc_writel(pmc, value, PMC_CNTRL); + + /* program core timings which are applicable only for suspend state */ + if (pmc->suspend_mode != TEGRA_SUSPEND_NONE) { + osc = DIV_ROUND_UP(pmc->core_osc_time * 8192, 1000000); + pmu = DIV_ROUND_UP(pmc->core_pmu_time * 32768, 1000000); + off = DIV_ROUND_UP(pmc->core_off_time * 32768, 1000000); + tegra_pmc_writel(pmc, ((osc << 8) & 0xff00) | (pmu & 0xff), + PMC_COREPWRGOOD_TIMER); + tegra_pmc_writel(pmc, off, PMC_COREPWROFF_TIMER); + } } static void tegra20_pmc_setup_irq_polarity(struct tegra_pmc *pmc, -- 2.7.4