From patchwork Mon May 6 09:36:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Charkov X-Patchwork-Id: 13655220 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 D110CC10F16 for ; Mon, 6 May 2024 09:37:59 +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=48gprz1v2aGh4kVd4qfNW4r5FhUaaUJbAD6X858yldw=; b=DDTYm2F0uIjK92 lqu7v3YTOHQPO7Z5VUQyUR202tKRWA4kfFVPy+Qt7WvyuQ/JYEKKoEYb2Ati9KtNC+nCxnEmR9uQl 6K0V5MyKHL8OEx7erLIdoQdNBfB0K/q9Ja1vydqr/2/Jl4COmNfhdEA0un4w8N+ccuc+ab0LcrqoA Ea/8yC+MsWoZalFGZKwtlho2iXPxzMRKSfn8YXk8z9ZYnEqR1gXBTQ45a3fnrY5CR9bjYnZ76lvqz lI3lRyRbDL0B39PVELzFYo6XRUnK4RXEHn6gfJj8KlVKyREMw+0mdfbYMoV0H+wvaABImEyshqG22 fsM3t99vVqfebWYARlAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s3un5-00000006oub-1nKq; Mon, 06 May 2024 09:37:47 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s3umr-00000006ogl-3qtO; Mon, 06 May 2024 09:37:40 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2dd7e56009cso22355621fa.3; Mon, 06 May 2024 02:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714988250; x=1715593050; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YJ/i9aSextJBDewJyOG1hC8/ORRuaV5BU0FGPlg+ibI=; b=cnEOOCimDOK2PL5Zvyqrcc44/RQ6eedMFx3XEspxQ2XrUFMATKVkj6t/8aPmYalugV xfZSDuYXUDziPKlwoFe5p9LddnsVi4jTCwdM8v3KKY099dA0LQNIahP/lOFZdZoYjgKe nnaEYArE1ErFDa5ConcVTE/KQsFk6v/G5ii2z3m0wS3XMPDPeCTuHj8fzfe+zT23M5nl nx4/GAMzz7cZuXXlBNhQa1nVTIP735a8s/Rx6HgwGMT5lggw7GR9JTDJbuqAwrjhceTd pDqluwkMmwfDI06FG70oWWC517W4UguScFZID0MtppYZIjDmbhNrQLYpOii8JsIsy/W1 9P7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714988250; x=1715593050; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YJ/i9aSextJBDewJyOG1hC8/ORRuaV5BU0FGPlg+ibI=; b=eLsOmmCtrlHI4lrl05C0umeNoYHOVrEBY1KXDErqx5wZlA2nodO6vH+WRYHgU01omE UzNXfNBv40UI9rD198pzT0tb2YJMaRTDet8M9zhCoNUH3kPNW35xil5Qz3vhldE+/pWY vcFacmRCPtK400Qzyr0fASf30/JxayWFU4u3lW5SY0IUe1O8JYthDfGsRgOUdX8xnlB6 X9RQWt//nE81+Em9tNWjGU55RBmDSMI9CAMUq210wbsGxopKcNm5XLbLtDRUfbXeQJQt aN+ntb23n/5LK4XAL4IrdBxh7bCwXB4faWN4P1zE5YPn3rifsRk2CU5mWh3cnjjIFRlz dCgw== X-Forwarded-Encrypted: i=1; AJvYcCWgWNaIhGz4T/RXP1nJhFvQu9j+5222usF+UUBULJ9+cgWB4bDgaWIHXi8wGtQjwxSIDmXWQ05LTbmZ2/qNtQVFHsVoBuouJ7+be3MJczHRydYNoGWXG11x+pKmbMhZcE6LRV8wacXrnIhrWowDh4AbJ2d2X/jk+Vo= X-Gm-Message-State: AOJu0YwRuLxQGBgT1wGcpYXyjki46hOFOqhavORhyYUxEFkyWAINaG3+ gynFB0aAIDIaus/nmc8sWaFP+8PIUcZH+0Zf+XO7GKwE6kqtHvL7 X-Google-Smtp-Source: AGHT+IGmDp3zClvpYcSZX9BMZ5alfu+DnAeI8C/Ka2kdqS+p80hCz9EVcR9O2B0IHmViYyKyuGF0Gg== X-Received: by 2002:a19:381a:0:b0:51d:3b87:70a6 with SMTP id f26-20020a19381a000000b0051d3b8770a6mr7073690lfa.13.1714988250256; Mon, 06 May 2024 02:37:30 -0700 (PDT) Received: from [172.30.32.119] ([2001:8f8:183b:f2c::d35]) by smtp.gmail.com with ESMTPSA id f6-20020a056402160600b005722ce89ae2sm4983647edv.38.2024.05.06.02.37.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 02:37:29 -0700 (PDT) From: Alexey Charkov Date: Mon, 06 May 2024 13:36:37 +0400 Subject: [PATCH v4 6/6] arm64: dts: rockchip: Add OPP data for CPU cores on RK3588 MIME-Version: 1.0 Message-Id: <20240506-rk-dts-additions-v4-6-271023ddfd40@gmail.com> References: <20240506-rk-dts-additions-v4-0-271023ddfd40@gmail.com> In-Reply-To: <20240506-rk-dts-additions-v4-0-271023ddfd40@gmail.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner Cc: Daniel Lezcano , Dragan Simic , Viresh Kumar , Chen-Yu Tsai , Diederik de Haas , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alexey Charkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714988225; l=7420; i=alchark@gmail.com; s=20240125; h=from:subject:message-id; bh=u0gM6tgf6YzJQvPrv4bbdJjzpHgMPBoZnVPNA5o69i0=; b=NfzFHVbPxKtMkrjMx7ITPK0l9dIz6TK3LMlotIOo6u548b6Xuf0R6hhxasx1fOlIhVYKEcYv/ J0vR7Nvg0SADzl2KsFF5wijg/ZINprMkziy6RTlh00QO7fHZLtRxYeE X-Developer-Key: i=alchark@gmail.com; a=ed25519; pk=xRO8VeD3J5jhwe0za0aHt2LDumQr8cm0Ls7Jz3YGimk= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240506_023734_160009_B238B1E8 X-CRM114-Status: GOOD ( 15.05 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org By default the CPUs on RK3588 start up in a conservative performance mode. Add frequency and voltage mappings to the device tree to enable dynamic scaling via cpufreq. OPP values are adapted from Radxa's downstream kernel for Rock 5B [1], stripping them down to the minimum frequency and voltage combinations as expected by the generic upstream cpufreq-dt driver, and also dropping those OPPs that don't differ in voltage but only in frequency (keeping the top frequency OPP in each case). Note that this patch ignores voltage scaling for the CPU memory interface which the downstream kernel does through a custom cpufreq driver, and which is why the downstream version has two sets of voltage values for each OPP (the second one being meant for the memory interface supply regulator). This is done instead via regulator coupling between CPU and memory interface supplies on affected boards. This has been tested on Rock 5B with u-boot 2023.11 compiled from Collabora's integration tree [2] with binary bl31 and appears to be stable both under active cooling and passive cooling (with throttling) [1] https://github.com/radxa/kernel/blob/stable-5.10-rock5/arch/arm64/boot/dts/rockchip/rk3588s.dtsi [2] https://gitlab.collabora.com/hardware-enablement/rockchip-3588/u-boot Signed-off-by: Alexey Charkov --- arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 122 ++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi index 57c2d998ae75..85c25d5efdad 100644 --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi @@ -97,6 +97,7 @@ cpu_l0: cpu@0 { clocks = <&scmi_clk SCMI_CLK_CPUL>; assigned-clocks = <&scmi_clk SCMI_CLK_CPUL>; assigned-clock-rates = <816000000>; + operating-points-v2 = <&cluster0_opp_table>; cpu-idle-states = <&CPU_SLEEP>; i-cache-size = <32768>; i-cache-line-size = <64>; @@ -116,6 +117,7 @@ cpu_l1: cpu@100 { enable-method = "psci"; capacity-dmips-mhz = <530>; clocks = <&scmi_clk SCMI_CLK_CPUL>; + operating-points-v2 = <&cluster0_opp_table>; cpu-idle-states = <&CPU_SLEEP>; i-cache-size = <32768>; i-cache-line-size = <64>; @@ -135,6 +137,7 @@ cpu_l2: cpu@200 { enable-method = "psci"; capacity-dmips-mhz = <530>; clocks = <&scmi_clk SCMI_CLK_CPUL>; + operating-points-v2 = <&cluster0_opp_table>; cpu-idle-states = <&CPU_SLEEP>; i-cache-size = <32768>; i-cache-line-size = <64>; @@ -154,6 +157,7 @@ cpu_l3: cpu@300 { enable-method = "psci"; capacity-dmips-mhz = <530>; clocks = <&scmi_clk SCMI_CLK_CPUL>; + operating-points-v2 = <&cluster0_opp_table>; cpu-idle-states = <&CPU_SLEEP>; i-cache-size = <32768>; i-cache-line-size = <64>; @@ -175,6 +179,7 @@ cpu_b0: cpu@400 { clocks = <&scmi_clk SCMI_CLK_CPUB01>; assigned-clocks = <&scmi_clk SCMI_CLK_CPUB01>; assigned-clock-rates = <816000000>; + operating-points-v2 = <&cluster1_opp_table>; cpu-idle-states = <&CPU_SLEEP>; i-cache-size = <65536>; i-cache-line-size = <64>; @@ -194,6 +199,7 @@ cpu_b1: cpu@500 { enable-method = "psci"; capacity-dmips-mhz = <1024>; clocks = <&scmi_clk SCMI_CLK_CPUB01>; + operating-points-v2 = <&cluster1_opp_table>; cpu-idle-states = <&CPU_SLEEP>; i-cache-size = <65536>; i-cache-line-size = <64>; @@ -215,6 +221,7 @@ cpu_b2: cpu@600 { clocks = <&scmi_clk SCMI_CLK_CPUB23>; assigned-clocks = <&scmi_clk SCMI_CLK_CPUB23>; assigned-clock-rates = <816000000>; + operating-points-v2 = <&cluster2_opp_table>; cpu-idle-states = <&CPU_SLEEP>; i-cache-size = <65536>; i-cache-line-size = <64>; @@ -234,6 +241,7 @@ cpu_b3: cpu@700 { enable-method = "psci"; capacity-dmips-mhz = <1024>; clocks = <&scmi_clk SCMI_CLK_CPUB23>; + operating-points-v2 = <&cluster2_opp_table>; cpu-idle-states = <&CPU_SLEEP>; i-cache-size = <65536>; i-cache-line-size = <64>; @@ -348,6 +356,120 @@ l3_cache: l3-cache { }; }; + cluster0_opp_table: opp-table-cluster0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-1008000000 { + opp-hz = /bits/ 64 <1008000000>; + opp-microvolt = <675000 675000 950000>; + clock-latency-ns = <40000>; + }; + opp-1200000000 { + opp-hz = /bits/ 64 <1200000000>; + opp-microvolt = <712500 712500 950000>; + clock-latency-ns = <40000>; + }; + opp-1416000000 { + opp-hz = /bits/ 64 <1416000000>; + opp-microvolt = <762500 762500 950000>; + clock-latency-ns = <40000>; + opp-suspend; + }; + opp-1608000000 { + opp-hz = /bits/ 64 <1608000000>; + opp-microvolt = <850000 850000 950000>; + clock-latency-ns = <40000>; + }; + opp-1800000000 { + opp-hz = /bits/ 64 <1800000000>; + opp-microvolt = <950000 950000 950000>; + clock-latency-ns = <40000>; + }; + }; + + cluster1_opp_table: opp-table-cluster1 { + compatible = "operating-points-v2"; + opp-shared; + + opp-1200000000 { + opp-hz = /bits/ 64 <1200000000>; + opp-microvolt = <675000 675000 1000000>; + clock-latency-ns = <40000>; + }; + opp-1416000000 { + opp-hz = /bits/ 64 <1416000000>; + opp-microvolt = <725000 725000 1000000>; + clock-latency-ns = <40000>; + }; + opp-1608000000 { + opp-hz = /bits/ 64 <1608000000>; + opp-microvolt = <762500 762500 1000000>; + clock-latency-ns = <40000>; + }; + opp-1800000000 { + opp-hz = /bits/ 64 <1800000000>; + opp-microvolt = <850000 850000 1000000>; + clock-latency-ns = <40000>; + }; + opp-2016000000 { + opp-hz = /bits/ 64 <2016000000>; + opp-microvolt = <925000 925000 1000000>; + clock-latency-ns = <40000>; + }; + opp-2208000000 { + opp-hz = /bits/ 64 <2208000000>; + opp-microvolt = <987500 987500 1000000>; + clock-latency-ns = <40000>; + }; + opp-2400000000 { + opp-hz = /bits/ 64 <2400000000>; + opp-microvolt = <1000000 1000000 1000000>; + clock-latency-ns = <40000>; + }; + }; + + cluster2_opp_table: opp-table-cluster2 { + compatible = "operating-points-v2"; + opp-shared; + + opp-1200000000 { + opp-hz = /bits/ 64 <1200000000>; + opp-microvolt = <675000 675000 1000000>; + clock-latency-ns = <40000>; + }; + opp-1416000000 { + opp-hz = /bits/ 64 <1416000000>; + opp-microvolt = <725000 725000 1000000>; + clock-latency-ns = <40000>; + }; + opp-1608000000 { + opp-hz = /bits/ 64 <1608000000>; + opp-microvolt = <762500 762500 1000000>; + clock-latency-ns = <40000>; + }; + opp-1800000000 { + opp-hz = /bits/ 64 <1800000000>; + opp-microvolt = <850000 850000 1000000>; + clock-latency-ns = <40000>; + }; + opp-2016000000 { + opp-hz = /bits/ 64 <2016000000>; + opp-microvolt = <925000 925000 1000000>; + clock-latency-ns = <40000>; + }; + opp-2208000000 { + opp-hz = /bits/ 64 <2208000000>; + opp-microvolt = <987500 987500 1000000>; + clock-latency-ns = <40000>; + }; + opp-2400000000 { + opp-hz = /bits/ 64 <2400000000>; + opp-microvolt = <1000000 1000000 1000000>; + clock-latency-ns = <40000>; + }; + }; + display_subsystem: display-subsystem { compatible = "rockchip,display-subsystem"; ports = <&vop_out>;