From nobody Wed Nov 27 02:26:45 2024 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2054.outbound.protection.outlook.com [40.107.247.54]) (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 57860154C04; Mon, 14 Oct 2024 09:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896574; cv=fail; b=lH7B38nMH/Va8gQ0/E18eWIZcMZLwtXfgRv46oOxEMOSOaWWfRkKahn++xbIe+32r2kZ5tLrr3jHPBRq6qjqautsn5iheUALmNn8gaCcPqSfKM/OJb233PcXJM5iWUK4o2KLzLYRBm9EYEZZS2UUP+3Z1KH/WzuqhBPdYZW+B94= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896574; c=relaxed/simple; bh=nyNphbDXdv9/89sxQwH8tfm2s5SLSBvnQOiphaKcSfM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=fu64clC1bE3QV0p8bdJ72CZCHx5pQ0mCkQvw3qo+Y5ZDGZNJW2INus3ZfvRwy8PMaOW1tA1EdMOoln9RxCcnRgKJGjFjrJJc6TRp9Zs40cmvb6p0zie9ga4vywLG6KeWPCrcHkUPggs+e+YEl2ka8rZHTQTUNsCxYrk0AwfChHk= 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.54 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) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: 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?B?ZnIvRDBFMGU5QVdTdW9zdTdIbkdDaW9EaTFuZ0IybFY2TUh0cTQxZDFxcXNB?= =?utf-8?B?ZldDM2JoSThMUUhvR0tVUlhLQlErN1lqRzNSaVFWdnZITkhpUDJmNE5tYkJW?= =?utf-8?B?TWdNZ0VoY0x5bWV4OHR4MTQzTm1MdGhHYytoOW5Dd1hlSHI1SlNWY3hQTklL?= =?utf-8?B?UGlBTXJUUVhadXJ2eXZFUHNYOHdwakxWQUhiRlVwM1hVdkQxeDNGb2RGSldC?= =?utf-8?B?TURkMUpmRUpSaW14NERWQ21oeVk1cXZaNzZtSE9vMHhKVUNWQkVrckZkenZw?= =?utf-8?B?VmQ2bGNRN1FZeCtNRmhMQUZyZlNjVVdta0ZOZ3NqYm5YUzVNNU16VlJURlc4?= =?utf-8?B?S3JMVEZxK3JTV1RiZHUwQkJQbjRLcndQSFdqd2IzL05kdHRRV2g2b1lkZUpi?= =?utf-8?B?UVJJVzJ0WTRHekIyK2NKSGhLN2JPT0FyL0w4R0VndjZoWmtFSnBwUEdMSGd2?= =?utf-8?B?TE5IMG93S3VGNjFwemh1Yk9oM3ZRc2xmbFJOMFNGUFBTK2N3Rm1zcm1ZZ0dJ?= =?utf-8?B?UUxWcmFXSUU5YzRERkpiWWU4em9NMnhQWStjZStmQVRTQ2grTFVIazJsMVZ5?= =?utf-8?B?ajJ0ejZseGdVekJTOHpQYnZkai83N1RVU3EydEhPeUR5KzNncHF6cXZ1THZs?= =?utf-8?B?aUFHRGFSZWNMdW13cVRhL3RFS3IvUVQ4djg0V0hRTUs3dGxwT2RuRURreXZZ?= =?utf-8?B?clhjc1FXN1VoVjI3SVBHckJNYWpaMmxRakFtOWlJejhSaWFvODl5alFoM3JP?= =?utf-8?B?SC9qOWpyakNzQlJRajdkZENwT1BWK0VaMGx0YVFjMWc5eEJKdEVJOExXYjlC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QjJ1K1NaVTE2ZkpZOTJLcW5y?= =?utf-8?B?dC9rU3lVUWdKS0RQaWhlWWttNFRxa25TeFI4L1FMU3pGeXdsTGkwaDY5b3Mz?= =?utf-8?B?LzJZYmp1Z1YyQzU0UERRdz09?= 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?B?QXpXWm92VnBzbzJaMzNyVzRVTnVZeGp6bXNNN0dXVmd3NlZBWElqUThTb01N?= =?utf-8?B?T1JDMnNFMXArM1FiTFdmaHhHclkycVNDQit0dE1xTWl2QmVqdGkydnR3S1dv?= =?utf-8?B?ZGxqKyszU3hUSGdSZUcySWFvdHJ5ckxtRXdkNXY5STU2MWVOTkhiTm95OENs?= =?utf-8?B?T2ZTVmlSMllwWGxRKzFod2xhZlV4OVBsRVhnalR0ekFVZGl1SERWamdGc2Fn?= =?utf-8?B?SmNjeU8ycWEveTVxMEhycHdCNytBODhDbGJXbVdvWmVJaHQwaTJaT3ErV2NG?= =?utf-8?B?YXZCS0FmYnpid3NlbzJxVFE1TXBDN2ZMMk9XQm1wRmU3RlpqOWdORnpseWRR?= =?utf-8?B?S0xKeHZjaSsxNGVJMUp4VFp1bVFjazVoNGFGakc4OXFRN1QwSmdncTVVZXkr?= =?utf-8?B?dE5hUk9zbmhrNm1RdWlxWTgxRnhYVWRFaXVzZTVVNkpldWFTOFpNQTNJM1dl?= =?utf-8?B?ZlkwSXUranFLRm0wZ2RQaDJkOEFiSjluUkdCVzljL3FQRy9URHhWcW9yaDdV?= =?utf-8?B?REVVZE52Uk1OVUxlZ2VnTzR2ZUFjZktKUG5WcVltcHZqNjgzSGRYNFh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y5bnZZTDJkTnJJd2w5bHVkS2V4Kzkw?= =?utf-8?B?b283RW5wZGN6RlRFSU9ZU05hOWhLQjVNaXF2MGEzdEtzS1lRNkhOYmR3bFRh?= =?utf-8?B?a3VrM3o3UW1IMmJpL0dLeVR1Mm1mWERDN1R6bU1OVG5rYlcrdTBCTnFzNEZP?= =?utf-8?B?RUIwY1BXTXQxSFJ2TGtwN1dzdEFXYlZ5b05pWFNpRkIwTzRkUWl6eXJjNUlF?= =?utf-8?B?cmVnQXRUQjF1cHZ6S3Uxc0lZRW9LV2tnb0plSkllM2xCQWU3U3lQVjViRXhy?= =?utf-8?B?dk9IVUZ6QkVidGtmYXQwU1ZzeVEwdkFsVlg4cndJaUliTVFiZDgydWlBcXl3?= =?utf-8?B?VGdseklidEdpYm5wVFJkcFlVMnJ2RzN2d1FZb1JYTmhQWkVpalMxZFYvY0h0?= =?utf-8?B?Y3BNTkVSd28vR1VCcEx4ejg3Zmo0ek5MaUxNc1lJYUJYT0lkaU9LV1g2d0M0?= =?utf-8?B?VkVSTmo4Nk1QY0lPTTZOdjYyeXArZG00TFpSSU05R1ArTFExK0MzelVqZ2VM?= =?utf-8?B?U29Sd2xpR01uQVJ2TFlaSGV5Q09Od295R0dNUnhheFJqVW5VNms3UzJnVnVj?= =?utf-8?B?WkhlbkJYRjJJb0I5U3dNZkFpdjIzRjdUbnZISXpNT21yZVdud2JubXVNdkVG?= =?utf-8?Q?4LYEY6CT6miPp4FyZdJMrW2RP?= 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..2cffec0c42dccc256e8dc5e9181= 952e250870a76 100644 --- a/drivers/clk/imx/clk-lpcg-scu.c +++ b/drivers/clk/imx/clk-lpcg-scu.c @@ -6,6 +6,7 @@ =20 #include #include +#include #include #include #include @@ -41,6 +42,31 @@ struct clk_lpcg_scu { =20 #define to_clk_lpcg_scu(_hw) container_of(_hw, struct clk_lpcg_scu, hw) =20 +/* 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 >=3D 24000000 || rate =3D=3D 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 =3D 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 =3D to_clk_lpcg_scu(hw); @@ -57,7 +83,8 @@ static int clk_lpcg_scu_enable(struct clk_hw *hw) val |=3D CLK_GATE_SCU_LPCG_HW_SEL; =20 reg |=3D val << clk->bit_idx; - writel(reg, clk->reg); + + lpcg_e10858_writel(clk_hw_get_rate(hw), clk->reg, reg); =20 spin_unlock_irqrestore(&imx_lpcg_scu_lock, flags); =20 @@ -74,7 +101,7 @@ static void clk_lpcg_scu_disable(struct clk_hw *hw) =20 reg =3D readl_relaxed(clk->reg); reg &=3D ~(CLK_GATE_SCU_LPCG_MASK << clk->bit_idx); - writel(reg, clk->reg); + lpcg_e10858_writel(clk_hw_get_rate(hw), clk->reg, reg); =20 spin_unlock_irqrestore(&imx_lpcg_scu_lock, flags); } @@ -149,9 +176,8 @@ static int __maybe_unused imx_clk_lpcg_scu_resume(struc= t 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); =20 return 0; --=20 2.37.1 From nobody Wed Nov 27 02:26:45 2024 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 D7F60156669; Mon, 14 Oct 2024 09:02:56 +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=1728896578; cv=fail; b=FJJWwQB29T/q8EsRDfoKp5AB6MFlqEjCniHY+upHlbT4+QUKmLBGWV7CQP5U0BbNCpoQDLWPpOwANoUT8hE+E96cAJctL1ur/tGhVaUhCRFv20V4hFeNpA/gUy8Q1uBRKElYvI+f610CGJ/DhPYDpiFMcfaCopudWFgJVufbU+o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896578; c=relaxed/simple; bh=ExlIgQbunead4w7dEkppAfw/EYJaVq4W07T9IlXzOBY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=i454Y29qZPcgOkYxdSxpJvlQH5VbKs631+9NYKzaPpBtMPDeinjECAgbCAc9mYRAhB61THC2cyGK8io4G5LMJVDFb7ynju4c6H5FeZAjVUotkO3tfae4SHNCbqqLKNk1RoFHGKMEqZlmVlu7UJ9BRHs8EY9ApVrYuOs3nqz7QfI= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: 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?B?L2haWlhTU2ticGFVMEZKcXUwcS9rcHM0V3pyRzdmUFZEYjdjNFp4WG1kbDU4?= =?utf-8?B?T1dDTjV1Nms5Qk9zMEZITVRMVW1PTUFxSE1CNktXOWhna21pa3pBTWJpSWVt?= =?utf-8?B?cDlRY3FOb2M2dE83anNkWUxwUkY2SHlia2owK1RXQ1E2djEvQWpQdWRlWWdG?= =?utf-8?B?TzJoeW9Lc2dmaEhpWlJ0am5PUFNCZHFTRVBxb2gxdVA3ZWtWbXB5NlVQYmZ3?= =?utf-8?B?dUhSTkF5Q243Z2kwNGhDZVlqRDUyUFBIdlJhMXlNM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cERwWTJFNG9JaGFPT3BaTEtFMSszLzdxYjNR?= =?utf-8?B?RVh2OGJ5VjAzTVlFcmVvUVNnWlV2S0pRV3dobG5XRENVOXFHM3hyNjdDTnRC?= =?utf-8?B?TEllaVBpVEE1K0Fmb0NBOVRhWDViV0E1TFlGMG4yM1pQUXYrWmllZHZNU0xY?= =?utf-8?B?YzFPWVBwOVNvK0E1L2x2L2VjS0Z3YkxlNE5hYk5XZzBUSjRKM2FFdFNzbE5L?= =?utf-8?B?dkN2VC96TmRQcmlmeS9SeklaVHI4cWhFYzJRK05BemtVOFZ2R3F0N08rSWxy?= =?utf-8?B?ZXdaZlJncXpCejNvK3lrYk1iTllBd04vU3FIQjFqQlFIY2JnYTl0bDlER3d0?= =?utf-8?B?UWd2eVZnbmdSQ3o3cUIyTldWZXhxbDA3akVVb0Nub0x5UlRONXRIRHh5c21G?= =?utf-8?B?ak1uWnVDWWNhd3pOMXl0K25ZOUlnL2xxMTJUZjVwWXdReStLcmU2c3hpeUt3?= =?utf-8?B?K1JVVFdOUXQ2SzBJekgwMWJRbU1rSTlOYWRVRXFsakJ6WGQyU0V2V1FrRG9q?= =?utf-8?B?MWs3VWcxa3oraFRDY2MzUzlTQ0pYK25sL2VrUHZSNXpDUjhmWFBEaXMvZ2dm?= =?utf-8?B?QVlxVTl6QzVhdTNqVzlQSXlBa2RKMmZQdWVVOHZaVFNxNmwzWXlXZGZvSzNq?= =?utf-8?B?NjNQRm4rNERZYjJiR0YwQT09?= 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?B?TTNmREw5Mm5xZTZYaWh0RmpEV3FWMktWTW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TUJEa1Vjd1BCOThXSEVQRjBXZmhUNzUyR2lKaEJuVnlOWktQNG1JdVNq?= =?utf-8?B?T2o5OCtienBUeU1EdThKQjVxOVNrNWU1Y2ZzVmpRM2VwMUFLaU1FVmtHNjd1?= =?utf-8?B?WmlnU0ZkZXJVRWVoT21qYnpwVHAyWjFXSit3OTBqZjRyemxiL3J1V0xjNkc0?= =?utf-8?B?UDNxRjM4UG4yVTRqSTJrNzhuYnpoeGdIeEc5TmVmYitUcmZ2THgwN0hMa2xB?= =?utf-8?B?d1lhQlhuZ1JzQUlnYjlWcFFRM0lGMkJ4RU1oQ3NGM3ZGRWJPZ1lYNXkrU21o?= =?utf-8?Q?enGNkD8oYD/sML8T9embcxx1M?= 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..466c0de11ca7d5af42a5ec34fb1= 97dc90b1742b1 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(stru= ct device *dev) { struct clk_lpcg_scu *clk =3D dev_get_drvdata(dev); =20 + if (!strncmp("hdmi_lpcg", clk_hw_get_name(&clk->hw), strlen("hdmi_lpcg"))) + return 0; + clk->state =3D readl_relaxed(clk->reg); dev_dbg(dev, "save lpcg state 0x%x\n", clk->state); =20 @@ -172,6 +175,9 @@ static int __maybe_unused imx_clk_lpcg_scu_resume(struc= t device *dev) { struct clk_lpcg_scu *clk =3D dev_get_drvdata(dev); =20 + 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 --=20 2.37.1 From nobody Wed Nov 27 02:26:45 2024 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2054.outbound.protection.outlook.com [40.107.247.54]) (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 A181C156F27; Mon, 14 Oct 2024 09:03:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896582; cv=fail; b=ps5jJcEA9UT99rK/+kwThvZ5OWDilc9aGsAMwlDqFD7i/dXgMRLisgOA3rl1VwLUU1Agez6jU8qkCqryXRnXIe9Hc5eSPere/ytcUSmw4+eusfBUOKBilnaxvOUfO+UxAHZDjvzBoVILALF3T67MlGXYu3F27/qDNcNzUP5bm4Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896582; 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=Ax0aeI14TXtH/Xj3Bsyy8Ko8FIZTXl3zFauv/+wXhcq1fGmVO/iZkSdWRE2SU6F5iVdG/15wMxTt/Q8uEgcxYQOZWusxdByLUBqJgv7s+WuM+nQJjDJXYzmsUSMtJ9m8t8tSnoUTsxowK+aUsJg4L7LSUPFQjUuyNTS4DeLHWbM= 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.54 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: 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?B?NXZlNTJVTXJWSTI3VTYyZlFHRk9tSzRSK3hEdkxHQk03TFJoSnVTQkFuZlpV?= =?utf-8?B?NEN0YnhYWHZrekc5ZU91RGZUdVlTMUZEU3JYREZOVnVQUU5JL0lIbGJZT2o5?= =?utf-8?B?U1N2WGl1Y3l6NFFPeEkrWVdnbXBUTnUrTk9EaUdPYlFzQ1VtWncvaU52QnRZ?= =?utf-8?B?WE5RaEpuVkNneHNHRTJjRE4yYThzalN4b2ZlaGJKV2RhVlM2NEszNmdza3NL?= =?utf-8?B?NU9qVEpVSEN3NFUzeUo1OUZFc0x3bHlXWW1nU1M0R1JJYnhpY3NGc2Rt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2bENjeXJiUEg1?= =?utf-8?B?VjlMTFlvQ1RSaVVqZVRHbWFrVHZHanVMS3Vzb0o1cWFiRUc3azlIRHpnTFF2?= =?utf-8?B?VFI2NXBLd1psQ2VXN24vcGt5bTl1MCtqL1h1OElXckgzSlBEOWNtcWlwalY4?= =?utf-8?B?aU5IZzBOUTlqY2JRbHFPbzl0Q21xRmNDUjRmcUtkZm5naVFUV2NZN3JaY05K?= =?utf-8?B?bVRLYzZhYVRmREFEUlhWSnplSTJvVisxT0tLM3VOdVJpQWl5elpMeFlKVkRK?= =?utf-8?B?MHI5c0YrN2o4ckNNaXdlWnVqbEEyZWk0cmZFSTQ1MjI1blJZeE5GL0dIWWVZ?= =?utf-8?B?V2JkNWhSVkp5b1dwd0FQY3dxUmxTRmU3ZmNPc05ES3RIUlRqWm1UMkplejFV?= =?utf-8?B?aytBdS9MT2xRUm83L3V2TG9lcDJ1SkFsRGx6TzlkSklLTFFzenNjWUFiZXVM?= =?utf-8?B?SEFrV1p4VThBaDB4a1ZoVXkyUEhrMDcrRmJhUFhZbXVsaWYzZEc2NCtUd2pD?= =?utf-8?B?UWoyQXFBT3RYRENJRmE2OVl3SnYyY2tGcDZTT1dMQ3ZtM0E1ZkRCdms4ZDBi?= =?utf-8?B?eTVkL2NuVWNnQU1uS0xxMklBOFhhWGc5TnUyeXNXTlBOQkFRd1I4VERVNmsx?= =?utf-8?B?cXU1TW5oVmxYK1EybFA5QT09?= 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?B?UVZRL0IxRGxlZHE3dy82dFQveGVaeUY0WGF2YUJhMEFaaVQ4VWU2bFN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qaTQ1ZXlQeU5zc2IzTEljVTAxbDlpa2V5?= =?utf-8?B?WStLOHBiZjlqTGZQZ0NlNmp6WVVaS2NZSWo3aFl4Yjk1YmRrNWVBSW1iQy9C?= =?utf-8?B?MVpZWENiT1VLbWY1S0F0TTc4UUJqY0NoVVJHZ2Iya2djSVZiRUdFSTNsY1U3?= =?utf-8?B?MUJDRUtyNmpPZW1teGE2dXcxMDFodDV2OGU0T2QxRU9kU1hFc1pqdWpyWVJi?= =?utf-8?B?UndaQUtCSG9nb2YzUWZsZ05oYnFhazM5Nms0QmlnOFdrNG9BU3E3ZWxrTkVJ?= =?utf-8?Q?fOY+JlHQ0zLcatUVf20/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 =CE=BCs. 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..4749c3e0b7051cf53876664808a= a28742f6861f7 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 |=3D POWERUP_MASK; writel_relaxed(val, pll->base + PLL_CTRL); =20 - val |=3D CLKMUX_EN; - writel_relaxed(val, pll->base + PLL_CTRL); - ret =3D clk_fracn_gppll_wait_lock(pll); if (ret) return ret; =20 + val |=3D CLKMUX_EN; + writel_relaxed(val, pll->base + PLL_CTRL); + val &=3D ~CLKMUX_BYPASS; writel_relaxed(val, pll->base + PLL_CTRL); =20 --=20 2.37.1 From nobody Wed Nov 27 02:26:45 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) (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 2510F158548; Mon, 14 Oct 2024 09:03:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896587; cv=fail; b=gzzHMVQ+XIoCOP54pYsvioalJZ6TBl1Tb30zie58qRGwUUp2Hh7LwSz34AdT+iBCmy42fdJe4IOXwQNk8J/epV44acBUoPEvg3SyC0LZTBvM6niY0p7aqAwCv70XfxtmfbAG8DW5caO58FM6lMACQvQ/4JLqa3hy9SId6n5hE5o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896587; c=relaxed/simple; bh=NMaixJesrwjgxBT4NT5looPIkUt0ihb+TNQ2+BNtgIw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=WKMjIpzGNVJU9yUBwxNL7r1nsgoE0rEvF8eA2BK9KZr9x7O5E/K08OvPQTjRgZoBtW6caQPkJuI1WSjWU2MXc4nW/zekJ1kd6LcYG99B8sAd6PzMDQ/wfRp4cJxTGrEZuj9Az+HoJESC/tsynpVVOQSALhizKpaHiJRcakH4FaM= 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.76 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: 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?B?WlA1TkxqSkpoOWdkYk9NY1VnMERuQXZUR1o2NGlzRDlvMGIydnh1S25zNVhF?= =?utf-8?B?UjFoWUEyY2ZLWnk1T0lzZDViTEFZQkZJQ1laRm1LRWRQYzdKYkd5K0ptR3h1?= =?utf-8?B?WndDOVlHSFo3VEwzNmR3aS9HU21uS3ViRm9vd0tqd2t1TURWVmpTUHh1eC9S?= =?utf-8?B?K0VWMGIva0lQQzhyMWVZaXV4UllyalhxZ2I3dVJQblBhSlRCMld0RVl1S29z?= =?utf-8?B?SjQ4d3oyWGNZbGJ2ZjhGa1p2T3V2TE1KZTlWYjk1ckxjWlQrSWFPS1gzdWt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h2Tkl5VmZ5RERtcSt3b3ptaVJnd2xN?= =?utf-8?B?cUxyU2hCTllXMFNvZGJuZGZjazgzMHExQm9EcUFXY1l3SXhxbkZ6aUlJVURU?= =?utf-8?B?VitxUFhRSzF0aE5xSUJVL2pUOGFqT2xSSHNXOFhoRmlVYW9Qd1R0NGhFbzZi?= =?utf-8?B?dDlyY2Y0QTk5dHp1MlplUUNjMFZSZTlZQ2dLdDU1eW5ZUVdHblVnRWQ1djg4?= =?utf-8?B?YWZWOXJxN1Zsa2xueGlrSzdxdWVzc3F2TVBNOExvZWJhYlV5aG9CZFNqMWd5?= =?utf-8?B?Q283eEJMYkxZL1RCK3ZUaTdnNjQ5SUcvOWY5cjI5ZXpBOWZUWkNIOGRtK2JI?= =?utf-8?B?ZUxLdVd3UnZzUG1JU2RqQXNIZmxGcG9sTUsvK3pyWmZFbFh0UjZQbVlmYlY4?= =?utf-8?B?MWJZcVBCZ2R2RFA5R3ExUFMzU2htOSs3SG9sOEw5NXdvN3VpSWU5MHg1VHpl?= =?utf-8?B?SHlacGJRNzQyQk1OL1dOVENUMkI4S3dzKzRSaTJUaTFMaFNha2JjRGhxckx3?= =?utf-8?B?V1lMUnBRa0EvNUJ5andFekVtbTdaWlZVL2thS2hPWnprZEtoZXdSR05FSCt4?= =?utf-8?B?NHdoeXZVelJqL2taVzBrQUFxVkNHVVdBMk5qc0cwYzBIUldEVVVtMDBnMUVT?= =?utf-8?B?eWIwMXpKL3IzVU5ISFRXQT09?= 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?B?RUZFUDhiRmJzTmd4SmJHZlVXNUMvS1d2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DZjY1V0tO?= =?utf-8?B?Z08rK0c3QmNEUmJJbWFoV3JadkZWUTNBMlRpU3A3a0lyS0JDeDJqY01SazNq?= =?utf-8?B?VTgrckY5ajRMZFZuSjh1azhjZU5aWlNQQ0ZvbjR1cnhoTjIzWUZrZ2o5WEZO?= =?utf-8?B?RlNtOFA1MXUzNEF6WFAvYUJDbUJOM1FwTnk3UFhnMVhlMFVMeHY2czZRN2pz?= =?utf-8?B?SFJRczRic1NSd2ZOZzloTy9xQktWUURwSU81bDVFb3QxZ00xQ0pGcnllZ0tm?= =?utf-8?B?bk03amJOMjN4UEFSTnBzTmhzck1CY2k0MU5FWmduY2JiWHdqSzBCUDBWaExR?= =?utf-8?Q?al6dUtOGgrua6CAusqshx85gQ?= 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 =3D 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..6a4b3745d3d9aa1b583c9bd390c= 884bcb689e4c7 100644 --- a/drivers/clk/imx/clk-fracn-gppll.c +++ b/drivers/clk/imx/clk-fracn-gppll.c @@ -63,6 +63,12 @@ .odiv =3D (_odiv), \ } =20 +#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, =20 pll_div =3D 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_NUME= RATOR); + fence_write(FIELD_PREP(PLL_MFN_MASK, rate->mfn), pll->base + PLL_NUMERAT= OR); } =20 /* 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, =20 /* Enable Powerup */ tmp |=3D POWERUP_MASK; - writel_relaxed(tmp, pll->base + PLL_CTRL); + fence_write(tmp, pll->base + PLL_CTRL); =20 /* Wait Lock */ ret =3D 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); =20 val |=3D POWERUP_MASK; - writel_relaxed(val, pll->base + PLL_CTRL); + fence_write(val, pll->base + PLL_CTRL); =20 ret =3D clk_fracn_gppll_wait_lock(pll); if (ret) --=20 2.37.1