All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spl: add support for custom boot method names
@ 2022-01-13 15:22 Heiko Thiery
  2022-01-13 17:20 ` Michael Walle
  2022-01-16 19:32 ` Michael Walle
  0 siblings, 2 replies; 3+ messages in thread
From: Heiko Thiery @ 2022-01-13 15:22 UTC (permalink / raw)
  To: u-boot; +Cc: Michael Walle, Heiko Thiery

Currently the names MMC1, MMC2 and MMC2_2 are output in the SPL. To
achieve more userbility here the name of the boot source can be returned.
E.g. for "MMC1" -> "eMMC" or "MMC2" -> "SD card".

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
 common/spl/spl.c | 5 +++++
 include/spl.h    | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 4c101ec5d3..b7b53f352e 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -174,6 +174,11 @@ __weak void spl_board_prepare_for_optee(void *fdt)
 {
 }
 
+__weak const char *spl_board_loader_name(u32 boot_device)
+{
+	return NULL;
+}
+
 #if CONFIG_IS_ENABLED(OPTEE_IMAGE)
 __weak void __noreturn jump_to_image_optee(struct spl_image_info *spl_image)
 {
diff --git a/include/spl.h b/include/spl.h
index 0af0ee3003..a7f17a3837 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -458,6 +458,7 @@ void spl_board_prepare_for_optee(void *fdt);
 void spl_board_prepare_for_boot(void);
 int spl_board_ubi_load_image(u32 boot_device);
 int spl_board_boot_device(u32 boot_device);
+const char *spl_board_loader_name(u32 boot_device);
 
 /**
  * jump_to_image_linux() - Jump to a Linux kernel from SPL
@@ -541,7 +542,9 @@ struct spl_image_loader {
 static inline const char *spl_loader_name(const struct spl_image_loader *loader)
 {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
-	return loader->name;
+	const char *name;
+	name = spl_board_loader_name(loader->boot_device);
+	return name ?: loader->name;
 #else
 	return NULL;
 #endif
-- 
2.30.2


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

* Re: [PATCH] spl: add support for custom boot method names
  2022-01-13 15:22 [PATCH] spl: add support for custom boot method names Heiko Thiery
@ 2022-01-13 17:20 ` Michael Walle
  2022-01-16 19:32 ` Michael Walle
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Walle @ 2022-01-13 17:20 UTC (permalink / raw)
  To: Heiko Thiery; +Cc: u-boot

Am 2022-01-13 16:22, schrieb Heiko Thiery:
> Currently the names MMC1, MMC2 and MMC2_2 are output in the SPL. To
> achieve more userbility here the name of the boot source can be 
> returned.
> E.g. for "MMC1" -> "eMMC" or "MMC2" -> "SD card".
> 
> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>

Very nice! If my board would have already support for multiple boot
sources, this would be a very good improvement for the user. Our
downstream bootloader has that support and it always puzzled me
whats MMC1, MMC2 and so on. In fact, theres two SPI boot sources
there, which cannot be distinguished at all at the moment; they
have different offsets for the same SPI flash.

Except for one nit below:
Reviewed-by: Michael Walle <michael@walle.cc>

> ---
>  common/spl/spl.c | 5 +++++
>  include/spl.h    | 5 ++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 4c101ec5d3..b7b53f352e 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -174,6 +174,11 @@ __weak void spl_board_prepare_for_optee(void *fdt)
>  {
>  }
> 
> +__weak const char *spl_board_loader_name(u32 boot_device)
> +{
> +	return NULL;
> +}
> +
>  #if CONFIG_IS_ENABLED(OPTEE_IMAGE)
>  __weak void __noreturn jump_to_image_optee(struct spl_image_info 
> *spl_image)
>  {
> diff --git a/include/spl.h b/include/spl.h
> index 0af0ee3003..a7f17a3837 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -458,6 +458,7 @@ void spl_board_prepare_for_optee(void *fdt);
>  void spl_board_prepare_for_boot(void);
>  int spl_board_ubi_load_image(u32 boot_device);
>  int spl_board_boot_device(u32 boot_device);
> +const char *spl_board_loader_name(u32 boot_device);

function documentation maybe?

>  /**
>   * jump_to_image_linux() - Jump to a Linux kernel from SPL
> @@ -541,7 +542,9 @@ struct spl_image_loader {
>  static inline const char *spl_loader_name(const struct
> spl_image_loader *loader)
>  {
>  #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> -	return loader->name;
> +	const char *name;
> +	name = spl_board_loader_name(loader->boot_device);
> +	return name ?: loader->name;
>  #else
>  	return NULL;
>  #endif

-michael

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

* Re: [PATCH] spl: add support for custom boot method names
  2022-01-13 15:22 [PATCH] spl: add support for custom boot method names Heiko Thiery
  2022-01-13 17:20 ` Michael Walle
@ 2022-01-16 19:32 ` Michael Walle
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Walle @ 2022-01-16 19:32 UTC (permalink / raw)
  To: Heiko Thiery; +Cc: u-boot

Am 2022-01-13 16:22, schrieb Heiko Thiery:
> Currently the names MMC1, MMC2 and MMC2_2 are output in the SPL. To
> achieve more userbility here the name of the boot source can be 
> returned.
> E.g. for "MMC1" -> "eMMC" or "MMC2" -> "SD card".
> 
> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>

Tested-by: Michael Walle <michael@walle.cc>

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

end of thread, other threads:[~2022-01-16 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 15:22 [PATCH] spl: add support for custom boot method names Heiko Thiery
2022-01-13 17:20 ` Michael Walle
2022-01-16 19:32 ` Michael Walle

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.