MLK-16361-2 imx8qm/qxp: Use sw_info for USB boot check
authorYe Li <ye.li@nxp.com>
Mon, 4 Sep 2017 02:11:39 +0000 (21:11 -0500)
committerJason Liu <jason.hui.liu@nxp.com>
Thu, 2 Nov 2017 18:37:16 +0000 (02:37 +0800)
The sw_info in handover structure has included the boot device info
provided by SC ROM. We can exploit this info, no need to check the
USB2 PHY PWD register.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
arch/arm/cpu/armv8/imx8/cpu.c
arch/arm/include/asm/arch-imx8/imx-regs.h

index 745bd8b..4b32852 100644 (file)
@@ -631,6 +631,11 @@ enum boot_device get_boot_device(void)
        return boot_dev;
 }
 
+bool is_usb_boot(void)
+{
+       return get_boot_device() == USB_BOOT;
+}
+
 int print_bootinfo(void)
 {
        enum boot_device bt_dev;
index e8a6d7d..910a3d8 100644 (file)
 
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
+#include <stdbool.h>
 
-/*
- * 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)))
+bool is_usb_boot(void);
+#define is_boot_from_usb  is_usb_boot
 #define        disconnect_from_pc(void) writel(0x0, USB_BASE_ADDR + 0x140)
 
 struct usbphy_regs {