• Heiner Kallweit's avatar
    spi: fsl-espi: fix handling of word sizes other than 8 bit · 923ab15e
    Heiner Kallweit authored
    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: default avatarHeiner Kallweit <hkallweit1@gmail.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    923ab15e
spi-fsl-espi.c 19.5 KB