Skip to content

arch/risc-v/k210: Add Watchdog Timer (WDT) driver support.#18550

Merged
xiaoxiang781216 merged 1 commit intoapache:masterfrom
no1wudi:k210
Mar 18, 2026
Merged

arch/risc-v/k210: Add Watchdog Timer (WDT) driver support.#18550
xiaoxiang781216 merged 1 commit intoapache:masterfrom
no1wudi:k210

Conversation

@no1wudi
Copy link
Copy Markdown
Contributor

@no1wudi no1wudi commented Mar 17, 2026

Summary

Add Watchdog Timer (WDT) driver support for the Kendryte K210 RISC-V SoC.

The K210 has two independent watchdog timers (WDT0 and WDT1) that can be used to detect and recover from system malfunctions. This driver implements the standard NuttX watchdog character driver interface.

Changes include:

  • Add WDT driver implementation (k210_wdt.c, k210_wdt.h)
  • Add hardware register definitions (hardware/k210_wdt.h)
  • Add memory map definitions for WDT0 (0x50400000) and WDT1 (0x50410000)
  • Add IRQ definitions for WDT0 (IRQ 21) and WDT1 (IRQ 22)
  • Add Kconfig options: CONFIG_K210_WDT, CONFIG_K210_WDT0, CONFIG_K210_WDT1
  • Add WDT initialization in maix-bit board bringup
  • Update platform documentation

Impact

  • Impact on user: YES - Enables watchdog timer functionality for K210 boards
  • Impact on build: YES - Adds new driver source files and Kconfig options
  • Impact on hardware: YES - Supports K210 WDT0 and WDT1 peripherals
  • Impact on documentation: YES - Added WDT section to K210 platform docs
  • Impact on security: YES - Watchdog improves system reliability and recovery
  • Impact on compatibility: NO

Testing

Build Host: Ubuntu 22.04, x86_64, GCC 12.2.0
Target: risc-v k210:maix-bit:nsh

Runtime output:

NuttShell (NSH) NuttX-12.12.0
nsh> wdog
  ping elapsed=0
  ping elapsed=491
  ping elapsed=991
  ping elapsed=1491
  ping elapsed=1991
  ping elapsed=2491
  ping elapsed=2991
  ping elapsed=3491
  ping elapsed=3991
  ping elapsed=4491
  ping elapsed=4991
  NO ping elapsed=5491
  NO ping elapsed=5991
  NO ping elapsed=6491
  NO ping elapsed=6991
  NO ping elapsed=7491

NuttShell (NSH) NuttX-12.12.0
nsh> uptime
00:00:05 up  0:00, load average: 0.00, 0.00, 0.00
nsh>

Verified:

  • Watchdog pings working (~500ms intervals)
  • After ping timeout (5 missed pings), watchdog triggers system reset
  • System reboots successfully after watchdog timeout

Add WDT driver for K210 with support for both WDT0 and WDT1 peripherals.
This includes:
- Add k210_wdt.c and k210_wdt.h driver files with interrupt-based
  watchdog timer functionality
- Add hardware register definitions in k210_wdt.h
- Add K210_WDT, K210_WDT0, K210_WDT1 Kconfig options
- Add memory map definitions for WDT0 (0x50400000) and WDT1 (0x50410000)
- Reorder WDT IRQ definitions (IRQ 21, 22) before UART0 (IRQ 33) in irq.h
- Add WDT initialization in board bringup for maix-bit

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
@github-actions github-actions bot added Area: Documentation Improvements or additions to documentation Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: L The size of the change in this PR is large Board: risc-v labels Mar 17, 2026
@xiaoxiang781216 xiaoxiang781216 merged commit 078e709 into apache:master Mar 18, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Area: Documentation Improvements or additions to documentation Board: risc-v Size: L The size of the change in this PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants