From 20e596bbcf99cdbf0588b9894850d50c7be90643 Mon Sep 17 00:00:00 2001 From: wangmengyang Date: Thu, 16 Mar 2023 12:09:14 +0800 Subject: [PATCH] esp_phy: fix failure of unit test for test_phy_rtc_init on ESP32-C6 - esp_phy_enable() blocks in the unit test due to the FE related functions in modem clock registers are not enabled. This MR adds dependency of FE for PHY module. --- components/esp_hw_support/modem_clock.c | 2 +- components/esp_phy/test/test_phy_rtc.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/esp_hw_support/modem_clock.c b/components/esp_hw_support/modem_clock.c index 73887054b2..ffb5f9aab3 100644 --- a/components/esp_hw_support/modem_clock.c +++ b/components/esp_hw_support/modem_clock.c @@ -202,7 +202,7 @@ static void IRAM_ATTR modem_clock_device_disable(modem_clock_context_t *ctx, uin #define BLE_CLOCK_DEPS (MODEM_CLOCK_BLE_MAC | MODEM_CLOCK_FE | MODEM_CLOCK_BLE_BB | MODEM_CLOCK_ETM | MODEM_CLOCK_COEXIST) #define IEEE802154_CLOCK_DEPS (MODEM_CLOCK_802154_MAC | MODEM_CLOCK_FE | MODEM_CLOCK_BLE_BB | MODEM_CLOCK_ETM | MODEM_CLOCK_COEXIST) #define COEXIST_CLOCK_DEPS (MODEM_CLOCK_COEXIST) -#define PHY_CLOCK_DEPS (MODEM_CLOCK_I2C_MASTER) +#define PHY_CLOCK_DEPS (MODEM_CLOCK_I2C_MASTER | MODEM_CLOCK_FE) void IRAM_ATTR modem_clock_module_enable(periph_module_t module) { diff --git a/components/esp_phy/test/test_phy_rtc.c b/components/esp_phy/test/test_phy_rtc.c index 8a58ee98d2..88e34e037e 100644 --- a/components/esp_phy/test/test_phy_rtc.c +++ b/components/esp_phy/test/test_phy_rtc.c @@ -11,9 +11,10 @@ #include #include #include "soc/soc_caps.h" +#include "esp_private/esp_modem_clock.h" #include "esp_private/wifi.h" -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C6, ESP32H2) +#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32H2) //IDF-5046 #include "esp_phy_init.h" @@ -57,7 +58,9 @@ static IRAM_ATTR void test_phy_rtc_cache_task(void *arg) { //power up wifi and bt mac bb power domain esp_wifi_power_domain_on(); - +#if CONFIG_IDF_TARGET_ESP32C6 + modem_clock_module_enable(PERIPH_PHY_MODULE); +#endif // CONFIG_IDF_TARGET_ESP32C6 test_phy_rtc_init(); #if CONFIG_IDF_TARGET_ESP32 @@ -97,6 +100,9 @@ static IRAM_ATTR void test_phy_rtc_cache_task(void *arg) #endif //SOC_BT_SUPPORTED +#if CONFIG_IDF_TARGET_ESP32C6 + modem_clock_module_disable(PERIPH_PHY_MODULE); +#endif // CONFIG_IDF_TARGET_ESP32C6 //power down wifi and bt mac bb power domain esp_wifi_power_domain_off();