From patchwork Fri Dec 8 01:15:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Wang X-Patchwork-Id: 175513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5173318vqy; Thu, 7 Dec 2023 17:15:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvrsZlbX19sOEDcXQ1E6Hqa0c2XrtZiOXO84vnGQaIxAEe+UeDsCCgTfnLKQuL0O+I0XlY X-Received: by 2002:a05:6a20:5182:b0:18f:cb22:31ae with SMTP id j2-20020a056a20518200b0018fcb2231aemr112980pzf.54.1701998153448; Thu, 07 Dec 2023 17:15:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701998153; cv=none; d=google.com; s=arc-20160816; b=oTmjN+KL6AiNhjax+AnphfcUcqrlX6pX+1eGvCpEuMeteDtAeAhCC0nN8dHn01JRvH VgI6gHADChs8HawUJFcJOuzFp8Ru6xSK2N+p7DDnkIxffZn2UhMBbYqHKESpRoXU/Urt GOkuqu8NxRoiOBygK7a4zOaK5MMgHKBk8L3N15lpWig7z7W+GU+vlC19Igz67l2gkZ2P 1PN3vF0F9WWVNRvTlLWN3W/Zd9y2mmKTvnDsnorM4hosad2rfuLvN++gGOKQx88fhQKH tERNHa516w6Tdzn4Jlnn4tR3k8zsvQbiSOB4DqGUP3vmA9Yb/YIic/pvObbf6t6B7D90 Jtfw== 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=kMotijnh/qiarlNtyEfMGI6pNts/0ixAszGWpmQazv8=; fh=KH8xm6lWnQmjdwi1VtR18ptPhMUvoKU3JPF7cI3jXZo=; b=M/Mr3EQP2WKVJtFd9aTI3uH0Pi0CwTMohLb+kxT+cEVie+6PyhAvclIl98IOUI4FAl 7+BKoOYtG3VRNlh4wQlzm8Kk5CE0sM+NknY4R68Ztc6TlySyXmuC7UwoBL6XTFpquk5k pA5PhlYOey/E2Si/v0gc0a0WGNKNNGpYCJ3Cxk4OW89fcLwXZiLOzely+MaZJf4JzPOt CGe3C4mep4BxUh/DP8n19gR08gKf3fgiyrJS/mOCel4LYwpsg6uJhdwf4mxa7MgWj4Z9 7lQBWhz6J6EngFkR5yYSvJyLMa093ZkNvFiF3mfrhsvTP2cqmADKoylVQiqvMe/51laQ AKUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ebr/03kW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id p20-20020a63fe14000000b0059d48c43152si600338pgh.40.2023.12.07.17.15.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 17:15:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ebr/03kW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id C146F80870F6; Thu, 7 Dec 2023 17:15:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1572901AbjLHBPN (ORCPT + 99 others); Thu, 7 Dec 2023 20:15:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1572884AbjLHBPL (ORCPT ); Thu, 7 Dec 2023 20:15:11 -0500 Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC1D171F; Thu, 7 Dec 2023 17:15:17 -0800 (PST) Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-59052ab970eso610789eaf.1; Thu, 07 Dec 2023 17:15:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701998116; x=1702602916; 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=kMotijnh/qiarlNtyEfMGI6pNts/0ixAszGWpmQazv8=; b=ebr/03kWW+Oh42WDQ/OrWQJngM0B1CICqrE4Av5RiQkxpEWB1XZMV3StNY6N2tBgxq 6wM1iYNY7qOpYD9AdAJ/MjMWaoL+6jpwfBGaj52ogdMVn+q+9NJvXL12f3krYyMxigjy O6FVkWtCYoKSQ1Pb04zTAy5rTND75EPzV/y7hGJlpU/ldIaAOBt1LXf5MLKxsRf1nkIc s3MISkFaQkH+jjLdbrIou9+ZbniXCyQB91/7ZrhmGK+QQQdyRuOZqtdtHpDt95NTYP8f 4WmGkG7qIAcTGqGYXdrZqbs5XJV99R3wVYlp1zYes79j8aDb6nFkM5yGv/GX+vCCJVb3 mUvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701998116; x=1702602916; 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=kMotijnh/qiarlNtyEfMGI6pNts/0ixAszGWpmQazv8=; b=DMQD26oO6L+0wg+Y6tf5S7QJK7C3IDcZrfaHiN9MMDoPvkVQhg8POr8BAyrHTlJUV3 bzf88C2e9bsOkKWTGBnHxtXSqhX/VUKf3jGYGu6Ev7SFMlf4lYskSnWeVOfmzOtyCihM n/fnrwO8qb51zp89E68sr1PS0Cu/Yd/wZP4A68d5ZMWGD1fClh0ufh1JRuoh23Uhu+6E 2cfOO8duwMXcwXmOdUsBka6fq1SP7EXe4RJ1TC7FZUWJQckdxzv5bX7N35gZGdpKAbVr +scGQ6ImHDAGjkxzKTS9lS+FHlHydPmhPc0fYkfoqnzbUobmczKN1m7liip7Y9UX/dnl TiMA== X-Gm-Message-State: AOJu0Yz4ubpl0tTO8k/IAGEDy4GY5OnMj7P6PkcLKKx7a/xCw6bh9AVJ pwvz3bOIGJbyxw/tvvyIwN0= X-Received: by 2002:a05:6870:799:b0:1fb:788:e8ba with SMTP id en25-20020a056870079900b001fb0788e8bamr63989oab.53.1701998116381; Thu, 07 Dec 2023 17:15:16 -0800 (PST) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id ps5-20020a0568709e0500b001fb33181cfasm76280oab.55.2023.12.07.17.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 17:15:15 -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 v6 4/4] riscv: dts: add clock generator for Sophgo SG2042 SoC Date: Fri, 8 Dec 2023 09:15:08 +0800 Message-Id: <7017ba0ffc736103339af041ec014a8cf209bc11.1701997033.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 agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 07 Dec 2023 17:15:33 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784674415931625796 X-GMAIL-MSGID: 1784674415931625796 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 | 79 +++++++++++++++++++ 2 files changed, 83 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..f08c41dda216 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,84 @@ intc: interrupt-controller@7090000000 { riscv,ndev = <224>; }; + sys_ctrl: system-controller@7030010000 { + compatible = "sophgo,sg2042-sysctrl"; + reg = <0x70 0x30010000 0x0 0x1000>; + }; + + clkgen: clock-controller@7030012000 { + compatible = "sophgo,sg2042-clkgen"; + reg = <0x70 0x30012000 0x0 0x1000>; + sophgo,system-ctrl = <&sys_ctrl>; + #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";