diff --git a/components/esp_hw_support/component.mk b/components/esp_hw_support/component.mk index 2f762ab2b4..15516c365c 100644 --- a/components/esp_hw_support/component.mk +++ b/components/esp_hw_support/component.mk @@ -17,7 +17,8 @@ COMPONENT_OBJEXCLUDE += clk_ctrl_os.o \ port/$(IDF_TARGET)/cache_sram_mmu.o \ port/$(IDF_TARGET)/esp_himem.o \ port/$(IDF_TARGET)/spiram.o \ - port/$(IDF_TARGET)/spiram_psram.o + port/$(IDF_TARGET)/spiram_psram.o \ + port/$(IDF_TARGET)/sar_periph_ctrl.o endif ifdef CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp_hw_support/port/esp32/rtc_init.c b/components/esp_hw_support/port/esp32/rtc_init.c index e01d604477..e4dccc6f94 100644 --- a/components/esp_hw_support/port/esp32/rtc_init.c +++ b/components/esp_hw_support/port/esp32/rtc_init.c @@ -13,6 +13,9 @@ #include "soc/efuse_periph.h" #include "hal/efuse_ll.h" #include "soc/gpio_periph.h" +#ifndef BOOTLOADER_BUILD +#include "esp_private/sar_periph_ctrl.h" +#endif void rtc_init(rtc_config_t cfg) @@ -95,6 +98,11 @@ void rtc_init(rtc_config_t cfg) REG_WRITE(RTC_CNTL_INT_ENA_REG, 0); REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX); + +#ifndef BOOTLOADER_BUILD + //initialise SAR related peripheral register settings + sar_periph_ctrl_init(); +#endif } rtc_vddsdio_config_t rtc_vddsdio_get_config(void) diff --git a/components/esp_hw_support/port/esp32c3/rtc_init.c b/components/esp_hw_support/port/esp32c3/rtc_init.c index 3511bda87c..6e29e9008c 100644 --- a/components/esp_hw_support/port/esp32c3/rtc_init.c +++ b/components/esp_hw_support/port/esp32c3/rtc_init.c @@ -19,6 +19,9 @@ #include "soc_log.h" #include "esp_efuse.h" #include "esp_efuse_table.h" +#ifndef BOOTLOADER_BUILD +#include "esp_private/sar_periph_ctrl.h" +#endif static const char *TAG = "rtc_init"; @@ -154,6 +157,11 @@ void rtc_init(rtc_config_t cfg) REG_WRITE(RTC_CNTL_INT_ENA_REG, 0); REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX); REGI2C_WRITE_MASK(I2C_ULP, I2C_ULP_IR_FORCE_XPD_CK, 1); + +#ifndef BOOTLOADER_BUILD + //initialise SAR related peripheral register settings + sar_periph_ctrl_init(); +#endif } rtc_vddsdio_config_t rtc_vddsdio_get_config(void) diff --git a/components/esp_hw_support/port/esp32h2/rtc_init.c b/components/esp_hw_support/port/esp32h2/rtc_init.c index 7b684d3d3d..3ee027e7c2 100644 --- a/components/esp_hw_support/port/esp32h2/rtc_init.c +++ b/components/esp_hw_support/port/esp32h2/rtc_init.c @@ -22,6 +22,9 @@ #include "esp_efuse_table.h" #include "i2c_pmu.h" #include "soc/clkrst_reg.h" +#ifndef BOOTLOADER_BUILD +#include "esp_private/sar_periph_ctrl.h" +#endif void pmu_ctl(void); void dcdc_ctl(uint32_t mode); @@ -132,6 +135,11 @@ void rtc_init(rtc_config_t cfg) } /* config dcdc frequency */ REG_SET_FIELD(RTC_CNTL_DCDC_CTRL0_REG, RTC_CNTL_FSW_DCDC, RTC_CNTL_DCDC_FREQ_DEFAULT); + +#ifndef BOOTLOADER_BUILD + //initialise SAR related peripheral register settings + sar_periph_ctrl_init(); +#endif } void pmu_ctl(void) diff --git a/components/esp_hw_support/port/esp32s2/rtc_init.c b/components/esp_hw_support/port/esp32s2/rtc_init.c index 0f446730a4..2b6ad6ba3e 100644 --- a/components/esp_hw_support/port/esp32s2/rtc_init.c +++ b/components/esp_hw_support/port/esp32s2/rtc_init.c @@ -18,6 +18,9 @@ #include "soc_log.h" #include "esp_efuse.h" #include "esp_efuse_table.h" +#ifndef BOOTLOADER_BUILD +#include "esp_private/sar_periph_ctrl.h" +#endif __attribute__((unused)) static const char *TAG = "rtc_init"; @@ -163,6 +166,11 @@ void rtc_init(rtc_config_t cfg) REG_WRITE(RTC_CNTL_INT_ENA_REG, 0); REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX); + +#ifndef BOOTLOADER_BUILD + //initialise SAR related peripheral register settings + sar_periph_ctrl_init(); +#endif } rtc_vddsdio_config_t rtc_vddsdio_get_config(void) diff --git a/components/esp_hw_support/port/esp32s3/rtc_init.c b/components/esp_hw_support/port/esp32s3/rtc_init.c index 844c508a62..a664da698e 100644 --- a/components/esp_hw_support/port/esp32s3/rtc_init.c +++ b/components/esp_hw_support/port/esp32s3/rtc_init.c @@ -22,6 +22,9 @@ #include "esp_efuse.h" #include "esp_efuse_table.h" #include "esp_private/spi_flash_os.h" +#ifndef BOOTLOADER_BUILD +#include "esp_private/sar_periph_ctrl.h" +#endif #define RTC_CNTL_MEM_FORCE_NOISO (RTC_CNTL_SLOWMEM_FORCE_NOISO | RTC_CNTL_FASTMEM_FORCE_NOISO) @@ -194,6 +197,11 @@ void rtc_init(rtc_config_t cfg) REG_WRITE(RTC_CNTL_INT_ENA_REG, 0); REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX); + +#ifndef BOOTLOADER_BUILD + //initialise SAR related peripheral register settings + sar_periph_ctrl_init(); +#endif } rtc_vddsdio_config_t rtc_vddsdio_get_config(void)