Parcourir la source

Merge branch 'feature/brownout_bringup_c6' into 'master'

BOD: Bringup for ESP32C6

Closes IDF-5345

See merge request espressif/esp-idf!21888
C.S.M il y a 3 ans
Parent
commit
faac178784
36 fichiers modifiés avec 961 ajouts et 276 suppressions
  1. 5 1
      components/esp_system/port/CMakeLists.txt
  2. 9 12
      components/esp_system/port/brownout.c
  3. 4 8
      components/hal/CMakeLists.txt
  4. 19 0
      components/hal/brownout_hal.c
  5. 0 34
      components/hal/esp32/brownout_hal.c
  6. 107 0
      components/hal/esp32/include/hal/brownout_ll.h
  7. 0 38
      components/hal/esp32c2/brownout_hal.c
  8. 110 0
      components/hal/esp32c2/include/hal/brownout_ll.h
  9. 0 37
      components/hal/esp32c3/brownout_hal.c
  10. 110 0
      components/hal/esp32c3/include/hal/brownout_ll.h
  11. 0 26
      components/hal/esp32c6/brownout_hal.c
  12. 110 0
      components/hal/esp32c6/include/hal/brownout_ll.h
  13. 110 0
      components/hal/esp32h2/include/hal/brownout_ll.h
  14. 0 39
      components/hal/esp32h4/brownout_hal.c
  15. 111 0
      components/hal/esp32h4/include/hal/brownout_ll.h
  16. 0 39
      components/hal/esp32s2/brownout_hal.c
  17. 111 0
      components/hal/esp32s2/include/hal/brownout_ll.h
  18. 0 39
      components/hal/esp32s3/brownout_hal.c
  19. 110 0
      components/hal/esp32s3/include/hal/brownout_ll.h
  20. 5 3
      components/hal/include/hal/brownout_hal.h
  21. 4 0
      components/soc/esp32/include/soc/Kconfig.soc_caps.in
  22. 1 0
      components/soc/esp32/include/soc/soc_caps.h
  23. 4 0
      components/soc/esp32c2/include/soc/Kconfig.soc_caps.in
  24. 1 0
      components/soc/esp32c2/include/soc/soc_caps.h
  25. 4 0
      components/soc/esp32c3/include/soc/Kconfig.soc_caps.in
  26. 1 0
      components/soc/esp32c3/include/soc/soc_caps.h
  27. 4 0
      components/soc/esp32c6/include/soc/Kconfig.soc_caps.in
  28. 1 0
      components/soc/esp32c6/include/soc/soc_caps.h
  29. 4 0
      components/soc/esp32h2/include/soc/Kconfig.soc_caps.in
  30. 1 0
      components/soc/esp32h2/include/soc/soc_caps.h
  31. 4 0
      components/soc/esp32h4/include/soc/Kconfig.soc_caps.in
  32. 1 0
      components/soc/esp32h4/include/soc/soc_caps.h
  33. 4 0
      components/soc/esp32s2/include/soc/Kconfig.soc_caps.in
  34. 1 0
      components/soc/esp32s2/include/soc/soc_caps.h
  35. 4 0
      components/soc/esp32s3/include/soc/Kconfig.soc_caps.in
  36. 1 0
      components/soc/esp32s3/include/soc/soc_caps.h

+ 5 - 1
components/esp_system/port/CMakeLists.txt

@@ -6,7 +6,11 @@ endif()
 
 target_include_directories(${COMPONENT_LIB} PRIVATE ${INCLUDE_FILES} include/private)
 
-set(srcs "cpu_start.c" "panic_handler.c" "brownout.c" "esp_system_chip.c")
+set(srcs "cpu_start.c" "panic_handler.c" "esp_system_chip.c")
+
+if(CONFIG_SOC_BOD_SUPPORTED)
+    list(APPEND srcs "brownout.c")
+endif()
 
 add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" ${srcs})
 

+ 9 - 12
components/esp_system/port/brownout.c

@@ -8,23 +8,18 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdbool.h>
-
 #include "esp_private/system_internal.h"
 #include "esp_private/rtc_ctrl.h"
 #include "esp_private/spi_flash_os.h"
-
 #include "esp_rom_sys.h"
 #include "esp_cpu.h"
-
 #include "soc/soc.h"
-
 #include "soc/rtc_periph.h"
 #include "esp_attr.h"
 #include "bootloader_flash.h"
 #include "esp_intr_alloc.h"
-
 #include "hal/brownout_hal.h"
-
+#include "hal/brownout_ll.h"
 #include "sdkconfig.h"
 
 #if defined(CONFIG_ESP_BROWNOUT_DET_LVL)
@@ -40,7 +35,7 @@ IRAM_ATTR static void rtc_brownout_isr_handler(void *arg)
      * handler returns. Since restart is called here, the flag needs to be
      * cleared manually.
      */
-    brownout_hal_intr_clear();
+    brownout_ll_intr_clear();
 
     // Stop the other core.
 #if !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE
@@ -75,13 +70,15 @@ void esp_brownout_init(void)
     };
 
     brownout_hal_config(&cfg);
-    brownout_hal_intr_clear();
-#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2// ESP32-C6, ESP32-H2 TODO: IDF-5645
-    rtc_isr_register(rtc_brownout_isr_handler, NULL, LP_ANALOG_PERI_LP_ANA_BOD_MODE0_LP_INT_ENA_M, RTC_INTR_FLAG_IRAM);
+    brownout_ll_intr_clear();
+#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
+    // TODO IDF-6606: LP_RTC_TIMER interrupt source is shared by lp_timer and brownout detector, but lp_timer interrupt
+    // is not used now. An interrupt allocator is needed when lp_timer intr gets supported.
+    esp_intr_alloc(ETS_LP_RTC_TIMER_INTR_SOURCE, ESP_INTR_FLAG_IRAM, &rtc_brownout_isr_handler, NULL, NULL);
 #else
     rtc_isr_register(rtc_brownout_isr_handler, NULL, RTC_CNTL_BROWN_OUT_INT_ENA_M, RTC_INTR_FLAG_IRAM);
 #endif
