]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: add basic support for SPI offloading
authorDavid Lechner <dlechner@baylibre.com>
Fri, 7 Feb 2025 20:08:58 +0000 (14:08 -0600)
committerMark Brown <broonie@kernel.org>
Fri, 7 Feb 2025 20:17:07 +0000 (20:17 +0000)
commit8e02d188698851436f76038ea998b726193d1b10
treeeacbc7747eee956d90170b7e9bb0cb0b9e445776
parent2014c95afecee3e76ca4a56956a936e23283f05b
spi: add basic support for SPI offloading

Add the basic infrastructure to support SPI offload providers and
consumers.

SPI offloading is a feature that allows the SPI controller to perform
transfers without any CPU intervention. This is useful, e.g. for
high-speed data acquisition.

SPI controllers with offload support need to implement the get_offload
and put_offload callbacks and can use the devm_spi_offload_alloc() to
allocate offload instances.

SPI peripheral drivers will call devm_spi_offload_get() to get a
reference to the matching offload instance. This offload instance can
then be attached to a SPI message to request offloading that message.

It is expected that SPI controllers with offload support will check for
the offload instance in the SPI message in the ctlr->optimize_message()
callback and handle it accordingly.

CONFIG_SPI_OFFLOAD is intended to be a select-only option. Both
consumer and provider drivers should `select SPI_OFFLOAD` in their
Kconfig to ensure that the SPI core is built with offload support.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250207-dlech-mainline-spi-engine-offload-2-v8-1-e48a489be48c@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
MAINTAINERS
drivers/spi/Kconfig
drivers/spi/Makefile
drivers/spi/spi-offload.c [new file with mode: 0644]
include/linux/spi/offload/consumer.h [new file with mode: 0644]
include/linux/spi/offload/provider.h [new file with mode: 0644]
include/linux/spi/offload/types.h [new file with mode: 0644]
include/linux/spi/spi.h