11/*
2- * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+ * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33 *
44 * SPDX-License-Identifier: Apache-2.0
55 */
2828#include "soc/hp_sys_clkrst_reg.h"
2929#include "soc/lp_clkrst_reg.h"
3030#include "soc/hp_system_reg.h"
31+ #include "hal/gdma_ll.h"
32+ #include "hal/axi_dma_ll.h"
33+ #include "hal/dw_gdma_ll.h"
34+ #include "hal/dma2d_ll.h"
3135
3236void IRAM_ATTR esp_system_reset_modules_on_exit (void )
3337{
@@ -38,6 +42,32 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
3842 }
3943 }
4044
45+ // Note: AXI bus doesn't allow an undergoing transaction to be interrupted in the middle
46+ // If you want to reset a AXI master, you should make sure that the master is in IDLE first
47+ if (gdma_ll_is_bus_clock_enabled (1 )) {
48+ for (int i = 0 ; i < GDMA_LL_AXI_PAIRS_PER_GROUP ; i ++ ) {
49+ axi_dma_ll_tx_abort (AXI_DMA_LL_GET_HW (0 ), i , true);
50+ axi_dma_ll_rx_abort (AXI_DMA_LL_GET_HW (0 ), i , true);
51+ while (!axi_dma_ll_tx_is_reset_avail (AXI_DMA_LL_GET_HW (0 ), i ));
52+ while (!axi_dma_ll_rx_is_reset_avail (AXI_DMA_LL_GET_HW (0 ), i ));
53+ }
54+ }
55+ if (dma2d_ll_is_bus_clock_enabled (0 )) {
56+ for (int i = 0 ; i < SOC_DMA2D_RX_CHANNELS_PER_GROUP ; i ++ ) {
57+ dma2d_ll_rx_abort (DMA2D_LL_GET_HW (0 ), i , true);
58+ while (!dma2d_ll_rx_is_reset_avail (DMA2D_LL_GET_HW (0 ), i ));
59+ }
60+ for (int i = 0 ; i < SOC_DMA2D_TX_CHANNELS_PER_GROUP ; i ++ ) {
61+ dma2d_ll_tx_abort (DMA2D_LL_GET_HW (0 ), i , true);
62+ while (!dma2d_ll_tx_is_reset_avail (DMA2D_LL_GET_HW (0 ), i ));
63+ }
64+ }
65+ if (dw_gdma_ll_is_bus_clock_enabled (0 )) {
66+ for (int i = 0 ; i < DW_GDMA_LL_CHANNELS_PER_GROUP ; i ++ ) {
67+ dw_gdma_ll_channel_abort (DW_GDMA_LL_GET_HW (0 ), i );
68+ }
69+ }
70+
4171 // Set Peripheral clk rst
4272 SET_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN1_REG , HP_SYS_CLKRST_REG_RST_EN_TIMERGRP1 );
4373 SET_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN1_REG , HP_SYS_CLKRST_REG_RST_EN_STIMER );
@@ -48,7 +78,6 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
4878 SET_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN1_REG , HP_SYS_CLKRST_REG_RST_EN_UART2_CORE );
4979 SET_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN1_REG , HP_SYS_CLKRST_REG_RST_EN_UART3_CORE );
5080 SET_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN1_REG , HP_SYS_CLKRST_REG_RST_EN_UART4_CORE );
51- SET_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN0_REG , HP_SYS_CLKRST_REG_RST_EN_GDMA );
5281 SET_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN2_REG , HP_SYS_CLKRST_REG_RST_EN_ADC );
5382
5483 // Clear Peripheral clk rst
@@ -61,7 +90,6 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
6190 CLEAR_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN1_REG , HP_SYS_CLKRST_REG_RST_EN_UART2_CORE );
6291 CLEAR_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN1_REG , HP_SYS_CLKRST_REG_RST_EN_UART3_CORE );
6392 CLEAR_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN1_REG , HP_SYS_CLKRST_REG_RST_EN_UART4_CORE );
64- CLEAR_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN0_REG , HP_SYS_CLKRST_REG_RST_EN_GDMA );
6593 CLEAR_PERI_REG_MASK (HP_SYS_CLKRST_HP_RST_EN2_REG , HP_SYS_CLKRST_REG_RST_EN_ADC );
6694
6795#if CONFIG_ESP32P4_REV_MIN_FULL <= 100
0 commit comments