cb5c254ffb4a3601bcec36ab37c668e59d7c4c35
[openwrt/staging/blocktrron.git] /
1 From 276856db91b46eaa7a4c19226c096a9dc899a3e9 Mon Sep 17 00:00:00 2001
2 From: Alexey Charkov <alchark@gmail.com>
3 Date: Mon, 17 Jun 2024 22:28:56 +0400
4 Subject: [PATCH] arm64: dts: rockchip: Add OPP data for CPU cores on RK3588
5
6 By default the CPUs on RK3588 start up in a conservative performance
7 mode. Add frequency and voltage mappings to the device tree to enable
8 dynamic scaling via cpufreq.
9
10 OPP values are adapted from Radxa's downstream kernel for Rock 5B [1],
11 stripping them down to the minimum frequency and voltage combinations
12 as expected by the generic upstream cpufreq-dt driver, and also dropping
13 those OPPs that don't differ in voltage but only in frequency (keeping
14 the top frequency OPP in each case).
15
16 Note that this patch ignores voltage scaling for the CPU memory
17 interface which the downstream kernel does through a custom cpufreq
18 driver, and which is why the downstream version has two sets of voltage
19 values for each OPP (the second one being meant for the memory
20 interface supply regulator). This is done instead via regulator
21 coupling between CPU and memory interface supplies on affected boards.
22
23 This has been tested on Rock 5B with u-boot 2023.11 compiled from
24 Collabora's integration tree [2] with binary bl31 and appears to be
25 stable both under active cooling and passive cooling (with throttling)
26
27 [1] https://github.com/radxa/kernel/blob/stable-5.10-rock5/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
28 [2] https://gitlab.collabora.com/hardware-enablement/rockchip-3588/u-boot
29
30 Signed-off-by: Alexey Charkov <alchark@gmail.com>
31 Link: https://lore.kernel.org/r/20240617-rk-dts-additions-v5-6-c1f5f3267f1e@gmail.com
32 Signed-off-by: Heiko Stuebner <heiko@sntech.de>
33 ---
34 arch/arm64/boot/dts/rockchip/rk3588-opp.dtsi | 149 +++++++++++++++++++
35 arch/arm64/boot/dts/rockchip/rk3588.dtsi | 1 +
36 arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 1 +
37 3 files changed, 151 insertions(+)
38 create mode 100644 arch/arm64/boot/dts/rockchip/rk3588-opp.dtsi
39
40 --- /dev/null
41 +++ b/arch/arm64/boot/dts/rockchip/rk3588-opp.dtsi
42 @@ -0,0 +1,149 @@
43 +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
44 +
45 +/ {
46 + cluster0_opp_table: opp-table-cluster0 {
47 + compatible = "operating-points-v2";
48 + opp-shared;
49 +
50 + opp-1008000000 {
51 + opp-hz = /bits/ 64 <1008000000>;
52 + opp-microvolt = <675000 675000 950000>;
53 + clock-latency-ns = <40000>;
54 + };
55 + opp-1200000000 {
56 + opp-hz = /bits/ 64 <1200000000>;
57 + opp-microvolt = <712500 712500 950000>;
58 + clock-latency-ns = <40000>;
59 + };
60 + opp-1416000000 {
61 + opp-hz = /bits/ 64 <1416000000>;
62 + opp-microvolt = <762500 762500 950000>;
63 + clock-latency-ns = <40000>;
64 + opp-suspend;
65 + };
66 + opp-1608000000 {
67 + opp-hz = /bits/ 64 <1608000000>;
68 + opp-microvolt = <850000 850000 950000>;
69 + clock-latency-ns = <40000>;
70 + };
71 + opp-1800000000 {
72 + opp-hz = /bits/ 64 <1800000000>;
73 + opp-microvolt = <950000 950000 950000>;
74 + clock-latency-ns = <40000>;
75 + };
76 + };
77 +
78 + cluster1_opp_table: opp-table-cluster1 {
79 + compatible = "operating-points-v2";
80 + opp-shared;
81 +
82 + opp-1200000000 {
83 + opp-hz = /bits/ 64 <1200000000>;
84 + opp-microvolt = <675000 675000 1000000>;
85 + clock-latency-ns = <40000>;
86 + };
87 + opp-1416000000 {
88 + opp-hz = /bits/ 64 <1416000000>;
89 + opp-microvolt = <725000 725000 1000000>;
90 + clock-latency-ns = <40000>;
91 + };
92 + opp-1608000000 {
93 + opp-hz = /bits/ 64 <1608000000>;
94 + opp-microvolt = <762500 762500 1000000>;
95 + clock-latency-ns = <40000>;
96 + };
97 + opp-1800000000 {
98 + opp-hz = /bits/ 64 <1800000000>;
99 + opp-microvolt = <850000 850000 1000000>;
100 + clock-latency-ns = <40000>;
101 + };
102 + opp-2016000000 {
103 + opp-hz = /bits/ 64 <2016000000>;
104 + opp-microvolt = <925000 925000 1000000>;
105 + clock-latency-ns = <40000>;
106 + };
107 + opp-2208000000 {
108 + opp-hz = /bits/ 64 <2208000000>;
109 + opp-microvolt = <987500 987500 1000000>;
110 + clock-latency-ns = <40000>;
111 + };
112 + opp-2400000000 {
113 + opp-hz = /bits/ 64 <2400000000>;
114 + opp-microvolt = <1000000 1000000 1000000>;
115 + clock-latency-ns = <40000>;
116 + };
117 + };
118 +
119 + cluster2_opp_table: opp-table-cluster2 {
120 + compatible = "operating-points-v2";
121 + opp-shared;
122 +
123 + opp-1200000000 {
124 + opp-hz = /bits/ 64 <1200000000>;
125 + opp-microvolt = <675000 675000 1000000>;
126 + clock-latency-ns = <40000>;
127 + };
128 + opp-1416000000 {
129 + opp-hz = /bits/ 64 <1416000000>;
130 + opp-microvolt = <725000 725000 1000000>;
131 + clock-latency-ns = <40000>;
132 + };
133 + opp-1608000000 {
134 + opp-hz = /bits/ 64 <1608000000>;
135 + opp-microvolt = <762500 762500 1000000>;
136 + clock-latency-ns = <40000>;
137 + };
138 + opp-1800000000 {
139 + opp-hz = /bits/ 64 <1800000000>;
140 + opp-microvolt = <850000 850000 1000000>;
141 + clock-latency-ns = <40000>;
142 + };
143 + opp-2016000000 {
144 + opp-hz = /bits/ 64 <2016000000>;
145 + opp-microvolt = <925000 925000 1000000>;
146 + clock-latency-ns = <40000>;
147 + };
148 + opp-2208000000 {
149 + opp-hz = /bits/ 64 <2208000000>;
150 + opp-microvolt = <987500 987500 1000000>;
151 + clock-latency-ns = <40000>;
152 + };
153 + opp-2400000000 {
154 + opp-hz = /bits/ 64 <2400000000>;
155 + opp-microvolt = <1000000 1000000 1000000>;
156 + clock-latency-ns = <40000>;
157 + };
158 + };
159 +};
160 +
161 +&cpu_b0 {
162 + operating-points-v2 = <&cluster1_opp_table>;
163 +};
164 +
165 +&cpu_b1 {
166 + operating-points-v2 = <&cluster1_opp_table>;
167 +};
168 +
169 +&cpu_b2 {
170 + operating-points-v2 = <&cluster2_opp_table>;
171 +};
172 +
173 +&cpu_b3 {
174 + operating-points-v2 = <&cluster2_opp_table>;
175 +};
176 +
177 +&cpu_l0 {
178 + operating-points-v2 = <&cluster0_opp_table>;
179 +};
180 +
181 +&cpu_l1 {
182 + operating-points-v2 = <&cluster0_opp_table>;
183 +};
184 +
185 +&cpu_l2 {
186 + operating-points-v2 = <&cluster0_opp_table>;
187 +};
188 +
189 +&cpu_l3 {
190 + operating-points-v2 = <&cluster0_opp_table>;
191 +};
192 --- a/arch/arm64/boot/dts/rockchip/rk3588.dtsi
193 +++ b/arch/arm64/boot/dts/rockchip/rk3588.dtsi
194 @@ -5,3 +5,4 @@
195 */
196
197 #include "rk3588-extra.dtsi"
198 +#include "rk3588-opp.dtsi"
199 --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
200 +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
201 @@ -5,3 +5,4 @@
202 */
203
204 #include "rk3588-base.dtsi"
205 +#include "rk3588-opp.dtsi"