Skip to content

Commit 3e057e0

Browse files
Haxk20vireshk
authored andcommitted
arm64: dts: allwinner: h616: Add CPU OPPs table
Add an Operating Performance Points table for the CPU cores to enable Dynamic Voltage & Frequency Scaling (DVFS) on the H616. The values were taken from the BSP sources. There is a separate OPP set seen on some H700 devices, but they didn't really work out in testing, so they are not included for now. Also add the needed cpu_speed_grade nvmem cell and the cooling cells properties, to enable passive cooling. Signed-off-by: Martin Botka <[email protected]> [Andre: rework to minimise opp-microvolt properties] Signed-off-by: Andre Przywara <[email protected]> Acked-by: Jernej Skrabec <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent e2e2dcd commit 3e057e0

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2+
// Copyright (C) 2023 Martin Botka <[email protected]>
3+
4+
/ {
5+
cpu_opp_table: opp-table-cpu {
6+
compatible = "allwinner,sun50i-h616-operating-points";
7+
nvmem-cells = <&cpu_speed_grade>;
8+
opp-shared;
9+
10+
opp-480000000 {
11+
opp-hz = /bits/ 64 <480000000>;
12+
opp-microvolt = <900000>;
13+
clock-latency-ns = <244144>; /* 8 32k periods */
14+
opp-supported-hw = <0x1f>;
15+
};
16+
17+
opp-600000000 {
18+
opp-hz = /bits/ 64 <600000000>;
19+
opp-microvolt = <900000>;
20+
clock-latency-ns = <244144>; /* 8 32k periods */
21+
opp-supported-hw = <0x12>;
22+
};
23+
24+
opp-720000000 {
25+
opp-hz = /bits/ 64 <720000000>;
26+
opp-microvolt = <900000>;
27+
clock-latency-ns = <244144>; /* 8 32k periods */
28+
opp-supported-hw = <0x0d>;
29+
};
30+
31+
opp-792000000 {
32+
opp-hz = /bits/ 64 <792000000>;
33+
opp-microvolt-speed1 = <900000>;
34+
opp-microvolt-speed4 = <940000>;
35+
clock-latency-ns = <244144>; /* 8 32k periods */
36+
opp-supported-hw = <0x12>;
37+
};
38+
39+
opp-936000000 {
40+
opp-hz = /bits/ 64 <936000000>;
41+
opp-microvolt = <900000>;
42+
clock-latency-ns = <244144>; /* 8 32k periods */
43+
opp-supported-hw = <0x0d>;
44+
};
45+
46+
opp-1008000000 {
47+
opp-hz = /bits/ 64 <1008000000>;
48+
opp-microvolt-speed0 = <950000>;
49+
opp-microvolt-speed1 = <940000>;
50+
opp-microvolt-speed2 = <950000>;
51+
opp-microvolt-speed3 = <950000>;
52+
opp-microvolt-speed4 = <1020000>;
53+
clock-latency-ns = <244144>; /* 8 32k periods */
54+
opp-supported-hw = <0x1f>;
55+
};
56+
57+
opp-1104000000 {
58+
opp-hz = /bits/ 64 <1104000000>;
59+
opp-microvolt-speed0 = <1000000>;
60+
opp-microvolt-speed2 = <1000000>;
61+
opp-microvolt-speed3 = <1000000>;
62+
clock-latency-ns = <244144>; /* 8 32k periods */
63+
opp-supported-hw = <0x0d>;
64+
};
65+
66+
opp-1200000000 {
67+
opp-hz = /bits/ 64 <1200000000>;
68+
opp-microvolt-speed0 = <1050000>;
69+
opp-microvolt-speed1 = <1020000>;
70+
opp-microvolt-speed2 = <1050000>;
71+
opp-microvolt-speed3 = <1050000>;
72+
opp-microvolt-speed4 = <1100000>;
73+
clock-latency-ns = <244144>; /* 8 32k periods */
74+
opp-supported-hw = <0x1f>;
75+
};
76+
77+
opp-1320000000 {
78+
opp-hz = /bits/ 64 <1320000000>;
79+
opp-microvolt = <1100000>;
80+
clock-latency-ns = <244144>; /* 8 32k periods */
81+
opp-supported-hw = <0x1d>;
82+
};
83+
84+
opp-1416000000 {
85+
opp-hz = /bits/ 64 <1416000000>;
86+
opp-microvolt = <1100000>;
87+
clock-latency-ns = <244144>; /* 8 32k periods */
88+
opp-supported-hw = <0x0d>;
89+
};
90+
91+
opp-1512000000 {
92+
opp-hz = /bits/ 64 <1512000000>;
93+
opp-microvolt-speed1 = <1100000>;
94+
opp-microvolt-speed3 = <1100000>;
95+
clock-latency-ns = <244144>; /* 8 32k periods */
96+
opp-supported-hw = <0x0a>;
97+
};
98+
};
99+
};
100+
101+
&cpu0 {
102+
operating-points-v2 = <&cpu_opp_table>;
103+
};
104+
105+
&cpu1 {
106+
operating-points-v2 = <&cpu_opp_table>;
107+
};
108+
109+
&cpu2 {
110+
operating-points-v2 = <&cpu_opp_table>;
111+
};
112+
113+
&cpu3 {
114+
operating-points-v2 = <&cpu_opp_table>;
115+
};

arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
reg = <0>;
2727
enable-method = "psci";
2828
clocks = <&ccu CLK_CPUX>;
29+
#cooling-cells = <2>;
2930
};
3031

3132
cpu1: cpu@1 {
@@ -34,6 +35,7 @@
3435
reg = <1>;
3536
enable-method = "psci";
3637
clocks = <&ccu CLK_CPUX>;
38+
#cooling-cells = <2>;
3739
};
3840

3941
cpu2: cpu@2 {
@@ -42,6 +44,7 @@
4244
reg = <2>;
4345
enable-method = "psci";
4446
clocks = <&ccu CLK_CPUX>;
47+
#cooling-cells = <2>;
4548
};
4649

4750
cpu3: cpu@3 {
@@ -50,6 +53,7 @@
5053
reg = <3>;
5154
enable-method = "psci";
5255
clocks = <&ccu CLK_CPUX>;
56+
#cooling-cells = <2>;
5357
};
5458
};
5559

@@ -156,6 +160,10 @@
156160
ths_calibration: thermal-sensor-calibration@14 {
157161
reg = <0x14 0x8>;
158162
};
163+
164+
cpu_speed_grade: cpu-speed-grade@0 {
165+
reg = <0x0 2>;
166+
};
159167
};
160168

161169
watchdog: watchdog@30090a0 {

0 commit comments

Comments
 (0)