From 0afeac99514a0b01228180b1c40c4812e2adcab3 Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Mon, 13 Feb 2023 16:36:19 +0800 Subject: [PATCH] bugfix: reset modem lpcon in soft reset --- components/esp_system/port/soc/esp32c6/system_internal.c | 4 +++- components/hal/esp32c6/include/hal/modem_lpcon_ll.h | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/components/esp_system/port/soc/esp32c6/system_internal.c b/components/esp_system/port/soc/esp32c6/system_internal.c index a3661e43ac..da78572821 100644 --- a/components/esp_system/port/soc/esp32c6/system_internal.c +++ b/components/esp_system/port/soc/esp32c6/system_internal.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -20,6 +20,7 @@ #include "soc/uart_reg.h" #include "hal/wdt_hal.h" #include "hal/modem_syscon_ll.h" +#include "hal/modem_lpcon_ll.h" #include "esp_private/cache_err_int.h" #include "esp32c6/rom/cache.h" @@ -72,6 +73,7 @@ void IRAM_ATTR esp_restart_noos(void) // REG_WRITE(SYSTEM_CORE_RST_EN_REG, 0); modem_syscon_ll_reset_all(&MODEM_SYSCON); + modem_lpcon_ll_reset_all(&MODEM_LPCON); // Set Peripheral clk rst SET_PERI_REG_MASK(PCR_TIMERGROUP0_CONF_REG, PCR_TG0_RST_EN); diff --git a/components/hal/esp32c6/include/hal/modem_lpcon_ll.h b/components/hal/esp32c6/include/hal/modem_lpcon_ll.h index d6751fe84a..57ca3bd71c 100644 --- a/components/hal/esp32c6/include/hal/modem_lpcon_ll.h +++ b/components/hal/esp32c6/include/hal/modem_lpcon_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -216,6 +216,13 @@ static inline void modem_lpcon_ll_set_lp_apb_icg_bitmap(modem_lpcon_dev_t *hw, u hw->clk_conf_power_st.clk_lp_apb_st_map = bitmap; } +__attribute__((always_inline)) +static inline void modem_lpcon_ll_reset_all(modem_lpcon_dev_t *hw) +{ + hw->rst_conf.val = 0xf; + hw->rst_conf.val = 0; +} + __attribute__((always_inline)) static inline uint32_t modem_lpcon_ll_get_date(modem_lpcon_dev_t *hw) {