From: Julien Masson <jmasson@baylibre.com>
To: u-boot@lists.denx.de
Cc: Simon Glass <sjg@chromium.org>
Subject: [PATCH v2 1/2] splash: support raw image from MMC
Date: Mon, 17 Oct 2022 10:33:21 +0200 [thread overview]
Message-ID: <87edv66e9a.fsf@baylibre.com> (raw)
In-Reply-To: <87fsfm6e9d.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>
---
Changes in v2:
- splash_mmc_read_raw: return -EIO in case of errors
- splash_mmc_read_raw: use IS_ENABLED(CONFIG_CMD_MMC) instead of #ifdef
common/splash.c | 6 ++++++
common/splash_source.c | 26 ++++++++++++++++++++++++++
2 files changed, 32 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..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:
--
2.37.3
next prev parent reply other threads:[~2022-10-17 8:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 8:33 [PATCH v2 0/2] splash: add more options/support Julien Masson
2022-10-17 8:33 ` Julien Masson [this message]
2022-10-18 16:59 ` [PATCH v2 1/2] splash: support raw image from MMC Simon Glass
2022-10-17 8:33 ` [PATCH v2 2/2] splash: get devpart from environment variable Julien Masson
2022-10-18 16:59 ` Simon Glass
2022-10-31 13:30 ` [PATCH v2 0/2] splash: add more options/support Anatolij Gustschin
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=87edv66e9a.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.