Merge branch 'fix/force_enable_uart0_sclk_in_esp_restart_v5.4' into 'release/v5.4'

fix(esp_system): force enable uart0 sclk in esp_restart (v5.4)

See merge request espressif/esp-idf!40347
This commit is contained in:
Jiang Jiang Jian
2025-07-11 13:46:00 +08:00
4 changed files with 20 additions and 0 deletions

View File

@@ -22,6 +22,7 @@
#include "soc/rtc_periph.h" #include "soc/rtc_periph.h"
#include "soc/uart_reg.h" #include "soc/uart_reg.h"
#include "hal/wdt_hal.h" #include "hal/wdt_hal.h"
#include "hal/uart_ll.h"
#if SOC_MODEM_CLOCK_SUPPORTED #if SOC_MODEM_CLOCK_SUPPORTED
#include "hal/modem_syscon_ll.h" #include "hal/modem_syscon_ll.h"
#include "hal/modem_lpcon_ll.h" #include "hal/modem_lpcon_ll.h"
@@ -78,6 +79,10 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN); CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN); CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN);
CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN); CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
// UART's sclk is controlled in the PCR register and does not reset with the UART module. The ROM missed enabling
// it when initializing the ROM UART. If it is not turned on, it will trigger LP_WDT in the ROM.
uart_ll_sclk_enable(&UART0);
} }
/* "inner" restart function for after RTOS, interrupts & anything else on this /* "inner" restart function for after RTOS, interrupts & anything else on this

View File

@@ -20,6 +20,7 @@
#include "esp_private/rtc_clk.h" #include "esp_private/rtc_clk.h"
#include "soc/rtc_periph.h" #include "soc/rtc_periph.h"
#include "soc/uart_reg.h" #include "soc/uart_reg.h"
#include "hal/uart_ll.h"
#include "hal/wdt_hal.h" #include "hal/wdt_hal.h"
#include "hal/modem_syscon_ll.h" #include "hal/modem_syscon_ll.h"
#include "hal/modem_lpcon_ll.h" #include "hal/modem_lpcon_ll.h"
@@ -75,6 +76,10 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN); CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN); CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN);
CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN); CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
// UART's sclk is controlled in the PCR register and does not reset with the UART module. The ROM missed enabling
// it when initializing the ROM UART. If it is not turned on, it will trigger LP_WDT in the ROM.
uart_ll_sclk_enable(&UART0);
} }
/* "inner" restart function for after RTOS, interrupts & anything else on this /* "inner" restart function for after RTOS, interrupts & anything else on this

View File

@@ -20,6 +20,7 @@
#include "esp_private/rtc_clk.h" #include "esp_private/rtc_clk.h"
#include "soc/rtc_periph.h" #include "soc/rtc_periph.h"
#include "soc/uart_reg.h" #include "soc/uart_reg.h"
#include "hal/uart_ll.h"
#include "hal/wdt_hal.h" #include "hal/wdt_hal.h"
#include "esp_private/cache_err_int.h" #include "esp_private/cache_err_int.h"
@@ -78,6 +79,10 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN); CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN); CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN);
CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN); CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
// UART's sclk is controlled in the PCR register and does not reset with the UART module. The ROM missed enabling
// it when initializing the ROM UART. If it is not turned on, it will trigger LP_WDT in the ROM.
uart_ll_sclk_enable(&UART0);
} }
/* "inner" restart function for after RTOS, interrupts & anything else on this /* "inner" restart function for after RTOS, interrupts & anything else on this

View File

@@ -23,6 +23,7 @@
#include "soc/uart_reg.h" #include "soc/uart_reg.h"
#include "hal/wdt_hal.h" #include "hal/wdt_hal.h"
#include "hal/spimem_flash_ll.h" #include "hal/spimem_flash_ll.h"
#include "hal/uart_ll.h"
#include "esp_private/cache_err_int.h" #include "esp_private/cache_err_int.h"
#include "esp_private/mspi_timing_tuning.h" #include "esp_private/mspi_timing_tuning.h"
@@ -73,6 +74,10 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN); CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN); CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN);
CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN); CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
// UART's sclk is controlled in the PCR register and does not reset with the UART module. The ROM missed enabling
// it when initializing the ROM UART. If it is not turned on, it will trigger LP_WDT in the ROM.
uart_ll_sclk_enable(&UART0);
} }
/* "inner" restart function for after RTOS, interrupts & anything else on this /* "inner" restart function for after RTOS, interrupts & anything else on this