Skip to contentSkip to conversation

thermal: broadcom: Add NSP Thermal Support

PATCH Applied Jon Mason 3 participants 10 messages Apr 28, 2017 – May 29, 2017

Subsystems (6)
lore
Share & tools
lore

Jon Mason

author
#0 lore raw

v3 cover thermal: broadcom: Add NSP Thermal Support

Changes in v3:
* Enable THERMAL on NSP, not all iProc Chips (per Scott Branden)
* Correct the Kconfig syntax in patch 2 (per Eduardo Valentin)

Changes in v2:
* Split SoC enablement into a separate patch (per Eduardo Valentin)
* Added Eduardo Valentin's Acked-by to the DTS patch

This adds support for NSP to the existing Northstar thermal driver. This code is based on patches currently in the Linux SoC Thermal git tree. Specfically,
https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git/commit/?h=linus&id=a94cb7eeecc4104a6874339f90c5d0647359c102

Jon Mason (3):
ARM: BCM: Enable thermal support for NSP SoCs
thermal: broadcom: ns-thermal: default on iProc SoCs
ARM: dts: NSP: Add Thermal Support

 arch/arm/boot/dts/bcm-nsp.dtsi   | 26 ++++++++++++++++++++++++++
 arch/arm/mach-bcm/Kconfig        |  2 ++
 drivers/thermal/broadcom/Kconfig |  9 +++++----
 3 files changed, 33 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v3 1/3 ARM: BCM: Enable thermal support for NSP SoCs

Change the Northstar Plus Kconfig to select THERMAL and THERMAL_OF, which allows the ns-thermal driver to be selected via menuconfig.

---
 arch/arm/mach-bcm/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-bcm/Kconfig +2 -0
index a0e66d8..93a61d0 100644
@@ -44,6 +44,8 @@ config ARCH_BCM_NSP
 	select ARM_ERRATA_775420
 	select ARM_ERRATA_764369 if SMP
 	select HAVE_SMP
+	select THERMAL
+	select THERMAL_OF
 	help
 	  Support for Broadcom Northstar Plus SoC.
 	  Broadcom Northstar Plus family of SoCs are used for switching control
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH v3 1/3] ARM: BCM: Enable thermal support for NSP SoCs

Quoted 4 lines · Jon Mason

Change the Northstar Plus Kconfig to select THERMAL and THERMAL_OF, which allows the ns-thermal driver to be selected via menuconfig.

Applied, thanks Jon

Signature · 1 line
Florian
author
#3 lore raw

PATCH v3 2/3 thermal: broadcom: ns-thermal: default on iProc SoCs

In reply to Jon Mason

Tweak the Kconfig description to mention support for NSP and make the default on for iProc based platforms.

---
 drivers/thermal/broadcom/Kconfig | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/thermal/broadcom/Kconfig +5 -4
index f0dea8a..b6f4b85 100644
@@ -1,8 +1,9 @@
 config BCM_NS_THERMAL
 	tristate "Northstar thermal driver"
 	depends on ARCH_BCM_IPROC || COMPILE_TEST
+	default y if ARCH_BCM_IPROC
 	help
-	  Northstar is a family of SoCs that includes e.g. BCM4708, BCM47081,
-	  BCM4709 and BCM47094. It contains DMU (Device Management Unit) block
-	  with a thermal sensor that allows checking CPU temperature. This
-	  driver provides support for it.
+	  Support for the Northstar and Northstar Plus family of SoCs (e.g.
+	  BCM4708, BCM4709, BCM5301x, BCM95852X, etc). It contains DMU (Device
+	  Management Unit) block with a thermal sensor that allows checking CPU
+	  temperature.
Signature · 1 line
2.7.4
#4 lore raw

Re: [PATCH v3 2/3] thermal: broadcom: ns-thermal: default on iProc SoCs

Quoted 13 lines · Jon Mason

Tweak the Kconfig description to mention support for NSP and make the default on for iProc based platforms.

---
 drivers/thermal/broadcom/Kconfig | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/thermal/broadcom/Kconfig +0 -0
index f0dea8a..b6f4b85 100644

drivers/thermal/broadcom/Kconfig line 3

Quoted 3 lines
drivers/thermal/broadcom/Kconfig +0 -0
@@ -1,8 +1,9 @@
 config BCM_NS_THERMAL
 	tristate "Northstar thermal driver"
 	depends on ARCH_BCM_IPROC || COMPILE_TEST

If this driver is used on these SoCs then it:
depends on ARCH_BCM_NSP || ARCH_BCM_5301X || COMPILE_TEST ?

Quoted 11 lines
drivers/thermal/broadcom/Kconfig +5 -4
+	default y if ARCH_BCM_IPROC
 	help
-	  Northstar is a family of SoCs that includes e.g. BCM4708, BCM47081,
-	  BCM4709 and BCM47094. It contains DMU (Device Management Unit) block
-	  with a thermal sensor that allows checking CPU temperature. This
-	  driver provides support for it.
+	  Support for the Northstar and Northstar Plus family of SoCs (e.g.
+	  BCM4708, BCM4709, BCM5301x, BCM95852X, etc). It contains DMU (Device
+	  Management Unit) block with a thermal sensor that allows checking CPU
+	  temperature.
author
#5 lore raw

Re: [PATCH v3 2/3] thermal: broadcom: ns-thermal: default on iProc SoCs

Quoted 12 lines · Scott Branden
Quoted 9 lines · Jon Mason

