Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp1810414imc; Fri, 22 Feb 2019 11:36:38 -0800 (PST) X-Google-Smtp-Source: AHgI3IazW3OooGmIEC3MwILDekJtvqUk272K4yQjUyjTDCpcm6sTknYdtPNOW0eidvPfOxkJuc6c X-Received: by 2002:a65:4384:: with SMTP id m4mr595149pgp.375.1550864198797; Fri, 22 Feb 2019 11:36:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550864198; cv=none; d=google.com; s=arc-20160816; b=YLWWrtq5d5YKdi0trqEDijFDFBJsfU3cNsuOJAm8Vz/8kl3gER0af69FyrXHWKXIis VEmiVuxhxhfWLqDm7BzxW6m+iQFpvWwVxrmTRz1ZIwwxCO+B1USlpsFY4rrGswUqsTxb Su/y7b+vrvnQ6pRk+tvBGKEJHbSNxlFc62CrxB5D3FTt/Bnhuzw8mAPyzLTl1tG4lM1M zawn7/opvdpUgbBkwIGWZOdfsfc323Z9WIJ9HFUel5iGrLjGExqRWvNZ7eWGVfk6agXV EzotRd9ggmFGMX5v//hYvJ4Mf8MnsKI+oOLQTGwdSLx8cN1F5JMVUEixQ7/4cLg4wPgo cc9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FgOYxchHGlJHFmyyLBfbI94R8PKLM3DDEZqKom9TK2g=; b=OZa9+gTkNqOfQ/JmNv9JwuOogQT7mnYCwaHVQD5H6y4xTu0Qktyfp4UHBuynAYiS8+ QMbyjoTs5TmbakeUpwAmOTtedeEdQXZtS8ZW8mu0Ey0B0WXkFNAroJ39ijNdHfg88Hmy 9Bh7dHxt4D4T5AetJq8ogm6MbD2wa+qbZKteb+tkg7iPtE0fggvkg2FJd1yP208wrgfL EGHIT1ZV5iLrzE4GTmxL86BJMWrwx70vRiVU3QN68GtdkQZyf1ieOva5ncs9Wn2tm1kw skLTYdYxZFvsfq+XtPQDpOU49yTwoQsTJYK8sDNu2abWAUH5E45vslXox/em0xcT65YV xL8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LQSTOIEV; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si2140586plb.146.2019.02.22.11.36.23; Fri, 22 Feb 2019 11:36:38 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=LQSTOIEV; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726783AbfBVTfn (ORCPT + 99 others); Fri, 22 Feb 2019 14:35:43 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:46334 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbfBVTfn (ORCPT ); Fri, 22 Feb 2019 14:35:43 -0500 Received: by mail-pf1-f195.google.com with SMTP id g6so1528179pfh.13; Fri, 22 Feb 2019 11:35:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FgOYxchHGlJHFmyyLBfbI94R8PKLM3DDEZqKom9TK2g=; b=LQSTOIEVpCycnBnVFTGzDZy2oq5Q4gymcQHesjT0EFkQM3UeGupDz+JVmdqT7tGgvD Mz9sPmEkQndNpPNgKGs4HE9a/qxYQeGT5VD3wcwlLJlch446BahDBzc/RIB6ay3DrUFn 5+wcH7cN3aOQMq/eNDhtkbvTzJbjw6dd0qjmzdyLeAJ58FsGos+mtvm0ZY9nme8sgh0v cerjrC4ApQ2b7mRV5CgECDhpcMvfqRS5RWbN2j5vXfilPaKRygoA+cL4I5bV5k5K6pKS +tJjt2ks8e61tyD8crrGW2JJZfvk2UTOstaWQMosa04cnKpC1oM01Aa0PP4+DuqSYuoC vxXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FgOYxchHGlJHFmyyLBfbI94R8PKLM3DDEZqKom9TK2g=; b=S/9QDX+tN2qvCtiJ5pMM5itU0thj6cy1dde4Pa/TbIHPlBitPoZM1xfGWm04s9qYh6 U0mbPdGeUOi7JhsBfDOBVTFn8rSx6tblRYmmov+jAcAS7X0FwVduQrzWpl/LBfP1AQn9 RBMdui89CHf1gklQhIgIoBhrHm8GFg2TrKVHq/aEXqLqEcqxMLpNTp1eBnb+Iw4VrhxR MTIcIN1J5JryFc06IY5wlaUyHdikmdpUoHM2N1hV28yki05QjnnkrGgcya2Xlw2hh/F8 at8GdxFXuwbswyZ9L2EYqzjgKdQGuF0VgtadfLce7z14OGdRpPtvskuFXFQAPlPPw1xe jBDA== X-Gm-Message-State: AHQUAuZ/C5FVHKwLYQGGNAzYKeXwC3szOWP7oMUwGne0g115MCBZ5ERd 52qYGcpyVkW28QQhVW+n6Ps= X-Received: by 2002:a63:104e:: with SMTP id 14mr1590390pgq.185.1550864142612; Fri, 22 Feb 2019 11:35:42 -0800 (PST) Received: from localhost.localdomain (ppp91-79-175-49.pppoe.mtu-net.ru. [91.79.175.49]) by smtp.gmail.com with ESMTPSA id e21sm7687190pfh.45.2019.02.22.11.35.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 11:35:41 -0800 (PST) From: Dmitry Osipenko To: Russell King , Thierry Reding , Jonathan Hunter , Robert Yang , =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Cc: linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 2/7] ARM: trusted_foundations: Make prepare_idle call to take mode argument Date: Fri, 22 Feb 2019 22:34:21 +0300 Message-Id: <20190222193426.10747-3-digetx@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222193426.10747-1-digetx@gmail.com> References: <20190222193426.10747-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Trusted Foundations firmware call varies depending on the required suspend-mode. Make the firmware API to take the mode argument in order to expose all of the modes to firmware user. Signed-off-by: Dmitry Osipenko --- arch/arm/firmware/trusted_foundations.c | 29 ++++++++++++++++++++-- arch/arm/include/asm/firmware.h | 2 +- arch/arm/include/asm/trusted_foundations.h | 6 +++++ arch/arm/mach-tegra/cpuidle-tegra114.c | 3 ++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/arch/arm/firmware/trusted_foundations.c b/arch/arm/firmware/trusted_foundations.c index 3bf61a5933b9..c496f4cc49cb 100644 --- a/arch/arm/firmware/trusted_foundations.c +++ b/arch/arm/firmware/trusted_foundations.c @@ -67,9 +67,34 @@ static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr) return 0; } -static int tf_prepare_idle(void) +static int tf_prepare_idle(unsigned long mode) { - tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S1_NOFLUSH_L2, cpu_boot_addr); + switch (mode) { + case TF_PM_MODE_LP0: + tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S3, cpu_boot_addr); + break; + + case TF_PM_MODE_LP1: + tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S2, cpu_boot_addr); + break; + + case TF_PM_MODE_LP1_NO_MC_CLK: + tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S2_NO_MC_CLK, + cpu_boot_addr); + break; + + case TF_PM_MODE_LP2: + tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S1, cpu_boot_addr); + break; + + case TF_PM_MODE_LP2_NOFLUSH_L2: + tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S1_NOFLUSH_L2, + cpu_boot_addr); + break; + + default: + return -EINVAL; + } return 0; } diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h index 34c1d96ef46d..6698272bbcbf 100644 --- a/arch/arm/include/asm/firmware.h +++ b/arch/arm/include/asm/firmware.h @@ -24,7 +24,7 @@ struct firmware_ops { /* * Inform the firmware we intend to enter CPU idle mode */ - int (*prepare_idle)(void); + int (*prepare_idle)(unsigned long mode); /* * Enters CPU idle mode */ diff --git a/arch/arm/include/asm/trusted_foundations.h b/arch/arm/include/asm/trusted_foundations.h index 00748350cf72..cdd48ab7d191 100644 --- a/arch/arm/include/asm/trusted_foundations.h +++ b/arch/arm/include/asm/trusted_foundations.h @@ -32,6 +32,12 @@ #include #include +#define TF_PM_MODE_LP0 0 +#define TF_PM_MODE_LP1 1 +#define TF_PM_MODE_LP1_NO_MC_CLK 2 +#define TF_PM_MODE_LP2 3 +#define TF_PM_MODE_LP2_NOFLUSH_L2 4 + struct trusted_foundations_platform_data { unsigned int version_major; unsigned int version_minor; diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c index e3fbcfedf845..3b9af4766cdf 100644 --- a/arch/arm/mach-tegra/cpuidle-tegra114.c +++ b/arch/arm/mach-tegra/cpuidle-tegra114.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "cpuidle.h" @@ -46,7 +47,7 @@ static int tegra114_idle_power_down(struct cpuidle_device *dev, tegra_set_cpu_in_lp2(); cpu_pm_enter(); - call_firmware_op(prepare_idle); + call_firmware_op(prepare_idle, TF_PM_MODE_LP2_NOFLUSH_L2); /* Do suspend by ourselves if the firmware does not implement it */ if (call_firmware_op(do_idle, 0) == -ENOSYS) -- 2.20.1