Skip to contentSkip to conversation

thermal: broadcom: Add NSP Thermal Support

PATCH Superseded Jon Mason 2 participants 8 messages Apr 25, 2017 – Apr 28, 2017

Subsystems (6)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jon Mason

author
#0 lore raw

cover thermal: broadcom: Add NSP Thermal Support

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 (2):
thermal: broadcom: Allow for NSP to use ns-thermal driver
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 1/2 thermal: broadcom: Allow for NSP to use ns-thermal driver

Change the iProc Kconfig to select THERMAL and THERMAL_OF, which allows the ns-thermal driver to be selected via menuconfig. Also, change the ns-thermal driver to work on any iProc based SoC. Finally, tweak the Kconfig description to mention support for NSP and make the default on for iProc based platforms.

---
 arch/arm/mach-bcm/Kconfig        | 2 ++
 drivers/thermal/broadcom/Kconfig | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/mach-bcm/Kconfig +2 -0
index a0e66d8..da2bfeb 100644
@@ -19,6 +19,8 @@ config ARCH_BCM_IPROC
 	select GPIOLIB
 	select ARM_AMBA
 	select PINCTRL
+	select THERMAL
+	select THERMAL_OF
 	help
 	  This enables support for systems based on Broadcom IPROC architected SoCs.
 	  The IPROC complex contains one or more ARM CPUs along with common
drivers/thermal/broadcom/Kconfig +5 -4
index f0dea8a..26d706c 100644
@@ -1,8 +1,9 @@
 config BCM_NS_THERMAL
 	tristate "Northstar thermal driver"
 	depends on ARCH_BCM_IPROC || COMPILE_TEST
+	default 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
#2 lore raw

Re: [PATCH 1/2] thermal: broadcom: Allow for NSP to use ns-thermal driver

Hey Jason,

Quoted 5 lines · Jon Mason

Change the iProc Kconfig to select THERMAL and THERMAL_OF, which allows the ns-thermal driver to be selected via menuconfig. Also, change the ns-thermal driver to work on any iProc based SoC. Finally, tweak the Kconfig description to mention support for NSP and make the default on for iProc based platforms.

Thanks for the patch, but..

Quoted 12 lines
---
 arch/arm/mach-bcm/Kconfig        | 2 ++
 drivers/thermal/broadcom/Kconfig | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/mach-bcm/Kconfig +0 -0
index a0e66d8..da2bfeb 100644

arch/arm/mach-bcm/Kconfig config ARCH_BCM_IPROC · line 26

Quoted 8 lines
arch/arm/mach-bcm/Kconfig +2 -0
@@ -19,6 +19,8 @@ config ARCH_BCM_IPROC
 	select GPIOLIB
 	select ARM_AMBA
 	select PINCTRL
+	select THERMAL
+	select THERMAL_OF
 	help
 	  This enables support for systems based on Broadcom IPROC architected SoCs.
 	  The IPROC complex contains one or more ARM CPUs along with common

It would be better if this is split and sent through your arch tree, to avoid conflicts. I could also pick it if you get an ack from one of your maintainers. Still, first option is preferable.

drivers/thermal/broadcom/Kconfig line 4

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

Not sure if this is really what you wanted. Based on your commit log message, you meant the following, perhaps?

+ default y if ARCH_BCM_IPROC

drivers/thermal/broadcom/Kconfig line 7

Quoted 7 lines
drivers/thermal/broadcom/Kconfig +2 -4
 	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

Did we look BCM47094 somehow on this patch?

Quoted 5 lines
drivers/thermal/broadcom/Kconfig +2 -0
+	  Management Unit) block with a thermal sensor that allows checking CPU
+	  temperature.
Signature · 1 line
2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170427/c74ae1b8/attachment.sig>

author
#3 lore raw

Re: [PATCH 1/2] thermal: broadcom: Allow for NSP to use ns-thermal driver

Quoted 1 line · Eduardo Valentin

Hey Jason,

It's Jon :)

Quoted 26 lines · Jon Mason
Quoted 5 lines

Change the iProc Kconfig to select THERMAL and THERMAL_OF, which allows the ns-thermal driver to be selected via menuconfig. Also, change the ns-thermal driver to work on any iProc based SoC. Finally, tweak the Kconfig description to mention support for NSP and make the default on for iProc based platforms.

Thanks for the patch, but..

