There are a few points that I am still confused about.
Chavira, this is your reply:
1>> U-Boot does not modify the Linux Device Tree at runtime.
Once the Linux kernel is loaded, U-Boot no longer has control over the Device Tree.
Are you sure u-boot can't modify the Linux device tree?
a. u-boot has the fdt command that can modify the Linux device tree.
Your colleague also has documentation on this.
Here is the document:
u-boot runtime modify Linux device tree (dtb)
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/u-boot-runtime-modify-Linux-device-tree-...
b. arch/arm/mach-imx/imx8m/soc.c uses the same API as the u-boot fdt command.
c. Isn't u-boot supposed to prepare the Linux runtime environment? Any operations, including modifying the Linux device tree, must occur before Linux boots.
After u-boot loads a Linux device, but Linux hasn't booted yet, can't it modify the Linux device tree?
The simplest question is: Isn the "disable_cpu_nodes" API function before or after Linux boots?
We really need clarification from NXP on these issues as this is relevant to the projects we are actually running.
Could you please review the source code?
https://github.com/nxp-imx/uboot-imx/blob/lf-5.10.72-2.2.3/arch/arm/mach-imx/imx8m/soc.c
const nodes_path here is Linux device tree node or not?
static int disable_cpu_nodes(void *blob, u32 disabled_cores)
{
static const char * const nodes_path[] = {
"/cpus/cpu@1",
"/cpus/cpu@2",
"/cpus/cpu@3",
};
u32 i = 0;
int rc;
int nodeoff;
if (disabled_cores > 3)
return -EINVAL;
i = 3 - disabled_cores;
for (; i < 3; i++) {
nodeoff = fdt_path_offset(blob, nodes_path[i]);
if (nodeoff < 0)
continue; /* Not found, skip it */
debug("Found %s node\n", nodes_path[i]);
rc = fdt_del_node(blob, nodeoff);
if (rc < 0) {
printf("Unable to delete node %s, err=%s\n",
nodes_path[i], fdt_strerror(rc));
} else {
printf("Delete node %s\n", nodes_path[i]);
}
}