#include <thermal.h>
#include <imx_thermal.h>
+/* board will busyloop until this many degrees C below CPU max temperature */
+#define TEMPERATURE_HOT_DELTA 5 /* CPU maxT - 5C */
#define FACTOR0 10000000
#define FACTOR1 15976
#define FACTOR2 4297157
struct thermal_data {
unsigned int fuse;
- int passive;
+ int critical;
int minc;
int maxc;
};
writel(TEMPSENSE0_FINISHED, &anatop->tempsense0_clr);
/* milli_Tmeas = c2 - Nmeas * c1 */
- temperature = (c2 - n_meas * c1)/1000;
+ temperature = (long)(c2 - n_meas * c1)/1000;
/* power down anatop thermal sensor */
writel(TEMPSENSE0_POWER_DOWN, &anatop->tempsense0_set);
int cpu_tmp = 0;
cpu_tmp = read_cpu_temperature(dev);
- while (cpu_tmp > priv->minc && cpu_tmp < priv->maxc) {
- if (cpu_tmp >= priv->passive) {
- printf("CPU Temperature is %d C, too hot to boot, waiting...\n",
- cpu_tmp);
- udelay(5000000);
- cpu_tmp = read_cpu_temperature(dev);
- } else {
- break;
- }
+ while (cpu_tmp >= priv->critical) {
+ printf("CPU Temperature (%dC) too close to max (%dC)",
+ cpu_tmp, priv->maxc);
+ puts(" waiting...\n");
+ udelay(5000000);
+ cpu_tmp = read_cpu_temperature(dev);
}
*temp = cpu_tmp;
return -EPERM;
}
- /* set passive cooling temp to max - 20C */
+ /* set critical cooling temp */
get_cpu_temp_grade(&priv->minc, &priv->maxc);
- priv->passive = priv->maxc - 20;
+ priv->critical = priv->maxc - TEMPERATURE_HOT_DELTA;
priv->fuse = fuse;
enable_thermal_clk();