summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnshul Dalal <[email protected]>2025-10-31 13:07:55 +0530
committerTom Rini <[email protected]>2025-11-06 17:39:49 -0600
commit518d8c1bec4cd78d3dc2ef574ae99f0918913175 (patch)
tree0fe665e48b448038ed01ae85b44d2c8a564ecb86
parent18a3a7a9b82a8f01ca22f5c1979145a28805ad46 (diff)
mach-k3: r5: common: add fdt fixups for falcon mode
This patch adds fdt fixups to the kernel device-tree in R5 falcon mode, these fixups include fixing up the core-count, reserved-memory etc. The users can opt out by disabling the respective CONFIG_OF_*_SETUP config options. Signed-off-by: Anshul Dalal <[email protected]>
-rw-r--r--arch/arm/mach-k3/r5/common.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/mach-k3/r5/common.c b/arch/arm/mach-k3/r5/common.c
index bf5e7903dcb..8e002504897 100644
--- a/arch/arm/mach-k3/r5/common.c
+++ b/arch/arm/mach-k3/r5/common.c
@@ -406,12 +406,43 @@ int k3_r5_falcon_bootmode(void)
return BOOT_DEVICE_NOBOOT;
}
+static int k3_falcon_fdt_fixup(void *fdt)
+{
+ int ret;
+
+ if (!fdt)
+ return -EINVAL;
+
+ fdt_set_totalsize(fdt, fdt_totalsize(fdt) + CONFIG_SYS_FDT_PAD);
+
+ if (IS_ENABLED(CONFIG_OF_BOARD_SETUP)) {
+ ret = ft_board_setup(fdt, gd->bd);
+ if (ret) {
+ printf("%s: Failed in board setup: %s\n", __func__,
+ fdt_strerror(ret));
+ return ret;
+ }
+ }
+
+ if (IS_ENABLED(CONFIG_OF_SYSTEM_SETUP)) {
+ ret = ft_system_setup(fdt, gd->bd);
+ if (ret) {
+ printf("%s: Failed in system setup: %s\n", __func__,
+ fdt_strerror(ret));
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
int k3_r5_falcon_prep(void)
{
struct spl_image_loader *loader, *drv;
struct spl_image_info kernel_image;
struct spl_boot_device bootdev;
int ret = -ENXIO, n_ents;
+ void *fdt;
tifalcon_loaded = true;
memset(&kernel_image, '\0', sizeof(kernel_image));
@@ -428,6 +459,13 @@ int k3_r5_falcon_prep(void)
if (ret)
continue;
+ fdt = spl_image_fdt_addr(&kernel_image);
+ ret = k3_falcon_fdt_fixup(fdt);
+ if (ret) {
+ printf("Failed to fixup fdt in falcon mode: %d\n", ret);
+ return ret;
+ }
+
return 0;
}