]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
splash: support raw image from MMC
authorJulien Masson <jmasson@baylibre.com>
Mon, 17 Oct 2022 08:33:21 +0000 (10:33 +0200)
committerAnatolij Gustschin <agust@denx.de>
Sun, 30 Oct 2022 19:01:40 +0000 (20:01 +0100)
The user has now the choice to specify the splash location in the MMC
as a raw storage.

Signed-off-by: Julien Masson <jmasson@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/splash.c
common/splash_source.c

index 0e520cc1030df205baf7af50d19c1e2e6fcef43c..5206e35f74d09b2f4620e7594acea1ac46ff097f 100644 (file)
@@ -39,6 +39,12 @@ static struct splash_location default_splash_locations[] = {
                .flags = SPLASH_STORAGE_FS,
                .devpart = "0:1",
        },
+       {
+               .name = "mmc_raw",
+               .storage = SPLASH_STORAGE_MMC,
+               .flags = SPLASH_STORAGE_RAW,
+               .devpart = "0:1",
+       },
        {
                .name = "usb_fs",
                .storage = SPLASH_STORAGE_USB,
index 87e55a54f8c6e7de4dea223017a0dbb0e6f6618e..68c9fa371b72ca0e863c750b48dfedf471be8266 100644 (file)
@@ -65,6 +65,30 @@ static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size)
 }
 #endif
 
+static int splash_mmc_read_raw(u32 bmp_load_addr, struct splash_location *location,
+                              size_t read_size)
+{
+       struct disk_partition partition;
+       struct blk_desc *desc;
+       lbaint_t blkcnt;
+       int ret, n;
+
+       if (!IS_ENABLED(CONFIG_CMD_MMC)) {
+               debug("%s: mmc support not available\n", __func__);
+               return -ENOSYS;
+       }
+
+       ret = part_get_info_by_dev_and_name_or_num("mmc", location->devpart, &desc,
+                                                  &partition, 1);
+       if (ret < 0)
+               return ret;
+
+       blkcnt = DIV_ROUND_UP(read_size, partition.blksz);
+       n = blk_dread(desc, partition.start, blkcnt, (void *)(uintptr_t)bmp_load_addr);
+
+       return (n == blkcnt) ? 0 : -EIO;
+}
+
 static int splash_storage_read_raw(struct splash_location *location,
                               u32 bmp_load_addr, size_t read_size)
 {
@@ -75,6 +99,8 @@ static int splash_storage_read_raw(struct splash_location *location,
 
        offset = location->offset;
        switch (location->storage) {
+       case SPLASH_STORAGE_MMC:
+               return splash_mmc_read_raw(bmp_load_addr, location, read_size);
        case SPLASH_STORAGE_NAND:
                return splash_nand_read_raw(bmp_load_addr, offset, read_size);
        case SPLASH_STORAGE_SF: