From patchwork Sun Oct 27 12:00:07 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: 13852502 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1258D10C1B for ; Sun, 27 Oct 2024 11:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WECvtFrL6i9TqWUnlboazsCz7Ojc7WJTFHkIjGGXBCM=; b=NEv78L7tTuiJXfD7DSmGe0fZMr kIPuSrNl+ci7gCTLpGq7nc7uA45WhXuOtvIxoCK8Otd23rQ2ooE4QZKeGApdcMn0XG4AstWV4wsuP nIZFd0UGfJK12b+QsRNZlfBd1Q0jcX/YvkHlua6EvzNhQkzvF7tfXfKPXazG4QOjqa0lYpp3uS7BL YmuLXj/MYB3Gv3cteiOp7HadPFKNIFSYJJoxX98X0ERKBVUd53wa9jabRZO2fYyI/q05Y3Yt3t7oW HbfTP4WntqqmW3vIDzAlFMqrkHlpUKaEX2HLnwrgarXwYojc1bN3HjyhqHCQY+5g9kpjNvG1n4Cix qU2ctayw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t51pe-00000008AlP-218e; Sun, 27 Oct 2024 11:53:18 +0000 Received: from mail-vi1eur05on20623.outbound.protection.outlook.com ([2a01:111:f403:2613::623] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t51mY-00000008AKw-1p9K for linux-arm-kernel@lists.infradead.org; Sun, 27 Oct 2024 11:50:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fQfIyI31tbIR2h4PvnWXf2jzWnblITkWffvtm1KKR2vI9oDWtYcQa4FNJQ/h8SdcRXrPjWNdhckGMWLGKj3367+J3ZiovjlbaQrR9Mnm9sSpgX3d5se99v5SVQDRtt4E7m0ad0Lb0/5JuQd23LsOcaL4rj+Q4dRPUCqyjhgTQ7A+i41OHWGS5Sudafr7bBPyAIHurMJFeRIYDEmdgBG3JkJnTZhguIGactvKEDJZa5IMoz64ah7U7JJUYGl5H6K4aXi7F7S+kMNWVMUR7xkKuYksZBSMqgOEeBHoL94jk8EWBQ3yLR0ndHK/RUoK2gnfdHjZlTBc1iZrGJVS1nlkig== 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=WECvtFrL6i9TqWUnlboazsCz7Ojc7WJTFHkIjGGXBCM=; b=XIHNcTlRoDpPr6/H2RKZmJuundhwLGE06gXt5kJbZVjcAFVZWY/fD3tAp9BSYemp9okGxWW3+lqfjzUNnfhc4HXf+w7eqj2tr/n2yU1z66nH5IGWE3/5urdG2mcEMfuND+kY9+rFiDORAPRrYz+mUqvxvhDT2MiTPjcLixxCjZijt7Geh/3W8NKj+BrJUPE+QVTiw2jFeLhjO/kWmnT81fyphmRpPR0hWacUU5IJqx0src4bNPzcG5lRQlgg9AQ+p09Uc2woAQFZgzgLN6/m2MYsyCru/lL7t4oXqP3xYKu5S+z9CYyvqjT7fzvKpuxNOIp3/S0CLjcJ5rOxjGjfgg== 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=WECvtFrL6i9TqWUnlboazsCz7Ojc7WJTFHkIjGGXBCM=; b=M9j3EllYFA2ryRC7kGReTtCHN7DEPMA86bEq2jw+sA2q7NW6JJZ0LNRDrm0rkvcWl9liJ/w3xw71ST+no96TONE1MMmjJl94TvGuZPLohHZQpcOG1Hccz3rUsQNBfzl/Koj6NIwYzou2x/DMr/+4v6SfXO2upIk5v5mr+r0dtdZtznS5Pue1ZNE3tujXc1WMlP3Yw6EhGeLEK1i2YOQKNdzS9ZWL1tJTIp3qytOfOwwM769RaLPAsZc3wJ5LCUmeF7oMVLBqICih/SkoXuQ01uBTKicI9mTLsaTswgdBm2GXUAVABCDYz0rbExtdalTJA7YtUf55rLoVWtZ5BuH8UQ== 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Sun, 27 Oct 2024 11:50: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%5]) with mapi id 15.20.8069.016; Sun, 27 Oct 2024 11:50:02 +0000 From: "Peng Fan (OSS)" Date: Sun, 27 Oct 2024 20:00:07 +0800 Subject: [PATCH v3 1/5] clk: imx: lpcg-scu: SW workaround for errata (e10858) Message-Id: <20241027-imx-clk-v1-v3-1-89152574d1d7@nxp.com> References: <20241027-imx-clk-v1-v3-0-89152574d1d7@nxp.com> In-Reply-To: <20241027-imx-clk-v1-v3-0-89152574d1d7@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, Abel Vesa , Peng Fan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730030419; l=3213; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=aeiGOFthGwsWpWxLMDzbGyOzHOzdaByvU+6qeurmvKg=; b=pw7m5MOW0uwLila30EbATDQCOC2ob55BW8uO/+dR89JpBKRdRawoiPz6suMqO9tJRGhf9Q2QI R9aIO/q1+o7DFU/L1BTJDNJwde1sovQt0emNa2dF3GdMiWGG4aI3VMH X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096::21) To DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8461:EE_|AS8PR04MB8689:EE_ X-MS-Office365-Filtering-Correlation-Id: 5edc3ae5-c936-45df-0d52-08dcf67d7dcc 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|52116014|7416014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?XTlb7ywTnHqJbG4CQN+rLPqo5DJNVcI?= =?utf-8?q?IIDRgZPs802ayrLzxXduX2qgnCk0djk3Qhr+/KRLWbt64t1nUQnjPUMZP7FqTDpxK?= =?utf-8?q?KQiRaTOd9ifeUoBhN9am0NBR8vrQCSUpYPUaGwr4ljKGfrxdrzR76TGjwfOZxW60d?= =?utf-8?q?DTmrdplOYtNzbHNTaCmdtCkKUCvxFXbFRBH8YopmyCcKsZ5Uib8TO6ldfM2afGL4F?= =?utf-8?q?wyfqjaI9xeJhfb7do3QtobvH1MoRNalMgG2Vj9DmboQbOcD+QsyK8RgYGYSfrllMC?= =?utf-8?q?YIKL7KHVY4yf1lh9jEf7VMifnsDtJd0Gm+XG7vqIcErJIZElej7962UwIPQlkN4QU?= =?utf-8?q?m9NLO4fd9Pz8W/M6/5RWjeIqnC19gqNNsIGRIr0+kmNXYaV60aYvbMsqjUOMq+zc/?= =?utf-8?q?65HVfYxmM3OJkDYPxaQE/b8pxKMWuFFxaDXNVmjbBdrcfQ/IsgEWPEU78igDCgMtV?= =?utf-8?q?sISPWX6Occ9sF5QN3vkQK/HVcMVF/kCfkD3+SBELw14z5MqAn38P0EhuKXYoo0X7P?= =?utf-8?q?YIc6FnSH+0kdZ1hqZXFY/Zb1DNm9/8K04dOymABnXglXZu+n1C0rDqowH6ypcyDrK?= =?utf-8?q?uEZPRByqCN1zMp9Pba+AjV+654US8i6T47giyoYH8cpwbP5Os4LIoMgMVgC3uA9du?= =?utf-8?q?0RBqEOS5z2QO/5VdVyUxyDynfrR0WuT6fMFKKqlBo4z/aIU3Ld3zUrgIXI7jMrhs0?= =?utf-8?q?5gwMKq+w3JgQXRHSy8OlfsusLja0dc1ChV3/KcSSL5F7//OaeRIzXRZhvJvmhYms/?= =?utf-8?q?oASoIpOT4EY2YHkmxZcj3LKIP/q2XjWC+hvMcr9JZZ6Smn6DV3i8ReUr+qOTcuVlB?= =?utf-8?q?fHtACx14D37R9gmVDZjCFKOgADPYYes7ZMvaPrr3HRwT5k23QyeZBf8sUGtU7GgRe?= =?utf-8?q?xL4PCRHWqVEKi4DFpHw2FRPEWJhvQDn544ZYKG6NHMqbaPWgUHMswS97h1TtcIfo1?= =?utf-8?q?sxE2fnzap1/+PRrQzgoNLLqqCY0U9a8zOh2+4U1r6fvU8VOfL/gNEUfo2u8gceJYO?= =?utf-8?q?qb7okPqLbV62q6uKBgpK2zyQvxpfLPEEunheJs9b+oJFZbuIUUCIjZRF49E34ZnZK?= =?utf-8?q?qMOev4VO4AHRUketjVVVIDFAuYlKEynLyq2Mw9pRQAddkjUPXDKAmS58JfyMm0XoF?= =?utf-8?q?Qq+Vj/2KdQp0R8r55x/UilcBe0nXy2s1q1i4pF8y5ndT6EvZhsKOzJEyF2G1unIP5?= =?utf-8?q?Lqohrv1wJ8g3q6l3bW+8iYI39rvxT2o+nThRsNn819SK8D+sdZVS/SbKJ/CRXMl9t?= =?utf-8?q?VGO5twZT1cQUD?= 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)(52116014)(7416014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?6qPhfoKKQZml8SqdeGXiMMZzWVJR?= =?utf-8?q?Tc5OR+JjZPDqqM3j9e/r9zup7ceExKhKqNWeBRbS/7S6zKB4DpAqYZmWOH1GMZfPs?= =?utf-8?q?ISfV8WbZjX5eTa2Grmx2baKwT2RgzUo9Exm5eXlvUq+o7EEQQjgHfpM/REtOPJH/M?= =?utf-8?q?VD6viJ+FG0eAxuzWOZODLUYRBnlNXd+w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87lMtt3lGm8ShHY8/el7+tobcuAHR9b?= =?utf-8?q?MO/JaobESHGinq94YZ2ZDsJ/39xTuCtVE0gm3x2JymIdoPMEfzeXVHQH3Uu/zoh7U?= =?utf-8?q?xYiO9zoXbArUW+utl36FmzL/O46sTu3E8yg+lhydKF8T6gaQZ+awI+V6b7mAV0o43?= =?utf-8?q?VxFa2ntJnu9zaeUh/zqJnVuTwINfsKnMaJjQLGf4qFDJbD0kwcU9J7bRu5X67jAVa?= =?utf-8?q?73ihSfBWa9wyL5t2lsSAcDW8+LctU14qUEEMWpmQaCenKMq/HfQSSQzfSsBZCw3xS?= =?utf-8?q?Syn2mLqwojojl/uWJdb0kUWCOMRXH6smFKAMEKpm+Wtn2eWGgkJPz1CErDwfBmLFw?= =?utf-8?q?UyIbXAu5/h93ALXyqpUDUw3MqJyrkC5L77Yc9PkotyeMSS+1UTCm7zd3HjIi/6Eek?= =?utf-8?q?LSnbporaDMP+K2iMkwk6W2PSYUQlMK9uXLvOBGUnhe2OIElug1f6UZbXOeHJgyUdP?= =?utf-8?q?+osTDrs6lNoZ?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5edc3ae5-c936-45df-0d52-08dcf67d7dcc X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8461.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2024 11:50:02.2554 (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: 20iqOMZO8yp2NpUobal8ACgcrWJZLG088iEMr6zuWYa4Lid4p2hYyLhbcc1fgzSy9KIg4V9OdfyNboOJxzKWpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241027_045006_522929_681ECDAE X-CRM114-Status: GOOD ( 16.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. See https://www.nxp.com.cn/docs/en/errata/IMX8_1N94W.pdf 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 Reviewed-by: Abel Vesa --- drivers/clk/imx/clk-lpcg-scu.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c index dd5abd09f3e206a5073767561b517d5b3320b28c..620afdf8dc03e9564bb074ca879cf778f7fc6419 100644 --- a/drivers/clk/imx/clk-lpcg-scu.c +++ b/drivers/clk/imx/clk-lpcg-scu.c @@ -6,10 +6,12 @@ #include #include +#include #include #include #include #include +#include #include "clk-scu.h" @@ -41,6 +43,29 @@ 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(unsigned long rate, void __iomem *reg, u32 val) +{ + writel(val, reg); + + if (rate >= 24 * HZ_PER_MHZ || 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. + */ + readl(reg); + } else { + /* + * For clocks running below 24MHz, wait a minimum of + * 4 clock cycles. + */ + ndelay(4 * (DIV_ROUND_UP(1000 * HZ_PER_MHZ, rate))); + } +} + static int clk_lpcg_scu_enable(struct clk_hw *hw) { struct clk_lpcg_scu *clk = to_clk_lpcg_scu(hw); @@ -57,7 +82,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 +100,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); } @@ -145,13 +171,8 @@ static int __maybe_unused imx_clk_lpcg_scu_resume(struct device *dev) { struct clk_lpcg_scu *clk = dev_get_drvdata(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 Sun Oct 27 12:00:08 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: 13852503 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A90CBD116E8 for ; Sun, 27 Oct 2024 11:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tll9CQpoI2JYPFCpRJcMtd6vZ7urFG2dHGkXxAOPskU=; b=PoDv+DR2Qag+/XOAd0cH2M2m8o NrZV0zjTx1T0eKpjR1ox5ZllUny6/6yI8m7dnymu92Bv9wLulpHbZOviRrM2vEIDeuERe8ok/IBxq 2LIH+yoL+GIku/VJBwcPbptcQnWHZvGEHXGqeRg6WqGGx0ztYA3soaRMxdDz0A+7857L91au8vaaf eOC9YKU6Y8XIvLZLayLLgNc8w4v+1sdgXv8BessUIqfbMPbHIb+HOPVe4K43yG0mo6C1UeCnY5cWi G8Y05hUmZ0kX5l4KSmMpOK2P/SlhwR/s/eRJo8L9GXe2o4yRh+eIq/zmBuzd86Pqfk9qBXS0m0DfV It0L3eCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t51rC-00000008Au2-2Hc5; Sun, 27 Oct 2024 11:54:54 +0000 Received: from mail-vi1eur05on20623.outbound.protection.outlook.com ([2a01:111:f403:2613::623] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t51ma-00000008AKw-2Vt4 for linux-arm-kernel@lists.infradead.org; Sun, 27 Oct 2024 11:50:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=piBVuTTKK06eVHqGqS43YEnuv9Z9lJ0g521YaOyihZnFW1/aJIvZvjdSiuN4O3WOlpQNCNaVTmd3wFRjhtbKG45/T9wV7DhSK8gqskPk/gO8dsn/4Bc+N3dQsDPwBrSnYNmJPHp7rrPYsakpdMFe9Pv4OJFRb6Vhvnw2D4l42jVMh+2lVqcuaPqD51SS3NiwXBSUMjzbTIGrmnRbKr+l5jGt7Eey+2fdlVtCXxJ9xArRk4JwGPMEpu06Vd1aiDDJ+rkMG+HhZTMzZE9TE2tSwKnHynH8TPDx4pmuLYvis0k/jaX5X8jnfSITwKcwB+ffgO0so6ALvCVNJYKOhZkJxg== 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=xwOc0zGRpcFFjA3pMTlXRC/tfqNd30tGlAQteqAJvQc6oMxuUMGr6eRS9/mLVTmaT/7ItZJObzR1Q2UU2BlW1Hehbg9DdzyeIn6qkRAdgGIlbIllEGJb+HIMy/IvCFYG337/pGYH0NEEsuHHutnUTMy4Vr76bxvC6/da3NQ4XgmCE5xy5ZgSnyt6ubDEOsqWm01qQDm4w6LMn1eTq9WByiBx3jeOEFtkUogjvyCmhlV1M1n1PvqT2ipQ7wKFDOsw5/pFZ010ookIg6dAtTSGFyttPunZ9yMbe6f9hRBOY7UNBeIwUTzkmCMusVOU1LjB3bMgJG/aPCpZQmYBtM+78Q== 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=YQcTkaskB3Kf4CuLdrp72dQroFURhmPGTQReBlZOnKaVABcAwwGXgpurBVFcXeArX+pmeiRGTd9aEnyULn2oN8oBYNXI5OJMCGuphLeHUh0ccCfUfvAHlep3x5YXL7s74/QqtlxPOMOzPKDlvIh+4qx2QArWS5ucWQBEtl83unlucKt0L3CS5dMMH+d5kgwFXOgLMKYV9f7Z8AuS+uANiB1cTFrMlOk+4joxUh2OtFU+dOMiJl17FwyxSnq9O/PAOrHhz7ZXj3xl6vCwvK4yt9AUgngTLOOVC8d2UCCdGJe2KcKl6p0grdEhb95YLyn/AgjdeV01fuk3GOW1TfGutw== 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Sun, 27 Oct 2024 11:50:06 +0000 Received: from DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197]) by DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197%5]) with mapi id 15.20.8069.016; Sun, 27 Oct 2024 11:50:06 +0000 From: "Peng Fan (OSS)" Date: Sun, 27 Oct 2024 20:00:08 +0800 Subject: [PATCH v3 2/5] clk: imx: fracn-gppll: correct PLL initialization flow Message-Id: <20241027-imx-clk-v1-v3-2-89152574d1d7@nxp.com> References: <20241027-imx-clk-v1-v3-0-89152574d1d7@nxp.com> In-Reply-To: <20241027-imx-clk-v1-v3-0-89152574d1d7@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, Abel Vesa , Peng Fan , Jacky Bai X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730030419; l=1523; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Sv4CHyV16UexiFdZ+yIX03Ey/S7U3vzUPoU0hMATx6E=; b=49dTChbtqNlnbbplHLJZs31aa3JMeZB8wQmI3HcIGYjWcHArhOOQo1+zpUfbsOUg/q8r8bdpW raQGeeSPMZSDY/3QieffMt3cBIzDxzf+6Kjj9SfZTHUnJwaVnajluWv X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096::21) To DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8461:EE_|AS8PR04MB8689:EE_ X-MS-Office365-Filtering-Correlation-Id: ff829c43-855e-47a4-77cb-08dcf67d8074 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|52116014|7416014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GsBQVIKOTWdoC4d3Gx2ojTX8LjYBVlf?= =?utf-8?q?7mnvLTKehsX/4sGZMo1317AZcNVcmrUg29BOqwu07mQP7MhkTSwp2ZB140LOHFpEC?= =?utf-8?q?ZXDRQnEk1pFPy165IbV3Vh3bFKi2U7h/hCSNy8Am1WNUaIWYa/Qqnl/r8AFv168et?= =?utf-8?q?RFis9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vCus9CGmQngAh/KzIHhyqcTvEGmR3uMvtn11NjdpwSkaVDxaStVjhK?= =?utf-8?q?c8NLV12ds60WRup8zCVYdGxBHOniWRbW9YA71lU8KH4u2f8mXevSsVRnnsCbTtaKF?= =?utf-8?q?e7/oNQUcaafpkmTu4l1PbU/481kLROFl7wSRhzGi+kR46pKWRVwTCRfSGdsDxscD+?= =?utf-8?q?+6rOSYdpMRImHOlcdO8aQg8xV/x2ohqOzwM5fhNKS3GXGEEXJv3VYEVDRG+4yprsz?= =?utf-8?q?vvR/kQrVpVn/lc9BjzAKgtNJTaJo/YLGQ/fdYZ/ChXdi03wYLkbxFuSw=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)(52116014)(7416014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?PNlzkrRYqFEg8QGdcIHZ//6WVn9e?= =?utf-8?q?opatXWLAf6kDProyRmq0GRRb61OHZUiatJgYfdHph45kTV+YBlu7XmMov7ZCaaGKP?= =?utf-8?q?JDLxxluKsG+UXhAkbfnzTCXy2EHXMCWn95y5VZBe/t60cqd7QmjGo8igN9VsA2kBs?= =?utf-8?q?cJRUyiKbpMEcbnC9QiWxSybBY9wrLp18vbEC3KhfoZEtEZTbyHwNlraRBWfB40FSm?= =?utf-8?q?ITVE7YaT6HMvD2mYHngenVADCPMKJL9B+Mve20SWNIAhuFUhqxvhglHW9umNdTR7T?= =?utf-8?q?J7RqaKBBJmZmVpDB2zckWpo0nqciszmyhHtUnKFwps0eBNXqbAkVXTAUDGjmz31rb?= =?utf-8?q?00CzT/EltYwE7aFHm+ON1kRAdPl0d8BijEBLt+9bB6LPlMJLNUNqUjq8cf/g+MwVW?= =?utf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C5znSPtfkHj8pLRreo?= =?utf-8?q?+abFLod2SU1kRbbsKJt7tcl4+1KULzzuC/HPc8l6FUpQ3hkRfGgG9BaaeckQyPl9R?= =?utf-8?q?YISDo1uq+bXS9h6J/kQDT0Z52mEoOb8Pk1Q1C8b7mH8ZGJXo8LWZ5h14SnTQm8JLs?= =?utf-8?q?DYwcnbuSP7Yy/AWX1OOBQuY9AZ/zYauztq+w5vxGv2LwbKm+l9a//1oivhmj7Zq8T?= =?utf-8?q?9h6kDpE8SswGV1F5meo+YVlxpk7MYp4RQkXuMW4lsGIQLbSJdVFD77MjeT9gicBzX?= =?utf-8?q?FQGaZWKN3shH?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff829c43-855e-47a4-77cb-08dcf67d8074 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8461.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2024 11:50:06.7154 (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: 2wIsLrDTn//xcATs80vZQV7UC4xs1icLhT900I2aA5/iLuADWkSnMWclpAQm3Us35yO61OQZeuN4Lradzcdt/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241027_045008_665656_10496E9A X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Abel Vesa --- 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 Sun Oct 27 12:00:09 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: 13852511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 10F43D10C1B for ; Sun, 27 Oct 2024 12:08:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=B+kcPrphzLGA7BGzbN1UZPB/S9IXEYPjoakvnz0Egv0=; b=04KHrADVT1zgqmgieq0gjwQUE5 pQ8ValUBmKOwyACVQ4Q1MPSFBUDYklcx0fY2NAlgm2Il0rmBmc6L1RprUp6fbEgRk2w4JMqhptZkd Qh4U+ZbScJh58AMGhJZT+I8RnQTQwilzGhi/iAtYtxPzLiSfS5V0VUlcALpklvAtyugdcPvY14vjB QLTUjSQiWGTOnpslkEgYDKrgLnyGnDqNEvYmrl1UEROUWFPOA77URtGYQ0YCMJ23rsX/CuzP/YCho IJQxMVk6nNvRZx2JPhYgTMciU1UcQKUFe6X66Cf25FO8tPkJVyd5o4Bbi9rQvDQ2hNuYIe91f7TIL JtSYV1hQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t523h-00000008Bjx-2Pdd; Sun, 27 Oct 2024 12:07:49 +0000 Received: from mail-vi1eur02on2061a.outbound.protection.outlook.com ([2a01:111:f403:2607::61a] helo=EUR02-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t5226-00000008BXc-45Lx for linux-arm-kernel@lists.infradead.org; Sun, 27 Oct 2024 12:06:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hCGutQkIS7sgX13CToNa41S5UBPbHjz3p83yOscqv2uyDLcFPxqFY1/VOG8NofFXovK508AUwvaIuACU7ReZoc0nNouxiRPFDVpVCOS85EINpoMB/y4mP/vYCI+UT0SqHAflHIDLOI1LdnLUyZeGV5AbEzX+oddHOJy2Xfyn/5At+47No6zLxE3feIZxU3c7c0yGTSpS+5cOb5jIi/iGLCJ0IYmSO7m6DCXU7nEPJLGeJnwzBzTYoHYRlCVGhpGLVmskaXIrQqxM/uAd9CUjzW/Q6A1cCgwkqGHncXd/3gmn3COmMUcBs7Cn3m2FuSwbqz6o7EF0hulU0NrA4m4YiA== 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=B+kcPrphzLGA7BGzbN1UZPB/S9IXEYPjoakvnz0Egv0=; b=IXI3+6wKnBlY0hj9yy9OW0go5RrkcT0XNmGKiCFFngKyYlBtcoROdXOinwV/dqk+ytAlbCmoDQhhZrlNOL1WtyhYvMTLdB64YPAujJxiqxZ77/sdEXu5AOrEuur0UKW/inyzFxds5IsUB80Z17eWSgoiLkBrbYoV1kYA9bOQ9uzZc6uEMpLO7gmlCAV4ivlwdvViNJnTWCO84blAnX+J6zJAfnmZoiMmVuol34TtLrUzMa8ek1D9rTS31rBi6bGqzcljcZxCuWWTa32rTrYMD4KzqOIeTC2/8kx0YlZ62jJf0e2+n9azD+JzUSnBksXlshkfB6+0Bq01jkhDzQf5Bg== 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=B+kcPrphzLGA7BGzbN1UZPB/S9IXEYPjoakvnz0Egv0=; b=g7akjn5BIaGonBhgXjsnT4UXvvHr5yYqvUsPPny1BzL7e8LryCqfdAxtBJyQRZxWQC5ME/pF7CrEd67fAbboUv5uFTyc6M9v6QwKfP4KVBOn1P978dhM7SYBmif34GqwgzlyQug8+YscLEH8VqDWIpYqCbgdwjwl9fx4qRgF1lOOWG+2Rk1vZ+e5kt3JTG41vTZxjvm8mfgbhy61U5PbXrAtHzUaznTeEDt+Ns7mBzHK4mcttMFVHBmodF0p+Z1+LQ7TA6X9FBnOMd9hlBlkAOjQrJZzUn8xyz63hYjvZtWP1G2qLeQKTAPgUwVIjQt7WYJ0yFiZsf4mm98PXgaUXQ== 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Sun, 27 Oct 2024 11:50:11 +0000 Received: from DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197]) by DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197%5]) with mapi id 15.20.8069.016; Sun, 27 Oct 2024 11:50:11 +0000 From: "Peng Fan (OSS)" Date: Sun, 27 Oct 2024 20:00:09 +0800 Subject: [PATCH v3 3/5] clk: imx: fracn-gppll: fix pll power up Message-Id: <20241027-imx-clk-v1-v3-3-89152574d1d7@nxp.com> References: <20241027-imx-clk-v1-v3-0-89152574d1d7@nxp.com> In-Reply-To: <20241027-imx-clk-v1-v3-0-89152574d1d7@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, Abel Vesa , Peng Fan , Jacky Bai X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730030419; l=3036; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=84M7E9SFxBK3SAqAyey+G62IZbKKHtL8RhiilZogEI0=; b=1dp4lIBmYsrpsEeHK/aDU9oJ0s/10g4Ap6rgDp309cycMXdhfpczYI2Qo9LNwe/TMNS53+dZV THPz6oe0exlBhtyz1KVCFihhhDnLgOeF7Q1BRNtePTL94Cv/6eEyRhI X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096::21) To DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8461:EE_|AS8PR04MB8689:EE_ X-MS-Office365-Filtering-Correlation-Id: 4feeefce-3023-4681-d159-08dcf67d831a 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|52116014|7416014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?B2XFNGDFC/ZeZ32lDt6i/gzBBAe6YsG?= =?utf-8?q?tI00Uf5xh0+AW7XPWj2N7CejovlyOOSKF4ZYeQCi6mhUYZ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boumdajAV5vnJvJ/T22iXN?= =?utf-8?q?dqVElsbMDnP8kc0cTRUjEge1HHAAWnnTEYkJLQffq2cDknvbQnGOoXclRgmhZwXJE?= =?utf-8?q?jSLAxRl1QuFtD+5qdeLKYVTXkCwpPluoZphPqglhGJwJpY/Uv0LhQ9zUmyqQ8ve1d?= =?utf-8?q?Z5VlnZRooPd4AORUBz+nUel7ODzzI2p87DMCBr7ZRhlHlpH9nh5WHdvy2k0oODLc0?= =?utf-8?q?oHML8c9thj5q4ln9vIied/8RnyDFsfcgy6gjDe7WjMzg8v8o1/nYk1OIF4rij+Dvh?= =?utf-8?q?nPXqmDY0/9by+ACbAJ2S4oUHHG/fkhxU6bSoFKlA/AWNR9qYkWMLPDXItpilG3VqS?= =?utf-8?q?vxPpLe2V7lv5b6c+PfNyb/V/AYOcDyOrxvvU/7GLufJsXzra+ovauz0A=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)(52116014)(7416014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?YiAmYmAG4u/1JCXmY9mnJmhF7cdH?= =?utf-8?q?roJYQ/YRb0eUJEXni1T8CQCcRXBkGV4fYOZVuMvTI477Jr52nXF15Zhu1YXVuah3Y?= =?utf-8?q?0gq4623I07QvbLS7KzmsM5oBnTASLCnwlm8Tyye+rl1DIkV8de3fzMkGwFhnhUzUj?= =?utf-8?q?YqLeTrEHqBl+DjFw/xOKTTDNfu7SZYvpewGAZKqFcXifChn5x8boUq+hkcegae1KX?= =?utf-8?q?fCUtY2jTpuz8EbFGfPNV8KmZxU4uGJD9gwmuoe9PO78qCucREfos1BhXlD5hDM+wE?= =?utf-8?q?akP2JYgC/QTgoMmH3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PwZIJvnrovNrA5dhNOP7px0q4fvzf35NiIjB/itX7?= =?utf-8?q?t70vlSQjDIB+hCUN9FIDFjjHLO5gt+cN2MNUB6fyzPUxbD1R3Vwlmwg7VwP51rPyX?= =?utf-8?q?G223HzMM5SnyaGIDO9wHouq4WejrxsV09Ij6VQ2RyjwdcUudjwGaKe05un/nbEnUd?= =?utf-8?q?Ez5FrRqhBKKWZn8olrr1tOoADtF4XkgW2rvR4h6cObLfdvRfweQcA8LHsas9NMTNc?= =?utf-8?q?8pXziS8GuB0vk3liMngeNYSYQlRbmjWYkyhzWPGJW9HZA1nHfxy7G4cAUCwG2pcpR?= =?utf-8?q?3zV0kk1aFXdVjU70/1psnoVksYskHABrMRfreh9BKm3GnTXB4vkgMEFB1ktK/7HoC?= =?utf-8?q?26jrjeHoaEZL?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4feeefce-3023-4681-d159-08dcf67d831a X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8461.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2024 11:50:11.1615 (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: G2ru4uWvSfJqeZ9D5TFrtqKkBAa+Cf/qeaA5+z9OXvmlodrQlt7p+j0mS5L/6lq006hG2H4pbqwT7r/UXgHW3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241027_050611_023712_158E1CC8 X-CRM114-Status: GOOD ( 15.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 achieve the goal. 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. So use readl after writel_relaxed to fix the issue. Since we are here, to avoid udelay to run before writel_relaxed, use readl before udelay. Fixes: 1b26cb8a77a4 ("clk: imx: support fracn gppll") Co-developed-by: Jacky Bai Signed-off-by: Jacky Bai Signed-off-by: Peng Fan Reviewed-by: Abel Vesa --- drivers/clk/imx/clk-fracn-gppll.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clk/imx/clk-fracn-gppll.c b/drivers/clk/imx/clk-fracn-gppll.c index 4749c3e0b7051cf53876664808aa28742f6861f7..85771afd4698ae6a0d8a7e82193301e187049255 100644 --- a/drivers/clk/imx/clk-fracn-gppll.c +++ b/drivers/clk/imx/clk-fracn-gppll.c @@ -254,9 +254,11 @@ 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); + readl(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); + readl(pll->base + PLL_NUMERATOR); } /* Wait for 5us according to fracn mode pll doc */ @@ -265,6 +267,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); + readl(pll->base + PLL_CTRL); /* Wait Lock */ ret = clk_fracn_gppll_wait_lock(pll); @@ -302,6 +305,7 @@ static int clk_fracn_gppll_prepare(struct clk_hw *hw) val |= POWERUP_MASK; writel_relaxed(val, pll->base + PLL_CTRL); + readl(pll->base + PLL_CTRL); ret = clk_fracn_gppll_wait_lock(pll); if (ret) From patchwork Sun Oct 27 12:00:10 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: 13852512 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 837FDD116E8 for ; Sun, 27 Oct 2024 12:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dKK38nCOci4ZCIoXe5gEa3U4nuztclm+S/58tn7qlss=; b=KPNVoDAu64Eci7FueXQtupNtvn wKwkDTPbNBSnPJ/1KCzYZh7RYyjZ4S2MzYn0ZuQE6ujLxPQktA0T8QoL5PsJQJPzqL/su6tDcG3bJ 33R31ERitYvOAnKj+wMcBQlUUx0FETHTJTtoyovUFvFvEFnqjJMfR6W7MC7gHfFJ5yixpIgZ2Z2Aa XgUGmy6RD1uo3MqUD2vraNWo4Kr915557zXCPoM7ksDQsU4R834oKa+8WjlhdxevPxgXjBHgVSFj+ 8+81kG24jW9qq1079ez2lusF/+TZKmnn+cvwNj/KsJ5zDFgPcTR5HISJ05+QE1KOO87UgqySdbXg4 H1LVJnBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t525E-00000008Bxu-4BUj; Sun, 27 Oct 2024 12:09:25 +0000 Received: from mail-db8eur05on20610.outbound.protection.outlook.com ([2a01:111:f403:2614::610] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t522C-00000008BZh-12CJ for linux-arm-kernel@lists.infradead.org; Sun, 27 Oct 2024 12:06:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=emxw4LreFEk71+21SaSWo7nbumo8bCGauwMgFVhFZD5bTFGzqGrLDM4+IxxwDRsvx+bxZt8S4HSPeiyLI859zbYziLlEeVN9CevcO41xNluBWNsTUtNgaBgEzUBAEjdDfgndhJuAKw6viJ+HYcbS1x396O0ira2cUmoqZixn4YeCdMWvVC0Lvl2pKwKWIHXVUgzFsPlqPCZqJ537r7aKWyunYw5eYFFW/aFS9ZwnlsgyEi7ZKIUpq8dyst8h1tITqBsIvlhDvd3kNYcxR+mVAdm+KsMj6KKh/pIY7b+H/VmD8+2jKBNKanenQz+z3ne8F0QnPlavPJ8K5NdNXjJm4Q== 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=dKK38nCOci4ZCIoXe5gEa3U4nuztclm+S/58tn7qlss=; b=brYH210vPkX7uoXvCGrqlSOL/qmhAS8IXpIil4bUFHSojPQjcWyf7kg4paOGk5SBrgqpx6VzkNz3lxW1mRWKPGlTAWSctyCLvJjSGf+Ovo3aV3WzOpCd4PRF3L7yGW2AfrIadb6FwKC8QGgcjBpVJJBYQRyObyrNlnlrC5WZ8W030M6xd0kDAIyglkcfD1241wYLZY7EZOkk8/FYyiIq+LyUK6VRWFAW43t6COqM7TNU9MH6mPEmTdiMAMfdF1RyzbUuh+vzm9cLJHQE0ELdwVnLZyzQBkbzJe3yPxqEE/pBIJnBMYQv9/OLxJKv/mSVx7dKLCgHffrflf+3T+wu5g== 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=dKK38nCOci4ZCIoXe5gEa3U4nuztclm+S/58tn7qlss=; b=pbxjIn9m7Zgcj0kCZKmvjiWN23KdZDJ+IrZn7WA7Bvu0kE9iqG8HMnjzj+cdzgyJDW2IeloxeoL3T3tr3WaOqSA8wFC5jgT7LUjwEBI0aumgeweP56M/gRS16FWJ4/YRYlLyTU48sc2ecRm9oXAwnO3yNFCe4E+GFXkZamZ0Nbz+OlGkZfrNeTrdopVDXV7+svKh0/X1aZXUXvwveRwIvauaTg4KcXlBxYbWuOICESrh8t8jZBYejYHgFM7AUKAANR8JH3L8p2XaDLlrB6m6veHG7hDHD808l+iObsjevqdYKgYRBw/cR4dyQXI/6x8fkYD0/bnqIRthXTfQbK77WQ== 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Sun, 27 Oct 2024 11:50:15 +0000 Received: from DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197]) by DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197%5]) with mapi id 15.20.8069.016; Sun, 27 Oct 2024 11:50:15 +0000 From: "Peng Fan (OSS)" Date: Sun, 27 Oct 2024 20:00:10 +0800 Subject: [PATCH v3 4/5] clk: imx: clk-scu: fix clk enable state save and restore Message-Id: <20241027-imx-clk-v1-v3-4-89152574d1d7@nxp.com> References: <20241027-imx-clk-v1-v3-0-89152574d1d7@nxp.com> In-Reply-To: <20241027-imx-clk-v1-v3-0-89152574d1d7@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, Abel Vesa , Peng Fan , Carlos Song X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730030419; l=1313; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=3X/Qf8yxkbiUb4z7PIwDr4+tntiXC7Iu2g5/3wMx1uE=; b=VI+Lsj5R2/35/vQhujc0PD5alNCf7KHi/4s8314O1YMtpUo1hUYjxxKz0Ns0behxdgRhNha9w 0Z+P3rpe3XLAM6ih9NS+2CfqqyuyxXDq95o3gx7knYeAYB2ghDPG4OE X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096::21) To DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8461:EE_|AS8PR04MB8689:EE_ X-MS-Office365-Filtering-Correlation-Id: ba2e4a91-853e-4efa-cdac-08dcf67d85c1 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|52116014|7416014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0MsaxTi+3jND+nCtgphkZlULNo7EoCb?= =?utf-8?q?8a7sWDpvG/C3HDTjLQcbpvL3hKwnfCZLxxNC9/pa0fMjFHXAuktW9fIScbkcgs2Br?= =?utf-8?q?ponnrGqxIaVoQ4OwFfFWzQDKHcTJsMa6ZnVyu1hKGqCtXydfL18GH7lNX/kpFz90q?= =?utf-8?q?VaQOvpQJMWtMSHE3vC3cJG/q0PvTTlg/FhJiCmhFa2/7Qu9JgbI3ZvfTNLRM2HiIJ?= =?utf-8?q?c7mE1IvVSYCESX/64UruN9QA4cOoQnosL2iiQ/VG03TIJIyOmoK2oVKJQgnNh5NtH?= =?utf-8?q?ZYGvYpLiznETthu+8hNpEKQadHmGVnycF0Bck8qVCEW3wwpkfVSusppZE5E+lrZWe?= =?utf-8?q?KTh4AcPJh5h4AkGj9dD8RjIY9iEyxqUBDV2E+bjHG2yr++czXdbKMv6wsq0kYgFMG?= =?utf-8?q?Y2rCEKDU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xm0RM58rAimCWsMQ8KGBiR3pLLYb5/unnLNmht6poN4891HqpXZyM=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)(52116014)(7416014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?n6Lsu/4gu7POt0sEY8yNsZpauCQh?= =?utf-8?q?YXrkgMo0Pzm13Dz00HyEHfVL+ruMJzKqSW0MqG5nhn/pzS3ce20697ZKGhUjqnsSI?= =?utf-8?q?mrRzRunf26OkzNYuREsoKroO7N2+PMrtPEw+atdrCqKP0k2KcmNi4VotVu/ATrmqK?= =?utf-8?q?Qilh65++KRgMbgQUsX7u6ROOK4aCMjjUfbGPWg6BJzGWU7Hz3oL/vD8Ot6DsHVjmZ?= =?utf-8?q?1Vs/7T6CvtozaSHQqBy5IQFzJBYVVuRR4gSffp7wt0qBSP94ztzMhnVFUfUF/tLHh?= =?utf-8?q?jm+c5gXQ4aDhZfp341gA9L4no7f9bdsQMtRHxsG4FsqEbtFiybFTBj4XXS2bZR2Ao?= =?utf-8?q?hGeQ0N8ZijO7kFYvhGORvnKxi/7MdEtg1rUB792NkRwM/BsVGWIdVT9nL/Rmjami2?= =?utf-8?q?qLdSPkqDbMa7bcCgXRHayEkvT4QpZuwDFow7HFektCs8fjhDUmN1qJEclPYBOwq14?= =?utf-8?q?uhRutESnu35EGzN3n30EXVnohKWuk9lxDOvv3A0Ug2DreuBd1+41QMOWRJe2Wbtyd?= =?utf-8?q?AxiBC/eaMYOGOjTqartdhEs+9VoFp2VXlhLw1BC/2virzmpTBRzWTHO6r17alDG56?= =?utf-8?q?8eyM4NTARLOAoVwaz9IlvZtb7ittvIj6PePMWT6hHnTzTwEyEukQtu1Peej76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= =?utf-8?q?nE6WUwjbG43O?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba2e4a91-853e-4efa-cdac-08dcf67d85c1 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8461.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2024 11:50:15.6191 (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: tUs9iwsibw6nou/HZ6q7KRcPtFO6optK/8m5oCo6awU2ZlnDwXQaGEM/xiGLSRWA24ROMNCCTQOHQc+ABIYhaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241027_050616_298095_4AD04AE9 X-CRM114-Status: GOOD ( 11.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Dong Aisheng The scu clk_ops only inplements prepare() and unprepare() callback. Saving the clock state during suspend by checking clk_hw_is_enabled() is not safe as it's possible that some device drivers may only disable the clocks without unprepare. Then the state retention will not work for such clocks. Fixing it by checking clk_hw_is_prepared() which is more reasonable and safe. Fixes: d0409631f466 ("clk: imx: scu: add suspend/resume support") Reviewed-by: Peng Fan Tested-by: Carlos Song Signed-off-by: Dong Aisheng --- drivers/clk/imx/clk-scu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index b1dd0c08e091b6b61f6972eb630adacaa4f288c2..b27186aaf2a15628910ea6a3d4aaa5320ec4295a 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -596,7 +596,7 @@ static int __maybe_unused imx_clk_scu_suspend(struct device *dev) clk->rate = clk_scu_recalc_rate(&clk->hw, 0); else clk->rate = clk_hw_get_rate(&clk->hw); - clk->is_enabled = clk_hw_is_enabled(&clk->hw); + clk->is_enabled = clk_hw_is_prepared(&clk->hw); if (clk->parent) dev_dbg(dev, "save parent %s idx %u\n", clk_hw_get_name(clk->parent), From patchwork Sun Oct 27 12:00:11 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: 13852504 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 273BED10C1B for ; Sun, 27 Oct 2024 11:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aeMdrbEeiHP0OWLxFzTmf1X1E5W0VvOXXT8+i272q4Q=; b=qP8mvoEc4DRDd2DLsnzgdKSNBd +Q/l38MoaoPdpZEaLNIAOkv/LS/f/edxSrNMit7SCDdvaCSnuUgCUg/yOd8YCLrfU7Z6UGnl/2UK1 Zc5rRZ2+xixFeslYRirlwv4eJyHp/ZSggaxQBvnDu/6Vn7xRqT9a1mEsHEJvKJApg8l2OwZ2S4/eU LpB31F4hw9PXxnN00QZZxElZ03ff/0aXGC0KdhaiHkGF4a7vyEL3vaHd8HHaUOw3uPV9oU05omaqA wYnp6eWtcuB6tYBiGhQfeldrgLyTFGGCq7uAvr4yIzGpkEVMYlQV7eTpg1x6JWyEi8j7BdXs80iZS yJJDWKyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t51sj-00000008B1M-1L26; Sun, 27 Oct 2024 11:56:29 +0000 Received: from mail-db8eur05on20629.outbound.protection.outlook.com ([2a01:111:f403:2614::629] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t51mp-00000008APw-0e1p for linux-arm-kernel@lists.infradead.org; Sun, 27 Oct 2024 11:50:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f2+cBNjTy2WypiP9t1U+x0enAfKrnhbmNEDv3XmPeJwD3D+a9zNpvykZ8AdZqEvPqVZA7mGAX5Fy3yzKi7sVl16iZrrxDZiYzh+pOP0LjYj6nO1Qf0ajQoYQzHZlLeJNY2aCjC/S+D9GMjzZn3i/unL588fmYD2Dcsc2VPv0y2F4RYsJyFwQaIGooDPINxpG6EZBpQdG3HYKgnzi8uWvXtGCVvZCBOrgr3Q1Lg/HdmHPtiDLdVRxJkFI+z6ojr9BGFKFhBqcd/McVzW0jkvb6MQc05m3zIfhGVDeAPkmKiJeJZ4p/DBKVK7XmZu+MPPI3qxqSllC+J1CXtface4QCg== 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=aeMdrbEeiHP0OWLxFzTmf1X1E5W0VvOXXT8+i272q4Q=; b=Caf67s8Sy/qBJ8M32pgT7vyNmRG/xjt6Yt6fORISj3LonrxJgM4FgpNVVAVcu98nrW//OZhacDwls4BxRdVQMaFWs+/OEvxbLSZQYzF+a5QDVGVHUF6zWPyVnlcPUdCw9SoFcKKSl6ig8Js/WeH9F2xP/gBuQouW5i6X3YSN+7Pj/rXxoW/SM59/F6EEmDjtmi0ZKyf2wkJq6Qfg8ng/b1ld7yhPGFkfvIBeoMJjLS/WkNGg34QkDUOHl52ypyczVeK6xV4q9P29jrerp58yjLJwuLIzpi3ZVKi0iutk9fhoSq2PAVQeUGiGc9YfUUHmppl8QnGn1Zz3yyAcKPe6LQ== 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=aeMdrbEeiHP0OWLxFzTmf1X1E5W0VvOXXT8+i272q4Q=; b=d4+3wXqmLgdwscuh/NNO88jobkyH8y58LQXtf/5lgP9Bohiq0NrHkgKtgSmdiW0YvANK41VYEPsu7w9UzFFkMO7dOXXa/7eMLGx1bwEr7LdoxFhRCjDTqg9LIyo4xLBlvcJXy4lY6SRme8rpT0b934zx1A+WTvcE6wRYGH9nNznLLfEFHBjXZJfDvVf+NCqOHNfl/Tib6Z+7ofBazUuOLzpF9qOnJfTh1HFqUIU8VX3B+PgdFUqljOLzx+Ic96pi4RXNr4Q1E10WNVhM+iSRDIDK5QAytyg4gEKSm1JAr9i0gH7GrD9023fLWfTAi9vXvpcD1Y1NMFDlsJRJiaPUWQ== 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Sun, 27 Oct 2024 11:50:19 +0000 Received: from DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197]) by DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197%5]) with mapi id 15.20.8069.016; Sun, 27 Oct 2024 11:50:19 +0000 From: "Peng Fan (OSS)" Date: Sun, 27 Oct 2024 20:00:11 +0800 Subject: [PATCH v3 5/5] clk: imx: lpcg-scu: Skip HDMI LPCG clock save/restore Message-Id: <20241027-imx-clk-v1-v3-5-89152574d1d7@nxp.com> References: <20241027-imx-clk-v1-v3-0-89152574d1d7@nxp.com> In-Reply-To: <20241027-imx-clk-v1-v3-0-89152574d1d7@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, Abel Vesa , Peng Fan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730030419; l=1554; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=k5AgvMxJOkPlhKlSMu3UDdZczpUXI2PHGzFfZGRxtfs=; b=h9DapNZroXt/cac+Tk9/QxyshQKZrQEjnIj8f4f2v7n2b+Qo0H3xPMkLdQveOcR437j8IT5mw pstmqx+cr7YDPAgl3m4/goolf2Xx/VrGBxqD60Xc24qnbK05Xq95ctd X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096::21) To DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8461:EE_|AS8PR04MB8689:EE_ X-MS-Office365-Filtering-Correlation-Id: b818e4e1-a7b5-405c-34db-08dcf67d8847 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|52116014|7416014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?RIA3L0mBQfaAOINOr11CnkmDAQN8tEJ?= =?utf-8?q?ukg9WmFcWqyJz3fkUIy6w8s99YP+9thQ1r9xsfOctvB2z7l+8P4GE1sCseF8Otv+L?= =?utf-8?q?0FKe78OnGPpOVz0hBkRfQcNrgfve6G0b+16tDWxDfMA3owTsCs3nVcPCAlI/ejTnO?= =?utf-8?q?A7whM8G4dW1JM1l8KlcCWsarOFvb4ar2k+leRefWw0D4H6j7nGPHakRZ8x78MjFus?= =?utf-8?q?jlA0azclOi0DpMxpVBKt4gb0csPyCZGX3qoAPm03EmRSQL2Bs0d+3EbeQBKNRwYgr?= =?utf-8?q?xRcK4E0f27Ak7Z8MUrJ5MGM2lyhg9YhwxNdrA6Y3c8sTKgnpPdEaJVTnGEMWI1Ic6?= =?utf-8?q?cBM3f5uIf1dC1YSQLeRKNKr+T/lkKrEDInXAGLZamuq3HsncGoAPWTYTsTRbWCT9q?= =?utf-8?q?zsUkIsvaXQ0P5h1L71NoSnv4tNsJghIvZwq198EvUGg9JbBYUTA/ztuRLtAJ+Vy6U?= =?utf-8?q?akjUIcUpF+lQiy5DdBblpbmQ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SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB8461.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(7416014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?W0qHCix9YzRPOkwKw6Ugrig7YDaC?= =?utf-8?q?2nDPgxGtYvPkJ31yUpJoVSIS9dWkE48AcxVIOm0JlJZdpmUlv1TYZBv+QXlEE0MSq?= =?utf-8?q?hAOpyhbIzs8I7XOznaWrCZJhBDPnLjag+0u4GrirtmQQnORhnGAhk1+l1gxR/p8MJ?= =?utf-8?q?/S7OLh2YMiKCLgNnkB+tR2kxfvmFSGuUlg6jxGWt3kZMGTQKgk9EE5mRJKAnBhYBs?= =?utf-8?q?fYAyB431L2b7E2WnOOdZmOynRs6yvynqAHcLFJBMWhlXrSY6bhgfPIMqrl3GG4a3l?= =?utf-8?q?CXXPJqh0AFnWKQxZIMymmbd7LycK2d1Mm3clalX9gXBF9fUVhW6EtAgO3gX3n3plv?= =?utf-8?q?Vewx4wn0R4qJ4hYytBDYMinwbe6u+3vv3JWTCHkj1yf175mbdt2hGQEgYKGTCzFzD?= =?utf-8?q?0cdTIGEjgF6X8dJt9p4t5gfX+y8jmtblgajUM/j5YCFWnPUuUPnj4DZE8tvb6gpY9?= =?utf-8?q?+pkWQ81Ym9i7frCWmtiKxk2h6seXAj/sgvR6Iggm7/MblDp4Lb+BiBajmV4A4e1cq?= =?utf-8?q?QG4S3bk6iOKQoLnkCiMkb0beAPEOMBsu3hz+zLFb7vFjD9GxjReOAt4W3R1E5vzYw?= =?utf-8?q?vlrYel3vo/tlyzDI5Mzd71hPOzLHnZxdtAlRAW3mgX7vDiHfdQWxYTDCru5Y6tIRf?= =?utf-8?q?kSpNzBnwVnen8x4E7hCN4N8qs8vi7n8EwN8ajGc23n/dUWVYqpuiK6a/ijpD4F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: b818e4e1-a7b5-405c-34db-08dcf67d8847 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8461.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2024 11:50:19.8256 (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: UBUUZHvq5ae7En+0T/bRzTPR/FE7AtYiEux6J8FSIXuZRqp+ppEj5dC/gUXIRf0tYDKyh2LArYwCZmHp6KEnQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241027_045023_238054_A61DBD2E X-CRM114-Status: UNSURE ( 9.73 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 620afdf8dc03e9564bb074ca879cf778f7fc6419..6376557a3c3d03130ca8168a6cb69eda73c43abe 100644 --- a/drivers/clk/imx/clk-lpcg-scu.c +++ b/drivers/clk/imx/clk-lpcg-scu.c @@ -161,6 +161,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); @@ -171,6 +174,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; + writel(clk->state, clk->reg); lpcg_e10858_writel(0, clk->reg, clk->state); dev_dbg(dev, "restore lpcg state 0x%x\n", clk->state);