]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mach-k3: common: support only MMC in R5 falcon mode
authorAnshul Dalal <anshuld@ti.com>
Fri, 31 Oct 2025 07:37:54 +0000 (13:07 +0530)
committerTom Rini <trini@konsulko.com>
Thu, 6 Nov 2025 23:39:49 +0000 (17:39 -0600)
To simplify the boot process and prevent the R5 SPL size from growing,
this patch restricts the boot media to load the next stage payload
(tifalcon.bin and kernel FIT) to MMC only.

We select between eMMC/SD by checking "mmcdev" in env to conform with
how U-Boot proper handles loading binaries from MMC1 or MMC2.

Note that tiboot3.bin (the initial bootloader) can be loaded from any
boot mode supported by the ROM since the restriction only applies to
tifalcon.bin and fitImage.

Signed-off-by: Anshul Dalal <anshuld@ti.com>
arch/arm/mach-k3/am62ax/am62a7_init.c
arch/arm/mach-k3/am62px/am62p5_init.c
arch/arm/mach-k3/am62x/am625_init.c
arch/arm/mach-k3/common.h
arch/arm/mach-k3/r5/common.c

index 48d578e7d6f180f06b42003313bf643c725eae7e..7de234611639d119db5c7a718738a02cedf8028c 100644 (file)
@@ -240,5 +240,9 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 
 u32 spl_boot_device(void)
 {
+#if IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE) && !IS_ENABLED(CONFIG_ARM64)
+       return k3_r5_falcon_bootmode();
+#else
        return get_boot_device();
+#endif
 }
index aebd5200b0db9959805d04408b34d283e21b6e2c..4c215d5cebed5930bce70bdc975fe31c437ce82b 100644 (file)
@@ -375,6 +375,10 @@ u32 spl_boot_device(void)
        u32 devstat = readl(CTRLMMR_MAIN_DEVSTAT);
        u32 bootmedia;
 
+#if IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE) && !IS_ENABLED(CONFIG_ARM64)
+       return k3_r5_falcon_bootmode();
+#endif
+
        if (bootindex == K3_PRIMARY_BOOTMODE)
                bootmedia = __get_primary_bootmedia(devstat);
        else
index 14f93ac998f7d11997b753550c0ea38926e35e64..02b7414e21cd56faab795fe7b39eefcc67cb044a 100644 (file)
@@ -327,5 +327,9 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 
 u32 spl_boot_device(void)
 {
+#if IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE) && !IS_ENABLED(CONFIG_ARM64)
+       return k3_r5_falcon_bootmode();
+#else
        return get_boot_device();
+#endif
 }
index 5807d3584645d3e80443842c7e11e653c6bb8468..cd3e19374dc35bd3745a0261e8b8395d47d95283 100644 (file)
@@ -54,6 +54,7 @@ int shutdown_mcu_r5_core1(void);
 
 #if IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE) && !IS_ENABLED(CONFIG_ARM64)
 int k3_r5_falcon_bootmode(void);
+int k3_r5_falcon_prep(void);
 #endif
 
 #if (IS_ENABLED(CONFIG_K3_QOS))
index f0654102737466ef9a1519d950d6137c6a9e8452..bf5e7903dcb180b95a1fc8d9b7a3f7ac0d192a0b 100644 (file)
@@ -391,6 +391,21 @@ int spl_start_uboot(void)
        return 0;
 }
 
+int k3_r5_falcon_bootmode(void)
+{
+       char *mmcdev = env_get("mmcdev");
+
+       if (!mmcdev)
+               return BOOT_DEVICE_NOBOOT;
+
+       if (strncmp(mmcdev, "0", sizeof("0")) == 0)
+               return BOOT_DEVICE_MMC1;
+       else if (strncmp(mmcdev, "1", sizeof("1")) == 0)
+               return BOOT_DEVICE_MMC2;
+       else
+               return BOOT_DEVICE_NOBOOT;
+}
+
 int k3_r5_falcon_prep(void)
 {
        struct spl_image_loader *loader, *drv;
@@ -402,7 +417,7 @@ int k3_r5_falcon_prep(void)
        memset(&kernel_image, '\0', sizeof(kernel_image));
        drv = ll_entry_start(struct spl_image_loader, spl_image_loader);
        n_ents = ll_entry_count(struct spl_image_loader, spl_image_loader);
-       bootdev.boot_device = spl_boot_device();
+       bootdev.boot_device = k3_r5_falcon_bootmode();
 
        for (loader = drv; loader != drv + n_ents; loader++) {
                if (loader && bootdev.boot_device != loader->boot_device)