spi: stm32: FIFO threshold level - fix align packet size
Subsystems (3)
PATCH 1/1 spi: stm32: FIFO threshold level - fix align packet size
if cur_bpw <= 8 and xfer_len < 4 then the value of fthlv will be 1 and SPI registers content may have been lost.
* If SPI data register is accessed as a 16-bit register and DSIZE <= 8bit, better to select FTHLV = 2, 4, 6 etc
* If SPI data register is accessed as a 32-bit register and DSIZE > 8bit, better to select FTHLV = 2, 4, 6 etc, while if DSIZE <= 8bit, better to select FTHLV = 4, 8, 12 etc
--- drivers/spi/spi-stm32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-stm32.c +2 -2
@@ -494,9 +494,9 @@ static u32 stm32h7_spi_prepare_fthlv(struct stm32_spi *spi, u32 xfer_len)/* align packet size with data registers access */ if (spi->cur_bpw >8 ) - fthlv -= (fthlv %2 );/* multiple of 2 */ + fthlv += (fthlv %2 ) ?1 :0 ;else - fthlv -= (fthlv %4 );/* multiple of 4 */ + fthlv += (fthlv %4 ) ? (4 - (fthlv %4 )) :0 ;if (!fthlv) fthlv =1 ;
Signature · 1 line
2.11.0
Quoted 11 lines · Roman Guskov
if
cur_bpw<= 8 andxfer_len< 4 then the value of fthlv will be 1 and SPI registers content may have been lost.* If SPI data register is accessed as a 16-bit register and DSIZE <= 8bit, better to select FTHLV = 2, 4, 6 etc
* If SPI data register is accessed as a 32-bit register and DSIZE > 8bit, better to select FTHLV = 2, 4, 6 etc, while if DSIZE <= 8bit, better to select FTHLV = 4, 8, 12 etc
Signed-off-by Roman Guskov <[email protected]>
I think this should also have the following tag:
Quoted 11 lines
--- drivers/spi/spi-stm32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/spi/spi-stm32.c +0
-0@@ -494,9 +494,9 @@ static u32 stm32h7_spi_prepare_fthlv(struct stm32_spi *spi, u32 xfer_len)
drivers/spi/spi-stm32.c static u32 stm32h7_spi_prepare_fthlv(struct stm32_spi *spi, u32 xfer_len) · line 502
Quoted 10 lines
drivers/spi/spi-stm32.c +2
-2/* align packet size with data registers access */ if (spi->cur_bpw >8 ) - fthlv -= (fthlv %2 );/* multiple of 2 */ + fthlv += (fthlv %2 ) ?1 :0 ;else - fthlv -= (fthlv %4 );/* multiple of 4 */ + fthlv += (fthlv %4 ) ? (4 - (fthlv %4 )) :0 ;if (!fthlv) fthlv =1 ;
Mark Brown
maintainerQuoted 9 lines · Roman Guskov
if
cur_bpw<= 8 andxfer_len< 4 then the value of fthlv will be 1 and SPI registers content may have been lost.* If SPI data register is accessed as a 16-bit register and DSIZE <= 8bit, better to select FTHLV = 2, 4, 6 etc
* If SPI data register is accessed as a 32-bit register and DSIZE > 8bit, better to select FTHLV = 2, 4, 6 etc, while if DSIZE <= 8bit, better to select FTHLV = 4, 8, 12 etc
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: stm32: FIFO threshold level - fix align packet size
commit: a590370d918fc66c62df6620445791fbe840344a
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark