From patchwork Fri Apr 14 02:41:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xingyu Wu X-Patchwork-Id: 8160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp85328vqo; Thu, 13 Apr 2023 19:44:06 -0700 (PDT) X-Google-Smtp-Source: AKy350YgalcZkqXUxvuZr/XhQg4y1DsoQJjfDr33L2Ik69z10XTxdI0M6Bzeh5qn/crJka+s5P1W X-Received: by 2002:a05:6a00:2390:b0:636:e0fb:8c44 with SMTP id f16-20020a056a00239000b00636e0fb8c44mr6500018pfc.12.1681440246119; Thu, 13 Apr 2023 19:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681440246; cv=none; d=google.com; s=arc-20160816; b=qc3UDYCIIbhi+TEaDHP3/ihMVvPs0T5ljwMLJ/lVpdKsfpzxhQct5ZjrkwhBS8tECH P6A+sxgnatTvIpim012lDJ3b7lVvycPCgjhQHkQPqEmZzOmwoihfKX/v+wOVeB4tMYOI drmwDC9vodH1cTce3rN5lfcWUmcu9I6XYgP7gDNlZTpKTLQ2ByVPKbNRZocr30DM/viK LccwIeZ2UFHOoTk4F4Zc5sjaxU65AOUSfCf5moUV2AjVMnYlatdFOW3cICTfg4I2i22A FxIUvV6g49M6U+LI9/nUpCdpzJyhwcHCSdQcQ5sdJM5yanF9F/esfz+blVJpyfOA7AR2 HJCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=2cJ+rs58nT1YlnwW8jJGW04KG6EtUUpF5/fPdiJDyxg=; b=AubuZhrBp3zoh32k9vslMlS9qsTVgINvM9Wl9ZxuZ5kmNFU0WNpLNOL9An3b3QuJhJ sPRya1UZGgmPPkXRnzaYC0NsOD85ajuOIH7OQHSgOA1Cn933tnGhcIPSq6NAo1BlTdO0 XVu4Wb8h5O66pPMLlpDubMhe5KTU9eVwnra5ofbKgFKIkg4gizPZYZDxWn/lnOw3oDj2 hyfPbJWhy/QvyM4M7QOQiNOz5G3bhVQe/MmbjVcws231jYtI76nPMTphxMrTdoSNdJMX IHk3BOCijQdWo72oyFxboKSVRVs487kqC/tLp5hu3LEWwo8FIbNCHQyKaN2M4slJ4a96 21mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020aa79e50000000b0063b5e9691a8si1555121pfq.129.2023.04.13.19.43.51; Thu, 13 Apr 2023 19:44:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjDNCnD convert rfc822-to-8bit (ORCPT + 99 others); Thu, 13 Apr 2023 22:43:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjDNCnA (ORCPT ); Thu, 13 Apr 2023 22:43:00 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D475D12E; Thu, 13 Apr 2023 19:42:57 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 3FA5A24E235; Fri, 14 Apr 2023 10:42:56 +0800 (CST) Received: from EXMBX061.cuchost.com (172.16.6.61) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 14 Apr 2023 10:42:56 +0800 Received: from localhost.localdomain (183.27.97.249) by EXMBX061.cuchost.com (172.16.6.61) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 14 Apr 2023 10:42:54 +0800 From: Xingyu Wu To: , , "Michael Turquette" , Stephen Boyd , Krzysztof Kozlowski , Philipp Zabel , Conor Dooley , "Emil Renner Berthing" CC: Rob Herring , Paul Walmsley , Palmer Dabbelt , Albert Ou , Hal Feng , Xingyu Wu , William Qiu , , Subject: [PATCH v3 0/7] Add PLL clocks driver for StarFive JH7110 SoC Date: Fri, 14 Apr 2023 10:41:50 +0800 Message-ID: <20230414024157.53203-1-xingyu.wu@starfivetech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [183.27.97.249] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX061.cuchost.com (172.16.6.61) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763117887268221738?= X-GMAIL-MSGID: =?utf-8?q?1763117887268221738?= This patch serises are to add PLL clocks driver and providers by writing and reading syscon registers for the StarFive JH7110 RISC-V SoC. And add documentation to describe StarFive System Controller(syscon) Registers. PLL are high speed, low jitter frequency synthesizers in JH7110. Each PLL clocks work in integer mode or fraction mode by some dividers, and the dividers are set in several syscon registers. The formula for calculating frequency is: Fvco = Fref * (NI + NF) / M / Q1 The first patch adds docunmentation to describe PLL clock bindings, and the second patch adds driver to support PLL clocks for JH7110. The patch 3 modifies the SYSCRG dibindings and adds PLL clock inputs. The patch 4 modifies the system clock driver and changes PLL clock source from PLL clock controller instead of the fixed factor clocks. The patch 5 adds documentation to decribe syscon registers. And the patch 6 adds the stg/sys/aon syscon nodes for JH7110 SoC. The last patch adds PLL clock node and modifies the syscrg node in JH7110 dts file. This patchset should be applied after these patchset about JH7110 basic clock drivers(Accepted and will merged in v6.4)[1]. [1] https://lore.kernel.org/all/20230401111934.130844-1-hal.feng@starfivetech.com/ Changes since v2: - Rebased on latest JH7110 basic clock drivers. - Added the complete documentation to describe syscon register. - Added syscon node in JH7110 dts file. - Modified the clock rate selection to match the closest rate in PLL driver when setting rate. v2: https://lore.kernel.org/all/20230316030514.137427-1-xingyu.wu@starfivetech.com/ Changes since v1: - Changed PLL clock node to be child of syscon node in dts. - Modifed the definitions and names of function in PLL clock driver. - Added commit to update syscon and syscrg dt-bindings. v1: https://lore.kernel.org/all/20230221141147.303642-1-xingyu.wu@starfivetech.com/ William Qiu (2): dt-bindings: soc: starfive: Add StarFive syscon module riscv: dts: starfive: jh7110: Add syscon nodes Xingyu Wu (5): dt-bindings: clock: Add StarFive JH7110 PLL clock generator clk: starfive: Add StarFive JH7110 PLL clock driver dt-bindings: clock: jh7110-syscrg: Add PLL clock inputs clk: starfive: jh7110-sys: Modify PLL clocks source riscv: dts: starfive: jh7110: Add PLL clock node and modify syscrg node .../bindings/clock/starfive,jh7110-pll.yaml | 46 ++ .../clock/starfive,jh7110-syscrg.yaml | 20 +- .../soc/starfive/starfive,jh7110-syscon.yaml | 58 +++ MAINTAINERS | 12 + arch/riscv/boot/dts/starfive/jh7110.dtsi | 29 +- drivers/clk/starfive/Kconfig | 9 + drivers/clk/starfive/Makefile | 1 + .../clk/starfive/clk-starfive-jh7110-pll.c | 427 ++++++++++++++++++ .../clk/starfive/clk-starfive-jh7110-pll.h | 293 ++++++++++++ .../clk/starfive/clk-starfive-jh7110-sys.c | 31 +- .../dt-bindings/clock/starfive,jh7110-crg.h | 6 + 11 files changed, 903 insertions(+), 29 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/starfive,jh7110-pll.yaml create mode 100644 Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml create mode 100644 drivers/clk/starfive/clk-starfive-jh7110-pll.c create mode 100644 drivers/clk/starfive/clk-starfive-jh7110-pll.h base-commit: 197b6b60ae7bc51dd0814953c562833143b292aa prerequisite-patch-id: 388b8adbb0fe2daf4d07a21eafd4f1bd50ce2403 prerequisite-patch-id: 1117ecaa40a353c667b71802ab34ecf9568d8bb2 prerequisite-patch-id: b00c6b21fbd0353d88b7c9b09093ba30b765f45b prerequisite-patch-id: 08ec9027e8a5c6fdf201726833168c7464a9b94d prerequisite-patch-id: fb5120248e48fe1faf053ae0b490c92507ec2b44 prerequisite-patch-id: 4b93d8d590b0a2abe7b4be5287232c494c35be4a prerequisite-patch-id: 89f049f951e5acf75aab92541992f816fd0acc0d prerequisite-patch-id: c09c4c68af017b8e5c97b515cb50b70c18a2e705 prerequisite-patch-id: 0df8ccb0e848c2df4c2da95026494bebecede92d prerequisite-patch-id: 315303931e4b6499de7127a88113763f86e97e16 prerequisite-patch-id: 40cb8212ddb024c20593f73d8b87d9894877e172 prerequisite-patch-id: a1673a9e9f19d6fab5a51abb721e54e36636f067 prerequisite-patch-id: d57cc467fb036241b9276320ff076c4a30d376d6 prerequisite-patch-id: 6e563d68bc5dbf951d4ced17897f9cc4d56169fe prerequisite-patch-id: 61ec2caa21fd0fc60e57977f7d16d3f72b135745 prerequisite-patch-id: 1387a7e87b446329dfc21f3e575ceae7ebcf954c prerequisite-patch-id: 258ea5f9b8bf41b6981345dcc81795f25865d38f prerequisite-patch-id: 8b6f2c9660c0ac0ee4e73e4c21aca8e6b75e81b9 prerequisite-patch-id: dbb0c0151b8bdf093e6ce79fd2fe3f60791a6e0b prerequisite-patch-id: 9007c8610fdcd387592475949864edde874c20a2 prerequisite-patch-id: d57e95d31686772abc4c4d5aa1cadc344dc293cd prerequisite-patch-id: 0a0ac5a8a90655b415f6b62e324f3db083cdaaee