]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: spi-fsl-lpspi: Handle clock polarity and phase
authorMarek Vasut <marex@nabladev.com>
Tue, 27 Jan 2026 22:23:22 +0000 (23:23 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 28 Jan 2026 15:53:10 +0000 (15:53 +0000)
commit7ae4d097b752d77c41dd26068d92ef34e9c66be9
tree0019e932465add593e1ee1775d418c86ca81fa44
parent5c6808d10499f6c8a8d5ee948a22fc93814f6d66
spi: spi-fsl-lpspi: Handle clock polarity and phase

The LPSPI driver currently does not support setting SPI bus clock
polarity and phase, add support for it.

It is important to configure correct initial clock polarity and phase
before the GPIO chipselect toggles, otherwise a chip attached to the
bus might recognize the first change of clock signal as the first
clock cycle and get confused.

In order to set up the correct polarity and phase on the clock signal
before the GPIO chipselects get configured by the SPI core, the
controller has to be briefly brought up in fsl_lpspi_prepare_message().
The fsl_lpspi_prepare_message() behaves like a zero-length transfer
which always uses PIO and never DMA, and which leaves the clock signal
in the correct state at the end of such transfer, which happens before
the GPIO chipselect toggles.

Signed-off-by: Marek Vasut <marex@nabladev.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260127222353.1452003-1-marex@nabladev.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-lpspi.c