fix(esp_phy): check hw freq hop done before disabling common clock

This commit is contained in:
zwx
2026-05-15 17:14:34 +08:00
parent 0f06a3c7e7
commit 26bf1eba50
5 changed files with 16 additions and 18 deletions
+7 -1
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -267,6 +267,12 @@ void esp_phy_sleep_data_init(void);
void esp_phy_sleep_data_deinit(void);
#endif
/**
* @brief Wait for frequency hardware hop to complete
*
*/
void phy_wait_freq_hw_hop_done(void);
#ifdef __cplusplus
}
#endif
+6
View File
@@ -377,3 +377,9 @@ void phy_wakeup_from_modem_state_extra_init(void)
}
#endif
#endif
__attribute__((weak)) void phy_wait_freq_hw_hop_done(void)
{
ESP_LOGD(TAG, "phy_wait_freq_hw_hop_done is not implemented");
return;
}
+1 -16
View File
@@ -36,12 +36,6 @@
#include "soc/rtc_periph.h"
// TODO: IDF-15338
#if CONFIG_IDF_TARGET_ESP32C5
#define FECOEX_SET_FREQ_SET_CHAN_REG (0x600a001c)
#define FECOEX_SET_FREQ_RESTEN (BIT(30))
#endif
#if CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION
#include "esp_partition.h"
#endif
@@ -363,22 +357,12 @@ void esp_phy_enable(esp_phy_modem_t modem)
#endif
sleep_modem_wifi_do_phy_retention(true, wifimac_link_is_sel);
} else {
// TODO: IDF-15338
#if CONFIG_IDF_TARGET_ESP32C5
REG_CLR_BIT(FECOEX_SET_FREQ_SET_CHAN_REG, FECOEX_SET_FREQ_RESTEN);
REG_SET_BIT(FECOEX_SET_FREQ_SET_CHAN_REG, FECOEX_SET_FREQ_RESTEN);
#endif
phy_wakeup_init();
}
} else {
phy_wakeup_from_modem_state_extra_init();
}
#else
// TODO: IDF-15338
#if CONFIG_IDF_TARGET_ESP32C5
REG_CLR_BIT(FECOEX_SET_FREQ_SET_CHAN_REG, FECOEX_SET_FREQ_RESTEN);
REG_SET_BIT(FECOEX_SET_FREQ_SET_CHAN_REG, FECOEX_SET_FREQ_RESTEN);
#endif
phy_wakeup_init();
#endif /* SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP */
@@ -456,6 +440,7 @@ void esp_phy_disable(esp_phy_modem_t modem)
// Update WiFi MAC time before disable WiFi/BT common peripheral clock
phy_update_wifi_mac_time(true, esp_timer_get_time());
#endif
phy_wait_freq_hw_hop_done();
// Disable WiFi/BT common peripheral clock. Do not disable clock for hardware RNG
esp_phy_common_clock_disable();
}
@@ -153,6 +153,7 @@ void esp_phy_disable(esp_phy_modem_t modem)
#endif
phy_close_rf();
phy_xpd_tsens();
phy_wait_freq_hw_hop_done();
#if SOC_MODEM_CLOCK_IS_INDEPENDENT
modem_clock_module_disable(PERIPH_PHY_MODULE);
#endif