spi: spi-pci1xxxx: enable concurrent DMA read/write across SPI transfers
authorThangaraj Samynathan <thangaraj.s@microchip.com>
Mon, 30 Jun 2025 07:32:33 +0000 (13:02 +0530)
committerMark Brown <broonie@kernel.org>
Mon, 30 Jun 2025 11:15:45 +0000 (12:15 +0100)
commit7e1c28fbf235791cb5046fafdac5bc16fe8e788d
treed63b6dfeb0376adc09dc5c3f702aef65bfffbcb7
parent46e001c003e30ed830a69e46c13ea02cd35b6093
spi: spi-pci1xxxx: enable concurrent DMA read/write across SPI transfers

Refactor the pci1xxxx SPI driver to allow overlapping DMA read and
write operations across SPI transfers. This improves throughput and
reduces idle time between SPI transactions.

Transfer sequence:
- Start with a DMA read to load TX data from host to device buffer.
- After DMA read completes, trigger the SPI transfer.
- On SPI completion:
  - Start DMA write to copy received data from RX buffer to host.
  - Start the next DMA read to prepare TX data for the following transfer.
- Begin the next SPI transfer after both DMA write and read complete.

To implement this sequence, the following changes were made:
- Added dma_completion_count to track and synchronize DMA completions.
- Split DMA setup into separate functions for TX (read) and RX (write).
- Introduced separate spinlocks for safe access to RD and WR DMA registers.

This new flow enables efficient pipelining by overlapping data
preparation and completion stages, leading to better SPI transfer
performance and utilization of DMA engines.

Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
Link: https://patch.msgid.link/20250630073233.7356-1-thangaraj.s@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-pci1xxxx.c