From: Giorgio Dal Molin <giorgio.nicole@arcor.de>
To: Lucas Stach <l.stach@pengutronix.de>,
Ahmad Fatoum <a.fatoum@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: reset / watchdog on an imx7d soc
Date: Fri, 3 Jul 2020 16:13:48 +0200 (CEST) [thread overview]
Message-ID: <1271427429.34667.1593785628899@mail.vodafone.de> (raw)
In-Reply-To: <c39270ce4ca906a98dd29c6a669fa0d25fedd551.camel@pengutronix.de>
Hi,
> On July 2, 2020 at 6:05 PM Lucas Stach <l.stach@pengutronix.de> wrote:
>
>
> Hi Giorgio,
>
> Am Donnerstag, den 02.07.2020, 17:28 +0200 schrieb Giorgio Dal Molin:
> [...]
> > barebox does something similar to trigger the wdog but afterwards also calls
> > mdelay() and a printf() before falling in the endless loop:
> >
> > static void imx21_soc_reset(struct imx_wd *priv)
> > {
> > ...
> > imxwd_write(priv, IMX21_WDOG_WCR, val);
> >
> > /* Two additional writes due to errata ERR004346 */
> > imxwd_write(priv, IMX21_WDOG_WCR, val);
> > imxwd_write(priv, IMX21_WDOG_WCR, val);
> >
>
> I'm not sure if the i.MX7 needs the same double write. Just in case,
> can you add a dummy read to the IMX21_WDOG_WCR register after the
> writes to make sure the writes actually get flushed to the device
> before the delay?
>
thank you for the suggestion, I had also such cases in the past.
In this case it seems to make no difference.
To speed up the reset tests I have now an 'init' script that automatically issues
a 'reset' after 2s timeout.
Now, putting the while(1); right after the watchdog trigger in imx21_soc_reset():
imxwd_write(priv, IMX21_WDOG_WCR, val);
while(1);
gives the 'best results' at rebooting: that means I still have occasional hangs
but they are very seldom, the 2s reboot loop normally go on for minutes (~50-100 reboots)
before hanging.
This behavior doesn't change reading the reg. IMX21_WDOG_WCR back after writing it or
repeating the write two more time (errata ERR004346).
What makes the hang MUCH more likely is the call to mdelay(1000): with it in place I have
almost always a hang within 5 tries.
I'm also verifying the system reboot after a complete kernel/userland startup: in this case,
with the DCD addition:
wm 32 0x30391000 0x00000003
nop
...
wm 32 0x30391000 0x00000002
...
the kernel ( == the wdog1 kernel driver ) is also able to restart the system.
For this case I've also setup a reboot loop to automate the test. Currently it's still
running, after ~30 minutes == ~30 reboots.
giorgio
> > ...
> >
> > mdelay(1000);
> >
> > hang(); // <== this also calls printf() before for(;;);
> >
> >
> > What I've found is that if I put the endless loop right at the end of
> > imx21_soc_reset(), after the imxwd_write's, then the reboot process becomes
> > reliable.
> >
> > (The changes in the DCD with the addition of the write:
> >
> > wm 32 0x30391000 0x00000003
> >
> > at the beginning, before the write:
> >
> > wm 32 0x30391000 0x00000002
> >
> > are also essential, only the delay between the two seems to be not a big deal).
> >
> > giorgio
> >
> > > > giorgio
> > > >
> > > > > _______________________________________________
> > > > > barebox mailing list
> > > > > barebox@lists.infradead.org
> > > > > http://lists.infradead.org/mailman/listinfo/barebox
> > >
> > > --
> > > Pengutronix e.K. | |
> > > Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> > > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> > > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
> > >
> > > _______________________________________________
> > > barebox mailing list
> > > barebox@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/barebox
> >
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-07-03 14:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 13:45 Giorgio Dal Molin
2020-06-23 13:53 ` Fabio Estevam
2020-06-23 15:11 ` Giorgio Dal Molin
2020-06-29 8:44 ` Ahmad Fatoum
2020-06-29 10:53 ` Giorgio Dal Molin
2020-06-29 13:30 ` Ahmad Fatoum
2020-06-29 15:30 ` Giorgio Dal Molin
2020-06-29 15:35 ` Ahmad Fatoum
2020-06-29 16:03 ` Giorgio Dal Molin
2020-06-29 16:11 ` Ahmad Fatoum
2020-06-29 16:33 ` Giorgio Dal Molin
2020-06-29 16:39 ` Fabio Estevam
2020-07-01 9:52 ` Giorgio Dal Molin
2020-07-02 9:25 ` Ahmad Fatoum
2020-07-02 14:51 ` Giorgio Dal Molin
2020-07-02 15:28 ` Giorgio Dal Molin
2020-07-02 16:05 ` Lucas Stach
2020-07-03 14:13 ` Giorgio Dal Molin [this message]
2020-07-02 16:24 ` Fabio Estevam
2020-07-07 5:52 ` Giorgio Dal Molin
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=1271427429.34667.1593785628899@mail.vodafone.de \
--to=giorgio.nicole@arcor.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=festevam@gmail.com \
--cc=l.stach@pengutronix.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