summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx/spl.c
diff options
context:
space:
mode:
authorEran Matityahu <eran.m@variscite.com>2018-03-06 16:38:00 +0200
committerStefano Babic <sbabic@denx.de>2018-03-29 17:33:12 +0200
commit0fe69adc8feacf69aabe44b779737079827d79b4 (patch)
treede4bff992d15ee77b25d08e8e2cd25a8f8e65504 /arch/arm/mach-imx/spl.c
parent03858f8ec6032ec74dadfae6c3849302d8f29a9b (diff)
downloadu-boot-0fe69adc8feacf69aabe44b779737079827d79b4.tar.gz
imx7: spl: Check for Serial Downloader in spl_boot_device
Similarly to imx6, before reading the boot device, first check bmode to see if the serial downloader has been selected explicitly, then check whether the serial downloader has been activated due to unbootable primary boot devices (e.g. empty eMMC). If the serial downloader is activated, return BOOT_DEVICE_BOARD. This allows SPL with SDP support to wait for the U-Boot image to be loaded via the serial download protocol using imx_usb_loader. Signed-off-by: Eran Matityahu <eran.m@variscite.com>
Diffstat (limited to 'arch/arm/mach-imx/spl.c')
-rw-r--r--arch/arm/mach-imx/spl.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index b2521b2101..6fc24630ba 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -101,6 +101,29 @@ u32 spl_boot_device(void)
/* Translate iMX7/MX8M boot device to the SPL boot device enumeration */
u32 spl_boot_device(void)
{
+#if defined(CONFIG_MX7)
+ unsigned int bmode = readl(&src_base->sbmr2);
+
+ /*
+ * Check for BMODE if serial downloader is enabled
+ * BOOT_MODE - see IMX7DRM Table 6-24
+ */
+ if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */
+ return BOOT_DEVICE_BOARD;
+
+ /*
+ * The above method does not detect that the boot ROM used
+ * serial downloader in case the boot ROM decided to use the
+ * serial downloader as a fall back (primary boot source failed).
+ *
+ * Infer that the boot ROM used the USB serial downloader by
+ * checking whether the USB PHY is currently active... This
+ * assumes that SPL did not (yet) initialize the USB PHY...
+ */
+ if (is_boot_from_usb())
+ return BOOT_DEVICE_BOARD;
+#endif
+
enum boot_device boot_device_spl = get_boot_device();
switch (boot_device_spl) {