From patchwork Fri Oct 18 10:00:55 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: 13841486 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 147B8D2FFE3 for ; Fri, 18 Oct 2024 09:56:25 +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=n45sX0jlW0hUXc+CXKLrG3U7xIQumx5jCDpKYVho75s=; b=Lr4KT8V90fJHKHXdiXJ5h42FpH xLeyjsAY4riKGw3hO7dmjFKKONBK6T0gFSyN4Y5qlJpcSFSzLMaXZIU/Hui2VfR8+dVypiDkfR4lf ztfZAa605K87ITOR6YX2AQeu+1vffS1CrgMF1EgCPK2IO5k9r/loSpC51Gw/QQicKtIAwpx9c3gOo LEbwDXnvsXAdWPtcMWE8HLmvD2c6fqw4MZSY+1lRwTm05ZRmc+fIp2T5dBY5cy4itMhR6teX5hluI /inJUdCX2NW7o7xUiJFAoDEvNxWvmkiDN1XMU4kANdkAsrsDNViMiZsOxiTDi93MMpfDKJQlQx4it 1zxch4tg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1jiP-00000000GQV-1XnR; Fri, 18 Oct 2024 09:56:13 +0000 Received: from mail-vi1eur02on20608.outbound.protection.outlook.com ([2a01:111:f403:2607::608] helo=EUR02-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1jey-00000000Fdt-0QOM for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2024 09:52:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=io5TKuDedAetOXwvKm0oAH/oLTSa5acKAqGG4RRyGRJDnL0d0SIa78IVN+mtB+T1DWWm9ZTVJHltWaYfGX0jBK2v7Yp3oVoXcBFnSvewUsg9+3KcaGy0nPVNjb873bWk4iiThw5V6gyxVfgTggLV52uwUtFwFkmrlUH3Hsxu/KpFNE8aVtIazfpwNDHM67GEW8V2YeTZJhKETZe41413WphexNANor6PNzwQIe2Ij3PlehlchPyiHWkRSsY6jCUih6UMchQqkrjBvFgn+5PHMzrzGsAT7QbGZnjPS1tLWWg+53TNBRo439+TGZoAWdpg3S0z62S1u8HbVtaecy57XA== 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=n45sX0jlW0hUXc+CXKLrG3U7xIQumx5jCDpKYVho75s=; b=reZI6rubg7cBePb7xzp7TEn7/qjDhZKlDHKnW6e3Bjp2DM5GRnB6LWjCFLDlELLN8fJjO2jpJNzqsqRB0uk/JzC+gzeQsNk1z7hlb6IjAiWKyjTh5J6aWf8vg8I6AswTc0NZmJCNyQaRz0zpylPHMGubkILUakddYNjrN0XCR1u06BTaVi4cL/7WKRh5MLTPjPUre6MEVRa5Kdm0GEwgKDPzHVwQagW9Nej7ibVmn7Kt0cSm/d3urDzmvW2PRkmHqPv+PBooHY1EVI9VQTawv4PF3OGOrymOQd3xqNWHAhYlIpqjHFAArF3pigfr9sm1EVW42tkkN7i5wFTqV+BIXw== 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=n45sX0jlW0hUXc+CXKLrG3U7xIQumx5jCDpKYVho75s=; b=thqzPscwV1B4Fh3hW7IfSIlgO+Z4WF2uOJxX+kK5B2AcFQTnWP1QKMk0IM6RZXGP+eU6vNaNaz6csJmYBjvuorHRwVrKnOPGWPCc/LM1x7M844R+hQ30GMyCq+/yXq6RNUBxt+jNY4OuvtMZ0tzXCsSkTEw7F43yF5TtKl9sdyjS6lD/QcZ8EDQCWMb/McISQKc9fhiYFYphDrsAaqEHTZHT5zXrew+MQ2AzwBkn9uy+4ItzVvnj0lO5X9zfIb8P2AHjSdonkEMQeY+wV82CJKhkgymV/Nuf7O51F8F00kR80C1On0xBrauj05ajS5QWjH5a9A/W1CSXbWCSPXTPMg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by DBAPR04MB7285.eurprd04.prod.outlook.com (2603:10a6:10:1ac::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.20; Fri, 18 Oct 2024 09:52:32 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%6]) with mapi id 15.20.8069.016; Fri, 18 Oct 2024 09:52:32 +0000 From: "Peng Fan (OSS)" Date: Fri, 18 Oct 2024 18:00:55 +0800 Subject: [PATCH v2 1/4] clk: imx: lpcg-scu: SW workaround for errata (e10858) Message-Id: <20241018-imx-clk-v1-v2-1-92c0b66ca970@nxp.com> References: <20241018-imx-clk-v1-v2-0-92c0b66ca970@nxp.com> In-Reply-To: <20241018-imx-clk-v1-v2-0-92c0b66ca970@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=1729245675; l=3168; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=5lV6Fnymwi08mNJOqfNiqBqacUaEGvCOefJyeSXwdDg=; b=zldSwAASvzZPp+4QoKIdmyOjLYUE2CgIaCB5H/e+itCHrvZX2WNvv45/rbzX3una65nJkJhP7 SxJMK9swp/RDf3AB1+IxJRCpmiDz0ARmD8gDN1bRNKXlEpkflEubfU7 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR01CA0028.apcprd01.prod.exchangelabs.com (2603:1096:4:192::21) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|DBAPR04MB7285:EE_ X-MS-Office365-Filtering-Correlation-Id: d05c2861-10d0-4168-dd45-08dcef5a961c X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|7416014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?s6tBmlZAmZ/gjZd3rXEGdZkm/3qPh53?= =?utf-8?q?66M3Qboh346j/1dNlcA8tOQfj0HrUrs6PxMBXjpaddkB6T+3a5Y7gZefIyrVW34bV?= =?utf-8?q?q9oQ77qL17IzmZoc88kvSZi03i8lyOgjoAm67lRIksMZD2wDTgnq9y2t4+zERz3RN?= =?utf-8?q?M9oVhfyud3lU0V/qUQjY5MznGCzzIIFVkH05tDTm75ehleohLWroUpboXaExQ/QZJ?= =?utf-8?q?TG+KOfwmpm80cQ6MgBZ7PrdFke811PmSdXGkbXT9Q1CQY6E+9ruy1D/32O7r7RiRg?= =?utf-8?q?4JnGw/FEXiOUZGUcAkCB0OIqC/5m5X8G3oOky87dIUAPl36K8rvD6zpWIvCCuyf6B?= =?utf-8?q?UBBzJzoCX/ClFQiGOBV7EMqe/OnFqU0P6x/ZRDvaJAe2JoVqvqgj0ENvC9Tin8ooE?= =?utf-8?q?paIgRxj7M6pMPf2yyDoF0aOHADqmN1resb9xbjWRfUnRc4MgOQ6uB3IiBdE1RxewS?= =?utf-8?q?FfTZwM7LGRsZhJ9k0GFkFDyzr0qM0I6nr5jJ4RIY1gWicb7YZ9Q5fSMvGxA+ol8MC?= =?utf-8?q?wdNOqE+jI7b0TEUmX+W7rvq9IRjTkiZlIkC3G7Dyk/FkDmcaq4tzyEKPGfLl3QqwX?= =?utf-8?q?Rs94+eNqK3Eb3ECBrD6+woRlFKcqIWuEOpIAD6MOrW20CygiaYyx1gD6HNeCNMOEF?= =?utf-8?q?8gbKP0Z92MXm23hQgTVqpw3zmJ8+1tmtj6z1emn5e18RxawFT9+LJTPsinKSuAgZr?= =?utf-8?q?o9LS20benw4ySBH9irvhCcJDE1DdVgklyip9rJ9tG8h/C2DyF8Kx0/DdKzj7Dcfb5?= =?utf-8?q?yL+rTc5/3vY2BsMutlFb+m2fS9aNTTiSdfKrGAO2F+JYpIvUFXaR9QJjCLcNB32iK?= =?utf-8?q?ZoAImEQAAw9eWjhwGshI6X/cd+6Oab6wDPVfGPfRsgw5BKkj2JW/1Sz6EM6uRbpwz?= =?utf-8?q?bV5l9sEeNTGC3btllf8IXgQ0z1t9Hh0rrKKY67drKNtAIIFtHWQSUaW0obGX2Dykf?= =?utf-8?q?stW3UffFu4wWJJWRLFAPdkpzMajqWjRLngt1Lv3LlZFS+qmWasfIFRUTk50QMx5S5?= =?utf-8?q?4z4SJQys7fsCUYnaSXqr89AtOCM5StZws/RUmeX+cQ48gWsRPi1CsfYXtRJn2+gl0?= =?utf-8?q?wv0AWKGaJlr4q5XPanvIzfX4bYu1ffFw2TKKcC38qP2LF8PwaI6r7K7f5ZsxwS+SE?= =?utf-8?q?FxoRrFRcfYEUDjy5X7fzjTS3uxrWFgSWwKgffQwDwtMbPSgq4SGBkB59nrieQJ/74?= =?utf-8?q?26sdTThL2im7AtyNO9CRe1kLBaH4BpUFp0N5tsAfnisJ4hX7suCcg4+nuGHfi4jv/?= =?utf-8?q?eoGkZxt7v2rN7?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(7416014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Ttbf1zsYoOOlcz0+FhG0HIiD5dCT?= =?utf-8?q?vmLwX2AaY84KvMn3PjP0GY6LHwixLmScsi6VwwXKAqn8/fhH54e4eT0VSujytk/mi?= =?utf-8?q?z/pscJMGjQOduF3X9dI7HGlSSeZmoL+830pLJ2EAT6/OJ05UnxfrMpftZB3PREHHP?= =?utf-8?q?mB6SkkM6kZKZLgYGTcqmZGYCsTyUn74G7JCAceiJY/V4t0/Plkxzn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y6ta0iozOZpwQos?= =?utf-8?q?SZxKUF0a1TDskvNziyplxGorcuZoN3vbw7nbSQcnpCp+QohHiS5QsGT7KHOnOhdvO?= =?utf-8?q?Rfgs0Bf5k1yaIqFLR7yZVwmGgcd6vkTQaSOIUghoaci3BTiiPnNX2Qu3C22eQOEHG?= =?utf-8?q?nQ1g9XHbXphriqfYyqqayVBLcCqRR0Q/os5vTBmeCr+r/gVX4+2H8d9RSgnjfNg2c?= =?utf-8?q?r1SypEVLM0pvHaW8Vs8RTc+UUzh6muQbB0a0vKz37DuutfQdLRXUrjzQb8VLl5Gbu?= =?utf-8?q?TfYP5AHXEVfVgq1PFUTouRw6WEaCednrQeyBQ85oP9GHkMhb4MwGkF911oFNlzH4M?= =?utf-8?q?04IxMM2YGvjYyia7HjdN5bA3FiZ+tuxxWygLvm+YZ6EsJNo0b7BgNcYiYero2ez8z?= =?utf-8?q?D5M6fQaPvcXHsvsJtkM9kcOaH1v/uIA1ZY8q4Gqtnwkr+zzWeqJ/blAlM3yadEztJ?= =?utf-8?q?Qcz9TfCIh7ak?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d05c2861-10d0-4168-dd45-08dcef5a961c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2024 09:52:32.5843 (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: BlJNxB6c06PDt+XxCWxMk4Bni+t3v45/nI+hxnTJdrus3UNqvfrwDcz4hEAloQ0a5UfY8IEx0MSc0Sb+sWYVcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7285 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241018_025240_196431_14D4802B X-CRM114-Status: GOOD ( 15.96 ) 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 --- drivers/clk/imx/clk-lpcg-scu.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c index dd5abd09f3e206a5073767561b517d5b3320b28c..cd42190233662c66f2c354f0a2eee3a2531eeb3a 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,31 @@ struct clk_lpcg_scu { #define to_clk_lpcg_scu(_hw) container_of(_hw, struct clk_lpcg_scu, hw) +/* e10858 -LPCG clock gating register synchronization errata */ +static void lpcg_e10858_writel(unsigned long rate, void __iomem *reg, u32 val) +{ + u32 reg1; + + 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. + */ + reg1 = 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 +84,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 +102,7 @@ static void clk_lpcg_scu_disable(struct clk_hw *hw) reg = readl_relaxed(clk->reg); reg &= ~(CLK_GATE_SCU_LPCG_MASK << clk->bit_idx); - writel(reg, clk->reg); + lpcg_e10858_writel(clk_hw_get_rate(hw), clk->reg, reg); spin_unlock_irqrestore(&imx_lpcg_scu_lock, flags); } @@ -149,9 +177,8 @@ static int __maybe_unused imx_clk_lpcg_scu_resume(struct device *dev) * FIXME: Sometimes writes don't work unless the CPU issues * them twice */ - - writel(clk->state, clk->reg); writel(clk->state, clk->reg); + lpcg_e10858_writel(0, clk->reg, clk->state); dev_dbg(dev, "restore lpcg state 0x%x\n", clk->state); return 0; From patchwork Fri Oct 18 10:00:56 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: 13841494 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 82185D2FFE0 for ; Fri, 18 Oct 2024 09:57:54 +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=Cm/mFQG2wVSjBXkYDMorim2bPCGjUUwGsFt9Oh0GLds=; b=gLqOlUkHpNrxY3iTyQCBrsPgWn 6rSDvrrqeJNdyqL5bl7KkexjI1Lf2HMbJddXRblNANYdDQ0YMcBRIkdshRKV4DPGcLOZ9zpr56kkM ZXX0nvZ/+M1wWEnvM1RM1RnUf3RPsTPhBlakA+YnwUahFXPm/FkUfBNbWXKf2YVHP01NV02wCEI/1 yEquqMfIUIibCvqjS8OwVUUnI44hh3E/ScNCzU7mLVhE2xHD74RJEMPosZ7/jmHb7e22HZqkuG16x LqbpMvPYngmo20djDIAaMOpfDsPfCVcPXRA+9BijQBiFPGglQRNDSeM2AGrQp78ou7FatXy4jmAu3 UA2Z8eTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1jjq-00000000GiE-2Zlg; Fri, 18 Oct 2024 09:57:42 +0000 Received: from mail-vi1eur02on20608.outbound.protection.outlook.com ([2a01:111:f403:2607::608] helo=EUR02-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1jf3-00000000Fdt-34wf for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2024 09:52:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aji57qC18OPKTDm/i+gGteyLpB0eoYNqi0YPKeM/7kl3rVzheCW5SLbX8FnhfpLhfwukYfZ2AABTRyL5OJcpqmitwzI0+8n7VPUL9cBW+qh1K+XxnOY9oApXfaTEurQBJ4hG523aShclXKdBLU/VNU7s28BtilcGMaPU7iUgeQaTQDg1nIyRPnzdD719Zt0Shp3yyrQ9kCTHHAFkYOxUvdfVWmqEE5EsGCgHM6uEh54E424b4BycXly3pAUOS3c8RaZyj4Lfg6qE7TzU3GQ1uBfXXvklYogDUBFiCDMKa509Ro4plA0ZF53DXPgjv0aPrJ0K+umfUQxmi8WZA3V0rw== 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=Cm/mFQG2wVSjBXkYDMorim2bPCGjUUwGsFt9Oh0GLds=; b=CWqvGoLuqCXRK7wpS7HXGPDk3uiIUg1X6M0TkxpQP5VkNjgbnTjLO4eeMWQduk3xE5LToRqIZohGpzC0GnjXSxgbjRdtX3V9QAZkOgjQmCtMPE4UQd2PU45SqDTnlvfA7NuvAQ40nLq9MRNSOR8hm2YXI8z2jWUQeu0Thm6PCe36hFyKKfsYDX1To9Du4MHLOxkGAGsLSK0DpMac95EjU3pIMQLuLRjQXXNvOqESDjMquGw//GCpqbK2RgnVZQw7tq27NNppnt6Q6GRvSKsqRxIW6Ji8GU7gC28BKHpXK9kHGQ28aJkjkeeZuT8TxqbTw69FV9d+Yvi0UbhBPKhcLA== 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=Cm/mFQG2wVSjBXkYDMorim2bPCGjUUwGsFt9Oh0GLds=; b=I5zGDf0SoGmGTikOJxuBzyPkBQdITmR857k6IhFiRcWWZaqs1LAya1CIPDg/EQbjJVy7JLsuakuZp7HaaTwH6nXg06HIbKwz3OcgFRkk1UBM58qbXNUVGx/FwACo5ZzhfSnWt+Y13NOVZDzruQfz84DRMvAZ+lZKtrVlbZ+mDI1AH/xla6Nrc3k9pWUy5q8qyH4nCbLuVt9AhxvGbhXRKKJYa0yH6KwvVRz5Z3r1mwkWLL95rHu7Y0hLrstUJjBOgrMKssqsyM8uIZwWvYw7JsbwGs2SCW5n5PtxQPGzi8YEE1DkEiRfC6IvBvH1o9CpFhGrYKZzacXRq9qzt2fNVA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by DBAPR04MB7285.eurprd04.prod.outlook.com (2603:10a6:10:1ac::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.20; Fri, 18 Oct 2024 09:52:36 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%6]) with mapi id 15.20.8069.016; Fri, 18 Oct 2024 09:52:36 +0000 From: "Peng Fan (OSS)" Date: Fri, 18 Oct 2024 18:00:56 +0800 Subject: [PATCH v2 2/4] clk: imx: lpcg-scu: Skip HDMI LPCG clock save/restore Message-Id: <20241018-imx-clk-v1-v2-2-92c0b66ca970@nxp.com> References: <20241018-imx-clk-v1-v2-0-92c0b66ca970@nxp.com> In-Reply-To: <20241018-imx-clk-v1-v2-0-92c0b66ca970@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=1729245675; l=1501; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Bc91I2eEi8/lINfvZA+03pByFBF/wxNxtYOf5hDZEIg=; b=Y+dGz3t9xvJH8MXD9XRzQd4Hx7F8NpX8IvWvzxTdUJyMc6JHXo8QTNMMvkbMDsDPJgmBcw3Hh 4k4MKmfRuY+CqepJ4Gw+F+q4pGBmA5xbw4ZUuH7XEO7+9otjY7tVNGG X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR01CA0028.apcprd01.prod.exchangelabs.com (2603:1096:4:192::21) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|DBAPR04MB7285:EE_ X-MS-Office365-Filtering-Correlation-Id: 3913e856-4958-4af3-61db-08dcef5a9866 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|7416014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?jiUWc58c7YAytpTKNxw5YX69gpyPXUl?= =?utf-8?q?+6cx7m7qggOMMaryd3DpYJIfZzNy11ktCJr9HntArKtlq69laGE2bJugkCeYOsGvh?= =?utf-8?q?bXeFONDkkNELWPiqtleKPd2kussCQw7/igKJhodzDOSNheQwk3pz1nHWq5/9ZZGST?= =?utf-8?q?y+NwH/yXSjFSqBZ26fBpwrCmqm4sKtkJ2nwkzuRbEQUua7UO8jWRh8RA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utf-8?q?XoOFWZfEoW59163qStZIEtvIsppgIu9gWaaHWBPt42GzVVEQDqpR83pDOsN261ihh?= =?utf-8?q?lRz4AbEBZWfyJAwQmHlyYQhEg5xI9MccBkZ8JUNML8A5igVjd6tgBIYYqZwd5NGRd?= =?utf-8?q?JJmYzV6YWfDKN0+FbriMaUE1V9iTCOKWhVOWDbeLA+xato9OMssZSrL0tMv2TdAeJ?= =?utf-8?q?y9bYqzCMYNdu2z5eWqlQMuXoZQjZvY1qkOigMEQ55IDNVxYm/r4YrUts=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(7416014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?nbjVksECNjEpxbH3ZGlLB58HcSuh?= =?utf-8?q?lS33QuIm75lGcV6uh7qRuy0AeTdoWZ9YXWCGPgQ2l/aLCCWUvbhUAY+rqUM4hR7Sc?= =?utf-8?q?MzcsA3GeWgr/u4Mcf/U16D44Rw6MmMvhF1/eSG8Ontn9wbcT+Gl7E04OXRPiaGWCf?= =?utf-8?q?2DUUHrRfsIgnzPXmggXjzeH4x8ukwUBjLLaUG/qmAAMFe+ocYjJHCiiDh2RihzKIQ?= =?utf-8?q?MEW8o9f20jjV+fSvBhwgsVfvUB+OcTFeSdaJC9c7kicl/QM1jVJw/v+gB6hkrAYvD?= =?utf-8?q?rwfMZVFRGZuk99F848nUtaAB3CYA/SILxHdz+RfTFCHmT9TLdLpPWTw6X+MB/sswi?= =?utf-8?q?8JU8Huu0xaixDAhokUxSLoKT0yh8yjUt9753cPviBSynqfZeFPOVLm9njsPuu3LIX?= =?utf-8?q?iRJH06xjZQnSjFb1cJsl23tdwaUmzBJOznJe5DhL2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ySKtn1s/DqwwK606+sAe86?= =?utf-8?q?ebR7IKrulrMJRczFGOOwRLkvh84+x4Ahg2ViW3hyTlf3tp8c7dqu4SSLnc5ekHILo?= =?utf-8?q?nE4LNx/ukZOlSjg/4ksv1BkHubxWyI0xQhrGoxsL9+5jWcveVhY9/B4iuZtH2OFiY?= =?utf-8?q?j51OnJhSRKYTHMJxymuomKSfvDaz5D14yKspNH4Nhp0mKvYdxPsu6PSjv35VrMBCd?= =?utf-8?q?tjwMZu6saspn?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3913e856-4958-4af3-61db-08dcef5a9866 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2024 09:52:36.4009 (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: phywFUaCWgFJsgy6we+Rk2u5oIZm5nkU6C68bbHUV7N4xykKF/PUujgn10rUtAB+Di+2FMuAc6CQoX2tyux3eg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7285 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241018_025245_844088_72ADF8D5 X-CRM114-Status: GOOD ( 10.67 ) 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 cd42190233662c66f2c354f0a2eee3a2531eeb3a..07deadcf73e929841fe113c7febfb6c9b6c5e719 100644 --- a/drivers/clk/imx/clk-lpcg-scu.c +++ b/drivers/clk/imx/clk-lpcg-scu.c @@ -163,6 +163,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); @@ -173,6 +176,9 @@ static int __maybe_unused imx_clk_lpcg_scu_resume(struct device *dev) { struct clk_lpcg_scu *clk = dev_get_drvdata(dev); + if (!strncmp("hdmi_lpcg", clk_hw_get_name(&clk->hw), strlen("hdmi_lpcg"))) + return 0; + /* * FIXME: Sometimes writes don't work unless the CPU issues * them twice From patchwork Fri Oct 18 10:00:57 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: 13841495 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 8B90FD2FFE0 for ; Fri, 18 Oct 2024 09:59:27 +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=pwjYBvp4xAM40uYhpUjgN4Jd89 dubcJqnAjsnYEXIWSgzWyk7lHaobI6XUeAMm/G0yoTsOn+s6V5kQ32m/hfxjS16+rZrpY6x8opOHo TQTChbGTyYWcQBVF3Ax7GWs3Di50L2i2w95nUCHK7BXeFb5EdoMOxcgo9DI7K0vfqOgRJCNiE0wRy hOotklqqd2XzIPPJ0lQ7KnQE0+Sxl2QTkovu9OPCPDISG9Wc+z4FMdWiqvZzyuV6+Y3A2Q8ewkm2T vvApFr7kYAatHqTfTJVsJcv5Efft/dxcteg/1T0o6GMXTrvtyE4bFFqFk0nBjpYQ7PRm3E4NdAwky gdYKpK4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1jlM-00000000H7X-0jLh; Fri, 18 Oct 2024 09:59:16 +0000 Received: from mail-am0eur02on2060a.outbound.protection.outlook.com ([2a01:111:f403:2606::60a] helo=EUR02-AM0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1jfB-00000000Fgy-09gM for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2024 09:52:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z/0LLIBBNeGZ6ZjSZgjtCXpatGAzlWQWssBxR27Zy7ZnsMSJLBF/Hr2I/bkOC0ta6ZB/7xtptXydSZOZNs6P8WKJ3ujoJlqEZZxww51AaPx+Z2ifzRWI/bPjQB78X1K2dJNHA1ncYNv7bpds4m5Q/Coxy/88M/otA7eDUfDQtAYzt08vuAFw7qTWiGAx/uHp44RouYRnqWWWTf+S4yihWFtDqR8DK5o4vXOYoD6WPCA9Zu3J1BuXMnkEeuKKMe0jnt/4LCgrF+Atc1zVwmWBSO5CCSH7cJNEI44lTwPk7Bsu7GcaKHs/Wvc5+NFvzyN8Dq42DsJiLdtU4k4HrHZa/Q== 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=ghCvP5JJaAb7nG4Eg0OEkwxwFdDlZh5ZvmuIAUSHtZFbqICDF59EFDcvOUPnxjmj2gDzjamBP+D4iOZT18AtotegP5NIQ0UV0Mk4cA044NbuzcdAr0/bRr2tzDvJ6sER3qCRDKVGa09HCaj8GhQQj5yI8JMIq/AP05z8wiNP5Q7C74hZ0Xku6UGDrHUP+Vstn8ceen+KWceEmmRugLppFAam/g0l/2a+dfdE2AExFyrn0ckpkw5FQ/4N8xpkllpGzuy8UvcdI/oQLJbH7Dy9waxwu9yNvKQH/rAUNi4t5X1ZvhjFiGDSDOilpPEPlJuvwb+xcsvNQU+SGKX2ZxUlag== 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=jbZYfts+LEQj2uhI+cLMeaaSot0zK0/WIvdfsZB8SQRZjtzJfo+qZJuEdml2krbp+WxSrESP9GZReuxPFeHEXqQNcuoE0nrFxG2uWqXLG2uP18l4WAVEGX5Tm/S9OzyoFVV+DtE27gAo71MW+0YihTaeDGlOZywMmCPdx9Km5eommc5SOoqSHxZ/Foq04Dsd+xojGYVulm2IYS9ZNa158qHCNqm/+BveXSEh09t1r7kWmjGsJW+R9MX49c4IOsjcRR2UockvxF1iQYsPwQ3lmNQ/ti2nZDJHiyr/uZj1VPdd/fMBvMBp6AYGDmkJ0yNIcuXgM/KU09Xcu1/lUQa1GQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by DBAPR04MB7285.eurprd04.prod.outlook.com (2603:10a6:10:1ac::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.20; Fri, 18 Oct 2024 09:52:45 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%6]) with mapi id 15.20.8069.016; Fri, 18 Oct 2024 09:52:40 +0000 From: "Peng Fan (OSS)" Date: Fri, 18 Oct 2024 18:00:57 +0800 Subject: [PATCH v2 3/4] clk: imx: fracn-gppll: correct PLL initialization flow Message-Id: <20241018-imx-clk-v1-v2-3-92c0b66ca970@nxp.com> References: <20241018-imx-clk-v1-v2-0-92c0b66ca970@nxp.com> In-Reply-To: <20241018-imx-clk-v1-v2-0-92c0b66ca970@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=1729245675; l=1523; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Sv4CHyV16UexiFdZ+yIX03Ey/S7U3vzUPoU0hMATx6E=; b=DSOgn3MmfKf9qUurppWcHeibwzQ634wERjidpXq8wcEo6dML0JSZjn0YQQTXq6G9GACruCnpH FvZvsurJmT9CixVl+oBbQjkYWhWSNlD3FgaWeHqxwNGe4nt7VhB/xqI X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR01CA0028.apcprd01.prod.exchangelabs.com (2603:1096:4:192::21) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|DBAPR04MB7285:EE_ X-MS-Office365-Filtering-Correlation-Id: 64c9acf6-5414-42bd-b798-08dcef5a9aff X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|7416014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?dnhGO+0mRPAuAhQtgsl/dwWH94/ViK9?= =?utf-8?q?We//0dWXk3cNCSNLSA8AgDKMCwPq0nN54BHfIj7/AYjzBHN3JaClbh3i/vjGiAO15?= =?utf-8?q?Oe6t1cbC6rhMgKQlWz3i2kKF8uTg6/pGX/u0uA/df7tdp9nenmDCv9Eg+CvqFrzS5?= =?utf-8?q?QUSiMO5o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eQdtEHREZHVbBAn3L9mpXmd+STOaxi9rtOeFFgfQJY?= =?utf-8?q?kFtos2LaQnUEbqDWqzEgzGyXnVAMVh7WbJnVvFJ+tyajSJ3pdUu7eZ7cTY4kT/4BV?= =?utf-8?q?StXvMF6bSUdLJn3eTDHQJL+BfUM0wqUXCyByu62LVHvYnU5tKY/8GVtTqq2HC9xVy?= =?utf-8?q?GZHeHAUCGrlvnvjSthTq6STowZi/Ar1gp5d/xAv3RklvnSL6RGxII0z5nOX3wtWms?= =?utf-8?q?GLs4CeDmi/J5qpvgJsL6bahvL5r07wHzMB5l7rLc75hUrykp8jo6+LMc=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(7416014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?I3wbnTM76E/TaDrEUXaiLzkjpw8s?= =?utf-8?q?LEeVYGaqlscnf/yOqjHUrbgCpGnygK05d/iHoKdCw030czkU98k/ymqtwyUSxMp+v?= =?utf-8?q?wzesaZkuyV4Z8xXHnz7Bw6/9Txe1fTKBMqgeegSEr/XAY5sC/LHFssEIT+RmKzIdB?= =?utf-8?q?fT6+Gb1LPkwp/VooPYz7m2BU0KJJGHrpaBq+nCqZqgj7oD44wm2S4OLEyrYgMsoep?= =?utf-8?q?YrKHiVnAMryTqvppv84yirtMurFuJB9KYPFYqKlGET65V1qXjGAHDdXWORq3y0gSG?= =?utf-8?q?zfNcjQBHyw/TF0X9ssrc4hx5OXCsWygXDMBDYYKc1DwXHm/8LV1gWu3SYip3PGFNs?= =?utf-8?q?SFdvRPW244Oei8jrEf65F2NzW6+A4D2dpCl8ggBdZqYgNuXLQAiYEwf4ZwbWIR5Ya?= =?utf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?H8b1vAcpYM4uAy3tikTVFgsqCkjNo3S2XASJRNtuwFKOlUf7ikPe5gFVV+Eexkdn1?= =?utf-8?q?2OqNc5udadT9vllR+CpQmbDB8u4zexKbdEWdy4QY21pUvIo2lpFp1+Vftp7D3S5vl?= =?utf-8?q?1deEw1iXJCja0sZGCz5Fi++MRXa26VY6bX0gUrfxSStgkj3kFp0wirYb8bw3KeoP1?= =?utf-8?q?8SLP5ES3jdNOQEu0dO4uNT1bYxC7z/4eloC31zOtuha203QRtHvpqYZMo+bF4GGYn?= =?utf-8?q?YhMAVPKWDitW?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64c9acf6-5414-42bd-b798-08dcef5a9aff X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2024 09:52:40.7530 (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: jV0Dfm9exJm7db9bb3L6Q+HDouyhCmMEL3V8r6I9aX3k5CotXdMT6/1Pu3wcR91rgre1+sq8iV2DMqDE06TqfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7285 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241018_025253_111782_43AD8ED1 X-CRM114-Status: UNSURE ( 9.90 ) 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 --- 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 Fri Oct 18 10:00:58 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: 13841496 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 13D58D2FFE0 for ; Fri, 18 Oct 2024 10:00:58 +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=BRmt+K2J8+ihruTcj6L1lN8Mfo ZYmjg5fBpXS8twBzX2Fz61Li9vidr/CJMfQ9W00PSvSFfVALKXxHB8MbOsPO/21brAhl9AX8OuBID NjpawjOA7qqhKY0Xm2LM7ww1G90NZulwGGcft/61OKM6fQ2MhlcAeFbr4l4/1KHzHkeuXpQvRTmA9 driuWGVuk7Lnl/hTEZv/EuwXM/PpA1w7y7aKiFS/pBxrbFztckxw332YBkdOznXAafqVTR+z5ZF9L 98AcNPTXlMNIZwH2OdP2+m46HbnnQmy7mYxESgvzHhfBunP5tp5GPfabzqamcjIWkDproBorMZKEk TmesId8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1jmn-00000000HKb-0Qsc; Fri, 18 Oct 2024 10:00:45 +0000 Received: from mail-am0eur02on2060a.outbound.protection.outlook.com ([2a01:111:f403:2606::60a] helo=EUR02-AM0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1jfC-00000000Fgy-2GXu for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2024 09:52:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O+DcYc3Y7wPAHJnCmyaIrNUA65vtUSQS7QhDdR8mZYZmhv+1gMgp71QJD+Z/LLf8SM/WswNhrlTtXHIARST+P/2YRuh3Z1OZv1WHJa9xFiMWXjrrsyrs1wsFXrDhbDqD/AXWfanPDxwMycMxGdOMyd5NrhVJhUVdUXntWxMcVwi7XMEHa1qudrAFxT3VwdeWAYv0Ba7s9lm0wUN++G0J5n2qEh5utkl/aaSbYbHKEQePmakf4DmnJ+rz8EBi0Hr+y89mDxO63nOzYL3Jj4dumPpY/lRLdRcZwVAe3+NBcoYhDgi1zK1U5qlIEcsa7ma77zo8quRf9ZRrpY+Ncfkn/w== 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=XL9KuMBL8IQsy8nNkOYBiZ49tp2ytk0jY1ghIqqy0u5v0Wk5i0GHgAa9gwjrEFxIDH39Akx8QZX6YoyqHEUK0yw4Lpueknv1CtiNVVlklLym++af8CWAhVpxSX1ABtHOITco38r/b1LYniiI0uM5N1g8aXGmKlyQJsl5nQrFWBS/IyBtJjxZpl9FBFjrQ9wgeNti/NKXfL6y5Vb8N+R751/WillIGo/lvL3U/PmEty77uLbH6PB29HfCeIcaAQ8Bvs6XzYtkQzmPO72GbmUmRsiSq/w8MA0Ts6rxPBGdrYkC9s0UTksYLFmTllYRZmpdGzh/YW0KznJCm1uwwO8yNg== 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=HiinE3L8YSDl59ZzScWCpuGOlFuUIg3gQcXFirtcjR5tY1AjPKkPVUUdQFE7qUjtUcuwnVFLFvIMEcy0Rh2jVGptn5n9SHIYrp4Jzi9bd+9G1l7gPNf3epKLmwOGNM/EyAI/OCSTI5BXcPdkVojy0HOxysIqar6mvCDGJVmltP8TIrNiUCB21SedSr4Qat+S0/hqFKYQtJMdCqoyO1K8GNpeYiNpgo3Bg7HD1S95+kWCgjhgWeOyxWBWWd5GVAzIu16UoHVvF/jac0eY3h+BaK8DmUfubLk6GtXjMdISgdE4h/ewVJHffqav/VIAwyXPJu8GuVDgLaQqxpGrAVLAuQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by DBAPR04MB7285.eurprd04.prod.outlook.com (2603:10a6:10:1ac::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.20; Fri, 18 Oct 2024 09:52:49 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%6]) with mapi id 15.20.8069.016; Fri, 18 Oct 2024 09:52:49 +0000 From: "Peng Fan (OSS)" Date: Fri, 18 Oct 2024 18:00:58 +0800 Subject: [PATCH v2 4/4] clk: imx: fracn-gppll: fix pll power up Message-Id: <20241018-imx-clk-v1-v2-4-92c0b66ca970@nxp.com> References: <20241018-imx-clk-v1-v2-0-92c0b66ca970@nxp.com> In-Reply-To: <20241018-imx-clk-v1-v2-0-92c0b66ca970@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=1729245675; l=3036; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=84M7E9SFxBK3SAqAyey+G62IZbKKHtL8RhiilZogEI0=; b=xlHiWobNppTS/0cbCmCuEwUr+/L3eCAQYme3vG5dICODTaDLGrODTHTveR3ajfiDB6IK1yx+4 dMR5jtNcE0bA31D2oR+01venJIBsdiN0oypLD9J9f0rXeZtqzSrHOwR X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR01CA0028.apcprd01.prod.exchangelabs.com (2603:1096:4:192::21) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|DBAPR04MB7285:EE_ X-MS-Office365-Filtering-Correlation-Id: e60789e4-a748-4db4-228c-08dcef5a9d62 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|7416014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/Rbe2xiG9HUfM2f0zP4oGeFE+6v8+dq?= =?utf-8?q?NdtsSsmzhjvVfLn5bskHS1+HvTiH7w0pHCplH2WXQiqaLLwG2mray7CZk8rFOZVWw?= =?utf-8?q?V7ATgDK01OVhvvKs/UY/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4RU0GLhENt2QoP2HuhXjCAH9hCHEu0Z5?= =?utf-8?q?C6wzg+27tAauVnNPjWXt25KKfDhGAQTROqLO+6b0UKMO/6TLr9eW5r9nVME6Sgm4S?= =?utf-8?q?dUlrNJ7RWb7W+XAq+aeQ1nZPbsgkCvf2EQ+Z2xUrkfohexWZ7QjHOtU5j2FGY1y/t?= =?utf-8?q?TOaBZO46dYNWeEvFP3cYvEpCu5lxYZ6lQN2fX542GRs5R323amPhc0gW4y7HI8vTB?= =?utf-8?q?Rwx8RpLf68vAY3UY20u/ZcTMiL+FYzBl4pqGzBuOAC9S/FoV2mf2bmtCg6u7ncrY7?= =?utf-8?q?P/TsNKSZBGilJOb1sVOsYG0a2PcN9vyUW8lSlDBZVBlVdRimFqr+7vGs=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(7416014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?VRMoO0dEAJ8ocomXppixvJzvfhCo?= =?utf-8?q?lYIgM3vfLCLfRogvxk4w8r4224bBQiEvEYgMwNJP9wN0u0KXyUdlKllVhUKRnGTFF?= =?utf-8?q?mRo+mzBodXnQLeVKLQ1+f0072ug/KKWSvSzIjyDVG+XI8euTDmyO4nZnFQ+rmQgxm?= =?utf-8?q?5Kwi9FP/BC/jNk0xZDK4+hCur+HzRbE0OpOPMTyIsJBn9yt6uSTyv7xkOsjHh6IhM?= =?utf-8?q?7L39dY4IaDKHcvVWPlIF1FMBCUc1XOmgf9b8wXfLo5ht1kqMAh29+nI+VNju/58Dm?= =?utf-8?q?6nCEiWgsJfgqGmlyQWEaBvrJt78LEUP7yoohOD6WFE/ZnNuBfWvgi/eYxpbvpo94e?=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8?q?09TSgKtIsK/QZ+wbv9S3bxxPt2UnX8s1yHfxzj1XfW24meBaLuM5qU6cA2Qk+sNR7?= =?utf-8?q?2GERIekjcF23bMt3Q+Y6NjyJxO5h4jl6KOpb8m1SVoOxRTpquEAKWg4obupC1ozoy?= =?utf-8?q?nM8vEqo4ovIpWNitCjZIuofY0DztAm9kpFqAY6gTGmAWWMeshomeLA2NEDedCbcd6?= =?utf-8?q?PfA3zD1YRPasdZ6XyoZHSC/d9TAssKsp2bpMzKrzgjtjYs17cquXUWQE4OIgZI3AY?= =?utf-8?q?ZR+4A7wJaGvR5wvJ8JfQl2Ny3EEM7xyo3U0DO/0rv23sGHWudqhO2KlvNhG7YTKLe?= =?utf-8?q?+p8icH01jgsW?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e60789e4-a748-4db4-228c-08dcef5a9d62 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2024 09:52:44.7693 (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: IhCTU/4TpMvf0fbmMxCfRwK0VtbIZCNb0aBNZTNPvxy3ZW8OYMv4CdUbKuAMzGUuznCLTLjdKuRk5SUfOwAwAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7285 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241018_025254_629520_EF33D6AC X-CRM114-Status: GOOD ( 16.12 ) 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 --- 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)