public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Thiery <heiko.thiery@gmail.com>
To: u-boot@lists.denx.de
Cc: Michael Walle <michael@walle.cc>, Heiko Thiery <heiko.thiery@gmail.com>
Subject: [PATCH v2] spl: add support for custom boot method names
Date: Mon, 17 Jan 2022 15:11:48 +0100	[thread overview]
Message-ID: <20220117141147.34568-1-heiko.thiery@gmail.com> (raw)

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>
Reviewed-by: Michael Walle <michael@walle.cc>
Tested-by: Michael Walle <michael@walle.cc>
---
v2:
 - add function documenation


 common/spl/spl.c |  5 +++++
 include/spl.h    | 16 +++++++++++++++-
 2 files changed, 20 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..e7b2ef0693 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -459,6 +459,18 @@ void spl_board_prepare_for_boot(void);
 int spl_board_ubi_load_image(u32 boot_device);
 int spl_board_boot_device(u32 boot_device);
 
+/**
+ * spl_board_loader_name() - Return a name for the loader
+ *
+ * This is a weak function which might be overridden by the board code. With
+ * that a board specific value for the device where the U-Boot will be loaded
+ * from can be set. By default it returns NULL.
+ *
+ * @boot_device:	ID of the device which the MMC driver wants to load
+ *			U-Boot from.
+ */
+const char *spl_board_loader_name(u32 boot_device);
+
 /**
  * jump_to_image_linux() - Jump to a Linux kernel from SPL
  *
@@ -541,7 +553,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


                 reply	other threads:[~2022-01-17 14:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220117141147.34568-1-heiko.thiery@gmail.com \
    --to=heiko.thiery@gmail.com \
    --cc=michael@walle.cc \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox