imx8: Select boot device dynamically
authorYe Li <ye.li@nxp.com>
Tue, 5 May 2020 12:28:42 +0000 (20:28 +0800)
committerStefano Babic <sbabic@denx.de>
Sun, 10 May 2020 18:55:20 +0000 (20:55 +0200)
For fspi build, we will enable both SPL NOR support and SPL SPI
support. SPL will dynamically check the resource owner then
select corresponding boot device.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/imx8/cpu.c

index e03193cb4cad3fb77824fca53718c41749e6cb23..103a29746a657fc1039179ca92f001f279fff5c7 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/armv8/mmu.h>
 #include <asm/setup.h>
 #include <asm/mach-imx/boot_mode.h>
+#include <spl.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -573,3 +574,14 @@ u32 get_cpu_rev(void)
 
        return (id << 12) | rev;
 }
+
+void board_boot_order(u32 *spl_boot_list)
+{
+       spl_boot_list[0] = spl_boot_device();
+
+       if (spl_boot_list[0] == BOOT_DEVICE_SPI) {
+               /* Check whether we own the flexspi0, if not, use NOR boot */
+               if (!sc_rm_is_resource_owned(-1, SC_R_FSPI_0))
+                       spl_boot_list[0] = BOOT_DEVICE_NOR;
+       }
+}