Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp894444lqh; Thu, 28 Mar 2024 23:22:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWMQPm4FLNhyNJRGWqOS9v1PUoGj+iBlDRTpi+xejqTm0q6/9hLpVJH61nGKqkvMgfDZyN1FhdUnmfzEGzbwSYm01QMb06Tq0p2hYhk8Q== X-Google-Smtp-Source: AGHT+IGNZ8igD6lTGHW9Ha+JDxSaVVWKOFWzxL6dz2BEWmvn5h1sD2qYnCQW3M/uHO8KqjYelBRB X-Received: by 2002:a05:6102:5f48:b0:476:d323:632a with SMTP id il8-20020a0561025f4800b00476d323632amr1153155vsb.7.1711693339939; Thu, 28 Mar 2024 23:22:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711693339; cv=pass; d=google.com; s=arc-20160816; b=yJrhIbpjh6rl6m8gdWVJ6oG+XQd7+LXqFtIH/uiNIMCTUrfLKNlrMUpbax/zKYBrPH dF2PONFYJRidki0PxyIfuLkqAZp7CLhD2Zdfv2xjDIMUhfCjy7TKngfer2vTLr73FL93 cs0B9C4kyiMOIZdt1vu/tEWMaTNpap5yfqJpQW2SP1Dd3+R5eLZB8hUCVv5K+LehBboG lhNxw1Y7Xh3y+DoTklWu6rzVrN09WMBAwNYdBK6xzCkzxHjQegIqaDppYhNiLgrgwp8j aabcfYxhsabGjkZkH9iaXwFitD1jl08Zmx+UFYfaH7y32wlRBaBlQ8g5BPAfQRvXvrqb x5Tw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YPRTTnRNGB6MC8MgLxeQqBqXiKf58UGvbzByUZNl4Io=; fh=9KOV9AVxNfYADOVaZ/ZZGfa9XAYbOcde4OqgeLoXs+I=; b=W6kJtsj+7801OKnhOj5jFo2tgvwy1v7DNuE+MaAHxi5Xr59aMUO6j6xR7JTrwY5eXq W12dNYfao/ss+tsMOmqWm08JkXcIu+GGEsSUm4HvmA62roEzeLfIBhPLElgNQuMLQsDj PeZUIqS3NOxLlltIuhWcoJ7UqezYhJQ3gXtD84jRK7/a+ilxtdSh4iHWXOq4cGuDkoGV vg2YiUWGebJGcdZOY+Fwcm6CUSz3Q+tlmkKzItzqeO33tuhfzW7dtMS8zqHudmGHeb4S ooafZ/5tRb41TOqfsloH4LRZ8OdQGDgcGekhBWnuwQqGH1w8alBVwCLVM0VjUk1XKGtF bSww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PjLWRFHh; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-124195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124195-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id wx51-20020a05620a5a7300b00789e981c0d9si2981274qkn.246.2024.03.28.23.22.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 23:22:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PjLWRFHh; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-124195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124195-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6BD2C1C22563 for ; Fri, 29 Mar 2024 06:22:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3540D3FB9E; Fri, 29 Mar 2024 06:22:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PjLWRFHh" Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B40023FE4F; Fri, 29 Mar 2024 06:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711693328; cv=none; b=MxosWAJEKyUeddgRfKGR3mfiQ1lfQIXbntw9dgRpSY9bDHhokvjuieqK19nI+0aJoBYkdq86qgOdrxDiAglnzch7EFVZ+FYpOu99fAwt0V4oAxlS+Hua2VNGCjkfyYhuRCh+dHv/SbHrxuet1JOoF2arvf2uElu8dofOs9CHJzM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711693328; c=relaxed/simple; bh=Kct7Pjk1WKf/K8JXQ51OPs2q82g4Vs270HKxVBz7YVU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Jo7lW3EFuR5xPuWm57IShfDvcLYANwHJid6x4qxS30omsMbRpGEB9g95jWbCX5+LRBCJp+R4u76USE6xXFdVv1k1DyPtDtQpBsP61xHF8g8OYWOPpQ9dpDx+N6wBjWo+tW1uPTh8BquDeeDjNeTYiHmV1B2LmMo1XKX0hM2HiPQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PjLWRFHh; arc=none smtp.client-ip=209.85.160.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-229d01e81f1so908904fac.2; Thu, 28 Mar 2024 23:22:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711693326; x=1712298126; 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=YPRTTnRNGB6MC8MgLxeQqBqXiKf58UGvbzByUZNl4Io=; b=PjLWRFHhQ4Sq9sICl9wBInuoY47OjDUJ/1bmz//xJAxEr65g50d8arXwBNPFXMv1E0 bGWbgzTt9GN0XJqcVpwHPcIxYOyvXgGOSCnBNYQ9kEvmMf+hzewcWRJ1PPkfeowocmtD fbU4oyCQ3iTeMaoDgPUmLmsqL2IQKegStSCFKCpzNkORVm41TiJpWE9Qe1NYoMSEhU1f qDs77YikekGwd2Uqru7nA9EmHHglxbd9gGjGC3S2QuZav1xGiwW3ZQGbtprZm9W60V0q 08uYjv+DLcEhtsBmJ6Ii3mWhm3LPTL+76mXHLVx6wTZs+vJL7I3FTUlDefl0GfRPn5R1 yd1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711693326; x=1712298126; 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=YPRTTnRNGB6MC8MgLxeQqBqXiKf58UGvbzByUZNl4Io=; b=vXQstyyTCaO5Fj3MStaGgIc60Of3Hdk9iRwa9aQW2cQ8L2TN85N7icHmQFcAF89MUX MgdxWvjQL6k/KZOjvpJvJs1JMQbaYuiC10biMOsbKoPLAh3oW3uNoO8BkilkC0PucXPf 7GPPZXIlslEYsUj0bUht6oq8kk1fjJNsOzrd4pzf0mP5fIVexFUBMkcOFjAN1C9p7EkL M9HK1KLVUZpYhGa7IWTdy9UNrWFOMxKXkzf24swq6xvacPp+8Q52N0t+yfzDN/7SZIRt eQW1OhmxUGf+BN+XjJZm0rhCGtDmKX7r1HIN/KQy1THnftIr6yL8+F4pYDysNVDNpYWm +exg== X-Forwarded-Encrypted: i=1; AJvYcCWequJ4cTTcRSYgsbJsEnQs3ocowLmHWtnjOzrwjX0Ct5EvqwEvfCYCRmdgaQBXcxmXMR+xzdh9MrUk1CmPR8JHSKhpzumyH0x0CQVg5suomNacGaONRJ56+FvdCEkDCw8U6Q81iH+SW9zr20+lEUTTGOfYA51uJO/DEnY6LrrIX2Qwxw== X-Gm-Message-State: AOJu0Yyts/+CL324+E5u3G7AAyAJqs3zP5q/B6VnWL//i62CjMsv6raY UkzXxN6xw16HTJLUNFoC2yZGBWa3R4z7McMgQFkaGcXayDfdyUMA X-Received: by 2002:a05:6870:f68b:b0:22b:5bc1:66e7 with SMTP id el11-20020a056870f68b00b0022b5bc166e7mr1384174oab.11.1711693325826; Thu, 28 Mar 2024 23:22:05 -0700 (PDT) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id m40-20020a05683032a800b006e6bf2cc882sm521325ott.26.2024.03.28.23.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 23:22:05 -0700 (PDT) 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 v13 5/5] riscv: dts: add clock generator for Sophgo SG2042 SoC Date: Fri, 29 Mar 2024 14:21:58 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Chen Wang Add clock generator node to device tree for SG2042, and enable clock for uart. Signed-off-by: Chen Wang Reviewed-by: Guo Ren --- .../boot/dts/sophgo/sg2042-milkv-pioneer.dts | 12 +++++ arch/riscv/boot/dts/sophgo/sg2042.dtsi | 49 ++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) 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>; +}; + &uart0 { status = "okay"; }; diff --git a/arch/riscv/boot/dts/sophgo/sg2042.dtsi b/arch/riscv/boot/dts/sophgo/sg2042.dtsi index 81fda312f988..8aab027cf730 100644 --- a/arch/riscv/boot/dts/sophgo/sg2042.dtsi +++ b/arch/riscv/boot/dts/sophgo/sg2042.dtsi @@ -4,8 +4,10 @@ */ /dts-v1/; +#include +#include +#include #include - #include #include "sg2042-cpus.dtsi" @@ -20,12 +22,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>; @@ -341,6 +385,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>; resets = <&rstgen RST_UART0>; -- 2.25.1