From patchwork Fri Sep 11 03:30:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 11769709 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF3AA59D for ; Fri, 11 Sep 2020 03:39:14 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BFC6C21D7E for ; Fri, 11 Sep 2020 03:39:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jDYCaZmd"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Mi/zLTJW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFC6C21D7E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eq6F3h+H/2NhnldpxX0fOzphDQrMSRs+Hzq7tVjXLXE=; b=jDYCaZmdpzzt4jQZVlkEcfBtE 26I6GePm49UqiA2GILckxFASvSk+4QJILqduQUaLfbORO0jxM+feu0M17Sn/xB5d1hp++FcLOzZtt XnKUOKLPdqGHL/0a0Q0sH4VlGGUxUw8VBF4ceDl17lSQXgNeRQfTKFF8tM3rkQpHFxL9lsA2jRnmL PuhpGrcWZu5tLWk9NteOfCTYXFIetY5OVwkfyne/Cr6xdJPYgwxrZR0Eala8rxm9JRRC+005N/9zB Qa7QxhENeYCrLEf6qZZhIgEaDvoRfPZrcRuJa+suVRTThJ3hjFVrJWVjojGsZpKT2aqv8HiP3nkw0 f4Z8BL3RQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGZsq-0004bO-CA; Fri, 11 Sep 2020 03:37:56 +0000 Received: from mail-vi1eur05on2084.outbound.protection.outlook.com ([40.107.21.84] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGZsi-0004Yu-0K for linux-arm-kernel@lists.infradead.org; Fri, 11 Sep 2020 03:37:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b32gPsQxW5IIOqhZRjQ1OmCktn8XjUO5r3YjPHQbLMFgrmZGOsmML0DLfKmZWnXk+zjskJ7Nv5uDD+8QI7mG5VFgjBQ2jwS3/43NMYULM82+hzaBGfzmQnQ2w4cSm6j014S37+HheM9B7ntoVsjL7c9f6w3ZJMZykn/ZlKUepJgvG/v2IdBGyfH/cWZ7KVFKcOSN+L522bef3HSi7ZIcKkP7dECUuS/p42C8mpqvKHnNrSXQMuN2XkYF5zuApMgjuwIdGfhXBXpvzNquEiHy12dvkEFD9Wyww6bd+Q3ZPvZRUzrSEh68YOr1LZGAYUVnVF6hS7AFSQckjFpukVRrHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IKJSe/PA46LdbLJDeZgA2CkRgSQKlIWylm5bM7qK/wQ=; b=K9WWyiPS+cx3AGGpr6awUm1g6OklsTU1G3amdexvu/v/HpFq8r69+l7KgMzshWc6TW3reULSgRNF6s769wfEBlooC2udwOwbYbuaIOE100RH8yDpebIpjGfmO3UBPbC+M4/bEvpO54p0HafxVL+Uxs0zsnEXg8C82RGDOulXMO+8JFGloSpePaggNYoqSBIE7BhJHPA8y4TXeoIwTwwCwFgQQWl9ciOxzEw3JNtSN3VBl1ysU5beQD4dx9oWYKAbJ5Fdf/PDFAg94Tj9Ws8qKzjHQx8j377KLtAy4P9VuX3tde9mM4XHSciayo7DHYzsr6rOCtgLqYKIKfnscnu+mA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IKJSe/PA46LdbLJDeZgA2CkRgSQKlIWylm5bM7qK/wQ=; b=Mi/zLTJWHz0cpbjPG3eSAYejJYFZ1kMw/Z6XQAcwTi642TCakpveJcXbymHkMS/z0q1Mu5hIB1FUSWoyHsvulVutKS+Bsq3bgV4+h1PyyCndgbeAniiMZ1g3Ma2rFQaEtUBLfXEZ5hHZIPSkGBPoYKB65RwzbQ5+znb9DuTrWgg= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB5084.eurprd04.prod.outlook.com (2603:10a6:10:1c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Fri, 11 Sep 2020 03:37:45 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::24d0:f783:3c7d:e232]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::24d0:f783:3c7d:e232%12]) with mapi id 15.20.3348.019; Fri, 11 Sep 2020 03:37:45 +0000 From: peng.fan@nxp.com To: shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, abel.vesa@nxp.com, robh+dt@kernel.org Subject: [PATCH 4/4] ARM: imx: cpuidle-imx7ulp: Stop mode disallowed when HSRUN Date: Fri, 11 Sep 2020 11:30:53 +0800 Message-Id: <1599795053-5091-5-git-send-email-peng.fan@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599795053-5091-1-git-send-email-peng.fan@nxp.com> References: <1599795053-5091-1-git-send-email-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR02CA0070.apcprd02.prod.outlook.com (2603:1096:4:54::34) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 10.192.242.69 (119.31.174.67) by SG2PR02CA0070.apcprd02.prod.outlook.com (2603:1096:4:54::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3370.16 via Frontend Transport; Fri, 11 Sep 2020 03:37:41 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [119.31.174.67] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3295791b-9f9a-417b-a228-08d856040bce X-MS-TrafficTypeDiagnostic: DB7PR04MB5084: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:64; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bvEj6lEEXIyreeq4ox1a3suxK7KZzdALn64b/fPmwwhOkfmiqIo5CmHN9EntjjxYs/pPqssZMfGmpbWcwAGLPVgdRcYvCAG7PsU4JqvuiJD45TRsVW9m+wEaGFJWV936DvGE7M0oRHSiezr7LBWLx9oy8kq/T0TuNH7hPlkfeNXypXGGmhFiLqkz41822EgsQNTcrVTshmWiYzHEfTilsA0L3hPtTQ3hxb3UdNYXi0rg9AnTPSIwRgAKFprTCa2MfLr/FkRE94KtBXcQRZ/qmj5LDQn1ZPTcwYCLUVSkpJtHp40WcIZv6p47EBy+NMOk19x7g24hdT5BljqvdDXkjg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(346002)(396003)(376002)(366004)(39860400002)(2906002)(8936002)(5660300002)(4326008)(66946007)(6486002)(316002)(16576012)(478600001)(66556008)(66476007)(86362001)(36756003)(83380400001)(956004)(2616005)(26005)(16526019)(186003)(8676002)(6666004)(52116002)(9686003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: lvJpmosTRWEwpJfiE30hyVZWUuf3bQGDHJgj4B2SwIAWCjiI8hjK+xfUTPd8Chrhdd2yuAThtDcq7BEvKFCdCJj4rQ3aR8ib2zn1yz905jn1ByG9W+hPH3/xNibEbW63zMK5emkfe0BQLx1UP0VjAEF2oPc6tM++3yCAv5IF+xEBnk3d6IfyABXz0Mym6Fx0wQPerwxX1n87slYCMC0hubM6QwKUKI3z3n3d0N4RIaoFy0fsmV4Bd2UWwV/mIsdCoN4/5gPAq0bDIYHIijsN4iJGq4NbBEbukENgx41yPXdeQwzgrwezpQAxTcRI99mtvgGnsY7SBDaJu3QlCoKYEJ2N/kmmKXyVSugAic6V7+ZiYm4QCN1rJDa31Y4yEesTi4pIifS1qxgZUk7sz4a3k9zmkoOrREv4fXMGb4Wl1sOGIGmrBqhYnt+iyyRIyTFfT+cf5lAr+FnQ+wbIW4EzSVvulRDCXAxilfSkVCRGl4EEkB3/eJXiJ9McjtNnIpVgCvJ5R0n2TYVcc+kud/OSPSauGTG7iGE2u69AYsiXeH7CUEqwvIWjH6ENYsOiAO3YsQ1FVOIllu9jUxxStJr1OP5QidtuEtXncEDBzABgBXy5NXAu2kKLg89EGYNoa8KnOdwDjJgX+IYnen61TB2/aA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3295791b-9f9a-417b-a228-08d856040bce X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2020 03:37:45.3113 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9Ua4gp47zYdvk+J1avTht6+qyv8FXg+2Tk6NgMerJZ2BulEwK0qfSIYEWMfXM9uZWkRJOS32+3gnIQgUZW+Pmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5084 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_233748_079181_1BD19848 X-CRM114-Status: GOOD ( 15.85 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [40.107.21.84 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.21.84 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aisheng.dong@nxp.com, devicetree@vger.kernel.org, Peng Fan , Anson.Huang@nxp.com, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Peng Fan When cpu runs in HSRUN mode, cpuidle is not allowed to run into Stop mode. So add imx7ulp_get_mode to get thr cpu run mode, and use WAIT mode instead, when cpu in HSRUN mode. Signed-off-by: Peng Fan --- arch/arm/mach-imx/common.h | 1 + arch/arm/mach-imx/cpuidle-imx7ulp.c | 14 +++++++++++--- arch/arm/mach-imx/pm-imx7ulp.c | 10 ++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index 72c3fcc32910..707ac650f1c2 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h @@ -103,6 +103,7 @@ void imx6_set_int_mem_clk_lpm(bool enable); void imx6sl_set_wait_clk(bool enter); int imx_mmdc_get_ddr_type(void); int imx7ulp_set_lpm(enum ulp_cpu_pwr_mode mode); +u32 imx7ulp_get_mode(void); void imx_cpu_die(unsigned int cpu); int imx_cpu_kill(unsigned int cpu); diff --git a/arch/arm/mach-imx/cpuidle-imx7ulp.c b/arch/arm/mach-imx/cpuidle-imx7ulp.c index ca86c967d19e..e7009d10b331 100644 --- a/arch/arm/mach-imx/cpuidle-imx7ulp.c +++ b/arch/arm/mach-imx/cpuidle-imx7ulp.c @@ -15,10 +15,18 @@ static int imx7ulp_enter_wait(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { - if (index == 1) + u32 mode; + + if (index == 1) { imx7ulp_set_lpm(ULP_PM_WAIT); - else - imx7ulp_set_lpm(ULP_PM_STOP); + } else { + mode = imx7ulp_get_mode(); + + if (mode == 3) + imx7ulp_set_lpm(ULP_PM_WAIT); + else + imx7ulp_set_lpm(ULP_PM_STOP); + } cpu_do_idle(); diff --git a/arch/arm/mach-imx/pm-imx7ulp.c b/arch/arm/mach-imx/pm-imx7ulp.c index 543ac69f5f70..eb1578f0bfa5 100644 --- a/arch/arm/mach-imx/pm-imx7ulp.c +++ b/arch/arm/mach-imx/pm-imx7ulp.c @@ -63,6 +63,16 @@ int imx7ulp_set_lpm(enum ulp_cpu_pwr_mode mode) return 0; } +u32 imx7ulp_get_mode(void) +{ + u32 mode; + + mode = readl_relaxed(smc1_base + SMC_PMCTRL) & BM_PMCTRL_RUNM; + mode >>= BP_PMCTRL_RUNM; + + return mode; +} + void __init imx7ulp_pm_init(void) { struct device_node *np;