All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: "Pali Rohár" <pali@kernel.org>
Cc: "Chris Packham" <judge.packham@gmail.com>,
	"Stefan Roese" <sr@denx.de>,
	"u-boot@lists.denx.de" <u-boot@lists.denx.de>,
	"Marek Behún" <marek.behun@nic.cz>
Subject: Re: [PATCH u-boot-marvell 1/2] arm: mvebu: spl: Add option to reset the board on DDR training failure
Date: Thu, 17 Feb 2022 12:48:08 +0100	[thread overview]
Message-ID: <20220217124808.663157c5@dellmb> (raw)
In-Reply-To: <20220217113754.ya6gtg2m73ke4ng5@pali>

On Thu, 17 Feb 2022 12:37:54 +0100
Pali Rohár <pali@kernel.org> wrote:

> On Thursday 17 February 2022 01:08:48 Marek Behún wrote:
> > From: Marek Behún <marek.behun@nic.cz>
> > 
> > Some boards may occacionally fail DDR training. Currently we hang() in
> > this case. Add an option that makes the board do an immediate reset in
> > such a case, so that a new training is tried as soon as possible,
> > instead of hanging and possibly waiting for watchdog to reset the board.
> > 
> > Signed-off-by: Marek Behún <marek.behun@nic.cz>
> > Reviewed-by: Stefan Roese <sr@denx.de>
> > ---
> >  arch/arm/mach-mvebu/Kconfig | 9 +++++++++
> >  arch/arm/mach-mvebu/spl.c   | 6 +++++-
> >  2 files changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
> > index d23cc0c760..ed957be6e1 100644
> > --- a/arch/arm/mach-mvebu/Kconfig
> > +++ b/arch/arm/mach-mvebu/Kconfig
> > @@ -213,6 +213,15 @@ config DDR_LOG_LEVEL
> >  	  At level 3, rovides the windows margin of each DQ as a results of
> >  	  DQS centeralization.
> >  
> > +config DDR_RESET_ON_TRAINING_FAILURE
> > +	bool "Reset the board on DDR training failure instead of hanging"
> > +	depends on ARMADA_38X || ARMADA_XP
> > +	help
> > +	  If DDR training fails in SPL, reset the board instead of hanging.
> > +	  Some boards are known to fail DDR training occasionally and an
> > +	  immediate reset may be preferable to waiting until the board is
> > +	  reset by watchdog (if there even is one).
> > +
> >  config SYS_BOARD
> >  	default "clearfog" if TARGET_CLEARFOG
> >  	default "helios4" if TARGET_HELIOS4
> > diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
> > index 273ecb8bd6..d3c3bdc74d 100644
> > --- a/arch/arm/mach-mvebu/spl.c
> > +++ b/arch/arm/mach-mvebu/spl.c
> > @@ -4,6 +4,7 @@
> >   */
> >  
> >  #include <common.h>
> > +#include <cpu_func.h>
> >  #include <dm.h>
> >  #include <fdtdec.h>
> >  #include <hang.h>
> > @@ -330,7 +331,10 @@ void board_init_f(ulong dummy)
> >  	ret = ddr3_init();
> >  	if (ret) {
> >  		printf("ddr3_init() failed: %d\n", ret);
> > -		hang();
> > +		if (IS_ENABLED(CONFIG_DDR_RESET_ON_TRAINING_FAILURE))
> > +			reset_cpu();  
> 
> You should not call reset_cpu() from SPL loaded via UART. This will
> confuse x-modem software. Either return failure to BootROM or hang()
> like it was before.

Hmm, I didn't consider that.

What will happen if I return failure to BootROM? Will it try booting
from different medium?

I think that the best thing to do on failure when booting via UART is
to hang()...

Marek

  parent reply	other threads:[~2022-02-17 11:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17  0:08 [PATCH u-boot-marvell 1/2] arm: mvebu: spl: Add option to reset the board on DDR training failure Marek Behún
2022-02-17  0:08 ` [PATCH u-boot-marvell 2/2] arm: mvebu: turris_omnia: Reset the board immediately " Marek Behún
2022-02-17  5:48   ` Stefan Roese
2022-02-17  5:48 ` [PATCH u-boot-marvell 1/2] arm: mvebu: spl: Add option to reset the board " Stefan Roese
2022-02-17 11:37 ` Pali Rohár
2022-02-17 11:42   ` Stefan Roese
2022-02-17 11:46     ` Pali Rohár
2022-02-17 11:48   ` Marek Behún [this message]
2022-02-17 12:09     ` Pali Rohár

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=20220217124808.663157c5@dellmb \
    --to=kabel@kernel.org \
    --cc=judge.packham@gmail.com \
    --cc=marek.behun@nic.cz \
    --cc=pali@kernel.org \
    --cc=sr@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.