
Hi Stefan,
I hate to be fussy about this, but I don't think I saw a reply to my earlier comment about the term "USB PHY".
https://lists.denx.de/pipermail/u-boot/2017-September/305123.html
Since i.MX6 SoCs have USB **Host** Phy's as well as the USB OTG Phy, this patch is a bit misleading.
There's no reference to OTG anywhere in this or patch 2.
On 09/12/2017 04:54 PM, Stefan Agner wrote:
From: Stefan Agner stefan.agner@toradex.com
This macro allows to detect whether the USB PHY is active. This is helpful to detect if the boot ROM has previously started the USB serial downloader.
The idea is taken from the mfgtool support in the NXP U-Boot: http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/commit/?h=imx_v2016....
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com Tested-by: Fabio Estevam fabio.estevam@nxp.com
Changes in v3: None Changes in v2:
Move macro to sys_proto.h
Renamed from is_boot_from_usb() to is_usbphy_active()
Use defines for register offset and field
Remove tab after define
Remove comment since the actual "magic" is happening and documented at usage side
arch/arm/include/asm/arch-mx6/sys_proto.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h index 14f5d948c9..9d4b1d6768 100644 --- a/arch/arm/include/asm/arch-mx6/sys_proto.h +++ b/arch/arm/include/asm/arch-mx6/sys_proto.h @@ -6,3 +6,10 @@ */
#include <asm/mach-imx/sys_proto.h>
+#define USBPHY_PWD 0x00000000
+#define USBPHY_PWD_RXPWDRX (1 << 20) /* receiver block power down */
+#define is_usbphy_active(void) (!(readl(USB_PHY0_BASE_ADDR + USBPHY_PWD) & \
USBPHY_PWD_RXPWDRX))
Regards,
Eric