Skip to contentSkip to conversation

imx8mm_evk_defconfig: Select CONFIG_IMX_TMU

PATCH In review Fabio Estevam 3 participants 11 messages Aug 23, 2023 – Sep 5, 2023

Subsystems (2)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH v2 1/5 imx8mm_evk_defconfig: Select CONFIG_IMX_TMU

From: Fabio Estevam <[email protected]>

Select the i.MX8MM thermal driver as it is useful for displaying the CPU temperature and its grading:

CPU: Commercial temperature grade (0C to 95C) at 38C

It also prevents booting when the temperature is above the alert point.

---
Changes since v1:
- None

 configs/imx8mm_evk_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/imx8mm_evk_defconfig +1 -0
index ac9810fe1b..822c2fbfab 100644
@@ -104,6 +104,7 @@ CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_PSCI=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_THERMAL=y
+CONFIG_IMX_TMU=y
 CONFIG_USB=y
 CONFIG_SPL_USB_HOST=y
 CONFIG_USB_EHCI_HCD=y
Signature · 1 line
2.34.1
author reviewer
#1 lore raw

PATCH v2 2/5 thermal: imx_tmu: Fix the polling default

From: Fabio Estevam <[email protected]>

When the 'polling-delay' property is not passed via devicetree, pdata->polling_delay keeps at 0. This causes the imx_tmu driver to get stuck inside the busy while() loop when the CPU temperature is above the alert point.

Fix this problem by passing a one second polling interval, which provides a proper delay to let the system to cool down and exit the while() loop when the temperature is below the alert point.

---
Changes since v1:
- None

 drivers/thermal/imx_tmu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/thermal/imx_tmu.c +5 -1
index 97efc55044..d9a04eaf79 100644
@@ -37,6 +37,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define TER_ADC_PD		0x40000000
 #define TER_ALPF		0x3
 
+#define IMX_TMU_POLLING_DELAY_MS	1000
 /*
  * i.MX TMU Registers
  */
@@ -574,6 +575,8 @@ static int imx_tmu_parse_fdt(struct udevice *dev)
 
 	dev_dbg(dev, "%s\n", __func__);
 
