public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2 0/2] splash: add more options/support
@ 2022-10-17  8:33 Julien Masson
  2022-10-17  8:33 ` [PATCH v2 1/2] splash: support raw image from MMC Julien Masson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Julien Masson @ 2022-10-17  8:33 UTC (permalink / raw)
  To: u-boot; +Cc: Simon Glass

This patch series add several options/support for splashscreen feature:
- support raw image from MMC
- get devpart from environment variable

With these changes the user has now more options and can change default
configurations through environment variables.

Example: image located in splashscreen partition (MMC as raw)
```
splashsource=mmc_raw
splashdevpart=0#splashscreen
```

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
- rename local var env_splashdevpart_value to devpart

Julien Masson (2):
  splash: support raw image from MMC
  splash: get devpart from environment variable

 common/splash.c        |  6 ++++++
 common/splash_source.c | 31 +++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

-- 
2.37.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] splash: support raw image from MMC
  2022-10-17  8:33 [PATCH v2 0/2] splash: add more options/support Julien Masson
@ 2022-10-17  8:33 ` Julien Masson
  2022-10-18 16:59   ` Simon Glass
  2022-10-17  8:33 ` [PATCH v2 2/2] splash: get devpart from environment variable Julien Masson
  2022-10-31 13:30 ` [PATCH v2 0/2] splash: add more options/support Anatolij Gustschin
  2 siblings, 1 reply; 6+ messages in thread
From: Julien Masson @ 2022-10-17  8:33 UTC (permalink / raw)
  To: u-boot; +Cc: Simon Glass

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] splash: get devpart from environment variable
  2022-10-17  8:33 [PATCH v2 0/2] splash: add more options/support Julien Masson
  2022-10-17  8:33 ` [PATCH v2 1/2] splash: support raw image from MMC Julien Masson
@ 2022-10-17  8:33 ` 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
  2 siblings, 1 reply; 6+ messages in thread
From: Julien Masson @ 2022-10-17  8:33 UTC (permalink / raw)
  To: u-boot; +Cc: Simon Glass

By default several types of splash locations are supported and the
user can select one of them through environment var (splashsource).

However the devpart is still hardcoded and we cannot change it from
the environment.

This patch add the support of "splashdevpart" which allow the user to
set the devpart though this environment variable.

Example: image located in splashscreen partition (MMC as raw)
```
splashsource=mmc_raw
splashdevpart=0#splashscreen
```

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

Changes in v2:
- rename local var env_splashdevpart_value to devpart

 common/splash_source.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/splash_source.c b/common/splash_source.c
index 68c9fa371b..a260137619 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -448,6 +448,7 @@ int splash_source_load(struct splash_location *locations, uint size)
 {
 	struct splash_location *splash_location;
 	char *env_splashimage_value;
+	char *devpart;
 	u32 bmp_load_addr;
 
 	env_splashimage_value = env_get("splashimage");
@@ -464,6 +465,10 @@ int splash_source_load(struct splash_location *locations, uint size)
 	if (!splash_location)
 		return -EINVAL;
 
+	devpart = env_get("splashdevpart");
+	if (devpart)
+		splash_location->devpart = devpart;
+
 	if (splash_location->flags == SPLASH_STORAGE_RAW)
 		return splash_load_raw(splash_location, bmp_load_addr);
 	else if (splash_location->flags == SPLASH_STORAGE_FS)
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] splash: support raw image from MMC
  2022-10-17  8:33 ` [PATCH v2 1/2] splash: support raw image from MMC Julien Masson
@ 2022-10-18 16:59   ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2022-10-18 16:59 UTC (permalink / raw)
  To: Julien Masson; +Cc: u-boot

On Mon, 17 Oct 2022 at 02:33, Julien Masson <jmasson@baylibre.com> wrote:
>
> 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(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] splash: get devpart from environment variable
  2022-10-17  8:33 ` [PATCH v2 2/2] splash: get devpart from environment variable Julien Masson
@ 2022-10-18 16:59   ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2022-10-18 16:59 UTC (permalink / raw)
  To: Julien Masson; +Cc: u-boot

On Mon, 17 Oct 2022 at 02:33, Julien Masson <jmasson@baylibre.com> wrote:
>
> By default several types of splash locations are supported and the
> user can select one of them through environment var (splashsource).
>
> However the devpart is still hardcoded and we cannot change it from
> the environment.
>
> This patch add the support of "splashdevpart" which allow the user to
> set the devpart though this environment variable.
>
> Example: image located in splashscreen partition (MMC as raw)
> ```
> splashsource=mmc_raw
> splashdevpart=0#splashscreen
> ```
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Julien Masson <jmasson@baylibre.com>
> ---
>
> Changes in v2:
> - rename local var env_splashdevpart_value to devpart
>
>  common/splash_source.c | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/2] splash: add more options/support
  2022-10-17  8:33 [PATCH v2 0/2] splash: add more options/support Julien Masson
  2022-10-17  8:33 ` [PATCH v2 1/2] splash: support raw image from MMC Julien Masson
  2022-10-17  8:33 ` [PATCH v2 2/2] splash: get devpart from environment variable Julien Masson
@ 2022-10-31 13:30 ` Anatolij Gustschin
  2 siblings, 0 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2022-10-31 13:30 UTC (permalink / raw)
  To: Julien Masson; +Cc: u-boot, Simon Glass

On Mon, 17 Oct 2022 10:33:18 +0200
Julien Masson jmasson@baylibre.com wrote:
...
> 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
> - rename local var env_splashdevpart_value to devpart
> 
> Julien Masson (2):
>   splash: support raw image from MMC
>   splash: get devpart from environment variable
> 
>  common/splash.c        |  6 ++++++
>  common/splash_source.c | 31 +++++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+)
> 

Applied to u-boot-video/master, thanks!

--
Anatolij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-31 13:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-17  8:33 [PATCH v2 0/2] splash: add more options/support Julien Masson
2022-10-17  8:33 ` [PATCH v2 1/2] splash: support raw image from MMC Julien Masson
2022-10-18 16:59   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox