[PATCH] imx: fdt: fix cooling-device property corruption

Sébastien Szymanski sebastien.szymanski at armadeus.com
Wed Jan 15 16:41:13 CET 2025


The function disable_thermal_cpu_nodes() corrupts the cooling-device
property.
For example, booting an i.MX93 devices with only one A55 core (IMX93x1)
with the cooling-device property set to:

$ dtc -I dtb foo.dtb | grep cooling-device
cooling-device = <0x08 0xffffffff 0xffffffff 0x09 0xffffffff 0xffffffff>;

Linux shows the following error at boot:

[    1.715189] OF: /thermal-zones/cpu-thermal/cooling-maps/map0: could not find phandle 1083699869
[    1.723977] thermal_sys: Add a cooling_device property with at least one device
[    1.731285] thermal thermal_zone0: binding zone cpu-thermal with cdev thermal-devfreq-0 failed:-2

because the cooling-device property in the device tree passed to the
kernel is

$ dtc -I dtb /sys/firmware/fdt | grep cooling-device
cooling-device = <0x4097f29d 0x00 0xb05aef9d>;

The issue is because the wrong variable type is passed to the function
fdt_setprop() called in the function disable_thermal_cpu_nodes(). With
the variable type fixed, the error at boot is gone and the property is
properly set:

$ dtc -I dtb /sys/firmware/fdt | grep cooling-device
cooling-device = <0x08 0xffffffff 0xffffffff>;

Signed-off-by: Sébastien Szymanski <sebastien.szymanski at armadeus.com>
---
 arch/arm/mach-imx/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/fdt.c b/arch/arm/mach-imx/fdt.c
index 103c1fc5968afb46efc8e8ecf9038fd93af3cac1..f19ab9edce496606ba99c80f6a53ff45d596f00e 100644
--- a/arch/arm/mach-imx/fdt.c
+++ b/arch/arm/mach-imx/fdt.c
@@ -39,7 +39,7 @@ static void disable_thermal_cpu_nodes(void *blob, u32 num_disabled_cores, u32 ma
 		for (j = 0; j < cnt; j++)
 			cooling_dev[j] = cpu_to_fdt32(cooling_dev[j]);
 
-		ret = fdt_setprop(blob, nodeoff, "cooling-device", &cooling_dev,
+		ret = fdt_setprop(blob, nodeoff, "cooling-device", cooling_dev,
 				  sizeof(__le32) * (num_le32 - num_disabled_cores * 3));
 		if (ret < 0) {
 			printf("Warning: %s, cooling-device setprop failed %d\n",

---
base-commit: 6a0db9ee030f634731b792d864fc7a9df6cc6b80
change-id: 20250114-imx93-boot-dtb-fixes-8bd66b58453b

Best regards,
-- 
Sébastien Szymanski <sebastien.szymanski at armadeus.com>



More information about the U-Boot mailing list