Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1459683rdb; Mon, 19 Feb 2024 17:23:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUj/V05nuFEhGiFBNp68dyWXUOun+/g9+zy/jDdAOPgB4+Xe1uLZuYH+/v7ovUDT4wh1EjlrC552G02wy/O+RaDvS1jnVvqgqRPwoTo0w== X-Google-Smtp-Source: AGHT+IG2Y8NdZlYKKlmOodSVBtOjSuAHrKA5YODGIea2ChqFQZ1Lj6s83tcUJRsl05zzxvEhoO0e X-Received: by 2002:a17:90a:6d63:b0:299:4219:243c with SMTP id z90-20020a17090a6d6300b002994219243cmr12913964pjj.5.1708392179916; Mon, 19 Feb 2024 17:22:59 -0800 (PST) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id si8-20020a17090b528800b002997c936f30si3658742pjb.113.2024.02.19.17.22.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 17:22:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72177-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=Vw3xoRSN; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-72177-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72177-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 51852B22532 for ; Tue, 20 Feb 2024 01:22:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 447DD18625; Tue, 20 Feb 2024 01:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="Vw3xoRSN" Received: from IND01-MAX-obe.outbound.protection.outlook.com (mail-maxind01olkn2026.outbound.protection.outlook.com [40.92.102.26]) (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 E7FD02CAB; Tue, 20 Feb 2024 01:22:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.102.26 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708392165; cv=fail; b=YEHE50c88E5qa7rKa7N8MxCpn71Do394JehKZL+gboPDSvTb2m2rnDALLConZdzK2hAmxBj300SurcGnruvN2+jDhgI8A6zecarqqHMyfdjwqKErakh3ObJ65O9pYRiAUkUCEFV/H0PtJB4mDANUgc3xvKhqp+MxXmfKd3tKESY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708392165; c=relaxed/simple; bh=3YKyDo53vHI+7Tk02IAkFTgarHpfxP3WNU+MPLRLbTM=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=tONJjMUoX4d/wov/akZ55MUrnFN7zIJbeUSxuGgasvtb0mYThtannDuDPtka2pjoLofwFzXn7LZFGQ/R6ilKEKvNJkDrXYGNnRKQCSou3kuwDL+QF6xvUWxbAgMD++BIRRzjF+md4uLS/79hzlLGk/G5CFBli3BsHL9UFe1yHe0= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=Vw3xoRSN; arc=fail smtp.client-ip=40.92.102.26 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oHMqdI8EJnUNKno6z3H3xKFKm0F1/BegYXP5fJxfja030lXcggLs0x5CHOiG01fwK1Bcnz55R2tpBHfKjD0OT+aq/FXZ3wUbhE2Fg6eqAwpsybLp3ECUooE7cPFZ8mRKrU/osBzRaxJTBBIWpw9sHy8puwutlJiOGCQ1Q/bWgqf0FgBLuDlOULPSwF1d5svW49R+sKofnkHqmlVrgo2zIDUIVwrHck7U4IFRZKE08KH7Af0+yrRU+hVHZupHt5KKDdCTkv24bgwu7wjquZVHJw0mChJUzimXBte15jgjbvqc4TV6oInBJVxqMGsvS7EGiipM/sriB6PYbtk6paIBTA== 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=lQBq46gA80BhUPyzmgunlK+x7pDE/RZONsNlUwyMO7U=; b=O+Ul9WWSMOvfMCkq+2UCoVq9SkEU7KM5JIXyRv3Vw1DsKH9oQdelIEQpYR59OET5DmHV4ic18JjI9BO6cxlY2pBkSoardnx0DVMR4ssMkyByxlHqwv3xy5aSRxG1CI4tEv/We+MD0zIbnQr1NC9jBPgrMjWGn7lMWGxlgYMl3rET6pYmiWrR7kYg89ZdTt1GGreZZzyNgGsUnjDvWrirMQuBOjRuBJjEzjoAqi1GKhurGzzKjEhgL2YQ7jSEkzyFoPsWAfgnHGvmrA9BoRTkEv0rnOeRamoQbB0DCAUOH7gX6jkke3z7wVreKwqS0dLZM4MRJNrXKdz7up8Pnt/Sfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lQBq46gA80BhUPyzmgunlK+x7pDE/RZONsNlUwyMO7U=; b=Vw3xoRSN3bw/HCvA/k1NSNt6hww4KNnOEnVcPIgtTLmOyJdscwcUlRB83mR5P9+sKl2N2T7BxXYbmGCbPLM4v01Dmn3uBljaKGpBoVbSC8Xf8CHanL4ZKp//pg4wh1/0rvjApSwJB34a1HutmSRTC0X9Ydl5ESdF1DPnlnfbZqMV6QFtZWslqpJcmlSF1bNP0osbFwcJD2w5BEMih8LhNviF37gBJJ8SusYax+hmP2NY455hkt8KO09fvtMuwzgKCht7ztc3Eu652C3/E0QFKrbQN8bXN4Jp96fbAXvj85RJFWcmtvKIUm7zt1PHxKhco9VM5k1FF9mjWLqF9L/YAw== Received: from MA0P287MB2822.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:138::5) by MA0P287MB1805.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.20; Tue, 20 Feb 2024 01:22:34 +0000 Received: from MA0P287MB2822.INDP287.PROD.OUTLOOK.COM ([fe80::8473:67b4:9a2a:3a69]) by MA0P287MB2822.INDP287.PROD.OUTLOOK.COM ([fe80::8473:67b4:9a2a:3a69%7]) with mapi id 15.20.7316.018; Tue, 20 Feb 2024 01:22:34 +0000 Message-ID: Date: Tue, 20 Feb 2024 09:22:25 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 5/5] riscv: dts: add clock generator for Sophgo SG2042 SoC To: Guo Ren , Chen Wang Cc: aou@eecs.berkeley.edu, chao.wei@sophgo.com, conor@kernel.org, krzysztof.kozlowski+dt@linaro.org, mturquette@baylibre.com, palmer@dabbelt.com, paul.walmsley@sifive.com, richardcochran@gmail.com, robh+dt@kernel.org, sboyd@kernel.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, haijiao.liu@sophgo.com, xiaoguang.xing@sophgo.com, jszhang@kernel.org, inochiama@outlook.com, samuel.holland@sifive.com References: From: Chen Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TMN: [T694EED5EStVhQFksPAETG6khaqgINra] X-ClientProxiedBy: SL2PR04CA0003.apcprd04.prod.outlook.com (2603:1096:100:2d::15) To MA0P287MB2822.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:138::5) X-Microsoft-Original-Message-ID: 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: MA0P287MB2822:EE_|MA0P287MB1805:EE_ X-MS-Office365-Filtering-Correlation-Id: 6965ed44-dff8-4a3a-3424-08dc31b268f8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tto+YNw8J8/t/hSdv481wJfsIrti2RG0H3+/z70eiBnzANUapu2BPURFqBFOcineauFm1Oqx8v4rXbGuyXwSUGks5o4LEURB3r73T2yv6qNcWUM9skiuQcMUYdHmymeHZ184Tk/ytminWVy+opQBH6omfUdVEmOFP/g94ZUeqIQnDsw+2S6mcVeNa2YAUVjbz9r23XZ2LHNWg4ep0x7QXb7TsR+uXohNNdYmgn8I48sNQ00RZxLpb8zGYGGd7unfJlkbuELe1dyDQ1tH3otmymnAtziaYjP+40jy6K7rFrQn+eQg2nS9qd7/HDFF9oeRkxsyPhggVjkq4MX2hW0JI+qRh1OOsiVQNibi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F4ZUYyaCtacFFMTlNxOVVSSVNLSjYzcHdN?= =?utf-8?B?VWRTeE54TmtkNDR5Z3liclNiYm02SkYwSm9XYmMvSHo5SkM1U3QzcmVpWHho?= =?utf-8?B?TmpTOHlpVVpaMUlFOXd2R3hvVHVRNlVVRFNpbnZKZVRHbjN3czdrR2xPSStk?= =?utf-8?Q?yxK+rSOY2I6NrwYtcbtD?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6965ed44-dff8-4a3a-3424-08dc31b268f8 X-MS-Exchange-CrossTenant-AuthSource: MA0P287MB2822.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 01:22:33.2875 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MA0P287MB1805 On 2024/2/20 9:18, Guo Ren wrote: > On Sun, Feb 18, 2024 at 10:52 AM Chen Wang wrote: >> From: Chen Wang >> >> Add clock generator node to device tree for SG2042, and enable clock for >> uart. >> >> Signed-off-by: Chen Wang >> --- >> .../boot/dts/sophgo/sg2042-milkv-pioneer.dts | 12 +++++ >> arch/riscv/boot/dts/sophgo/sg2042.dtsi | 48 +++++++++++++++++++ >> 2 files changed, 60 insertions(+) >> >> diff --git a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts >> index 49b4b9c2c101..80cb017974d8 100644 >> --- a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts >> +++ b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts >> @@ -14,6 +14,18 @@ chosen { >> }; >> }; >> >> +&cgi_main { >> + clock-frequency = <25000000>; >> +}; >> + >> +&cgi_dpll0 { >> + clock-frequency = <25000000>; >> +}; >> + >> +&cgi_dpll1 { >> + clock-frequency = <25000000>; >> +}; >> + > If all are fixed, why do we separate them into three pieces? To show > real internal hardware? Yes, according to TRM, there are three input cgi(Clock Generator IC) on board. > >> &uart0 { >> status = "okay"; >> }; >> diff --git a/arch/riscv/boot/dts/sophgo/sg2042.dtsi b/arch/riscv/boot/dts/sophgo/sg2042.dtsi >> index ead1cc35d88b..e70c43e2ccbe 100644 >> --- a/arch/riscv/boot/dts/sophgo/sg2042.dtsi >> +++ b/arch/riscv/boot/dts/sophgo/sg2042.dtsi >> @@ -5,6 +5,9 @@ >> >> /dts-v1/; >> #include >> +#include >> +#include >> +#include >> >> #include "sg2042-cpus.dtsi" >> >> @@ -18,12 +21,54 @@ aliases { >> serial0 = &uart0; >> }; >> >> + cgi_main: oscillator0 { >> + compatible = "fixed-clock"; >> + clock-output-names = "cgi_main"; >> + #clock-cells = <0>; >> + }; >> + >> + cgi_dpll0: oscillator1 { >> + compatible = "fixed-clock"; >> + clock-output-names = "cgi_dpll0"; >> + #clock-cells = <0>; >> + }; >> + >> + cgi_dpll1: oscillator2 { >> + compatible = "fixed-clock"; >> + clock-output-names = "cgi_dpll1"; >> + #clock-cells = <0>; >> + }; >> + >> soc: soc { >> compatible = "simple-bus"; >> #address-cells = <2>; >> #size-cells = <2>; >> ranges; >> >> + pllclk: clock-controller@70300100c0 { >> + compatible = "sophgo,sg2042-pll"; >> + reg = <0x70 0x300100c0 0x0 0x40>; >> + clocks = <&cgi_main>, <&cgi_dpll0>, <&cgi_dpll1>; >> + #clock-cells = <1>; >> + }; >> + >> + rpgate: clock-controller@7030010368 { >> + compatible = "sophgo,sg2042-rpgate"; >> + reg = <0x70 0x30010368 0x0 0x98>; >> + clocks = <&clkgen GATE_CLK_RP_CPU_NORMAL>; >> + #clock-cells = <1>; >> + }; >> + >> + clkgen: clock-controller@7030012000 { >> + compatible = "sophgo,sg2042-clkgen"; >> + reg = <0x70 0x30012000 0x0 0x1000>; >> + clocks = <&pllclk MPLL_CLK>, >> + <&pllclk FPLL_CLK>, >> + <&pllclk DPLL0_CLK>, >> + <&pllclk DPLL1_CLK>; >> + #clock-cells = <1>; >> + }; >> + >> clint_mswi: interrupt-controller@7094000000 { >> compatible = "sophgo,sg2042-aclint-mswi", "thead,c900-aclint-mswi"; >> reg = <0x00000070 0x94000000 0x00000000 0x00004000>; >> @@ -333,6 +378,9 @@ uart0: serial@7040000000 { >> interrupt-parent = <&intc>; >> interrupts = <112 IRQ_TYPE_LEVEL_HIGH>; >> clock-frequency = <500000000>; >> + clocks = <&clkgen GATE_CLK_UART_500M>, >> + <&clkgen GATE_CLK_APB_UART>; >> + clock-names = "baudclk", "apb_pclk"; >> reg-shift = <2>; >> reg-io-width = <4>; >> status = "disabled"; >> -- >> 2.25.1 >> > Others LGTM. > > Reviewed-by: Guo Ren >