Skip to content

Commit

Permalink
Deinitialize ESP32-S3 SPI slave GDMA engine
Browse files Browse the repository at this point in the history
  • Loading branch information
nuttxs authored and xiaoxiang781216 committed Feb 22, 2024
1 parent 996b937 commit d2b4734
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion arch/xtensa/src/esp32s3/esp32s3_spi_slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,35 @@ void spislave_dma_init(struct spislave_priv_s *priv)

resetbits(SPI_RX_EOF_EN_M, SPI_DMA_CONF_REG(priv->config->id));
}

/****************************************************************************
* Name: spislave_dma_deinit
*
* Description:
* Deinitialize ESP32-S3 SPI slave GDMA engine.
*
* Input Parameters:
* dev - Device-specific state data
*
* Returned Value:
* None.
*
****************************************************************************/

void spislave_dma_deinit(struct spislave_priv_s *priv)
{
/* Release a DMA channel from peripheral */

esp32s3_dma_release(priv->dma_channel);

/* Deinitialize DMA controller */

esp32s3_dma_deinit();

/* Disable DMA clock for the SPI peripheral */

modifyreg32(SYSTEM_PERIP_CLK_EN0_REG, priv->config->dma_clk_bit, 0);
}
#endif

/****************************************************************************
Expand Down Expand Up @@ -1390,7 +1419,7 @@ static void spislave_deinitialize(struct spi_slave_ctrlr_s *ctrlr)
resetbits(SPI_TRANS_DONE_INT_ENA_M, SPI_DMA_INT_ENA_REG(priv->config->id));

#ifdef CONFIG_ESP32S3_SPI_DMA
resetbits(priv->config->dma_clk_bit, SYSTEM_PERIP_CLK_EN0_REG);
spislave_dma_deinit(priv);
priv->rx_dma_offset = 0;
#endif

Expand Down

0 comments on commit d2b4734

Please sign in to comment.