diff options
| -rw-r--r-- | include/linux/spi/spi.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index cce80e6dc7d1..3eebc6c235fb 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -425,6 +425,12 @@ struct spi_master { | |||
| 425 | #define SPI_MASTER_MUST_RX BIT(3) /* requires rx */ | 425 | #define SPI_MASTER_MUST_RX BIT(3) /* requires rx */ |
| 426 | #define SPI_MASTER_MUST_TX BIT(4) /* requires tx */ | 426 | #define SPI_MASTER_MUST_TX BIT(4) /* requires tx */ |
| 427 | 427 | ||
| 428 | /* | ||
| 429 | * on some hardware transfer size may be constrained | ||
| 430 | * the limit may depend on device transfer settings | ||
| 431 | */ | ||
| 432 | size_t (*max_transfer_size)(struct spi_device *spi); | ||
| 433 | |||
| 428 | /* lock and mutex for SPI bus locking */ | 434 | /* lock and mutex for SPI bus locking */ |
| 429 | spinlock_t bus_lock_spinlock; | 435 | spinlock_t bus_lock_spinlock; |
| 430 | struct mutex bus_lock_mutex; | 436 | struct mutex bus_lock_mutex; |
| @@ -832,6 +838,15 @@ extern int spi_async(struct spi_device *spi, struct spi_message *message); | |||
| 832 | extern int spi_async_locked(struct spi_device *spi, | 838 | extern int spi_async_locked(struct spi_device *spi, |
| 833 | struct spi_message *message); | 839 | struct spi_message *message); |
| 834 | 840 | ||
| 841 | static inline size_t | ||
| 842 | spi_max_transfer_size(struct spi_device *spi) | ||
| 843 | { | ||
| 844 | struct spi_master *master = spi->master; | ||
| 845 | if (!master->max_transfer_size) | ||
| 846 | return SIZE_MAX; | ||
| 847 | return master->max_transfer_size(spi); | ||
| 848 | } | ||
| 849 | |||
| 835 | /*---------------------------------------------------------------------------*/ | 850 | /*---------------------------------------------------------------------------*/ |
| 836 | 851 | ||
| 837 | /* All these synchronous SPI transfer routines are utilities layered | 852 | /* All these synchronous SPI transfer routines are utilities layered |
