diff options
Diffstat (limited to 'include/linux/spi/spi.h')
| -rw-r--r-- | include/linux/spi/spi.h | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index a0faa18f7b1b..c47c4b4da97e 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -80,6 +80,8 @@ struct spi_device { | |||
| 80 | #define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */ | 80 | #define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */ |
| 81 | #define SPI_3WIRE 0x10 /* SI/SO signals shared */ | 81 | #define SPI_3WIRE 0x10 /* SI/SO signals shared */ |
| 82 | #define SPI_LOOP 0x20 /* loopback mode */ | 82 | #define SPI_LOOP 0x20 /* loopback mode */ |
| 83 | #define SPI_NO_CS 0x40 /* 1 dev/bus, no chipselect */ | ||
| 84 | #define SPI_READY 0x80 /* slave pulls low to pause */ | ||
| 83 | u8 bits_per_word; | 85 | u8 bits_per_word; |
| 84 | int irq; | 86 | int irq; |
| 85 | void *controller_state; | 87 | void *controller_state; |
| @@ -245,6 +247,13 @@ struct spi_master { | |||
| 245 | */ | 247 | */ |
| 246 | u16 dma_alignment; | 248 | u16 dma_alignment; |
| 247 | 249 | ||
| 250 | /* spi_device.mode flags understood by this controller driver */ | ||
| 251 | u16 mode_bits; | ||
| 252 | |||
| 253 | /* other constraints relevant to this driver */ | ||
| 254 | u16 flags; | ||
| 255 | #define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ | ||
| 256 | |||
| 248 | /* Setup mode and clock, etc (spi driver may call many times). | 257 | /* Setup mode and clock, etc (spi driver may call many times). |
| 249 | * | 258 | * |
| 250 | * IMPORTANT: this may be called when transfers to another | 259 | * IMPORTANT: this may be called when transfers to another |
| @@ -523,30 +532,7 @@ static inline void spi_message_free(struct spi_message *m) | |||
| 523 | kfree(m); | 532 | kfree(m); |
| 524 | } | 533 | } |
| 525 | 534 | ||
| 526 | /** | 535 | extern int spi_setup(struct spi_device *spi); |
| 527 | * spi_setup - setup SPI mode and clock rate | ||
| 528 | * @spi: the device whose settings are being modified | ||
| 529 | * Context: can sleep, and no requests are queued to the device | ||
| 530 | * | ||
| 531 | * SPI protocol drivers may need to update the transfer mode if the | ||
| 532 | * device doesn't work with its default. They may likewise need | ||
| 533 | * to update clock rates or word sizes from initial values. This function | ||
| 534 | * changes those settings, and must be called from a context that can sleep. | ||
| 535 | * Except for SPI_CS_HIGH, which takes effect immediately, the changes take | ||
| 536 | * effect the next time the device is selected and data is transferred to | ||
| 537 | * or from it. When this function returns, the spi device is deselected. | ||
| 538 | * | ||
| 539 | * Note that this call will fail if the protocol driver specifies an option | ||
| 540 | * that the underlying controller or its driver does not support. For | ||
| 541 | * example, not all hardware supports wire transfers using nine bit words, | ||
| 542 | * LSB-first wire encoding, or active-high chipselects. | ||
| 543 | */ | ||
| 544 | static inline int | ||
| 545 | spi_setup(struct spi_device *spi) | ||
| 546 | { | ||
| 547 | return spi->master->setup(spi); | ||
| 548 | } | ||
| 549 | |||
| 550 | 536 | ||
| 551 | /** | 537 | /** |
| 552 | * spi_async - asynchronous SPI transfer | 538 | * spi_async - asynchronous SPI transfer |
