summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJulien Masson <jmasson@baylibre.com>2022-10-17 11:33:21 +0300
committerAnatolij Gustschin <agust@denx.de>2022-10-30 22:01:40 +0300
commita638d9a47c8ebc36ded79726e48b46ededc64e59 (patch)
tree168d6f134c2056137311c9d2329bd708873eaacd /common
parentc830e285f475e580eb45290d54e9d174a57a7d71 (diff)
downloadu-boot-a638d9a47c8ebc36ded79726e48b46ededc64e59.tar.xz
splash: support raw image from MMC
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>
Diffstat (limited to 'common')
-rw-r--r--common/splash.c6
-rw-r--r--common/splash_source.c26
2 files changed, 32 insertions, 0 deletions
diff --git a/common/splash.c b/common/splash.c
index 0e520cc103..5206e35f74 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -40,6 +40,12 @@ static struct splash_location default_splash_locations[] = {
.devpart = "0:1",
},
{
+ .name = "mmc_raw",
+ .storage = SPLASH_STORAGE_MMC,
+ .flags = SPLASH_STORAGE_RAW,
+ .devpart = "0:1",
+ },
+ {
.name = "usb_fs",
.storage = SPLASH_STORAGE_USB,
.flags = SPLASH_STORAGE_FS,
diff --git a/common/splash_source.c b/common/splash_source.c
index 87e55a54f8..68c9fa371b 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -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: