Patch "spi: spi-imx: correctly configure burst length when using dma" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    spi: spi-imx: correctly configure burst length when using dma

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     spi-spi-imx-correctly-configure-burst-length-when-us.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 62ef9f16be90f11753047bec8d5b53aeff5aa9e9
Author: Benjamin Bigler <benjamin@xxxxxxxxxx>
Date:   Sat Dec 9 23:23:26 2023 +0100

    spi: spi-imx: correctly configure burst length when using dma
    
    [ Upstream commit e9b220aeacf109684cce36a94fc24ed37be92b05 ]
    
    If DMA is used, burst length should be set to the bus width of the DMA.
    Otherwise, the SPI hardware will transmit/receive one word per DMA
    request.
    Since this issue affects both transmission and reception, it cannot be
    detected with a loopback test.
    Replace magic numbers 512 and 0xfff with MX51_ECSPI_CTRL_MAX_BURST.
    
    Reported-by Stefan Bigler <linux@xxxxxxxxx>
    
    Signed-off-by: Benjamin Bigler <benjamin@xxxxxxxxxx>
    Fixes: 15a6af94a277 ("spi: Increase imx51 ecspi burst length based on transfer length")
    Link: https://lore.kernel.org/r/8a415902c751cdbb4b20ce76569216ed@xxxxxxxxxxxxxxxxxxx
    Link: https://lore.kernel.org/r/20231209222338.5564-1-benjamin@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 498e35c8db2c1..272bc871a848b 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -659,11 +659,18 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
 		ctrl |= (spi_imx->target_burst * 8 - 1)
 			<< MX51_ECSPI_CTRL_BL_OFFSET;
 	else {
-		if (spi_imx->count >= 512)
-			ctrl |= 0xFFF << MX51_ECSPI_CTRL_BL_OFFSET;
-		else
-			ctrl |= (spi_imx->count * spi_imx->bits_per_word - 1)
+		if (spi_imx->usedma) {
+			ctrl |= (spi_imx->bits_per_word *
+				spi_imx_bytes_per_word(spi_imx->bits_per_word) - 1)
 				<< MX51_ECSPI_CTRL_BL_OFFSET;
+		} else {
+			if (spi_imx->count >= MX51_ECSPI_CTRL_MAX_BURST)
+				ctrl |= (MX51_ECSPI_CTRL_MAX_BURST - 1)
+						<< MX51_ECSPI_CTRL_BL_OFFSET;
+			else
+				ctrl |= (spi_imx->count * spi_imx->bits_per_word - 1)
+						<< MX51_ECSPI_CTRL_BL_OFFSET;
+		}
 	}
 
 	/* set clock speed */




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux