Commit 40a60b20 authored by Ye Li's avatar Ye Li Committed by Jason Liu

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: 's avatarYe Li <ye.li@nxp.com>
Reviewed-by: 's avatarPeng Fan <peng.fan@nxp.com>
parent f4f8dbcb
......@@ -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
......
......@@ -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>;
......
......@@ -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>;
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment