diff options
author | Ye.Li <B37916@freescale.com> | 2015-02-06 10:26:03 +0800 |
---|---|---|
committer | Ye.Li <B37916@freescale.com> | 2015-02-06 10:31:36 +0800 |
commit | 322e1c291b31998e6f197ecdc3336c2be0223532 (patch) | |
tree | 0572996033ba767ff57fcb34eba8bd2ee7927bf6 /arch | |
parent | c83c6cc7dedf9759bf193044ff5c3572d5f6afd2 (diff) | |
download | u-boot-imx-322e1c291b31998e6f197ecdc3336c2be0223532.zip u-boot-imx-322e1c291b31998e6f197ecdc3336c2be0223532.tar.gz u-boot-imx-322e1c291b31998e6f197ecdc3336c2be0223532.tar.bz2 |
MLK-10206-2 imx: mx7: Fix temperature checking issue
It is the same temperature checking problem as mx6 codes.
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/mx7/soc.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c index f150569..9280983 100644 --- a/arch/arm/cpu/armv7/mx7/soc.c +++ b/arch/arm/cpu/armv7/mx7/soc.c @@ -63,9 +63,8 @@ u32 __weak get_board_rev(void) } #endif -static int read_cpu_temperature(void) +static int read_cpu_temperature(int *temperature) { - int temperature; unsigned int reg, tmp; unsigned int raw_25c, raw_n40c, ratio; struct mxc_ccm_anatop_reg *ccm_anatop = (struct mxc_ccm_anatop_reg *) @@ -79,7 +78,7 @@ static int read_cpu_temperature(void) fuse = readl(&fuse_bank3->ana1); if (fuse == 0 || fuse == 0xffffffff || (fuse & 0xfff00000) == 0) - return TEMPERATURE_MIN; + return -EINVAL; /* * fuse data layout: @@ -130,35 +129,38 @@ static int read_cpu_temperature(void) writel(TEMPMON_HW_ANADIG_TEMPSENSE1_FINISHED_MASK, &ccm_anatop->tempsense1_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(TEMPMON_HW_ANADIG_TEMPSENSE1_POWER_DOWN_MASK, &ccm_anatop->tempsense0_set); writel(PMU_REF_REFTOP_SELFBIASOFF_MASK, &ccm_anatop->ref_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 init_aips(void) |