Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: omap2-mcspi: add support for interword delay

The module omap2-mcspi does not support the interword delay
parameter present in the spi transfer. On one side, if the module
is instructed to use the dma, this parameter is correctly ignored.
However, without the usage of the dma, that parameter should be
used.

The patch introduce the handling of such delay in the omap2-mcspi
module, using standard spi_delay struct. The patch has been tested
using as benchmark a DM3730.

The delay function used (spi_delay_exec) is already present in the
kernel and it checks on its own the validity of the input, as such,
no additional checks are present.

The range of usage of the udelay function is incremented to 200 us,
as the change from udelay to usleep_range introduces not
neglectible delays.

Signed-off-by: Andrea Zanotti <andreazanottifo@gmail.com>
Link: https://lore.kernel.org/r/20220502111300.24754-1-andreazanottifo@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Andrea Zanotti and committed by
Mark Brown
2cd757e6 dfc6597e

+6
+6
drivers/spi/spi-omap2-mcspi.c
··· 757 757 dev_vdbg(&spi->dev, "read-%d %02x\n", 758 758 word_len, *(rx - 1)); 759 759 } 760 + /* Add word delay between each word */ 761 + spi_delay_exec(&xfer->word_delay, xfer); 760 762 } while (c); 761 763 } else if (word_len <= 16) { 762 764 u16 *rx; ··· 806 804 dev_vdbg(&spi->dev, "read-%d %04x\n", 807 805 word_len, *(rx - 1)); 808 806 } 807 + /* Add word delay between each word */ 808 + spi_delay_exec(&xfer->word_delay, xfer); 809 809 } while (c >= 2); 810 810 } else if (word_len <= 32) { 811 811 u32 *rx; ··· 855 851 dev_vdbg(&spi->dev, "read-%d %08x\n", 856 852 word_len, *(rx - 1)); 857 853 } 854 + /* Add word delay between each word */ 855 + spi_delay_exec(&xfer->word_delay, xfer); 858 856 } while (c >= 4); 859 857 } 860 858