mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
Merge branch 'feat/esp_idf_h4_support_bus_lowpower' into 'master'
feat(esp_hw_support): support esp32h4 esp32s31 bus hw low power Closes PM-812 See merge request espressif/esp-idf!50563
This commit is contained in:
@@ -92,6 +92,20 @@ FORCE_INLINE_ATTR void _clk_gate_ll_ref_96m_clk_en(bool enable)
|
|||||||
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
|
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
|
||||||
#define clk_gate_ll_ref_96m_clk_en(...) (void)__DECLARE_RCC_ATOMIC_ENV; _clk_gate_ll_ref_96m_clk_en(__VA_ARGS__)
|
#define clk_gate_ll_ref_96m_clk_en(...) (void)__DECLARE_RCC_ATOMIC_ENV; _clk_gate_ll_ref_96m_clk_en(__VA_ARGS__)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set system bus clock gate bypass
|
||||||
|
*
|
||||||
|
* @param enable true: bypass bus clock gating (force clocks on);
|
||||||
|
* false: allow hardware auto clock gating to decrease power consumption
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_ATTR void clk_gate_ll_set_bus_clock_gate_bypass(bool enable)
|
||||||
|
{
|
||||||
|
PCR.bus_clock_gate_bypass.ahb_clk_gating_bypass = enable;
|
||||||
|
PCR.bus_clock_gate_bypass.apb_clk_gating_bypass = enable;
|
||||||
|
PCR.bus_clock_gate_bypass.axi_clk_gating_bypass = enable;
|
||||||
|
PCR.bus_clock_gate_bypass.mem_clk_gating_bypass = enable;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configuration structure for peripheral clock gate settings
|
* @brief Configuration structure for peripheral clock gate settings
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -70,6 +70,21 @@ FORCE_INLINE_ATTR void _clk_gate_ll_ref_25m_clk_en(bool enable)
|
|||||||
HP_SYS_CLKRST.ref_25m_ctrl0.reg_ref_25m_clk_en = enable;
|
HP_SYS_CLKRST.ref_25m_ctrl0.reg_ref_25m_clk_en = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set system bus clock gate bypass
|
||||||
|
*
|
||||||
|
* @param enable true: bypass bus clock gating (force clocks on);
|
||||||
|
* false: allow hardware auto clock gating to decrease power consumption
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_ATTR void clk_gate_ll_set_bus_clock_gate_bypass(bool enable)
|
||||||
|
{
|
||||||
|
HP_ALIVE_SYS.bus_clock_gate_bypass.ahb_clk_gating_bypass = enable;
|
||||||
|
HP_ALIVE_SYS.bus_clock_gate_bypass.apb_clk_gating_bypass = enable;
|
||||||
|
HP_ALIVE_SYS.bus_clock_gate_bypass.axi_clk_gating_bypass = enable;
|
||||||
|
HP_ALIVE_SYS.bus_clock_gate_bypass.mem_clk_gating_bypass = enable;
|
||||||
|
HP_ALIVE_SYS.bus_clock_gate_bypass.ahb_mtx_clk_gating_bypass = enable;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool disable_uart0_clk; ///< Gate UART0 when it is not the console UART
|
bool disable_uart0_clk; ///< Gate UART0 when it is not the console UART
|
||||||
bool disable_uart1_clk; ///< Gate UART1 when it is not the console UART
|
bool disable_uart1_clk; ///< Gate UART1 when it is not the console UART
|
||||||
|
|||||||
@@ -337,6 +337,22 @@ menu "Hardware Settings"
|
|||||||
help
|
help
|
||||||
If enabled, this option will perform additional checks on modem clock configuration
|
If enabled, this option will perform additional checks on modem clock configuration
|
||||||
to ensure proper operation and detect potential configuration issues.
|
to ensure proper operation and detect potential configuration issues.
|
||||||
|
|
||||||
|
config ESP_BUS_ENABLE_AUTO_GATE
|
||||||
|
bool "Enable bus clock auto-gate"
|
||||||
|
depends on SOC_PM_SUPPORT_BUS_CLK_AUTO_GATE
|
||||||
|
default y if IDF_CI_BUILD
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enable this option to use bus clock auto-gate for the system bus.
|
||||||
|
|
||||||
|
When enabled, AHB/APB/AXI/MEM bus clock gating bypass is cleared, so the bus
|
||||||
|
clocks are no longer forced on. Hardware then automatically gates these clocks
|
||||||
|
when there is no bus access, reducing power consumption.
|
||||||
|
|
||||||
|
This option has risk: auto-gating may cause unexpected bus access failures or
|
||||||
|
system instability on some peripherals/scenarios. Enable with caution and
|
||||||
|
verify thoroughly.
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
rsource "./etm/Kconfig.etm"
|
rsource "./etm/Kconfig.etm"
|
||||||
|
|||||||
@@ -223,4 +223,9 @@ __attribute__((weak)) void esp_perip_clk_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
periph_ll_clk_gate_set_default(rst_reason, &clk_gate_config);
|
periph_ll_clk_gate_set_default(rst_reason, &clk_gate_config);
|
||||||
|
|
||||||
|
#if CONFIG_ESP_BUS_ENABLE_AUTO_GATE
|
||||||
|
// Clear bus clock gating bypass so hardware can auto-gate idle bus clocks
|
||||||
|
clk_gate_ll_set_bus_clock_gate_bypass(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,4 +229,9 @@ __attribute__((weak)) void esp_perip_clk_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
periph_ll_clk_gate_set_default(rst_reason, &clk_gate_config);
|
periph_ll_clk_gate_set_default(rst_reason, &clk_gate_config);
|
||||||
|
|
||||||
|
#if CONFIG_ESP_BUS_ENABLE_AUTO_GATE
|
||||||
|
// Clear bus clock gating bypass so hardware can auto-gate idle bus clocks
|
||||||
|
clk_gate_ll_set_bus_clock_gate_bypass(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1215,6 +1215,10 @@ config SOC_PM_FLASH_KEEP_POWER_IN_LSLP
|
|||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
config SOC_PM_SUPPORT_BUS_CLK_AUTO_GATE
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
|
||||||
config SOC_CLK_RC_FAST_SUPPORT_CALIBRATION
|
config SOC_CLK_RC_FAST_SUPPORT_CALIBRATION
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
|||||||
@@ -509,6 +509,7 @@
|
|||||||
#define SOC_PM_MODEM_LOCK_CLK_WORKAROUND (1) // In ESP32H4, the modem lock will lock the xtalx2, bbpll and other xpd state during modem2active.
|
#define SOC_PM_MODEM_LOCK_CLK_WORKAROUND (1) // In ESP32H4, the modem lock will lock the xtalx2, bbpll and other xpd state during modem2active.
|
||||||
|
|
||||||
#define SOC_PM_FLASH_KEEP_POWER_IN_LSLP (1) /*!<Keep flash on in light sleep to reduce wake latency*/
|
#define SOC_PM_FLASH_KEEP_POWER_IN_LSLP (1) /*!<Keep flash on in light sleep to reduce wake latency*/
|
||||||
|
#define SOC_PM_SUPPORT_BUS_CLK_AUTO_GATE (1) /*!<Support hardware auto clock gating for system bus*/
|
||||||
|
|
||||||
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
|
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
|
||||||
#define SOC_CLK_RC_FAST_SUPPORT_CALIBRATION (1)
|
#define SOC_CLK_RC_FAST_SUPPORT_CALIBRATION (1)
|
||||||
|
|||||||
@@ -1563,6 +1563,10 @@ config SOC_PM_RETENTION_MODULE_NUM
|
|||||||
int
|
int
|
||||||
default 64
|
default 64
|
||||||
|
|
||||||
|
config SOC_PM_SUPPORT_BUS_CLK_AUTO_GATE
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
|
||||||
config SOC_LP_MAILBOX_SUPPORTED
|
config SOC_LP_MAILBOX_SUPPORTED
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
|||||||
@@ -593,6 +593,8 @@
|
|||||||
|
|
||||||
#define SOC_PM_RETENTION_MODULE_NUM (64)
|
#define SOC_PM_RETENTION_MODULE_NUM (64)
|
||||||
|
|
||||||
|
#define SOC_PM_SUPPORT_BUS_CLK_AUTO_GATE (1) /*!<Support hardware auto clock gating for system bus*/
|
||||||
|
|
||||||
/*-------------------------- LP_CORE CAPS ------------------------------------*/
|
/*-------------------------- LP_CORE CAPS ------------------------------------*/
|
||||||
#define SOC_LP_MAILBOX_SUPPORTED (1) /*!< LP Core supports LP-mailbox */
|
#define SOC_LP_MAILBOX_SUPPORTED (1) /*!< LP Core supports LP-mailbox */
|
||||||
#define SOC_LP_CORE_SUPPORT_ETM (1) /*!< LP Core supports ETM wakeup */
|
#define SOC_LP_CORE_SUPPORT_ETM (1) /*!< LP Core supports ETM wakeup */
|
||||||
|
|||||||
Reference in New Issue
Block a user