spi: spi-imx: add PIO polling support
authorMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 2 May 2022 17:54:56 +0000 (19:54 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 9 May 2022 17:18:15 +0000 (18:18 +0100)
commit07e7593877882fbd07c55b26b7dcf88760449323
tree37709511b140eb729c1e7db9fb1743ddec3741fe
parent307c897db762d1e0feee9477276b08f6deca4a5b
spi: spi-imx: add PIO polling support

The driver supports several modes, one of them is PIO/IRQ
"spi_imx_pio_transfer()". The data is exchanged with the IP core using
PIO, an IRQ is setup to signal empty/full FIFOs and the end of the
transfer. The IRQ and scheduling overhead for short transfers is
significant. Using polling instead of IRQs can be beneficial to reduce
the overall CPU load, especially on small transfer workloads.

On an imx6 single core, a given RX workload of the mcp251xfd driver
results in 40% CPU load. Using polling mode reduces the CPU load to
30%.

This patch adds PIO polling support to the driver. For transfers with
a duration of less than 30 µs the polling mode instead of IRQ based
PIO mode is used. 30 µs seems to be a good compromise, which is used
the by the SPI drivers for the raspberry Pi (spi-bcm2835,
spi-bcm2835), too.

Co-developed-by: David Jander <david@protonic.nl>
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20220502175457.1977983-9-mkl@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-imx.c