Page MenuHomeFreeBSD

Add driver for Synopsys Designware Watchdog timer.

Authored by on Oct 13 2020, 5:49 PM.
Referenced Files
F78164857: D26761.diff
Wed, Feb 28, 12:57 PM
Unknown Object (File)
Wed, Feb 21, 3:08 PM
Unknown Object (File)
Sat, Feb 3, 11:28 AM
Unknown Object (File)
Wed, Jan 31, 11:45 PM
Unknown Object (File)
Wed, Jan 31, 6:26 AM
Unknown Object (File)
Wed, Jan 31, 4:45 AM
Unknown Object (File)
Jan 27 2024, 9:16 PM
Unknown Object (File)
Jan 27 2024, 5:40 PM



This driver supports some arm and arm64 boards equipped with "snps,dw-wdt"-compatible watchdog device. Tested on RK3399-based board (RockPro64). Once started watchdog device cannot be stopped. Interrupt handler has mode to kick watchdog even when software does not do it properly. This can be controlled via sysctl: dev.dwwdt.prevent_restart. Also - driver handles system shutdown and prevents from restart when system is asked to reboot.


  • RK3399 TRM Part 1 (it lacks details on clock configuration)

Other implementations:

Test Plan

Tested on RockPro64

Diff Detail

rG FreeBSD src repository
Lint Not Applicable
Tests Not Applicable

Event Timeline

1214 ↗(On Diff #78173)

No clock without this change.


This is uncalibrated. No guarantee that we will hit any particular time period.


Clock returns 0 even with the change above to CRU.


We can't detach if watchdog was once started.

Fix interrupt handling: we should clear interrupt bit only if we want to tap watchdog. Minor fixes to build system, remove clock configuration in RK3399 - this should be done in separated commit. marked an inline comment as not done.

Add calibration.

1214 ↗(On Diff #80878)

I've commited r368766 which fixes this clock.
You should need to fallback on pclk_alive now. edited the summary of this revision. (Show Details)

Rework code to remove workarounds, remove clock definition, be more precise on calibration.

Overall looks good, just a few questions on code that I don't understand.


This is more a full reload than a stop no ?


Why do we need to reload the counter here if we reload it after ?


This "reload" is to decrese interrupt rate when watchdog is stopped. As dwwdt cannot be really stopped once started, I had to provide kind of "emulation". Counter reload here is just for keeping interrupt rate at minimal possible rate.


We don't really need to reload counter here. It is just to save couple of lines of code and to prevent reboot while reconfiguring watchdog.

Fixed calibration issue: we should add one tick, not substract.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 13 2021, 5:44 PM
This revision was automatically updated to reflect the committed changes.