summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2017-08-16 08:41:50 -0500
committerJason Liu <jason.hui.liu@nxp.com>2017-11-03 02:37:13 +0800
commit40a60b20276c45373a5337664943a3e14e19bdda (patch)
treec9507a022595d8b7e7f395606cd14cb48a097e85 /arch
parentf4f8dbcb125fdf419917e77ebbca875bca330b4b (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/armv8/imx8/cpu.c41
-rw-r--r--arch/arm/dts/fsl-imx8qm.dtsi1
-rw-r--r--arch/arm/dts/fsl-imx8qxp.dtsi1
3 files changed, 42 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv8/imx8/cpu.c b/arch/arm/cpu/armv8/imx8/cpu.c
index 57f95cd658..2b26c0863e 100644
--- a/arch/arm/cpu/armv8/imx8/cpu.c
+++ b/arch/arm/cpu/armv8/imx8/cpu.c
@@ -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
diff --git a/arch/arm/dts/fsl-imx8qm.dtsi b/arch/arm/dts/fsl-imx8qm.dtsi
index d43f10ba1d..fb2ee47b44 100644
--- a/arch/arm/dts/fsl-imx8qm.dtsi
+++ b/arch/arm/dts/fsl-imx8qm.dtsi
@@ -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>;
diff --git a/arch/arm/dts/fsl-imx8qxp.dtsi b/arch/arm/dts/fsl-imx8qxp.dtsi
index 99a7941786..81faf29cc1 100644
--- a/arch/arm/dts/fsl-imx8qxp.dtsi
+++ b/arch/arm/dts/fsl-imx8qxp.dtsi
@@ -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>;