summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2017-08-08 18:14:38 -0700
committerStefan Agner <stefan.agner@toradex.com>2017-08-31 19:57:38 -0700
commit80c3bd6c2750c3c2843537f015c0d675b1b74a58 (patch)
treeccd96c2ea1cf6d7a47a551763a8394246b5037c2
parent0d069117614b590848b490e348488362443c5547 (diff)
imx_common: detect USB serial downloader reliably
The current mechanism using SCR/GPR registers work well when the serial downloader boot mode has been selected explicitly (either via boot mode pins or using bmode command). However, in case the system entered boot ROM due to unbootable primary boot devices (e.g. empty eMMC), the SPL fails to detect that it has been downloaded through serial loader and tries to continue booting from eMMC: Trying to boot from MMC1 mmc_load_image_raw_sector: mmc block read error SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ### The only known way to reliably detect USB serial downloader is by checking the USB PHY receiver block power state... Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r--arch/arm/imx-common/spl.c8
-rw-r--r--arch/arm/include/asm/arch-mx6/imx-regs.h2
2 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c
index 29f8fb613a..60d013611c 100644
--- a/arch/arm/imx-common/spl.c
+++ b/arch/arm/imx-common/spl.c
@@ -26,9 +26,13 @@ u32 spl_boot_device(void)
* Check for BMODE if serial downloader is enabled
* BOOT_MODE - see IMX6DQRM Table 8-1
*/
- if ((((bmode >> 24) & 0x03) == 0x01) || /* Serial Downloader */
- (gpr10_boot && (reg == 1)))
+ if (((bmode >> 24) & 0x03) == 0x01)
return BOOT_DEVICE_SDP;
+
+ /* Check USB state in case we entered serial downloader as fallback */
+ if (is_boot_from_usb())
+ return BOOT_DEVICE_SDP;
+
/* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
switch ((reg & 0x000000FF) >> 4) {
/* EIM: See 8.5.1, Table 8-9 */
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 4b8d27371f..1bd007c8f3 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -962,7 +962,7 @@ struct pwm_regs {
};
/*
- * If ROM fail back to USB recover mode, USBPH0_PWD will be clear to use USB
+ * If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB
* If boot from the other mode, USB0_PWD will keep reset value
*/
#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))