• Vladimir Oltean's avatar
    spi: spi-fsl-dspi: Accelerate transfers using larger word size if possible · 6c1c26ec
    Vladimir Oltean authored
    This patch adds logic in the driver to transmit SPI buffers that use
    bits_per_word=8 with a higher bits_per_word count (multiple of 8).
    
    Currently the following (most common) modes are implemented:
     - 8 bits_per_word on 32-bit capable controllers
     - 8 bits_per_word on 16-bit capable controllers
     - 16 bits_per_word on 32-bit capable controllers
    
    Transfers which are not accelerated are transferred with a hardware
    bits_per_word value equal to the one of the SPI transfer.
    
    The difference from just extending bits_per_word=32 at the spi_device
    driver level is that endianness is different - the SPI core wants to
    treat bits_per_word=32 buffers as arrays of u32 (i.e. words in host CPU
    endianness). So to preserve endianness when clumping 8x4 bits into
    32-bit words, one must perform conversion between CPU and standard (big)
    endianness.
    
    All appearances (both on the wire as well as in the buffers presented to
    the peripheral driver) are preserved, just that accesses to the PUSHR
    and POPR registers are now more efficient, since the same number of
    reads/writes can now carry more data (2x more data on TX, 4x more data
    on RX).
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Link: https://lore.kernel.org/r/20200304220044.11193-10-olteanv@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    6c1c26ec
spi-fsl-dspi.c 35.3 KB