Commit 006b18a5c50cd3141d9aeb7e19f5675f7a1e974d

Authored by Ye Li
1 parent 4112fa4620

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 <ye.li@nxp.com>

Showing 2 changed files with 16 additions and 1 deletions Side-by-side Diff

arch/arm/include/asm/arch-mx7/imx-regs.h
... ... @@ -1207,10 +1207,14 @@
1207 1207 extern void pcie_power_up(void);
1208 1208 extern void pcie_power_off(void);
1209 1209  
  1210 +#include <stdbool.h>
  1211 +bool is_usb_boot(void);
  1212 +#define is_boot_from_usb is_usb_boot
  1213 +
1210 1214 /* If ROM fail back to USB recover mode, USBPH0_PWD will be clear to use USB
1211 1215 * If boot from the other mode, USB0_PWD will keep reset value
1212 1216 */
1213   -#define is_boot_from_usb(void) (readl(USBOTG1_IPS_BASE_ADDR + 0x158) || \
  1217 +#define is_usbotg_boot_enabled(void) (readl(USBOTG1_IPS_BASE_ADDR + 0x158) || \
1214 1218 readl(USBOTG2_IPS_BASE_ADDR + 0x158))
1215 1219 #define disconnect_from_pc(void) writel(0x0, USBOTG1_IPS_BASE_ADDR + 0x140)
1216 1220  
arch/arm/mach-imx/mx7/soc.c
... ... @@ -190,8 +190,19 @@
190 190 writel(0xe080, IOMUXC_GPR_BASE_ADDR + 0x0034); /* EPDC AW/AR CACHE ENABLE */
191 191 }
192 192  
  193 +bool is_usb_boot(void)
  194 +{
  195 + if (gd->flags & GD_FLG_ARCH_IMX_USB_BOOT)
  196 + return true;
  197 +
  198 + return false;
  199 +}
  200 +
193 201 int arch_cpu_init(void)
194 202 {
  203 + if (is_usbotg_boot_enabled())
  204 + gd->flags |= GD_FLG_ARCH_IMX_USB_BOOT;
  205 +
195 206 init_aips();
196 207  
197 208 init_csu();