From 67d29e7537b2db050306a7ced1cea2295129fb6d Mon Sep 17 00:00:00 2001 From: Sara Souza Date: Tue, 3 Aug 2021 08:31:39 -0300 Subject: [PATCH] xtensa/esp32: initialize RTC in case PM or RTC configs are not set, but RWDT is. --- arch/xtensa/src/esp32/esp32_wdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/xtensa/src/esp32/esp32_wdt.c b/arch/xtensa/src/esp32/esp32_wdt.c index 9be3f85c5cb..b3168023e6e 100644 --- a/arch/xtensa/src/esp32/esp32_wdt.c +++ b/arch/xtensa/src/esp32/esp32_wdt.c @@ -932,6 +932,18 @@ FAR struct esp32_wdt_dev_s *esp32_wdt_init(uint8_t wdt_id) case 2: { wdt = &g_esp32_rwdt_priv; + + /* If RTC was not initialized in a previous + * stage by the PM or by clock_initialize() + * Then, init the RTC clock configuration here. + */ + +#if !defined(CONFIG_PM) && !defined(CONFIG_RTC) + /* Initialize RTC controller parameters */ + + esp32_rtc_init(); + esp32_rtc_clk_set(); +#endif break; }