Tweak the Kconfig description to mention support for NSP and make the default on for iProc based platforms.

---
 drivers/thermal/broadcom/Kconfig | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Quoted 13 lines

drivers/thermal/broadcom/Kconfig line 3

Quoted 9 lines
drivers/thermal/broadcom/Kconfig +0 -0
index f0dea8a..b6f4b85 100644
@@ -1,8 +1,9 @@
 config BCM_NS_THERMAL
        tristate "Northstar thermal driver"
        depends on ARCH_BCM_IPROC || COMPILE_TEST

If this driver is used on these SoCs then it:
depends on ARCH_BCM_NSP || ARCH_BCM_5301X || COMPILE_TEST ?

The code referenced is outside of this patch, as that code was already existing from when the driver was submitted.

I did some checking and NS2 and Cygnus do not have the registers in use by this driver. So, you are correct in that this driver will never be used for them. So, this is slightly over-permissive in allowing a driver to be selected that could not ever be used on non-NS/NSP hardware. But barring an incorrect DT string, it would only result in an slightly larger kernel than necessary.

I'll do a follow-on patch to correct this with your suggestion above, and push it separately (unless a v4 is needed on this series).

Thanks,
Jon

Quoted 17 lines
Quoted 16 lines
drivers/thermal/broadcom/Kconfig +1 -2
+       default y if ARCH_BCM_IPROC
        help
-         Northstar is a family of SoCs that includes e.g. BCM4708,
 BCM47081,
-         BCM4709 and BCM47094. It contains DMU (Device Management Unit)

block

drivers/thermal/broadcom/Kconfig +1 -2
-         with a thermal sensor that allows checking CPU temperature. This
-         driver provides support for it.
+         Support for the Northstar and Northstar Plus family of SoCs

(e.g.
+ BCM4708, BCM4709, BCM5301x, BCM95852X, etc). It contains DMU
(Device
+ Management Unit) block with a thermal sensor that allows
checking CPU
+ temperature.

#6 lore raw

Re: [PATCH v3 2/3] thermal: broadcom: ns-thermal: default on iProc SoCs

Hi Jon,

Quoted 34 lines · Jon Mason
Quoted 10 lines · Scott Branden
Quoted 8 lines · Jon Mason

Tweak the Kconfig description to mention support for NSP and make the default on for iProc based platforms.

---
  drivers/thermal/broadcom/Kconfig | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
Quoted 12 lines

drivers/thermal/broadcom/Kconfig line 3

Quoted 9 lines
drivers/thermal/broadcom/Kconfig +0 -0
index f0dea8a..b6f4b85 100644
@@ -1,8 +1,9 @@
  config BCM_NS_THERMAL
         tristate "Northstar thermal driver"
         depends on ARCH_BCM_IPROC || COMPILE_TEST

If this driver is used on these SoCs then it:
depends on ARCH_BCM_NSP || ARCH_BCM_5301X || COMPILE_TEST ?

The code referenced is outside of this patch, as that code was already existing from when the driver was submitted.

I did some checking and NS2 and Cygnus do not have the registers in use by this driver. So, you are correct in that this driver will never be used for them. So, this is slightly over-permissive in allowing a driver to be selected that could not ever be used on non-NS/NSP hardware. But barring an incorrect DT string, it would only result in an slightly larger kernel than necessary.

Quoted 2 lines

I'll do a follow-on patch to correct this with your suggestion above, and push it separately (unless a v4 is needed on this series).

Please submit the follow on patch.

Quoted 3 lines

Thanks,
Jon

Thanks,
Scott

#7 lore raw

Re: [PATCH v3 2/3] thermal: broadcom: ns-thermal: default on iProc SoCs

In reply to Jon Mason
Quoted 4 lines · Jon Mason

Tweak the Kconfig description to mention support for NSP and make the default on for iProc based platforms.

Zhang, Eduardo, please apply, the Kconfig and DTS changes have been queued for 4.13 in my ARM-SoC pull request for Broadcom SoCs.

Thanks!
--
Florian

author
#8 lore raw

PATCH v3 3/3 ARM: dts: NSP: Add Thermal Support

In reply to Jon Mason

Add thermal support via the ns-thermal driver and create a single thermal zone for the entire SoC.

---
 arch/arm/boot/dts/bcm-nsp.dtsi | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
arch/arm/boot/dts/bcm-nsp.dtsi +26 -0
index 832795b..be6fcfb 100644
@@ -383,6 +383,12 @@
 			      <0x3f408 0x04>;
 		};
 
+		thermal: thermal at 3f2c0 {
+			compatible = "brcm,ns-thermal";
+			reg = <0x3f2c0 0x10>;
+			#thermal-sensor-cells = <0>;
+		};
+
 		sata_phy: sata_phy at 40100 {
 			compatible = "brcm,iproc-nsp-sata-phy";
 			reg = <0x40100 0x340>;
@@ -533,4 +539,24 @@
 			brcm,pcie-msi-inten;
 		};
 	};
+
+	thermal-zones {
+		cpu-thermal {
+			polling-delay-passive = <0>;
+			polling-delay = <1000>;
+			coefficients = <(-556) 418000>;
+			thermal-sensors = <&thermal>;
+
+			trips {
+				cpu-crit {
+					temperature     = <125000>;
+					hysteresis      = <0>;
+					type            = "critical";
+				};
+			};
+
+			cooling-maps {
+			};
+		};
+	};
 };
Signature · 1 line
2.7.4