This is an automated email from the ASF dual-hosted git repository. jerpelea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 52286f6 arch: cxd56xx: Introduce CONFIG_CXD56_SPI_DMATHRESHOLD 52286f6 is described below commit 52286f6dec35728d8e055e20cc623c7bea13a164 Author: Masayuki Ishikawa <masayuki.ishik...@gmail.com> AuthorDate: Mon Aug 24 16:52:25 2020 +0900 arch: cxd56xx: Introduce CONFIG_CXD56_SPI_DMATHRESHOLD Summary: - This commit improves SPI performance. - For small data, it does not use DMA. Impact: - All use cases which use SPI with DMA Testing: - Tested with spresense:wifi and spresense:example_lcd Signed-off-by: Masayuki Ishikawa <masayuki.ishik...@jp.sony.com> --- arch/arm/src/cxd56xx/Kconfig | 9 +++++++++ arch/arm/src/cxd56xx/cxd56_spi.c | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/cxd56xx/Kconfig b/arch/arm/src/cxd56xx/Kconfig index 49839eb..62a0882 100644 --- a/arch/arm/src/cxd56xx/Kconfig +++ b/arch/arm/src/cxd56xx/Kconfig @@ -356,6 +356,15 @@ config CXD56_SPI_DRIVER used to perform SPI bus transfers from applications. The intent of this driver is to support SPI testing. +config CXD56_SPI_DMATHRESHOLD + int "SPI DMA threshold" + default 64 + depends on CXD56_DMAC + ---help--- + When SPI DMA is enabled, small DMA transfers will still be performed + by polling logic. But we need a threshold value to determine what + is small. + config CXD56_SPI0 bool "SPI0" diff --git a/arch/arm/src/cxd56xx/cxd56_spi.c b/arch/arm/src/cxd56xx/cxd56_spi.c index 67c5fd5..b0d8ded 100644 --- a/arch/arm/src/cxd56xx/cxd56_spi.c +++ b/arch/arm/src/cxd56xx/cxd56_spi.c @@ -855,7 +855,13 @@ static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, #ifdef CONFIG_CXD56_DMAC FAR struct cxd56_spidev_s *priv = (FAR struct cxd56_spidev_s *)dev; - if (priv->dmaenable) +#ifdef CONFIG_CXD56_SPI_DMATHRESHOLD + size_t dmath = CONFIG_CXD56_SPI_DMATHRESHOLD; +#else + size_t dmath = 0; +#endif + + if (priv->dmaenable && dmath < nwords) { spi_dmaexchange(dev, txbuffer, rxbuffer, nwords); }