Fishwaldo opened a new pull request, #20380:
URL: https://github.com/apache/nuttx/pull/20380
## Summary
Adds the four Synopsys watchdog timers on the EIC7700X, registered as
`/dev/watchdog0` to `3`, and a `board_reset()` that takes the chip down.
Split by layer: the first commit is the arch driver and its register
definitions, the second registers the instances and implements reboot and
reset-cause reporting for both boards.
- **Timeouts are powers of two of the 200 MHz peripheral clock**, a third of
a millisecond to about eleven seconds, rounded up. A request beyond the ceiling
is refused rather than shortened, so a caller that plans its feeding around the
value it asked for is never handed less.
- **The protection level is the trap.** Each watchdog has a field that locks
its own configuration and resets to a permissive value. Once raised it cannot
be lowered without a chip reset, so setting it while probing locks the driver
out of the timeout it is about to need. The timeout range register is written
and read back for the same reason: clearing the protection level first, as the
manual advises, makes the block drop timeout writes while still accepting the
enable.
- **Stopping means holding the block in reset**, which is the only way to
clear an enable bit the hardware makes unclearable. Every start therefore
begins from the block's reset state.
- **`board_reset()` asks firmware through SBI** and writes the chip's system
software reset register itself if firmware declines. That register sits in the
CRG block beside the reset lines but is not one of them: the CRG driver models
the per-line array from offset `0x400` and refuses to assert system-critical
lines, since asserting one takes down the system doing the asserting.
- **`board_reset_cause()`** reports why the chip last restarted, read once
at startup and cleared because the register accumulates.
## Impact
New driver behind `CONFIG_EIC7700X_WDT`, default `n`. Both boards'
defconfigs enable it with `WATCHDOG_AUTOMONITOR`, so the kernel arms and feeds
every instance from boot until an application claims one with `WDIOC_START`. No
existing code path changes.
## Testing
ESWIN EIC7700 EVB. All four instances register, and the reset cause decodes
correctly for three different sources:
```
[CPU0] wdt: last reset: debug (40) <- reset over JTAG
[CPU0] wdt: last reset: software (10) <- nsh "reboot"
[CPU0] wdt: last reset: WATCHDOG (08) <- timeout
[CPU0] wdt: 4 watchdogs, auto-fed
```
The timeout genuinely resets the chip, shown with `apps/examples/watchdog`,
which starts a dog and then stops feeding it:
```
nsh> wdog
ping elapsed=0 ... ping elapsed=4509
NO ping elapsed=5010 ... NO ping elapsed=7014
pll config ok <- the chip reset itself
```
Built for `eic7700-evb:nsh` with `-Wno-cpp -Werror`, with `EIC7700X_WDT`
both on and off, and with the arch commit alone to confirm the split builds at
each step.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]