From 4049f2b5fb6465d697ef0104d0457efb087e23d4 Mon Sep 17 00:00:00 2001 From: "C.S.M" Date: Sat, 12 Oct 2024 15:09:03 +0800 Subject: [PATCH] feat(bod): Update bod threshold on esp32p4-eco2 --- .../esp_hw_support/port/esp32p4/Kconfig.hw_support | 7 +++++-- components/hal/esp32h2/include/hal/brownout_ll.h | 3 ++- components/hal/esp32p4/include/hal/brownout_ll.h | 3 ++- components/soc/esp32h2/include/soc/regi2c_brownout.h | 12 ++++++++---- components/soc/esp32p4/include/soc/regi2c_brownout.h | 11 +++++++---- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/components/esp_hw_support/port/esp32p4/Kconfig.hw_support b/components/esp_hw_support/port/esp32p4/Kconfig.hw_support index fe31a3aebe..46f9a88f30 100644 --- a/components/esp_hw_support/port/esp32p4/Kconfig.hw_support +++ b/components/esp_hw_support/port/esp32p4/Kconfig.hw_support @@ -13,12 +13,15 @@ choice ESP32P4_REV_MIN bool "Rev v0.0" config ESP32P4_REV_MIN_1 bool "Rev v0.1" + config ESP32P4_REV_MIN_100 + bool "Rev v1.0" endchoice config ESP32P4_REV_MIN_FULL int default 0 if ESP32P4_REV_MIN_0 default 1 if ESP32P4_REV_MIN_1 + default 100 if ESP32P4_REV_MIN_100 config ESP_REV_MIN_FULL int @@ -28,7 +31,7 @@ config ESP_REV_MIN_FULL # MAX Revision # - comment "Maximum Supported ESP32-P4 Revision (Rev v0.99)" + comment "Maximum Supported ESP32-P4 Revision (Rev v1.99)" # Maximum revision that IDF supports. # It can not be changed by user. # Only Espressif can change it when a new version will be supported in IDF. @@ -36,7 +39,7 @@ config ESP_REV_MIN_FULL config ESP32P4_REV_MAX_FULL int - default 99 + default 199 # keep in sync the "Maximum Supported Revision" description with this value config ESP_REV_MAX_FULL diff --git a/components/hal/esp32h2/include/hal/brownout_ll.h b/components/hal/esp32h2/include/hal/brownout_ll.h index 5ee9dcb73e..61e1288c6b 100644 --- a/components/hal/esp32h2/include/hal/brownout_ll.h +++ b/components/hal/esp32h2/include/hal/brownout_ll.h @@ -65,7 +65,8 @@ static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, */ static inline void brownout_ll_set_threshold(uint8_t threshold) { - REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold); + REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD_L, threshold); + REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD_H, threshold); } /** diff --git a/components/hal/esp32p4/include/hal/brownout_ll.h b/components/hal/esp32p4/include/hal/brownout_ll.h index e4b338d8a6..d4b40e6838 100644 --- a/components/hal/esp32p4/include/hal/brownout_ll.h +++ b/components/hal/esp32p4/include/hal/brownout_ll.h @@ -62,7 +62,8 @@ static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, */ static inline void brownout_ll_set_threshold(uint8_t threshold) { - REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold); + REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD_L, threshold); + REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD_H, threshold); } /** diff --git a/components/soc/esp32h2/include/soc/regi2c_brownout.h b/components/soc/esp32h2/include/soc/regi2c_brownout.h index 9daf67f093..0d2caf531c 100644 --- a/components/soc/esp32h2/include/soc/regi2c_brownout.h +++ b/components/soc/esp32h2/include/soc/regi2c_brownout.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -44,6 +44,10 @@ #define I2C_PMU_OR_DREFH_VDDA_MSB 7 #define I2C_PMU_OR_DREFH_VDDA_LSB 5 -#define I2C_BOD_THRESHOLD I2C_PMU_OR_DREFL_VDDA -#define I2C_BOD_THRESHOLD_MSB I2C_PMU_OR_DREFL_VDDA_MSB -#define I2C_BOD_THRESHOLD_LSB I2C_PMU_OR_DREFL_VDDA_LSB +#define I2C_BOD_THRESHOLD_L I2C_PMU_OR_DREFL_VDDA +#define I2C_BOD_THRESHOLD_L_MSB I2C_PMU_OR_DREFL_VDDA_MSB +#define I2C_BOD_THRESHOLD_L_LSB I2C_PMU_OR_DREFL_VDDA_LSB + +#define I2C_BOD_THRESHOLD_H I2C_PMU_OR_DREFH_VDDA +#define I2C_BOD_THRESHOLD_H_MSB I2C_PMU_OR_DREFH_VDDA_MSB +#define I2C_BOD_THRESHOLD_H_LSB I2C_PMU_OR_DREFH_VDDA_LSB diff --git a/components/soc/esp32p4/include/soc/regi2c_brownout.h b/components/soc/esp32p4/include/soc/regi2c_brownout.h index 0504a13705..b7297808f4 100644 --- a/components/soc/esp32p4/include/soc/regi2c_brownout.h +++ b/components/soc/esp32p4/include/soc/regi2c_brownout.h @@ -14,9 +14,12 @@ * bus. These definitions are used via macros defined in regi2c_ctrl.h. */ -#define I2C_BOD 0x61 +#define I2C_BOD 0x6a #define I2C_BOD_HOSTID 0 -#define I2C_BOD_THRESHOLD 0x5 -#define I2C_BOD_THRESHOLD_MSB 2 -#define I2C_BOD_THRESHOLD_LSB 0 +#define I2C_BOD_THRESHOLD_L 0x9 +#define I2C_BOD_THRESHOLD_L_MSB 4 +#define I2C_BOD_THRESHOLD_L_LSB 2 +#define I2C_BOD_THRESHOLD_H 0x9 +#define I2C_BOD_THRESHOLD_H_MSB 7 +#define I2C_BOD_THRESHOLD_H_LSB 5