From 4758cf21988496ac9ad0eb19045cece970f626ff Mon Sep 17 00:00:00 2001 From: Ye Li Date: Tue, 19 Feb 2019 00:07:33 -0800 Subject: [PATCH] MLK-20945-5 imx8: Select boot device dynamically 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 (cherry picked from commit 675cc6031033fbe5e7d8cfe01ebe1dedfd6c1b96) --- arch/arm/mach-imx/imx8/cpu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c index 2c5ba8eb0f..b0260c522f 100644 --- a/arch/arm/mach-imx/imx8/cpu.c +++ b/arch/arm/mach-imx/imx8/cpu.c @@ -30,6 +30,7 @@ #include #include #include +#include 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; + } +} -- 2.17.1