Quoted 16 lines
---
 arch/arm/mach-bcm/Kconfig        | 2 ++
 drivers/thermal/broadcom/Kconfig | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/mach-bcm/Kconfig +1 -0
index a0e66d8..da2bfeb 100644
@@ -19,6 +19,8 @@ config ARCH_BCM_IPROC
      select GPIOLIB
      select ARM_AMBA
      select PINCTRL
+     select THERMAL
Quoted 8 lines

arch/arm/mach-bcm/Kconfig config ARCH_BCM_IPROC · line 26

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +1 -0
+     select THERMAL_OF
      help
        This enables support for systems based on Broadcom IPROC architected SoCs.
        The IPROC complex contains one or more ARM CPUs along with common

It would be better if this is split and sent through your arch tree, to avoid conflicts. I could also pick it if you get an ack from one of your maintainers. Still, first option is preferable.

Sure, I'll be happy to split this off. I should've thought to split it up before sending. Thanks for the suggestion.

Quoted 14 lines

drivers/thermal/broadcom/Kconfig line 4

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

Not sure if this is really what you wanted. Based on your commit log message, you meant the following, perhaps?

Quoted 1 line

+ default y if ARCH_BCM_IPROC

IIUC, my original default works, as we have used it frequently in other places in the kernel.
grep -rI "default ARCH_BCM_IPROC" * | wc -l
15

However, if the above is preferred (or the other 15 massively broken), I'll be happy to do it that way.

Quoted 9 lines

drivers/thermal/broadcom/Kconfig line 7

Quoted 7 lines
drivers/thermal/broadcom/Kconfig +2 -4
      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

Did we look BCM47094 somehow on this patch?

Naa, just trying to be more concise, while adding the NSP products to the list.. BCM47094 is a type of BCM4709. So, it is still there :)

Quoted 6 lines
Quoted 6 lines
drivers/thermal/broadcom/Kconfig +2 -1
+       Management Unit) block with a thermal sensor that allows checking CPU
+       temperature.
--

2.7.4

#4 lore raw

Re: [PATCH 1/2] thermal: broadcom: Allow for NSP to use ns-thermal driver

Quoted 4 lines · Jon Mason
Quoted 1 line · Eduardo Valentin

Hey Jason,

It's Jon :)

Apologies. I think I either read too fast, or my fingers were faster than my brain. Sorry.

Quoted 36 lines
Quoted 27 lines · Jon Mason
Quoted 5 lines

Change the iProc Kconfig to select THERMAL and THERMAL_OF, which allows the ns-thermal driver to be selected via menuconfig. Also, change the ns-thermal driver to work on any iProc based SoC. Finally, tweak the Kconfig description to mention support for NSP and make the default on for iProc based platforms.

Thanks for the patch, but..

Quoted 16 lines
---
 arch/arm/mach-bcm/Kconfig        | 2 ++
 drivers/thermal/broadcom/Kconfig | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/mach-bcm/Kconfig +1 -0
index a0e66d8..da2bfeb 100644
@@ -19,6 +19,8 @@ config ARCH_BCM_IPROC
      select GPIOLIB
      select ARM_AMBA
      select PINCTRL
+     select THERMAL
Quoted 8 lines

arch/arm/mach-bcm/Kconfig config ARCH_BCM_IPROC · line 26

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +1 -0
+     select THERMAL_OF
      help
        This enables support for systems based on Broadcom IPROC architected SoCs.
        The IPROC complex contains one or more ARM CPUs along with common

It would be better if this is split and sent through your arch tree, to avoid conflicts. I could also pick it if you get an ack from one of your maintainers. Still, first option is preferable.

Quoted 2 lines

Sure, I'll be happy to split this off. I should've thought to split it up before sending. Thanks for the suggestion.

Cool!

Quoted 15 lines
Quoted 15 lines

drivers/thermal/broadcom/Kconfig line 4

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

Not sure if this is really what you wanted. Based on your commit log message, you meant the following, perhaps?

Quoted 6 lines
Quoted 1 line

+ default y if ARCH_BCM_IPROC

IIUC, my original default works, as we have used it frequently in other places in the kernel.
grep -rI "default ARCH_BCM_IPROC" * | wc -l
15

Yeah... Are you sure they are all correct?

Quoted 3 lines

However, if the above is preferred (or the other 15 massively broken), I'll be happy to do it that way.

Your construction is syntactically correct. Maybe might still work (did not check myself) for the purpose you describe, but the construction mentioned in Documentation/kbuild/kconfig-language.txt is:
+ default y if BAR

