summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorYe.Li <B37916@freescale.com>2015-02-06 10:25:10 +0800
committerYe.Li <B37916@freescale.com>2015-02-06 10:31:29 +0800
commitc83c6cc7dedf9759bf193044ff5c3572d5f6afd2 (patch)
tree3d5b64bc6910e76547384331bf153291515769a0 /arch
parentaf2deb8e0c1d3848b1f86b4783b5a381592af90e (diff)
downloadu-boot-imx-c83c6cc7dedf9759bf193044ff5c3572d5f6afd2.zip
u-boot-imx-c83c6cc7dedf9759bf193044ff5c3572d5f6afd2.tar.gz
u-boot-imx-c83c6cc7dedf9759bf193044ff5c3572d5f6afd2.tar.bz2
MLK-10206-1 imx: mx6: Fix temperature checking issue
The current temperature checking will not stop booting when temperature is over TEMPERATURE_MAX value. This is a bug in the temperature polling. The patch fixes this issue by blocking the booting until the temperature is lower than TEMPERATURE_HOT. Signed-off-by: Ye.Li <B37916@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/armv7/mx6/soc.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 3c3d2fd..207b92b 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -2,7 +2,7 @@
* (C) Copyright 2007
* Sascha Hauer, Pengutronix
*
- * (C) Copyright 2009-2014 Freescale Semiconductor, Inc.
+ * (C) Copyright 2009-2015 Freescale Semiconductor, Inc.
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -238,9 +238,8 @@ static void imx_set_wdog_powerdown(bool enable)
writew(enable, &wdog2->wmcr);
}
-static int read_cpu_temperature(void)
+static int read_cpu_temperature(int *temperature)
{
- int temperature;
unsigned int ccm_ccgr2;
unsigned int reg, tmp;
unsigned int raw_25c, raw_n40c, ratio;
@@ -278,7 +277,7 @@ static int read_cpu_temperature(void)
writel(ccm_ccgr2, &mxc_ccm->CCGR2);
if (fuse == 0 || fuse == 0xffffffff || (fuse & 0xfff00000) == 0)
- return TEMPERATURE_MIN;
+ return -EINVAL;
/*
* fuse data layout:
@@ -329,35 +328,38 @@ static int read_cpu_temperature(void)
writel(BM_ANADIG_TEMPSENSE0_FINISHED, &mxc_ccm->tempsense0_clr);
if (tmp <= raw_n40c)
- temperature = REG_VALUE_TO_CEL(ratio, tmp);
+ *temperature = REG_VALUE_TO_CEL(ratio, tmp);
else
- temperature = TEMPERATURE_MIN;
+ *temperature = TEMPERATURE_MIN;
/* power down anatop thermal sensor */
writel(BM_ANADIG_TEMPSENSE0_POWER_DOWN, &mxc_ccm->tempsense0_set);
writel(BM_ANADIG_ANA_MISC0_REFTOP_SELBIASOFF, &mxc_ccm->ana_misc0_clr);
- return temperature;
+ return 0;
}
void check_cpu_temperature(void)
{
int cpu_tmp = 0;
+ int ret;
- cpu_tmp = read_cpu_temperature();
- while (cpu_tmp > TEMPERATURE_MIN && cpu_tmp < TEMPERATURE_MAX) {
+ ret = read_cpu_temperature(&cpu_tmp);
+ while (!ret) {
if (cpu_tmp >= TEMPERATURE_HOT) {
printf("CPU is %d C, too hot to boot, waiting...\n",
cpu_tmp);
udelay(5000000);
- cpu_tmp = read_cpu_temperature();
- } else
+ ret = read_cpu_temperature(&cpu_tmp);
+ } else {
+ printf("CPU: Temperature %d C, calibration data: 0x%x\n",
+ cpu_tmp, fuse);
break;
+ }
}
- if (cpu_tmp > TEMPERATURE_MIN && cpu_tmp < TEMPERATURE_MAX)
- printf("CPU: Temperature %d C, calibration data: 0x%x\n",
- cpu_tmp, fuse);
- else
+
+ if (ret) {
printf("CPU: Temperature: can't get valid data!\n");
+ }
}
static void set_ahb_rate(u32 val)