From 902d531f3f23af99e7d5c3cded446c99671d6708 Mon Sep 17 00:00:00 2001 From: zwx Date: Fri, 13 Feb 2026 17:14:33 +0800 Subject: [PATCH] fix(phy): add workaround for phy hop stuck --- components/esp_phy/src/phy_init.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index 8ffd48c046..2484bab409 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -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 */ @@ -35,6 +35,12 @@ #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 @@ -334,12 +340,22 @@ void esp_phy_enable(esp_phy_modem_t modem) if (sleep_modem_wifi_modem_state_enabled() && sleep_modem_wifi_modem_link_done()) { sleep_modem_wifi_do_phy_retention(true); } 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 */