From: LI Qingwu <Qing-wu.Li@xxxxxxxxxxxxxxxxxxxxxxx> The current code override the serial download boot mode which is set in case the BootROM decide to fallback due to an empty QSPI. This lead into the wrong boot source detection and barebox will try to download the rest of the image via QSPI instead of using the serial download mode. Fix this by reorder the detection, first try the generic bootsource and if this fails try to detect the QSPI boot mode. This is also how u-boot does it in the first place. Fixes: 7b55ababb40f ("ARM: i.MX8MM bootsource: fix QSPI boot source detection") Signed-off-by: LI Qingwu <Qing-wu.Li@xxxxxxxxxxxxxxxxxxxxxxx> Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> --- arch/arm/mach-imx/boot.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c index c6134f35b659..153da835606c 100644 --- a/arch/arm/mach-imx/boot.c +++ b/arch/arm/mach-imx/boot.c @@ -711,15 +711,18 @@ void imx8mm_get_boot_source(enum bootsource *src, int *instance) return; } + addr = IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0; + + __imx7_get_boot_source(src, instance, addr, sbmr2); + + if (*src != BOOTSOURCE_UNKNOWN) + return; + if (imx8mm_bootsource_qspi(sbmr1)) { *src = BOOTSOURCE_SPI; /* Really: qspi */ *instance = 0; return; } - - addr = IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0; - - __imx7_get_boot_source(src, instance, addr, sbmr2); } void imx8mm_boot_save_loc(void) -- 2.39.2