From: <patrice.chotard@foss.st.com>
To: Mark Brown <broonie@kernel.org>,
Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: <linux-spi@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <christophe.kerello@foss.st.com>,
<patrice.chotard@foss.st.com>
Subject: [PATCH 2/3] spi: stm32-qspi: Trigger DMA only if more than 4 bytes to transfer
Date: Mon, 19 Apr 2021 14:15:40 +0200 [thread overview]
Message-ID: <20210419121541.11617-3-patrice.chotard@foss.st.com> (raw)
In-Reply-To: <20210419121541.11617-1-patrice.chotard@foss.st.com>
From: Patrice Chotard <patrice.chotard@foss.st.com>
In order to optimize accesses to spi flashes, trigger a DMA only
if more than 4 bytes has to be transferred.
DMA transfer preparation's cost becomes negligible above 4 bytes to
transfer. Below this threshold, indirect transfer give more throughput.
mtd_speedtest shows that page write throughtput increases :
- from 779 to 853 KiB/s (~9.5%) with s25fl512s SPI-NOR.
- from 5283 to 5666 KiB/s (~7.25%) with Micron SPI-NAND.
Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
---
drivers/spi/spi-stm32-qspi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c
index 2786470a5201..6e74d6bed54c 100644
--- a/drivers/spi/spi-stm32-qspi.c
+++ b/drivers/spi/spi-stm32-qspi.c
@@ -269,8 +269,9 @@ static int stm32_qspi_tx(struct stm32_qspi *qspi, const struct spi_mem_op *op)
if (qspi->fmode == CCR_FMODE_MM)
return stm32_qspi_tx_mm(qspi, op);
- else if ((op->data.dir == SPI_MEM_DATA_IN && qspi->dma_chrx) ||
- (op->data.dir == SPI_MEM_DATA_OUT && qspi->dma_chtx))
+ else if (((op->data.dir == SPI_MEM_DATA_IN && qspi->dma_chrx) ||
+ (op->data.dir == SPI_MEM_DATA_OUT && qspi->dma_chtx)) &&
+ op->data.nbytes > 4)
if (!stm32_qspi_tx_dma(qspi, op))
return 0;
--
2.17.1
next prev parent reply other threads:[~2021-04-19 12:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 12:15 [PATCH 0/3] spi: stm32-qspi: Fix and update patrice.chotard
2021-04-19 12:15 ` [PATCH 1/3] spi: stm32-qspi: fix pm_runtime usage_count counter patrice.chotard
2021-04-19 12:15 ` patrice.chotard [this message]
2021-04-19 12:15 ` [PATCH 3/3] spi: stm32-qspi: Add dirmap support patrice.chotard
2021-04-19 17:33 ` [PATCH 0/3] spi: stm32-qspi: Fix and update Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210419121541.11617-3-patrice.chotard@foss.st.com \
--to=patrice.chotard@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=broonie@kernel.org \
--cc=christophe.kerello@foss.st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).