aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/spi/spi.h
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2006-04-03 18:46:22 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-05-16 17:33:57 -0400
commitccf77cc4af5b048e20cfd9327fcc286cb69c34cc (patch)
tree0a19a6948fe8bbf2128010a655e170ffebc9d8b8 /include/linux/spi/spi.h
parentff9f4771b5f017ee0f57629488b6cd7a6ef3d19b (diff)
[PATCH] SPI: devices can require LSB-first encodings
Add spi_device hook for LSB-first word encoding, and update all the (in-tree) controller drivers to reject such devices. Eventually, some controller drivers will be updated to support lsb-first encodings on the wire; no current drivers need this. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/spi/spi.h')
-rw-r--r--include/linux/spi/spi.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 082006714b8..77add901691 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -35,10 +35,13 @@ extern struct bus_type spi_bus_type;
35 * @chip-select: Chipselect, distinguishing chips handled by "master". 35 * @chip-select: Chipselect, distinguishing chips handled by "master".
36 * @mode: The spi mode defines how data is clocked out and in. 36 * @mode: The spi mode defines how data is clocked out and in.
37 * This may be changed by the device's driver. 37 * This may be changed by the device's driver.
38 * The "active low" default for chipselect mode can be overridden,
39 * as can the "MSB first" default for each word in a transfer.
38 * @bits_per_word: Data transfers involve one or more words; word sizes 40 * @bits_per_word: Data transfers involve one or more words; word sizes
39 * like eight or 12 bits are common. In-memory wordsizes are 41 * like eight or 12 bits are common. In-memory wordsizes are
40 * powers of two bytes (e.g. 20 bit samples use 32 bits). 42 * powers of two bytes (e.g. 20 bit samples use 32 bits).
41 * This may be changed by the device's driver. 43 * This may be changed by the device's driver, or left at the
44 * default (0) indicating protocol words are eight bit bytes.
42 * The spi_transfer.bits_per_word can override this for each transfer. 45 * The spi_transfer.bits_per_word can override this for each transfer.
43 * @irq: Negative, or the number passed to request_irq() to receive 46 * @irq: Negative, or the number passed to request_irq() to receive
44 * interrupts from this device. 47 * interrupts from this device.
@@ -67,6 +70,7 @@ struct spi_device {
67#define SPI_MODE_2 (SPI_CPOL|0) 70#define SPI_MODE_2 (SPI_CPOL|0)
68#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) 71#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
69#define SPI_CS_HIGH 0x04 /* chipselect active high? */ 72#define SPI_CS_HIGH 0x04 /* chipselect active high? */
73#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */
70 u8 bits_per_word; 74 u8 bits_per_word;
71 int irq; 75 int irq;
72 void *controller_state; 76 void *controller_state;
@@ -75,7 +79,6 @@ struct spi_device {
75 79
76 // likely need more hooks for more protocol options affecting how 80 // likely need more hooks for more protocol options affecting how
77 // the controller talks to each chip, like: 81 // the controller talks to each chip, like:
78 // - bit order (default is wordwise msb-first)
79 // - memory packing (12 bit samples into low bits, others zeroed) 82 // - memory packing (12 bit samples into low bits, others zeroed)
80 // - priority 83 // - priority
81 // - drop chipselect after each word 84 // - drop chipselect after each word