From patchwork Wed Sep 16 02:48:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 11778757 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 B944714F6 for ; Wed, 16 Sep 2020 02:56:23 +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 872F620708 for ; Wed, 16 Sep 2020 02:56:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KKj8cqq2"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="aXvx/mVN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 872F620708 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=daTKJGR9vREMtKwctJNbVDuKu0S9k5EDVP1IqmIqKtQ=; b=KKj8cqq2hD27WcU1JDVIn1z4L DcitekTVVgB/hxd46VOaMHp9AIS3bzN+Uequ5KtNftSqa7k2fYNUq7j0ssDgY6cz6HdOYnI5z7Y/q ehkCYAnqzmX2o2hg9t4rTaEpRQUX7bCgSqDVLcWa+0KhQuudWuw/zVMg9tfPf6YeUInGq40OHrYIl ZzHr6NvQ/XSUHRZtDSz8HV9eoa9B0Ivp3p09pLR0c1yYoF/Pe6i1I0gTnVO3KpNcoU5GLA50kffDY I53NWic+C4cCWu03UZNagkOQR/Oz7AWVgtH64aTAoD6s3lAN9DAD1afAYMY5M0h80uAJT7NKZ2rIN 1SRDt09FA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kINcA-0004cr-St; Wed, 16 Sep 2020 02:56:10 +0000 Received: from mail-db8eur05on2061.outbound.protection.outlook.com ([40.107.20.61] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kINbx-0004Yt-WA for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 02:55:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBuBXQBJmeYp56C7YRjfyFlh6+tqJ6sWiWGG2L5K3w6Zt90fgDaHf1FuQanxoxXR4v8U0gpXC2mPqOsV3X5aP3G0QnJC4u1dnTISAZ4ERYEniWy2xj+ODfdTGJlxhZUteWHBW63hIFTcSxCxthLDRF68fbiGlK/Hxbpnka9/4F5FvKCRRK/i39hH5hztin/UGGvpBaUb72TpvVu9G0wCA6U0QlSpwYbp6G+Z5ExoQoGmFHZ8uzHT4HAEzreHuX0I4oh15+Tpy3ZfttVsQwiSnHu2F7kR79qa8OqmfZDs+k2kiNNLVkLOcTjKh5hDI7Sun/EfOpUbwZJU8I3qWh/Zlg== 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=tQGEwU6mhVXJnZUNK2mGmKwMpV43P3jw6Cc6Ob7/2lA=; b=R6yhotRP2OzlTW5T46WHUnu0v/hTAKDvXcO09A32j6Baj1hJdQymYDJnBV08b4eaMw57wBmr5XeAS0t3iLSBmDu6eeBqKTOjIvQ+Q+59yYldEaIVxTnMtLLRXBN4/y1ex9x6HOewR5RpSi4GPGooUzIgpvIr2H5hTnipBkfILB+lPmuDuitVUElAUkP6us/eDfBL7SXS9V0VIZWKeaxQC79IbLa0nE67wTT/oc2otZ6cdHzNRxZwgfzYGlAUHpv/CaogVcMDIYm8jRIB/jf9qstY8tWx7TGgbRJirNRjY7noTxEbMdF/FYSMMmj8x/+sXOWNVKvQUZkDjgs/U5X/6A== 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=tQGEwU6mhVXJnZUNK2mGmKwMpV43P3jw6Cc6Ob7/2lA=; b=aXvx/mVNnXANmwdiBsOz5WHLte54+i0nVNRAGBFTuoYuNtozduA6FDug908s+HRzdZRgfetoyLb/v+506nDYSZdJ1UUjB28ZCC2xYt12XQSyYikuNJvuJEJlsnNlB8CaO2qttFbr+aE5oMOvKOHdEW8oyhwa4Zw/JoW43GL257s= 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 DB8PR04MB7177.eurprd04.prod.outlook.com (2603:10a6:10:127::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.17; Wed, 16 Sep 2020 02:55:54 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 02:55:54 +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 V2 4/4] ARM: imx: cpuidle-imx7ulp: Stop mode disallowed when HSRUN Date: Wed, 16 Sep 2020 10:48:37 +0800 Message-Id: <1600224517-31465-5-git-send-email-peng.fan@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600224517-31465-1-git-send-email-peng.fan@nxp.com> References: <1600224517-31465-1-git-send-email-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR01CA0165.apcprd01.prod.exchangelabs.com (2603:1096:4:28::21) 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 SG2PR01CA0165.apcprd01.prod.exchangelabs.com (2603:1096:4:28::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3391.11 via Frontend Transport; Wed, 16 Sep 2020 02:55:49 +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: 33d56087-e325-42a1-b60a-08d859ec0767 X-MS-TrafficTypeDiagnostic: DB8PR04MB7177: 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: pghf5VcVGytp0wfZ85czEUDHerJAOoR9UjQ2t75n9+lh8LoU/OR+CYSTxtoVDCtL19YRKi/kWX0j6YiYwC+LEZfIJ/VJOFC91X9pJ+M86ffc6hbmul9HewNAvXN03q7Nkc+prrtS50JA12WdHGWcGsDT/ZaJ9j/lvnyeNPTTxyridIqgjjOVcXWWaczdh8ZOsYmOxtEd1IDk+f2/5AbKVlBQywwZybfw/azp5VAgnos2YSnOUsdA51Vr6g7nZ2MO+9KFdLkJmRpU2ErzNeFqtDXKebki08Tjx1CSPEAzAICt3jrR9xo9NebQ1EC5RgpjDx9cJPsIRhsrVyrMKnrAXEZ6jvx3cd5xyZuFioFOphu2APv1NmeISg+Hra45KU1Q 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)(366004)(52116002)(498600001)(2616005)(2906002)(6486002)(956004)(83380400001)(16576012)(36756003)(86362001)(8676002)(4326008)(66946007)(26005)(66476007)(66556008)(16526019)(186003)(9686003)(6666004)(8936002)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1i2jgOI3hyNVnOvljJwfslQWZgMsQ4PByssPqHIAk2LQdCPWq7sEbVGg6aNGZkc2b65oaEX5WTS8BleSf1myzZnNW19agKNDJzIUr7mIO+2g/Eaf2zLZZRMWn6fRqKpZLjqh2vUljDteQmzrPQW43pHuavzMvjDhk+oSpJhT5QpiA63R17rZK2tkrpp8YZYRAmKwmu7GvsCJxkvM0KcJcHe7IdwsTlopspMapu5jpGOMZTcW0fDXoLcdP8soEh5bn0BwjEVYf1xK2KvzoVnx1wEvNzacUYLmW3h6pmhL5EVH5zJwBfAGFqVal8jtKv/by1PrZ+u8HWkxKsFNl1sc3gl2O2Zj9ePbceSsGTy1dahbyG58pl689lT7grpCJCu0U0hEcGmWvSyAJIzhg+hhn4qkpr9f0++WtWZQunpXS0NeVUcURVKGxv4Y/EXn2GEpdL8H/gQ23IVehW4S274qhxPYKuaG707Oe2YSUKgsP78AB5N9OmjsREV+SHiWtV2GXcrQpVkRX8rFfAxqOZMnrFzavtX3OMLpLbO2K73bgCFGo3V/Q5SJ4BAch+dMMUD9+9MLZhtYBFr3KC6qTPuQZOAbPEUcMwXGcDxC5GylxYwtVvp8QkmT1n3zxQCkAqTAraqx8wpDuB2AEvYybABZ+A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33d56087-e325-42a1-b60a-08d859ec0767 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 02:55:54.6715 (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: FORMuXKh1AI5rT3p+OLWwhdgmFKYj8lBBpQX4C8eBBfKEuhOGS/cii0xL4Luj++fWk+uJRwq9fI7qrMuIQ2C5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7177 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200915_225558_277186_1ABDD3A8 X-CRM114-Status: GOOD ( 16.35 ) 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.20.61 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.20.61 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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 Reviewed-by: Dong Aisheng --- 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 393faf1e8382..1410ccfc71bd 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;