OSDN Git Service

spi: spi-fsl-dspi: Accelerate transfers using larger word size if possible
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 4 Mar 2020 22:00:41 +0000 (00:00 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 5 Mar 2020 14:06:21 +0000 (14:06 +0000)
commit6c1c26ecd9a31c24f9ea7dfb174528141dd32361
treef2f4e41a10b9f1f4c10fdb05fd24ad6ab115261f
parentd59c90a2400ffc4d7127a7653f99da1c4a8fa762
spi: spi-fsl-dspi: Accelerate transfers using larger word size if possible

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: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20200304220044.11193-10-olteanv@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-dspi.c