From 06c86a100cadabc9bfe75465d99d0c705958d9a2 Mon Sep 17 00:00:00 2001 From: Ye Li Date: Fri, 17 May 2019 02:41:50 -0700 Subject: [PATCH] MLK-20510-2 mx7d: Align implementation of is_boot_from_usb with mx6 Because the ROM info on iMX7D does not set device type to USB when booting from serial download mode, we have to use the mechanism on mx6 to implement the is_boot_from_usb. The original implementation is checking USB controller register, it can't work correctly after any USB functionality is run in u-boot. Signed-off-by: Ye Li (cherry picked from commit 4934c765c6f1c9c997a28aa79f08c14fc4e91202) (cherry picked from commit 4713c35ab51842524e4d53286dd2620c8dd9fdec) --- arch/arm/include/asm/arch-mx7/imx-regs.h | 6 +++++- arch/arm/mach-imx/mx7/soc.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arch-mx7/imx-regs.h b/arch/arm/include/asm/arch-mx7/imx-regs.h index 7e830c4f06..a539e2941e 100644 --- a/arch/arm/include/asm/arch-mx7/imx-regs.h +++ b/arch/arm/include/asm/arch-mx7/imx-regs.h @@ -1173,10 +1173,14 @@ extern void check_cpu_temperature(void); extern void pcie_power_up(void); extern void pcie_power_off(void); +#include +bool is_usb_boot(void); +#define is_boot_from_usb is_usb_boot + /* 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(USBOTG1_IPS_BASE_ADDR + 0x158) || \ +#define is_usbotg_boot_enabled(void) (readl(USBOTG1_IPS_BASE_ADDR + 0x158) || \ readl(USBOTG2_IPS_BASE_ADDR + 0x158)) #define disconnect_from_pc(void) writel(0x0, USBOTG1_IPS_BASE_ADDR + 0x140) diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c index 378ee2b584..ada49b9e40 100644 --- a/arch/arm/mach-imx/mx7/soc.c +++ b/arch/arm/mach-imx/mx7/soc.c @@ -333,8 +333,19 @@ static void set_epdc_qos(void) writel(0xe080, IOMUXC_GPR_BASE_ADDR + 0x0034); /* EPDC AW/AR CACHE ENABLE */ } +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_usbotg_boot_enabled()) + gd->flags |= GD_FLG_ARCH_IMX_USB_BOOT; + init_aips(); init_csu(); -- 2.17.1