Skip to contentSkip to conversation

arm64: dts: ti: k3-am62a: Enable CPU freq throttling on thermal alert

PATCH Superseded Daniel Schultz 2 participants 7 messages May 2, 2025 – May 5, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 arm64: dts: ti: k3-am62a: Enable CPU freq throttling on thermal alert

Enable throttling down the CPU frequency when an alert temperature threshold (lower than the critical threshold) is reached.

---
 arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi | 57 ++++++++++++++++++--
 arch/arm64/boot/dts/ti/k3-am62a7.dtsi        |  4 ++
 2 files changed, 58 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi +54 -3
index c7486fb2a5b4..39ff9118b6c4 100644
@@ -12,12 +12,29 @@ main0_thermal: main0-thermal {
 		thermal-sensors = <&wkup_vtm0 0>;
 
 		trips {
+			main0_alert: main0-alert {
+				temperature = <95000>;
+				hysteresis = <2000>;
+				type = "passive";
+			};
+
 			main0_crit: main0-crit {
 				temperature = <125000>;	/* milliCelsius */
 				hysteresis = <2000>;	/* milliCelsius */
 				type = "critical";
 			};
 		};
+
+		cooling-maps {
+			map0 {
+				trip = <&main0_alert>;
+				cooling-device =
+					<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			};
+		};
 	};
 
 	main1_thermal: main1-thermal {
@@ -26,25 +43,59 @@ main1_thermal: main1-thermal {
 		thermal-sensors = <&wkup_vtm0 1>;
 
 		trips {
+			main1_alert: main1-alert {
+				temperature = <95000>;
+				hysteresis = <2000>;
+				type = "passive";
+			};
+
 			main1_crit: main1-crit {
 				temperature = <125000>;	/* milliCelsius */
 				hysteresis = <2000>;	/* milliCelsius */
 				type = "critical";
 			};
 		};
+
+		cooling-maps {
+			map0 {
+				trip = <&main1_alert>;
+				cooling-device =
+					<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			};
+		};
 	};
 
 	main2_thermal: main2-thermal {
-	       polling-delay-passive = <250>;	/* milliSeconds */
-	       polling-delay = <500>;		/* milliSeconds */
-	       thermal-sensors = <&wkup_vtm0 2>;
+		polling-delay-passive = <250>;	/* milliSeconds */
+		polling-delay = <500>;		/* milliSeconds */
+		thermal-sensors = <&wkup_vtm0 2>;
 
 		trips {
+			main2_alert: main2-alert {
+				temperature = <95000>;
+				hysteresis = <2000>;
+				type = "passive";
+			};
+
 			main2_crit: main2-crit {
 				temperature = <125000>;	/* milliCelsius */
 				hysteresis = <2000>;	/* milliCelsius */
 				type = "critical";
 			};
 		};
+
+		cooling-maps {
+			map0 {
+				trip = <&main2_alert>;
+				cooling-device =
+					<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			};
+		};
 	};
 };
