Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1558080ybm; Tue, 21 May 2019 16:33:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxpH6Qnd09tUN1ulJkmXfBesD9kxVFK+g4jK7Qx3k8Vd7/TUeahfaN58qH1kF+N2fpyvlS X-Received: by 2002:a63:42:: with SMTP id 63mr86537375pga.337.1558481603233; Tue, 21 May 2019 16:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558481603; cv=none; d=google.com; s=arc-20160816; b=SoyF5wx8u6AyzGHP22yQoRCaiAS1MnHnbolk4e6UQp8+B62bwxqk2MdDIiIJxpOf0k xvJChdXRfu9qZ0UCPTCiM6qOpG8PvsyaSzAR61XHaXLMTs6I1fKK2gYsboGGZqsXA18q Jh2URMYF2FPYr9oimX2CkhENGKt59E3rWZGiinCPKBYiXExY6XV9EcNd0c9Kysi0PYm/ Px9qXcRNP6+8JLuUuSI2WopWkw3tRE+DCgOjntwYP0GqtF72+FPQA7GWjEpkadO9EFdZ k2gaLpSyRNes1rKdM7S8XzqsfEZlXY3ZUH33mCUPZn+y043PTdIEIjQUVT9nhczGhRJY HMpg== 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=/J/3Ez25wTlkLCMS6Rzj4KYTeU+OuYLp1sYDTC4EZwg=; b=tTTA6AZQyLxZnzMJ8sMmhi1/yLIDuHW7jd7OYVxamB9BMPzyKSTUbSJ2hu6yRtDZXP /FgFu20C5AvHzUSECrI8LYdkEDrU3Zp39vJhOfgo15tszEjqm8bRMIb8zBO1gTSDOvKy MOokcVRqi5bio988PJrud8G/GhE+JAGr+iMp3te4LVyTZYx4bfVYWpBGttSDMgL40Ab4 VioNYIoOjyV3YKgtAmTmr26VJcP6NXb9MjiPPfsNxQxwCsiRe9BEz0HxI7Y03kRM7g3y md154jxZh6Xp+lmS4QBlkmX4skof1YLMHmACZ7T+OnE6MDR72IhuJ/JWqy663rAnire4 sXVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=maCKIs6j; 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 t61si24955512plb.309.2019.05.21.16.33.08; Tue, 21 May 2019 16:33:23 -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=maCKIs6j; 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 S1728269AbfEUXbr (ORCPT + 99 others); Tue, 21 May 2019 19:31:47 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:8292 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727493AbfEUXbU (ORCPT ); Tue, 21 May 2019 19:31:20 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 21 May 2019 16:31:18 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 21 May 2019 16:31:18 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 21 May 2019 16:31:18 -0700 Received: from HQMAIL103.nvidia.com (172.20.187.11) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 21 May 2019 23:31:18 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL103.nvidia.com (172.20.187.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 21 May 2019 23:31:17 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.110.102.174]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 21 May 2019 16:31:18 -0700 From: Sowjanya Komatineni To: , CC: , , , , , Subject: [PATCH V1 11/12] soc/tegra: pmc: configure tegra deep sleep control settings Date: Tue, 21 May 2019 16:31:22 -0700 Message-ID: <1558481483-22254-12-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558481483-22254-1-git-send-email-skomatineni@nvidia.com> References: <1558481483-22254-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=1558481478; bh=/J/3Ez25wTlkLCMS6Rzj4KYTeU+OuYLp1sYDTC4EZwg=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=maCKIs6jHHyFnDLGCcYHesQHi3BHGJ3Y7FkR62Rki7Wiqhw/w0gU0mcDSfl/F8jrn K9bTVMXXjNUH1cXWmD0wxk2aNlHm0/5+eCtqbDNMOtva4/cwkB6+U/Q5uzdu8V5UWb WqbR/QP62r41Qu1KtKUCBxkc9Bfv2xuAV7tRTPr9pE4w2TQj0yiBYtBv++otBl3Ayo qJ+Sz+EpbjQpHYq0/Fj04sBtmGk5lV+2mik0IVM222dM+Rceutci9e9DCS33szaHZU VTbyPx23F58eoLoRH8fGdyXEQ6Xy8wn/BnQ1fhqb3YKGKPtNZTabWCsWicxMjo0Rmm S7964imysn+4g== 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 power request signal polarity, deep sleep entry and wake related timings which are platform specific that should be configured before entering into deep sleep. Below are the timings specific configurations for deep sleep and wake. - 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 configurations which are must to have for deep sleep state. Signed-off-by: Sowjanya Komatineni --- arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi | 7 +++++++ drivers/soc/tegra/pmc.c | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi b/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi index 4dcd0d36189a..7ac5e55a30aa 100644 --- a/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi @@ -266,6 +266,13 @@ pmc@7000e400 { nvidia,invert-interrupt; + nvidia,suspend-mode = <0>; + nvidia,cpu-pwr-good-time = <0>; + nvidia,cpu-pwr-off-time = <0>; + nvidia,core-pwr-good-time = <4587 3876>; + nvidia,core-pwr-off-time = <39065>; + nvidia,core-power-req-active-high; + nvidia,sys-clock-req-active-high; }; /* eMMC */ diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index 5e68e1de1780..8d225962d136 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -66,6 +66,7 @@ #define PMC_CNTRL_SIDE_EFFECT_LP0 BIT(14) /* LP0 when CPU pwr gated */ #define PMC_CNTRL_SYSCLK_OE BIT(11) /* system clock enable */ #define PMC_CNTRL_SYSCLK_POLARITY BIT(10) /* sys clk polarity */ +#define PMC_CNTRL_PWRREQ_POLARITY BIT(8) #define PMC_CNTRL_MAIN_RST BIT(4) #define PMC_CNTRL_LATCH_WAKEUPS BIT(5) @@ -98,6 +99,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 @@ -2293,6 +2296,7 @@ static const struct tegra_pmc_regs tegra20_pmc_regs = { static void tegra20_pmc_init(struct tegra_pmc *pmc) { u32 value; + unsigned long osc, pmu, off; /* Always enable CPU power request */ value = tegra_pmc_readl(pmc, PMC_CNTRL); @@ -2306,6 +2310,11 @@ static void tegra20_pmc_init(struct tegra_pmc *pmc) else value |= PMC_CNTRL_SYSCLK_POLARITY; + if (pmc->corereq_high) + value &= ~PMC_CNTRL_PWRREQ_POLARITY; + else + value |= PMC_CNTRL_PWRREQ_POLARITY; + /* configure the output polarity while the request is tristated */ tegra_pmc_writel(pmc, value, PMC_CNTRL); @@ -2313,6 +2322,15 @@ 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); + + osc = DIV_ROUND_UP_ULL(pmc->core_osc_time * 8192, 1000000); + pmu = DIV_ROUND_UP_ULL(pmc->core_pmu_time * 32768, 1000000); + off = DIV_ROUND_UP_ULL(pmc->core_off_time * 32768, 1000000); + if (osc && pmu) + tegra_pmc_writel(pmc, ((osc << 8) & 0xff00) | (pmu & 0xff), + PMC_COREPWRGOOD_TIMER); + if (off) + tegra_pmc_writel(pmc, off, PMC_COREPWROFF_TIMER); } static void tegra20_pmc_setup_irq_polarity(struct tegra_pmc *pmc, -- 2.7.4