git: 4b4e88d9425b - main - aw_wdog: disable timer on attach

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Sat, 16 Nov 2024 19:55:36 UTC
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=4b4e88d9425b59a377a71ffeb553376b1c60a80e

commit 4b4e88d9425b59a377a71ffeb553376b1c60a80e
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-11-16 19:54:46 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-11-16 19:55:27 +0000

    aw_wdog: disable timer on attach
    
    Otherwise it may cause system reset before the watchdog can be pat. This
    is consistent with other watchdog drivers.
    
    Tested on Allwinner D1.
    
    Reviewed by:    manu
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D47517
---
 sys/arm/allwinner/aw_wdog.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/arm/allwinner/aw_wdog.c b/sys/arm/allwinner/aw_wdog.c
index 5c087464c9e1..acfbdd8fe6d0 100644
--- a/sys/arm/allwinner/aw_wdog.c
+++ b/sys/arm/allwinner/aw_wdog.c
@@ -202,6 +202,9 @@ aw_wdog_attach(device_t dev)
 	EVENTHANDLER_REGISTER(shutdown_final, aw_wdog_shutdown_fn, sc,
 	    SHUTDOWN_PRI_LAST - 1);
 
+	/* Disable watchdog for now. */
+	WRITE(sc, sc->wdog_mode, sc->wdog_mode_key);
+
 	return (0);
 }