From 6be09eb5b85540f9b9ebedb5f3c642e6516dd575 Mon Sep 17 00:00:00 2001 From: Lou Tianhao Date: Wed, 11 Sep 2024 14:48:50 +0800 Subject: [PATCH] change(pm): replace SOC_CLK_RC32K_NOT_TO_USE with CONFIG_ESP_CLK_RC32K_NOT_TO_USE --- components/esp_hw_support/Kconfig | 9 +++++++++ components/esp_hw_support/modem_clock.c | 6 +++--- components/esp_hw_support/port/esp32c61/CMakeLists.txt | 2 +- components/esp_hw_support/sleep_modes.c | 4 ++-- components/soc/esp32c5/include/soc/Kconfig.soc_caps.in | 4 ---- components/soc/esp32c5/include/soc/soc_caps.h | 1 - components/soc/esp32c61/include/soc/Kconfig.soc_caps.in | 4 ---- components/soc/esp32c61/include/soc/soc_caps.h | 1 - 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/components/esp_hw_support/Kconfig b/components/esp_hw_support/Kconfig index c3cdf5062f..167d828de2 100644 --- a/components/esp_hw_support/Kconfig +++ b/components/esp_hw_support/Kconfig @@ -273,4 +273,13 @@ menu "Hardware Settings" config ESP_SPI_BUS_LOCK_FUNCS_IN_IRAM bool default n + + config ESP_CLK_RC32K_NOT_TO_USE + bool + default y if IDF_TARGET_ESP32C5 || IDF_TARGET_ESP32C61 + default n + help + Due to the poor low-temperature characteristics of + RC32K (it cannot operate below -40 degrees Celsius), + please avoid using it whenever possible endmenu diff --git a/components/esp_hw_support/modem_clock.c b/components/esp_hw_support/modem_clock.c index a4ae39be5c..63066d6302 100644 --- a/components/esp_hw_support/modem_clock.c +++ b/components/esp_hw_support/modem_clock.c @@ -423,7 +423,7 @@ void modem_clock_select_lp_clock_source(periph_module_t module, modem_clock_lpcl esp_sleep_pd_domain_t pd_domain = (esp_sleep_pd_domain_t) ( (last_src == MODEM_CLOCK_LPCLK_SRC_RC_FAST) ? ESP_PD_DOMAIN_RC_FAST : (last_src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) ? ESP_PD_DOMAIN_XTAL : -#if !SOC_CLK_RC32K_NOT_TO_USE +#if !CONFIG_ESP_CLK_RC32K_NOT_TO_USE (last_src == MODEM_CLOCK_LPCLK_SRC_RC32K) ? ESP_PD_DOMAIN_RC32K : #endif (last_src == MODEM_CLOCK_LPCLK_SRC_XTAL32K) ? ESP_PD_DOMAIN_XTAL32K : @@ -431,7 +431,7 @@ void modem_clock_select_lp_clock_source(periph_module_t module, modem_clock_lpcl esp_sleep_pd_domain_t pu_domain = (esp_sleep_pd_domain_t) ( (src == MODEM_CLOCK_LPCLK_SRC_RC_FAST) ? ESP_PD_DOMAIN_RC_FAST : (src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) ? ESP_PD_DOMAIN_XTAL : -#if !SOC_CLK_RC32K_NOT_TO_USE +#if !CONFIG_ESP_CLK_RC32K_NOT_TO_USE (src == MODEM_CLOCK_LPCLK_SRC_RC32K) ? ESP_PD_DOMAIN_RC32K : #endif (src == MODEM_CLOCK_LPCLK_SRC_XTAL32K) ? ESP_PD_DOMAIN_XTAL32K : @@ -486,7 +486,7 @@ void modem_clock_deselect_lp_clock_source(periph_module_t module) esp_sleep_pd_domain_t pd_domain = (esp_sleep_pd_domain_t) ( (last_src == MODEM_CLOCK_LPCLK_SRC_RC_FAST) ? ESP_PD_DOMAIN_RC_FAST : (last_src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) ? ESP_PD_DOMAIN_XTAL : -#if !SOC_CLK_RC32K_NOT_TO_USE +#if !CONFIG_ESP_CLK_RC32K_NOT_TO_USE (last_src == MODEM_CLOCK_LPCLK_SRC_RC32K) ? ESP_PD_DOMAIN_RC32K : #endif (last_src == MODEM_CLOCK_LPCLK_SRC_XTAL32K) ? ESP_PD_DOMAIN_XTAL32K : diff --git a/components/esp_hw_support/port/esp32c61/CMakeLists.txt b/components/esp_hw_support/port/esp32c61/CMakeLists.txt index 45cdcebb73..0e720dc029 100644 --- a/components/esp_hw_support/port/esp32c61/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32c61/CMakeLists.txt @@ -17,7 +17,7 @@ if(NOT BOOTLOADER_BUILD) endif() -# TODO: [ESP32C61] IDF-9250 +# TODO: [ESP32C61] IDF-9304 if(CONFIG_IDF_TARGET_ESP32C61) list(REMOVE_ITEM srcs "sar_periph_ctrl.c" diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 084f417ab5..44edbe8cfd 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -709,7 +709,7 @@ FORCE_INLINE_ATTR void misc_modules_wake_prepare(uint32_t pd_flags) #if SOC_USB_SERIAL_JTAG_SUPPORTED && !SOC_USB_SERIAL_JTAG_SUPPORT_LIGHT_SLEEP sleep_console_usj_pad_restore(); #endif -#if !CONFIG_IDF_TARGET_ESP32C61 +#if !CONFIG_IDF_TARGET_ESP32C61 // TODO: IDF-9304 sar_periph_ctrl_power_enable(); #endif #if CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP && SOC_PM_CPU_RETENTION_BY_RTCCNTL @@ -2363,7 +2363,7 @@ static uint32_t get_power_down_flags(void) } #endif #if SOC_PM_SUPPORT_RC32K_PD -#if !SOC_CLK_RC32K_NOT_TO_USE +#if !CONFIG_ESP_CLK_RC32K_NOT_TO_USE if (s_config.domain[ESP_PD_DOMAIN_RC32K].pd_option != ESP_PD_OPTION_ON) { pd_flags |= PMU_SLEEP_PD_RC32K; } diff --git a/components/soc/esp32c5/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c5/include/soc/Kconfig.soc_caps.in index 0ac05a0ce3..7435729305 100644 --- a/components/soc/esp32c5/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c5/include/soc/Kconfig.soc_caps.in @@ -1359,10 +1359,6 @@ config SOC_CLK_LP_FAST_SUPPORT_XTAL bool default y -config SOC_CLK_RC32K_NOT_TO_USE - bool - default y - config SOC_RCC_IS_INDEPENDENT bool default y diff --git a/components/soc/esp32c5/include/soc/soc_caps.h b/components/soc/esp32c5/include/soc/soc_caps.h index 2cad5a7f94..9f3de8cea2 100644 --- a/components/soc/esp32c5/include/soc/soc_caps.h +++ b/components/soc/esp32c5/include/soc/soc_caps.h @@ -579,7 +579,6 @@ #define SOC_CLK_XTAL32K_SUPPORTED (1) /*!< Support to connect an external low frequency crystal */ #define SOC_CLK_OSC_SLOW_SUPPORTED (1) /*!< Support to connect an external oscillator, not a crystal */ #define SOC_CLK_LP_FAST_SUPPORT_XTAL (1) /*!< Support XTAL clock as the LP_FAST clock source */ -#define SOC_CLK_RC32K_NOT_TO_USE (1) /*!< Due to the poor low-temperature characteristics of RC32K (it cannot operate below -40 degrees Celsius), please avoid using it whenever possible. */ #define SOC_RCC_IS_INDEPENDENT 1 /*!< Reset and Clock Control is independent, thanks to the PCR registers */ /*-------------------------- Temperature Sensor CAPS -------------------------------------*/ diff --git a/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in index 84726d1f45..30f9cf7ea3 100644 --- a/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in @@ -895,10 +895,6 @@ config SOC_CLK_LP_FAST_SUPPORT_XTAL bool default y -config SOC_CLK_RC32K_NOT_TO_USE - bool - default y - config SOC_RCC_IS_INDEPENDENT bool default y diff --git a/components/soc/esp32c61/include/soc/soc_caps.h b/components/soc/esp32c61/include/soc/soc_caps.h index 97eb9686ca..12229b1b9a 100644 --- a/components/soc/esp32c61/include/soc/soc_caps.h +++ b/components/soc/esp32c61/include/soc/soc_caps.h @@ -453,7 +453,6 @@ #define SOC_CLK_XTAL32K_SUPPORTED (1) /*!< Support to connect an external low frequency crystal */ #define SOC_CLK_OSC_SLOW_SUPPORTED (1) /*!< Support to connect an external oscillator, not a crystal */ #define SOC_CLK_LP_FAST_SUPPORT_XTAL (1) /*!< Support XTAL clock as the LP_FAST clock source */ -#define SOC_CLK_RC32K_NOT_TO_USE (1) /*!< Due to the poor low-temperature characteristics of RC32K (it cannot operate below -40 degrees Celsius), please avoid using it whenever possible. */ #define SOC_RCC_IS_INDEPENDENT 1 /*!< Reset and Clock Control is independent, thanks to the PCR registers */ /*-------------------------- Temperature Sensor CAPS -------------------------------------*/