arch/arm64/boot/dts/ti/k3-am62a7.dtsi +4 -0
index 6c99221beb6b..b6e5eee99370 100644
@@ -50,6 +50,7 @@ cpu0: cpu@0 {
 			next-level-cache = <&L2_0>;
 			operating-points-v2 = <&a53_opp_table>;
 			clocks = <&k3_clks 135 0>;
+			#cooling-cells = <2>;
 		};
 
 		cpu1: cpu@1 {
@@ -66,6 +67,7 @@ cpu1: cpu@1 {
 			next-level-cache = <&L2_0>;
 			operating-points-v2 = <&a53_opp_table>;
 			clocks = <&k3_clks 136 0>;
+			#cooling-cells = <2>;
 		};
 
 		cpu2: cpu@2 {
@@ -82,6 +84,7 @@ cpu2: cpu@2 {
 			next-level-cache = <&L2_0>;
 			operating-points-v2 = <&a53_opp_table>;
 			clocks = <&k3_clks 137 0>;
+			#cooling-cells = <2>;
 		};
 
 		cpu3: cpu@3 {
@@ -98,6 +101,7 @@ cpu3: cpu@3 {
 			next-level-cache = <&L2_0>;
 			operating-points-v2 = <&a53_opp_table>;
 			clocks = <&k3_clks 138 0>;
+			#cooling-cells = <2>;
 		};
 	};
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/3 arm64: dts: ti: k3-am62a: Set Critical Temp. to 105C

The AM62Ax SoC supports two temperature ranges:
* A: -40 to 105C - Extended Industrial
* I: -40 to 125C - Automotive

By default, use the lower limit (105 °C) so that any AM62A running in Extended Industrial mode will shut down safely before overheating.

If the bootloader detects an Automotive-grade device, it should override this and raise the critical trip point to 125 °C.

---
 arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi +3 -3
index 39ff9118b6c4..40dcb9bab965 100644
@@ -19,7 +19,7 @@ main0_alert: main0-alert {
 			};
 
 			main0_crit: main0-crit {
-				temperature = <125000>;	/* milliCelsius */
+				temperature = <105000>;	/* milliCelsius */
 				hysteresis = <2000>;	/* milliCelsius */
 				type = "critical";
 			};
@@ -50,7 +50,7 @@ main1_alert: main1-alert {
 			};
 
 			main1_crit: main1-crit {
-				temperature = <125000>;	/* milliCelsius */
+				temperature = <105000>;	/* milliCelsius */
 				hysteresis = <2000>;	/* milliCelsius */
 				type = "critical";
 			};
@@ -81,7 +81,7 @@ main2_alert: main2-alert {
 			};
 
 			main2_crit: main2-crit {
-				temperature = <125000>;	/* milliCelsius */
+				temperature = <105000>;	/* milliCelsius */
 				hysteresis = <2000>;	/* milliCelsius */
 				type = "critical";
 			};
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH 2/3] arm64: dts: ti: k3-am62a: Set Critical Temp. to 105C

arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi

Quoted 19 lines · Daniel Schultz

The AM62Ax SoC supports two temperature ranges:
* A: -40 to 105C - Extended Industrial
* I: -40 to 125C - Automotive

By default, use the lower limit (105 °C) so that any AM62A running in Extended Industrial mode will shut down safely before overheating.

If the bootloader detects an Automotive-grade device, it should override this and raise the critical trip point to 125 °C.

---
 arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi +0 -0
index 39ff9118b6c4..40dcb9bab965 100644

Why not create a separate header for industrial grade and rename this as automotive grade and let the board file pick the right grade used on the board?

Quoted 30 lines
arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi +3 -3
@@ -19,7 +19,7 @@ main0_alert: main0-alert {
 			};
 
 			main0_crit: main0-crit {
-				temperature = <125000>;	/* milliCelsius */
+				temperature = <105000>;	/* milliCelsius */
 				hysteresis = <2000>;	/* milliCelsius */
 				type = "critical";
 			};
@@ -50,7 +50,7 @@ main1_alert: main1-alert {
 			};
 
 			main1_crit: main1-crit {
-				temperature = <125000>;	/* milliCelsius */
+				temperature = <105000>;	/* milliCelsius */
 				hysteresis = <2000>;	/* milliCelsius */
 				type = "critical";
 			};
@@ -81,7 +81,7 @@ main2_alert: main2-alert {
 			};
 
 			main2_crit: main2-crit {
-				temperature = <125000>;	/* milliCelsius */
+				temperature = <105000>;	/* milliCelsius */
 				hysteresis = <2000>;	/* milliCelsius */
 				type = "critical";
 			};
Signature · 1 line
2.25.1
Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#3 lore raw

Re: [PATCH 2/3] arm64: dts: ti: k3-am62a: Set Critical Temp. to 105C

Quoted 16 lines · Nishanth Menon
Quoted 15 lines · Daniel Schultz

The AM62Ax SoC supports two temperature ranges:
* A: -40 to 105C - Extended Industrial
* I: -40 to 125C - Automotive

By default, use the lower limit (105 °C) so that any AM62A running in Extended Industrial mode will shut down safely before overheating.

If the bootloader detects an Automotive-grade device, it should override this and raise the critical trip point to 125 °C.

---
  arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 7 lines

arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi

Quoted 4 lines
arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi +0 -0
index 39ff9118b6c4..40dcb9bab965 100644

Why not create a separate header for industrial grade and rename this as automotive grade and let the board file pick the right grade used on the board?

Mostly because I copied this from 10e7bfd8114c207ac and with the most recent temperature fixups in U-Boot, we also have the missing bootloader logic.

I would also prefer an out-of-the-box solution for that.

- Daniel

Quoted 31 lines
Quoted 31 lines
arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi +3 -3
@@ -19,7 +19,7 @@ main0_alert: main0-alert {
  			};
 
  			main0_crit: main0-crit {
-				temperature = <125000>;	/* milliCelsius */
+				temperature = <105000>;	/* milliCelsius */
  				hysteresis = <2000>;	/* milliCelsius */
  				type = "critical";
  			};
@@ -50,7 +50,7 @@ main1_alert: main1-alert {
  			};
 
  			main1_crit: main1-crit {
-				temperature = <125000>;	/* milliCelsius */
+				temperature = <105000>;	/* milliCelsius */
  				hysteresis = <2000>;	/* milliCelsius */
  				type = "critical";
  			};
@@ -81,7 +81,7 @@ main2_alert: main2-alert {
  			};
 
  			main2_crit: main2-crit {
-				temperature = <125000>;	/* milliCelsius */
+				temperature = <105000>;	/* milliCelsius */
  				hysteresis = <2000>;	/* milliCelsius */
  				type = "critical";
  			};
Signature · 1 line
2.25.1
maintainer
#4 lore raw

Re: [PATCH 2/3] arm64: dts: ti: k3-am62a: Set Critical Temp. to 105C

Quoted 26 lines · Daniel Schultz
Quoted 16 lines · Nishanth Menon
Quoted 15 lines · Daniel Schultz

The AM62Ax SoC supports two temperature ranges:
* A: -40 to 105C - Extended Industrial
* I: -40 to 125C - Automotive

By default, use the lower limit (105 °C) so that any AM62A running in Extended Industrial mode will shut down safely before overheating.

If the bootloader detects an Automotive-grade device, it should override this and raise the critical trip point to 125 °C.

---
  arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 7 lines

arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi

Quoted 4 lines
arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi +0 -0
index 39ff9118b6c4..40dcb9bab965 100644

Why not create a separate header for industrial grade and rename this as automotive grade and let the board file pick the right grade used on the board?

Quoted 4 lines

Mostly because I copied this from 10e7bfd8114c207ac and with the most recent temperature fixups in U-Boot, we also have the missing bootloader logic.

I would also prefer an out-of-the-box solution for that.

Personally, I am not in favor of depending on U-boot (there are other bootloaders as well in the ecosystem) monkeying with dt nodes.

I suggest renaming the dtsi and introducing a industrial dtsi. And depending on the samples used by the board, use the correct dtsi.

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#5 lore raw

Re: [PATCH 2/3] arm64: dts: ti: k3-am62a: Set Critical Temp. to 105C

Quoted 28 lines · Nishanth Menon
Quoted 27 lines · Daniel Schultz
Quoted 16 lines · Nishanth Menon
Quoted 15 lines · Daniel Schultz

The AM62Ax SoC supports two temperature ranges:
* A: -40 to 105C - Extended Industrial
* I: -40 to 125C - Automotive

By default, use the lower limit (105 °C) so that any AM62A running in Extended Industrial mode will shut down safely before overheating.

If the bootloader detects an Automotive-grade device, it should override this and raise the critical trip point to 125 °C.

---
   arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 7 lines

arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi

Quoted 4 lines
arch/arm64/boot/dts/ti/k3-am62a-thermal.dtsi +0 -0
index 39ff9118b6c4..40dcb9bab965 100644

Why not create a separate header for industrial grade and rename this as automotive grade and let the board file pick the right grade used on the board?

Mostly because I copied this from 10e7bfd8114c207ac and with the most recent temperature fixups in U-Boot, we also have the missing bootloader logic.

Quoted 6 lines
Quoted 1 line

I would also prefer an out-of-the-box solution for that.

Personally, I am not in favor of depending on U-boot (there are other bootloaders as well in the ecosystem) monkeying with dt nodes.

I suggest renaming the dtsi and introducing a industrial dtsi. And depending on the samples used by the board, use the correct dtsi.

Can you just drop this patch and continue with 1/3 and 3/3 or should I re-send? I will update the am62x and am62ax both in a separate series afterwards. I probably have to update quite a lot board and that might take longer to get an ack by everyone.

- Daniel

#6 lore raw

PATCH 3/3 arm64: dts: ti: k3-am62x-phyboard-lyra-gpio-fan: Update cooling maps

In reply to Daniel Schultz

Rename 'main0_thermal_trip0' to a more descriptive name that includes 'fan', as the current name is too generic for a fan control trip point.

Move the fan to a new cooling map to avoid overwriting the passive trip point used for CPU frequency throttling when this overlay is enabled. Also, add the fan to the existing cooling map.

---
 .../dts/ti/k3-am62x-phyboard-lyra-gpio-fan.dtso    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/ti/k3-am62x-phyboard-lyra-gpio-fan.dtso +12 -2
index f0b2fd4165a7..1fd0aaff3193 100644
@@ -33,7 +33,7 @@ AM62X_IOPAD(0x0a4, PIN_OUTPUT, 7) /* (M22) GPMC0_DIR.GPIO0_40 */
 &thermal_zones {
 	main0_thermal: main0-thermal {
 		trips {
-			main0_thermal_trip0: main0-thermal-trip {
+			main0_fan: main0-fan {
 				temperature = <65000>;  /* millicelsius */
 				hysteresis = <2000>;    /* millicelsius */
 				type = "active";
@@ -42,7 +42,17 @@ main0_thermal_trip0: main0-thermal-trip {
 
 		cooling-maps {
 			map0 {
-				trip = <&main0_thermal_trip0>;
+				trip = <&main0_alert>;
+				cooling-device =
+					<&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			};
+
+			map1 {
+				trip = <&main0_fan>;
 				cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 			};
 		};
Signature · 1 line
2.25.1