Re: [U-Boot] [PATCH v1 2/2] imx_common: detect USB serial downloader reliably

2017-09-05 Thread Fabio Estevam
On Mon, Sep 4, 2017 at 10:21 PM, Stefan Agner  wrote:
> From: Stefan Agner 
>
> 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 
> Acked-by: Marcel Ziswiler 

This allows Serial Download Protocol to work on imx6q sabresd:

Tested-by: Fabio Estevam 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 2/2] imx_common: detect USB serial downloader reliably

2017-09-04 Thread Stefan Agner
From: Stefan Agner 

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 
Acked-by: Marcel Ziswiler 
---

 arch/arm/mach-imx/spl.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 258578ac25..8e8e2f755b 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -31,6 +31,10 @@ u32 spl_boot_device(void)
if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */
return BOOT_DEVICE_BOARD;
 
+   /* Check USB state in case we entered serial downloader as fallback */
+   if (is_boot_from_usb())
+   return BOOT_DEVICE_BOARD;
+
/* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
switch ((reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT) {
 /* EIM: See 8.5.1, Table 8-9 */
-- 
2.14.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot