Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751718AbdL0CPB (ORCPT ); Tue, 26 Dec 2017 21:15:01 -0500 Received: from mail-eopbgr10040.outbound.protection.outlook.com ([40.107.1.40]:59840 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751266AbdL0CO7 (ORCPT ); Tue, 26 Dec 2017 21:14:59 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; From: Peng Fan To: shawnguo@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, van.freenix@gmail.com, Peng Fan , Sascha Hauer , Fabio Estevam , Russell King , Dong Aisheng Subject: [PATCH V2] ARM: imx: suspend/resume: use outer_disable/resume Date: Wed, 27 Dec 2017 09:57:47 +0800 Message-Id: <1514339867-28946-1-git-send-email-peng.fan@nxp.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [123.151.195.53] X-ClientProxiedBy: HK2PR02CA0189.apcprd02.prod.outlook.com (2603:1096:201:21::25) To HE1PR04MB3228.eurprd04.prod.outlook.com (2603:10a6:7:1b::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 79d5b295-f8b7-4b3b-65df-08d54ccf9df4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(48565401081)(2017052603307)(7153060);SRVR:HE1PR04MB3228; X-Microsoft-Exchange-Diagnostics: 1;HE1PR04MB3228;3:jdYU6fzeUvr1qCop2ZSv2ULejZhpx7zcpuL0uPcN06U2iD+Potgu2pZ9B6ugUR6jBBRyZNPh1yzCctVjCTqVhAYHwYji30jrlqV+M+1PS1WA1NII2UJg7LdFLXqEbx8noS8K3QNLLZlrVb8lQX1MeSF8B4ysBfwNJ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ldPuQzukBidFnVdDVZMdx8yNm5Liomvf8wRJdqd9MpSrVBH9QZD096TXylmHQFeVI4Lh6qhE3glfsvewphJEKX9OH90991GNog1SrXemhhNGB9ekllXL58cM2kJ1Az4syyLZjwTq5Rf2K91uvJH3nSdmmfwDAYrLdjhJ04lNB8QEiCZ3mIPnqk5XJ8f;4:5TxFxiW04kYswDILPK8wlpJ4SL93b4Hb72f6YBim2HRk7dejWg4vVD6ygdQzk0tq7t3Lyra1jYiCz2jzH04CSuXuJwwUlkkptXrKYTszlO8v2+A+rL4UwppPQqG2+kDp9aM1gPpv6yqZrF+sr9cBrvM2ODJaHuj+KWA/k+RJzrijWejnuIHWBNSGQc3p9xLyRlRof6ihsrBUBzIGKms5AN9JEb/CZsj0p1/E+YIYgBXqvJM1qUqpoV7zagd5YMdqF26A2bNPKnyikRJH4UC2z4AuhZdqbKzIQ40hsgGUuvaOkRkwCDJokb71Ri+Qsmcd X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3231023)(944501075)(3002001)(93006095)(93001095)(6055026)(6041268)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:HE1PR04MB3228;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:HE1PR04MB3228; X-Forefront-PRVS: 0534947130 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(376002)(39380400002)(39860400002)(366004)(346002)(396003)(189003)(199004)(50226002)(51416003)(2361001)(2351001)(105586002)(52116002)(47776003)(50466002)(48376002)(16526018)(6506007)(316002)(81156014)(81166006)(106356001)(386003)(36756003)(8936002)(59450400001)(2906002)(6486002)(16586007)(66066001)(3846002)(86362001)(575784001)(6116002)(8676002)(53936002)(97736004)(5660300001)(4326008)(478600001)(39060400002)(305945005)(7736002)(54906003)(25786009)(6512007)(15650500001)(68736007)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR04MB3228;H:shlinux2.ap.freescale.net;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR04MB3228;23:S9lTCGjryptlwA6FqZDx3+Gz3GgzEOdFGWywkIdPM?= =?us-ascii?Q?3cCHyjhbEeM8Ii+aObVmwKHmcbMf7fK1bRTDONmKsg4dS8jWUo4FJd/GbrvM?= =?us-ascii?Q?3Yq6H29eQ6WCZxeuawQ7nmfPv3QM1hwh+oVR9qB/ylVekFYdgCauYCx/1whk?= =?us-ascii?Q?aMgQJoFbdqLKh9mReusiADnB2YAy5LST2TTE3pEcNdypi9/Ei1NWstmh4fPb?= =?us-ascii?Q?X6oW3a3+qp9wB2VBcxPQA9EuPgrzS4WPyqde9sjRt7guLaxRvBNHIQkRA5I3?= =?us-ascii?Q?UnQS7V9IiOBE3OE4rP0c6kWAPAAMlaaZbCFATotUNdaCqodHPZLBGHmScDT3?= =?us-ascii?Q?DLkCs4gn6ZjtTw0H1CN1SQtc21qYCtXAGYorFVFduP9YuKbrYi5i4V1HBVAs?= =?us-ascii?Q?Hg1rYGRmothL+raUomG9VCDxwF6qNmjcup3Tf88Dw9awGs94zoDC7gfzZiU4?= =?us-ascii?Q?pUvmr6KSVf2CiTQ7yeNIb57HcJjAUjtl6zPpJnNLHnrDRDnKtZ/UR+LqyjU4?= =?us-ascii?Q?m8qK4GAUD/rVXiK/lGtM6f1Jl87QWE5CP+4j3UkgVq8ZDWBL0J2Uoa0jqhla?= =?us-ascii?Q?fSZjd+133tyU8OKKdi8cWatPu83FAJj+GZxa+2cUwAern8pJouEvvoaAUp7d?= =?us-ascii?Q?fUBqiv5h3/igiP4Vd+55Ug9KFtIi+k7t3a81HROktm7GwAPJXmS7Ps7dn+pa?= =?us-ascii?Q?RPt2idEjRO1T98NZ3ku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ef4ti2hgy1hfc0jG6ftSTfa2k3wXGLvQnGyuhqIFY9q6khnpD2Pd+S5Ml48o=;24:mzCZZ6FW8+1gNHckSAWCA6b3fitvv04Qv1si1zkbIuNSPLABlz2CffLLRqclbxPjIBafmYZDxDEXlV3bUa+V37eKDBdX0HYve/u0SxGxGCA=;7:v1cPVQRnRO+luQSwMyBi86D5pTisTZFHXwDuvlTk3fcpTQcPv830c4NhPpCtmmV2AY/lNALdjbqxHWE2tKfvopQBXmLCoNh7bTpJoXbhWxNB5zSSbGJ/EYo2P2TQRhAZ4yz7COy9vip6f0X8+2WIkaz9ngfTfu3Y1oPF10s8sNaeHAxwgoIOvSNlcDYSqbPiXN1M3kx7zHTEeC4M3meiQpDYoVC1HftLtHtFHSNsubNJmTyw+na841zyxDOP1K+y SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2017 02:14:49.9617 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79d5b295-f8b7-4b3b-65df-08d54ccf9df4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB3228 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2816 Lines: 102 Use outer_disable/resume for suspend/resume. With the two APIs used, code could be simplified and easy to extend to introduce l2c_write_sec for i.MX platforms when moving Linux Kernel runs in non-secure world. Signed-off-by: Peng Fan Cc: Shawn Guo Cc: Sascha Hauer Cc: Fabio Estevam Cc: Russell King Cc: Dong Aisheng --- V2: Fix 6SX booting. The V1 patch does not take 6SX low power idle into consideration. Tested on 6Q-SDB and 6SX-SDB. arch/arm/mach-imx/cpuidle-imx6sx.c | 2 ++ arch/arm/mach-imx/pm-imx6.c | 2 ++ arch/arm/mach-imx/suspend-imx6.S | 24 ------------------------ 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c b/arch/arm/mach-imx/cpuidle-imx6sx.c index c5a5c3a70ab1..b35841d133dc 100644 --- a/arch/arm/mach-imx/cpuidle-imx6sx.c +++ b/arch/arm/mach-imx/cpuidle-imx6sx.c @@ -49,7 +49,9 @@ static int imx6sx_enter_wait(struct cpuidle_device *dev, cpu_pm_enter(); cpu_cluster_pm_enter(); + outer_disable(); cpu_suspend(0, imx6sx_idle_finish); + outer_resume(); cpu_cluster_pm_exit(); cpu_pm_exit(); diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c index ecdf071653d4..153a0afc7645 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c @@ -392,8 +392,10 @@ static int imx6q_pm_enter(suspend_state_t state) imx6_enable_rbc(true); imx_gpc_pre_suspend(true); imx_anatop_pre_suspend(); + outer_disable(); /* Zzz ... */ cpu_suspend(0, imx6q_suspend_finish); + outer_resume(); if (cpu_is_imx6q() || cpu_is_imx6dl()) imx_smp_prepare(); imx_anatop_post_resume(); diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S index 76ee2ceec8d5..324f6b165e82 100644 --- a/arch/arm/mach-imx/suspend-imx6.S +++ b/arch/arm/mach-imx/suspend-imx6.S @@ -74,24 +74,6 @@ .align 3 - .macro sync_l2_cache - - /* sync L2 cache to drain L2's buffers to DRAM. */ -#ifdef CONFIG_CACHE_L2X0 - ldr r11, [r0, #PM_INFO_MX6Q_L2_V_OFFSET] - teq r11, #0 - beq 6f - mov r6, #0x0 - str r6, [r11, #L2X0_CACHE_SYNC] -1: - ldr r6, [r11, #L2X0_CACHE_SYNC] - ands r6, r6, #0x1 - bne 1b -6: -#endif - - .endm - .macro resume_mmdc /* restore MMDC IO */ @@ -185,9 +167,6 @@ ENTRY(imx6_suspend) str r9, [r11, #MX6Q_SRC_GPR1] str r1, [r11, #MX6Q_SRC_GPR2] - /* need to sync L2 cache before DSM. */ - sync_l2_cache - ldr r11, [r0, #PM_INFO_MX6Q_MMDC_V_OFFSET] /* * put DDR explicitly into self-refresh and @@ -342,8 +321,5 @@ ENDPROC(imx6_suspend) ENTRY(v7_cpu_resume) bl v7_invalidate_l1 -#ifdef CONFIG_CACHE_L2X0 - bl l2c310_early_resume -#endif b cpu_resume ENDPROC(v7_cpu_resume) -- 2.14.1