Skip to contentSkip to conversation

riscv: dts: starfive: jh71x0: Add temperature sensor nodes and thermal-zones

PATCH Applied Hal Feng 3 participants 9 messages Jul 18, 2023 – Aug 10, 2023

Subsystems (3)
lore
Share & tools
lore

Hal Feng

author
#0 lore raw

cover riscv: dts: starfive: jh71x0: Add temperature sensor nodes and thermal-zones

Hi, Conor,

These patches add temperature sensor nodes and thermal-zones for the StarFive JH71X0 SoC. I have tested them on the BeagleV Starlight board and StarFive VisionFive 1 / 2 board. Thanks.

Best regards,
Hal

Hal Feng (3):
riscv: dts: starfive: jh7100: Add temperature sensor node and
thermal-zones
riscv: dts: starfive: jh7110: Add temperature sensor node and
thermal-zones
MAINTAINERS: Add Hal as a maintainer of SFCTEMP HWMON DRIVER

 MAINTAINERS                              |  1 +
 arch/riscv/boot/dts/starfive/jh7100.dtsi | 37 +++++++++++++++++
 arch/riscv/boot/dts/starfive/jh7110.dtsi | 53 ++++++++++++++++++++++++
 3 files changed, 91 insertions(+)

base-commit: fdf0eaf11452d72945af31804e2a1048ee1b574c

Signature · 1 line
2.38.1
author
#3 lore raw

PATCH 3/3 MAINTAINERS: Add Hal as a maintainer of SFCTEMP HWMON DRIVER

As he is the submitter of this driver, add his mail so he can maintain the driver and easily reply in the mailing list.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index aee340630eca..5056079ade77 100644
@@ -19256,6 +19256,7 @@ F:	drivers/net/ethernet/sfc/
 
 SFCTEMP HWMON DRIVER
 M:	Emil Renner Berthing <[email protected]>
+M:	Hal Feng <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml
Signature · 1 line
2.38.1
author
#2 lore raw

PATCH 2/3 riscv: dts: starfive: jh7110: Add temperature sensor node and thermal-zones

In reply to Hal Feng

Add temperature sensor and thermal-zones support for the StarFive JH7110 SoC. CPUFreq cooling is supported in thermal-zones.

---
 arch/riscv/boot/dts/starfive/jh7110.dtsi | 53 ++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
arch/riscv/boot/dts/starfive/jh7110.dtsi +53 -0
index ec2e70011a73..2315acd560a3 100644
@@ -7,6 +7,7 @@
 /dts-v1/;
 #include <dt-bindings/clock/starfive,jh7110-crg.h>
 #include <dt-bindings/reset/starfive,jh7110-crg.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
 	compatible = "starfive,jh7110";