-    brownout_hal_intr_enable(true);
+    brownout_ll_intr_enable(true);
 
 #else // brownout without interrupt
 
@@ -105,7 +102,7 @@ void esp_brownout_disable(void)
 
     brownout_hal_config(&cfg);
 #if CONFIG_ESP_SYSTEM_BROWNOUT_INTR
-    brownout_hal_intr_enable(false);
+    brownout_ll_intr_enable(false);
     rtc_isr_deregister(rtc_brownout_isr_handler, NULL);
 #endif // CONFIG_ESP_SYSTEM_BROWNOUT_INTR
 }

+ 4 - 8
components/hal/CMakeLists.txt

@@ -115,6 +115,10 @@ if(NOT BOOTLOADER_BUILD)
         list(APPEND srcs "${target}/modem_clock_hal.c")
     endif()
 
+    if(CONFIG_SOC_BOD_SUPPORTED)
+        list(APPEND srcs "brownout_hal.c")
+    endif()
+
     if(CONFIG_SOC_GPSPI_SUPPORTED)
         list(APPEND srcs
                     "spi_hal.c"
@@ -132,7 +136,6 @@ if(NOT BOOTLOADER_BUILD)
         list(APPEND srcs
             "sdio_slave_hal.c"
             "touch_sensor_hal.c"
-            "esp32/brownout_hal.c"
             "esp32/touch_sensor_hal.c"
             "esp32/gpio_hal_workaround.c")
     endif()
@@ -144,7 +147,6 @@ if(NOT BOOTLOADER_BUILD)
                     "usb_hal.c"
                     "usb_phy_hal.c"
                     "xt_wdt_hal.c"
-                    "esp32s2/brownout_hal.c"
                     "esp32s2/cp_dma_hal.c"
                     "esp32s2/touch_sensor_hal.c"
                     "usb_dwc_hal.c")
@@ -158,7 +160,6 @@ if(NOT BOOTLOADER_BUILD)
             "usb_hal.c"
             "usb_phy_hal.c"
             "xt_wdt_hal.c"
-            "esp32s3/brownout_hal.c"
             "hmac_hal.c"
             "esp32s3/touch_sensor_hal.c"
             "esp32s3/rtc_cntl_hal.c"
@@ -170,7 +171,6 @@ if(NOT BOOTLOADER_BUILD)
               "ds_hal.c"
               "spi_flash_hal_gpspi.c"
               "xt_wdt_hal.c"
-              "esp32c3/brownout_hal.c"
               "hmac_hal.c"
               "esp32c3/rtc_cntl_hal.c")
     endif()
@@ -180,7 +180,6 @@ if(NOT BOOTLOADER_BUILD)
             "ds_hal.c"
             "spi_flash_hal_gpspi.c"
             "aes_hal.c"
-            "esp32h4/brownout_hal.c"
             "hmac_hal.c"
             "esp32h4/rtc_cntl_hal.c")
     endif()
@@ -188,14 +187,12 @@ if(NOT BOOTLOADER_BUILD)
     if(${target} STREQUAL "esp32c2")
         list(APPEND srcs
               "spi_flash_hal_gpspi.c"
-              "esp32c2/brownout_hal.c"
               "esp32c2/rtc_cntl_hal.c")
     endif()
 
     if(${target} STREQUAL "esp32c6")
         list(APPEND srcs
               "spi_flash_hal_gpspi.c"
-              "esp32c6/brownout_hal.c"
               "esp32c6/rtc_cntl_hal.c"
               )
 