+	pdata->polling_delay = IMX_TMU_POLLING_DELAY_MS;
+
 	if (pdata->zone_node) {
 		pdata->regs = (union tmu_regs *)dev_read_addr_ptr(dev);
 
@@ -602,7 +605,8 @@ static int imx_tmu_parse_fdt(struct udevice *dev)
 
 	dev_dbg(dev, "args.args_count %d, id %d\n", args.args_count, pdata->id);
 
-	pdata->polling_delay = dev_read_u32_default(dev, "polling-delay", 1000);
+	pdata->polling_delay = dev_read_u32_default(dev, "polling-delay",
+						    IMX_TMU_POLLING_DELAY_MS);
 
 	trips_np = ofnode_path("/thermal-zones/cpu-thermal/trips");
 	ofnode_for_each_subnode(trips_np, trips_np) {
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/5 thermal: imx_tmu: Fix the polling default

Quoted 9 lines

From: Fabio Estevam <[email protected]>
When the 'polling-delay' property is not passed via devicetree, pdata->polling_delay keeps at 0. This causes the imx_tmu driver to get stuck inside the busy while() loop when the CPU temperature is above the alert point.
Fix this problem by passing a one second polling interval, which provides a proper delay to let the system to cool down and exit the while() loop when the temperature is below the alert point.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
author reviewer
#3 lore raw

PATCH v2 3/5 thermal: imx_tmu: Increase the log level for high temperatures

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

dev_info() message is not printed by default. Increase the log level to dev_crit(). This allows the critical messages related to the temperature getting beyong the alert threshold to be displayed.

---
Changes since v1:
- Use dev_crit() instead of selecting LOG via Kconfig. (Tom)

 drivers/thermal/imx_tmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/imx_tmu.c +1 -1
index d9a04eaf79fb..d2ea084d2d2f 100644
@@ -238,7 +238,7 @@ int imx_tmu_get_temp(struct udevice *dev, int *temp)
 		return ret;
 
 	while (cpu_tmp >= pdata->alert) {
-		dev_info(dev, "CPU Temperature (%dC) has beyond alert (%dC), close to critical (%dC) waiting...\n",
+		dev_crit(dev, "CPU Temperature (%dC) has beyond alert (%dC), close to critical (%dC) waiting...\n",
 			 cpu_tmp, pdata->alert, pdata->critical);
 		mdelay(pdata->polling_delay);
 		ret = read_temperature(dev, &cpu_tmp);
Signature · 1 line
2.34.1
Reviewed-by on v2 3/5
#4 lore raw

Re: [PATCH v2 3/5] thermal: imx_tmu: Increase the log level for high temperatures

Quoted 7 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

dev_info() message is not printed by default. Increase the log level to dev_crit(). This allows the critical messages related to the temperature getting beyong the alert threshold to be displayed.

Signature · 1 line
Tom
#5 lore raw

PATCH v2 3/5 thermal: imx_tmu: Increase the log level for high temperatures

In reply to Fabio Estevam
Quoted 6 lines

From: Fabio Estevam <[email protected]>
dev_info() message is not printed by default. Increase the log level to dev_crit(). This allows the critical messages related to the temperature getting beyong the alert threshold to be displayed.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
author reviewer
#6 lore raw

PATCH v2 4/5 thermal: imx_tmu: Fix the temperature unit

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

The temperature unit is millidegree Celsius, so divide by 1000 to correctly print the temperature values in Celsius.

While at it, also change a typo: "has beyond" to "is beyond".

---
Changes since v1:
- Rebased.

 drivers/thermal/imx_tmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/imx_tmu.c +2 -2
index d2ea084d2d2f..b877ee36878f 100644
@@ -238,8 +238,8 @@ int imx_tmu_get_temp(struct udevice *dev, int *temp)
 		return ret;
 
 	while (cpu_tmp >= pdata->alert) {
-		dev_crit(dev, "CPU Temperature (%dC) has beyond alert (%dC), close to critical (%dC) waiting...\n",
-			 cpu_tmp, pdata->alert, pdata->critical);
+		dev_crit(dev, "CPU Temperature (%dC) is beyond alert (%dC), close to critical (%dC) waiting...\n",
+			 cpu_tmp / 1000, pdata->alert / 1000, pdata->critical / 1000);
 		mdelay(pdata->polling_delay);
 		ret = read_temperature(dev, &cpu_tmp);
 		if (ret)
Signature · 1 line
2.34.1
#7 lore raw

PATCH v2 4/5 thermal: imx_tmu: Fix the temperature unit

Quoted 5 lines

From: Fabio Estevam <[email protected]>
The temperature unit is millidegree Celsius, so divide by 1000 to correctly print the temperature values in Celsius.
While at it, also change a typo: "has beyond" to "is beyond".

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
author reviewer
#8 lore raw

PATCH v2 5/5 thermal: imx_tmu: Increase the polling interval

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Polling every second to check whether the CPU has cooled down is too frequent.

Allow more time for the CPU to cool down by increasing the polling interval to 5 seconds by defaut.

This value is used in the absence of the 'polling-delay' devicetree property.

---
Changes since v1:
- None

 drivers/thermal/imx_tmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/imx_tmu.c +1 -1
index f79b583811..15e01b6166 100644
@@ -37,7 +37,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define TER_ADC_PD		0x40000000
 #define TER_ALPF		0x3
 
-#define IMX_TMU_POLLING_DELAY_MS	1000
+#define IMX_TMU_POLLING_DELAY_MS	5000
 /*
  * i.MX TMU Registers
  */
Signature · 1 line
2.34.1
#9 lore raw

PATCH v2 5/5 thermal: imx_tmu: Increase the polling interval

Quoted 8 lines

From: Fabio Estevam <[email protected]>
Polling every second to check whether the CPU has cooled down is too frequent.
Allow more time for the CPU to cool down by increasing the polling interval to 5 seconds by defaut.
This value is used in the absence of the 'polling-delay' devicetree property.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#10 lore raw

PATCH v2 1/5 imx8mm_evk_defconfig: Select CONFIG_IMX_TMU

In reply to Fabio Estevam
Quoted 7 lines

From: Fabio Estevam <[email protected]>
Select the i.MX8MM thermal driver as it is useful for displaying the CPU temperature and its grading:
CPU: Commercial temperature grade (0C to 95C) at 38C
It also prevents booting when the temperature is above the alert point.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================