2021-10-04 12:19:47

by Keerthy

[permalink] [raw]
Subject: [PATCH 0/4] 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

--
2.17.1


2021-10-04 12:20:45

by Keerthy

[permalink] [raw]
Subject: [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.

Signed-off-by: Keerthy <[email protected]>
---
.../bindings/thermal/ti,j72xx-thermal.yaml | 58 +++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml

diff --git a/Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml b/Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
new file mode 100644
index 000000000000..ccf1bd3640ee
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
@@ -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";
+ };
+ };
+ };
+...
--
2.17.1

2021-10-04 12:35:54

by Keerthy

[permalink] [raw]
Subject: [PATCH 3/4] arm64: dts: ti: j7200: Add VTM node

VTM stands for Voltage Thermal Management

Signed-off-by: Keerthy <[email protected]>
---
.../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

diff --git a/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi
index 1044ec6c4b0d..2b5c570253cc 100644
--- a/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi
@@ -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>;
+ };
};
diff --git a/arch/arm64/boot/dts/ti/k3-j7200-thermal.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-thermal.dtsi
new file mode 100644
index 000000000000..1f18f9dcd3e9
--- /dev/null
+++ b/arch/arm64/boot/dts/ti/k3-j7200-thermal.dtsi
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <dt-bindings/thermal/thermal.h>
+
+mcu_thermal: mcu_thermal {
+ polling-delay-passive = <250>; /* milliseconds */
+ polling-delay = <500>; /* milliseconds */
+ thermal-sensors = <&wkup_vtm0 0>;
+
+ trips {
+ wkup_crit: wkup_crit {
+ temperature = <125000>; /* milliCelsius */
+ hysteresis = <2000>; /* milliCelsius */
+ type = "critical";
+ };
+ };
+};
+
+mpu_thermal: mpu_thermal {
+ polling-delay-passive = <250>; /* milliseconds */
+ polling-delay = <500>; /* milliseconds */
+ thermal-sensors = <&wkup_vtm0 1>;
+
+ trips {
+ mpu_crit: mpu_crit {
+ temperature = <125000>; /* milliCelsius */
+ hysteresis = <2000>; /* milliCelsius */
+ type = "critical";
+ };
+ };
+};
+
+main_thermal: main_thermal {
+ polling-delay-passive = <250>; /* milliseconds */
+ polling-delay = <500>; /* milliseconds */
+ thermal-sensors = <&wkup_vtm0 2>;
+
+ trips {
+ c7x_crit: c7x_crit {
+ temperature = <125000>; /* milliCelsius */
+ hysteresis = <2000>; /* milliCelsius */
+ type = "critical";
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/ti/k3-j7200.dtsi b/arch/arm64/boot/dts/ti/k3-j7200.dtsi
index b7005b803149..649d1d60f5c7 100644
--- a/arch/arm64/boot/dts/ti/k3-j7200.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j7200.dtsi
@@ -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 */
--
2.17.1

2021-10-04 14:08:51

by Keerthy

[permalink] [raw]
Subject: [PATCH 2/4] arm64: dts: ti: j721e: Add VTM node

VTM stands for Voltage Thermal Management

Signed-off-by: Keerthy <[email protected]>
---
.../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

diff --git a/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
index d2dceda72fe9..fafc07848f86 100644
--- a/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
@@ -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>;
+ };
};
diff --git a/arch/arm64/boot/dts/ti/k3-j721e-thermal.dtsi b/arch/arm64/boot/dts/ti/k3-j721e-thermal.dtsi
new file mode 100644
index 000000000000..e922042f356f
--- /dev/null
+++ b/arch/arm64/boot/dts/ti/k3-j721e-thermal.dtsi
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <dt-bindings/thermal/thermal.h>
+
+wkup_thermal: wkup_thermal {
+ polling-delay-passive = <250>; /* milliseconds */
+ polling-delay = <500>; /* milliseconds */
+ thermal-sensors = <&wkup_vtm0 0>;
+
+ trips {
+ wkup_crit: wkup_crit {
+ temperature = <125000>; /* milliCelsius */
+ hysteresis = <2000>; /* milliCelsius */
+ type = "critical";
+ };
+ };
+};
+
+mpu_thermal: mpu_thermal {
+ polling-delay-passive = <250>; /* milliseconds */
+ polling-delay = <500>; /* milliseconds */
+ thermal-sensors = <&wkup_vtm0 1>;
+
+ trips {
+ mpu_crit: mpu_crit {
+ temperature = <125000>; /* milliCelsius */
+ hysteresis = <2000>; /* milliCelsius */
+ type = "critical";
+ };
+ };
+};
+
+c7x_thermal: c7x_thermal {
+ polling-delay-passive = <250>; /* milliseconds */
+ polling-delay = <500>; /* milliseconds */
+ thermal-sensors = <&wkup_vtm0 2>;
+
+ trips {
+ c7x_crit: c7x_crit {
+ temperature = <125000>; /* milliCelsius */
+ hysteresis = <2000>; /* milliCelsius */
+ type = "critical";
+ };
+ };
+};
+
+gpu_thermal: gpu_thermal {
+ polling-delay-passive = <250>; /* milliseconds */
+ polling-delay = <500>; /* milliseconds */
+ thermal-sensors = <&wkup_vtm0 3>;
+
+ trips {
+ gpu_crit: gpu_crit {
+ temperature = <125000>; /* milliCelsius */
+ hysteresis = <2000>; /* milliCelsius */
+ type = "critical";
+ };
+ };
+};
+
+r5f_thermal: r5f_thermal {
+ polling-delay-passive = <250>; /* milliseconds */
+ polling-delay = <500>; /* milliseconds */
+ thermal-sensors = <&wkup_vtm0 4>;
+
+ trips {
+ r5f_crit: r5f_crit {
+ temperature = <125000>; /* milliCelsius */
+ hysteresis = <2000>; /* milliCelsius */
+ type = "critical";
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/ti/k3-j721e.dtsi b/arch/arm64/boot/dts/ti/k3-j721e.dtsi
index f0587fde147e..20e26a359aaf 100644
--- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi
@@ -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 */
--
2.17.1

2021-10-05 12:28:52

by Rob Herring (Arm)

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

On Mon, 04 Oct 2021 16:55:47 +0530, Keerthy wrote:
> 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.
>
> Signed-off-by: Keerthy <[email protected]>
> ---
> .../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.

2021-10-05 13:11:06

by Rob Herring

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

On Tue, Oct 5, 2021 at 7:26 AM Rob Herring <[email protected]> wrote:
>
> On Mon, 04 Oct 2021 16:55:47 +0530, Keerthy wrote:
> > 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.
> >
> > Signed-off-by: Keerthy <[email protected]>
> > ---
> > .../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):

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.

2021-10-06 09:44:23

by Daniel Lezcano

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


Keerthy,

did you receive this answer ?


On 05/10/2021 15:05, Rob Herring wrote:
> On Tue, Oct 5, 2021 at 7:26 AM Rob Herring <[email protected]> wrote:
>>
>> On Mon, 04 Oct 2021 16:55:47 +0530, Keerthy wrote:
>>> 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.
>>>
>>> Signed-off-by: Keerthy <[email protected]>
>>> ---
>>> .../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):
>
> 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.
>


--
<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

2021-10-06 13:23:40

by Keerthy

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



On 10/6/2021 3:12 PM, Daniel Lezcano wrote:
>
> 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


>
>
> On 05/10/2021 15:05, Rob Herring wrote:
>> On Tue, Oct 5, 2021 at 7:26 AM Rob Herring <[email protected]> wrote:
>>>
>>> On Mon, 04 Oct 2021 16:55:47 +0530, Keerthy wrote:
>>>> 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.
>>>>
>>>> Signed-off-by: Keerthy <[email protected]>
>>>> ---
>>>> .../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):
>>
>> 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.
>>
>
>