@@ -209,7 +206,6 @@ if(NOT BOOTLOADER_BUILD)
         list(REMOVE_ITEM srcs
                 "adc_oneshot_hal.c" # TODO: IDF-6214
                 "adc_hal_common.c" # TODO: IDF-6215
-                "esp32h2/brownout_hal.c"
                 "esp32h2/rtc_cntl_hal.c"
                 "timer_hal.c"
                 "timer_hal_iram.c"

+ 19 - 0
components/hal/brownout_hal.c

@@ -0,0 +1,19 @@
+
+/*
+ * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "hal/brownout_ll.h"
+#include "hal/brownout_hal.h"
+
+void brownout_hal_config(const brownout_hal_config_t *cfg)
+{
+    brownout_ll_set_intr_wait_cycles(2);
+    brownout_ll_enable_flash_power_down(cfg->flash_power_down);
+    brownout_ll_enable_rf_power_down(cfg->rf_power_down);
+    brownout_ll_reset_config(cfg->reset_enabled, 0x3ff, 1);
+    brownout_ll_set_threshold(cfg->threshold);
+    brownout_ll_bod_enable(cfg->enabled);
+}

+ 0 - 34
components/hal/esp32/brownout_hal.c

@@ -1,34 +0,0 @@
-
-/*
- * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "hal/brownout_hal.h"
-#include "soc/rtc_cntl_struct.h"
-#include "esp_attr.h"
-
-void brownout_hal_config(const brownout_hal_config_t *cfg)
-{
-    typeof(RTCCNTL.brown_out) brown_out_reg = {
-        .close_flash_ena = cfg->flash_power_down,
-        .pd_rf_ena = cfg->rf_power_down,
-        .rst_wait = 0x3ff,
-        .rst_ena = cfg->reset_enabled,
-        .thres = cfg->threshold,
-        .ena = cfg->enabled,
-    };
-
-    RTCCNTL.brown_out = brown_out_reg;
-}
-
-void brownout_hal_intr_enable(bool enable)
-{
-    RTCCNTL.int_ena.rtc_brown_out = enable;
-}
-
-IRAM_ATTR void brownout_hal_intr_clear(void)
-{
-    RTCCNTL.int_clr.rtc_brown_out = 1;
-}

+ 107 - 0
components/hal/esp32/include/hal/brownout_ll.h

@@ -0,0 +1,107 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*******************************************************************************
+ * NOTICE
+ * The ll is not public api, don't use in application code.
+ * See readme.md in hal/readme.md
+ ******************************************************************************/
+
+#pragma once
+#include <stdbool.h>
+#include "soc/rtc_cntl_struct.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief power down the flash when a brown out happens.
+ *
+ * @param enable true: power down flash. false: not power down
+ */
+static inline void brownout_ll_enable_flash_power_down(bool enable)
+{
+    RTCCNTL.brown_out.close_flash_ena = enable;
+}
+
+/**
+ * @brief power down the RF circuits when a brown out happens
+ *
+ * @param enable true: power down. false: not power done.
+ */
+static inline void brownout_ll_enable_rf_power_down(bool enable)
+{
+    RTCCNTL.brown_out.pd_rf_ena = enable;
+}
+
+/**
+ * @brief Enable this to reset brown out
+ *
+ * @note: If brown out interrupt is used, this should be disabled.
+ *
+ * @param reset_ena true: enable reset. false: disable reset.
+ * @param reset_wait brown out reset wait cycles
+ * @param select 1: chip reset, 0: system reset
+ */
+static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select)
+{
+    RTCCNTL.brown_out.rst_wait = reset_wait;
+    RTCCNTL.brown_out.rst_ena = reset_ena;
+}
+
+/**
+ * @brief Set brown out threshold
+ *
+ * @param threshold brownout threshold
+ */
+static inline void brownout_ll_set_threshold(uint8_t threshold)
+{
+    RTCCNTL.brown_out.thres = threshold;
+}
+
+/**
+ * @brief Set this bit to enable the brown out detection
+ *
+ * @param bod_enable true: enable, false: disable
+ */
+static inline void brownout_ll_bod_enable(bool bod_enable)
+{
+    RTCCNTL.brown_out.ena = bod_enable;
+}
+
+/**
+ * @brief configure the waiting cycles before sending an interrupt
+ *
+ * @param cycle waiting cycles.
+ */
+static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle)
+{
+    // Not supported on ESP32
+}
+
+/**
+ * @brief Enable brown out interrupt
+ *
+ * @param enable true: enable, false: disable
+ */
+static inline void brownout_ll_intr_enable(bool enable)
+{
+    RTCCNTL.int_ena.rtc_brown_out = enable;
+}
+
+/**
+ * @brief Clear interrupt bits.
+ */
+__attribute__((always_inline))
+static inline void brownout_ll_intr_clear(void)
+{
+    RTCCNTL.int_clr.rtc_brown_out = 1;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 0 - 38
components/hal/esp32c2/brownout_hal.c

@@ -1,38 +0,0 @@
-
-/*
- * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "hal/brownout_hal.h"
-#include "soc/rtc_cntl_struct.h"
-#include "soc/rtc_cntl_reg.h"
-#include "esp_attr.h"
-#include "hal/regi2c_ctrl.h"
-#include "soc/regi2c_brownout.h"
-
-
-void brownout_hal_config(const brownout_hal_config_t *cfg)
-{
-    REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, cfg->threshold);
-    typeof(RTCCNTL.brown_out) brown_out_reg = {
-        .close_flash_ena = cfg->flash_power_down,
-        .pd_rf_ena = cfg->rf_power_down,
-        .rst_wait = 0x3ff,
-        .rst_ena = cfg->reset_enabled,
-        .ena = cfg->enabled,
-        .rst_sel = 1,
-    };
-    RTCCNTL.brown_out = brown_out_reg;
-}
-
-void brownout_hal_intr_enable(bool enable)
-{
-    RTCCNTL.int_ena.rtc_brown_out = enable;
-}
-
-IRAM_ATTR void brownout_hal_intr_clear(void)
-{
-    RTCCNTL.int_clr.rtc_brown_out = 1;
-}

+ 110 - 0
components/hal/esp32c2/include/hal/brownout_ll.h

@@ -0,0 +1,110 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*******************************************************************************
+ * NOTICE
+ * The ll is not public api, don't use in application code.
+ * See readme.md in hal/readme.md
+ ******************************************************************************/
+
+#pragma once
+#include <stdbool.h>
+#include "soc/rtc_cntl_struct.h"
+#include "hal/regi2c_ctrl.h"
+#include "soc/regi2c_brownout.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief power down the flash when a brown out happens.
+ *
+ * @param enable true: power down flash. false: not power down
+ */
+static inline void brownout_ll_enable_flash_power_down(bool enable)
+{
+    RTCCNTL.brown_out.close_flash_ena = enable;
+}
+
+/**
+ * @brief power down the RF circuits when a brown out happens
+ *
+ * @param enable true: power down. false: not power done.
+ */
+static inline void brownout_ll_enable_rf_power_down(bool enable)
+{
+    RTCCNTL.brown_out.pd_rf_ena = enable;
+}
+
+/**
+ * @brief Enable this to reset brown out
+ *
+ * @note: If brown out interrupt is used, this should be disabled.
+ *
+ * @param reset_ena true: enable reset. false: disable reset.
+ * @param reset_wait brown out reset wait cycles
+ * @param select 1: chip reset, 0: system reset
+ */
+static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select)
+{
+    RTCCNTL.brown_out.rst_wait = reset_wait;
+    RTCCNTL.brown_out.rst_ena = reset_ena;
+    RTCCNTL.brown_out.rst_sel = select;
+}
+
+/**
+ * @brief Set brown out threshold
+ *
+ * @param threshold brownout threshold
+ */
+static inline void brownout_ll_set_threshold(uint8_t threshold)
+{
+    REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold);
+}
+
+/**
+ * @brief Set this bit to enable the brown out detection
+ *
+ * @param bod_enable true: enable, false: disable
+ */
+static inline void brownout_ll_bod_enable(bool bod_enable)
+{
+    RTCCNTL.brown_out.ena = bod_enable;
+}
+
+/**
+ * @brief configure the waiting cycles before sending an interrupt
+ *
+ * @param cycle waiting cycles.
+ */
+static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle)
+{
+    // Not supported on ESP32C2
+}
+
+/**
+ * @brief Enable brown out interrupt
+ *
+ * @param enable true: enable, false: disable
+ */
+static inline void brownout_ll_intr_enable(bool enable)
+{
+    RTCCNTL.int_ena.rtc_brown_out = enable;
+}
+
+/**
+ * @brief Clear interrupt bits.
+ */
+__attribute__((always_inline))
+static inline void brownout_ll_intr_clear(void)
+{
+    RTCCNTL.int_clr.rtc_brown_out = 1;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 0 - 37
components/hal/esp32c3/brownout_hal.c

@@ -1,37 +0,0 @@
-
-/*
- * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "hal/brownout_hal.h"
-#include "soc/rtc_cntl_struct.h"
-#include "soc/rtc_cntl_reg.h"
-#include "esp_attr.h"
-#include "hal/regi2c_ctrl.h"
-#include "soc/regi2c_brownout.h"
-
-void brownout_hal_config(const brownout_hal_config_t *cfg)
-{
-    REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, cfg->threshold);
-    typeof(RTCCNTL.brown_out) brown_out_reg = {
-        .close_flash_ena = cfg->flash_power_down,
-        .pd_rf_ena = cfg->rf_power_down,
-        .rst_wait = 0x3ff,
-        .rst_ena = cfg->reset_enabled,
-        .ena = cfg->enabled,
-        .rst_sel = 1,
-    };
-    RTCCNTL.brown_out = brown_out_reg;
-}
-
-void brownout_hal_intr_enable(bool enable)
-{
-    RTCCNTL.int_ena.rtc_brown_out = enable;
-}
-
-IRAM_ATTR void brownout_hal_intr_clear(void)
-{
-    RTCCNTL.int_clr.rtc_brown_out = 1;
-}

+ 110 - 0
components/hal/esp32c3/include/hal/brownout_ll.h

@@ -0,0 +1,110 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*******************************************************************************
+ * NOTICE
+ * The ll is not public api, don't use in application code.
+ * See readme.md in hal/readme.md
+ ******************************************************************************/
+
+#pragma once
+#include <stdbool.h>
+#include "soc/rtc_cntl_struct.h"
+#include "hal/regi2c_ctrl.h"
+#include "soc/regi2c_brownout.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief power down the flash when a brown out happens.
+ *
+ * @param enable true: power down flash. false: not power down
+ */
+static inline void brownout_ll_enable_flash_power_down(bool enable)
+{
+    RTCCNTL.brown_out.close_flash_ena = enable;
+}
+
+/**
+ * @brief power down the RF circuits when a brown out happens
+ *
+ * @param enable true: power down. false: not power done.
+ */
+static inline void brownout_ll_enable_rf_power_down(bool enable)
+{
+    RTCCNTL.brown_out.pd_rf_ena = enable;
+}
+
+/**
+ * @brief Enable this to reset brown out
+ *
+ * @note: If brown out interrupt is used, this should be disabled.
+ *
+ * @param reset_ena true: enable reset. false: disable reset.
+ * @param reset_wait brown out reset wait cycles
+ * @param select 1: chip reset, 0: system reset
+ */
+static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select)
+{
+    RTCCNTL.brown_out.rst_wait = reset_wait;
+    RTCCNTL.brown_out.rst_ena = reset_ena;
+    RTCCNTL.brown_out.rst_sel = select;
+}
+
+/**
+ * @brief Set brown out threshold
+ *
+ * @param threshold brownout threshold
+ */
+static inline void brownout_ll_set_threshold(uint8_t threshold)
+{
+    REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold);
+}
+
+/**
+ * @brief Set this bit to enable the brown out detection
+ *
+ * @param bod_enable true: enable, false: disable
+ */
+static inline void brownout_ll_bod_enable(bool bod_enable)
+{
+    RTCCNTL.brown_out.ena = bod_enable;
+}
+
+/**
+ * @brief configure the waiting cycles before sending an interrupt
+ *
+ * @param cycle waiting cycles.
+ */
+static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle)
+{
+    // Not supported on ESP32C3
+}
+
+/**
+ * @brief Enable brown out interrupt
+ *
+ * @param enable true: enable, false: disable
+ */
+static inline void brownout_ll_intr_enable(bool enable)
+{
+    RTCCNTL.int_ena.rtc_brown_out = enable;
+}
+
+/**
+ * @brief Clear interrupt bits.
+ */
+__attribute__((always_inline))
+static inline void brownout_ll_intr_clear(void)
+{
+    RTCCNTL.int_clr.rtc_brown_out = 1;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 0 - 26
components/hal/esp32c6/brownout_hal.c

@@ -1,26 +0,0 @@
-
-/*
- * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "hal/brownout_hal.h"
-#include "esp_attr.h"
-#include "hal/regi2c_ctrl.h"
-#include "soc/regi2c_brownout.h"
-
-void brownout_hal_config(const brownout_hal_config_t *cfg)
-{
-    // TODO: IDF-5711
-}
-
-void brownout_hal_intr_enable(bool enable)
-{
-    // TODO: IDF-5711
-}
-
-IRAM_ATTR void brownout_hal_intr_clear(void)
-{
-    // TODO: IDF-5711
-}

+ 110 - 0
components/hal/esp32c6/include/hal/brownout_ll.h

@@ -0,0 +1,110 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*******************************************************************************
+ * NOTICE
+ * The ll is not public api, don't use in application code.
+ * See readme.md in hal/readme.md
+ ******************************************************************************/
+
+#pragma once
+#include <stdbool.h>
+#include "soc/lp_analog_peri_struct.h"
+#include "hal/regi2c_ctrl.h"
+#include "soc/regi2c_brownout.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief power down the flash when a brown out happens.
+ *
+ * @param enable true: power down flash. false: not power down
+ */
+static inline void brownout_ll_enable_flash_power_down(bool enable)
+{
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_close_flash_ena = enable;
+}
+
+/**
+ * @brief power down the RF circuits when a brown out happens
+ *
+ * @param enable true: power down. false: not power done.
+ */
+static inline void brownout_ll_enable_rf_power_down(bool enable)
+{
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_pd_rf_ena = enable;
+}
+
+/**
+ * @brief Enable this to reset brown out
+ *
+ * @note: If brown out interrupt is used, this should be disabled.
+ *
+ * @param reset_ena true: enable reset. false: disable reset.
+ * @param reset_wait brown out reset wait cycles
+ * @param select 1: chip reset, 0: system reset
+ */
+static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select)
+{
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_wait = reset_wait;
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_ena = reset_ena;
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_sel = select;
+}
+
+/**
+ * @brief Set brown out threshold
+ *
+ * @param threshold brownout threshold
+ */
+static inline void brownout_ll_set_threshold(uint8_t threshold)
+{
+    REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold);
+}
+
+/**
+ * @brief Set this bit to enable the brown out detection
+ *
+ * @param bod_enable true: enable, false: disable
+ */
+static inline void brownout_ll_bod_enable(bool bod_enable)
+{
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_intr_ena = bod_enable;
+}
+
+/**
+ * @brief configure the waiting cycles before sending an interrupt
+ *
+ * @param cycle waiting cycles.
+ */
+static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle)
+{
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_intr_wait = cycle;
+}
+
+/**
+ * @brief Enable brown out interrupt
+ *
+ * @param enable true: enable, false: disable
+ */
+static inline void brownout_ll_intr_enable(bool enable)
+{
+    LP_ANA_PERI.int_ena.bod_mode0 = enable;
+}
+
+/**
+ * @brief Clear interrupt bits.
+ */
+__attribute__((always_inline))
+static inline void brownout_ll_intr_clear(void)
+{
+    LP_ANA_PERI.int_clr.bod_mode0 = 1;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 110 - 0
components/hal/esp32h2/include/hal/brownout_ll.h

@@ -0,0 +1,110 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*******************************************************************************
+ * NOTICE
+ * The ll is not public api, don't use in application code.
+ * See readme.md in hal/readme.md
+ ******************************************************************************/
+
+#pragma once
+#include <stdbool.h>
+#include "soc/lp_analog_peri_struct.h"
+#include "hal/regi2c_ctrl.h"
+#include "soc/regi2c_brownout.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief power down the flash when a brown out happens.
+ *
+ * @param enable true: power down flash. false: not power down
+ */
+static inline void brownout_ll_enable_flash_power_down(bool enable)
+{
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_close_flash_ena = enable;
+}
+
+/**
+ * @brief power down the RF circuits when a brown out happens
+ *
+ * @param enable true: power down. false: not power done.
+ */
+static inline void brownout_ll_enable_rf_power_down(bool enable)
+{
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_pd_rf_ena = enable;
+}
+
+/**
+ * @brief Enable this to reset brown out
+ *
+ * @note: If brown out interrupt is used, this should be disabled.
+ *
+ * @param reset_ena true: enable reset. false: disable reset.
+ * @param reset_wait brown out reset wait cycles
+ * @param select 1: chip reset, 0: system reset
+ */
+static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select)
+{
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_wait = reset_wait;
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_ena = reset_ena;
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_sel = select;
+}
+
+/**
+ * @brief Set brown out threshold
+ *
+ * @param threshold brownout threshold
+ */
+static inline void brownout_ll_set_threshold(uint8_t threshold)
+{
+    REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold);
+}
+
+/**
+ * @brief Set this bit to enable the brown out detection
+ *
+ * @param bod_enable true: enable, false: disable
+ */
+static inline void brownout_ll_bod_enable(bool bod_enable)
+{
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_intr_ena = bod_enable;
+}
+
+/**
+ * @brief configure the waiting cycles before sending an interrupt
+ *
+ * @param cycle waiting cycles.
+ */
+static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle)
+{
+    LP_ANA_PERI.bod_mode0_cntl.bod_mode0_intr_wait = cycle;
+}
+
+/**
+ * @brief Enable brown out interrupt
+ *
+ * @param enable true: enable, false: disable
+ */
+static inline void brownout_ll_intr_enable(bool enable)
+{
+    LP_ANA_PERI.int_ena.bod_mode0_int_ena = enable;
+}
+
+/**
+ * @brief Clear interrupt bits.
+ */
+__attribute__((always_inline))
+static inline void brownout_ll_intr_clear(void)
+{
+    LP_ANA_PERI.int_clr.bod_mode0_int_clr = 1;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 0 - 39
components/hal/esp32h4/brownout_hal.c

@@ -1,39 +0,0 @@
-
-/*
- * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "hal/brownout_hal.h"
-#include "soc/rtc_cntl_struct.h"
-#include "soc/rtc_cntl_reg.h"
-#include "i2c_pmu.h"
-#include "esp_attr.h"
-#include "hal/regi2c_ctrl.h"
-#include "soc/regi2c_brownout.h"
-
-
-void brownout_hal_config(const brownout_hal_config_t *cfg)
-{
-    REGI2C_WRITE_MASK(I2C_PMU, I2C_PMU_OC_DREF_LVDET, cfg->threshold);
-    typeof(RTCCNTL.brown_out) brown_out_reg = {
-        .close_flash_ena = cfg->flash_power_down,
-        .pd_rf_ena = cfg->rf_power_down,
-        .rst_wait = 0x3ff,
-        .rst_ena = cfg->reset_enabled,
-        .ena = cfg->enabled,
-        .rst_sel = 1,
-    };
-    RTCCNTL.brown_out = brown_out_reg;
-}
-
-void brownout_hal_intr_enable(bool enable)
-{
-    RTCCNTL.int_ena.rtc_brown_out = enable;
-}
-
-IRAM_ATTR void brownout_hal_intr_clear(void)
-{
-    RTCCNTL.int_clr.rtc_brown_out = 1;
-}

+ 111 - 0
components/hal/esp32h4/include/hal/brownout_ll.h

@@ -0,0 +1,111 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*******************************************************************************
+ * NOTICE
+ * The ll is not public api, don't use in application code.
+ * See readme.md in hal/readme.md
+ ******************************************************************************/
+
+#pragma once
+#include <stdbool.h>
+#include "soc/rtc_cntl_struct.h"
+#include "hal/regi2c_ctrl.h"
+#include "soc/regi2c_brownout.h"
+#include "i2c_pmu.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief power down the flash when a brown out happens.
+ *
+ * @param enable true: power down flash. false: not power down
+ */
+static inline void brownout_ll_enable_flash_power_down(bool enable)
+{
+    RTCCNTL.brown_out.close_flash_ena = enable;
+}
+
+/**
+ * @brief power down the RF circuits when a brown out happens
+ *
+ * @param enable true: power down. false: not power done.
+ */
+static inline void brownout_ll_enable_rf_power_down(bool enable)
+{
+    RTCCNTL.brown_out.pd_rf_ena = enable;
+}
+
+/**
+ * @brief Enable this to reset brown out
+ *
+ * @note: If brown out interrupt is used, this should be disabled.
+ *
+ * @param reset_ena true: enable reset. false: disable reset.
+ * @param reset_wait brown out reset wait cycles
+ * @param select 1: chip reset, 0: system reset
+ */
+static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select)
+{
+    RTCCNTL.brown_out.rst_wait = reset_wait;
+    RTCCNTL.brown_out.rst_ena = reset_ena;
+    RTCCNTL.brown_out.rst_sel = select;
+}
+
+/**
+ * @brief Set brown out threshold
+ *
+ * @param threshold brownout threshold
+ */
+static inline void brownout_ll_set_threshold(uint8_t threshold)
+{
+    REGI2C_WRITE_MASK(I2C_PMU, I2C_PMU_OC_DREF_LVDET, threshold);
+}
+
+/**
+ * @brief Set this bit to enable the brown out detection
+ *
+ * @param bod_enable true: enable, false: disable
+ */
+static inline void brownout_ll_bod_enable(bool bod_enable)
+{
+    RTCCNTL.brown_out.ena = bod_enable;
+}
+
+/**
+ * @brief configure the waiting cycles before sending an interrupt
+ *
+ * @param cycle waiting cycles.
+ */
+static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle)
+{
+    // Not supported on ESP32H4
+}
+
+/**
+ * @brief Enable brown out interrupt
+ *
+ * @param enable true: enable, false: disable
+ */
+static inline void brownout_ll_intr_enable(bool enable)
+{
+    RTCCNTL.int_ena.rtc_brown_out = enable;
+}
+
+/**
+ * @brief Clear interrupt bits.
+ */
+__attribute__((always_inline))
+static inline void brownout_ll_intr_clear(void)
+{
+    RTCCNTL.int_clr.rtc_brown_out = 1;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 0 - 39
components/hal/esp32s2/brownout_hal.c

@@ -1,39 +0,0 @@
-
-/*
- * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "hal/brownout_hal.h"
-#include "soc/rtc_cntl_struct.h"
-#include "soc/rtc_cntl_reg.h"
-#include "esp_attr.h"
-#include "hal/regi2c_ctrl.h"
-#include "soc/regi2c_brownout.h"
-
-void brownout_hal_config(const brownout_hal_config_t *cfg)
-{
-    REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, cfg->threshold);
-    typeof(RTCCNTL.brown_out) brown_out_reg = {
-        .out2_ena = 1,
-        .int_wait = 0x002,
-        .close_flash_ena = cfg->flash_power_down,
-        .pd_rf_ena = cfg->rf_power_down,
-        .rst_wait = 0x3ff,
-        .rst_ena = cfg->reset_enabled,
-        .ena = cfg->enabled,
-        .rst_sel = 1,
-    };
-    RTCCNTL.brown_out = brown_out_reg;
-}
-
-void brownout_hal_intr_enable(bool enable)
-{
-    RTCCNTL.int_ena.rtc_brown_out = enable;
-}
-
-IRAM_ATTR void brownout_hal_intr_clear(void)
-{
-    RTCCNTL.int_clr.rtc_brown_out = 1;
-}

+ 111 - 0
components/hal/esp32s2/include/hal/brownout_ll.h

@@ -0,0 +1,111 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*******************************************************************************
+ * NOTICE
+ * The ll is not public api, don't use in application code.
+ * See readme.md in hal/readme.md
+ ******************************************************************************/
+
+#pragma once
+#include <stdbool.h>
+#include "soc/rtc_cntl_struct.h"
+#include "hal/regi2c_ctrl.h"
+#include "soc/regi2c_brownout.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief power down the flash when a brown out happens.
+ *
+ * @param enable true: power down flash. false: not power down
+ */
+static inline void brownout_ll_enable_flash_power_down(bool enable)
+{
+    RTCCNTL.brown_out.close_flash_ena = enable;
+}
+
+/**
+ * @brief power down the RF circuits when a brown out happens
+ *
+ * @param enable true: power down. false: not power done.
+ */
+static inline void brownout_ll_enable_rf_power_down(bool enable)
+{
+    RTCCNTL.brown_out.pd_rf_ena = enable;
+}
+
+/**
+ * @brief Enable this to reset brown out
+ *
+ * @note: If brown out interrupt is used, this should be disabled.
+ *
+ * @param reset_ena true: enable reset. false: disable reset.
+ * @param reset_wait brown out reset wait cycles
+ * @param select 1: chip reset, 0: system reset
+ */
+static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select)
+{
+    RTCCNTL.brown_out.rst_wait = reset_wait;
+    RTCCNTL.brown_out.rst_ena = reset_ena;
+    RTCCNTL.brown_out.out2_ena = true;
+    RTCCNTL.brown_out.rst_sel = select;
+}
+
+/**
+ * @brief Set brown out threshold
+ *
+ * @param threshold brownout threshold
+ */
+static inline void brownout_ll_set_threshold(uint8_t threshold)
+{
+    REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold);
+}
+
+/**
+ * @brief Set this bit to enable the brown out detection
+ *
+ * @param bod_enable true: enable, false: disable
+ */
+static inline void brownout_ll_bod_enable(bool bod_enable)
+{
+    RTCCNTL.brown_out.ena = bod_enable;
+}
+
+/**
+ * @brief configure the waiting cycles before sending an interrupt
+ *
+ * @param cycle waiting cycles.
+ */
+static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle)
+{
+    RTCCNTL.brown_out.int_wait = cycle;
+}
+
+/**
+ * @brief Enable brown out interrupt
+ *
+ * @param enable true: enable, false: disable
+ */
+static inline void brownout_ll_intr_enable(bool enable)
+{
+    RTCCNTL.int_ena.rtc_brown_out = enable;
+}
+
+/**
+ * @brief Clear interrupt bits.
+ */
+__attribute__((always_inline))
+static inline void brownout_ll_intr_clear(void)
+{
+    RTCCNTL.int_clr.rtc_brown_out = 1;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 0 - 39
components/hal/esp32s3/brownout_hal.c

@@ -1,39 +0,0 @@
-
-/*
- * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "hal/brownout_hal.h"
-#include "soc/rtc_cntl_struct.h"
-#include "soc/rtc_cntl_reg.h"
-#include "esp_attr.h"
-#include "hal/regi2c_ctrl.h"
-#include "soc/regi2c_brownout.h"
-
-
-void brownout_hal_config(const brownout_hal_config_t *cfg)
-{
-    REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, cfg->threshold);
-    typeof(RTCCNTL.brown_out) brown_out_reg = {
-        .int_wait = 0x002,
-        .close_flash_ena = cfg->flash_power_down,
-        .pd_rf_ena = cfg->rf_power_down,
-        .rst_wait = 0x3ff,
-        .rst_ena = cfg->reset_enabled,
-        .ena = cfg->enabled,
-        .rst_sel = 1,
-    };
-    RTCCNTL.brown_out = brown_out_reg;
-}
-
-void brownout_hal_intr_enable(bool enable)
-{
-    RTCCNTL.int_ena.rtc_brown_out = enable;
-}
-
-IRAM_ATTR void brownout_hal_intr_clear(void)
-{
-    RTCCNTL.int_clr.rtc_brown_out = 1;
-}

+ 110 - 0
components/hal/esp32s3/include/hal/brownout_ll.h

@@ -0,0 +1,110 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*******************************************************************************
+ * NOTICE
+ * The ll is not public api, don't use in application code.
+ * See readme.md in hal/readme.md
+ ******************************************************************************/
+
+#pragma once
+#include <stdbool.h>
+#include "soc/rtc_cntl_struct.h"
+#include "hal/regi2c_ctrl.h"
+#include "soc/regi2c_brownout.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief power down the flash when a brown out happens.
+ *
+ * @param enable true: power down flash. false: not power down
+ */
+static inline void brownout_ll_enable_flash_power_down(bool enable)
+{
+    RTCCNTL.brown_out.close_flash_ena = enable;
+}
+
+/**
+ * @brief power down the RF circuits when a brown out happens
+ *
+ * @param enable true: power down. false: not power done.
+ */
+static inline void brownout_ll_enable_rf_power_down(bool enable)
+{
+    RTCCNTL.brown_out.pd_rf_ena = enable;
+}
+
+/**
+ * @brief Enable this to reset brown out
+ *
+ * @note: If brown out interrupt is used, this should be disabled.
+ *
+ * @param reset_ena true: enable reset. false: disable reset.
+ * @param reset_wait brown out reset wait cycles
+ * @param select 1: chip reset, 0: system reset
+ */
+static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select)
+{
+    RTCCNTL.brown_out.rst_wait = reset_wait;
+    RTCCNTL.brown_out.rst_ena = reset_ena;
+    RTCCNTL.brown_out.rst_sel = select;
+}
+
+/**
+ * @brief Set brown out threshold
+ *
+ * @param threshold brownout threshold
+ */
+static inline void brownout_ll_set_threshold(uint8_t threshold)
+{
+    REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold);
+}
+
+/**
+ * @brief Set this bit to enable the brown out detection
+ *
+ * @param bod_enable true: enable, false: disable
+ */
+static inline void brownout_ll_bod_enable(bool bod_enable)
+{
+    RTCCNTL.brown_out.ena = bod_enable;
+}
+
+/**
+ * @brief configure the waiting cycles before sending an interrupt
+ *
+ * @param cycle waiting cycles.
+ */
+static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle)
+{
+    RTCCNTL.brown_out.int_wait = cycle;
+}
+
+/**
+ * @brief Enable brown out interrupt
+ *
+ * @param enable true: enable, false: disable
+ */
+static inline void brownout_ll_intr_enable(bool enable)
+{
+    RTCCNTL.int_ena.rtc_brown_out = enable;
+}
+
+/**
+ * @brief Clear interrupt bits.
+ */
+__attribute__((always_inline))
+static inline void brownout_ll_intr_clear(void)
+{
+    RTCCNTL.int_clr.rtc_brown_out = 1;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 5 - 3
components/hal/include/hal/brownout_hal.h

@@ -29,11 +29,13 @@ typedef struct {
     bool rf_power_down;
 } brownout_hal_config_t;
 
+/**
+ * @brief Config brown out hal.
+ *
+ * @param cfg Pointer of brown out configuration structure.
+ */
 void brownout_hal_config(const brownout_hal_config_t *cfg);
 
-void brownout_hal_intr_enable(bool enable);
-
-void brownout_hal_intr_clear(void);
 
 #ifdef __cplusplus
 }

