feat(esp_hw_support): add support for SOC_CLOCK_SOURCE_CG and WIFI_BB_80X1 clock in modem clock management

This commit is contained in:
wuzhenghui
2026-04-16 17:50:43 +08:00
committed by yinqingzhao
parent da26be8864
commit ab664da95d
7 changed files with 79 additions and 9 deletions
@@ -393,19 +393,25 @@ static inline void modem_syscon_ll_clk_wifibb_configure(modem_syscon_dev_t *hw,
{
/* Configure
clk_wifibb_22m / clk_wifibb_40m / clk_wifibb_80m
clk_wifibb_40x / clk_wifibb_80x / clk_wifibb_40x1 / clk_wifibb_80x1
clk_wifibb_40x / clk_wifibb_80x / clk_wifibb_40x1
clk_wifibb_160x1
clk_wifibb_44m is configured in modem_syscon_ll_enable_wifibb_44m_clock
clk_wifibb_80x1 is configured in modem_syscon_ll_enable_wifibb_80x1_clock
*/
modem_syscon_ll_clk_conf1_configure(hw, en, 0x1fb);
modem_syscon_ll_clk_conf1_configure(hw, en, 0x17b);
}
__attribute__((always_inline))
static inline bool modem_syscon_ll_wifibb_clock_is_enabled(modem_syscon_dev_t *hw)
{
// Check if any of the wifibb clocks are enabled
return (hw->clk_conf1.val & 0x1fb) == 0x1fb;
return (hw->clk_conf1.val & 0x17b) == 0x17b;
}
__attribute__((always_inline))
static inline bool modem_syscon_ll_wifibb_80x1_clock_is_enabled(modem_syscon_dev_t *hw)
{
return hw->clk_conf1.clk_wifibb_80x1_en;
}
__attribute__((always_inline))
+13
View File
@@ -7,6 +7,7 @@
// The HAL layer for MODEM CLOCK (ESP32-S31 specific part)
#include <stdbool.h>
#include "soc/soc.h"
#include "soc/hp_sys_clkrst_reg.h"
#include "esp_attr.h"
#include "hal/modem_clock_hal.h"
#include "hal/modem_clock_types.h"
@@ -117,6 +118,18 @@ uint32_t IRAM_ATTR modem_clock_hal_get_clock_domain_icg_bitmap(modem_clock_hal_c
return bitmap;
}
void IRAM_ATTR modem_clock_hal_enable_soc_pll_source_cg(modem_clock_hal_context_t *hal, bool enable)
{
(void)hal;
HP_SYS_CLKRST.modem_conf.val = enable ? 0x3d : 0x25;
}
bool IRAM_ATTR modem_clock_hal_soc_pll_source_cg_is_enabled(modem_clock_hal_context_t *hal)
{
(void)hal;
return (HP_SYS_CLKRST.modem_conf.val == 0x3d);
}
void IRAM_ATTR modem_clock_hal_enable_modem_common_fe_clock(modem_clock_hal_context_t *hal, bool enable)
{
if (enable) {