]> git.karo-electronics.de Git - linux-beck.git/commit
spi: fsl-espi: fix handling of word sizes other than 8 bit
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 2 Oct 2016 12:22:57 +0000 (14:22 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 21 Oct 2016 11:09:37 +0000 (12:09 +0100)
commit923ab15e1a5ce6248601304440e9f30fbf3bb6ab
treeb9f8be6d6ea17c67c2ffc7b71e4dcf3b2ae3e518
parente4be7053b9d3aa0a97b311ad77528d8b32236590
spi: fsl-espi: fix handling of word sizes other than 8 bit

The code in fsl_espi_tx_buf_lsb and parts of fsl_espi_setup_transfer
look very weird and don't reflect the ESPI spec.
ESPI stores values with <= 8 bit word size right justified as 8 bit
value and values with > 8 bit word size right justified as 16 bit
value. Therefore no such shifting is needed.
Only case MSB-first with 8 bit word size is correctly handled,
and most likely nobody ever used this driver with a different config.

On ESPI only the case LSB-first with word size > 8 bit needs a
special handling. In this case a little endian 16 bit value has
to be written to the TX FIFO what requires a byte swap as the
host system is big endian.
The same applies to reading from the RX FIFO.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-espi.c