From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Harvey Date: Fri, 5 Feb 2021 16:11:05 -0800 Subject: [PATCH v2 1/4] thermal: imx_tmu: enable monitoring and default alert/critical In-Reply-To: <1612570268-8625-1-git-send-email-tharvey@gateworks.com> References: <1612570268-8625-1-git-send-email-tharvey@gateworks.com> Message-ID: <1612570268-8625-2-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 Set default critical/alert temperature and enabling monoitoring. Without calling imx_tmu_enable_msite() monitoring will not be enabled and read_temperature will return 0. Additionally without setting alert temperature will cause imx_tmu_get_temp() to spin indefiniately thinking the system needs to cool. This resolves the board spinning endlessly when enabling IMX_TMU in the SPL. Reviewed-by: Fabio Estevam Signed-off-by: Tim Harvey --- v2: added Fabio's review --- drivers/thermal/imx_tmu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/thermal/imx_tmu.c b/drivers/thermal/imx_tmu.c index 1bd0340..1dada06 100644 --- a/drivers/thermal/imx_tmu.c +++ b/drivers/thermal/imx_tmu.c @@ -343,6 +343,7 @@ static int imx_tmu_bind(struct udevice *dev) ofnode node, offset; const char *name; const void *prop; + int minc, maxc; debug("%s dev name %s\n", __func__, dev->name); @@ -351,6 +352,10 @@ static int imx_tmu_bind(struct udevice *dev) return 0; pdata->zone_node = 1; + /* default alert/crit temps based on temp grade */ + get_cpu_temp_grade(&minc, &maxc); + pdata->critical = maxc * 1000; + pdata->alert = (maxc - 10) * 1000; node = ofnode_path("/thermal-zones"); ofnode_for_each_subnode(offset, node) { @@ -442,6 +447,7 @@ static int imx_tmu_probe(struct udevice *dev) if (pdata->zone_node) { imx_tmu_init(dev); imx_tmu_calibration(dev); + imx_tmu_enable_msite(dev); } else { imx_tmu_enable_msite(dev); } -- 2.7.4