@@ -56,6 +57,7 @@ U74_1: cpu@1 {
 			operating-points-v2 = <&cpu_opp>;
 			clocks = <&syscrg JH7110_SYSCLK_CPU_CORE>;
 			clock-names = "cpu";
+			#cooling-cells = <2>;
 
 			cpu1_intc: interrupt-controller {
 				compatible = "riscv,cpu-intc";
@@ -85,6 +87,7 @@ U74_2: cpu@2 {
 			operating-points-v2 = <&cpu_opp>;
 			clocks = <&syscrg JH7110_SYSCLK_CPU_CORE>;
 			clock-names = "cpu";
+			#cooling-cells = <2>;
 
 			cpu2_intc: interrupt-controller {
 				compatible = "riscv,cpu-intc";
@@ -114,6 +117,7 @@ U74_3: cpu@3 {
 			operating-points-v2 = <&cpu_opp>;
 			clocks = <&syscrg JH7110_SYSCLK_CPU_CORE>;
 			clock-names = "cpu";
+			#cooling-cells = <2>;
 
 			cpu3_intc: interrupt-controller {
 				compatible = "riscv,cpu-intc";
@@ -143,6 +147,7 @@ U74_4: cpu@4 {
 			operating-points-v2 = <&cpu_opp>;
 			clocks = <&syscrg JH7110_SYSCLK_CPU_CORE>;
 			clock-names = "cpu";
+			#cooling-cells = <2>;
 
 			cpu4_intc: interrupt-controller {
 				compatible = "riscv,cpu-intc";
@@ -197,6 +202,42 @@ opp-1500000000 {
 			};
 	};
 
+	thermal-zones {
+		cpu-thermal {
+			polling-delay-passive = <250>;
+			polling-delay = <15000>;
+
+			thermal-sensors = <&sfctemp>;
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu_alert0>;
+					cooling-device =
+						<&U74_1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+						<&U74_2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+						<&U74_3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+						<&U74_4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+
+			trips {
+				cpu_alert0: cpu_alert0 {
+					/* milliCelsius */
+					temperature = <85000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_crit {
+					/* milliCelsius */
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	gmac0_rgmii_rxin: gmac0-rgmii-rxin-clock {
 		compatible = "fixed-clock";
 		clock-output-names = "gmac0_rgmii_rxin";
@@ -473,6 +514,18 @@ i2c6: i2c@12060000 {
 			status = "disabled";
 		};
 
+		sfctemp: temperature-sensor@120e0000 {
+			compatible = "starfive,jh7110-temp";
+			reg = <0x0 0x120e0000 0x0 0x10000>;
+			clocks = <&syscrg JH7110_SYSCLK_TEMP_CORE>,
+				 <&syscrg JH7110_SYSCLK_TEMP_APB>;
+			clock-names = "sense", "bus";
+			resets = <&syscrg JH7110_SYSRST_TEMP_CORE>,
+				 <&syscrg JH7110_SYSRST_TEMP_APB>;
+			reset-names = "sense", "bus";
+			#thermal-sensor-cells = <0>;
+		};
+
 		syscrg: clock-controller@13020000 {
 			compatible = "starfive,jh7110-syscrg";
 			reg = <0x0 0x13020000 0x0 0x10000>;
Signature · 1 line
2.38.1
author
#1 lore raw

PATCH 1/3 riscv: dts: starfive: jh7100: Add temperature sensor node and thermal-zones

In reply to Hal Feng

Add temperature sensor and thermal-zones support for the StarFive JH7100 SoC.

---
 arch/riscv/boot/dts/starfive/jh7100.dtsi | 37 ++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
arch/riscv/boot/dts/starfive/jh7100.dtsi +37 -0
index 4218621ea3b9..35ab54fb235f 100644
@@ -80,6 +80,31 @@ core1 {
 		};
 	};
 
+	thermal-zones {
+		cpu-thermal {
+			polling-delay-passive = <250>;
+			polling-delay = <15000>;
+
+			thermal-sensors = <&sfctemp>;
+
+			trips {
+				cpu_alert0 {
+					/* milliCelsius */
+					temperature = <75000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_crit {
+					/* milliCelsius */
+					temperature = <90000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	osc_sys: osc_sys {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
@@ -248,5 +273,17 @@ watchdog@12480000 {
 			resets = <&rstgen JH7100_RSTN_WDTIMER_APB>,
 				 <&rstgen JH7100_RSTN_WDT>;
 		};
+
+		sfctemp: temperature-sensor@124a0000 {
+			compatible = "starfive,jh7100-temp";
+			reg = <0x0 0x124a0000 0x0 0x10000>;
+			clocks = <&clkgen JH7100_CLK_TEMP_SENSE>,
+				 <&clkgen JH7100_CLK_TEMP_APB>;
+			clock-names = "sense", "bus";
+			resets = <&rstgen JH7100_RSTN_TEMP_SENSE>,
+				 <&rstgen JH7100_RSTN_TEMP_APB>;
+			reset-names = "sense", "bus";
+			#thermal-sensor-cells = <0>;
+		};
 	};
 };
Signature · 1 line
2.38.1
maintainer
#4 lore raw

Re: [PATCH v1 3/3] MAINTAINERS: Add Hal as a maintainer of SFCTEMP HWMON DRIVER

In reply to Hal Feng
Quoted 13 lines · Hal Feng

As he is the submitter of this driver, add his mail so he can maintain the driver and easily reply in the mailing list.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index aee340630eca..5056079ade77 100644

MAINTAINERS F: drivers/net/ethernet/sfc/ · line 19262

Quoted 7 lines
MAINTAINERS +1 -0
@@ -19256,6 +19256,7 @@ F:	drivers/net/ethernet/sfc/
 
 SFCTEMP HWMON DRIVER
 M:	Emil Renner Berthing <[email protected]>
+M:	Hal Feng <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml

Whatever about the other patches in this series, this one certainly needs an Ack from Emil.

Thanks,
Conor.

maintainer Applied
#8 lore raw

Re: (subset) [PATCH v1 0/3] riscv: dts: starfive: jh71x0: Add temperature sensor nodes and thermal-zones

In reply to Hal Feng

From: Conor Dooley <[email protected]>

Quoted 8 lines · Hal Feng

These patches add temperature sensor nodes and thermal-zones for the StarFive JH71X0 SoC. I have tested them on the BeagleV Starlight board and StarFive VisionFive 1 / 2 board. Thanks.

Best regards,
Hal

[...]

Applied to riscv-dt-for-next, thanks!

[1/3] riscv: dts: starfive: jh7100: Add temperature sensor node and thermal-zones

      https://git.kernel.org/conor/c/0417c587420f
[2/3] riscv: dts: starfive: jh7110: Add temperature sensor node and thermal-zones
      https://git.kernel.org/conor/c/54ab0b6b85d4

Thanks,
Conor.

author
#5 lore raw

Re: [PATCH v1 3/3] MAINTAINERS: Add Hal as a maintainer of SFCTEMP HWMON DRIVER

In reply to Conor Dooley
Quoted 15 lines · Conor Dooley
Quoted 14 lines · Hal Feng

As he is the submitter of this driver, add his mail so he can maintain the driver and easily reply in the mailing list.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index aee340630eca..5056079ade77 100644
@@ -19256,6 +19256,7 @@ F:	drivers/net/ethernet/sfc/
 
Quoted 9 lines

MAINTAINERS F: drivers/net/ethernet/sfc/ · line 19262

Quoted 6 lines
MAINTAINERS +1 -0
 SFCTEMP HWMON DRIVER
 M:	Emil Renner Berthing <[email protected]>
+M:	Hal Feng <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml

Whatever about the other patches in this series, this one certainly needs an Ack from Emil.

Hi @Emil,

Would you mind adding me as one of the maintainers of this driver? Within StarFive, I was appointed to maintain this driver.

Best regards,
Hal

#6 lore raw

Re: [PATCH v1 3/3] MAINTAINERS: Add Hal as a maintainer of SFCTEMP HWMON DRIVER

Quoted 26 lines · Hal Feng
Quoted 15 lines · Conor Dooley
Quoted 14 lines · Hal Feng

As he is the submitter of this driver, add his mail so he can maintain the driver and easily reply in the mailing list.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index aee340630eca..5056079ade77 100644
@@ -19256,6 +19256,7 @@ F:   drivers/net/ethernet/sfc/
 
Quoted 9 lines

MAINTAINERS F: drivers/net/ethernet/sfc/ · line 19262

Quoted 6 lines
MAINTAINERS +1 -0
 SFCTEMP HWMON DRIVER
 M:  Emil Renner Berthing <[email protected]>
+M:  Hal Feng <[email protected]>
 L:  [email protected]
 S:  Maintained
 F:  Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml

Whatever about the other patches in this series, this one certainly needs an Ack from Emil.

Quoted 4 lines

Hi @Emil,

Would you mind adding me as one of the maintainers of this driver? Within StarFive, I was appointed to maintain this driver.

Hey, sorry about the late reply. That's absolutely fine by me.

/Emil

Quoted 2 lines

Best regards,
Hal

Acked-by on v1 3/3
#7 lore raw

Re: [PATCH v1 3/3] MAINTAINERS: Add Hal as a maintainer of SFCTEMP HWMON DRIVER

In reply to Hal Feng
Quoted 3 lines · Hal Feng

As he is the submitter of this driver, add his mail so he can maintain the driver and easily reply in the mailing list.

Quoted 18 lines
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -1
index aee340630eca..5056079ade77 100644
@@ -19256,6 +19256,7 @@ F:      drivers/net/ethernet/sfc/
 
 SFCTEMP HWMON DRIVER
 M:     Emil Renner Berthing <[email protected]>
+M:     Hal Feng <[email protected]>
 L:     [email protected]
 S:     Maintained
 F:     Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml
--
Quoted 2 lines

2.38.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv