From patchwork Tue Aug 13 08:57:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13761575 Received: from outbound.mail.protection.outlook.com (mail-northeuropeazon11013022.outbound.protection.outlook.com [52.101.67.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 320B11BDDC; Tue, 13 Aug 2024 08:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.22 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723538950; cv=fail; b=iF8aPM5nAnDCuamUzvqzl5ZjGokWRq4/oDOqGEIcJc9zm1bb1BrQSORrl5Rbrt6Bbmxad5CkPBWOwnIMevk5nt6zg9CPIAFuuAMYziN06YTefzsvPcvvd5yEUqMtVdsW5E/OtJP7zWBpzyHMlWsn1eKo8lqqju6T89JYVFFcEIs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723538950; c=relaxed/simple; bh=N/C5TVpJMZFWPe7xAxKVrFelFkn0/jzrCkpZlr7EVWs=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=VvL3YGn8J0YqS/itsxtW8NofmRw+0iZzMOBr7kHuYzzWePWzq/Azd6M6tbPQKEEzlyyPJj8UTHWqtX860CF+ThoHMMzcR/b2hmhtpHegiVcbffP3LQA80VFTrJMqqJCH/QU1D6iY4/oxmTXPQYIzTQM5/Z8bCR7dlUByj1YER+8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=UIJM+bMY; arc=fail smtp.client-ip=52.101.67.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="UIJM+bMY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oSsFqwov3YjgTvOGPwp/7LroOf1yQpZGL0agDfkZVHuvg1pg1xMVPrqVZh74zzzgMuR5ndhM0Wgj8Cts8Bbo6sHUBsjgZMg/z6rmig9ky5CInHjz423RzIbKCxC8lzSjOqIL9hK5bI/Cd9mBj/vfINAH+t0uWrWHTO4t9z3TWpdncf/SDMIpY0rA2T6DzY78130CBNXT2JhdJ0Fc9Mywl3LsMhir8/ZD3DtAjKe3MVKMGhzNtIgTbL9seAqktvEcRYdb38EMF20v7ldtXPrX7YgXdT/rkCpbj8xKizVyWjd/3/tHGFA0teWqIxAKVEQcfCNjOVBJMVQSq7e1pzBYOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SkPy3bXd/NT1EbLVQ4e2Q+MlKyFWfiMrZWCT85oy/CM=; b=xlXaD+sDSqOID4ui+A5l0S+1bB//rEDddd5mawUeu8uurvsCZmLxTRTNK87IFSIAlmG1uZCFWEIXJ3kppZQ4jozWH6FL+6vBNug+dlZXepX+HYurfEkf7j4m4Ow72pWxkufn3vfodxkci5D9Th27o6X1xG8R+6Fv3/18fc8si2CyDfKGORm0birWdczdIGwSdvjWhf7SnJt0uhIBdwcGypzL1qimQS+rZ4urfXmqRsVV5wnnegXJ57Fe8lCXuINMOXUKEseRDXAcw7PZj3jXXVI83QR01V25flfid02E7rOocBnXO8TlvKBJRMyVpJgeRGlf7PW8ZngWz/VbzIEqwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SkPy3bXd/NT1EbLVQ4e2Q+MlKyFWfiMrZWCT85oy/CM=; b=UIJM+bMY6IwJhvhbBxBEUznFSOjR1ZE+ixIwV9U+UasLnAxx3ECAtKTTziWvg9/o3kWZvH7DC1gT3zE4IEQRqGh2nBDBwWEpHnOWVImS4VzuLaEkxrpLr1UpyjNPi907mc+4VJzMD5sm7ItJe/RDCS1ptkf1NFHLCTm1bsE29jseeMKo6GFVvMB7IZkySizd5AMpb81kPgTHQkOJr/0KkJL15QYM6vSEGGAwuIx8cNDqd68r4T1OfDDvkRNXlpGMb59uvGVpkNRLY2GA59AhJTKkQMOCWnceHGwkzwb+oJzMxvbzqzL3z0JkpfILz65s+LYKY2QpCv7WfIrKXX2loA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by AS8PR04MB8721.eurprd04.prod.outlook.com (2603:10a6:20b:428::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 08:49:02 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%6]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 08:49:02 +0000 From: "Peng Fan (OSS)" To: ulf.hansson@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Peng Fan , Jacky Bai Subject: [PATCH] pmdomain: imx: wait SSAR when i.MX93 power domain on Date: Tue, 13 Aug 2024 16:57:48 +0800 Message-Id: <20240813085748.2144637-1-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 X-ClientProxiedBy: SI2PR01CA0002.apcprd01.prod.exchangelabs.com (2603:1096:4:191::21) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AS8PR04MB8721:EE_ X-MS-Office365-Filtering-Correlation-Id: a6de9a3e-59f7-495a-cc6b-08dcbb74c786 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: X5QyD8BQN5MrSmoOM9UAVq1dMv3B97KuUQ05YrZzpfZwB5YYrjAgI8Jk/Ko2kv5MZOZ/IW9xD5YonDE9YFKoiuLg7S4AJsvn9O746gtZh22NJp9N/9/w2Jvo/KPzOTvtS1QuEayAmG6OSdxiLCQDfO2pZkXlkOTpfm5o8+BZjpQ/UEPnQ6Co4DJYvBYGwkIMqAVqClTQpZ0fx0HgJC61+Ow+T0zV1K/jUo4yAhVLis/ox3kgUE0Scff8bW4sHY05JJVNPecRGQaWlr/uKG0cwIIF8Dw0EK44DqpruMYGV0d+d0DR4u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cdBR9Ky3CzYKW7bA4svGXs/1nXV0OA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0iopa+aPWtcM1oux+0tjScR5/Y6WgIfxN1KUB+g0BgZeE6xHxVTtQ+OSjssHS6yuI+7c1vqRjoMuC0JIzofEvcfLIfgGQ0eSk3btnONrLJ5jYB0iGdeG4GpA+FfOcv7mtBMtMYtTk1HXdc/f2BNKxNFr+S8UQ5EtSUPV1lY/+Yr/HDW/Ps5Z48FmnNPdbM8jBlKG841IizxCDosMgxMtDDsWjscLsVRfKJ8q5v1Qd/QOAY12VcnP9SzOH3WazZsBGY487xNfELfK0NxaBCwlPiKffo/KY9Z1Rt/wvNn3k7x0FMMDrga+hNP/CVrueAnYTpF+cpk0G1nXV01MttR2da8ufki23lOJeccNGjK8w6prSyNoXvdEdCndAGNFHSOPCgWbT494MlqXHtnrBut5LpF1iZfw5hLEs8luf2b7O0EPclRYAGNAGvDuaeMFGTrBGgbVtZI/IFNFyG0PZa6Rz6Yk7cSBCzhtlECm5UkUYojydjpz1H7hqvHNaIrIlsk1CVRnVwbS3iPZAM5K4N8GzMYFwWtGZ38T/ZB5iG82secPvuFrt2yjRczylXfz4mdUXxNH5FYR0s4onXe9cTyVcJqTERs8QFBA9jVYP/OCJyva1KLboFH1mccRmQQwUFe1ZsT3Z05/WGuSbqojEuure/0kKMKoWWtnStDojFVRFy2Ccl9tx+S1JiyhynReAOFH/EiFSO7FO1JHDRfmiwVMVpthzECGTACfl+xwEdKfXG6eFZxPWC29XGNFAe6MZj//YlNaqOLUEWA1MtDHzwFMOH8+LtamJQC7BiA22a5odijUPvvGlACxSDdqlWaSTlVGZD8HngJxKa7Jrgwd4r0xzDaZs1QDK7QZ92lCKc7RhWnRecjRrIGmPLcT+Jqqv3og6VRN52t1v1BZBOhLPtpMYIYEbZwTPLCQlQkJ2z4REN1lg8szY8mKY0wGPevfdWX6xqd6LgKWjktAbyzX86clwh8MjiTU1rHbtsHlo9dy7jIIPRJZC859WghrOx2Bl99lJ3kLID1g/z9hC3SiV18uJ0H6JZQgYoC8Cd1iOkaYB1v7Lu0pQQY1lwLXCayNAs4ySqOLLzV3wfJ/T2CAVcusS904DWq4gmbeVMfMPfyqXvCvezewjMFpiNRsvl6OyWVRgyYzlaOP89QTBddYsavXEcQtj3e0//o7hFUR4ceSnFscpbVAcqBgyi0TIkJmbc093g9KNLGAtMTZCelLHqvT1UlLhJfJxDYVSwHom/9e2NY0snvKPatyzcIohAmeOMcz6DiNbpJUlu/dDILAa/fw858+2OX38KQ1P3+7146v8DM/hS2v4WeIUT5ufVMBxMqL7Wif0XczLAdhp0v9hgkR0vXh5IRsrOsAqkb62gaZG5dxgseK+qUFrmJAPVv0aexMdkZesdm0/ieMF7Aa5jS7deVGxV6rTyD5cIWdvf3oPnDk89aCqenKN0Tb1623qKXn5IQfPLm2kCKKKoFijz33rCg62z4plhngDBBkhQRYCtr7ntrBACwgmdtBy5KcUuB4a3xu5hh6codmFPhy9dn+Cg+hoD6sTzXtu6dlXifmbC1jh7AjJeyGTGIfBqZnLBLR X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6de9a3e-59f7-495a-cc6b-08dcbb74c786 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 08:49:02.2782 (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: HWJ/z4KtkZWEVRSqRnc2to+brz3cHQb2K8Y6nKIcFRK6Mqb9gaaU/VKS5umYY59yRxtkLpBodcZVdufTNIpX+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8721 From: Peng Fan With "quite" set in bootargs, there is power domain failure: "imx93_power_domain 44462400.power-domain: pd_off timeout: name: 44462400.power-domain, stat: 4" The current power on opertation takes ISO state as power on finished flag, but it is wrong. Before powering on operation really finishes, powering off comes and powering off will never finish because the last powering on still not finishes, so the following powering off actually not trigger hardware state machine to run. SSAR is the last step when powering on a domain, so need to wait SSAR done when powering on. Since EdgeLock Enclave(ELE) handshake is involved in the flow, enlarge the waiting time to 10ms for both on and off to avoid timeout. Reviewed-by: Jacky Bai Signed-off-by: Peng Fan --- V1: Downstream R-b tag kept drivers/pmdomain/imx/imx93-pd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pmdomain/imx/imx93-pd.c b/drivers/pmdomain/imx/imx93-pd.c index 1e94b499c19b..d750a7dc58d2 100644 --- a/drivers/pmdomain/imx/imx93-pd.c +++ b/drivers/pmdomain/imx/imx93-pd.c @@ -20,6 +20,7 @@ #define FUNC_STAT_PSW_STAT_MASK BIT(0) #define FUNC_STAT_RST_STAT_MASK BIT(2) #define FUNC_STAT_ISO_STAT_MASK BIT(4) +#define FUNC_STAT_SSAR_STAT_MASK BIT(8) struct imx93_power_domain { struct generic_pm_domain genpd; @@ -50,7 +51,7 @@ static int imx93_pd_on(struct generic_pm_domain *genpd) writel(val, addr + MIX_SLICE_SW_CTRL_OFF); ret = readl_poll_timeout(addr + MIX_FUNC_STAT_OFF, val, - !(val & FUNC_STAT_ISO_STAT_MASK), 1, 10000); + !(val & FUNC_STAT_SSAR_STAT_MASK), 1, 10000); if (ret) { dev_err(domain->dev, "pd_on timeout: name: %s, stat: %x\n", genpd->name, val); return ret; @@ -72,7 +73,7 @@ static int imx93_pd_off(struct generic_pm_domain *genpd) writel(val, addr + MIX_SLICE_SW_CTRL_OFF); ret = readl_poll_timeout(addr + MIX_FUNC_STAT_OFF, val, - val & FUNC_STAT_PSW_STAT_MASK, 1, 1000); + val & FUNC_STAT_PSW_STAT_MASK, 1, 10000); if (ret) { dev_err(domain->dev, "pd_off timeout: name: %s, stat: %x\n", genpd->name, val); return ret;