Skip to content

Commit e883a54

Browse files
author
Raffael Rostagno
committed
drivers: watchdog: Added support to C6
Added support to watchdog timer to ESP32C6 Signed-off-by: Raffael Rostagno <[email protected]>
1 parent fd4d9c6 commit e883a54

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

boards/espressif/esp32c6_devkitc/esp32c6_devkitc.dts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
aliases {
2525
sw0 = &user_button1;
26+
watchdog0 = &wdt0;
2627
};
2728

2829
gpio_keys {
@@ -49,6 +50,10 @@
4950
status = "okay";
5051
};
5152

53+
&wdt0 {
54+
status = "okay";
55+
};
56+
5257
&flash0 {
5358
status = "okay";
5459
partitions {

drivers/watchdog/wdt_esp32.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,29 @@
77
#define DT_DRV_COMPAT espressif_esp32_watchdog
88

99
/* Include esp-idf headers first to avoid redefining BIT() macro */
10+
#if defined(CONFIG_SOC_SERIES_ESP32C6)
11+
#include <soc/lp_aon_reg.h>
12+
#else
1013
#include <soc/rtc_cntl_reg.h>
14+
#endif
1115
#include <soc/timer_group_reg.h>
1216
#include <hal/mwdt_ll.h>
1317
#include <hal/wdt_hal.h>
1418

1519
#include <string.h>
1620
#include <zephyr/drivers/watchdog.h>
1721
#include <zephyr/drivers/clock_control.h>
18-
#ifndef CONFIG_SOC_SERIES_ESP32C3
19-
#include <zephyr/drivers/interrupt_controller/intc_esp32.h>
20-
#else
22+
#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6)
2123
#include <zephyr/drivers/interrupt_controller/intc_esp32c3.h>
24+
#else
25+
#include <zephyr/drivers/interrupt_controller/intc_esp32.h>
2226
#endif
2327
#include <zephyr/device.h>
2428

2529
#include <zephyr/logging/log.h>
2630
LOG_MODULE_REGISTER(wdt_esp32, CONFIG_WDT_LOG_LEVEL);
2731

28-
#ifdef CONFIG_SOC_SERIES_ESP32C3
32+
#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6)
2933
#define ISR_HANDLER isr_handler_t
3034
#else
3135
#define ISR_HANDLER intr_handler_t

dts/riscv/espressif/esp32c6/esp32c6_common.dtsi

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,24 @@
7878
};
7979
};
8080

81+
wdt0: watchdog@6001f048 {
82+
compatible = "espressif,esp32-watchdog";
83+
reg = <0x6001f048 0x20>;
84+
interrupts = <TG0_WDT_LEVEL_INTR_SOURCE>;
85+
interrupt-parent = <&intc>;
86+
clocks = <&rtc ESP32_TIMG0_MODULE>;
87+
status = "disabled";
88+
};
89+
90+
wdt1: watchdog@60020048 {
91+
compatible = "espressif,esp32-watchdog";
92+
reg = <0x60020048 0x20>;
93+
interrupts = <TG1_WDT_LEVEL_INTR_SOURCE>;
94+
interrupt-parent = <&intc>;
95+
clocks = <&rtc ESP32_TIMG1_MODULE>;
96+
status = "disabled";
97+
};
98+
8199
flash: flash-controller@60002000 {
82100
compatible = "espressif,esp32-flash-controller";
83101
reg = <0x60002000 0x1000>;

0 commit comments

Comments
 (0)