spi: apple: Add driver for Apple SPI controller
authorHector Martin <marcan@marcan.st>
Thu, 9 Dec 2021 12:55:49 +0000 (21:55 +0900)
committerHector Martin <marcan@marcan.st>
Tue, 18 Jan 2022 11:21:46 +0000 (20:21 +0900)
commit7c7643f3f10d74f140f15f42ed41004ad7fba731
treeb4c134c9e085be43049574d5f45f841789a77ec8
parent3a15cb34fe23651b759431896e86c9c55e6fb944
spi: apple: Add driver for Apple SPI controller

This SPI controller is present in Apple SoCs such as the M1 (t8103) and
M1 Pro/Max (t600x). It is a relatively straightforward design with two
16-entry FIFOs, arbitrary transfer sizes (up to 2**32 - 1) and fully
configurable word size up to 32 bits. It supports one hardware CS line
which can also be driven via the pinctrl/GPIO driver instead, if
desired. TX and RX can be independently enabled.

There are a surprising number of knobs for tweaking details of the
transfer, most of which we do not use right now. Hardware CS control
is available, but we haven't found a way to make it stay low across
multiple logical transfers, so we just use software CS control for now.

There is also a shared DMA offload coprocessor that can be used to handle
larger transfers without requiring an IRQ every 8-16 words, but that
feature depends on a bunch of scaffolding that isn't ready to be
upstreamed yet, so leave it for later.

The hardware shares some register bit definitions with spi-s3c24xx which
suggests it has a shared legacy with Samsung SoCs, but it is too
different to warrant sharing a driver.

Signed-off-by: Hector Martin <marcan@marcan.st>
drivers/spi/Kconfig
drivers/spi/Makefile
drivers/spi/spi-apple.c [new file with mode: 0644]