* [PATCH v1 1/2] imx: mach: imx8: fdt: return libfdt errors from helpers
2026-10-19 12:58 [PATCH v1 0/2] imx: mach: imx8: fdt: fix industrial GPU frequencies Stefan Eichenberger
@ 2026-10-19 12:58 ` Stefan Eichenberger
2026-10-19 12:58 ` [PATCH v1 2/2] imx: mach: imx8: fdt: support newer GPU0 bus node name Stefan Eichenberger
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Eichenberger @ 2026-10-19 12:58 UTC (permalink / raw)
To: trini, ilias.apalodimas, sbabic, festevam, uboot-imx,
stefan.eichenberger, francesco.dolcini
Cc: u-boot
From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
delete_node() and change_property() replaced the libfdt error codes with
-ENXIO and -EINVAL, but the callers pass the result to fdt_strerror(),
which expects a libfdt error code. In addition,
update_fdt_gpu_industrial_frequencies() compared the result against the
positive ENXIO, so a missing node was reported as an error instead of
being ignored.
On an industrial i.MX 8 booted with a device tree that lacks the GPU1
nodes (e.g. mainline Linux), a misleading error is printed on every boot
because -ENXIO is interpreted by fdt_strerror() as a libfdt error code,
e.g.:
Failed to set assigned-clock-rates for GPU1: FDT_ERR_BADPHANDLE
Return the libfdt error codes unchanged and ignore -FDT_ERR_NOTFOUND,
which fdt_path_offset() returns if the node does not exist.
Fixes: e9cf7f515a19 ("imx: mach: imx8: fdt: set correct frequencies for the industrial SoC")
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
---
arch/arm/mach-imx/imx8/fdt.c | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-imx/imx8/fdt.c b/arch/arm/mach-imx/imx8/fdt.c
index 8337edc2f62..630b5e55702 100644
--- a/arch/arm/mach-imx/imx8/fdt.c
+++ b/arch/arm/mach-imx/imx8/fdt.c
@@ -281,34 +281,24 @@ static int ft_add_optee_node(void *fdt, struct bd_info *bd)
static int delete_node(void *blob, const char *node)
{
int nodeoffset;
- int err;
nodeoffset = fdt_path_offset(blob, node);
if (nodeoffset < 0)
- return -ENXIO;
-
- err = fdt_del_node(blob, nodeoffset);
- if (err)
- return -EINVAL;
+ return nodeoffset;
- return 0;
+ return fdt_del_node(blob, nodeoffset);
}
static int change_property(void *blob, const char *node, const char *property,
const void *value, int len)
{
int nodeoffset;
- int err;
nodeoffset = fdt_path_offset(blob, node);
if (nodeoffset < 0)
- return -ENXIO;
-
- err = fdt_setprop(blob, nodeoffset, property, value, len);
- if (err)
- return -EINVAL;
+ return nodeoffset;
- return 0;
+ return fdt_setprop(blob, nodeoffset, property, value, len);
}
static void update_fdt_gpu_industrial_frequencies(void *blob)
@@ -330,21 +320,21 @@ static void update_fdt_gpu_industrial_frequencies(void *blob)
err = change_property(blob, "/bus@53100000/gpu@53100000",
"assigned-clock-rates", gpu_assigned_clocks,
sizeof(gpu_assigned_clocks));
- if (err && err != ENXIO)
+ if (err && err != -FDT_ERR_NOTFOUND)
printf("Failed to set assigned-clock-rates for GPU0: %s\n",
fdt_strerror(err));
err = change_property(blob, "/bus@54100000/gpu@54100000",
"assigned-clock-rates", gpu_assigned_clocks,
sizeof(gpu_assigned_clocks));
- if (err && err != ENXIO)
+ if (err && err != -FDT_ERR_NOTFOUND)
printf("Failed to set assigned-clock-rates for GPU1: %s\n",
fdt_strerror(err));
err = change_property(blob, "/bus@54100000/imx8_gpu1_ss@80000000",
"operating-points", &gpu_opp_table,
sizeof(gpu_opp_table));
- if (err && err != ENXIO)
+ if (err && err != -FDT_ERR_NOTFOUND)
printf("Failed to set operating-points for GPU: %s\n",
fdt_strerror(err));
}
@@ -354,12 +344,12 @@ static void update_fdt_cpu_industrial_frequencies(void *blob)
int err;
err = delete_node(blob, "/opp-table-0/opp-1200000000");
- if (err && err != -ENXIO)
+ if (err && err != -FDT_ERR_NOTFOUND)
printf("Failed to delete 1.2 GHz node on A53: %s\n",
fdt_strerror(err));
err = delete_node(blob, "/opp-table-1/opp-1596000000");
- if (err && err != -ENXIO)
+ if (err && err != -FDT_ERR_NOTFOUND)
printf("Failed to delete 1.596 GHz node on A72: %s\n",
fdt_strerror(err));
}
--
2.56.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v1 2/2] imx: mach: imx8: fdt: support newer GPU0 bus node name
2026-10-19 12:58 [PATCH v1 0/2] imx: mach: imx8: fdt: fix industrial GPU frequencies Stefan Eichenberger
2026-10-19 12:58 ` [PATCH v1 1/2] imx: mach: imx8: fdt: return libfdt errors from helpers Stefan Eichenberger
@ 2026-10-19 12:58 ` Stefan Eichenberger
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Eichenberger @ 2026-10-19 12:58 UTC (permalink / raw)
To: trini, ilias.apalodimas, sbabic, festevam, uboot-imx,
stefan.eichenberger, francesco.dolcini
Cc: u-boot
From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Mainline Linux and NXP downstream kernels starting with 6.18 name the
GPU0 subsystem bus@53000000, while older downstream kernels used
bus@53100000. Because of that, the industrial GPU clock rates were not
applied and GPU0 kept running at the default 700/850 MHz instead of
the 625 MHz limit of the industrial SoC.
Use /bus@53000000/gpu@53100000 and, if it does not exist, fall back to
the legacy /bus@53100000/gpu@53100000.
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
---
arch/arm/mach-imx/imx8/fdt.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/imx8/fdt.c b/arch/arm/mach-imx/imx8/fdt.c
index 630b5e55702..05d2ddead91 100644
--- a/arch/arm/mach-imx/imx8/fdt.c
+++ b/arch/arm/mach-imx/imx8/fdt.c
@@ -317,9 +317,14 @@ static void update_fdt_gpu_industrial_frequencies(void *blob)
gpu_assigned_clocks[0] = cpu_to_fdt32(625000000); /* Core Clock */
gpu_assigned_clocks[1] = cpu_to_fdt32(625000000); /* Shader Clock */
- err = change_property(blob, "/bus@53100000/gpu@53100000",
+ err = change_property(blob, "/bus@53000000/gpu@53100000",
"assigned-clock-rates", gpu_assigned_clocks,
sizeof(gpu_assigned_clocks));
+ /* NXP kernels before 6.18 use bus@53100000 */
+ if (err == -FDT_ERR_NOTFOUND)
+ err = change_property(blob, "/bus@53100000/gpu@53100000",
+ "assigned-clock-rates", gpu_assigned_clocks,
+ sizeof(gpu_assigned_clocks));
if (err && err != -FDT_ERR_NOTFOUND)
printf("Failed to set assigned-clock-rates for GPU0: %s\n",
fdt_strerror(err));
--
2.56.0
^ permalink raw reply related [flat|nested] 3+ messages in thread