Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7473824ybh; Thu, 8 Aug 2019 16:48:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwf7Nqj4PCp/fc09DREOpQZsJJmj1D3QliIJYjxTnwRIIcg2hCNywwo8rty/w8ABz/6om0J X-Received: by 2002:a17:902:b48c:: with SMTP id y12mr16043856plr.202.1565308125556; Thu, 08 Aug 2019 16:48:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565308125; cv=none; d=google.com; s=arc-20160816; b=baG1JbV0JjT2Ydk+kCZNpVuizf//c+bjL91xWNu3NaCfazuqCgoDdJ0ujpiJzljOsA AlfM6QCSLkLtzrDgMgNDmPUL3rSTB1kJ+tJFagWcO/iAJAYjONnwRuR+irUiZY4xXNC+ ua7aXkLcWMijkQxT6aIFplgCRzYVWjRZq0O00Q0B9oDvkNESdWacVjf/8Fn1XHI5F6eo AZndZqM35sSpoO69UwmHQewkn8Qitdue17dVbK5ZjmV74QLhFW3fJdrFRRC/ZdWxXO0s Izp/6XxSK2hByg5OUd35uwYeWTpP7s/Hbo5rbsqFzFr0DhCHgZ9bJ21m6Qmu6LAObAqx Q/Hg== 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=e0L/CBaNsglm/ojFaoC8UfipD1BklMJFbKMEJWbcTJ0=; b=uq90pISpaAeMhiNoFTrE5+WPsHjBkx4vRqs9nQFfESPl0bXyNFtrRS/yno3tXGL2ph +I+8qqdfccWPUw6MYdUZTurarHOhMkP55fjxYtaHBQBeRvX+xgS9lqIPdvEmTzs4zFwr 1JHtRUEKNuCrsj+8gjxib0L8FSzGQmGNjRFd3GAbjQvDdinO9lVqlkQmmpthmPlXJX/I Le0PEIXAdtuez4UGKLKA+cnIJL32psLRYpXp11HHm4ITOlA80UYMxUv9YFcnBdaxJXwv 7QNyeu1cDYwNaW5OZm3sZCcmQ+xFaf0fuSz2yDbhTmFBuVmxSni7HlKl8dZ/VgZoKf5A eGow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=SZJnhw2D; 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 u10si4898550pls.385.2019.08.08.16.48.29; Thu, 08 Aug 2019 16:48:45 -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=SZJnhw2D; 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 S2405132AbfHHXri (ORCPT + 99 others); Thu, 8 Aug 2019 19:47:38 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:12801 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404955AbfHHXrH (ORCPT ); Thu, 8 Aug 2019 19:47:07 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 08 Aug 2019 16:47:17 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Thu, 08 Aug 2019 16:47:06 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Thu, 08 Aug 2019 16:47:06 -0700 Received: from HQMAIL110.nvidia.com (172.18.146.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 8 Aug 2019 23:47:06 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by hqmail110.nvidia.com (172.18.146.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 8 Aug 2019 23:47:06 +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; Thu, 8 Aug 2019 23:47:06 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.110.103.110]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Thu, 08 Aug 2019 16:47:05 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH v8 19/21] soc/tegra: pmc: Configure deep sleep control settings Date: Thu, 8 Aug 2019 16:46:58 -0700 Message-ID: <1565308020-31952-20-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565308020-31952-1-git-send-email-skomatineni@nvidia.com> References: <1565308020-31952-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=1565308037; bh=e0L/CBaNsglm/ojFaoC8UfipD1BklMJFbKMEJWbcTJ0=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=SZJnhw2DcyN4FNHQZlK52o0Zp9OrKfSmVuP6AYxOGt85Oj8m7+TfYj+7zSdxgT3lD nHaOaFqFAtJB0DGHXZnHQfYFTKUhZ6+xt0J/EgMPdIYK5Y3I9KAYccRSOss6HD5A43 /AhTrsiofwOE91jAHyTk+7EILXD+tn8lFRuBzUUp7h0UF3FUkJScWLUv/1dc2wiPPM ai/NcU8QzVCF8PsUsf6IRzUvQTWVMC0G/lSAKmG3rSgqG76/NhpanEm9fflki6hKPB 6ZCT4d/uWMqv8+YImIqgK0Ai46+fkZfZ6S7AqnHTE2xNwQLIobtQcKpdMjBZHYgM9H G3IhW8hHm3hTA== 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 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index e013ada7e4e9..9a78d8417367 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,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(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); + 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