spi: axi-spi-engine: move msg finalization out of irq handler
authorDavid Lechner <dlechner@baylibre.com>
Wed, 7 Feb 2024 14:51:25 +0000 (08:51 -0600)
committerMark Brown <broonie@kernel.org>
Wed, 7 Feb 2024 15:17:43 +0000 (15:17 +0000)
commitabb4b46c43689dd1f4d80c41e49127ca0ede75b3
tree97c20574a1bf7197b5ee6121eb621de8de68506c
parent531860e12da76a444e0ecfd37a9d786e7986957a
spi: axi-spi-engine: move msg finalization out of irq handler

As a general principal, it is best to do as little as possible in an
interrupt handler. This patch reworks the AXI SPI Engine driver to move
timer_delete_sync() and spi_finalize_current_message() out of the
interrupt handler. Instead, spi_finalize_current_message() is moved to
the transfer_one_message function (similar to nearly all other SPI
controllers). A completion is now used to wait for the sync interrupt
that indicates that the message is complete. The watchdog timer is no
longer needed since we can use the wait_for_completion_timeout()
function to wait for the message to complete with the same effect.

As a bonus, these changes also improve throughput of the SPI controller.
For example, this was tested on a ZynqMP with a 80MHz SCLK reading 4
byte samples from an ADC. The max measured throughput increased from
26k to 28k samples per second.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240207-axi-spi-engine-round-2-1-v2-2-40c0b4e85352@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-axi-spi-engine.c