diff --git a/components/esp_phy/Kconfig b/components/esp_phy/Kconfig index 19e969170d..e3bb40f3db 100644 --- a/components/esp_phy/Kconfig +++ b/components/esp_phy/Kconfig @@ -81,7 +81,7 @@ menu "PHY" config ESP32_PHY_MAC_BB_PD bool "Power down MAC and baseband of Wi-Fi and Bluetooth when PHY is disabled" - depends on (IDF_TARGET_ESP32C3 && FREERTOS_USE_TICKLESS_IDLE) + depends on ((IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3) && FREERTOS_USE_TICKLESS_IDLE) default n help If enabled, the MAC and baseband of Wi-Fi and Bluetooth will be powered diff --git a/components/esp_rom/include/esp32s3/rom/apb_backup_dma.h b/components/esp_rom/include/esp32s3/rom/apb_backup_dma.h new file mode 100644 index 0000000000..324135cb83 --- /dev/null +++ b/components/esp_rom/include/esp32s3/rom/apb_backup_dma.h @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +void ets_apb_backup_init_lock_func(void(* _apb_backup_lock)(void), void(* _apb_backup_unlock)(void)); + +#ifdef __cplusplus +} +#endif diff --git a/components/esp_system/port/soc/esp32s3/CMakeLists.txt b/components/esp_system/port/soc/esp32s3/CMakeLists.txt index 3aca18904a..b944b7f875 100644 --- a/components/esp_system/port/soc/esp32s3/CMakeLists.txt +++ b/components/esp_system/port/soc/esp32s3/CMakeLists.txt @@ -3,6 +3,7 @@ set(srcs "highint_hdl.S" "reset_reason.c" "system_internal.c" "cache_err_int.c" + "apb_backup_dma.c" "../../arch/xtensa/panic_arch.c" "../../arch/xtensa/panic_handler_asm.S" "../../arch/xtensa/expression_with_stack.c" diff --git a/components/esp_system/port/soc/esp32s3/apb_backup_dma.c b/components/esp_system/port/soc/esp32s3/apb_backup_dma.c new file mode 100644 index 0000000000..ef4d2558ad --- /dev/null +++ b/components/esp_system/port/soc/esp32s3/apb_backup_dma.c @@ -0,0 +1,36 @@ +/* + * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "soc/soc_caps.h" +#include "esp_attr.h" +#include "freertos/FreeRTOS.h" +#include "freertos/portmacro.h" +#include "esp32s3/rom/apb_backup_dma.h" + +static portMUX_TYPE s_apb_backup_dma_mutex = portMUX_INITIALIZER_UNLOCKED; + +static void IRAM_ATTR apb_backup_dma_lock(void) +{ + if (xPortInIsrContext()) { + portENTER_CRITICAL_ISR(&s_apb_backup_dma_mutex); + } else { + portENTER_CRITICAL(&s_apb_backup_dma_mutex); + } +} + +static void IRAM_ATTR apb_backup_dma_unlock(void) +{ + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(&s_apb_backup_dma_mutex); + } else { + portEXIT_CRITICAL(&s_apb_backup_dma_mutex); + } +} + +void esp_apb_backup_dma_lock_init(void) +{ + ets_apb_backup_init_lock_func(apb_backup_dma_lock, apb_backup_dma_unlock); +} diff --git a/components/soc/esp32s3/include/soc/soc_caps.h b/components/soc/esp32s3/include/soc/soc_caps.h index b3680c6bd8..b8f2d55260 100644 --- a/components/soc/esp32s3/include/soc/soc_caps.h +++ b/components/soc/esp32s3/include/soc/soc_caps.h @@ -39,6 +39,8 @@ #define SOC_ADC_SUPPORT_RTC_CTRL (1) #define SOC_ADC_ARBITER_SUPPORTED (1) +/*-------------------------- APB BACKUP DMA CAPS -------------------------------*/ +#define SOC_APB_BACKUP_DMA (1) /*-------------------------- BROWNOUT CAPS -----------------------------------*/ #include "brownout_caps.h" diff --git a/components/soc/esp32s3/include/soc/syscon_reg.h b/components/soc/esp32s3/include/soc/syscon_reg.h index 6706ccc53d..f8d8516dd5 100644 --- a/components/soc/esp32s3/include/soc/syscon_reg.h +++ b/components/soc/esp32s3/include/soc/syscon_reg.h @@ -169,9 +169,9 @@ extern "C" { #define SYSTEM_WIFI_CLK_EN_REG SYSCON_WIFI_CLK_EN_REG /* SYSTEM_WIFI_CLK_EN : R/W ;bitpos:[31:0] ;default: 32'hfffce030 ; */ /*description: */ -#define SYSTEM_WIFI_CLK_EN 0xFFFFFFFF +#define SYSTEM_WIFI_CLK_EN 0x00FB9FCF #define SYSTEM_WIFI_CLK_EN_M ((SYSTEM_WIFI_CLK_EN_V) << (SYSTEM_WIFI_CLK_EN_S)) -#define SYSTEM_WIFI_CLK_EN_V 0xFFFFFFFF +#define SYSTEM_WIFI_CLK_EN_V 0x00FB9FCF #define SYSTEM_WIFI_CLK_EN_S 0 /* Mask for all Wifi clock bits, 6 */