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

Stefan Agner stefan at agner.ch
Wed May 30 17:01:45 UTC 2018


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>
---

 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 431439218d..4f01b20aed 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -996,5 +996,12 @@ struct pwm_regs {
 	u32	pr;
 	u32	cnr;
 };
+
+/*
+ * If ROM fail 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__ */
-- 
2.17.0



More information about the U-Boot mailing list