From 5ed33be4022a89a95c54c0684bb1dfe4d28fd530 Mon Sep 17 00:00:00 2001 From: Song Ruo Jing Date: Wed, 16 Oct 2024 19:27:59 +0800 Subject: [PATCH] fix(pmu): enable all func clock icg during retention This should only increase a tiny amount of the power consumption in the retention process, but save debug time since some module register read/write relies not only APB but also func clock. --- .../esp_hw_support/port/esp32c5/pmu_param.c | 38 ++---------------- .../port/esp32c5/private_include/pmu_param.h | 8 ++-- .../esp_hw_support/port/esp32c6/pmu_param.c | 40 ++----------------- .../port/esp32c6/private_include/pmu_param.h | 2 +- .../port/esp32c61/private_include/pmu_param.h | 2 +- .../esp_hw_support/port/esp32h2/pmu_param.c | 39 ++---------------- .../port/esp32h2/private_include/pmu_param.h | 2 +- .../esp_hw_support/port/esp32p4/pmu_param.c | 28 ++----------- .../port/esp32p4/private_include/pmu_param.h | 2 +- 9 files changed, 23 insertions(+), 138 deletions(-) diff --git a/components/esp_hw_support/port/esp32c5/pmu_param.c b/components/esp_hw_support/port/esp32c5/pmu_param.c index 8d1ef19b7b..9a954a02f7 100644 --- a/components/esp_hw_support/port/esp32c5/pmu_param.c +++ b/components/esp_hw_support/port/esp32c5/pmu_param.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -285,17 +285,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_sleep2active_backup_en = 0, \ .hp_modem2active_backup_en = 0, \ }, \ - .backup_clk = ( \ - BIT(PMU_ICG_FUNC_ENA_REGDMA) | \ - BIT(PMU_ICG_FUNC_ENA_TG0) | \ - BIT(PMU_ICG_FUNC_ENA_TG1) | \ - BIT(PMU_ICG_FUNC_ENA_HPBUS) | \ - BIT(PMU_ICG_FUNC_ENA_MSPI) | \ - BIT(PMU_ICG_FUNC_ENA_IOMUX) | \ - BIT(PMU_ICG_FUNC_ENA_SPI2) | \ - BIT(PMU_ICG_FUNC_ENA_UART0) | \ - BIT(PMU_ICG_FUNC_ENA_SYSTIMER) \ - ) \ + .backup_clk = 0xffffffff, \ } #define PMU_HP_MODEM_RETENTION_CONFIG_DEFAULT() { \ @@ -307,17 +297,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_sleep2modem_backup_mode = PMU_HP_RETENTION_REGDMA_CONFIG(0, 1), \ .hp_sleep2modem_backup_en = 0, \ }, \ - .backup_clk = ( \ - BIT(PMU_ICG_FUNC_ENA_REGDMA) | \ - BIT(PMU_ICG_FUNC_ENA_TG0) | \ - BIT(PMU_ICG_FUNC_ENA_TG1) | \ - BIT(PMU_ICG_FUNC_ENA_HPBUS) | \ - BIT(PMU_ICG_FUNC_ENA_MSPI) | \ - BIT(PMU_ICG_FUNC_ENA_IOMUX) | \ - BIT(PMU_ICG_FUNC_ENA_SPI2) | \ - BIT(PMU_ICG_FUNC_ENA_UART0) | \ - BIT(PMU_ICG_FUNC_ENA_SYSTIMER) \ - ) \ + .backup_clk = 0xffffffff, \ } #define PMU_HP_SLEEP_RETENTION_CONFIG_DEFAULT() { \ @@ -334,17 +314,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_modem2sleep_backup_en = 0, \ .hp_active2sleep_backup_en = 0, \ }, \ - .backup_clk = ( \ - BIT(PMU_ICG_FUNC_ENA_REGDMA) | \ - BIT(PMU_ICG_FUNC_ENA_TG0) | \ - BIT(PMU_ICG_FUNC_ENA_TG1) | \ - BIT(PMU_ICG_FUNC_ENA_HPBUS) | \ - BIT(PMU_ICG_FUNC_ENA_MSPI) | \ - BIT(PMU_ICG_FUNC_ENA_IOMUX) | \ - BIT(PMU_ICG_FUNC_ENA_SPI2) | \ - BIT(PMU_ICG_FUNC_ENA_UART0) | \ - BIT(PMU_ICG_FUNC_ENA_SYSTIMER) \ - ) \ + .backup_clk = 0xffffffff, \ } const pmu_hp_system_retention_param_t * pmu_hp_system_retention_param_default(pmu_hp_mode_t mode) diff --git a/components/esp_hw_support/port/esp32c5/private_include/pmu_param.h b/components/esp_hw_support/port/esp32c5/private_include/pmu_param.h index 909a583215..d85640b94c 100644 --- a/components/esp_hw_support/port/esp32c5/private_include/pmu_param.h +++ b/components/esp_hw_support/port/esp32c5/private_include/pmu_param.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -84,7 +84,7 @@ const pmu_hp_system_analog_param_t* pmu_hp_system_analog_param_default(pmu_hp_mo typedef struct { pmu_hp_backup_reg_t retention; - uint32_t backup_clk; + uint32_t backup_clk; // icg_func } pmu_hp_system_retention_param_t; const pmu_hp_system_retention_param_t* pmu_hp_system_retention_param_default(pmu_hp_mode_t mode); @@ -412,7 +412,7 @@ typedef struct { typedef struct pmu_sleep_machine_constant { struct { - uint16_t min_slp_time_us; /* Mininum sleep protection time (unit: microsecond) */ + uint16_t min_slp_time_us; /* Minimum sleep protection time (unit: microsecond) */ uint8_t wakeup_wait_cycle; /* Modem wakeup signal (WiFi MAC and BEACON wakeup) waits for the slow & fast clock domain synchronization and the wakeup signal triggers the PMU FSM switching wait cycle (unit: slow clock cycle) */ uint8_t reserved0; uint16_t reserved1; @@ -424,7 +424,7 @@ typedef struct pmu_sleep_machine_constant { uint16_t power_up_wait_time_us; /* (unit: microsecond) */ } lp; struct { - uint16_t min_slp_time_us; /* Mininum sleep protection time (unit: microsecond) */ + uint16_t min_slp_time_us; /* Minimum sleep protection time (unit: microsecond) */ uint16_t clock_domain_sync_time_us; /* The Slow OSC clock domain synchronizes time with the Fast OSC domain, at least 4 slow clock cycles (unit: microsecond) */ uint16_t system_dfs_up_work_time_us; /* System DFS up scaling work time (unit: microsecond) */ uint16_t analog_wait_time_us; /* HP LDO power up wait time (unit: microsecond) */ diff --git a/components/esp_hw_support/port/esp32c6/pmu_param.c b/components/esp_hw_support/port/esp32c6/pmu_param.c index 379e058b29..90c1fddf9a 100644 --- a/components/esp_hw_support/port/esp32c6/pmu_param.c +++ b/components/esp_hw_support/port/esp32c6/pmu_param.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -290,18 +290,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_sleep2active_backup_en = 0, \ .hp_modem2active_backup_en = 0, \ }, \ - .backup_clk = ( \ - BIT(PMU_ICG_FUNC_ENA_GDMA) | \ - BIT(PMU_ICG_FUNC_ENA_REGDMA) | \ - BIT(PMU_ICG_FUNC_ENA_TG0) | \ - BIT(PMU_ICG_FUNC_ENA_TG1) | \ - BIT(PMU_ICG_FUNC_ENA_HPBUS) | \ - BIT(PMU_ICG_FUNC_ENA_MSPI) | \ - BIT(PMU_ICG_FUNC_ENA_IOMUX) | \ - BIT(PMU_ICG_FUNC_ENA_SPI2) | \ - BIT(PMU_ICG_FUNC_ENA_UART0) | \ - BIT(PMU_ICG_FUNC_ENA_SYSTIMER) \ - ) \ + .backup_clk = 0xffffffff, \ } #define PMU_HP_MODEM_RETENTION_CONFIG_DEFAULT() { \ @@ -313,17 +302,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_sleep2modem_backup_mode = PMU_HP_RETENTION_REGDMA_CONFIG(0, 1), \ .hp_sleep2modem_backup_en = 0, \ }, \ - .backup_clk = ( \ - BIT(PMU_ICG_FUNC_ENA_REGDMA) | \ - BIT(PMU_ICG_FUNC_ENA_TG0) | \ - BIT(PMU_ICG_FUNC_ENA_TG1) | \ - BIT(PMU_ICG_FUNC_ENA_HPBUS) | \ - BIT(PMU_ICG_FUNC_ENA_MSPI) | \ - BIT(PMU_ICG_FUNC_ENA_IOMUX) | \ - BIT(PMU_ICG_FUNC_ENA_SPI2) | \ - BIT(PMU_ICG_FUNC_ENA_UART0) | \ - BIT(PMU_ICG_FUNC_ENA_SYSTIMER) \ - ) \ + .backup_clk = 0xffffffff, \ } #define PMU_HP_SLEEP_RETENTION_CONFIG_DEFAULT() { \ @@ -340,18 +319,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_modem2sleep_backup_en = 0, \ .hp_active2sleep_backup_en = 0, \ }, \ - .backup_clk = ( \ - BIT(PMU_ICG_FUNC_ENA_GDMA) | \ - BIT(PMU_ICG_FUNC_ENA_REGDMA) | \ - BIT(PMU_ICG_FUNC_ENA_TG0) | \ - BIT(PMU_ICG_FUNC_ENA_TG1) | \ - BIT(PMU_ICG_FUNC_ENA_HPBUS) | \ - BIT(PMU_ICG_FUNC_ENA_MSPI) | \ - BIT(PMU_ICG_FUNC_ENA_IOMUX) | \ - BIT(PMU_ICG_FUNC_ENA_SPI2) | \ - BIT(PMU_ICG_FUNC_ENA_UART0) | \ - BIT(PMU_ICG_FUNC_ENA_SYSTIMER) \ - ) \ + .backup_clk = 0xffffffff, \ } const pmu_hp_system_retention_param_t * pmu_hp_system_retention_param_default(pmu_hp_mode_t mode) diff --git a/components/esp_hw_support/port/esp32c6/private_include/pmu_param.h b/components/esp_hw_support/port/esp32c6/private_include/pmu_param.h index fdef78b330..155c3e810f 100644 --- a/components/esp_hw_support/port/esp32c6/private_include/pmu_param.h +++ b/components/esp_hw_support/port/esp32c6/private_include/pmu_param.h @@ -92,7 +92,7 @@ const pmu_hp_system_analog_param_t* pmu_hp_system_analog_param_default(pmu_hp_mo typedef struct { pmu_hp_backup_reg_t retention; - uint32_t backup_clk; + uint32_t backup_clk; // icg_func } pmu_hp_system_retention_param_t; const pmu_hp_system_retention_param_t* pmu_hp_system_retention_param_default(pmu_hp_mode_t mode); diff --git a/components/esp_hw_support/port/esp32c61/private_include/pmu_param.h b/components/esp_hw_support/port/esp32c61/private_include/pmu_param.h index bbed9cc4a9..15f0910d4a 100644 --- a/components/esp_hw_support/port/esp32c61/private_include/pmu_param.h +++ b/components/esp_hw_support/port/esp32c61/private_include/pmu_param.h @@ -93,7 +93,7 @@ const pmu_hp_system_analog_param_t* pmu_hp_system_analog_param_default(pmu_hp_mo typedef struct { pmu_hp_backup_reg_t retention; - uint32_t backup_clk; + uint32_t backup_clk; // icg_func } pmu_hp_system_retention_param_t; const pmu_hp_system_retention_param_t* pmu_hp_system_retention_param_default(pmu_hp_mode_t mode); diff --git a/components/esp_hw_support/port/esp32h2/pmu_param.c b/components/esp_hw_support/port/esp32h2/pmu_param.c index 6120a1367c..7fd3a122ed 100644 --- a/components/esp_hw_support/port/esp32h2/pmu_param.c +++ b/components/esp_hw_support/port/esp32h2/pmu_param.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -290,18 +290,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_sleep2active_backup_en = 0, \ .hp_modem2active_backup_en = 0, \ }, \ - .backup_clk = ( \ - BIT(PMU_ICG_FUNC_ENA_GDMA) \ - | BIT(PMU_ICG_FUNC_ENA_REGDMA) \ - | BIT(PMU_ICG_FUNC_ENA_TG0) \ - | BIT(PMU_ICG_FUNC_ENA_HPBUS) \ - | BIT(PMU_ICG_FUNC_ENA_MSPI) \ - | BIT(PMU_ICG_FUNC_ENA_IOMUX) \ - | BIT(PMU_ICG_FUNC_ENA_SPI2) \ - | BIT(PMU_ICG_FUNC_ENA_SEC) \ - | BIT(PMU_ICG_FUNC_ENA_PWM) \ - | BIT(PMU_ICG_FUNC_ENA_SYSTIMER) \ - | BIT(PMU_ICG_FUNC_ENA_UART0)), \ + .backup_clk = 0xffffffff, \ } #define PMU_HP_MODEM_RETENTION_CONFIG_DEFAULT() { \ @@ -313,16 +302,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_sleep2modem_backup_mode = PMU_HP_RETENTION_REGDMA_CONFIG(0, 1), \ .hp_sleep2modem_backup_en = 0, \ }, \ - .backup_clk = (BIT(PMU_ICG_FUNC_ENA_REGDMA) \ - | BIT(PMU_ICG_FUNC_ENA_TG0) \ - | BIT(PMU_ICG_FUNC_ENA_HPBUS) \ - | BIT(PMU_ICG_FUNC_ENA_MSPI) \ - | BIT(PMU_ICG_FUNC_ENA_IOMUX) \ - | BIT(PMU_ICG_FUNC_ENA_SPI2) \ - | BIT(PMU_ICG_FUNC_ENA_SEC) \ - | BIT(PMU_ICG_FUNC_ENA_PWM) \ - | BIT(PMU_ICG_FUNC_ENA_SYSTIMER) \ - | BIT(PMU_ICG_FUNC_ENA_UART0)), \ + .backup_clk = 0xffffffff, \ } #define PMU_HP_SLEEP_RETENTION_CONFIG_DEFAULT() { \ @@ -339,18 +319,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_modem2sleep_backup_en = 0, \ .hp_active2sleep_backup_en = 0, \ }, \ - .backup_clk = ( \ - BIT(PMU_ICG_FUNC_ENA_GDMA) \ - | BIT(PMU_ICG_FUNC_ENA_REGDMA) \ - | BIT(PMU_ICG_FUNC_ENA_TG0) \ - | BIT(PMU_ICG_FUNC_ENA_HPBUS) \ - | BIT(PMU_ICG_FUNC_ENA_MSPI) \ - | BIT(PMU_ICG_FUNC_ENA_IOMUX) \ - | BIT(PMU_ICG_FUNC_ENA_SPI2) \ - | BIT(PMU_ICG_FUNC_ENA_SEC) \ - | BIT(PMU_ICG_FUNC_ENA_PWM) \ - | BIT(PMU_ICG_FUNC_ENA_SYSTIMER) \ - | BIT(PMU_ICG_FUNC_ENA_UART0)), \ + .backup_clk = 0xffffffff, \ } const pmu_hp_system_retention_param_t * pmu_hp_system_retention_param_default(pmu_hp_mode_t mode) diff --git a/components/esp_hw_support/port/esp32h2/private_include/pmu_param.h b/components/esp_hw_support/port/esp32h2/private_include/pmu_param.h index 52ad70fa21..bb89da8b00 100644 --- a/components/esp_hw_support/port/esp32h2/private_include/pmu_param.h +++ b/components/esp_hw_support/port/esp32h2/private_include/pmu_param.h @@ -85,7 +85,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m typedef struct { pmu_hp_backup_reg_t retention; - uint32_t backup_clk; + uint32_t backup_clk; // icg_func } pmu_hp_system_retention_param_t; const pmu_hp_system_retention_param_t * pmu_hp_system_retention_param_default(pmu_hp_mode_t mode); diff --git a/components/esp_hw_support/port/esp32p4/pmu_param.c b/components/esp_hw_support/port/esp32p4/pmu_param.c index e96cd99dc8..17e4030031 100644 --- a/components/esp_hw_support/port/esp32p4/pmu_param.c +++ b/components/esp_hw_support/port/esp32p4/pmu_param.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -207,18 +207,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_sleep2active_backup_en = 0, \ .hp_modem2active_backup_en = 0, \ }, \ - .backup_clk = ( \ - BIT(PMU_ICG_FUNC_ENA_L2MEM_MEM) | \ - BIT(PMU_ICG_FUNC_ENA_L2MEM_SYS) | \ - BIT(PMU_ICG_FUNC_ENA_REGDMA) | \ - BIT(PMU_ICG_FUNC_ENA_HP_CLKRST) | \ - BIT(PMU_ICG_FUNC_ENA_SYSREG_APB) | \ - BIT(PMU_ICG_FUNC_ENA_ICM_CPU) | \ - BIT(PMU_ICG_FUNC_ENA_ICM_APB) | \ - BIT(PMU_ICG_FUNC_ENA_ICM_SYS) | \ - BIT(PMU_ICG_FUNC_ENA_ICM_MEM) | \ - BIT(PMU_ICG_FUNC_ENA_INTRMTX_APB) \ - ) \ + .backup_clk = 0xffffffff, \ } #define PMU_HP_SLEEP_RETENTION_CONFIG_DEFAULT() { \ @@ -235,18 +224,7 @@ const pmu_hp_system_analog_param_t * pmu_hp_system_analog_param_default(pmu_hp_m .hp_modem2sleep_backup_en = 0, \ .hp_active2sleep_backup_en = 0, \ }, \ - .backup_clk = ( \ - BIT(PMU_ICG_FUNC_ENA_L2MEM_MEM) | \ - BIT(PMU_ICG_FUNC_ENA_L2MEM_SYS) | \ - BIT(PMU_ICG_FUNC_ENA_REGDMA) | \ - BIT(PMU_ICG_FUNC_ENA_HP_CLKRST) | \ - BIT(PMU_ICG_FUNC_ENA_SYSREG_APB) | \ - BIT(PMU_ICG_FUNC_ENA_ICM_CPU) | \ - BIT(PMU_ICG_FUNC_ENA_ICM_APB) | \ - BIT(PMU_ICG_FUNC_ENA_ICM_SYS) | \ - BIT(PMU_ICG_FUNC_ENA_ICM_MEM) | \ - BIT(PMU_ICG_FUNC_ENA_INTRMTX_APB) \ - ) \ + .backup_clk = 0xffffffff, \ } const pmu_hp_system_retention_param_t * pmu_hp_system_retention_param_default(pmu_hp_mode_t mode) diff --git a/components/esp_hw_support/port/esp32p4/private_include/pmu_param.h b/components/esp_hw_support/port/esp32p4/private_include/pmu_param.h index e2eaca314a..3c30fea3fa 100644 --- a/components/esp_hw_support/port/esp32p4/private_include/pmu_param.h +++ b/components/esp_hw_support/port/esp32p4/private_include/pmu_param.h @@ -86,7 +86,7 @@ const pmu_hp_system_analog_param_t* pmu_hp_system_analog_param_default(pmu_hp_mo typedef struct { pmu_hp_backup_reg_t retention; - uint32_t backup_clk; + uint32_t backup_clk; // icg_func } pmu_hp_system_retention_param_t; const pmu_hp_system_retention_param_t* pmu_hp_system_retention_param_default(pmu_hp_mode_t mode);