public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ravik Hasija <rahasij@linux.microsoft.com>
To: u-boot@lists.denx.de
Subject: [PATCH] cmd: mmc: add mmcboot command
Date: Wed, 23 Dec 2020 11:57:17 -0800	[thread overview]
Message-ID: <1608753437-5004-1-git-send-email-rahasij@linux.microsoft.com> (raw)

Similar to usbboot, add command line to boot from raw mmc partition
using common_diskboot(), which supports legacy or FIT images.

Usage:
mmcboot loadAaddr dev:part

Where <loadAddr> defaults to CONFIG_SYS_LOAD_ADDR, and <dev:part>
defaults to ${bootdevice}.

Also fixing config macro usage for CONFIG_SUPPORT_EMMC_BOOT (suggested
by checkpatch.pl).

Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
---
 cmd/mmc.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/cmd/mmc.c b/cmd/mmc.c
index 1529a3e05d..4d134e35a1 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -711,7 +711,7 @@ static int do_mmc_hwpartition(struct cmd_tbl *cmdtp, int flag,
 }
 #endif
 
-#ifdef CONFIG_SUPPORT_EMMC_BOOT
+#if CONFIG_IS_ENABLED(SUPPORT_EMMC_BOOT)
 static int do_mmc_bootbus(struct cmd_tbl *cmdtp, int flag,
 			  int argc, char *const argv[])
 {
@@ -950,7 +950,7 @@ static struct cmd_tbl cmd_mmc[] = {
 #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
 	U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),
 #endif
-#ifdef CONFIG_SUPPORT_EMMC_BOOT
+#if CONFIG_IS_ENABLED(SUPPORT_EMMC_BOOT)
 	U_BOOT_CMD_MKENT(bootbus, 5, 0, do_mmc_bootbus, "", ""),
 	U_BOOT_CMD_MKENT(bootpart-resize, 4, 0, do_mmc_boot_resize, "", ""),
 	U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""),
@@ -992,6 +992,14 @@ static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc,
 	return cp->cmd(cmdtp, flag, argc, argv);
 }
 
+#if CONFIG_IS_ENABLED(SUPPORT_EMMC_BOOT)
+static int do_mmcboot(cmd_tbl_t *cmdtp, int flag, int argc,
+		char *const argv[])
+{
+	return common_diskboot(cmdtp, "mmc", argc, argv);
+}
+#endif
+
 U_BOOT_CMD(
 	mmc, 29, 1, do_mmcops,
 	"MMC sub system",
@@ -1016,7 +1024,7 @@ U_BOOT_CMD(
 	"  WARNING: Partitioning is a write-once setting once it is set to complete.\n"
 	"  Power cycling is required to initialize partitions after set to complete.\n"
 #endif
-#ifdef CONFIG_SUPPORT_EMMC_BOOT
+#if CONFIG_IS_ENABLED(SUPPORT_EMMC_BOOT)
 	"mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n"
 	" - Set the BOOT_BUS_WIDTH field of the specified device\n"
 	"mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>\n"
@@ -1046,3 +1054,11 @@ U_BOOT_CMD(
 	"display MMC info",
 	"- display info of the current MMC device"
 );
+
+#if CONFIG_IS_ENABLED(SUPPORT_EMMC_BOOT)
+U_BOOT_CMD(
+	mmcboot, 3, 1, do_mmcboot,
+	"boot from eMMC",
+	"loadAddr dev:part"
+);
+#endif
-- 
2.17.1

             reply	other threads:[~2020-12-23 19:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20201223195751epcas1p488f3f465492b11d4c8fd328c3b3dc193@epcas1p4.samsung.com>
2020-12-23 19:57 ` Ravik Hasija [this message]
2020-12-27 22:58   ` [PATCH] cmd: mmc: add mmcboot command Jaehoon Chung
2021-01-01  9:56     ` Heinrich Schuchardt
2020-12-29  3:32   ` Simon Glass
2021-01-04 18:40   ` [PATCH v2] " Ravik Hasija
2021-01-04 19:56     ` Marek Vasut
2021-01-05 18:21       ` Ravik Hasija
2021-01-04 23:49     ` Jaehoon Chung
2021-01-07 20:23       ` Ravik Hasija

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=1608753437-5004-1-git-send-email-rahasij@linux.microsoft.com \
    --to=rahasij@linux.microsoft.com \
    --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