Skip to contentSkip to conversation

thermal: k3_j72xx_bandgap: Add the bandgap driver support

PATCH Superseded Keerthy 4 participants 9 messages Oct 4, 2021 – Oct 6, 2021

Subsystems (3)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Keerthy

author
#0 lore raw

cover thermal: k3_j72xx_bandgap: Add the bandgap driver support

Add VTM thermal support. In the Voltage Thermal Management Module(VTM), K3 J72XX supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

Currently reading temperatures only is supported. There are no active/passive cooling agent supported.

J721e SoCs have errata i2128: https://www.ti.com/lit/pdf/sprz455

The series also incorporates workaround for Errata i2128.

Keerthy (4):
dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation
arm64: dts: ti: j721e: Add VTM node
arm64: dts: ti: j7200: Add VTM node
thermal: k3_j72xx_bandgap: Add the bandgap driver support

 .../bindings/thermal/ti,j72xx-thermal.yaml    |  58 ++
 .../boot/dts/ti/k3-j7200-mcu-wakeup.dtsi      |   9 +
 arch/arm64/boot/dts/ti/k3-j7200-thermal.dtsi  |  45 +
 arch/arm64/boot/dts/ti/k3-j7200.dtsi          |   4 +
 .../boot/dts/ti/k3-j721e-mcu-wakeup.dtsi      |   9 +
 arch/arm64/boot/dts/ti/k3-j721e-thermal.dtsi  |  73 ++
 arch/arm64/boot/dts/ti/k3-j721e.dtsi          |   4 +
 drivers/thermal/Makefile                      |   2 +-
 drivers/thermal/k3_j72xx_bandgap.c            | 773 ++++++++++++++++++
 9 files changed, 976 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
 create mode 100644 arch/arm64/boot/dts/ti/k3-j7200-thermal.dtsi
 create mode 100644 arch/arm64/boot/dts/ti/k3-j721e-thermal.dtsi
 create mode 100644 drivers/thermal/k3_j72xx_bandgap.c
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/4 dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 J72XX supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

---
 .../bindings/thermal/ti,j72xx-thermal.yaml    | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml new file +58 -0
new file mode 100644
index 000000000000..ccf1bd3640ee
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/ti,j72xx-thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments J72XX VTM (DTS) binding
+
+maintainers:
+  - Keerthy <[email protected]>
+
+properties:
+  compatible:
+    const: ti,j721e-vtm
+
+  reg:
+    maxItems: 3
+
+  power-domains:
+    maxItems: 1
+
+  "#thermal-sensor-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - power-domains
+  - "#thermal-sensor-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/ti,sci_pm_domain.h>
+    wkup_vtm0: wkup_vtm0@42040000 {
+        compatible = "ti,j721e-vtm", "ti,j7200-vtm";
+        reg = <0x0 0x42040000 0x0 0x350>,
+            <0x0 0x42050000 0x0 0x350>,
+            <0x0 0x43000300 0x0 0x10>;
+        power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>;
+        #thermal-sensor-cells = <1>;
+    };
+
+    mpu_thermal: mpu_thermal {
+        polling-delay-passive = <250>; /* milliseconds */
+        polling-delay = <500>; /* milliseconds */
+        thermal-sensors = <&wkup_vtm0 0>;
+
+        trips {
+                mpu_crit: mpu_crit {
+                        temperature = <125000>; /* milliCelsius */
+                        hysteresis = <2000>; /* milliCelsius */
+                        type = "critical";
+                };
+        };
+    };
+...
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH 1/4] dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation

Quoted 9 lines · Keerthy

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 J72XX supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

Quoted 6 lines
---
 .../bindings/thermal/ti,j72xx-thermal.yaml    | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.example.dt.yaml: example-0: wkup_vtm0@42040000:reg:0: [0, 1107558400, 0, 848] is too long
From schema: /usr/local/lib/python3.8/dist-packages/dtschema/schemas/reg.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.example.dt.yaml: example-0: wkup_vtm0@42040000:reg:1: [0, 1107623936, 0, 848] is too long
From schema: /usr/local/lib/python3.8/dist-packages/dtschema/schemas/reg.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.example.dt.yaml: example-0: wkup_vtm0@42040000:reg:2: [0, 1124074240, 0, 16] is too long
From schema: /usr/local/lib/python3.8/dist-packages/dtschema/schemas/reg.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.example.dt.yaml: wkup_vtm0@42040000: compatible: ['ti,j721e-vtm', 'ti,j7200-vtm'] is too long
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.example.dt.yaml: wkup_vtm0@42040000: compatible: Additional items are not allowed ('ti,j7200-vtm' was unexpected)
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.example.dt.yaml:0:0: /example-0/wkup_vtm0@42040000: failed to match any schema with compatible: ['ti,j721e-vtm', 'ti,j7200-vtm']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1536069

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

#3 lore raw

Re: [PATCH 1/4] dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation

Quoted 18 lines · Rob Herring
Quoted 9 lines · Keerthy

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 J72XX supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

Quoted 6 lines
---
 .../bindings/thermal/ti,j72xx-thermal.yaml    | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
Quoted 2 lines

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

Woot, TI has blacklisted me:

The response from the remote server was:
553 Sorry, your email address has been blacklisted. Please contact Texas Instruments Inc to have yourself removed.

#4 lore raw

Re: [PATCH 1/4] dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation

Keerthy,

did you receive this answer ?

Quoted 28 lines · Rob Herring
Quoted 18 lines · Rob Herring
Quoted 9 lines · Keerthy

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 J72XX supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

Quoted 6 lines
---
 .../bindings/thermal/ti,j72xx-thermal.yaml    | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
Quoted 2 lines

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

Woot, TI has blacklisted me:

The response from the remote server was:
553 Sorry, your email address has been blacklisted. Please contact Texas Instruments Inc to have yourself removed.

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
author
#5 lore raw

Re: [PATCH 1/4] dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation

Quoted 4 lines · Daniel Lezcano

Keerthy,

did you receive this answer ?

Daniel,

Thanks for sending this. I did not receive Rob's responses.

Rob,

Apologies. I will get this rectified before i send the V2 with the reported issue fixed. It seems issue with my particular e-mail account.

Apologies for the inconvenience once again!

Best Regards,
Keerthy

Quoted 33 lines · Rob Herring
Quoted 28 lines · Rob Herring
Quoted 18 lines · Keerthy
Quoted 9 lines

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 J72XX supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

Quoted 6 lines
---
  .../bindings/thermal/ti,j72xx-thermal.yaml    | 58 +++++++++++++++++++
  1 file changed, 58 insertions(+)

create mode 100644 Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml

Quoted 2 lines

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

Woot, TI has blacklisted me:

The response from the remote server was:
553 Sorry, your email address has been blacklisted. Please contact Texas Instruments Inc to have yourself removed.

author
#6 lore raw

PATCH 2/4 arm64: dts: ti: j721e: Add VTM node

In reply to Keerthy

VTM stands for Voltage Thermal Management

---
 .../boot/dts/ti/k3-j721e-mcu-wakeup.dtsi      |  9 +++
 arch/arm64/boot/dts/ti/k3-j721e-thermal.dtsi  | 73 +++++++++++++++++++
 arch/arm64/boot/dts/ti/k3-j721e.dtsi          |  4 +
 3 files changed, 86 insertions(+)
 create mode 100644 arch/arm64/boot/dts/ti/k3-j721e-thermal.dtsi
arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi +9 -0
index d2dceda72fe9..fafc07848f86 100644
@@ -390,4 +390,13 @@
 			ti,loczrama = <1>;
 		};
 	};
+
+	wkup_vtm0: wkup_vtm0@42040000 {
+		compatible = "ti,j721e-vtm";
+		reg = <0x0 0x42040000 0x0 0x350>,
+			<0x0 0x42050000 0x0 0x350>,
+			<0x0 0x43000300 0x0 0x10>;
+		power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>;
+		#thermal-sensor-cells = <1>;
+	};
 };
arch/arm64/boot/dts/ti/k3-j721e-thermal.dtsi new file +73 -0

73 lines not on this page · raw message

arch/arm64/boot/dts/ti/k3-j721e.dtsi +4 -0
index f0587fde147e..20e26a359aaf 100644
@@ -177,6 +177,10 @@
 				 <0x07 0x00000000 0x07 0x00000000 0x01 0x00000000>; /* FSS OSPI1 data region 3*/
 		};
 	};
