Browse Source

MLK-16208-3 imx8qm/qxp: Enable the CPU thermal sensor to get temperature

Add "u-boot,dm-pre-reloc" to thermal node in QM and QXP DTSi files, and
enable the thermal driver in relevant build targets.

In SoC level, will get and print the CPU temperature at booting.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 0cdf3cd01c)
Ye Li 3 years ago
parent
commit
599254d536
12 changed files with 69 additions and 1 deletions
  1. +40
    -1
      arch/arm/cpu/armv8/imx8/cpu.c
  2. +1
    -0
      arch/arm/dts/fsl-imx8qm.dtsi
  3. +1
    -0
      arch/arm/dts/fsl-imx8qxp.dtsi
  4. +3
    -0
      configs/imx8qm_lpddr4_arm2_defconfig
  5. +3
    -0
      configs/imx8qm_lpddr4_arm2_fspi_defconfig
  6. +3
    -0
      configs/imx8qxp_lpddr4_arm2_defconfig
  7. +3
    -0
      configs/imx8qxp_lpddr4_arm2_fspi_defconfig
  8. +3
    -0
      configs/imx8qxp_lpddr4_arm2_nand_defconfig
  9. +3
    -0
      configs/imx8qxp_mek_defconfig
  10. +3
    -0
      configs/mx8qm_lpddr4_arm2_android_defconfig
  11. +3
    -0
      configs/mx8qxp_lpddr4_arm2_android_defconfig
  12. +3
    -0
      configs/mx8qxp_mek_android_defconfig

+ 40
- 1
arch/arm/cpu/armv8/imx8/cpu.c View File

@ -23,6 +23,8 @@
#include <libfdt.h>
#include <fdt_support.h>
#include <fdtdec.h>
#include <thermal.h>
#include <asm/arch/cpu.h>
DECLARE_GLOBAL_DATA_PTR;
@ -71,16 +73,53 @@ const char *get_imx8_rev(u32 rev)
}
}
const char *get_core_name(void)
{
if (is_cortex_a53())
return "A53";
else if (is_cortex_a35())
return "A35";
else if (is_cortex_a72())
return "A72";
else
return "?";
}
int print_cpuinfo(void)
{
u32 cpurev;
cpurev = get_cpu_rev();
printf("CPU: Freescale i.MX%s rev%s at %d MHz\n",
printf("CPU: Freescale i.MX%s rev%s %s at %d MHz",
get_imx8_type((cpurev & 0xFF000) >> 12),
get_imx8_rev((cpurev & 0xFFF)),
get_core_name(),
mxc_get_clock(MXC_ARM_CLK) / 1000000);
#if defined(CONFIG_IMX_SC_THERMAL)
struct udevice *thermal_dev;
int cpu_tmp, ret;
if (is_imx8qm() && is_cortex_a72())
ret = uclass_get_device_by_name(UCLASS_THERMAL, "cpu-thermal1", &thermal_dev);
else
ret = uclass_get_device_by_name(UCLASS_THERMAL, "cpu-thermal0", &thermal_dev);
if (!ret) {
ret = thermal_get_temp(thermal_dev, &cpu_tmp);
if (!ret)
printf(" at %dC", cpu_tmp);
else
debug(" - invalid sensor data");
} else {
debug(" - invalid sensor device");
}
#endif
printf("\n");
return 0;
}
#endif


+ 1
- 0
arch/arm/dts/fsl-imx8qm.dtsi View File

@ -972,6 +972,7 @@
tsens: thermal-sensor {
compatible = "nxp,imx8qm-sc-tsens";
u-boot,dm-pre-reloc;
/* number of the temp sensor on the chip */
tsens-num = <5>;
#thermal-sensor-cells = <1>;


+ 1
- 0
arch/arm/dts/fsl-imx8qxp.dtsi View File

@ -823,6 +823,7 @@
tsens: thermal-sensor {
compatible = "nxp,imx8qxp-sc-tsens";
u-boot,dm-pre-reloc;
/* number of the temp sensor on the chip */
tsens-num = <1>;
#thermal-sensor-cells = <1>;


+ 3
- 0
configs/imx8qm_lpddr4_arm2_defconfig View File

@ -68,3 +68,6 @@ CONFIG_PINCTRL_IMX8=y
CONFIG_POWER_DOMAIN=y
CONFIG_IMX8_POWER_DOMAIN=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SC_THERMAL=y

+ 3
- 0
configs/imx8qm_lpddr4_arm2_fspi_defconfig View File

@ -69,3 +69,6 @@ CONFIG_PINCTRL_IMX8=y
CONFIG_POWER_DOMAIN=y
CONFIG_IMX8_POWER_DOMAIN=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SC_THERMAL=y

+ 3
- 0
configs/imx8qxp_lpddr4_arm2_defconfig View File

@ -68,3 +68,6 @@ CONFIG_PINCTRL_IMX8=y
CONFIG_POWER_DOMAIN=y
CONFIG_IMX8_POWER_DOMAIN=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SC_THERMAL=y

+ 3
- 0
configs/imx8qxp_lpddr4_arm2_fspi_defconfig View File

@ -69,3 +69,6 @@ CONFIG_PINCTRL_IMX8=y
CONFIG_POWER_DOMAIN=y
CONFIG_IMX8_POWER_DOMAIN=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SC_THERMAL=y

+ 3
- 0
configs/imx8qxp_lpddr4_arm2_nand_defconfig View File

@ -67,3 +67,6 @@ CONFIG_PINCTRL_IMX8=y
CONFIG_POWER_DOMAIN=y
CONFIG_IMX8_POWER_DOMAIN=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SC_THERMAL=y

+ 3
- 0
configs/imx8qxp_mek_defconfig View File

@ -64,3 +64,6 @@ CONFIG_PINCTRL_IMX8=y
CONFIG_POWER_DOMAIN=y
CONFIG_IMX8_POWER_DOMAIN=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SC_THERMAL=y

+ 3
- 0
configs/mx8qm_lpddr4_arm2_android_defconfig View File

@ -64,3 +64,6 @@ CONFIG_PINCTRL_IMX8=y
CONFIG_POWER_DOMAIN=y
CONFIG_IMX8_POWER_DOMAIN=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SC_THERMAL=y

+ 3
- 0
configs/mx8qxp_lpddr4_arm2_android_defconfig View File

@ -64,3 +64,6 @@ CONFIG_PINCTRL_IMX8=y
CONFIG_POWER_DOMAIN=y
CONFIG_IMX8_POWER_DOMAIN=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SC_THERMAL=y

+ 3
- 0
configs/mx8qxp_mek_android_defconfig View File

@ -66,3 +66,6 @@ CONFIG_PINCTRL_IMX8=y
CONFIG_POWER_DOMAIN=y
CONFIG_IMX8_POWER_DOMAIN=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SC_THERMAL=y

Loading…
Cancel
Save