Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1918537ybd; Sun, 23 Jun 2019 20:04:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAm8SvfRgTcLpPazn9g47p/a0VhGPfdNFTSTlOazVZAbf/yec4TiEEtA977lEaZTi9zmB/ X-Received: by 2002:a63:2109:: with SMTP id h9mr30896818pgh.51.1561345481591; Sun, 23 Jun 2019 20:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561345481; cv=none; d=google.com; s=arc-20160816; b=wfnM0s9TY1je/xtJG1KvXsmOoIqjSyylnn0TvWes0imVZXWXCZysyCRB7fKEX8NF2i OJMtSNkzOnOFmIY2Fei9rDILKEvCjzE7uk6tuvP/fL9L7mIYsk+xD0vderUMoaMViyCr vTkth+KXyuLn/Yp7KXAYIds3+dhzGyPTl/MOAJbbUh63Tjv4iiRg6OVahMeHV5ecjm9J Nmm70gTTOzHcLXOUZD0leo4uxfcQyzTLmDGse+ehZHcqK3C/b3CiRFIA7f55UcBaiH+f lWeSenajC/7sKAxzbBdBRhHD85D9N2xatZfBGhxUgGQYmBC6BXA/zK9nR3lYGGv5wk0P ILbw== 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=nQJmjDHX/yyz71fC5Ramf2lDdXrwkLYirADexX5oFCU=; b=LnctpUrvvhYYiEigvEi00ovTolhq4FcHHi73pz3SUv8Tb3K9xmmvPaRvl+8yzQcFEx Oe7DNokg6S0hzEY3B2hqX7nuDp7q4npsH2CNrhdKMSfkAev6gl7dqS93eYWgiZuyTfZb AQDVzcNTT6zrfGmz+z5UndsP41So5Fom8conWyBDpyb/H4uQ6B5g8+z/5bzc0MIbWuIy 5WICvXIXVvZg3QO5I99sqi4TkKdn4e6boYJSwTsAecfPYkQLbSL1vaDFlS6l7jawXgCD /V/8zNNEy762rHZpP7J0ylQIQg9prnBFWIbsGsTSpjm0WJD8whyyaw/12SSaWlemB3Sz o3tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ampYINpX; 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 y8si2904883pgq.134.2019.06.23.20.04.26; Sun, 23 Jun 2019 20:04:41 -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=ampYINpX; 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 S1727619AbfFXDD4 (ORCPT + 99 others); Sun, 23 Jun 2019 23:03:56 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:7426 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727028AbfFXDDy (ORCPT ); Sun, 23 Jun 2019 23:03:54 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Sun, 23 Jun 2019 20:03:55 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Sun, 23 Jun 2019 20:03:53 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Sun, 23 Jun 2019 20:03:53 -0700 Received: from HQMAIL102.nvidia.com (172.18.146.10) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 24 Jun 2019 03:03:52 +0000 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL102.nvidia.com (172.18.146.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 24 Jun 2019 03:03:52 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 24 Jun 2019 03:03:52 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.2.174.126]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Sun, 23 Jun 2019 20:03:52 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , , , , , , , , , , , , Subject: [PATCH V4 17/18] soc/tegra: pmc: configure deep sleep control settings Date: Sun, 23 Jun 2019 20:02:58 -0700 Message-ID: <1561345379-2429-18-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1561345379-2429-1-git-send-email-skomatineni@nvidia.com> References: <1561345379-2429-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=1561345435; bh=nQJmjDHX/yyz71fC5Ramf2lDdXrwkLYirADexX5oFCU=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=ampYINpXhpOmytKw3B1PctUPS6m6JnohTG9U5A5THCGZeSWYt/4ZfpU1VMOH1XDTm FtTMWVMKX/snj9ASoCGM51jAPwA7JXsdkvtxsAX+zvd1JA+my8kPjZxs88u+gx6mQz ewy+9bHCP9BWVlUen+pm3J+nFsdSz+tfwsSJyxqs+uZSQWRaxYv5KbRWGHNKB9MVOG ipxed22Enwq0VMUWEPermcXNwlMNCs6Y9wJ5dRQSesyyJVD3SkIR2kevZcQ/67S7Sj MZtG55L8AnWl/b1V3rb4BY9VpSlc2G8Uxa7wBCWxbU2bcsUSle7VfGP6SRYB+mAmSN qQJHo2XLZ40zQ== 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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index c9eea5ef008a..1b2ecda88a26 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -89,6 +89,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 @@ -2292,6 +2294,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); @@ -2317,6 +2320,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