Skip to content

Commit 7563ae5

Browse files
esp-wzhespressif-bot
authored andcommitted
fix(esp_system): deselect all modem modules clk source selection before clk init
1 parent 4143156 commit 7563ae5

File tree

6 files changed

+23
-1
lines changed

6 files changed

+23
-1
lines changed

components/esp_hw_support/include/esp_private/esp_modem_clock.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -107,9 +107,15 @@ void modem_clock_select_lp_clock_source(periph_module_t module, modem_clock_lpcl
107107

108108
/**
109109
* @brief Disable lowpower clock source selection
110+
* @param module modem module
110111
*/
111112
void modem_clock_deselect_lp_clock_source(periph_module_t module);
112113

114+
/**
115+
* @brief Disable all modem module's lowpower clock source selection
116+
*/
117+
void modem_clock_deselect_all_module_lp_clock_source(void);
118+
113119
/**
114120
* @brief Reset wifi mac
115121
*/

components/esp_hw_support/modem_clock.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,17 @@ void IRAM_ATTR modem_clock_module_disable(periph_module_t module)
346346
modem_clock_device_disable(MODEM_CLOCK_instance(), deps);
347347
}
348348

349+
void modem_clock_deselect_all_module_lp_clock_source(void)
350+
{
351+
#if SOC_WIFI_SUPPORTED
352+
modem_clock_hal_deselect_all_wifi_lpclk_source(MODEM_CLOCK_instance()->hal);
353+
#endif
354+
#if SOC_BT_SUPPORTED
355+
modem_clock_hal_deselect_all_ble_rtc_timer_lpclk_source(MODEM_CLOCK_instance()->hal);
356+
#endif
357+
modem_clock_hal_deselect_all_coex_lpclk_source(MODEM_CLOCK_instance()->hal);
358+
}
359+
349360
void modem_clock_select_lp_clock_source(periph_module_t module, modem_clock_lpclk_src_t src, uint32_t divider)
350361
{
351362
assert(IS_MODEM_MODULE(module));

components/esp_system/port/soc/esp32c5/clk.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ __attribute__((weak)) void esp_clk_init(void)
8383
wdt_hal_write_protect_enable(&rtc_wdt_ctx);
8484
#endif
8585

86+
modem_clock_deselect_all_module_lp_clock_source();
8687
#if defined(CONFIG_RTC_CLK_SRC_EXT_CRYS)
8788
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_XTAL32K);
8889
#elif defined(CONFIG_RTC_CLK_SRC_EXT_OSC)

components/esp_system/port/soc/esp32c6/clk.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ __attribute__((weak)) void esp_clk_init(void)
102102
wdt_hal_write_protect_enable(&rtc_wdt_ctx);
103103
#endif
104104

105+
modem_clock_deselect_all_module_lp_clock_source();
105106
#if defined(CONFIG_RTC_CLK_SRC_EXT_CRYS)
106107
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_XTAL32K);
107108
#elif defined(CONFIG_RTC_CLK_SRC_EXT_OSC)

components/esp_system/port/soc/esp32c61/clk.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ __attribute__((weak)) void esp_clk_init(void)
7575
wdt_hal_write_protect_enable(&rtc_wdt_ctx);
7676
#endif
7777

78+
modem_clock_deselect_all_module_lp_clock_source();
7879
#if defined(CONFIG_RTC_CLK_SRC_EXT_CRYS)
7980
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_XTAL32K);
8081
#elif defined(CONFIG_RTC_CLK_SRC_EXT_OSC)

components/esp_system/port/soc/esp32h2/clk.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "hal/temperature_sensor_ll.h"
4444
#include "hal/usb_serial_jtag_ll.h"
4545
#include "esp_private/periph_ctrl.h"
46+
#include "esp_private/esp_modem_clock.h"
4647
#include "esp_private/esp_clk.h"
4748
#include "esp_private/esp_pmu.h"
4849
#include "esp_rom_uart.h"
@@ -101,6 +102,7 @@ __attribute__((weak)) void esp_clk_init(void)
101102
wdt_hal_write_protect_enable(&rtc_wdt_ctx);
102103
#endif
103104

105+
modem_clock_deselect_all_module_lp_clock_source();
104106
#if defined(CONFIG_RTC_CLK_SRC_EXT_CRYS)
105107
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_XTAL32K);
106108
#elif defined(CONFIG_RTC_CLK_SRC_EXT_OSC)

0 commit comments

Comments
 (0)