From patchwork Tue May 7 06:53:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xingyu Wu X-Patchwork-Id: 13656339 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 6E7B4C10F1A for ; Tue, 7 May 2024 06:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=5Vum/1tMySFSfCn7p7p73dWJfI+N73XEr4anGdQCPns=; b=pZtUX9G/E/5W56 py7EJMXTyBZv0LVWnH1PqUHNQiDdixOX0pE2eoADnRTCCV/9FJVoElJwIafZtQOW3wZbzcvIQ1fFl UcdiO/zaO8hNBD1eArnYJ7keXJdNNrghL8Yaxlg7dlMQFuThZcIWTNYypxdt8HG4NB9h0NGFZF4wx WuASVsM7KpBLjvgtKz3182bCi3tmXtfEyJBshaTiMifRSVlZ41rrbe3yScBOTSJOTdrDqaawzTVdM ieEQup3rMh+0yND1+ds1MKNPnv3STfORoz5mkqhd23R3pz0CPKNRe5Sf7op5n83nzFiJpaUDWBcSx KwsN6rO9mPTKVoE7zkMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Ehy-00000009tf2-25UL; Tue, 07 May 2024 06:53:50 +0000 Received: from mail-sh0chn02on20724.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::724] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Eht-00000009tdE-2zOn for linux-riscv@lists.infradead.org; Tue, 07 May 2024 06:53:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n4/p2ykm8Gzk4FTkkuG+S5XckYp1GFNpVnHnOvEWMnlGPK5eW8wACDwyRjM/fD9CzjFbX438ehyYwlNsXpIxh+j16tXV3H3NwLzdp5D87fL0kWdN9ca5jaLMHTAJLgbjHif2XqECnZelJSGoKJu4O6u/1/ePTS1nyUHox86axNijgml/vFhfcoF9yIn4YNpXmg3+Pz/yrbx55ylUnOQKVyzInGNW9vIcmS0pW9G86G3GWpseA4t6sCFEbC4JFBxiG+BJI3icFwtBBrozJKKGleXlgbTBDWiMs7qehNz704EzUsjFHplHlG+UYV5IwEaj+6cYs+PzfUgkGHEDJyy0sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=rPgA2XoWyccVJshY4J0NiilpptzwP1FKo3U4f0T4ofU=; b=EqTT6qjs6PmQC/UBRmcbSMsloLBgtg6+U4Y93aJwDtbZrCvv6nnpwshF5GzWDzyu2PJVziFr/nrwgq9YeKT8ylFMtFfJyZ2HEH+bYhHlb6KMo0OTWHeLzpTjA4e3lYzTm2FIhQ2DhJdnibdmeNhLsZYy6KIFURbiy0HeNA2pyjQo0bzGtK3PqYzgYUJs/4tYMpIke6ndzUnUkNqc7pyiXUngpGZi0dOz6o98jOz4lg7KQbTE4430aIiOPOdDT+JVaUCmau8HHYs+TQ7OTkyg3fgavI+jOJ5ZfPDbi7t87tReY0gEqFU9RsgmxHghCLwHDEBJ7E+/qrrYLI7F0dwdeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from NTZPR01MB0956.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:8::10) by NTZPR01MB1100.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Tue, 7 May 2024 06:53:26 +0000 Received: from NTZPR01MB0956.CHNPR01.prod.partner.outlook.cn ([fe80::e903:99a6:10b7:304d]) by NTZPR01MB0956.CHNPR01.prod.partner.outlook.cn ([fe80::e903:99a6:10b7:304d%6]) with mapi id 15.20.7472.044; Tue, 7 May 2024 06:53:26 +0000 From: Xingyu Wu To: Michael Turquette , Stephen Boyd , Conor Dooley , Emil Renner Berthing , Rob Herring , Krzysztof Kozlowski Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Hal Feng , Xingyu Wu , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCH v5 0/2] Add notifier for PLL0 clock and set it 1.5GHz on Date: Tue, 7 May 2024 14:53:17 +0800 Message-Id: <20240507065319.274976-1-xingyu.wu@starfivetech.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SH0PR01CA0020.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:5::32) To NTZPR01MB0956.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:8::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: NTZPR01MB0956:EE_|NTZPR01MB1100:EE_ X-MS-Office365-Filtering-Correlation-Id: 152807ca-7b4e-451e-8105-08dc6e626514 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M6Sr/ThJJsODKblb6b8Y/WDxPd9h9hNzEQP0u+SP55DgdeCtHU+ZWeUOEzfJlKMfHs12OZvhqqAN8FiAfj2exfcoRAKh/5+bPduLfHk3g7SMVT275Xw1N1CtiTNu8RFM2Ax9oqO+N6cIqDjwi49XRgtlABEZOv4Ucj2hMrHs+Q8sPxFpTqTfxhmHc+0CD3LNZhQqHoiVB5e41bqLE7ZumwKw43edXxmV2ackak9/K0KMFMuqb62X9Ouw3ujqUE+GUeagjMdr5V7BcwJWrZD7a856l7+eGgEy/2m1RNRCLM41+AEv3rdusiZHdcEpX3za3YU8h+4cg2UfqUUcaeH4rOesSkQWIsTBpNu5EPvz3BxcwRx25obD4Wf+LKdkEF/V67zGeMCwrkmDkfPJHgsSUg+g0F4nMjEKmXxNE7l/6MZ9iYpm3ihU3Z1f0dG13W/+RnCy6RK0UGslLVUXzpq5C+mLeiPUQ8q5eSutKju6gFpw7vpnU2D7KaF7bL+5ZiC8LPR16hLaG23yG0ItW7R/VnOpxF1LQ4Eha8tP/TRDlauFrbvaerAIqcHj0gQcUojMLB+/Uhy1ANlLNvphr4HuXeIh97T+YByImwBS5TthiVPCOvWfPwVBbv6ZQIKQ/yGj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:NTZPR01MB0956.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(366007)(41320700004)(52116005)(7416005)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iNalNqVJw99VuuQQphg10/oqeAAZHJGvNb4R1pDAY2T2rr+FGTxp1dImFiWxzeJdn6CsQA1Qdvu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bbUST8hbzCO+/QPzkkfp+2XlFVPw4IJQEhtCuu4nrB0ME6USpbqe+W8EN18N1RYRdyDcp5WgrbKd99yEMTLvWi6VThBGk/Z3UH+Z70wpDiPrR1cPybw2i/z5jAV5i9+hrhKo+VG8TBlMzN6S9syl/0xuhvslcislleW9iQtt6lUjBAVMcrtP305+srpYIpmWhUzR6cy+47KtKXjocDNYLiuttHqkYLA5DKWRoR4Avd8pDLoBQek6EbgsfuBHX1H8TRxREkdGlKuBLwLAdi4XCeo/AKSRElP8I5ZOKW9awfFNY/mOGPxWnHPDsNMlnSqMwdhsiYnzlbfyFONpwZuIRgObMrBc0c6Yp5zbENH7ov1pvzR2KDQ8JKmPrv8EXowj2WMmTqymrOC0gXpSgxdFKoQs6vVb2MtnOFa6d8TvfZhHfdN3U2gsbHIzhNDn3IVYcd/6+NvZPqboMb/0naJg== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 152807ca-7b4e-451e-8105-08dc6e626514 X-MS-Exchange-CrossTenant-AuthSource: NTZPR01MB0956.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 06:53:26.2788 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6zVqLdz08ABdYP00WHRKKWdpyDLSYoY+pYQvIr+suHQf5gi7jwK252/hNso6W9wzEtN6XQAvKrrf1WuyKrcitnfGts+XZe8HRhfhpDuiSN4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: NTZPR01MB1100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240506_235345_784273_2B31EB96 X-CRM114-Status: GOOD ( 11.62 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org This patch is to add the notifier for PLL0 clock and set the PLL0 rate to 1.5GHz to fix the lower rate of CPUfreq on the JH7110 SoC. The first patch is to add the notifier for PLL0 clock. Setting the PLL0 rate need the son clock (cpu_root) to switch its parent clock to OSC clock and switch it back after setting PLL0 rate. It need to use the cpu_root clock from SYSCRG and register the notifier in the SYSCRG driver. The second patch is to set cpu_core rate to 500MHz and PLL0 rate to 1.5GHz to fix the problem about the lower rate of CPUfreq on the visionfive board. The cpu_core clock rate is set to 500MHz first to ensure that the cpu frequency will not suddenly become high and the cpu voltage is not enough to cause a crash when the PLL0 is set to 1.5GHz. The cpu voltage and frequency are then adjusted together by CPUfreq. Changes since v4: - Fixed the wrong words. - Added the Fixes tag in first patch. v4: https://lore.kernel.org/all/20240410033148.213991-1-xingyu.wu@starfivetech.com/ Changes since v3: - Added the notifier for PLL0 clock. - Set cpu_core rate in DTS v3: https://lore.kernel.org/all/20240402090920.11627-1-xingyu.wu@starfivetech.com/ Changes since v2: - Made the steps into the process into the process of setting PLL0 rate v2: https://lore.kernel.org/all/20230821152915.208366-1-xingyu.wu@starfivetech.com/ Changes since v1: - Added the fixes tag in the commit. v1: https://lore.kernel.org/all/20230811033631.160912-1-xingyu.wu@starfivetech.com/ Xingyu Wu (2): clk: starfive: jh7110-sys: Add notifier for PLL0 clock riscv: dts: starfive: visionfive-2: Fix lower rate of CPUfreq by setting PLL0 rate to 1.5GHz .../jh7110-starfive-visionfive-2.dtsi | 6 ++++ .../clk/starfive/clk-starfive-jh7110-sys.c | 31 ++++++++++++++++++- drivers/clk/starfive/clk-starfive-jh71x0.h | 2 ++ 3 files changed, 38 insertions(+), 1 deletion(-)