aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2023-04-28 12:08:14 +0800
committerStefano Babic <sbabic@denx.de>2023-05-21 16:54:40 +0200
commitf3a07717b721edfb5a183f8e3403f70a3727fca5 (patch)
tree09c7d9fc177f4deba8df1ac96b61feb5903ada53
parent7c5256e89f9e65b15af8821585a11f13e5cc4348 (diff)
downloadu-boot-f3a07717b721edfb5a183f8e3403f70a3727fca5.zip
u-boot-f3a07717b721edfb5a183f8e3403f70a3727fca5.tar.gz
u-boot-f3a07717b721edfb5a183f8e3403f70a3727fca5.tar.bz2
imx: imx8_cpu: print cpu grade temperature
Support print out cpu grade temperature Signed-off-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r--drivers/cpu/imx8_cpu.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/cpu/imx8_cpu.c b/drivers/cpu/imx8_cpu.c
index 4da7a99..304d5e5 100644
--- a/drivers/cpu/imx8_cpu.c
+++ b/drivers/cpu/imx8_cpu.c
@@ -13,6 +13,7 @@
#include <asm/arch/sys_proto.h>
#include <asm/arch-imx/cpu.h>
#include <asm/armv8/cpu.h>
+#include <imx_thermal.h>
#include <linux/bitops.h>
#include <linux/clk-provider.h>
@@ -121,10 +122,17 @@ static int cpu_imx_get_temp(struct cpu_imx_plat *plat)
}
#endif
+__weak u32 get_cpu_temp_grade(int *minc, int *maxc)
+{
+ return 0;
+}
+
static int cpu_imx_get_desc(const struct udevice *dev, char *buf, int size)
{
struct cpu_imx_plat *plat = dev_get_plat(dev);
+ const char *grade;
int ret, temp;
+ int minc, maxc;
if (size < 100)
return -ENOSPC;
@@ -132,6 +140,27 @@ static int cpu_imx_get_desc(const struct udevice *dev, char *buf, int size)
ret = snprintf(buf, size, "NXP i.MX%s Rev%s %s at %u MHz",
plat->type, plat->rev, plat->name, plat->freq_mhz);
+ if (IS_ENABLED(CONFIG_IMX9)) {
+ switch (get_cpu_temp_grade(&minc, &maxc)) {
+ case TEMP_AUTOMOTIVE:
+ grade = "Automotive temperature grade ";
+ break;
+ case TEMP_INDUSTRIAL:
+ grade = "Industrial temperature grade ";
+ break;
+ case TEMP_EXTCOMMERCIAL:
+ grade = "Extended Consumer temperature grade ";
+ break;
+ default:
+ grade = "Consumer temperature grade ";
+ break;
+ }
+
+ buf = buf + ret;
+ size = size - ret;
+ ret = snprintf(buf, size, "\nCPU: %s (%dC to %dC)", grade, minc, maxc);
+ }
+
if (IS_ENABLED(CONFIG_DM_THERMAL)) {
temp = cpu_imx_get_temp(plat);
buf = buf + ret;