From patchwork Mon Oct 14 09:11:22 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: 13834420 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2052.outbound.protection.outlook.com [40.107.247.52]) (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 2A8731BC58 for ; Mon, 14 Oct 2024 09:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896651; cv=fail; b=KXTQ7s0Gyzbq/UhLH7W9iPkZRTUzfEpie2QwdmLd0AKnJpSHzISiRUPf5emE0Xuqg0mj4lgvz/tbk/iX4JYXYLp9lL2J7zQbnDbtNQWL4h4SAdKUwoQQL+oPu/H30TzzrIfwZdXWSHXWSHimkCIA9L1s5IhDOTcwhB9+gkpW87U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896651; c=relaxed/simple; bh=nyNphbDXdv9/89sxQwH8tfm2s5SLSBvnQOiphaKcSfM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=rd6Jl0yav41e0+vHKOFWae7lrFV7GDy4TkwSWLE5cjNmcQBeua8d+rCWTBpUTSwDuYOOKMFCtfjSxhQ5+S/U6UIBqWj5xobl/yxYlpDVSi8vggqRJknjVZP5kol0PvQNJRUewq7JmiGeNSqMXyuy3Ho1VSoWrv3NyYX+AUq0dVM= 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=iu97b0DL; arc=fail smtp.client-ip=40.107.247.52 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="iu97b0DL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qVFJkXecSH9AeX1f11Tlbl+gGwkYSV5HvW4ekg99Xidxds9E4/FB24ZXxfPhqgy1lG6ZoXOOzpd2wyXRDFgDPkY9b/BYY4A+VRthyWnteWOBh8LLfA7GuQUukL6S3+4FMQimBxqK0vAblcT9S5xGDYsOMUGcGhu+jBgccyr1Rzmr+qMLx10k/RwRM6eiU8Psj2j5CZUjKhxOBWACPWe//xgeAAfxrtXxJ92iPJ4i/yYQnAWr8G4RZLJrZ+W92Ut++aV0cLvkbTtq7tE6in9Sy9ELGSOH+DtBsgpDsO1JgYrQKY3Y6UKq0mzwDom42ai8ryVHWB3kJRPPuk8HXbB6+A== 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=PWkiDlRqKMQVrdTslJQGTlBhAYtEMGibd+A9k4ZRs+w=; b=cXdZwyUMC94W87LNPaZ58UUyw+mSmIK5jtw7NKMdoaKttXbvwEw7z0/aiZWzFFarNvdvAsShmYKkZXKYJTTXa31eawKwvMguICzE4s4JJpuhLwjI9BWAehuxoSCC2CmBnVLBNYiGbinY2tNkcK2VXMIbi2X+soY3r+IU6RkJZBZgCD71xrIl0SUOx61TJ5h90spBN8wHBxMlCBQAtgLvbn/LdkHOk8uB6R0XZ1dVtr/4zsWgWlC7WQ9EGpZKN6kSgIQv59WTPOB4koYOh6cFJxWLuF7GbmmUPXAa/vPnmhBqh6ciz7IMownX0fyGXhmznef+ejAL1BqobU763Goskw== 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=PWkiDlRqKMQVrdTslJQGTlBhAYtEMGibd+A9k4ZRs+w=; b=iu97b0DLUMF6ID8t8zXVNQElPOVPLpIyWuhPwnUzVqn5D3fD+XRHE0WUzYO2QuORuPEto+nSB+58CbpCA0GsIyK2q4NdMuhoU30jv+OqvdwrytsrctrpcNbtPLB9XnmhXsnmWzhptMH9AiWr2mp/xGCCoaomQFzrqqCXKg3WbjtetZjQpBd86lMXqHui6CXGt1UOeaPXiKOS9eMa2vGBr1qiDGLqp3+atmpZrCsEY1/KTlpPOxy8u9CQf9Z/suJVNvJG+OcFo78zrP6ZtfVg2e6snIjiPESAiAOacKIaffgKTpit/qaIl9uU03a567aWp9M9lfkcWtoiUpTU/ojm8A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) by PAXPR04MB8765.eurprd04.prod.outlook.com (2603:10a6:102:20c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 09:02:49 +0000 Received: from DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197]) by DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197%3]) with mapi id 15.20.8048.020; Mon, 14 Oct 2024 09:02:49 +0000 From: "Peng Fan (OSS)" Date: Mon, 14 Oct 2024 17:11:22 +0800 Subject: [PATCH 1/4] clk: imx: lpcg-scu: SW workaround for errata (e10858) Message-Id: <20241014-imx-clk-v1-v1-1-ee75876d3102@nxp.com> References: <20241014-imx-clk-v1-v1-0-ee75876d3102@nxp.com> In-Reply-To: <20241014-imx-clk-v1-v1-0-ee75876d3102@nxp.com> To: Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Aisheng Dong Cc: linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728897092; l=3000; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=gPVJ62hn10fd8Mk5dUx6+DMIgNMDHMz4XiIGb+nUuxg=; b=+PT+d02018SH4dIlmd6VmmT5NpESWMszR+mVBeYO8QAysQV722o2BDe4uxr5gx7KCnZFckipX D48pvrY+sWGDFzskGMUlIUT+aY5VoRMlq3N71FQv4yLTN7KWP5bdTgX X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:1f4::15) To DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8461:EE_|PAXPR04MB8765:EE_ X-MS-Office365-Filtering-Correlation-Id: 42597541-d9ad-4d82-ebf1-08dcec2efa48 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|1800799024|376014|7416014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?fr/D0E0e9AWSuosu7HnGCioDi1ngB2l?= =?utf-8?q?V6MHtq41d1qqsAfWC3bhI8LQHoGKURXKBQ+7YjG3RiQVvvHNHiP2f4NmbBVMgMgEh?= =?utf-8?q?cLymex8tx143NmLthGc+h9nCwXeHr5JSVcxPNIKPiAMrTQXZurvyvEPsX8wpjLVAH?= =?utf-8?q?bFUp3XUvD1x3FodFJWBMDd1JfEJRimx4DVCmhyY5qvZ76mHOo0xJUCVBEkrFdzvpV?= =?utf-8?q?d6lcQ7QYx+MFhLAFrfScUWmkFNgsjbnXS5M5MzVRTFW8KrLTFq+rSWTbdu0BBPn4K?= =?utf-8?q?rwPHWjwb3/NdttQWh6oYdeJbQRIW2tY4GzB2+cJHhK7bOOAr/L8GEgv6hZkEJppPG?= =?utf-8?q?LHgvLNH0owKuF61pzhubOh3vQslflRN0SFPPS+cwFmsrmYgGIQLVraWIE9c4DFJbY?= =?utf-8?q?e8zoM2xPY+ce+fATSCh+LUHk2l1Vyj2tz6lxgUzBS8zPbvdj/77TUSq2tHOyDy+3g?= =?utf-8?q?pqzqvuLvliAGDaRecLumwqTa/tEKr/QT8v84WHQMK7tlpOdnEDkyvYrXcsQW7UhV2?= =?utf-8?q?7IPGrBMajZ2lQjAm9iIz8Riao89yjQh3rOH/j9jrjCsBRQj7ddCpOPV+EZ0ltaQc1?= =?utf-8?q?g9xBJtEI8LWb9BTuHDjhUuBXE0DZAcoyne6IG7op+j9I/rkduWKTpmpNipACOwuw/?= =?utf-8?q?1Va+2gFAtlmAcPvg5gWo/mQmx8tmNDW4aZSy2WkPcseDXFQUrcQhOtPzxhumWz+kW?= =?utf-8?q?PS9Wa3D9bfNJwGLcMBYQXFIIQjZC2EcWSxE6QDJRemTHlRlUcgHuQ80ntfkAdhP0g?= =?utf-8?q?ErQjgHeiu9F9SW1ZQkmS+D8BBRM0iFIC57VNvtDRs6CYQlgx0NePDR+hoQPLxIHzN?= =?utf-8?q?6TuZo9fe+svjwiChQFDUykZEcHx7irCXpgkIyrhLnoCCmX/vhg1kotzP9lRcLBEJO?= =?utf-8?q?TW9M39mNQpneh66DqFHOz6fVlzPIg38qQRScOKW0JdaKdcl6q+clheJw3ZxOmA9Jf?= =?utf-8?q?qCF4d8oqxFGcl3bnGIYm51rsfKxzUB/OwycvUDKbz91/y1HO/LPBdLpqwpasiWuy+?= =?utf-8?q?oPEgIgt3Z0g1+YyUIK9OXypX9YXTXEyv+S6Kru/bwkT4eFtUPUd0DxXOpNlrFCadc?= =?utf-8?q?bMH2l8UKvkYieB1tpyj1BC0qa1IRCOH/TcI9a+xN/dRorXvHGhx/tq3MHOQeylIQl?= =?utf-8?q?+0SYTsZLEAU5jWqiKgHIxthYc0iwmDfwTlzl/riKPSYjUyzv1mj5cCcFX8yS93bSX?= =?utf-8?q?okJA5nb+35PCU7va+2arIB2u+SZU16fJY92Kqnrt/kSyUQgJKDPiheYkm4TqknSxR?= =?utf-8?q?8/QLSzFywlLi0h69os3/2YbjugV2C54PDQw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB8461.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?AzWZovVpso2Z33rW4UNuYxjzmsM7?= =?utf-8?q?GWVgw6VAXIjQ8SoMMORC2sE1p+3QbLWfhxGrY2qSCB+ttMqMivBejti2vtwKWodlj?= =?utf-8?q?++3SxTHgReG2IaotryrLmEwd5v9I561eNNHbNoy8ClOfSViR2Y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Qjs?= =?utf-8?q?IEg8aoYIyW18B6A1xfMnjC7hbjpDjrMvBSv9nvYL2dNrIwl9ludKex+90oo7Enpdc?= =?utf-8?q?zFTEIOYSNa9hKB5Miqv0a3tKsKYQ6HNbdwlTakuk3z7QmH2bi/GKyTu2mfXDC7Tzm?= =?utf-8?q?MNTnkbW+u0BNqs4FOEB0cPWMt1HRvLkp7WstAWbVyoNiXSiFB0O4dQizyrc5IEreg?= =?utf-8?q?AtTB1upvzKu1sIYEoKWkgoJeJIe3lBAe7SyPV5bExrvOHUFzBEbtkfat0SVsyQ0vA?= =?utf-8?q?lVX8rwIiIbMQbd82uiAqywTglzIbtGibnpTRdpYU2rvG3vwQYoRXNhPZEijS1dV/c?= =?utf-8?q?HtcpMNERwo/GUBpLxz87fj4zNLiLMsYIaBXOIdiOKWX6wC4VERNj86MPcIOM6Nv62?= =?utf-8?q?yp+dm4LZRIM9GP+LQ1+C3zUjgeLSoRwliGMnARvLYZHeyCONwoyGGMRxaxRjUnU6k?= =?utf-8?q?7S2gVucZHenBXF2IoB9SwMfAiv23F7TnvHIzMOmreWnwbnmuMvEF4LYEY6CT6miPp?= =?utf-8?q?4FyZdJMrW2RP?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42597541-d9ad-4d82-ebf1-08dcec2efa48 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8461.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 09:02:49.2906 (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: Fiz9BBZG2yLBfYeTAg9Xr7u2aH7G1kRfxWfgrBG6VgchT48fz6r3R+EmKjfma01m6u9YFqPbmYSBo+OTgCD9Fw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8765 From: Peng Fan Back-to-back LPCG writes can be ignored by the LPCG register due to a HW bug. The writes need to be separated by at least 4 cycles of the gated clock. The workaround is implemented as follows: 1. For clocks running greater than or equal to 24MHz, a read followed by the write will provide sufficient delay. 2. For clocks running below 24MHz, add a delay of 4 clock cylces after the write to the LPCG register. Fixes: 2f77296d3df9 ("clk: imx: add lpcg clock support") Signed-off-by: Peng Fan --- drivers/clk/imx/clk-lpcg-scu.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c index dd5abd09f3e206a5073767561b517d5b3320b28c..2cffec0c42dccc256e8dc5e9181952e250870a76 100644 --- a/drivers/clk/imx/clk-lpcg-scu.c +++ b/drivers/clk/imx/clk-lpcg-scu.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -41,6 +42,31 @@ struct clk_lpcg_scu { #define to_clk_lpcg_scu(_hw) container_of(_hw, struct clk_lpcg_scu, hw) +/* e10858 -LPCG clock gating register synchronization errata */ +static void lpcg_e10858_writel(ulong rate, void __iomem *reg, u32 val) +{ + u32 reg1; + + writel(val, reg); + + if (rate >= 24000000 || rate == 0) { + /* + * The time taken to access the LPCG registers from the AP core + * through the interconnect is longer than the minimum delay + * of 4 clock cycles required by the errata. + * Adding a readl will provide sufficient delay to prevent + * back-to-back writes. + */ + reg1 = readl(reg); + } else { + /* + * For clocks running below 24MHz, wait a minimum of + * 4 clock cycles. + */ + ndelay(4 * (DIV_ROUND_UP(1000000000, rate))); + } +} + static int clk_lpcg_scu_enable(struct clk_hw *hw) { struct clk_lpcg_scu *clk = to_clk_lpcg_scu(hw); @@ -57,7 +83,8 @@ static int clk_lpcg_scu_enable(struct clk_hw *hw) val |= CLK_GATE_SCU_LPCG_HW_SEL; reg |= val << clk->bit_idx; - writel(reg, clk->reg); + + lpcg_e10858_writel(clk_hw_get_rate(hw), clk->reg, reg); spin_unlock_irqrestore(&imx_lpcg_scu_lock, flags); @@ -74,7 +101,7 @@ static void clk_lpcg_scu_disable(struct clk_hw *hw) reg = readl_relaxed(clk->reg); reg &= ~(CLK_GATE_SCU_LPCG_MASK << clk->bit_idx); - writel(reg, clk->reg); + lpcg_e10858_writel(clk_hw_get_rate(hw), clk->reg, reg); spin_unlock_irqrestore(&imx_lpcg_scu_lock, flags); } @@ -149,9 +176,8 @@ static int __maybe_unused imx_clk_lpcg_scu_resume(struct device *dev) * FIXME: Sometimes writes don't work unless the CPU issues * them twice */ - - writel(clk->state, clk->reg); writel(clk->state, clk->reg); + lpcg_e10858_writel(0, clk->reg, clk->state); dev_dbg(dev, "restore lpcg state 0x%x\n", clk->state); return 0; From patchwork Mon Oct 14 09:11:23 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: 13834421 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2052.outbound.protection.outlook.com [40.107.247.52]) (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 694621BC58 for ; Mon, 14 Oct 2024 09:04:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896653; cv=fail; b=XdCnyR2+Cgoj3wzu93CYeKFoO3/mZIvWnMOz3rpr/ZEG5gaFUcaGkrV57whSHruLXMJIZichGs8kTkqXtzVsqMSBhJ88A1Kp4x9FSQgRjFz4ZQZVfd2jTkrKP+YDuCst6EdSjDf5oXQDCjUSph3G+x/krbU+I0fj7Fh24UJJUco= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896653; c=relaxed/simple; bh=ExlIgQbunead4w7dEkppAfw/EYJaVq4W07T9IlXzOBY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=NHuY5NNCdmCOXuhUnfevuTA5uCUw5pbYyuUWuK04P5Af0f/k5RG8Z4nIQeb8Kf3tocO0OpbhFmvrc9Pc45JZzo6CVOVigN9PJ04MMfj/nrdngW8rwn6F2FM78ZEW4a5u/pxv1tMX6u1sixOi/6Owu06Ubql9W5vf9UN+JewgkLI= 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=dxSFdCOX; arc=fail smtp.client-ip=40.107.247.52 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="dxSFdCOX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MFaMAok2L3Hjg024R3Ukwz+6qBY8YFN4eeuu1RTfMEefbTEvc98c4eQeUV7KoBv7vCelw0tQUydM8TtTomvs+gjDrLKLS1boG0sgHlWgpTWF+Wzq8YQeT6xsIcbjdCw+0rFiH+jvrcppC97Ketv2bN7cX6687f5J4uj+Cs4sdo2jFfYMsE+4R5O9JxDLTuJTa4MUVo+txVYZ1mQMMiI39QfdUNJfBoLhSKrROHYl98Zt5ykjKt/7BuwSqlMj6vfC1yHqb8UeTgQuZgbs72h8fKoIz4uRilIvMaMnl9SpjHGnspLci5RN7ivvvVGUMo6dmuf/LiL07ERN3vRFDIahZg== 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=wdvKNvGzumUXSlt5L+eIRW+tInE4yBzZKKVPMUHT4sI=; b=gAjs8ptdSLMVLTV91YONZIytl5xLucaw81XtbNlTVIZZQ7oD9vOw50KGdAMpyMhBiQt9dQktMaFobtlcKvAcONkY4qahVb5Qilh9u0qwFZUCGix8baiZ+ooD5ZRgQ2Xdp1g6gU2AltC4WHs0RziFeniVKxXR9ksjTodMZ0p2sLxk0RJ9vx3vYZ/MNG0ZpEAoLa/n9O7xpU0oHisxr4Ti1wADF95yq+V/UUGtKLCZArU78kiNCm6BugmZXk1nN9jIyqi/DG7xRsO6b3X2z0vx+cW2EkcbCRjFoZeMrjMAYESSvHtsqKPqXpRY6aIFYzHmyl2n7tN0NlRBTIfEoKRNhA== 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=wdvKNvGzumUXSlt5L+eIRW+tInE4yBzZKKVPMUHT4sI=; b=dxSFdCOXUuQ+HZEflL5dm0vCjEkIiVXT5iSqsvTsaA81lCIs+UtI4v7RNefXuKYK7pTWWcHFO155WzkbOTZOn7Fi/b8NE9J44G8WcqEH/i6417nvKQLb8SX9IVkR7koGh9Sgkxv75xod8sSq+X5ufDFYtQdRsAC+oyCARtTo3X16c2TMCV5C26+KseAfeBN4wJ12AdPIWDlBxa8tYEKAVEdpLVg9NkW7TTr5/FlXhXisoUzrt5X5GCmSXkLh7xfnl5h5hhmDRd1xAsREU2BtSOl34eRwtaDw3PJCS4BIDZwHYEMR+EVS35wS0OtMegyosgcQhCyL0t4zMYXeD92ytQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) by PAXPR04MB8765.eurprd04.prod.outlook.com (2603:10a6:102:20c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 09:02:53 +0000 Received: from DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197]) by DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197%3]) with mapi id 15.20.8048.020; Mon, 14 Oct 2024 09:02:53 +0000 From: "Peng Fan (OSS)" Date: Mon, 14 Oct 2024 17:11:23 +0800 Subject: [PATCH 2/4] clk: imx: lpcg-scu: Skip HDMI LPCG clock save/restore Message-Id: <20241014-imx-clk-v1-v1-2-ee75876d3102@nxp.com> References: <20241014-imx-clk-v1-v1-0-ee75876d3102@nxp.com> In-Reply-To: <20241014-imx-clk-v1-v1-0-ee75876d3102@nxp.com> To: Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Aisheng Dong Cc: linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728897092; l=1501; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=ymw2GjjoDDKGoLL2K77L2xxO6NJ0H9lsK5VA9yIxUtA=; b=ZP8NYaa4S+DFKcFlOpHarpyP2wmmB8Ry7k0Sq3edfJFNRNtDTYyCmr+klBq4jhAtSpSk7oyvx fTVSGV2VdpOCIYqC/+VXYL25EMmR/NaKnjF9tLtT31NwoXFhlGeUWeK X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:1f4::15) To DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8461:EE_|PAXPR04MB8765:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f74bca5-4915-4722-8a0d-08dcec2efcbf 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|1800799024|376014|7416014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/hZZXSSkbpaU0FJqu0q/kps4WzrG7fP?= =?utf-8?q?VDb7c4ZxXmdl58OWCN5u6k9BOs0FHMTLUmOMAqHMB6KW9hgkmikzAMbiIemp9QcqN?= =?utf-8?q?oc6tO7jsdYLpRF6Hybkj0+TWCQ6v1/AjPudeYgFO2hyoKsgfhHiZRtjnOPSBdqSEP?= =?utf-8?q?qoh1uP7ekVmpy6UPbfwuHRNAyCn7gi04hCeYjD52PPHvRa1yM1XKDES7t+Gsg9zQH?= =?utf-8?q?raeeiYtlgOtNfhOmsfxFspeeaR7ogx8hd6+r0GG7uVHGEFPsYmYSiwZwUliaf7XDX?= =?utf-8?q?lq7NF1pXoV1w0LDYSCL+IIZHWxbaaheg72Objz3CPw6dGrvtLo7bZA7bDF5qNF39k?= =?utf-8?q?N+Z7MXsEtvHgwovDFkOcMkZpPBa2B/kNB6sJq4utw20zhKGL/ouU/whI6cka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9PIyAkdJ2fPue?= =?utf-8?q?U8vZTSq6l3YyWdfoK3j63PFn+4DYb2bGF0A=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB8461.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?M3fDL92nqe6XihtFjDWqV2KVMcdJ?= =?utf-8?q?ydbw3a0++N/U2sa4ErQy2uQOeHV8VNjkgah0wiQFrmiRTxSKFak+1W2up/U6bsvjR?= =?utf-8?q?/YHzC0jggswuFbd2LnzmzJLW3CjsZQoevjX5BUVtK6/fGpYoI/7tsmeLqi6BhugBv?= =?utf-8?q?IQI8ta+8vOEXCP0QgYNIfG0AY/J5IMQXe8LVNDcPRNcb253D2WEZN+AhdBZ4H4wbE?= =?utf-8?q?TEuoPeispa8ujZaupYkpZ7szXsvA/GcrXPscRGxNujW6z86LeAfbVEnHmPioR9lAv?= =?utf-8?q?6AMob8c7xwu2XpztkYY8WrjgJ1aX4LoQaPtrdM9CWO03zkdzP5RIc06QmgpNzSfQT?= =?utf-8?q?sDpWEEdzEQcyrP95W0G9p0ZFtAAYLQu8DcSP6gB7FpWhjVk6OCiWj6c3LjIfpFdaL?= =?utf-8?q?QbNAIkyfGJXfqOjgkqF+Ru9H0O5SRbEWIt2n/aHnaHWT8G9MGs2hF7l8JRQLUeU67?= =?utf-8?q?tzJa6loJhPtFLnRPgPlWsx7lmUqgQLG6P9SqdCC87Eo/tN2od04Z1A5N9oTb5qv22?= =?utf-8?q?QlQ/Tr/7WWCP+lkvsdCn6jw4Zb5xSKPjSMkADvoaKSAz14v3nB/9hM3poHTp6odBm?= =?utf-8?q?F9QxiNw/ESoXeCDUKV5s/3vTHvHJgPzS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hCsF3vFEbOgYX5y+SmhenGNkD8oYD/sM?= =?utf-8?q?L8T9embcxx1M?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f74bca5-4915-4722-8a0d-08dcec2efcbf X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8461.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 09:02:53.3611 (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: xNkMpz3ri6gFWqMsmTOCFdtYfSV8JM2WAYRs3NYs0BQQbsOSYCaD/O6PtkKDn3oirBULvwot1LCjSOyH3/WaWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8765 From: Peng Fan On i.MX8QM, HDMI LPCG clocks operation needs SCU clock "hdmi_ipg_clk" to be ON. While during noirq suspend phase, "hdmi_ipg_clk" is disabled by HDMI IRQ STEER driver, so SError will be triggered when accessing the HDMI LPCG registers. Skip all HDMI LPCG clocks save/restore to avoid SError during system suspend/resume, it will NOT introduce additional power consumption as their parent clock is disabled when suspend. Signed-off-by: Peng Fan --- drivers/clk/imx/clk-lpcg-scu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c index 2cffec0c42dccc256e8dc5e9181952e250870a76..466c0de11ca7d5af42a5ec34fb197dc90b1742b1 100644 --- a/drivers/clk/imx/clk-lpcg-scu.c +++ b/drivers/clk/imx/clk-lpcg-scu.c @@ -162,6 +162,9 @@ static int __maybe_unused imx_clk_lpcg_scu_suspend(struct device *dev) { struct clk_lpcg_scu *clk = dev_get_drvdata(dev); + if (!strncmp("hdmi_lpcg", clk_hw_get_name(&clk->hw), strlen("hdmi_lpcg"))) + return 0; + clk->state = readl_relaxed(clk->reg); dev_dbg(dev, "save lpcg state 0x%x\n", clk->state); @@ -172,6 +175,9 @@ static int __maybe_unused imx_clk_lpcg_scu_resume(struct device *dev) { struct clk_lpcg_scu *clk = dev_get_drvdata(dev); + if (!strncmp("hdmi_lpcg", clk_hw_get_name(&clk->hw), strlen("hdmi_lpcg"))) + return 0; + /* * FIXME: Sometimes writes don't work unless the CPU issues * them twice From patchwork Mon Oct 14 09:11:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13834422 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2052.outbound.protection.outlook.com [40.107.247.52]) (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 9B3B41BC58 for ; Mon, 14 Oct 2024 09:04:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896655; cv=fail; b=PoaeKtKGN6wAgx3UpFDSCKPP7NRijnuzJeJOvmZzDs2zVlv//IM7uVcdpUaxd7tiAZwnBryoY5eOAFbCVxObbxcRTtzoFg7aTqw86jaCPrvq8iutc8Mq2yAYrsNPcbp2+5i9yA9LAsH0X7FHTKGtMIal6u0SvNKqpRJ5H86cqLw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896655; c=relaxed/simple; bh=v8ksMBxvbeVAy80xC/9SxZUA+6+FZGxZgqOBK4nC2MI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=LhshuG4vi38EpJ+Q2Rk0iTGGVUdU6vt7PQ9gww22yqugLrwhBVSkrlHyuZ+UQ4o4Q056KScJoOrmfFHk0V+DfoNMJwSD/Lh31S2/oiEvAO6melALwr64E6z++JAWDkVoMg3XtsQsNaKcFGnJgawF48lCvoVHCZ3Eci6+kzfADDw= 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=saPI0gTJ; arc=fail smtp.client-ip=40.107.247.52 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="saPI0gTJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rw3mQQWRFYN3OK760Qm6amBGTx8MMpr5A6KreozADSVOL/kfZrxSUXaugRtpyjZEgsIIoCfQ3pKBmrXyz/Pe+qjRLwrxeFAAQxUEvHNzuAMYDEsrb5TLA6Rmluxgssh8ENS4vDb3/w+6nNYV9LSsP4SsHlLIidoxgUXZ1aMjxMBL+OqFczAz6RgfDp/w4kiUGRZXkA83SXAdxk9qIN6p8Yo55sQNAeCrxpTnYomqvnD60gnPoy8EHjCWqXaP+ZEKURcjW1C/boIpIvogAHfsXOJa4XEgdZFcqRasvYJyCpY1UgsQknIGL1ssybdgpA7ejzhjgwpJv+OXpdM12q3NXA== 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=tll9CQpoI2JYPFCpRJcMtd6vZ7urFG2dHGkXxAOPskU=; b=DptD5A05zeoEkqfd76+xq5E21bguA7/h4NySK8MEto3DhlI/JfKs/U3qI/GmxviXpAqa4U5LP8QJ5QFJKJ+XmGHesJpqKznP7PptWTa0Kv+bnNJ0BQ3Anddu82/Gc5pgtQLcMBrmEG4YtmUJX37YgX73dlNkhqKUrBaJTB0UrIoMZTuPAHbyCJPbvUJaCP7vUoe7NRQI00cff/FeRnjKPnClfWDNVrg2syossHmAr//jvaeltet+sKnRE6FwZEK7egOxNrwoyGVQxKSO2k9W/djgIipuiH6JA9w7Xil0VZ/VpNKsxw5MEsi6KuRCpnjnmJZm8kki9nnsQhlnM58fFg== 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=tll9CQpoI2JYPFCpRJcMtd6vZ7urFG2dHGkXxAOPskU=; b=saPI0gTJf911xgSKUcwNNMnfz4zfzwpYayiZI+cQ3/k2JIcZiBv1xWemTewN5CIfOuNVHPl3PoLxUUspA2Emt6oKmFDisLt/Fa2Yn62Thvd6honJr9iqq0/rZoneosq2/hZF2c+L4A+EJOqODdQTEfMgIUO2qgWobQ+pqAsH0TU1dQaNU0dH+jNcpK01DW28wZ8kN6+LsS/cNOKxiYI07xM+HimhrsbEF4qWepTYfjil9ahu7VslR0ZnMYp7y5KqpBL6gem1gzIQlbvrnuomh2m0PX27a7bAoSJiuv2ASrgSb96hzMOg/dnri9nRA7UF/1knEuPt+D7VNCnxnC1d8A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) by PAXPR04MB8765.eurprd04.prod.outlook.com (2603:10a6:102:20c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 09:02:57 +0000 Received: from DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197]) by DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197%3]) with mapi id 15.20.8048.020; Mon, 14 Oct 2024 09:02:57 +0000 From: "Peng Fan (OSS)" Date: Mon, 14 Oct 2024 17:11:24 +0800 Subject: [PATCH 3/4] clk: imx: fracn-gppll: correct PLL initialization flow Message-Id: <20241014-imx-clk-v1-v1-3-ee75876d3102@nxp.com> References: <20241014-imx-clk-v1-v1-0-ee75876d3102@nxp.com> In-Reply-To: <20241014-imx-clk-v1-v1-0-ee75876d3102@nxp.com> To: Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Aisheng Dong Cc: linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan , Jacky Bai X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728897092; l=1523; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Sv4CHyV16UexiFdZ+yIX03Ey/S7U3vzUPoU0hMATx6E=; b=Don9BLt1qZNpRnAE7hpt4WSRL7PiCdVd51Urgvhksw/MZFdrgL/IxtagQMHkQY7ElrL6GNtqO aMhQYmeGrrrCuR2ZfCeyyCZ8W92DP5KOyYWcV5LwxPEIu+H1eXLpoOF X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:1f4::15) To DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8461:EE_|PAXPR04MB8765:EE_ X-MS-Office365-Filtering-Correlation-Id: e786ea21-fbd5-4716-4554-08dcec2eff44 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|1800799024|376014|7416014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?5ve52UMrVI27U62fQGFOmK4R+xDvLGB?= =?utf-8?q?M7LRhJuSBAnfZU4CtbxXXvkzG9eOuDfTuYS1FDSrXDFNVuPQNI/IHlbYOj9SSvXiu?= =?utf-8?q?cyz4QOxI+YWgmpTNu+NODiGObQsCUmZw/iNvBtYXNQhJnVCgxsGE2cDN2a8sjSxof?= =?utf-8?q?ehbJWdaVS64K36gsksK5OjTJUHCw4U3yJ59FEsLwlyWYmgSS4GRIbxicsFsdmNFOU?= =?utf-8?q?e4EcLwe/47QyQFqM1AGr72XrkdFbL8lm+EIngi3+v2dOUR9CoZISyjHqqhgv4AiyI?= =?utf-8?q?3uSTMUCuKs//GYFbglwaBQkgyj40IYX51wuAFAtPqnPsMv1L9NCU2UANsHxtXaeqN?= =?utf-8?q?k4ci9/XfQswUb0X3UMWTUBUGSzRSkFQ+YfXRUM5n48VhVKVsgxEo6aMLUCdIbVWEW?= =?utf-8?q?KhSUY+ZLm8gJ9aiw+tfITSQznFphsauru6Nb7b3jChecfMRpyLg8zLPEsR+7b7A9k?= =?utf-8?q?u9DwZ9IPyUxxbstBiWOhZ84+dEpYGYwZsAJ6jmst6D+VGbQH5jrWyQwERordOB8Am?= =?utf-8?q?yupz9iq67nJlMEwJGhDI9CzQhWzd7q510ZsvEd0/soqQqcBrxUznknu82o2bHrMEm?= =?utf-8?q?rurTRUy1LQtG1oUvMqQUD2kVUk4yHHEMAdvpkN5AOB9yr4t/gv+tEeJu8siICh397?= =?utf-8?q?pKedr5s0NPoQh5O7kDeMDbUlo08PFO5SHFPTutC9gheRb8LXOnmJB83PsPrCSAb7f?= =?utf-8?q?E3pWqi9ODUt/SubnGhBQEnFf6U4PB+lRm4lxJ6h4IRlQ5XAAii6jg1b6xUSSYoowX?= =?utf-8?q?LpYwXUUebI1QEHcfO/LMd2ArBHmuLHofbibNVc4s/kfenf6d9tvMBa+btp6ynimxT?= =?utf-8?q?bZQJmtOtLTIH2CvlCcyrbPH5V9LLYoCTRiUjeTGmakTvGjuLKusoJ5qabEG7k9HDz?= =?utf-8?q?gLQvTR65pKwZlCeW7n/pkym9u0+j/Xu8IWrH3JPD9cmqipjV8iNHg0NQ9jcbQlqOo?= =?utf-8?q?9tCmqFcCR4fqKdfngiQTWcY7rZcNJmTKc6aaTfDADRXVJzeI2oV+1OKK3uNuRiAiy?= =?utf-8?q?zZLxYJVDJ0r9sF+7j8rCMiweZujlA2ei4rfEI45225nRYxNF/GHYeYWbd5hRVJyoW?= =?utf-8?q?pwAPcwqRlSFe7fcOsNDKtHRTjZmT2Jez1Uk+Au/LOlQRo7/uvLoep2uJAlDlzO9dJ?= =?utf-8?q?IKLQszscYAbeuLHAkWZxU8Ah0xkVhUy2PHk07+FbaPXYmulif3dG64+TwjCQj2AqA?= =?utf-8?q?OtXDCIFa69YwJv2ckFp6SOWLCvm3A5fDBvk8d0by5d/cnUcgAMnKLq2IA8XaXg9Nu?= =?utf-8?q?2ysWNPNBAQwR8TDU6k1qu5MnhVlX+Q2lP9A=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB8461.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?QVQ/B1Dledq7w/6tT/xeZyF4Xava?= =?utf-8?q?Ba0AZiT8Ue6lShbkIObXyoGTWHYARGm4bqV6U8KLEFx+DusOXwzCd3lcdc7ihwHO3?= =?utf-8?q?C5sdQqMkLzI7VDFGsM4w9JubQ/Dwt8GjQZQ21ii9NQ1Y18t96P6MGjx9m2Y5usJkI?= =?utf-8?q?av8cbRsrZPCERu218ymSzR9bI/FENz7PiJIr7aP2jct0N/gPEJDw/uptEntrAEVq5?= =?utf-8?q?rj2oPgh0pYn8VVThyu0SYqETrzng5zR9/pE2rr3CEdxfs1SKihryq3QU4b/q0IqIO?= =?utf-8?q?AMxgCncn0dMLUjThYUlFaxxkhKGkfgspSvoV+skxXI2dH1RuvM/6S1+7zaERDLzvd?= =?utf-8?q?x96zxZg+UAA50daaZl0WGA8uIy69Lx5TvI7twXqZSVAs6OrvTwkjxOamj5YURGvoa?= =?utf-8?q?y8jkjNTFD4GAuYDzoRKZbwaQsuLUxXwYvA7dmnogVaaw9mc3r7DrGjN2lu6xj+/wC?= =?utf-8?q?06NqT9nbN2vKd0bJ0SkgJN+vh62PYhdrEMN/+VEZOQ5WL052rk6hCxN1G8zB6jGbx?= =?utf-8?q?cg3C/9cG3ZVDDKRZ80hOvlDI2/qcyqJ5Nr6Lv9Uo6CCj+Xgoquj2n4Gj92ZZUUa0I?= =?utf-8?q?C2tWMyJ//gu3bg/6wJriLJE95JZB81+uKnvPDOuWWOK4PzN3xZYip8otO1Rus+sZK?= =?utf-8?q?ryYYZuMRG40+1eUjrJJmBZY0USktl838rrVmeXIhUi7ggJiIAOCkbJtagheZ+sCbb?= =?utf-8?q?j9Mgd1PCpYnX5pIAEvxAcgtTRSO8K6HAT/4p6vWA4FpB9xGd6Em5rEq2Yi+HIbd9O?= =?utf-8?q?YaeblX5vPjUyp/6OMZk9NKSfHHelTKX0TOyyhXhi414mr4YrOHi08G0XFg0h3PClt?= =?utf-8?q?0pdg9Cz1oK1NVM2UkqB+sdICOA7OX0YvhZigTyJPPxCOoMFb8MHALiYVlwB7OetOc?= =?utf-8?q?KeZCmTrqDOBjFp1+yxMclWNXkb2wt5bd9B9IncTB5iCvCk6wPcvliIIzhXc+JHUzi?= =?utf-8?q?bnXOANpJAw+TJjZ1kKU+52VZZgxaLWNptCPYs2FyjiYORTrDGFIdS+DsF3wEfI4zP?= =?utf-8?q?TGLddP3PX8BxWcJSCxr4y4CBqqOx/iGQRM2R2+fGA6h1SPEKhXajSy4v44BrVxQ2Z?= =?utf-8?q?EI4fCZAQ1cAIFuWU/hFz3L+maNWhQZJseFMxd5Wvh1i4cWgBDuqvugdaIUBJN5mQ/?= =?utf-8?q?HcNa5zcmHbbFSsVlMAfDb7Ui6pZ/nI9O8AX4AKnkaWd40oBwDZLkdanHR32OFGbER?= =?utf-8?q?Dn8BPjyXIJUmZnthfYhCEzTQjB46iA9J1hH5l9unRtH0+FSRoKeqpXiK7LV0wptIH?= =?utf-8?q?A6pqCOrUyeuIqjv8aKdOQ6G4wSa8eMzqitYV7CsqGnji45eyPyNssb3LIcU01l9ik?= =?utf-8?q?eyY+K8pbf9jLfPgCe6jzYUZKcYIj7hYxb95bdk5eAImbC/B1ZYXCbOUKmf5KAtM78?= =?utf-8?q?QBjcChURGgb2kgcIVbEGEI3lcU71BCEKr6jOemmxa6uw101ht5v8e4Od1EOdSXEsZ?= =?utf-8?q?jujrYRbRwZAKBHogof3QflgNhbqak396k4Big8Wk4oASq7elkNEIfOY+JlHQ0zLca?= =?utf-8?q?tUVf20/HABXx?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e786ea21-fbd5-4716-4554-08dcec2eff44 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8461.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 09:02:57.6066 (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: Qs3S88VDgbywuuLAc9mc47CNwrdU5zbpCLGt+hi1nqXT3lUeyCjrO9hOSLdLW8VdW+b7eenqBLw7r/X79hGXkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8765 From: Peng Fan Per i.MX93 Reference Mannual 22.4 Initialization information 1. Program appropriate value of DIV[ODIV], DIV[RDIV] and DIV[MFI] as per Integer mode. 2. Wait for 5 μs. 3. Program the following field in CTRL register. Set CTRL[POWERUP] to 1'b1 to enable PLL block. 4. Poll PLL_STATUS[PLL_LOCK] register, and wait till PLL_STATUS[PLL_LOCK] is 1'b1 and pll_lock output signal is 1'b1. 5. Set CTRL[CLKMUX_EN] to 1'b1 to enable PLL output clock. So move the CLKMUX_EN operation after PLL locked. Fixes: 1b26cb8a77a4 ("clk: imx: support fracn gppll") Co-developed-by: Jacky Bai Signed-off-by: Jacky Bai Signed-off-by: Peng Fan --- drivers/clk/imx/clk-fracn-gppll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/imx/clk-fracn-gppll.c b/drivers/clk/imx/clk-fracn-gppll.c index 591e0364ee5c113859a7b6271c8c11e98a0e0ffc..4749c3e0b7051cf53876664808aa28742f6861f7 100644 --- a/drivers/clk/imx/clk-fracn-gppll.c +++ b/drivers/clk/imx/clk-fracn-gppll.c @@ -303,13 +303,13 @@ static int clk_fracn_gppll_prepare(struct clk_hw *hw) val |= POWERUP_MASK; writel_relaxed(val, pll->base + PLL_CTRL); - val |= CLKMUX_EN; - writel_relaxed(val, pll->base + PLL_CTRL); - ret = clk_fracn_gppll_wait_lock(pll); if (ret) return ret; + val |= CLKMUX_EN; + writel_relaxed(val, pll->base + PLL_CTRL); + val &= ~CLKMUX_BYPASS; writel_relaxed(val, pll->base + PLL_CTRL); From patchwork Mon Oct 14 09:11:25 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: 13834419 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) (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 24EB315575B for ; Mon, 14 Oct 2024 09:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896588; cv=fail; b=LvMzaq4dUiE/CnQt6OvQmJoBIOA7p/IHDmZ0iXFZu887gK9UTXIxqnKNWR6RD07AecSIPChArNtGOn6BqOHh7S3t+gi074UrzMe0lPpCw1LBYJh24Z6Y1c/wCCZ3ZC1IxTNqhGVXidx7AmanGh8k4k+2iAP5C+/IHsRl3varlhE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896588; c=relaxed/simple; bh=NMaixJesrwjgxBT4NT5looPIkUt0ihb+TNQ2+BNtgIw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=lMcoDQo1iaQ4RZjFBMV9RCj0GkF3ihSDgf0/kJwJ8b0eMXi4cSUgQ7s5K5KdeliHVv5wDYz6PGCwwQhMphXebe0kSOBpihXAM4zcxzseK6KhWknGkJKpTRDNPyF+ADajrYIK1u72Aapwvbq1vpSekSfXUXThTAOQ8jrujXdGNJY= 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=S1KD4wRk; arc=fail smtp.client-ip=40.107.22.69 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="S1KD4wRk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MMrCnwgRSiwplz/dcLLVYrtVzhyX4m66vvCLXIo+CbK4tKUkHjsAgb7QjEDIy/63/0bqfAKzRjtuE8Z73iBAmJLzu/IF9GhCBPopYFFMmUGlKLu1F2aumS40MK69Yq+GFnkG8yxQRHO1wxyYXnN6whmmjDDpUlLCWNwPXuq6Gvq4DBS8uJ9WodfZ7dGwQNQ0KxEKO3ATUhS8ph6FKvZ7zeS/xWkzVy3k3vZp48Ik7SBmgJV0bQzclVZFuqGxvNOAUljWX5njzy2YCYuyan3pwpTMHQJQPfyxZXWziv37VhhhYLesWF7G3HA5XDoINhZIJgvpiBNJrY9p4n/TpuUBmA== 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=d2X07okjtdl9vOjnNmLbOm2lrZztvIEIJlDlOPNZ4ds=; b=rlpJ2HLOeS/KFRIKjxm7QtrtuwiCJrkMsWseds+d9aa1GFaEJFFxMk7yoaAwW+G4SK4jCQDVX8h0zFPine4NMRGPID7nsmqFfQ1d68TDFSur4ki3pLsjX6FbIUPX/oih8ab2lBmyJSA5IVML/KnMxzfNR0eIheSQg0YsxPpUgNjguS68StOg9c86Id/9K/++otYOj+pAq9/ZpjymhG7nwXOZaHD6ZzrZyVowZL83Xf6WbvtDHiZsJBRoch9Yy694ow1BseDHuG4jhaNFt12FVXhCNkmoFIqCiw3ib4wfZAfLUbR1HiA2PayHblShPxsuYuCLos4W11L91RsEhvlkOg== 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=d2X07okjtdl9vOjnNmLbOm2lrZztvIEIJlDlOPNZ4ds=; b=S1KD4wRkDU6UTXdvnfJrWWbNWneNvOuDZBLmdO5R8jFiNiXaaSmtKi2qpk0hyC/PMWPs/B3mcQqw/zwxJwilrzdx5bTv4v9FtBtfWm0u2BVGAMsC5unNiOlprmVonEWyXYnzWwxhPWg7/HTsPq50NFc1DIylGb7oHodwsYs7UIditm0R0wf7F6Cp31isFE5REAu35t51T4t96JwcElHjL1K4bcueAyev91PCNXx9ANmMPqWcDnbniLpLU+k3xFR08jeXRHG3/57yfNqbfDJpOZ8DWInPTYyPwvfDCVKkwmnlDSQ7Dx7caCSewT+HWYS4rb0WEYv51ev2G2v2YFNsNg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) by AM9PR04MB8292.eurprd04.prod.outlook.com (2603:10a6:20b:3ef::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 09:03:02 +0000 Received: from DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197]) by DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197%3]) with mapi id 15.20.8048.020; Mon, 14 Oct 2024 09:03:02 +0000 From: "Peng Fan (OSS)" Date: Mon, 14 Oct 2024 17:11:25 +0800 Subject: [PATCH 4/4] clk: imx: fracn-gppll: fix pll power up Message-Id: <20241014-imx-clk-v1-v1-4-ee75876d3102@nxp.com> References: <20241014-imx-clk-v1-v1-0-ee75876d3102@nxp.com> In-Reply-To: <20241014-imx-clk-v1-v1-0-ee75876d3102@nxp.com> To: Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Aisheng Dong Cc: linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan , Jacky Bai X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728897092; l=3465; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=0FRtVJRoldZWhrjsnYMTTv4H4lNFEH+cZfZjwCflnCg=; b=8NTWCY5GXXjje1CkaoW6y/mFO1bx+tz2QgAgzl7GsiW3xX6ovzrYy+mMu0oUsXnSMEZ/O29R6 YrXBlhmXuYKA3h+FU2nsAxCb4vuPpegjyLNUzG6wGlbJXiHAL6msu32 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:1f4::15) To DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8461:EE_|AM9PR04MB8292:EE_ X-MS-Office365-Filtering-Correlation-Id: 406ee9bb-5e03-440e-920b-08dcec2f01dc 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|1800799024|7416014|376014|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ZP5NLjJJh9gdbOMcUg0DnAvTGZ64isD?= =?utf-8?q?9o0b2vxuKns5XER1hYA2cfKZy5OIsd5bLAYBFICYZFmKEdPc7JbGy+JmGxuZwC9YG?= =?utf-8?q?HZ7TL36dwi/GSmnKubFoowKjwkuMDVVjSPxux/R+EV0b/kIPC8r1eYiuxRYrjXqgb?= =?utf-8?q?7uRPnPaJTB2WtEYuKosJ48wz2XcYlbvf8FkZvOuvLMJe9Vb95rLcZT+IaOKX3ukcj?= =?utf-8?q?ceDtZI/+RUDisTHiB6kKYdRZKqC8yY9cfg69HeUEJHFwv74BV2CMe3FFvxV4FHjC3?= =?utf-8?q?OdytVSaO9uMnErmmsQh+DYKkq8HmzJPPhYAcjNWGrrsZSsiUZXYlQ4fhH0a5CeNGp?= =?utf-8?q?VQE9Rl9SDicfi8bRYwviqIKxTtAsjmNKtpaVIzlBhCftQ/AzanZrr/8POYqsTU5MD?= =?utf-8?q?g9ZyoBy0RqGCgweNSoYd9DhaONMBjciYeJnHpdL3Kr3Kil1nf2Zkse0QHluxifhcB?= =?utf-8?q?sPYfX6YTj3J5wgMH/jfEhMdUNDTAYjQY7odbj7gVUvvz+QlZV0YkFaVZI0yt67E9s?= =?utf-8?q?jpEs/LpygAE/z7tvyUkqHRFXx0t7WFvGeZxSkaxUErwCWwZuQLixnTK/Rh3j7JhF3?= =?utf-8?q?FdI2V4gZq6pzDCwd5pmz2Iku/R9Cs+MZNbBj6uXdOOYHYCpAJvyGmR7fzo0vlw55F?= =?utf-8?q?oGZqC0sy1GJxSQNkbOai+nO1OEIi9s8lEyAOe+sqil9sGRINiMcdZNc8XVYDT5f3H?= =?utf-8?q?dEV6O8xVJByR0fX8ukveMfLNTUAihdiJ8Al651OyzF3XmR9B+9Q4l9ea+iGSk4UAg?= =?utf-8?q?t6fStZ/Se3NKtftQzAunH1bQTAxVI8h75p9qPGdbaQtblWO9Lhvtqpll98eEPAEvk?= =?utf-8?q?NxvNIyVfyDDmq+wozmiRgwlMqLrShBNYW0Sodbndfck830q1BoDqAWcYwIxqnFziI?= =?utf-8?q?IUDTV+qPXQK1thNqIBU/jT8ajOlRHsW8XhFiUaoPwTt4hEo6bt9rcf4A99tzu2ZeQ?= =?utf-8?q?Cc0VRe9YCgKt55ynYQWGnUgEd5v88afV9rq7VlklnxikK7quessqvMPM8LoebabUy?= =?utf-8?q?hoBdSj1gyCo7xBLbLY/TB+vTi7g649IG/9f9r29ezA9fTZCH8dm+bHeLKuWwRvsPm?= =?utf-8?q?ISdjAsHflFpolMK/+zrZfElXtR6PmYfbV81bYqPBgdvDP9Gq1PS3Shm9+7Hol8L95?= =?utf-8?q?wo7uiIe90x5TzeHyZpbQ742BMN/WNTCT2B8Kws+4Ri2Ti1LhSakbcDhqrLwWYLRpQ?= =?utf-8?q?kA/5ByjwEzEmm7ZZVU/kaKhOZzkdKhewRGNEH+x4whyvUzRj/kZW0kAAqVCGUWA2N?= =?utf-8?q?jsG0c0HRWDUUm00g1ESyb01zJ/r3UNHHTWA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB8461.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(366016)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?EFEP8bFbsNgxJbGfUW5C/KWvR6rO?= =?utf-8?q?QLFV0tHGu8SVaH9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klNdVY79rkQt3wYpbkB9JAL21dhPebAul1nOnF2DT?= =?utf-8?q?IG9SNzN/zlTyAVCRMUA9VX/Cvwah19lXb7vhbliXChX7cOJDXxGoY/XsDx1ksc4FC?= =?utf-8?q?gtaNowuddjmyRCRUq25n2bVp6jipahA38q87HPSMkWy3sZhnipxe4BDABOHSIQ3u1?= =?utf-8?q?M6sacSvhgJFPzUg9f4h5gupHzeXc7qEmEuXft/h9OOt3j3fRz5j7vwu7d5z32jb5O?= =?utf-8?q?wxR7c0X+TgSYpPzy+9PJAR0PD4iMSnFy0s44+S18u9PLMmhbIJHUIavlXwgnPUgpP?= =?utf-8?q?DDs9ogyahdkNe/J9mQPHijdqVJJ3ETd/X45R6omFtWuJOnzwpNqvN290P4UyM4guq?= =?utf-8?q?7h6qTHXrQL7OGH5Cf65WKNgO++G7BcDRbImahWrZvFVQ3A2TiSp7kIrKBCx2jcMRk?= =?utf-8?q?3jU8+rF9j4LdVnJ8uk8ceNZZSPCFon4urxhN23YFkgj9XFNFSm8P51u34AzXP/aBC?= =?utf-8?q?mBN3QpNy7PXg1Xe0ULxv6s6Q7jsHRQs4bsSRwfNg9hO/qBKVQDpIO5l5Eot1gM1CJ?= =?utf-8?q?FryegKfnM7jbN23xPARNpsNhsrMBci41NEZgncbbXwjK0BP0VhLQal6dUtOGgrua6?= =?utf-8?q?CAusqshx85gQ?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 406ee9bb-5e03-440e-920b-08dcec2f01dc X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8461.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 09:03:01.9321 (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: ei540PbxXxQN/EWN6gjYUk/jjqlVrkCOc0OgriF+Xo3+dSvh/sUlKUsJbY4yfqlZRtqs1ptY6a+n0wn8wNxiYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8292 From: Peng Fan To i.MX93 which features dual Cortex-A55 cores and DSU, when using writel_relaxed to write value to PLL registers, the value might be buffered. To make sure the value has been written into the hardware, using readl to read back the register could make sure the value written into hardware. current PLL power up flow can be simplified as below: 1. writel_relaxed to set the PLL POWERUP bit; 2. readl_poll_timeout to check the PLL lock bit: a). timeout = ktime_add_us(ktime_get(), timeout_us); b). readl the pll the lock reg; c). check if the pll lock bit ready d). check if timeout But in some corner cases, both the write in step 1 and read in step 2 will be blocked by other bus transaction in the SoC for a long time, saying the value into real hardware is just before step b). That means the timeout counting has begins for quite sometime since step a), but value still not written into real hardware until bus released just at a point before step b). Then there maybe chances that the pll lock bit is not ready when readl done but the timeout happens. readl_poll_timeout will err return due to timeout. To avoid such unexpected failure, read back the reg to make sure the write has been done in HW reg. Introduce fence_write for this purpose. Since we are here, to avoid udelay to run before writel_relaxed, use fence_write before udelay. Fixes: 1b26cb8a77a4 ("clk: imx: support fracn gppll") Co-developed-by: Jacky Bai Signed-off-by: Jacky Bai Signed-off-by: Peng Fan --- drivers/clk/imx/clk-fracn-gppll.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/clk/imx/clk-fracn-gppll.c b/drivers/clk/imx/clk-fracn-gppll.c index 4749c3e0b7051cf53876664808aa28742f6861f7..6a4b3745d3d9aa1b583c9bd390c884bcb689e4c7 100644 --- a/drivers/clk/imx/clk-fracn-gppll.c +++ b/drivers/clk/imx/clk-fracn-gppll.c @@ -63,6 +63,12 @@ .odiv = (_odiv), \ } +#define fence_write(val, reg) \ + do { \ + writel_relaxed(val, reg); \ + readl(reg); \ + } while (0) + struct clk_fracn_gppll { struct clk_hw hw; void __iomem *base; @@ -253,10 +259,10 @@ static int clk_fracn_gppll_set_rate(struct clk_hw *hw, unsigned long drate, pll_div = FIELD_PREP(PLL_RDIV_MASK, rate->rdiv) | rate->odiv | FIELD_PREP(PLL_MFI_MASK, rate->mfi); - writel_relaxed(pll_div, pll->base + PLL_DIV); + fence_write(pll_div, pll->base + PLL_DIV); if (pll->flags & CLK_FRACN_GPPLL_FRACN) { writel_relaxed(rate->mfd, pll->base + PLL_DENOMINATOR); - writel_relaxed(FIELD_PREP(PLL_MFN_MASK, rate->mfn), pll->base + PLL_NUMERATOR); + fence_write(FIELD_PREP(PLL_MFN_MASK, rate->mfn), pll->base + PLL_NUMERATOR); } /* Wait for 5us according to fracn mode pll doc */ @@ -264,7 +270,7 @@ static int clk_fracn_gppll_set_rate(struct clk_hw *hw, unsigned long drate, /* Enable Powerup */ tmp |= POWERUP_MASK; - writel_relaxed(tmp, pll->base + PLL_CTRL); + fence_write(tmp, pll->base + PLL_CTRL); /* Wait Lock */ ret = clk_fracn_gppll_wait_lock(pll); @@ -301,7 +307,7 @@ static int clk_fracn_gppll_prepare(struct clk_hw *hw) writel_relaxed(val, pll->base + PLL_CTRL); val |= POWERUP_MASK; - writel_relaxed(val, pll->base + PLL_CTRL); + fence_write(val, pll->base + PLL_CTRL); ret = clk_fracn_gppll_wait_lock(pll); if (ret)