Skip to content

Commit cf6d79a

Browse files
abutcher-ghbroonie
authored andcommitted
spi: spi-imx: fix off-by-one in mx51 CPU mode burst length
c712c05 ("spi: imx: fix the burst length at DMA mode and CPU mode") corrects three cases of setting the ECSPI burst length but erroneously leaves the in-range CPU case one bit to big (in that field a value of 0 means 1 bit). The effect was that transmissions that should have been 8-bit bytes appeared as 9-bit causing failed communication with SPI devices. Link: https://lore.kernel.org/all/[email protected]/ Link: https://lore.kernel.org/all/[email protected]/ Fixes: c712c05 ("spi: imx: fix the burst length at DMA mode and CPU mode") Signed-off-by: Adam Butcher <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 5bd249a commit cf6d79a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/spi/spi-imx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,8 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
668668
ctrl |= (MX51_ECSPI_CTRL_MAX_BURST * BITS_PER_BYTE - 1)
669669
<< MX51_ECSPI_CTRL_BL_OFFSET;
670670
else
671-
ctrl |= spi_imx->count / DIV_ROUND_UP(spi_imx->bits_per_word,
672-
BITS_PER_BYTE) * spi_imx->bits_per_word
671+
ctrl |= (spi_imx->count / DIV_ROUND_UP(spi_imx->bits_per_word,
672+
BITS_PER_BYTE) * spi_imx->bits_per_word - 1)
673673
<< MX51_ECSPI_CTRL_BL_OFFSET;
674674
}
675675
}

0 commit comments

Comments
 (0)