summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorAnatolij Gustschin <agust@denx.de>2020-05-20 11:21:53 +0300
committerAnatolij Gustschin <agust@denx.de>2020-05-22 14:29:25 +0300
commit4e7413a998ba5666aa4ee0b4f49789f52b1281b1 (patch)
treeeabaca7767d2e6dfc0c36d43f8eb92852b01dd29 /drivers/thermal
parent74e8fb03bdafd096bcfaa36268376874dfb5c7d4 (diff)
downloadu-boot-4e7413a998ba5666aa4ee0b4f49789f52b1281b1.tar.xz
thermal: imx_scu_thermal: prevent boot hang with zero pdata
Should initialization of pdata values have failed for some reason, we end up in endless loop when getting the CPU temperature value and can not boot. Check alert value in pdata and only retry reading temperature if alert value is not zero. Also shorten the temperature info string. Signed-off-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/imx_scu_thermal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/thermal/imx_scu_thermal.c b/drivers/thermal/imx_scu_thermal.c
index 321f905e3a..83ec753802 100644
--- a/drivers/thermal/imx_scu_thermal.c
+++ b/drivers/thermal/imx_scu_thermal.c
@@ -61,13 +61,15 @@ int imx_sc_thermal_get_temp(struct udevice *dev, int *temp)
return ret;
while (cpu_temp >= pdata->alert) {
- printf("CPU Temperature (%dC) has beyond alert (%dC), close to critical (%dC)",
+ printf("CPU Temperature (%dC) beyond alert (%dC), close to critical (%dC)",
cpu_temp, pdata->alert, pdata->critical);
puts(" waiting...\n");
mdelay(pdata->polling_delay);
ret = read_temperature(dev, &cpu_temp);
if (ret)
return ret;
+ if (cpu_temp >= pdata->alert && !pdata->alert)
+ break;
}
*temp = cpu_temp / 1000;