spi: tegra114: use unpacked mode for below 4 bytes
authorSowjanya Komatineni <skomatineni@nvidia.com>
Fri, 5 Apr 2019 00:14:01 +0000 (17:14 -0700)
committerMark Brown <broonie@kernel.org>
Fri, 5 Apr 2019 03:22:38 +0000 (10:22 +0700)
Packed mode expects minimum transfer length of 4 bytes.

This patch fixes this by using unpacked mode for transfers less
than 4 bytes.

Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-tegra114.c

index c2ebf1ae632daadf048d84e6e0aec6e8fca1007b..ea67ff3b5b2c45ca7a618e0e88a7713b097b0a14 100644 (file)
@@ -259,7 +259,8 @@ static unsigned tegra_spi_calculate_curr_xfer_param(
 
        tspi->bytes_per_word = DIV_ROUND_UP(bits_per_word, 8);
 
-       if (bits_per_word == 8 || bits_per_word == 16 || bits_per_word == 32) {
+       if ((bits_per_word == 8 || bits_per_word == 16 ||
+            bits_per_word == 32) && t->len > 3) {
                tspi->is_packed = 1;
                tspi->words_per_32bit = 32/bits_per_word;
        } else {