+ 4 - 0
components/soc/esp32/include/soc/Kconfig.soc_caps.in

@@ -131,6 +131,10 @@ config SOC_TOUCH_SENSOR_SUPPORTED
     bool
     default y
 
+config SOC_BOD_SUPPORTED
+    bool
+    default y
+
 config SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL
     int
     default 5

+ 1 - 0
components/soc/esp32/include/soc/soc_caps.h

@@ -92,6 +92,7 @@
 #define SOC_FLASH_ENC_SUPPORTED     1
 #define SOC_SECURE_BOOT_SUPPORTED   1
 #define SOC_TOUCH_SENSOR_SUPPORTED  1
+#define SOC_BOD_SUPPORTED           1
 
 #if SOC_CAPS_ECO_VER < 200
 #define SOC_DPORT_WORKAROUND                   1

+ 4 - 0
components/soc/esp32c2/include/soc/Kconfig.soc_caps.in

@@ -75,6 +75,10 @@ config SOC_SYSTIMER_SUPPORTED
     bool
     default y
 
+config SOC_BOD_SUPPORTED
+    bool
+    default y
+
 config SOC_XTAL_SUPPORT_26M
     bool
     default y

+ 1 - 0
components/soc/esp32c2/include/soc/soc_caps.h

@@ -43,6 +43,7 @@
 #define SOC_FLASH_ENC_SUPPORTED         1
 #define SOC_SECURE_BOOT_SUPPORTED       1
 #define SOC_SYSTIMER_SUPPORTED          1
