SPI bitbanging becomes library code
PATCH 3/3 SPI bitbanging becomes library code
This updates the SPI bitbanging support so it should be usable for some common types of SPI hardware.
This updates the SPI bitbanging support:
- It's no longer a standalone driver, but is instead a library of code for drivers to call.
- It should now support three different types of driver, all within this task-per-controller implementation model.
* Pure bitbang. These can now provide word-at-a-time I/O loops tuned for each SPI mode, possibly using assembly language.
* Word-at-a-time controllers. Some controllers essentially let those I/O loops be handled by the hardware, and at common CPU and SPI speeds a polling driver may be quite appropriate.
* Transfer-at-a-time controllers. It turns out that it's easy to fit controllers with FIFOs, half-duplex restrictions, and simple DMA support into the same framework.
- Some cleanups to the code actually banging bits.
That means a lot of hardware could work with this framework, though common types of controller can't reach peak performance without switching to a driver structure that supports pipelining of transfers (e.g. DMA queues) and maybe controllers (e.g. IRQ driven).
drivers/spi/Kconfig +8 -8
@@ -71,14 +71,14 @@ config SPI_BITBANG depends on SPI_MASTER && EXPERIMENTAL help With a few GPIO pins, your system can bitbang the SPI protocol. - Choose this if you need SPI support through I/O pins (GPIO, - parallel port, etc). - - Make sure you initialize one platform device object for each SPI - master device on your system, using "spi_bitbang" as the device - name with platform_data saying how to use which pins. That will - often be done using static board-specific tables in board-specific - (or adapter-specific) setup code. + Select this to get SPI support through I/O pins (GPIO, parallel + port, etc). Or, some systems' SPI master controller drivers use + this code to manage the per-word or per-transfer accesses to the + hardware shift registers. + + This is library code, and is automatically selected by drivers that + need it. You only need to select this explicitly to support driver + modules that aren't part of this kernel tree. # # Add new SPI master controllers in alphabetical order above this line
include/linux/spi/spi_bitbang.h +54 -35
151 lines not on this page · raw message
drivers/spi/spi_bitbang.c +222 -164
535 lines not on this page · raw message