thermal: Integrate VTM and AVS driver
Subsystems (4)
v2 cover thermal: Integrate VTM and AVS driver
VTM (Voltage and Thermal Manager) IP is used for following purpose
1) AVS class 0
2) Thermal management (setting thermal shutdown TSHUT) temperature.
3) SoC temperature reporting.
In origin boot flow, R5/SPL sets the AVS voltage using by AVS driver, residing under UCLASS_MISC.
In this series At top level, following changes are done
- Moved avs driver to Thermal class
- Ported kernel driver (drivers/thermal/k3_j72xx_bandgap.c) which supports TSHUT and temperature reporting
- Merged these two driver as one under UCLASS_THERMAL.
This series aims to
- set avs and thermal shutdown at R5/SPL stage
- At main u-boot stage, support thermal shutdown and temperature reporting
Also, j72xx_bandgap does complex math to get ADC value to temperature conversion, This table is pretty static.
So at R5 SPL stage, instead of calculation, fixed values is used for TSHUT values.
and #ifdef is used skip non needed code for SPL/R5 to reduce code size.
Change log
Changes in v2:
v1 : https://lore.kernel.org/all/[email protected]/
- Trying to merge AVS and kernel driver into 1
- Mark as RFC
Udit Kumar (3):
thermal: k3: Add support for thermal in vtm
arm: mach-k3: update board file to use thermal device
arm: dts: k3: update device tree for vtm node
arch/arm/dts/k3-j7200-mcu-wakeup.dtsi | 9 + .../arm/dts/k3-j7200-r5-common-proc-board.dts | 6 - arch/arm/dts/k3-j721e-mcu-wakeup.dtsi | 10 + .../arm/dts/k3-j721e-r5-common-proc-board.dts | 7 - arch/arm/dts/k3-j721e-r5-sk.dts | 7 - arch/arm/mach-k3/am654_init.c | 2 +- arch/arm/mach-k3/j721e_init.c | 2 +- configs/am65x_evm_r5_defconfig | 3 + configs/am65x_evm_r5_usbdfu_defconfig | 3 + configs/am65x_evm_r5_usbmsc_defconfig | 3 + configs/am65x_hs_evm_r5_defconfig | 3 + configs/j7200_evm_a72_defconfig | 3 + configs/j7200_evm_r5_defconfig | 3 + configs/j721e_evm_a72_defconfig | 3 + configs/j721e_evm_r5_defconfig | 3 + drivers/misc/Makefile | 1 - drivers/misc/k3_avs.c | 394 -------- drivers/thermal/Kconfig | 7 + drivers/thermal/Makefile | 1 + drivers/thermal/k3_thermal.c | 928 ++++++++++++++++++ 20 files changed, 981 insertions(+), 417 deletions(-) delete mode 100644 drivers/misc/k3_avs.c create mode 100644 drivers/thermal/k3_thermal.c
Signature · 1 line
2.34.1
RFC PATCH v2 1/3 thermal: k3: Add support for thermal in vtm
TI K3's SOC supports AVS class 0 and thermal functions by one IP called VTM (voltage and Thermal Manager).
This patch adds support for thermal management into available AVS driver.
Along with updating needed configs for boot
--- configs/am65x_evm_r5_defconfig | 3 + configs/am65x_evm_r5_usbdfu_defconfig | 3 + configs/am65x_evm_r5_usbmsc_defconfig | 3 + configs/am65x_hs_evm_r5_defconfig | 3 + configs/j7200_evm_a72_defconfig | 3 + configs/j7200_evm_r5_defconfig | 3 + configs/j721e_evm_a72_defconfig | 3 + configs/j721e_evm_r5_defconfig | 3 + drivers/misc/Makefile | 1 - drivers/misc/k3_avs.c | 394 ----------- drivers/thermal/Kconfig | 7 + drivers/thermal/Makefile | 1 + drivers/thermal/k3_thermal.c | 926 ++++++++++++++++++++++++++ 13 files changed, 958 insertions(+), 395 deletions(-) delete mode 100644 drivers/misc/k3_avs.c create mode 100644 drivers/thermal/k3_thermal.c
configs/am65x_evm_r5_defconfig +3 -0
@@ -140,3 +140,6 @@ CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 +CONFIG_SPL_THERMAL=y +CONFIG_DM_THERMAL=y +CONFIG_TI_K3_THERMAL=y
configs/am65x_evm_r5_usbdfu_defconfig +3 -0
@@ -135,3 +135,6 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6162 CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_SPL_DFU=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 +CONFIG_SPL_THERMAL=y +CONFIG_DM_THERMAL=y +CONFIG_TI_K3_THERMAL=y
configs/am65x_evm_r5_usbmsc_defconfig +3 -0
@@ -131,3 +131,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0451 CONFIG_USB_GADGET_PRODUCT_NUM=0x6162 CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 +CONFIG_SPL_THERMAL=y +CONFIG_DM_THERMAL=y +CONFIG_TI_K3_THERMAL=y
configs/am65x_hs_evm_r5_defconfig +3 -0
@@ -133,3 +133,6 @@ CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 +CONFIG_SPL_THERMAL=y +CONFIG_DM_THERMAL=y +CONFIG_TI_K3_THERMAL=y
configs/j7200_evm_a72_defconfig +3 -0
@@ -197,3 +197,6 @@ CONFIG_SPL_DFU=y CONFIG_UFS=y CONFIG_CADENCE_UFS=y CONFIG_TI_J721E_UFS=y +CONFIG_DM_THERMAL=y +CONFIG_TI_K3_THERMAL=y +CONFIG_CMD_TEMPERATURE=y
configs/j7200_evm_r5_defconfig +3 -0
@@ -168,3 +168,6 @@ CONFIG_FS_EXT4=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 CONFIG_LIB_RATIONAL=y CONFIG_SPL_LIB_RATIONAL=y +CONFIG_SPL_THERMAL=y +CONFIG_DM_THERMAL=y +CONFIG_TI_K3_THERMAL=y
configs/j721e_evm_a72_defconfig +3 -0
@@ -201,3 +201,6 @@ CONFIG_SPL_DFU=y CONFIG_UFS=y CONFIG_CADENCE_UFS=y CONFIG_TI_J721E_UFS=y +CONFIG_DM_THERMAL=y +CONFIG_TI_K3_THERMAL=y +CONFIG_CMD_TEMPERATURE=y
configs/j721e_evm_r5_defconfig +3 -0
@@ -178,3 +178,6 @@ CONFIG_FS_EXT4=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 CONFIG_LIB_RATIONAL=y CONFIG_SPL_LIB_RATIONAL=y +CONFIG_SPL_THERMAL=y +CONFIG_DM_THERMAL=y +CONFIG_TI_K3_THERMAL=y
drivers/misc/Makefile +0 -1
@@ -84,7 +84,6 @@ obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress_config.o obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o obj-$(CONFIG_JZ4780_EFUSE) += jz4780_efuse.o obj-$(CONFIG_MICROCHIP_FLEXCOM) += microchip_flexcom.o -obj-$(CONFIG_K3_AVS0) += k3_avs.o obj-$(CONFIG_ESM_K3) += k3_esm.o obj-$(CONFIG_ESM_PMIC) += esm_pmic.o obj-$(CONFIG_SL28CPLD) += sl28cpld.o
drivers/misc/k3_avs.c deleted +0 -394
394 lines not on this page · raw message
drivers/thermal/Kconfig +7 -0
@@ -35,6 +35,13 @@ config IMX_TMU The boot is hold to the cool device to throttle CPUs when the passive trip is crossed +config TI_K3_THERMAL + bool "Temperature sensor and AVS driver for TI K3 j7xx SOCs" + help + Enable thermal and avs support for the Texas Instruments TI K3 j7xx family. + The driver supports reading CPU temperature. + + config TI_DRA7_THERMAL bool "Temperature sensor driver for TI dra7xx SOCs" help
drivers/thermal/Makefile +1 -0
@@ -8,4 +8,5 @@ obj-$(CONFIG_SANDBOX) += thermal_sandbox.o obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o obj-$(CONFIG_IMX_SCU_THERMAL) += imx_scu_thermal.o obj-$(CONFIG_TI_DRA7_THERMAL) += ti-bandgap.o +obj-$(CONFIG_TI_K3_THERMAL) +=k3_thermal.o obj-$(CONFIG_IMX_TMU) += imx_tmu.o
drivers/thermal/k3_thermal.c new file +926 -0
926 lines not on this page · raw message
Signature · 1 line
2.34.1
RFC PATCH v2 2/3 arm: mach-k3: update board file to use thermal device
In reply to Udit KumarUpdate am65 and J721e board files to use thermal device instead of MISC device
--- arch/arm/mach-k3/am654_init.c | 2 +- arch/arm/mach-k3/j721e_init.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-k3/am654_init.c +1 -1
@@ -248,7 +248,7 @@ void board_init_f(ulong dummy)do_board_detect ();#if defined(CONFIG_CPU_V7R ) && defined(CONFIG_K3_AVS0 ) - ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (k3_avs), + ret =uclass_get_device_by_driver (UCLASS_THERMAL ,DM_DRIVER_GET (k3_avs), &dev);if (ret)printf ("AVS init failed: %d\n" , ret);
arch/arm/mach-k3/j721e_init.c +1 -1
@@ -276,7 +276,7 @@ void board_init_f(ulong dummy)do_board_detect ();#if defined(CONFIG_CPU_V7R ) && defined(CONFIG_K3_AVS0 ) - ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (k3_avs), + ret =uclass_get_device_by_driver (UCLASS_THERMAL ,DM_DRIVER_GET (k3_avs), &dev);if (ret)printf ("AVS init failed: %d\n" , ret);
Signature · 1 line
2.34.1
RFC PATCH v2 3/3 arm: dts: k3: update device tree for vtm node
In reply to Udit KumarUpdate device tree for vtm node and update driver compatible too
---
Kernel DT sync is happening in other series. So this patch is added just for testing and make sure functions are working ok
arch/arm/dts/k3-j7200-mcu-wakeup.dtsi | 9 +++++++++ arch/arm/dts/k3-j7200-r5-common-proc-board.dts | 6 ------ arch/arm/dts/k3-j721e-mcu-wakeup.dtsi | 10 ++++++++++ arch/arm/dts/k3-j721e-r5-common-proc-board.dts | 7 ------- arch/arm/dts/k3-j721e-r5-sk.dts | 7 ------- drivers/thermal/k3_thermal.c | 2 ++ 6 files changed, 21 insertions(+), 20 deletions(-)
arch/arm/dts/k3-j7200-mcu-wakeup.dtsi +9 -0
@@ -375,4 +375,13 @@ ti,loczrama = <1>; }; }; + + wkup_vtm0: temperature-sensor@42040000 { + bootph-all; + compatible = "ti,j7200-vtm"; + reg = <0x00 0x42040000 0x00 0x350>, + <0x00 0x42050000 0x00 0x350>; + power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>; + #thermal-sensor-cells = <1>; + }; };
arch/arm/dts/k3-j7200-r5-common-proc-board.dts +0 -6
@@ -91,12 +91,6 @@ bootph-pre-ram; }; - wkup_vtm0: vtm@42040000 { - compatible = "ti,am654-vtm", "ti,j721e-avs"; - reg = <0x0 0x42040000 0x0 0x330>; - power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>; - #thermal-sensor-cells = <1>; - }; }; &dmsc {
arch/arm/dts/k3-j721e-mcu-wakeup.dtsi +10 -0
@@ -408,4 +408,14 @@ ti,loczrama = <1>; }; }; + + wkup_vtm0: temperature-sensor@42040000 { + bootph-all; + compatible = "ti,j721e-vtm"; + reg = <0x00 0x42040000 0x00 0x350>, + <0x00 0x42050000 0x00 0x350>, + <0x00 0x43000300 0x00 0x10>; + power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>; + #thermal-sensor-cells = <1>; + }; };
arch/arm/dts/k3-j721e-r5-common-proc-board.dts +0 -7
@@ -71,13 +71,6 @@ mbox-names = "tx", "rx"; }; - wkup_vtm0: wkup_vtm@42040000 { - compatible = "ti,am654-vtm", "ti,j721e-avs"; - reg = <0x0 0x42040000 0x0 0x330>; - power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>; - #thermal-sensor-cells = <1>; - }; - dm_tifs: dm-tifs { compatible = "ti,j721e-dm-sci"; ti,host-id = <3>;
arch/arm/dts/k3-j721e-r5-sk.dts +0 -7
@@ -204,13 +204,6 @@ mbox-names = "tx", "rx"; }; - wkup_vtm0: wkup_vtm@42040000 { - compatible = "ti,am654-vtm", "ti,j721e-avs"; - reg = <0x0 0x42040000 0x0 0x330>; - power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>; - #thermal-sensor-cells = <1>; - }; - dm_tifs: dm-tifs { compatible = "ti,j721e-dm-sci"; ti,host-id = <3>;
drivers/thermal/k3_thermal.c +2 -0
@@ -913,6 +913,8 @@ static struct vd_config am654_vd_config = {static const struct udevice_id k3_avs_ids[] = { { .compatible ="ti,am654-avs" , .data = (ulong)&am654_vd_config }, { .compatible ="ti,j721e-avs" , .data = (ulong)&j721e_vd_config }, + { .compatible ="ti,j7200-vtm" , .data = (ulong)&j721e_vd_config }, + { .compatible ="ti,j721e-vtm" , .data = (ulong)&j721e_vd_config }, {} };
Signature · 1 line
2.34.1
Dear All,
Quoted 19 lines · Udit Kumar
VTM (Voltage and Thermal Manager) IP is used for following purpose
1) AVS class 0
2) Thermal management (setting thermal shutdown TSHUT) temperature.
3) SoC temperature reporting.In origin boot flow, R5/SPL sets the AVS voltage using by AVS driver, residing under
UCLASS_MISC.In this series At top level, following changes are done
- Moved avs driver to Thermal class
- Ported kernel driver (drivers/thermal/k3_j72xx_bandgap.c) which supports TSHUT and temperature reporting
- Merged these two driver as one underUCLASS_THERMAL.This series aims to
- set avs and thermal shutdown at R5/SPL stage
- At main u-boot stage, support thermal shutdown and temperature reporting
Quoted 5 lines
Also,
j72xx_bandgapdoes complex math to get ADC value to temperature conversion, This table is pretty static.
So at R5 SPL stage, instead of calculation, fixed values is used for TSHUT values.
and #ifdef is used skip non needed code for SPL/R5 to reduce code size.
Kindly review and provide feedback, if this approach looks ok.
Thanks
Udit
Quoted 36 lines
Change log
Changes in v2:
v1 : https://lore.kernel.org/all/[email protected]/
- Trying to merge AVS and kernel driver into 1
- Mark as RFCUdit Kumar (3):
thermal: k3: Add support for thermal in vtm
arm: mach-k3: update board file to use thermal device
arm: dts: k3: update device tree for vtm nodearch/arm/dts/k3-j7200-mcu-wakeup.dtsi | 9 + .../arm/dts/k3-j7200-r5-common-proc-board.dts | 6 - arch/arm/dts/k3-j721e-mcu-wakeup.dtsi | 10 + .../arm/dts/k3-j721e-r5-common-proc-board.dts | 7 - arch/arm/dts/k3-j721e-r5-sk.dts | 7 - arch/arm/mach-k3/am654_init.c | 2 +- arch/arm/mach-k3/j721e_init.c | 2 +- configs/am65x_evm_r5_defconfig | 3 + configs/am65x_evm_r5_usbdfu_defconfig | 3 + configs/am65x_evm_r5_usbmsc_defconfig | 3 + configs/am65x_hs_evm_r5_defconfig | 3 + configs/j7200_evm_a72_defconfig | 3 + configs/j7200_evm_r5_defconfig | 3 + configs/j721e_evm_a72_defconfig | 3 + configs/j721e_evm_r5_defconfig | 3 + drivers/misc/Makefile | 1 - drivers/misc/k3_avs.c | 394 -------- drivers/thermal/Kconfig | 7 + drivers/thermal/Makefile | 1 + drivers/thermal/k3_thermal.c | 928 ++++++++++++++++++ 20 files changed, 981 insertions(+), 417 deletions(-)delete mode 100644
drivers/misc/k3_avs.c
create mode 100644drivers/thermal/k3_thermal.c