Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SPI: add 3wire mode flag

Add a new spi->mode bit: SPI_3WIRE, for chips where the SI and SO signals
are shared (and which are thus only half duplex). Update the LM70 driver
to require support for that hardware mode from the controller.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Brownell and committed by
Linus Torvalds
c06e677a dccd573b

+5
+4
drivers/hwmon/lm70.c
··· 96 96 struct lm70 *p_lm70; 97 97 int status; 98 98 99 + /* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */ 100 + if ((spi->mode & (SPI_CPOL|SPI_CPHA)) || !(spi->mode & SPI_3WIRE)) 101 + return -EINVAL; 102 + 99 103 p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL); 100 104 if (!p_lm70) 101 105 return -ENOMEM;
+1
include/linux/spi/spi.h
··· 76 76 #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) 77 77 #define SPI_CS_HIGH 0x04 /* chipselect active high? */ 78 78 #define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */ 79 + #define SPI_3WIRE 0x10 /* SI/SO signals shared */ 79 80 u8 bits_per_word; 80 81 int irq; 81 82 void *controller_state;