So, please fix it.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
drivers/thermal/broadcom/Kconfig +2 -4
      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
Quoted 11 lines
Quoted 1 line

Did we look BCM47094 somehow on this patch?

Naa, just trying to be more concise, while adding the NSP products to the list.. BCM47094 is a type of BCM4709. So, it is still there :)

Quoted 6 lines
Quoted 6 lines
drivers/thermal/broadcom/Kconfig +2 -1
+       Management Unit) block with a thermal sensor that allows checking CPU
+       temperature.
--

2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170428/b46e5a16/attachment.sig>

author
#5 lore raw

Re: [PATCH 1/2] thermal: broadcom: Allow for NSP to use ns-thermal driver

Quoted 8 lines · Eduardo Valentin
Quoted 4 lines · Jon Mason
Quoted 1 line · Eduardo Valentin

Hey Jason,

It's Jon :)

Apologies. I think I either read too fast, or my fingers were faster than my brain. Sorry.

NP, That exact error happens more frequently that you would think :)

Quoted 69 lines
Quoted 36 lines
Quoted 27 lines · Jon Mason
Quoted 5 lines

Change the iProc Kconfig to select THERMAL and THERMAL_OF, which allows the ns-thermal driver to be selected via menuconfig. Also, change the ns-thermal driver to work on any iProc based SoC. Finally, tweak the Kconfig description to mention support for NSP and make the default on for iProc based platforms.

Thanks for the patch, but..

Quoted 16 lines
---
 arch/arm/mach-bcm/Kconfig        | 2 ++
 drivers/thermal/broadcom/Kconfig | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/mach-bcm/Kconfig +1 -0
index a0e66d8..da2bfeb 100644
@@ -19,6 +19,8 @@ config ARCH_BCM_IPROC
      select GPIOLIB
      select ARM_AMBA
      select PINCTRL
+     select THERMAL
Quoted 8 lines

arch/arm/mach-bcm/Kconfig config ARCH_BCM_IPROC · line 26

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +1 -0
+     select THERMAL_OF
      help
        This enables support for systems based on Broadcom IPROC architected SoCs.
        The IPROC complex contains one or more ARM CPUs along with common

It would be better if this is split and sent through your arch tree, to avoid conflicts. I could also pick it if you get an ack from one of your maintainers. Still, first option is preferable.

Quoted 2 lines

Sure, I'll be happy to split this off. I should've thought to split it up before sending. Thanks for the suggestion.

Cool!

Quoted 15 lines
Quoted 15 lines

drivers/thermal/broadcom/Kconfig line 4

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

Not sure if this is really what you wanted. Based on your commit log message, you meant the following, perhaps?

Quoted 6 lines
Quoted 1 line

+ default y if ARCH_BCM_IPROC

IIUC, my original default works, as we have used it frequently in other places in the kernel.
grep -rI "default ARCH_BCM_IPROC" * | wc -l
15

Yeah... Are you sure they are all correct?

Quoted 3 lines

However, if the above is preferred (or the other 15 massively broken), I'll be happy to do it that way.

Quoted 6 lines

Your construction is syntactically correct. Maybe might still work (did not check myself) for the purpose you describe, but the construction mentioned in Documentation/kbuild/kconfig-language.txt is:
+ default y if BAR

So, please fix it.

Oh, thanks for the info. I was unaware of this, and we should definitely follow the documentation.. I'll make the relevant changes and do follow-on patches to correct the other places.

Quoted 22 lines
Quoted 22 lines
Quoted 11 lines

drivers/thermal/broadcom/Kconfig line 7

Quoted 10 lines
drivers/thermal/broadcom/Kconfig +2 -4
      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
Quoted 1 line

Did we look BCM47094 somehow on this patch?

Naa, just trying to be more concise, while adding the NSP products to the list.. BCM47094 is a type of BCM4709. So, it is still there :)

Quoted 6 lines
Quoted 6 lines
drivers/thermal/broadcom/Kconfig +2 -1
+       Management Unit) block with a thermal sensor that allows checking CPU
+       temperature.
--

2.7.4

author
#6 lore raw

PATCH 2/2 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
Acked-by on v1 2/2
#7 lore raw

Re: [PATCH 2/2] ARM: dts: NSP: Add Thermal Support

Quoted 4 lines · Jon Mason

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

Quoted 49 lines
---
 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170427/0f0f5b1a/attachment.sig>