MLK-20945-5 imx8: Select boot device dynamically
authorYe Li <ye.li@nxp.com>
Tue, 19 Feb 2019 08:07:33 +0000 (00:07 -0800)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 11:28:19 +0000 (04:28 -0700)
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>
(cherry picked from commit 675cc6031033fbe5e7d8cfe01ebe1dedfd6c1b96)

arch/arm/mach-imx/imx8/cpu.c

index 2c5ba8e..b0260c5 100644 (file)
@@ -30,6 +30,7 @@
 #include <fdtdec.h>
 #include <generated/version_autogenerated.h>
 #include <asm/mach-imx/imx_vservice.h>
+#include <spl.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -1862,3 +1863,14 @@ int board_imx_lpi2c_bind(struct udevice *dev)
 
        return -ENODEV;
 }
+
+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 (!check_owned_resource(SC_R_FSPI_0))
+                       spl_boot_list[0] = BOOT_DEVICE_NOR;
+       }
+}