From patchwork Mon Nov 27 01:16:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Wang X-Patchwork-Id: 169935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2780738vqx; Sun, 26 Nov 2023 17:16:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGC8zjYrNcdrDggfpIOT5py79G4yrgLlcvyD+uZ9iqWmF21PduBZ6Twy+rrat+YtVAvNBNL X-Received: by 2002:a17:90b:33cd:b0:285:9f64:d0d0 with SMTP id lk13-20020a17090b33cd00b002859f64d0d0mr7367552pjb.4.1701047807829; Sun, 26 Nov 2023 17:16:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701047807; cv=none; d=google.com; s=arc-20160816; b=tznLL0cQljxFR00bCK/WF4G04SUtvWppJhzIEpLcWx1sm4RiBJW15h+gvDzK9kOVEc 6SvGHIVSQhgpV1iGzKh4P3Il2ZMfD7CPaOWVzzoy5ydve2FeVHugrwz//hhjTnhSgWiQ 44iAWI2QtO9aCJmK4X6qR1URZmQT6rtlapliUxo4KPcnOt1UAurDHrixVnq/LWsfxWlb BbvAKJ7Rfp55bhU11aF5NzPbQqfMqr7K1lygmtDdWPZUPfx041k7ZfEdxANmslHCjW3i mEuTz2hbQrz0j5ColqXBIfqM6IgbEgHXM2DGEpfU/Q7ntJVxZoyQnBCIelnY0vKhhxtp z5Yg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W/U0t4lVPnM2IDbC1l080UWyb7I1vEq1c7QyaFDSq/c=; fh=KH8xm6lWnQmjdwi1VtR18ptPhMUvoKU3JPF7cI3jXZo=; b=KpCkekLWkxrVfJ+anEeK8qyjZ7/BugHUs7qeyyjjDwfuomYAEGJ5Kb+OKr6gXcFcxz EffOrk+jlhN04pn1WhvaPRw5AHaHJd+rsZOSiEqqmOby3huFpjdqfeg6ttoYjmfeUOuD nCqU2jBPVdQiKrAlJef8Zbog/TQXWJqvjX75ZeJkQKCO4P0vLCYCdrGAW+JyfdsufPn+ vdeisMsn5v6KQ+xql5h7HfPPPEM1scUQ+GNxM0FnhEZTwMp+b9BtXOW0QJDZHcEidIcV WOjkz3gDBpoSD9iZegtf6ixA5V5lmJZ634PgeO+OFEg9UVJ7d+0ZqhwnVD2pVBmxzUOc 6E4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CmRx2zX0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id ci4-20020a17090afc8400b0028516cc3884si9296350pjb.115.2023.11.26.17.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 17:16:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CmRx2zX0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9546280859AB; Sun, 26 Nov 2023 17:16:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbjK0BQ1 (ORCPT + 99 others); Sun, 26 Nov 2023 20:16:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbjK0BQZ (ORCPT ); Sun, 26 Nov 2023 20:16:25 -0500 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87B29E8; Sun, 26 Nov 2023 17:16:32 -0800 (PST) Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-6ce2ea3a944so2535460a34.1; Sun, 26 Nov 2023 17:16:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701047792; x=1701652592; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W/U0t4lVPnM2IDbC1l080UWyb7I1vEq1c7QyaFDSq/c=; b=CmRx2zX0fVt3BL3gdTGsHkEIsDIXvtDYSyRiqUvw6eHhX2pSLKcV7tI2I+m+l80edy zHH/tsOo9oP5GNNL2t9UeWeNESyMlAIOty2P3tsx0OSXpgD58DhENbA/FNAznlUq3Mru n7LtvNtUXBjxYnXSQY1VkxTig7zlIkYXSzUixHLbZrRZU3hsM+hKTQMgWlYsuyDzAb+A rXGRUUP10BPPdYHCSbmQ9WY8JdcomiqEgiEOas8g/zNt68JG4qr9J+RhjFlVjBBm/Xqy C4FdPUa3/GdXjouKNr/hIt6tdw3a84fWrnJT0qKbZa3IBhJSGC0XpIPCV6KoWjsBVGiL kPMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701047792; x=1701652592; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W/U0t4lVPnM2IDbC1l080UWyb7I1vEq1c7QyaFDSq/c=; b=MDpmhqfcLXbmow5cBSy3T0kb26hWPR9lTzgflQMTp+/7qiOV7YUcxGFMeHcq+Ni+oZ g5ZFGWW38Tv3BTQ9tEWxcGTaCA8xbIgzImZKaTUsBr/BX1h1OTaeywA/bjXATbo13mkW zjvdjl5r66WNUVuQ3UK+EIMcn5hRWv9ZViT7zIPz67xjkTHtUo+ImSMs65QpcJodliGG 5adm+l7Jb67mhSnyh1NSo/Zqulh3lhM1+VcgzROv9hIqp1HORdxtljUgN/Rdr5b7mTN8 AldSzk1CDV14ECc4dAvTibdx4BS/DQTa0/NZgXlVf0wwPEBgmDYIKdCzyFqk8gOK0mPg gFSw== X-Gm-Message-State: AOJu0YzPX1z+KcUk5BPwUqs+qCUUSvOG3lwb2iFUpMnaXnnOGMMGz/qf QMpP5Cdw1nKLQnpQUPKHw+4= X-Received: by 2002:a05:6830:6b42:b0:6bb:1c30:6f3c with SMTP id dc2-20020a0568306b4200b006bb1c306f3cmr13168007otb.0.1701047791774; Sun, 26 Nov 2023 17:16:31 -0800 (PST) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id e5-20020a9d7305000000b006c61c098d38sm1241663otk.21.2023.11.26.17.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 17:16:31 -0800 (PST) From: Chen Wang To: 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, guoren@kernel.org, jszhang@kernel.org, inochiama@outlook.com, samuel.holland@sifive.com Cc: Chen Wang Subject: [PATCH v2 4/4] riscv: dts: add clock generator for Sophgo SG2042 SoC Date: Mon, 27 Nov 2023 09:16:22 +0800 Message-Id: <70ad5faa3a4a012df328fa21e69eaffd377e99ca.1701044106.git.unicorn_wang@outlook.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 26 Nov 2023 17:16:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783677906303338499 X-GMAIL-MSGID: 1783677906303338499 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 | 4 + arch/riscv/boot/dts/sophgo/sg2042.dtsi | 77 +++++++++++++++++++ 2 files changed, 81 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..0b3b3b2b0c64 100644 --- a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +++ b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts @@ -14,6 +14,10 @@ chosen { }; }; +&cgi { + clock-frequency = <25000000>; +}; + &uart0 { status = "okay"; }; diff --git a/arch/riscv/boot/dts/sophgo/sg2042.dtsi b/arch/riscv/boot/dts/sophgo/sg2042.dtsi index 93256540d078..c5849a0e74d0 100644 --- a/arch/riscv/boot/dts/sophgo/sg2042.dtsi +++ b/arch/riscv/boot/dts/sophgo/sg2042.dtsi @@ -5,6 +5,7 @@ /dts-v1/; #include +#include #include "sg2042-cpus.dtsi" @@ -18,6 +19,12 @@ aliases { serial0 = &uart0; }; + cgi: oscillator { + compatible = "fixed-clock"; + clock-output-names = "cgi"; + #clock-cells = <0>; + }; + soc: soc { compatible = "simple-bus"; #address-cells = <2>; @@ -311,12 +318,82 @@ intc: interrupt-controller@7090000000 { riscv,ndev = <224>; }; + sys_ctrl: syscon@7030010000 { + compatible = "sophgo,sg2042-syscon", "syscon"; + reg = <0x70 0x30010000 0x0 0x8000>; + + clkgen: clock-controller { + compatible = "sophgo,sg2042-clkgen"; + #clock-cells = <1>; + clocks = <&cgi>; + assigned-clocks = \ + <&clkgen DIV_CLK_FPLL_RP_CPU_NORMAL_1>, + <&clkgen DIV_CLK_FPLL_50M_A53>, + <&clkgen DIV_CLK_FPLL_TOP_RP_CMN_DIV2>, + <&clkgen DIV_CLK_FPLL_UART_500M>, + <&clkgen DIV_CLK_FPLL_AHB_LPC>, + <&clkgen DIV_CLK_FPLL_EFUSE>, + <&clkgen DIV_CLK_FPLL_TX_ETH0>, + <&clkgen DIV_CLK_FPLL_PTP_REF_I_ETH0>, + <&clkgen DIV_CLK_FPLL_REF_ETH0>, + <&clkgen DIV_CLK_FPLL_EMMC>, + <&clkgen DIV_CLK_FPLL_SD>, + <&clkgen DIV_CLK_FPLL_TOP_AXI0>, + <&clkgen DIV_CLK_FPLL_TOP_AXI_HSPERI>, + <&clkgen DIV_CLK_FPLL_AXI_DDR_1>, + <&clkgen DIV_CLK_FPLL_DIV_TIMER1>, + <&clkgen DIV_CLK_FPLL_DIV_TIMER2>, + <&clkgen DIV_CLK_FPLL_DIV_TIMER3>, + <&clkgen DIV_CLK_FPLL_DIV_TIMER4>, + <&clkgen DIV_CLK_FPLL_DIV_TIMER5>, + <&clkgen DIV_CLK_FPLL_DIV_TIMER6>, + <&clkgen DIV_CLK_FPLL_DIV_TIMER7>, + <&clkgen DIV_CLK_FPLL_DIV_TIMER8>, + <&clkgen DIV_CLK_FPLL_100K_EMMC>, + <&clkgen DIV_CLK_FPLL_100K_SD>, + <&clkgen DIV_CLK_FPLL_GPIO_DB>, + <&clkgen DIV_CLK_MPLL_RP_CPU_NORMAL_0>, + <&clkgen DIV_CLK_MPLL_AXI_DDR_0>; + assigned-clock-rates = \ + <2000000000>, + <50000000>, + <1000000000>, + <500000000>, + <200000000>, + <25000000>, + <125000000>, + <50000000>, + <25000000>, + <100000000>, + <100000000>, + <100000000>, + <250000000>, + <1000000000>, + <50000000>, + <50000000>, + <50000000>, + <50000000>, + <50000000>, + <50000000>, + <50000000>, + <50000000>, + <100000>, + <100000>, + <100000>, + <2000000000>, + <1000000000>; + }; + }; + uart0: serial@7040000000 { compatible = "snps,dw-apb-uart"; reg = <0x00000070 0x40000000 0x00000000 0x00001000>; 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";