]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - arch/arm/mach-imx/spl.c
Merge branch 'rmobile' of git://git.denx.de/u-boot-sh
[people/ms/u-boot.git] / arch / arm / mach-imx / spl.c
index 75698c48ea608afcadbec6b0167a960677a88ec5..fb94c969ecc6c4fb5d4873545a20ff4f22faeb4b 100644 (file)
@@ -14,6 +14,9 @@
 #include <asm/spl.h>
 #include <spl.h>
 #include <asm/mach-imx/hab.h>
+#include <g_dnl.h>
+
+DECLARE_GLOBAL_DATA_PTR;
 
 #if defined(CONFIG_MX6)
 /* determine boot device from SRC_SBMR1 (BOOT_CFG[4:1]) or SRC_GPR9 register */
@@ -27,7 +30,19 @@ u32 spl_boot_device(void)
         * BOOT_MODE - see IMX6DQRM Table 8-1
         */
        if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */
-               return BOOT_DEVICE_UART;
+               return BOOT_DEVICE_BOARD;
+
+       /*
+        * The above method does not detect that the boot ROM used
+        * serial downloader in case the boot ROM decided to use the
+        * serial downloader as a fall back (primary boot source failed).
+        *
+        * Infer that the boot ROM used the USB serial downloader by
+        * checking whether the USB PHY is currently active... This
+        * assumes that SPL did not (yet) initialize the USB PHY...
+        */
+       if (is_usbotg_phy_active())
+               return BOOT_DEVICE_BOARD;
 
        /* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
        switch ((reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT) {
@@ -42,11 +57,13 @@ u32 spl_boot_device(void)
                break;
                }
        /* Reserved: Used to force Serial Downloader */
-       case IMX6_BMODE_UART:
-               return BOOT_DEVICE_UART;
+       case IMX6_BMODE_RESERVED:
+               return BOOT_DEVICE_BOARD;
        /* SATA: See 8.5.4, Table 8-20 */
+#if !defined(CONFIG_MX6UL) && !defined(CONFIG_MX6ULL)
        case IMX6_BMODE_SATA:
                return BOOT_DEVICE_SATA;
+#endif
        /* Serial ROM: See 8.5.5.1, Table 8-22 */
        case IMX6_BMODE_SERIAL_ROM:
                /* BOOT_CFG4[2:0] */
@@ -78,6 +95,15 @@ u32 spl_boot_device(void)
        }
        return BOOT_DEVICE_NONE;
 }
+
+#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
 #endif
 
 #if defined(CONFIG_SPL_MMC_SUPPORT)
@@ -126,3 +152,13 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 }
 
 #endif
+
+#if defined(CONFIG_MX6) && defined(CONFIG_SPL_OS_BOOT)
+int dram_init_banksize(void)
+{
+       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+       gd->bd->bi_dram[0].size = imx_ddr_size();
+
+       return 0;
+}
+#endif