All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Cc: Marek Vasut <marex@denx.de>, Stefano Babic <sbabic@denx.de>
Subject: [PATCH 3/3] ARM: imx: mx5: Add altbootcmd and resets to M53Menlo
Date: Sun, 12 Sep 2021 00:40:00 +0200	[thread overview]
Message-ID: <20210911224000.98908-3-marex@denx.de> (raw)
In-Reply-To: <20210911224000.98908-1-marex@denx.de>

Bulletproof the default boot command with reset statements in case
any command in the chain would fail. In case a failure were to happen,
the board will reset, increment boot counter and retry the procedure.
In case the failures persist and the boot counter reaches the bootlimit,
U-Boot starts altbootcmd instead of the default bootcmd boot command.

The altbootcmd swaps the default boot partition for the other boot
partition, which is an identical copy or an older copy, and tries
booting from that one instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
---
 include/configs/m53menlo.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/configs/m53menlo.h b/include/configs/m53menlo.h
index bd117daf063..9bec05bf0bd 100644
--- a/include/configs/m53menlo.h
+++ b/include/configs/m53menlo.h
@@ -184,6 +184,13 @@
 	"splashfile=boot/usplash.bmp.gz\0"				\
 	"splashimage=0x88000000\0"					\
 	"splashpos=m,m\0"						\
+	"altbootcmd="							\
+		"if test ${mmcpart} -eq 1 ; then "			\
+			"setenv mmcpart 2 ; "				\
+		"else "							\
+			"setenv mmcpart 1 ; "				\
+		"fi ; "							\
+		"boot\0"						\
 	"stdout=serial,vidconsole\0"					\
 	"stderr=serial,vidconsole\0"					\
 	"addcons="							\
@@ -198,14 +205,14 @@
 		"setenv bootargs ${bootargs} ${miscargs}\0"		\
 	"addargs=run addcons addmisc addmtd\0"				\
 	"mmcload="							\
-		"mmc rescan ; load mmc ${mmcdev}:${mmcpart} "		\
-		"${kernel_addr_r} ${bootfile}\0"			\
+		"mmc rescan || reset ; load mmc ${mmcdev}:${mmcpart} "	\
+		"${kernel_addr_r} ${bootfile} || reset\0"		\
 	"miscargs=nohlt panic=1\0"					\
 	"mmcargs=setenv bootargs root=/dev/mmcblk0p${mmcpart} rw "	\
 		"rootwait\0"						\
 	"mmc_mmc="							\
-		"run mmcload mmcargs addargs ; "			\
-		"bootm ${kernel_addr_r}\0"				\
+		"run mmcload mmcargs addargs || reset ; "		\
+		"bootm ${kernel_addr_r} ; reset\0"			\
 	"netload=tftp ${kernel_addr_r} ${hostname}/${bootfile}\0"	\
 	"net_nfs="							\
 		"run netload nfsargs addip addargs ; "			\
-- 
2.33.0


  parent reply	other threads:[~2021-09-11 22:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-11 22:39 [PATCH 1/3] ARM: imx: mx5: Enable BMODE command on MX53 Menlo board Marek Vasut
2021-09-11 22:39 ` [PATCH 2/3] ARM: imx: mx5: Enable Thumb2 build " Marek Vasut
2021-10-20 12:20   ` sbabic
2021-09-11 22:40 ` Marek Vasut [this message]
2021-10-20 12:21   ` [PATCH 3/3] ARM: imx: mx5: Add altbootcmd and resets to M53Menlo sbabic
2021-10-20 12:20 ` [PATCH 1/3] ARM: imx: mx5: Enable BMODE command on MX53 Menlo board sbabic

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=20210911224000.98908-3-marex@denx.de \
    --to=marex@denx.de \
    --cc=sbabic@denx.de \
    --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.