mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spi: Increase imx51 ecspi burst length based on transfer length
@ 2023-06-28 12:54 Stefan Moring
  2023-06-28 13:16 ` Fabio Estevam
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Stefan Moring @ 2023-06-28 12:54 UTC (permalink / raw)
  To: broonie, shawnguo, s.hauer, festevam, linux-imx, linux-spi,
	linux-arm-kernel, linux-kernel
  Cc: Stefan Moring

IMX51 supports 4096 bit burst lengths. Using the spi transfer length
instead of bits_per_word increases performance significantly.

Signed-off-by: Stefan Moring <stefan.moring@technolution.nl>
---
 drivers/spi/spi-imx.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 34e5f81ec431..cbd306c25d28 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -644,9 +644,13 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
 	if (spi_imx->slave_mode && is_imx53_ecspi(spi_imx))
 		ctrl |= (spi_imx->slave_burst * 8 - 1)
 			<< MX51_ECSPI_CTRL_BL_OFFSET;
-	else
-		ctrl |= (spi_imx->bits_per_word - 1)
-			<< MX51_ECSPI_CTRL_BL_OFFSET;
+	else {
+		if (spi_imx->count >= 512)
+			ctrl |= 0xFFF << MX51_ECSPI_CTRL_BL_OFFSET;
+		else
+			ctrl |= (spi_imx->count*8 - 1)
+				<< MX51_ECSPI_CTRL_BL_OFFSET;
+	}
 
 	/* set clock speed */
 	ctrl &= ~(0xf << MX51_ECSPI_CTRL_POSTDIV_OFFSET |
@@ -1243,6 +1247,7 @@ static int spi_imx_setupxfer(struct spi_device *spi,
 		spi_imx->spi_bus_clk = t->speed_hz;
 
 	spi_imx->bits_per_word = t->bits_per_word;
+	spi_imx->count = t->len;
 
 	/*
 	 * Initialize the functions for transfer. To transfer non byte-aligned
-- 
2.34.1


^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <CAB3BuKAVzXWNNiYDceNCpBqBmKyEykKA3rX=cfTyz+gWaJcnkA@mail.gmail.com>]

end of thread, other threads:[~2024-06-18 16:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28 12:54 [PATCH] spi: Increase imx51 ecspi burst length based on transfer length Stefan Moring
2023-06-28 13:16 ` Fabio Estevam
2023-06-28 13:20   ` Stefan Moring
2024-06-18 11:58     ` Marc Kleine-Budde
2024-06-18 15:59       ` Marc Kleine-Budde
2024-06-18 16:02         ` Mark Brown
2024-06-18 16:06           ` Marc Kleine-Budde
2024-06-18 16:11             ` Mark Brown
2023-07-11 22:04 ` Mark Brown
2023-09-14 22:47 ` Sebastian Reichel
     [not found]   ` <CAB3BuKAEFewb6W5K=Z2ZX9Xx0gA+RW+XKY-Mkn-PfBOfq3eb+A@mail.gmail.com>
2023-09-16 23:53     ` Sebastian Reichel
     [not found] <CAB3BuKAVzXWNNiYDceNCpBqBmKyEykKA3rX=cfTyz+gWaJcnkA@mail.gmail.com>
2023-06-28 11:54 ` Mark Brown
2023-06-28 12:55   ` Stefan Moring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®