forked from espressif/esp-idf
pmu active state ICG map initialize and modify i2c master force enable to enable
This commit is contained in:
@@ -27,7 +27,7 @@ bootloader_usable_dram_end = 0x4087c610;
|
|||||||
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
||||||
bootloader_dram_seg_len = 0x5000;
|
bootloader_dram_seg_len = 0x5000;
|
||||||
bootloader_iram_loader_seg_len = 0x7000;
|
bootloader_iram_loader_seg_len = 0x7000;
|
||||||
bootloader_iram_seg_len = 0x2000;
|
bootloader_iram_seg_len = 0x2100;
|
||||||
|
|
||||||
/* Start of the lower region is determined by region size and the end of the higher region */
|
/* Start of the lower region is determined by region size and the end of the higher region */
|
||||||
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -237,8 +237,8 @@ static inline void bootloader_hardware_init(void)
|
|||||||
esp_rom_spiflash_fix_dummylen(1, 1);
|
esp_rom_spiflash_fix_dummylen(1, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: IDF-5990 need update, enable i2c mst clk by force on temporarily
|
/* Enable analog i2c master clock */
|
||||||
SET_PERI_REG_MASK(MODEM_LPCON_CLK_CONF_FORCE_ON_REG, MODEM_LPCON_CLK_I2C_MST_FO);
|
SET_PERI_REG_MASK(MODEM_LPCON_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_EN);
|
||||||
SET_PERI_REG_MASK(MODEM_LPCON_I2C_MST_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_SEL_160M);
|
SET_PERI_REG_MASK(MODEM_LPCON_I2C_MST_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_SEL_160M);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -19,14 +19,47 @@
|
|||||||
#include "esp_hw_log.h"
|
#include "esp_hw_log.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "esp_rom_uart.h"
|
#include "esp_rom_uart.h"
|
||||||
|
#include "esp_private/esp_pmu.h"
|
||||||
#include "hal/clk_tree_ll.h"
|
#include "hal/clk_tree_ll.h"
|
||||||
|
#include "hal/pmu_ll.h"
|
||||||
|
#include "hal/modem_syscon_ll.h"
|
||||||
|
#include "hal/modem_lpcon_ll.h"
|
||||||
|
|
||||||
static const char *TAG = "rtc_clk_init";
|
static const char *TAG = "rtc_clk_init";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the ICG map of some modem clock domains in the PMU_ACTIVE state
|
||||||
|
*
|
||||||
|
* A pre-initialization interface is used to initialize the ICG map of the
|
||||||
|
* MODEM_APB, I2C_MST and LP_APB clock domains in the PMU_ACTIVE state, and
|
||||||
|
* disable the clock gating of these clock domains in the PMU_ACTIVE state,
|
||||||
|
* because the system clock source (PLL) in the system boot up process needs
|
||||||
|
* to use the i2c master peripheral.
|
||||||
|
*
|
||||||
|
* ICG map of all modem clock domains under different power states (PMU_ACTIVE,
|
||||||
|
* PMU_MODEM and PMU_SLEEP) will be initialized in esp_perip_clk_init().
|
||||||
|
*/
|
||||||
|
static void rtc_clk_modem_clock_domain_active_state_icg_map_preinit(void)
|
||||||
|
{
|
||||||
|
/* Configure modem ICG code in PMU_ACTIVE state */
|
||||||
|
pmu_ll_hp_set_icg_modem(&PMU, PMU_MODE_HP_ACTIVE, PMU_HP_ICG_MODEM_CODE_ACTIVE);
|
||||||
|
|
||||||
|
/* Disable clock gating for MODEM_APB, I2C_MST and LP_APB clock domains in PMU_ACTIVE state */
|
||||||
|
modem_syscon_ll_set_modem_apb_icg_bitmap(&MODEM_SYSCON, BIT(PMU_HP_ICG_MODEM_CODE_ACTIVE));
|
||||||
|
modem_lpcon_ll_set_i2c_master_icg_bitmap(&MODEM_LPCON, BIT(PMU_HP_ICG_MODEM_CODE_ACTIVE));
|
||||||
|
modem_lpcon_ll_set_lp_apb_icg_bitmap(&MODEM_LPCON, BIT(PMU_HP_ICG_MODEM_CODE_ACTIVE));
|
||||||
|
|
||||||
|
/* Software trigger force update modem ICG code and ICG switch */
|
||||||
|
pmu_ll_imm_update_dig_icg_modem_code(&PMU, true);
|
||||||
|
pmu_ll_imm_update_dig_icg_switch(&PMU, true);
|
||||||
|
}
|
||||||
|
|
||||||
void rtc_clk_init(rtc_clk_config_t cfg)
|
void rtc_clk_init(rtc_clk_config_t cfg)
|
||||||
{
|
{
|
||||||
rtc_cpu_freq_config_t old_config, new_config;
|
rtc_cpu_freq_config_t old_config, new_config;
|
||||||
|
|
||||||
|
rtc_clk_modem_clock_domain_active_state_icg_map_preinit();
|
||||||
|
|
||||||
/* Set tuning parameters for RC_FAST, RC_SLOW, and RC32K clocks.
|
/* Set tuning parameters for RC_FAST, RC_SLOW, and RC32K clocks.
|
||||||
* Note: this doesn't attempt to set the clocks to precise frequencies.
|
* Note: this doesn't attempt to set the clocks to precise frequencies.
|
||||||
* Instead, we calibrate these clocks against XTAL frequency later, when necessary.
|
* Instead, we calibrate these clocks against XTAL frequency later, when necessary.
|
||||||
|
Reference in New Issue
Block a user