We introduce a new arch-specific flag GD_FLG_ARCH_IMX_USB_BOOT to indicate if it is
USB boot. We check the USB PHY PWD bit at early of boot stage then set that flag
in global variable. So any following calling of is_boot_from_usb will return
correct value.
Signed-off-by: Ye Li <ye.li@nxp.com>
* 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)))
+#include <stdbool.h>
+bool is_usb_boot(void);
+#define is_boot_from_usb is_usb_boot
+#define is_usbphy_power_on(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
+#define disconnect_from_pc(void) writel(0x0, OTG_BASE_ADDR + 0x140)
#endif /* __ASSEMBLER__*/
#endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
#define is_imx8qm() (is_cpu_type(MXC_CPU_IMX8QM))
#define is_imx8qxp() (is_cpu_type(MXC_CPU_IMX8QXP))
+ /* gd->flags reserves high 16 bits for arch-specific flags */
+#define GD_FLG_ARCH_IMX_USB_BOOT 0x80000000 /* Only used for MX6/7, If set, the u-boot is booting from USB serial download */
+
#ifdef CONFIG_MX6
#define IMX6_SRC_GPR10_BMODE BIT(28)
#include <fsl_caam.h>
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
enum ldo_reg {
LDO_ARM,
LDO_SOC,
}
}
+bool is_usb_boot(void)
+{
+ if (gd->flags & GD_FLG_ARCH_IMX_USB_BOOT)
+ return true;
+
+ return false;
+}
+
int arch_cpu_init(void)
{
+ if (is_usbphy_power_on())
+ gd->flags |= GD_FLG_ARCH_IMX_USB_BOOT;
+
if (!is_mx6sl() && !is_mx6sx()
&& !is_mx6ul() && !is_mx6ull()
&& !is_mx6sll()) {