From patchwork Mon Mar 3 12:20:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xukai Wang X-Patchwork-Id: 13998788 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 1B189C282C5 for ; Mon, 3 Mar 2025 12:42:55 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version: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=ilCf5YZHL9NsPTz7aw0QehOuxb85RV5j6OoQJMLercM=; b=xJ3ik3cnfZmzQ9 eYn++8OGg7Q6mpc6sF2qD2lR5UfnxM7UD+wrtWmXwJrErEmbYP4+rTBkH0Rgl5WvLT68APYW5lMfv Y0AbwsvNqc3ZJ9uE2twsdUsLc7KBmZJUtImUsZ3rj9qtsmLQwN8PGOaBTtYfE4XBHFVivvGQTXj2s +gGscgZx3BG/njufz2cOwUIg+13AHCnZZqJ42E1MTxmrkOpml5GZxwrfzQ/C+T5eKOQZSyMHjlcE6 YR3c22WroTPT/Dbi75LvZURJ2vpUlsqx8tWSsv8bDK3QDI1DlOzl4j5Vh7Jb5kraeItilW5pPzvWs 7xVQxVPcBOILVv4nd9kQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tp586-00000000mP6-0X10; Mon, 03 Mar 2025 12:42:42 +0000 Received: from sender4-pp-o94.zoho.com ([136.143.188.94]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tp4nd-00000000jCh-3Sy3 for linux-riscv@lists.infradead.org; Mon, 03 Mar 2025 12:21:35 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1741004483; cv=none; d=zohomail.com; s=zohoarc; b=oAkZRjaZqIbgQVj1QiHT1+HKQF0yfjK2GZUTXvc2u8/YIyW1jTQGpIiMe0q4TZ8sj8FlJN9aVrNJr/ObgEaNbx1Ae0VS4+GQ0lwUsuebQ+XPd56Jdar2YFs2cH1Vq0GTIa5V2TKB9Fqu0UNmVr7g1uyOnez5QiZROjkgWoDagLU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741004483; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=3ydZCPGpoQBdvJRWpULIrkhPs9pNUlcKM0pGYMjjiqQ=; b=JJmEM94VccWbjPtkLDXR0oRfnx7icgYGTwRFEfN7KFimiKyNNfgTcy+plYlQqu0i4k9OZnKE8EPTWlfOa6J0G13HzqDIDfrjiSSGgqauUacWhQQnnDIJXXW9EmyUNSKou/Cv8pxEniU1rrA0ojmr8BmwjagNHdbsU3gzYBf/yfc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zohomail.com; spf=pass smtp.mailfrom=kingxukai@zohomail.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1741004483; s=zm2022; d=zohomail.com; i=kingxukai@zohomail.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Feedback-ID:Reply-To; bh=3ydZCPGpoQBdvJRWpULIrkhPs9pNUlcKM0pGYMjjiqQ=; b=P3d+rGz1oo9cva3q0QAiGdmacQx2sHi6Ds/dPryrf7MFLzlLGhz84lVGqIaqzKcK /61KXUz8eY0nR//AHW9Euf33zpf+MoMpVx54uVRUPwl0VwJKAqTOrJDAmAlSuoZ5hY7 ZMEA3m9maY1LF07FC9K6hWUFm+Dt2FKvtNzdTcj0= Received: by mx.zohomail.com with SMTPS id 1741004478912708.8413176197934; Mon, 3 Mar 2025 04:21:18 -0800 (PST) From: Xukai Wang Date: Mon, 03 Mar 2025 20:20:37 +0800 Subject: [PATCH v5 1/3] dt-bindings: clock: Add bindings for Canaan K230 clock controller MIME-Version: 1.0 Message-Id: <20250303-b4-k230-clk-v5-1-748d121283e3@zohomail.com> References: <20250303-b4-k230-clk-v5-0-748d121283e3@zohomail.com> In-Reply-To: <20250303-b4-k230-clk-v5-0-748d121283e3@zohomail.com> To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Xukai Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Samuel Holland , Troy Mitchell , Krzysztof Kozlowski X-Mailer: b4 0.14.2 Feedback-ID: rr080112278023036a06dbdcbd3a23d44200002b81d417ab5dd55009f4b843ad4fd77b9cba8aa5bd0901fd8a:zu08011227cdd3bbd721d8b167eb2a74bd0000b8fc4f77c0164826b383e249bd15fa026a8b4d223a4f0e555f:rf0801122c3d26086ea0444cd2e5bcc1960000ce354aa1b441ef4dd0567f9ee369852d3c360944b5b7afdd6ad30731ca23:ZohoMail X-ZohoMailClient: External X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250303_042133_945842_4B79E769 X-CRM114-Status: GOOD ( 11.45 ) 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 adds the Device Tree binding for the clock controller on Canaan k230. The binding defines the new clocks available and the required properties to configure them correctly. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Xukai Wang --- .../devicetree/bindings/clock/canaan,k230-clk.yaml | 43 ++++++++++++++ include/dt-bindings/clock/canaan,k230-clk.h | 69 ++++++++++++++++++++++ 2 files changed, 112 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/canaan,k230-clk.yaml b/Documentation/devicetree/bindings/clock/canaan,k230-clk.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d7220fa30e4699a68fa5279c04abc63c1905fa4a --- /dev/null +++ b/Documentation/devicetree/bindings/clock/canaan,k230-clk.yaml @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/canaan,k230-clk.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Canaan Kendryte K230 Clock + +maintainers: + - Xukai Wang + +properties: + compatible: + const: canaan,k230-clk + + reg: + items: + - description: PLL control registers. + - description: Sysclk control registers. + + clocks: + maxItems: 1 + + '#clock-cells': + const: 1 + +required: + - compatible + - reg + - clocks + - '#clock-cells' + +additionalProperties: false + +examples: + - | + clock-controller@91102000 { + compatible = "canaan,k230-clk"; + reg = <0x91102000 0x1000>, + <0x91100000 0x1000>; + clocks = <&osc24m>; + #clock-cells = <1>; + }; diff --git a/include/dt-bindings/clock/canaan,k230-clk.h b/include/dt-bindings/clock/canaan,k230-clk.h new file mode 100644 index 0000000000000000000000000000000000000000..41edb13ea04bffaa1ddd1d1af87ae3406b688332 --- /dev/null +++ b/include/dt-bindings/clock/canaan,k230-clk.h @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Kendryte Canaan K230 Clock Drivers + * + * Author: Xukai Wang + */ + +#ifndef CLOCK_K230_CLK_H +#define CLOCK_K230_CLK_H + +/* Kendryte K230 SoC clock identifiers (arbitrary values). */ +#define K230_CPU0_SRC 0 +#define K230_CPU0_ACLK 1 +#define K230_CPU0_PLIC 2 +#define K230_CPU0_NOC_DDRCP4 3 +#define K230_CPU0_PCLK 4 +#define K230_PMU_PCLK 5 +#define K230_HS_HCLK_HIGH_SRC 6 +#define K230_HS_HCLK_HIGH_GATE 7 +#define K230_HS_HCLK_SRC 8 +#define K230_HS_SD0_HS_AHB_GAT 9 +#define K230_HS_SD1_HS_AHB_GAT 10 +#define K230_HS_SSI1_HS_AHB_GA 11 +#define K230_HS_SSI2_HS_AHB_GA 12 +#define K230_HS_USB0_HS_AHB_GA 13 +#define K230_HS_USB1_HS_AHB_GA 14 +#define K230_HS_SSI0_AXI15 15 +#define K230_HS_SSI1 16 +#define K230_HS_SSI2 17 +#define K230_HS_QSPI_AXI_SRC 18 +#define K230_HS_SSI1_ACLK_GATE 19 +#define K230_HS_SSI2_ACLK_GATE 20 +#define K230_HS_SD_CARD_SRC 21 +#define K230_HS_SD0_CARD_TX 22 +#define K230_HS_SD1_CARD_TX 23 +#define K230_HS_SD_AXI_SRC 24 +#define K230_HS_SD0_AXI_GATE 25 +#define K230_HS_SD1_AXI_GATE 26 +#define K230_HS_SD0_BASE_GATE 27 +#define K230_HS_SD1_BASE_GATE 28 +#define K230_HS_OSPI_SRC 29 +#define K230_HS_USB_REF_50M 30 +#define K230_HS_SD_TIMER_SRC 31 +#define K230_HS_SD0_TIMER_GATE 32 +#define K230_HS_SD1_TIMER_GATE 33 +#define K230_HS_USB0_REFERENCE 34 +#define K230_HS_USB1_REFERENCE 35 +#define K230_LS_APB_SRC 36 +#define K230_LS_UART0_APB 37 +#define K230_LS_UART1_APB 38 +#define K230_LS_UART2_APB 39 +#define K230_LS_UART3_APB 40 +#define K230_LS_UART4_APB 41 +#define K230_LS_I2C0_APB 42 +#define K230_LS_I2C1_APB 43 +#define K230_LS_I2C2_APB 44 +#define K230_LS_I2C3_APB 45 +#define K230_LS_GPIO_APB 46 +#define K230_LS_PWM_APB 47 +#define K230_LS_UART0 48 +#define K230_LS_UART1 49 +#define K230_LS_UART2 50 +#define K230_LS_UART3 51 +#define K230_LS_UART4 52 +#define K230_SHRM_AXI_SRC 53 +#define K230_SHRM_SDMA_AXI_GATE 54 +#define K230_SHRM_PDMA_AXI_GATE 55 + +#endif /* CLOCK_K230_CLK_H */