spi: spi-mem: add automatic poll status functions
authorPatrice Chotard <patrice.chotard@foss.st.com>
Tue, 18 May 2021 16:27:52 +0000 (18:27 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 3 Jun 2021 13:04:56 +0000 (14:04 +0100)
commitc955a0cc8a286e5da1ebb88c19201e9bab8c2422
tree0ee6eae99184df1a2b4e992b02c2aeb39cc486a0
parent6efb943b8616ec53a5e444193dccf1af9ad627b5
spi: spi-mem: add automatic poll status functions

With STM32 QSPI, it is possible to poll the status register of the device.
This could be done to offload the CPU during an operation (erase or
program a SPI NAND for example).

spi_mem_poll_status API has been added to handle this feature.
This new function take care of the offload/non-offload cases.

For the non-offload case, use read_poll_timeout() to poll the status in
order to release CPU during this phase.
For example, previously, when erasing large area, in non-offload case,
CPU load can reach ~50%, now it decrease to ~35%.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://lore.kernel.org/r/20210518162754.15940-2-patrice.chotard@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-mem.c
include/linux/spi/spi-mem.h