From: Ye Li Date: Fri, 17 May 2019 09:36:57 +0000 (-0700) Subject: MLK-19869-1 imx6: Checking serial download booting X-Git-Tag: rel_imx_4.19.35_1.1.0~363 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=50b30746a9aac8785bfe6ea8077c8572b02065c2;p=u-boot.git MLK-19869-1 imx6: Checking serial download booting 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 --- diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 5aca229855..7097625e67 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -1105,7 +1105,11 @@ struct dbg_monitor_regs { * 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 +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__ */ diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h b/arch/arm/include/asm/mach-imx/sys_proto.h index 877f04f6fe..4dbad53422 100644 --- a/arch/arm/include/asm/mach-imx/sys_proto.h +++ b/arch/arm/include/asm/mach-imx/sys_proto.h @@ -57,6 +57,9 @@ #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) diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c index 4538c61d9f..d010f90d68 100644 --- a/arch/arm/mach-imx/mx6/soc.c +++ b/arch/arm/mach-imx/mx6/soc.c @@ -28,6 +28,8 @@ #include #endif +DECLARE_GLOBAL_DATA_PTR; + enum ldo_reg { LDO_ARM, LDO_SOC, @@ -519,8 +521,19 @@ static void imx_set_pcie_phy_power_down(void) } } +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()) {