From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Harvey Date: Mon, 18 May 2015 06:56:46 -0700 Subject: [U-Boot] [Patch v3 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo() In-Reply-To: <1431957407-24920-1-git-send-email-tharvey@gateworks.com> References: <1431957407-24920-1-git-send-email-tharvey@gateworks.com> Message-ID: <1431957407-24920-4-git-send-email-tharvey@gateworks.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de When CONFIG_IMX6_THERMAL is defined print the CPU temperature grade info along with the current temperature. Before: CPU: Temperature 42 C After: CPU: Automotive temperature grade (-40C to 125C) at 42C CPU: Industrial temperature grade (-40C to 105C) at 42C CPU: Extended Commercial temperature grade (-20C to 105C) at 42C Cc: Stefan Roese Cc: Eric Nelson Cc: Heiko Schocher Cc: Nikita Kiryanov Cc: Jon Nettleton Cc: Jason Liu Cc: Ye Li Cc: Fabio Estevam Cc: Christian Gmeiner Cc: Markus Niebel Cc: Peng Fan Tested-by: Nikolay Dimitrov Signed-off-by: Tim Harvey --- v3: - remove check for IMX6SX - it supports the same OTP regs/definitions for this - fixed typo in commit message - added Nokolay's tested by v2: - moved display of CPU temperature grade to own patch and combined with the current temperature from the thermal sensor driver - add example output to description Signed-off-by: Tim Harvey --- arch/arm/imx-common/cpu.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c index 6b20482..5be07a2 100644 --- a/arch/arm/imx-common/cpu.c +++ b/arch/arm/imx-common/cpu.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -146,7 +147,7 @@ int print_cpuinfo(void) #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL) struct udevice *thermal_dev; - int cpu_tmp, ret; + int cpu_tmp, minc, maxc, ret; #endif cpurev = get_cpu_rev(); @@ -172,16 +173,32 @@ int print_cpuinfo(void) #endif #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL) + puts("CPU: "); + switch (get_cpu_temp_grade(&minc, &maxc)) { + case TEMP_AUTOMOTIVE: + puts("Automotive temperature grade "); + break; + case TEMP_INDUSTRIAL: + puts("Industrial temperature grade "); + break; + case TEMP_EXTCOMMERCIAL: + puts("Extended Commercial temperature grade "); + break; + default: + puts("Commercial temperature grade "); + break; + } + printf("(%dC to %dC)", minc, maxc); ret = uclass_get_device(UCLASS_THERMAL, 0, &thermal_dev); if (!ret) { ret = thermal_get_temp(thermal_dev, &cpu_tmp); if (!ret) - printf("CPU: Temperature %d C\n", cpu_tmp); + printf(" at %dC\n", cpu_tmp); else - printf("CPU: Temperature: invalid sensor data\n"); + puts(" - invalid sensor data\n"); } else { - printf("CPU: Temperature: Can't find sensor device\n"); + puts(" - invalid sensor device\n"); } #endif -- 1.9.1