From: Julien Masson <jmasson@baylibre.com>
To: u-boot@lists.denx.de
Cc: Simon Glass <sjg@chromium.org>
Subject: [RESEND PATCH 1/2] splash: support raw image from MMC
Date: Wed, 12 Oct 2022 13:38:53 +0200 [thread overview]
Message-ID: <878rllclv6.fsf@baylibre.com> (raw)
In-Reply-To: <87a661clvc.fsf@baylibre.com>
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>
---
common/splash.c | 6 ++++++
common/splash_source.c | 29 +++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/common/splash.c b/common/splash.c
index 0e520cc103..5206e35f74 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -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,
diff --git a/common/splash_source.c b/common/splash_source.c
index 87e55a54f8..b4bf6f1336 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -65,6 +65,33 @@ static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size)
}
#endif
+#ifdef CONFIG_CMD_MMC
+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;
+
+ 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 : -EINVAL;
+}
+#else
+static int splash_mmc_read_raw(u32 bmp_load_addr, int offset, size_t read_size)
+{
+ debug("%s: mmc support not available\n", __func__);
+ return -ENOSYS;
+}
+#endif
+
static int splash_storage_read_raw(struct splash_location *location,
u32 bmp_load_addr, size_t read_size)
{
@@ -75,6 +102,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:
--
2.37.3
next prev parent reply other threads:[~2022-10-12 11:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 11:38 [RESEND PATCH 0/2] splash: add more options/support Julien Masson
2022-10-12 11:38 ` Julien Masson [this message]
2022-10-12 12:59 ` [RESEND PATCH 1/2] splash: support raw image from MMC Simon Glass
2022-10-13 16:08 ` Julien Masson
2022-10-14 15:55 ` Simon Glass
2022-10-12 11:38 ` [RESEND PATCH 2/2] splash: get devpart from environment variable Julien Masson
2022-10-12 12:59 ` Simon Glass
2022-10-13 15:51 ` Julien Masson
2022-10-14 15:55 ` Simon Glass
2022-10-17 7:50 ` Julien Masson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878rllclv6.fsf@baylibre.com \
--to=jmasson@baylibre.com \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.