From 08c77a7eaf1e6aabe7509ef8a89c1fde56390900 Mon Sep 17 00:00:00 2001 From: Armando Date: Sun, 23 Apr 2023 18:17:25 +0800 Subject: [PATCH] sar: init sar periph power state --- components/esp_hw_support/port/esp32/rtc_init.c | 8 ++++++++ components/esp_hw_support/port/esp32c2/rtc_init.c | 8 ++++++++ components/esp_hw_support/port/esp32c3/rtc_init.c | 8 ++++++++ components/esp_hw_support/port/esp32h2/rtc_init.c | 8 ++++++++ components/esp_hw_support/port/esp32s2/rtc_init.c | 8 ++++++++ components/esp_hw_support/port/esp32s3/rtc_init.c | 9 +++++++++ 6 files changed, 49 insertions(+) diff --git a/components/esp_hw_support/port/esp32/rtc_init.c b/components/esp_hw_support/port/esp32/rtc_init.c index e32cdb03ae..ab0fa4bd1d 100644 --- a/components/esp_hw_support/port/esp32/rtc_init.c +++ b/components/esp_hw_support/port/esp32/rtc_init.c @@ -12,6 +12,9 @@ #include "soc/dport_reg.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) @@ -104,6 +107,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/esp32c2/rtc_init.c b/components/esp_hw_support/port/esp32c2/rtc_init.c index 5c9124d132..e8ec002a09 100644 --- a/components/esp_hw_support/port/esp32c2/rtc_init.c +++ b/components/esp_hw_support/port/esp32c2/rtc_init.c @@ -21,6 +21,9 @@ #include "esp_hw_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"; @@ -121,6 +124,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/esp32c3/rtc_init.c b/components/esp_hw_support/port/esp32c3/rtc_init.c index 05aeb43e81..2fcaea56f9 100644 --- a/components/esp_hw_support/port/esp32c3/rtc_init.c +++ b/components/esp_hw_support/port/esp32c3/rtc_init.c @@ -21,6 +21,9 @@ #include "esp_hw_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"; @@ -166,6 +169,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 975b5bf85e..80adb0ffff 100644 --- a/components/esp_hw_support/port/esp32h2/rtc_init.c +++ b/components/esp_hw_support/port/esp32h2/rtc_init.c @@ -20,6 +20,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); @@ -135,6 +138,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 7212b02b5d..8704de924a 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 "esp_hw_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"; @@ -173,6 +176,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 a0dcaea78f..dc8fd6dec7 100644 --- a/components/esp_hw_support/port/esp32s3/rtc_init.c +++ b/components/esp_hw_support/port/esp32s3/rtc_init.c @@ -25,6 +25,10 @@ #include "esp_efuse_table.h" #include "esp_private/spi_flash_os.h" #include "hal/efuse_hal.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) @@ -206,6 +210,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)