]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
greybus: spi: add rdwr field to transfer descriptor
authorRui Miguel Silva <rui.silva@linaro.org>
Wed, 2 Dec 2015 11:12:27 +0000 (11:12 +0000)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 3 Dec 2015 01:04:58 +0000 (17:04 -0800)
Add read and/or write field to transfer descriptor to make it possible
to identify the type of transfer.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/spi.c

index 00593b0a3597f476d00f90131734d9216f40887a..23d4cce8b727f567d73fe385be042fd67d8f7582 100644 (file)
@@ -695,6 +695,9 @@ struct gb_spi_transfer {
        __le16          delay_usecs;
        __u8            cs_change;
        __u8            bits_per_word;
+       __u8            rdwr;
+#define GB_SPI_XFER_READ       0x01
+#define GB_SPI_XFER_WRITE      0x02
 } __packed;
 
 struct gb_spi_transfer_request {
index 33e86f9c3182281b6f7c126aaa9246d1241910c3..1b9c973364512e58dca56a74663b6c3a11f5b9e1 100644 (file)
@@ -107,13 +107,16 @@ gb_spi_operation_create(struct gb_connection *connection,
                gb_xfer->delay_usecs = cpu_to_le16(xfer->delay_usecs);
                gb_xfer->cs_change = xfer->cs_change;
                gb_xfer->bits_per_word = xfer->bits_per_word;
-               gb_xfer++;
 
                /* Copy tx data */
                if (xfer->tx_buf) {
                        memcpy(tx_data, xfer->tx_buf, xfer->len);
                        tx_data += xfer->len;
+                       gb_xfer->rdwr |= GB_SPI_XFER_WRITE;
                }
+               if (xfer->rx_buf)
+                       gb_xfer->rdwr |= GB_SPI_XFER_READ;
+               gb_xfer++;
        }
 
        return operation;