drivers: spi: set max chunk len for esp32

Max SPI chunk len was missing from the
implementation, causing SPI to hang up in some
conditions.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
This commit is contained in:
Sylvio Alves 2021-08-12 09:35:38 -03:00 committed by Maureen Helm
commit 907b5d9e7f
2 changed files with 2 additions and 0 deletions

View file

@ -63,6 +63,7 @@ static int IRAM_ATTR spi_esp32_transfer(const struct device *dev)
spi_hal_dev_config_t *hal_dev = &data->dev_config; spi_hal_dev_config_t *hal_dev = &data->dev_config;
spi_hal_trans_config_t *hal_trans = &data->trans_config; spi_hal_trans_config_t *hal_trans = &data->trans_config;
size_t chunk_len = spi_context_max_continuous_chunk(&data->ctx); size_t chunk_len = spi_context_max_continuous_chunk(&data->ctx);
chunk_len = MIN(chunk_len, SOC_SPI_MAXIMUM_BUFFER_SIZE);
/* clean up and prepare SPI hal */ /* clean up and prepare SPI hal */
memset((uint32_t *) hal->hw->data_buf, 0, sizeof(hal->hw->data_buf)); memset((uint32_t *) hal->hw->data_buf, 0, sizeof(hal->hw->data_buf));

View file

@ -8,6 +8,7 @@
#define __SOC_H__ #define __SOC_H__
#include <soc/dport_reg.h> #include <soc/dport_reg.h>
#include <soc/rtc_cntl_reg.h> #include <soc/rtc_cntl_reg.h>
#include <soc/soc_caps.h>
#include <esp32/rom/ets_sys.h> #include <esp32/rom/ets_sys.h>
#include <esp32/rom/spi_flash.h> #include <esp32/rom/spi_flash.h>