From patchwork Sat Sep 11 22:40:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1526802 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=tRLFUxp0; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=CokM/GiU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H6SPv3Dtgz9sW5 for ; Sun, 12 Sep 2021 08:40:51 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 30458838BB; Sun, 12 Sep 2021 00:40:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1631400027; bh=OKiNpyMhIRA9qudMb5oCWdKYMhVXTAyGGYTKASTR1nw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tRLFUxp08RkjyJxFnfW4TmwmTz5vsjn+NuRoWwN1aqS5Q6UysdkO+GnarEjaJ4YFA Nu5u0aBXaENcUMuLGoatiEhQ16lwPqTP0rUEv5MbdMUmnBpOrNOQrMTTXkzCG2etuD 9aK9zLPJZ+uju0dWzTFqP1k7j5RItxOXOEViAKCZuTZXUN3FkbHYkGKA3QJ9k3s9vK qKWKxIRY2sNefbdAKIQb9sr7ycVLKXrsqybR85/GILU+LLwTKeRwoq1bC/bT/EnoYp hJ6WCkbD1Ahid12Yi5MBCNFWxNIcMSSn/C63L3hOldc2MEQx59NwV3s9GV+8kSotHH wCl/p45jKzJvQ== Received: from tr.lan (ip-89-176-112-137.net.upcbroadband.cz [89.176.112.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id B8A3B838AC; Sun, 12 Sep 2021 00:40:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1631400016; bh=OKiNpyMhIRA9qudMb5oCWdKYMhVXTAyGGYTKASTR1nw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CokM/GiUjMOQD8RL15PrqDF0XIMJoWIxbBBYclMX9BzNqS3VjRwYyCq6BU8++h/sm BmO0cjjZG3D80NYj2WtL9Zf/h5ZjDlCND/W/0nLE2pEASEByPvpswdbJhThHeHrp8p z1BisJw1THzfktkfx0zlfd9CBLeH8VznXAy2L1/xtubBEl5Hc4fJsZCoTvlsLiSbHM whlPVmys78GMk9RoSAO3PszomACIym3OaGUrlxu6ylkeHDjdNwvSdSec5ZXC9JKKW5 gHwTwNwZJ0eMKPs4nUWQzdHm3Bjaj4CuOYQ3aVXPEuMsnSsTJ+v/JKRkUj+n5VQdX6 8AiapqU1ByxcQ== From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Stefano Babic Subject: [PATCH 3/3] ARM: imx: mx5: Add altbootcmd and resets to M53Menlo Date: Sun, 12 Sep 2021 00:40:00 +0200 Message-Id: <20210911224000.98908-3-marex@denx.de> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210911224000.98908-1-marex@denx.de> References: <20210911224000.98908-1-marex@denx.de> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean 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 Cc: Stefano Babic --- 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 ; " \