Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6268320ybi; Sun, 21 Jul 2019 13:30:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBiDXqFG/293sNw1vUYde3j6tdYZR3kRWuM5EV5sAot94Bqf6BuAf/zbskXwVzsbYSrz0l X-Received: by 2002:a17:90a:9bc5:: with SMTP id b5mr73623089pjw.109.1563741027717; Sun, 21 Jul 2019 13:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563741027; cv=none; d=google.com; s=arc-20160816; b=aDer0Tw84e3URFXMz/TyA6rPywg+Z/QXH26Egblvgtotw/BDby4x/aNggq7STygx+A eeMOJbzZvCKFxFjyAzNn9yvN3xjsXEK6NDXTnXYPcb5dVQPxTuU5MCuatn8uL0wJjnFd DO5iO/cZ05AtPFaeC9oyxC+tMt1tVpYnniV0eSle9nM9xdDck7ZC9ZB+lTx3nU4X6W57 NPd98+R0AiELseOTSS94fI47vAs+t+pjcNBDu+kTM6lZnPkqdQ0ZtQTEUPLsYImnlZS+ EFa3mDVGt9h1y0HxsWkgNJiLjP8qVmd8df7WMlNwed1C65P9vLDbduvRXv5yZxAGCDKC Ajpg== 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=Jfk6xJnCfov0z3hLLm+3iLOW+N0kk3KDGipzWIXZYNQ=; b=wYllNwbYNkX37gY2xG8bBiqwwwy0TiKldWsVPKU3LB37D3DeB6Tm0N9SdtQY8sxmPP aiUWaemvY6FK89pgum69HpACMP/NKEtRRbiLTzVpill8RvYOt6XrXxrTJp245bDOlS/3 BltYfJMzTaRCAERGiaRZUOlEuYU/MsTs/QwtwYUHMFm4lrGUnQoBU014tyHrMJE+tQVm XaHnZZt1sF4ONnDteNAPhkloak+U80a6BiGaM5LYDFx1jvwagB4FmlGbgaRKkx2xwPkX bOAnTsQEU3eUqdrHZ9EZvrH2ep27C0gLZlZiZ2yUdbhhcl7vPwTIGfTVcB/y0AUsJGeE bcXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=aehCUWhP; 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 p13si7888036plo.33.2019.07.21.13.30.11; Sun, 21 Jul 2019 13:30:27 -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=aehCUWhP; 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 S1727878AbfGUTlc (ORCPT + 99 others); Sun, 21 Jul 2019 15:41:32 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:15879 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727779AbfGUTlX (ORCPT ); Sun, 21 Jul 2019 15:41:23 -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, 21 Jul 2019 12:41:29 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Sun, 21 Jul 2019 12:41:22 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Sun, 21 Jul 2019 12:41:22 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 21 Jul 2019 19:41:21 +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; Sun, 21 Jul 2019 19:41:21 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Sun, 21 Jul 2019 19:41:21 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.2.164.85]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Sun, 21 Jul 2019 12:41:21 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , , , , , , , , , , , , Subject: [PATCH V6 19/21] soc/tegra: pmc: Configure deep sleep control settings Date: Sun, 21 Jul 2019 12:40:58 -0700 Message-ID: <1563738060-30213-20-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1563738060-30213-1-git-send-email-skomatineni@nvidia.com> References: <1563738060-30213-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=1563738089; bh=Jfk6xJnCfov0z3hLLm+3iLOW+N0kk3KDGipzWIXZYNQ=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=aehCUWhPKxIv6/mfsdgcRFAgK00Zmz00J5lYwPTdxg+aWiarZWK7KxhmySntxEWVR 5/DTJkiF2PNOrTNqhwJwdPCmlduicZsuvd3gNXKdXlHIko9ZNVje99kjtuYM2GLhJr fKPskXU+axzkIm2PPoCfRzprEzwFcFCikZ5DZKjd4Zc3xcBq1b4ZS8F7LkZ2QgNgcm RXMHgXZLj3XB96IDzYG2aKG9IsyZa5NwAlE5WAvPKoBFt/qNG3aua0TsFg+o3iekGj Oy5TkZ5wbkq1A26ZH9Wd8dQznUhsr8j5HAVe87ShgMTGQB2J8XDljE+ibjNIlSZS8t Qj0E3CUaH1JjA== 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 7521394b94ab..16df35bdbd4b 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 @@ -2290,7 +2292,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); @@ -2316,6 +2318,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