Re: reset / watchdog on an imx7d soc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> On July 2, 2020 at 6:05 PM Lucas Stach <l.stach@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx
> > > > > 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@xxxxxxxxxxxxxxxxxxx
> > > http://lists.infradead.org/mailman/listinfo/barebox
> > 
> > _______________________________________________
> > barebox mailing list
> > barebox@xxxxxxxxxxxxxxxxxxx
> > http://lists.infradead.org/mailman/listinfo/barebox
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux