forked from espressif/esp-idf
fix(esp_system): hp periph clk should not be gated on core/system reset
This commit is contained in:
@@ -74,6 +74,12 @@ void bootloader_console_init(void)
|
||||
// Enable the peripheral
|
||||
uart_ll_enable_bus_clock(uart_num, true);
|
||||
uart_ll_reset_register(uart_num);
|
||||
// Set clock source
|
||||
#if SOC_UART_SUPPORT_XTAL_CLK
|
||||
uart_ll_set_sclk(UART_LL_GET_HW(uart_num), (soc_module_clk_t)UART_SCLK_XTAL);
|
||||
#else
|
||||
uart_ll_set_sclk(UART_LL_GET_HW(uart_num), (soc_module_clk_t)UART_SCLK_APB);
|
||||
#endif
|
||||
// Reset TX and RX FIFOs
|
||||
uart_ll_txfifo_rst(UART_LL_GET_HW(uart_num));
|
||||
uart_ll_rxfifo_rst(UART_LL_GET_HW(uart_num));
|
||||
|
@@ -316,8 +316,8 @@ __attribute__((weak)) void esp_perip_clk_init(void)
|
||||
if ((rst_reason == RESET_REASON_CHIP_POWER_ON) || (rst_reason == RESET_REASON_CHIP_BROWN_OUT) \
|
||||
|| (rst_reason == RESET_REASON_SYS_RTC_WDT) || (rst_reason == RESET_REASON_SYS_SUPER_WDT)) {
|
||||
_lp_i2c_ll_enable_bus_clock(0, false);
|
||||
_lp_uart_ll_enable_bus_clock(0, false);
|
||||
lp_uart_ll_sclk_disable(0);
|
||||
_lp_uart_ll_enable_bus_clock(0, false);
|
||||
lp_core_ll_enable_bus_clock(false);
|
||||
_lp_clkrst_ll_enable_rng_clock(false);
|
||||
|
||||
|
@@ -243,9 +243,9 @@ __attribute__((weak)) void esp_perip_clk_init(void)
|
||||
}
|
||||
|
||||
soc_reset_reason_t rst_reason = esp_rom_get_reset_reason(0);
|
||||
if ((rst_reason != RESET_REASON_CPU0_SW) && (rst_reason != RESET_REASON_CPU_MWDT) \
|
||||
&& (rst_reason != RESET_REASON_CPU_RWDT) && (rst_reason != RESET_REASON_CPU_JTAG) \
|
||||
&& (rst_reason != RESET_REASON_CPU_LOCKUP)) {
|
||||
// HP related clock control
|
||||
if ((rst_reason == RESET_REASON_CHIP_POWER_ON) || (rst_reason == RESET_REASON_CORE_PMU_PWR_DOWN)) {
|
||||
// hp_sys_clkrst register gets reset only if chip reset or pmu powers down hp
|
||||
_gdma_ll_enable_bus_clock(0, false);
|
||||
_gdma_ll_enable_bus_clock(1, false);
|
||||
_pau_ll_enable_bus_clock(false);
|
||||
@@ -356,12 +356,16 @@ __attribute__((weak)) void esp_perip_clk_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
// LP related clock control
|
||||
if ((rst_reason == RESET_REASON_CHIP_POWER_ON) || (rst_reason == RESET_REASON_SYS_SUPER_WDT) \
|
||||
|| (rst_reason == RESET_REASON_SYS_RWDT) || (rst_reason == RESET_REASON_SYS_BROWN_OUT)) {
|
||||
_lp_uart_ll_enable_bus_clock(0, false);
|
||||
// lpperi,lp peripheral registers get reset for reset level equal or higher than system reset
|
||||
lp_uart_ll_sclk_disable(0);
|
||||
_lp_uart_ll_enable_bus_clock(0, false);
|
||||
_rtcio_ll_enable_io_clock(false);
|
||||
// LP_Peri & Clock Control
|
||||
|
||||
if (rst_reason == RESET_REASON_CHIP_POWER_ON) {
|
||||
// lp_aon_clkrst, lp_system registers get reset only if chip reset
|
||||
_uart_ll_enable_pad_sleep_clock(&UART0, false);
|
||||
_uart_ll_enable_pad_sleep_clock(&UART1, false);
|
||||
_uart_ll_enable_pad_sleep_clock(&UART2, false);
|
||||
@@ -385,4 +389,5 @@ __attribute__((weak)) void esp_perip_clk_init(void)
|
||||
#endif
|
||||
REG_CLR_BIT(LP_SYSTEM_REG_HP_ROOT_CLK_CTRL_REG, LP_SYSTEM_REG_CPU_CLK_EN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user