summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-npcm-pspi.c
diff options
context:
space:
mode:
authorTomer Maimon <tmaimon77@gmail.com>2020-01-15 18:22:59 +0200
committerMark Brown <broonie@kernel.org>2020-01-17 15:38:02 +0000
commitb4adf5b27d59cdefff1e6fcba99151edea65a9f7 (patch)
treeef5a1a5cc845ab196e2edd48a89564f52366b106 /drivers/spi/spi-npcm-pspi.c
parent6925212f328bf2abde0c8f0d037fddd36751d489 (diff)
downloadlwn-b4adf5b27d59cdefff1e6fcba99151edea65a9f7.tar.gz
lwn-b4adf5b27d59cdefff1e6fcba99151edea65a9f7.zip
spi: npcm-pspi: improve spi transfer performance
Improving spi 8 bit per word mode transfer performance by using 16 bit per word transfer and receive when the data length is even and larger than one. Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> Link: https://lore.kernel.org/r/20200115162301.235926-3-tmaimon77@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-npcm-pspi.c')
-rw-r--r--drivers/spi/spi-npcm-pspi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/spi/spi-npcm-pspi.c b/drivers/spi/spi-npcm-pspi.c
index fe624731c74c..d224aa63dbce 100644
--- a/drivers/spi/spi-npcm-pspi.c
+++ b/drivers/spi/spi-npcm-pspi.c
@@ -178,6 +178,13 @@ static void npcm_pspi_setup_transfer(struct spi_device *spi,
priv->mode = spi->mode;
}
+ /*
+ * If transfer is even length, and 8 bits per word transfer,
+ * then implement 16 bits-per-word transfer.
+ */
+ if (priv->bits_per_word == 8 && !(t->len & 0x1))
+ t->bits_per_word = 16;
+
if (!priv->is_save_param || priv->bits_per_word != t->bits_per_word) {
npcm_pspi_set_transfer_size(priv, t->bits_per_word);
priv->bits_per_word = t->bits_per_word;