+
+	thermal_zones: thermal-zones {
+		#include "k3-j721e-thermal.dtsi"
+	};
 };
 
 /* Now include the peripherals for each bus segments */
Signature · 1 line
2.17.1
author
#7 lore raw

PATCH 3/4 arm64: dts: ti: j7200: Add VTM node

In reply to Keerthy

VTM stands for Voltage Thermal Management

---
 .../boot/dts/ti/k3-j7200-mcu-wakeup.dtsi      |  9 ++++
 arch/arm64/boot/dts/ti/k3-j7200-thermal.dtsi  | 45 +++++++++++++++++++
 arch/arm64/boot/dts/ti/k3-j7200.dtsi          |  4 ++
 3 files changed, 58 insertions(+)
 create mode 100644 arch/arm64/boot/dts/ti/k3-j7200-thermal.dtsi
arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi +9 -0
index 1044ec6c4b0d..2b5c570253cc 100644
@@ -375,4 +375,13 @@
 			ti,loczrama = <1>;
 		};
 	};
+
+	wkup_vtm0: wkup_vtm0@42040000 {
+		compatible = "ti,j7200-vtm";
+		reg = <0x0 0x42040000 0x0 0x350>,
+			<0x0 0x42050000 0x0 0x350>,
+			<0x0 0x43000300 0x0 0x10>;
+		power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>;
+		#thermal-sensor-cells = <1>;
+	};
 };
arch/arm64/boot/dts/ti/k3-j7200-thermal.dtsi new file +45 -0

45 lines not on this page · raw message

arch/arm64/boot/dts/ti/k3-j7200.dtsi +4 -0
index b7005b803149..649d1d60f5c7 100644
@@ -165,6 +165,10 @@
 				 <0x07 0x00000000 0x07 0x00000000 0x01 0x00000000>; /* FSS OSPI1 data region 3 */
 		};
 	};
+
+	thermal_zones: thermal-zones {
+		#include "k3-j7200-thermal.dtsi"
+	};
 };
 
 /* Now include the peripherals for each bus segments */
Signature · 1 line
2.17.1
author
#8 lore raw

PATCH 4/4 thermal: k3_j72xx_bandgap: Add the bandgap driver support

In reply to Keerthy

Add VTM thermal support. In the Voltage Thermal Management Module(VTM), K3 J72XX supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

Currently reading temperatures only is supported. There are no active/passive cooling agent supported.

J721e SoCs have errata i2128: https://www.ti.com/lit/pdf/sprz455

The VTM Temperature Monitors (TEMPSENSORs) are trimmed during production, with the resulting values stored in software-readable registers. Software should use these register values when translating the Temperature Monitor output codes to temperature values.

It has an involved workaround. Software needs to read the error codes for -40C, 30C, 125C from the efuse for each device & derive a new look up table for adc to temperature conversion. Involved calculating slopes & constants using 3 different straight line equations with adc refernce codes as the y-axis & error codes in the x-axis.

-40C to 30C
30C to 125C
125C to 150C

With the above 2 line equations we derive the full look-up table to workaround the errata i2128 for j721e SoC.

Tested temperature reading on J721e SoC & J7200 SoC.

---
 drivers/thermal/Makefile           |   2 +-
 drivers/thermal/k3_j72xx_bandgap.c | 772 +++++++++++++++++++++++++++++
 2 files changed, 773 insertions(+), 1 deletion(-)
 create mode 100644 drivers/thermal/k3_j72xx_bandgap.c
drivers/thermal/Makefile +1 -1
index 82fc3e616e54..6dcaf2028ddc 100644
@@ -28,7 +28,7 @@ thermal_sys-$(CONFIG_CPU_IDLE_THERMAL)	+= cpuidle_cooling.o
 # devfreq cooling
 thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
 
-obj-$(CONFIG_K3_THERMAL)	+= k3_bandgap.o
+obj-$(CONFIG_K3_THERMAL)	+= k3_bandgap.o k3_j72xx_bandgap.o
 # platform thermal drivers
 obj-y				+= broadcom/
 obj-$(CONFIG_THERMAL_MMIO)		+= thermal_mmio.o
drivers/thermal/k3_j72xx_bandgap.c new file +772 -0

772 lines not on this page · raw message

Signature · 1 line
2.17.1