esp32/machine_hw_spi: Use auto DMA channel on S2, S3, C3 chips.

Auto DMA channel is supported in IDF v4.4, and is required to be used on S3
chips, so use this simpler configuration option where possible.

Fixes issue #8634.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2022-10-04 17:43:04 +11:00
parent 0e35c4de9b
commit 95c614e2b6
1 changed files with 5 additions and 11 deletions

View File

@ -267,21 +267,15 @@ STATIC void machine_hw_spi_init_internal(
// Select DMA channel based on the hardware SPI host
int dma_chan = 0;
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3
dma_chan = SPI_DMA_CH_AUTO;
#else
if (self->host == HSPI_HOST) {
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3
dma_chan = 3;
#else
dma_chan = 1;
#endif
#ifdef FSPI_HOST
} else if (self->host == FSPI_HOST) {
dma_chan = 1;
#endif
#ifdef VSPI_HOST
} else if (self->host == VSPI_HOST) {
} else {
dma_chan = 2;
#endif
}
#endif
ret = spi_bus_initialize(self->host, &buscfg, dma_chan);
switch (ret) {