[lkml]   [2018]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH v2 0/4] spi: introduce SPI_CS_WORD mode flag
This series introduces a new SPI mode flag, SPI_CS_WORD, that indicates that
the chip select line should be toggled after each word sent. This series
includes examples of how this can be implemented for both an SPI controller
and an SPI device.

The motivation here is to take advantage of DMA transfers with an analog/digital
convert chip. This chip requires that the chip select line be toggled after
each word send in order to drive the internal circuitry of the chip.

The way we were accomplishing this was, for example, to read 16 channels, we
would create 16 SPI _transfer_s in one SPI _message_. Although this works, it
uses quite a bit of CPU because we have to do work at the end of each transfer
to get the next transfer ready. When you are polling the chip at 100Hz, this
CPU usage adds up.

The SPI controller being used has DMA support, but only on the _transfer_ level
and not on the _message_ level. So, to take advantage of DMA, we need to read
all of the A/DC channels in a single _transfer_. The SPI controller is capable
automatically toggling the chip select line during a DMA transfer, so we are
adding a new SPI flag in order to take advantage of this.

I have tested both the default software implementation and the spi-davinci
implementation with the A/DC driver in this series.

v2 changes:
- dropped patch "spi: spi-bitbang: change flags from u8 to u16" that has already
been applied
- new patch "spi: add software implementation for SPI_CS_WORD" that provides
a default implementation of SPI_CS_WORD for controllers

David Lechner (4):
spi: add new SPI_CS_WORD flag
spi: add software implementation for SPI_CS_WORD
iio: adc: ti-ads7950: use SPI_CS_WORD to reduce CPU usage
spi: spi-davinci: Add support for SPI_CS_WORD

drivers/iio/adc/ti-ads7950.c | 53 +++++++++++++++++++++---------------
drivers/spi/spi-davinci.c | 11 ++++++--
drivers/spi/spi.c | 32 +++++++++++++++++++++-
include/linux/spi/spi.h | 2 +-
4 files changed, 71 insertions(+), 27 deletions(-)


 \ /
  Last update: 2018-09-13 02:40    [W:0.104 / U:1.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site