]> err.no Git - linux-2.6/commitdiff
SPI: add 3wire mode flag
authorDavid Brownell <david-b@pacbell.net>
Tue, 17 Jul 2007 11:04:03 +0000 (04:04 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 17 Jul 2007 17:23:04 +0000 (10:23 -0700)
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>
drivers/hwmon/lm70.c
include/linux/spi/spi.h

index 7eaae3834e157279e926281fd1ec2270c7666f12..275d392eca6116d62461db1f16b6468655af3c2e 100644 (file)
@@ -96,6 +96,10 @@ static int __devinit lm70_probe(struct spi_device *spi)
        struct lm70 *p_lm70;
        int status;
 
+       /* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */
+       if ((spi->mode & (SPI_CPOL|SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
+               return -EINVAL;
+
        p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL);
        if (!p_lm70)
                return -ENOMEM;
index 1be5ea0594771c0a49956d117109c810d0a7bdf6..302b81d1d1176999e61dc2b5b5db8ae5b320a21c 100644 (file)
@@ -76,6 +76,7 @@ struct spi_device {
 #define        SPI_MODE_3      (SPI_CPOL|SPI_CPHA)
 #define        SPI_CS_HIGH     0x04                    /* chipselect active high? */
 #define        SPI_LSB_FIRST   0x08                    /* per-word bits-on-wire */
+#define        SPI_3WIRE       0x10                    /* SI/SO signals shared */
        u8                      bits_per_word;
        int                     irq;
        void                    *controller_state;