]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitffa85d09f4b6ce7ea6bad2b6c0dbe3df4e86044b
tree37709511b140eb729c1e7db9fb1743ddec3741fe
parent6f1e0b5ab8fbc055d36e2ff6efa62c8afc2052b6
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