From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70001C6FD1F for ; Wed, 15 Mar 2023 00:24:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3F57E85E1A; Wed, 15 Mar 2023 01:24:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OBbFoaIW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 08EE485E0B; Wed, 15 Mar 2023 01:24:46 +0100 (CET) Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E04A185DFC for ; Wed, 15 Mar 2023 01:24:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mibodhi@gmail.com Received: by mail-qv1-xf2c.google.com with SMTP id nf5so14172408qvb.5 for ; Tue, 14 Mar 2023 17:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678839881; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rFIdUkhc+s3z+PgqSgfFygo9yWb0pyg3JQ+LcXzZmco=; b=OBbFoaIWQmny1wowp6lDD9IvpsMMF6hAO7/vtHpX6pYmneqWF4APaH0NTge8wIN2qR LsOO9KOEfAuxbgFvxsyk3BCE0YX04k/TCow0rOoFGQlFBxGugMB/y/xr3P4jhFVK4yZg iZFHe9VMxVeywtaXGiuTFhaDeVl6R9lTrBo6P3EJzeoZlLWKDAbZ6I2BzmSzAZfs3E6B VZjgRy5bI9fLLYXTs5I7DJyAVxZh3rvq8ah0t8+VfQn6T/BMn/2AYiiEYigQfsjg5G0I 4WJy6uOZIzjOCnQTvLSpr4utRrTPIYZZ9uFMy8kL5SyxwedJh+65SbQbWz5epZL0bG8b ATug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678839881; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rFIdUkhc+s3z+PgqSgfFygo9yWb0pyg3JQ+LcXzZmco=; b=m57SE5SmHIqguYb4BxohOe7n40yPeje24amykue/k4m2J7a2yVrGTPKrwwYk4Ji/uO tQ9xF3PQSlztJYYUq1H0IlkeXU3Dc5VrH9L2l78izJ33y2QMs/uFj0+uQV7Tva2yO6Qa nhhau+M6n1bOk1nbfCgOJTgrl7NCZ0EwKovOXntuIfxEUyA3GCbTmwtUF5N+70U9rMor j9cKoL94NyeZQXbcP3nwiB7buOwRJXuD3rJ5mv0uEO+r6TlHZVD4rsrpIA91jGmYM3Xt qH4ydJS/rfZtY8pJk4wNDfEjVSKzSPZQCJpRKYgERlOBLm1MkXNRdWZKbppVCcbMG03j 1HyQ== X-Gm-Message-State: AO0yUKVxqJX8A3LZBR3TqMkB3g0A9/VW7d+r059O1hsNzel2PtKnAapV gaY72h7eLCMEiA6ryn7n1lw= X-Google-Smtp-Source: AK7set+O9nxksorrYFI2/PjGohWh0DDwkaph1jEpXx/GuDS2a0cZ0FQnLIlrZXr3PXmwMrzGRIhYnw== X-Received: by 2002:a05:622a:58e:b0:3b9:bf7f:66ff with SMTP id c14-20020a05622a058e00b003b9bf7f66ffmr65010712qtb.67.1678839881699; Tue, 14 Mar 2023 17:24:41 -0700 (PDT) Received: from localhost.localdomain (76-229-100-169.lightspeed.irvnca.sbcglobal.net. [76.229.100.169]) by smtp.gmail.com with ESMTPSA id w7-20020ac86b07000000b003b9bca1e093sm2756049qts.27.2023.03.14.17.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 17:24:41 -0700 (PDT) From: Tony Dinh To: Stefan Roese , =?UTF-8?q?Pali=20Roh=E1r?= , Tom Rini , Simon Glass , U-Boot Mailing List Cc: Michael Walle , Tony Dinh Subject: [PATCH] console: Use flush() before panic and reset Date: Tue, 14 Mar 2023 17:24:26 -0700 Message-Id: <20230315002427.26167-1-mibodhi@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean To make sure the panic and the reset messages will go out, console flush() should be used. Sleep periods do not work in early u-boot phase when timer driver is not initialized yet. Reference: https://lists.denx.de/pipermail/u-boot/2023-March/512233.html Signed-off-by: Tony Dinh --- arch/arm/lib/reset.c | 4 ++-- lib/panic.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/arm/lib/reset.c b/arch/arm/lib/reset.c index 95169bae1c..3e051e36f1 100644 --- a/arch/arm/lib/reset.c +++ b/arch/arm/lib/reset.c @@ -25,6 +25,7 @@ #include #include #include +#include __weak void reset_misc(void) { @@ -33,8 +34,7 @@ __weak void reset_misc(void) int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { puts ("resetting ...\n"); - - mdelay(50); /* wait 50 ms */ + flush(); disable_interrupts(); diff --git a/lib/panic.c b/lib/panic.c index 58382ac4f4..66ae17f3df 100644 --- a/lib/panic.c +++ b/lib/panic.c @@ -15,6 +15,7 @@ #include #endif #include +#include static void panic_finish(void) __attribute__ ((noreturn)); @@ -24,7 +25,8 @@ static void panic_finish(void) #if defined(CONFIG_PANIC_HANG) hang(); #else - udelay(100000); /* allow messages to go out */ + flush(); /* flush the panic message before reset */ + do_reset(NULL, 0, 0, NULL); #endif while (1) -- 2.30.2