[U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

Stefano Babic sbabic at denx.de
Tue Sep 5 11:16:32 UTC 2017


Hi Stefan,

On 05/09/2017 03:21, Stefan Agner wrote:
> From: Stefan Agner <stefan.agner at toradex.com>
> 
> This macro allows to detect whether the boot ROM initialized USB
> already (serial downloader). This is helpful to reliably detect
> if the system has been recovered via USB serial downloader.
> 
> Signed-off-by: Stefan Agner <stefan.agner at toradex.com>
> Acked-by: Marcel Ziswiler <marcel.ziswiler at toradex.com>
> ---
> Hi Stefano,
> 
> I noted already in my initial post that detection of serial
> downloader mode is somewhat brittle:
> https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
> 
> This came up quite fast now also for other boards:
> https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
> 
> We use this patches since quite some time. Also NXP uses this
> detection method to start their mfgr tools...

Then it seems to be an "undocumented feature" rather a hack.

> Altough a hack,
> maybe we should still add it upstream?

If we can detect at runtime as this patch is thought to do, it is really
an improvement and I will glad to merge it.

Maybe we get some further info from our "insider" (Fabio, Peng). It will
be very interesting to know if we can apply this to all spectrum from
i.MX6, or if there is some MX6 variant where the Bootrom is doing
something different.

Regards,
Stefano

> 
> --
> Stefan
> 
> 
>  arch/arm/include/asm/arch-mx6/imx-regs.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
> index 86e267087a..895ef4de83 100644
> --- a/arch/arm/include/asm/arch-mx6/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
> @@ -985,5 +985,12 @@ struct pwm_regs {
>  	u32	pr;
>  	u32	cnr;
>  };
> +
> +/*
> + * 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)))
> +
>  #endif /* __ASSEMBLER__*/
>  #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
> 


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list