From b1f1f74d7cbac3020c0e08a33f6f0c657dc0af8b Mon Sep 17 00:00:00 2001 From: Hake Huang Date: Tue, 13 Aug 2024 12:30:52 +0000 Subject: [PATCH] tests: spi_loopback: kinetis dspi fix 1. kenistis dspi does support rx and tx with different size, so skip the tx_bigger test. 2. dspi dma need internal alignment and 8192 bytes are too many for k64, so reduce to 1440 bytes fixing: #77010 Signed-off-by: Hake Huang --- .../spi/spi_loopback/overlay-mcux-dspi-dma.conf | 2 +- tests/drivers/spi/spi_loopback/src/spi.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/drivers/spi/spi_loopback/overlay-mcux-dspi-dma.conf b/tests/drivers/spi/spi_loopback/overlay-mcux-dspi-dma.conf index 17e3ffb7bcce8..eb7fe42776232 100644 --- a/tests/drivers/spi/spi_loopback/overlay-mcux-dspi-dma.conf +++ b/tests/drivers/spi/spi_loopback/overlay-mcux-dspi-dma.conf @@ -1,4 +1,4 @@ # enable DMA mode CONFIG_DMA=y CONFIG_DSPI_MCUX_EDMA=y -CONFIG_MCUX_DSPI_BUFFER_SIZE=144 +CONFIG_MCUX_DSPI_BUFFER_SIZE=5760 diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index f091f436396f1..ac1f7e5d972f1 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -58,7 +58,14 @@ static struct spi_dt_spec spi_slow = SPI_DT_SPEC_GET(SPI_SLOW_DEV, SPI_OP(FRAME_ #define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACK_SIZE) #define BUF_SIZE 18 #define BUF2_SIZE 36 + +#ifdef CONFIG_DSPI_MCUX_EDMA +/*DSPI DMA need aligned buffer for internal*/ +#define BUF3_SIZE 1440 +#else #define BUF3_SIZE 8192 +#endif + #if CONFIG_NOCACHE_MEMORY #define __NOCACHE __attribute__((__section__(".nocache"))) @@ -481,6 +488,11 @@ static int spi_rx_bigger_than_tx(struct spi_dt_spec *spec) return 0; } + if (IS_ENABLED(CONFIG_DSPI_MCUX_EDMA)) { + LOG_INF("Skip rx bigger than tx"); + return 0; + } + LOG_INF("Start rx bigger than tx"); (void)memset(buffer_rx, 0xff, BUF_SIZE);