]> git.sur5r.net Git - u-boot/blobdiff - common/splash_source.c
spi: fsl_qspi: Fix issues on arm64
[u-boot] / common / splash_source.c
index 7de8695375d016cb7cc7db3f29fef438c90eaf2b..a09dd4b46eb643ad7ceaf0cbd52f282fc486fc19 100644 (file)
@@ -12,6 +12,8 @@
 #include <splash.h>
 #include <spi_flash.h>
 #include <spi.h>
+#include <usb.h>
+#include <sata.h>
 #include <bmp_layout.h>
 #include <fs.h>
 
@@ -112,6 +114,12 @@ static int splash_select_fs_dev(struct splash_location *location)
        case SPLASH_STORAGE_MMC:
                res = fs_set_blk_dev("mmc", location->devpart, FS_TYPE_ANY);
                break;
+       case SPLASH_STORAGE_USB:
+               res = fs_set_blk_dev("usb", location->devpart, FS_TYPE_ANY);
+               break;
+       case SPLASH_STORAGE_SATA:
+               res = fs_set_blk_dev("sata", location->devpart, FS_TYPE_ANY);
+               break;
        default:
                printf("Error: unsupported location storage.\n");
                return -ENODEV;
@@ -123,11 +131,43 @@ static int splash_select_fs_dev(struct splash_location *location)
        return res;
 }
 
+#ifdef CONFIG_USB_STORAGE
+static int splash_init_usb(void)
+{
+       int err;
+
+       err = usb_init();
+       if (err)
+               return err;
+
+       return usb_stor_scan(1) < 0 ? -ENODEV : 0;
+}
+#else
+static inline int splash_init_usb(void)
+{
+       printf("Cannot load splash image: no USB support\n");
+       return -ENOSYS;
+}
+#endif
+
+#ifdef CONFIG_CMD_SATA
+static int splash_init_sata(void)
+{
+       return sata_initialize();
+}
+#else
+static inline int splash_init_sata(void)
+{
+       printf("Cannot load splash image: no SATA support\n");
+       return -ENOSYS;
+}
+#endif
+
 #define SPLASH_SOURCE_DEFAULT_FILE_NAME                "splash.bmp"
 
 static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr)
 {
-       int res;
+       int res = 0;
        loff_t bmp_size;
        char *splash_file;
 
@@ -135,6 +175,15 @@ static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr)
        if (!splash_file)
                splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;
 
+       if (location->storage == SPLASH_STORAGE_USB)
+               res = splash_init_usb();
+
+       if (location->storage == SPLASH_STORAGE_SATA)
+               res = splash_init_sata();
+
+       if (res)
+               return res;
+
        res = splash_select_fs_dev(location);
        if (res)
                return res;