Page MenuHomeFreeBSD

Add driver for Synopsys Designware Watchdog timer.
ClosedPublic

Authored by kjopek_gmail.com on Oct 13 2020, 5:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 6, 10:35 AM
Unknown Object (File)
Wed, Feb 28, 12:57 PM
Unknown Object (File)
Feb 21 2024, 3:08 PM
Unknown Object (File)
Feb 3 2024, 11:28 AM
Unknown Object (File)
Jan 31 2024, 11:45 PM
Unknown Object (File)
Jan 31 2024, 6:26 AM
Unknown Object (File)
Jan 31 2024, 4:45 AM
Unknown Object (File)
Jan 27 2024, 9:16 PM

Details

Summary

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.

Bibliography:

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

Other implementations:

Test Plan

Tested on RockPro64

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/arm64/rockchip/clk/rk3399_cru.c
1214

No clock without this change.

sys/dev/dwwdt/dwwdt.c
63

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

289

Clock returns 0 even with the change above to CRU.

321

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.

kjopek_gmail.com marked an inline comment as not done.

Add calibration.

sys/arm64/rockchip/clk/rk3399_cru.c
1214

I've commited r368766 which fixes this clock.
You should need to fallback on pclk_alive now.

kjopek_gmail.com 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.

sys/dev/dwwdt/dwwdt.c
161

This is more a full reload than a stop no ?

197

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

sys/dev/dwwdt/dwwdt.c
161

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.

197

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.