* [U-Boot] [PATCH] aspeed/watchdog: Correct timeout value
@ 2019-06-06 7:38 Joel Stanley
2019-06-07 14:57 ` Tom Rini
2019-06-21 1:54 ` Tom Rini
0 siblings, 2 replies; 4+ messages in thread
From: Joel Stanley @ 2019-06-06 7:38 UTC (permalink / raw)
To: u-boot
The driver was using milliseconds and programming it into a register
which takes ticks of the watchdog clock, which runs at 1MHz. This meant
we were off by 1000 with the desired value.
When 06985289d452 ("watchdog: Implement generic watchdog_reset()
version") was added the aspeed board would leave the watchdog running,
causing it to bite before u-boot was done.
Discovered by booting in qemu:
$ qemu-system-arm -M ast2500-evb -drive file=test.img,format=raw,if=mtd -nographic -no-reboot -d cpu_reset
U-Boot 2019.07-rc3-00091-g2253e40caef5 (Jun 06 2019 - 16:53:23 +0930)
Model: Aspeed BMC
DRAM: 496 MiB
WDT: Started with servicing (60s timeout)
MMC:
In: serial at 1e784000
Out: serial at 1e784000
Err: serial at 1e784000
Watchdog timer expired.
Fixes: 06985289d452 ("watchdog: Implement generic watchdog_reset() version")
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
drivers/watchdog/ast_wdt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/watchdog/ast_wdt.c b/drivers/watchdog/ast_wdt.c
index 523484b1fff9..d344d54aee82 100644
--- a/drivers/watchdog/ast_wdt.c
+++ b/drivers/watchdog/ast_wdt.c
@@ -23,6 +23,12 @@ static int ast_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
ulong driver_data = dev_get_driver_data(dev);
u32 reset_mode = ast_reset_mode_from_flags(flags);
+ /* 32 bits at 1MHz is 4294967ms */
+ timeout = min_t(u64, timeout, 4294967);
+
+ /* WDT counts in ticks of 1MHz clock. 1ms / 1e3 * 1e6 */
+ timeout *= 1000;
+
clrsetbits_le32(&priv->regs->ctrl,
WDT_CTRL_RESET_MASK << WDT_CTRL_RESET_MODE_SHIFT,
reset_mode << WDT_CTRL_RESET_MODE_SHIFT);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] aspeed/watchdog: Correct timeout value
2019-06-06 7:38 [U-Boot] [PATCH] aspeed/watchdog: Correct timeout value Joel Stanley
@ 2019-06-07 14:57 ` Tom Rini
2019-06-17 5:55 ` Joel Stanley
2019-06-21 1:54 ` Tom Rini
1 sibling, 1 reply; 4+ messages in thread
From: Tom Rini @ 2019-06-07 14:57 UTC (permalink / raw)
To: u-boot
On Thu, Jun 06, 2019 at 05:08:45PM +0930, Joel Stanley wrote:
> The driver was using milliseconds and programming it into a register
> which takes ticks of the watchdog clock, which runs at 1MHz. This meant
> we were off by 1000 with the desired value.
>
> When 06985289d452 ("watchdog: Implement generic watchdog_reset()
> version") was added the aspeed board would leave the watchdog running,
> causing it to bite before u-boot was done.
>
> Discovered by booting in qemu:
>
> $ qemu-system-arm -M ast2500-evb -drive file=test.img,format=raw,if=mtd -nographic -no-reboot -d cpu_reset
>
> U-Boot 2019.07-rc3-00091-g2253e40caef5 (Jun 06 2019 - 16:53:23 +0930)
>
> Model: Aspeed BMC
> DRAM: 496 MiB
> WDT: Started with servicing (60s timeout)
> MMC:
> In: serial at 1e784000
> Out: serial at 1e784000
> Err: serial at 1e784000
> Watchdog timer expired.
>
> Fixes: 06985289d452 ("watchdog: Implement generic watchdog_reset() version")
> Signed-off-by: Joel Stanley <joel@jms.id.au>
Thanks for finding this. Any chance you could take a look at what we
have in .travis.yml today for running QEMU platforms and add this one?
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190607/82f7de5f/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] aspeed/watchdog: Correct timeout value
2019-06-07 14:57 ` Tom Rini
@ 2019-06-17 5:55 ` Joel Stanley
0 siblings, 0 replies; 4+ messages in thread
From: Joel Stanley @ 2019-06-17 5:55 UTC (permalink / raw)
To: u-boot
On Fri, 7 Jun 2019 at 14:57, Tom Rini <trini@konsulko.com> wrote:
>
> On Thu, Jun 06, 2019 at 05:08:45PM +0930, Joel Stanley wrote:
>
> > The driver was using milliseconds and programming it into a register
> > which takes ticks of the watchdog clock, which runs at 1MHz. This meant
> > we were off by 1000 with the desired value.
> >
> > When 06985289d452 ("watchdog: Implement generic watchdog_reset()
> > version") was added the aspeed board would leave the watchdog running,
> > causing it to bite before u-boot was done.
> >
> > Discovered by booting in qemu:
> >
> > $ qemu-system-arm -M ast2500-evb -drive file=test.img,format=raw,if=mtd -nographic -no-reboot -d cpu_reset
> >
> > U-Boot 2019.07-rc3-00091-g2253e40caef5 (Jun 06 2019 - 16:53:23 +0930)
> >
> > Model: Aspeed BMC
> > DRAM: 496 MiB
> > WDT: Started with servicing (60s timeout)
> > MMC:
> > In: serial at 1e784000
> > Out: serial at 1e784000
> > Err: serial at 1e784000
> > Watchdog timer expired.
> >
> > Fixes: 06985289d452 ("watchdog: Implement generic watchdog_reset() version")
> > Signed-off-by: Joel Stanley <joel@jms.id.au>
>
> Thanks for finding this. Any chance you could take a look at what we
> have in .travis.yml today for running QEMU platforms and add this one?
Yes, I'll give it a go.
Can we get this fix merged in the mean time?
Cheers,
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] aspeed/watchdog: Correct timeout value
2019-06-06 7:38 [U-Boot] [PATCH] aspeed/watchdog: Correct timeout value Joel Stanley
2019-06-07 14:57 ` Tom Rini
@ 2019-06-21 1:54 ` Tom Rini
1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2019-06-21 1:54 UTC (permalink / raw)
To: u-boot
On Thu, Jun 06, 2019 at 05:08:45PM +0930, Joel Stanley wrote:
> The driver was using milliseconds and programming it into a register
> which takes ticks of the watchdog clock, which runs at 1MHz. This meant
> we were off by 1000 with the desired value.
>
> When 06985289d452 ("watchdog: Implement generic watchdog_reset()
> version") was added the aspeed board would leave the watchdog running,
> causing it to bite before u-boot was done.
>
> Discovered by booting in qemu:
>
> $ qemu-system-arm -M ast2500-evb -drive file=test.img,format=raw,if=mtd -nographic -no-reboot -d cpu_reset
>
> U-Boot 2019.07-rc3-00091-g2253e40caef5 (Jun 06 2019 - 16:53:23 +0930)
>
> Model: Aspeed BMC
> DRAM: 496 MiB
> WDT: Started with servicing (60s timeout)
> MMC:
> In: serial at 1e784000
> Out: serial at 1e784000
> Err: serial at 1e784000
> Watchdog timer expired.
>
> Fixes: 06985289d452 ("watchdog: Implement generic watchdog_reset() version")
> Signed-off-by: Joel Stanley <joel@jms.id.au>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190620/b251e757/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-21 1:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-06 7:38 [U-Boot] [PATCH] aspeed/watchdog: Correct timeout value Joel Stanley
2019-06-07 14:57 ` Tom Rini
2019-06-17 5:55 ` Joel Stanley
2019-06-21 1:54 ` Tom Rini
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.