+#define SOC_BOD_SUPPORTED               1
 
 /*-------------------------- XTAL CAPS ---------------------------------------*/
 #define SOC_XTAL_SUPPORT_26M            1

+ 4 - 0
components/soc/esp32c3/include/soc/Kconfig.soc_caps.in

@@ -127,6 +127,10 @@ config SOC_MEMPROT_SUPPORTED
     bool
     default y
 
+config SOC_BOD_SUPPORTED
+    bool
+    default y
+
 config SOC_XTAL_SUPPORT_40M
     bool
     default y

+ 1 - 0
components/soc/esp32c3/include/soc/soc_caps.h

@@ -59,6 +59,7 @@
  * earlier revisions */
 #define SOC_SECURE_BOOT_SUPPORTED       1
 #define SOC_MEMPROT_SUPPORTED           1
+#define SOC_BOD_SUPPORTED               1
 
 /*-------------------------- XTAL CAPS ---------------------------------------*/
 #define SOC_XTAL_SUPPORT_40M            1

+ 4 - 0
components/soc/esp32c6/include/soc/Kconfig.soc_caps.in

@@ -123,6 +123,10 @@ config SOC_SECURE_BOOT_SUPPORTED
     bool
     default y
 
+config SOC_BOD_SUPPORTED
+    bool
+    default y
+
 config SOC_XTAL_SUPPORT_40M
     bool
     default y

+ 1 - 0
components/soc/esp32c6/include/soc/soc_caps.h

@@ -59,6 +59,7 @@
 #define SOC_ECC_SUPPORTED               1
 #define SOC_FLASH_ENC_SUPPORTED         1
 #define SOC_SECURE_BOOT_SUPPORTED       1
+#define SOC_BOD_SUPPORTED               1
 
 /*-------------------------- XTAL CAPS ---------------------------------------*/
 #define SOC_XTAL_SUPPORT_40M            1

+ 4 - 0
components/soc/esp32h2/include/soc/Kconfig.soc_caps.in

@@ -27,6 +27,10 @@ config SOC_SYSTIMER_SUPPORTED
     bool
     default y
 
+config SOC_BOD_SUPPORTED
+    bool
+    default y
+
 config SOC_XTAL_SUPPORT_32M
     bool
     default y

+ 1 - 0
components/soc/esp32h2/include/soc/soc_caps.h

@@ -56,6 +56,7 @@
 // #define SOC_DIG_SIGN_SUPPORTED          1 // TODO: IDF-6285
 // #define SOC_FLASH_ENC_SUPPORTED         1 // TODO: IDF-6282
 // #define SOC_SECURE_BOOT_SUPPORTED       1 // TODO: IDF-6281
+#define SOC_BOD_SUPPORTED               1
 
 /*-------------------------- XTAL CAPS ---------------------------------------*/
 #define SOC_XTAL_SUPPORT_32M            1

+ 4 - 0
components/soc/esp32h4/include/soc/Kconfig.soc_caps.in

@@ -115,6 +115,10 @@ config SOC_SECURE_BOOT_SUPPORTED
     bool
     default y
 
+config SOC_BOD_SUPPORTED
+    bool
+    default y
+
 config SOC_XTAL_SUPPORT_32M
     bool
     default y

+ 1 - 0
components/soc/esp32h4/include/soc/soc_caps.h

@@ -61,6 +61,7 @@
 #define SOC_ECC_SUPPORTED               1
 #define SOC_FLASH_ENC_SUPPORTED         1
 #define SOC_SECURE_BOOT_SUPPORTED       1
+#define SOC_BOD_SUPPORTED               1
 
 /*-------------------------- XTAL CAPS ---------------------------------------*/
 #define SOC_XTAL_SUPPORT_32M            1

+ 4 - 0
components/soc/esp32s2/include/soc/Kconfig.soc_caps.in

@@ -155,6 +155,10 @@ config SOC_TOUCH_SENSOR_SUPPORTED
     bool
     default y
 
+config SOC_BOD_SUPPORTED
+    bool
+    default y
+
 config SOC_XTAL_SUPPORT_40M
     bool
     default y

+ 1 - 0
components/soc/esp32s2/include/soc/soc_caps.h

