summaryrefslogtreecommitdiff
path: root/board/kontron/sl-mx6ul/spl.c
diff options
context:
space:
mode:
authorFrieder Schrempf <frieder.schrempf@kontron.de>2022-08-23 17:29:13 +0300
committerStefano Babic <sbabic@denx.de>2022-10-20 18:35:51 +0300
commit93935acc6f1d5b928f8552e767638e94a82793da (patch)
tree221602edf0fe35c9bc35acc894a0e0adf80e2d12 /board/kontron/sl-mx6ul/spl.c
parent234b3be98efe21d04f623b0a67eead321a3da6c1 (diff)
downloadu-boot-93935acc6f1d5b928f8552e767638e94a82793da.tar.xz
imx: imx6ul: kontron-sl-mx6ul: Select correct boot and env device
Instead of checking both, SPI NOR and MMC for loading U-Boot proper and the environment, implement a way to detect the actual boot device even if the BootROM doesn't report it and we can't rely solely on the fuse settings, as by default we use MMC as primary boot device and boot from SPI NOR via the secondary fallback device (EEPROM Recovery Mode). Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Diffstat (limited to 'board/kontron/sl-mx6ul/spl.c')
-rw-r--r--board/kontron/sl-mx6ul/spl.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/board/kontron/sl-mx6ul/spl.c b/board/kontron/sl-mx6ul/spl.c
index 12b0352146..ba6915c898 100644
--- a/board/kontron/sl-mx6ul/spl.c
+++ b/board/kontron/sl-mx6ul/spl.c
@@ -17,6 +17,7 @@
#include <linux/sizes.h>
#include <linux/errno.h>
#include <mmc.h>
+#include <sl-mx6ul-common.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -339,26 +340,30 @@ void board_boot_order(u32 *spl_boot_list)
/*
* The default boot fuse settings use the SD card (MMC1) as primary
- * boot device, but allow SPI NOR as a fallback boot device.
- * We can't detect the fallback case and spl_boot_device() will return
- * BOOT_DEVICE_MMC1 despite the actual boot device being SPI NOR.
- * Therefore we try to load U-Boot proper vom SPI NOR after loading
- * from MMC has failed.
+ * boot device, but allow SPI NOR as a fallback boot device. There
+ * is no proper way to detect if the fallback was used. Therefore
+ * we read the ECSPI2_CONREG register and see if it differs from the
+ * reset value 0x0. If that's the case we can assume that the BootROM
+ * has successfully probed the SPI NOR.
*/
- spl_boot_list[0] = bootdev;
-
switch (bootdev) {
case BOOT_DEVICE_MMC1:
case BOOT_DEVICE_MMC2:
- spl_boot_list[1] = BOOT_DEVICE_SPI;
+ if (sl_mx6ul_is_spi_nor_boot()) {
+ spl_boot_list[0] = BOOT_DEVICE_SPI;
+ return;
+ }
break;
}
+
+ spl_boot_list[0] = bootdev;
}
int board_early_init_f(void)
{
setup_iomux_uart();
- setup_spi();
+ if (sl_mx6ul_is_spi_nor_boot())
+ setup_spi();
return 0;
}