fix(esp_system): reset EMAC on restart for ESP32-P4

Closes https://github.com/espressif/esp-idf/issues/19085
This commit is contained in:
Renz Bagaporo
2026-09-18 14:01:05 +09:00
parent 3dd1a4671a
commit 5dedd956f6
@@ -113,6 +113,12 @@ void esp_system_reset_modules_on_exit(void)
SET_PERI_REG_MASK(LP_CLKRST_HP_SDMMC_EMAC_RST_CTRL_REG, LP_CLKRST_RST_EN_SDMMC);
CLEAR_PERI_REG_MASK(LP_CLKRST_HP_SDMMC_EMAC_RST_CTRL_REG, LP_CLKRST_RST_EN_SDMMC);
// Likewise the EMAC DMA: its descriptor ring and receive buffers live in the
// heap, so a receive left running across a restart writes incoming frames
// into memory the next boot has already handed out.
SET_PERI_REG_MASK(LP_CLKRST_HP_SDMMC_EMAC_RST_CTRL_REG, LP_CLKRST_RST_EN_EMAC);
CLEAR_PERI_REG_MASK(LP_CLKRST_HP_SDMMC_EMAC_RST_CTRL_REG, LP_CLKRST_RST_EN_EMAC);
// Reset crypto peripherals. This ensures a clean state for the crypto peripherals after a CPU restart
// and hence avoiding any possibility with crypto failure in ROM security workflows.
SET_PERI_REG_MASK(HP_SYS_CLKRST_HP_RST_EN2_REG, HP_SYS_CLKRST_REG_RST_EN_CRYPTO);