@@ -77,6 +77,7 @@
 #define SOC_SECURE_BOOT_SUPPORTED       1
 #define SOC_MEMPROT_SUPPORTED           1
 #define SOC_TOUCH_SENSOR_SUPPORTED      1
+#define SOC_BOD_SUPPORTED               1
 
 /*-------------------------- XTAL CAPS ---------------------------------------*/
 #define SOC_XTAL_SUPPORT_40M            1

+ 4 - 0
components/soc/esp32s3/include/soc/Kconfig.soc_caps.in

@@ -191,6 +191,10 @@ config SOC_TOUCH_SENSOR_SUPPORTED
     bool
     default y
 
+config SOC_BOD_SUPPORTED
+    bool
+    default y
+
 config SOC_XTAL_SUPPORT_40M
     bool
     default y

+ 1 - 0
components/soc/esp32s3/include/soc/soc_caps.h

@@ -67,6 +67,7 @@
 #define SOC_SECURE_BOOT_SUPPORTED       1
 #define SOC_MEMPROT_SUPPORTED           1
 #define SOC_TOUCH_SENSOR_SUPPORTED      1
+#define SOC_BOD_SUPPORTED               1
 
 /*-------------------------- XTAL CAPS ---------------------------------------*/
 #define SOC_XTAL_SUPPORT_40M            1