summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAlice Guo <alice.guo@nxp.com>2021-10-29 04:46:32 +0300
committerStefano Babic <sbabic@denx.de>2022-02-05 15:38:39 +0300
commit6293b73d0ffb90e67cf959360ca72e737290bcd7 (patch)
tree33840ff66f113d9519072d455dfb0f56683dcdcf /arch
parentdc77d0f9fc0f31b591a7643b77b6162cb075a98d (diff)
downloadu-boot-6293b73d0ffb90e67cf959360ca72e737290bcd7.tar.xz
imx8ulp: implement to obtain the SoC current temperature
Obatin the SoC current temperature in print_cpuinfo(). Reviewed-by: Ye Li <ye.li@nxp.com> Signed-off-by: Alice Guo <alice.guo@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/imx8ulp/soc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/imx8ulp/soc.c b/arch/arm/mach-imx/imx8ulp/soc.c
index 943ea7fb7e..934b0ef038 100644
--- a/arch/arm/mach-imx/imx8ulp/soc.c
+++ b/arch/arm/mach-imx/imx8ulp/soc.c
@@ -24,6 +24,7 @@
#include <dm/device.h>
#include <dm/uclass-internal.h>
#include <fuse.h>
+#include <thermal.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -216,6 +217,22 @@ int print_cpuinfo(void)
(cpurev & 0x000F0) >> 4, (cpurev & 0x0000F) >> 0,
mxc_get_clock(MXC_ARM_CLK) / 1000000);
+#if defined(CONFIG_IMX_PMC_TEMPERATURE)
+ struct udevice *udev;
+ int ret, temp;
+
+ ret = uclass_get_device(UCLASS_THERMAL, 0, &udev);
+ if (!ret) {
+ ret = thermal_get_temp(udev, &temp);
+ if (!ret)
+ printf("CPU current temperature: %d\n", temp);
+ else
+ debug(" - failed to get CPU current temperature\n");
+ } else {
+ debug(" - failed to get CPU current temperature\n");
+ }
+#endif
+
printf("Reset cause: %s\n", get_reset_cause(cause));
printf("Boot mode: ");