From patchwork Tue May 5 12:28:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 245131 List-Id: U-Boot discussion From: peng.fan at nxp.com (Peng Fan) Date: Tue, 5 May 2020 20:28:42 +0800 Subject: [PATCH 06/10] imx8: Select boot device dynamically In-Reply-To: <20200505122846.15992-1-peng.fan@nxp.com> References: <20200505122846.15992-1-peng.fan@nxp.com> Message-ID: <20200505122846.15992-7-peng.fan@nxp.com> From: Ye Li 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 Signed-off-by: Peng Fan --- 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 e03193cb4c..103a29746a 100644 --- a/arch/arm/mach-imx/imx8/cpu.c +++ b/arch/arm/mach-imx/imx8/cpu.c @@ -22,6 +22,7 @@ #include #include #include +#include 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; + } +}