Merge git://git.denx.de/u-boot-fsl-qoriq
[oweals/u-boot.git] / arch / arm / mach-imx / spl.c
index 82ea6b85d6468c8cc1d82dd3b4bfc3f066227f2d..d0d1b73aa638bd12130e380b47a086e6ccaf8d55 100644 (file)
@@ -14,6 +14,8 @@
 #include <asm/spl.h>
 #include <spl.h>
 #include <asm/mach-imx/hab.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <g_dnl.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -94,6 +96,35 @@ u32 spl_boot_device(void)
        }
        return BOOT_DEVICE_NONE;
 }
+
+#elif defined(CONFIG_MX7)
+/* Translate iMX7 boot device to the SPL boot device enumeration */
+u32 spl_boot_device(void)
+{
+       enum boot_device boot_device_spl = get_boot_device();
+
+       switch (boot_device_spl) {
+       case SD1_BOOT:
+       case MMC1_BOOT:
+               return BOOT_DEVICE_MMC1;
+       case SD2_BOOT:
+       case MMC2_BOOT:
+               return BOOT_DEVICE_MMC2;
+       case SPI_NOR_BOOT:
+               return BOOT_DEVICE_SPI;
+       default:
+               return BOOT_DEVICE_NONE;
+       }
+}
+#endif /* CONFIG_MX6 || CONFIG_MX7 */
+
+#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+       put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM + 0xfff, &dev->idProduct);
+
+       return 0;
+}
 #endif
 
 #if defined(CONFIG_SPL_MMC_SUPPORT)