| @@ -12,6 +12,7 @@ · 11 unmodified lines |
| 12 | 12 | #include <linux/kthread.h> |
| 13 | 13 | #include <linux/completion.h> |
| 14 | 14 | #include <linux/scatterlist.h> |
| 15 | +#include <linux/gpio/consumer.h> |
| 15 | 16 | |
| 16 | 17 | struct dma_chan; |
| 17 | 18 | struct property_entry; |
| @@ -116,8 +117,13 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats, · 98 unmodified lines |
| 116 | 117 | * @modalias: Name of the driver to use with this device, or an alias |
| 117 | 118 | * for that name. This appears in the sysfs "modalias" attribute |
| 118 | 119 | * for driver coldplugging, and in uevents used for hotplugging |
| 119 | | − * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when |
| 120 | + * @cs_gpio: LEGACY: gpio number of the chipselect line (optional, -ENOENT when |
| 121 | + * not using a GPIO line) use cs_gpiod in new drivers by opting in on |
| 122 | + * the spi_master. |
| 123 | + * @cs_gpiod: gpio descriptor of the chipselect line (optional, NULL when |
| 120 | 124 | * not using a GPIO line) |
| 125 | + * @word_delay_usecs: microsecond delay to be inserted between consecutive |
| 126 | + * words of a transfer |
| 121 | 127 | * |
| 122 | 128 | * @statistics: statistics for the spi_device |
| 123 | 129 | * |
| @@ -163,7 +169,9 @@ struct spi_device { · 39 unmodified lines |
| 163 | 169 | void *controller_data; |
| 164 | 170 | char modalias[SPI_NAME_SIZE]; |
| 165 | 171 | const char *driver_override; |
| 166 | | − int cs_gpio; /* chip select gpio */ |
| 172 | + int cs_gpio; /* LEGACY: chip select gpio */ |
| 173 | + struct gpio_desc *cs_gpiod; /* chip select gpio desc */ |
| 174 | + uint8_t word_delay_usecs; /* inter-word delay */ |
| 167 | 175 | |
| 168 | 176 | /* the statistics */ |
| 169 | 177 | struct spi_statistics statistics; |
| @@ -376,9 +384,17 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 206 unmodified lines |
| 376 | 384 | * controller has native support for memory like operations. |
| 377 | 385 | * @unprepare_message: undo any work done by prepare_message(). |
| 378 | 386 | * @slave_abort: abort the ongoing transfer request on an SPI slave controller |
| 379 | | − * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS |
| 380 | | − * number. Any individual value may be -ENOENT for CS lines that |
| 387 | + * @cs_gpios: LEGACY: array of GPIO descs to use as chip select lines; one per |
| 388 | + * CS number. Any individual value may be -ENOENT for CS lines that |
| 389 | + * are not GPIOs (driven by the SPI controller itself). Use the cs_gpiods |
| 390 | + * in new drivers. |
| 391 | + * @cs_gpiods: Array of GPIO descs to use as chip select lines; one per CS |
| 392 | + * number. Any individual value may be NULL for CS lines that |
| 381 | 393 | * are not GPIOs (driven by the SPI controller itself). |
| 394 | + * @use_gpio_descriptors: Turns on the code in the SPI core to parse and grab |
| 395 | + * GPIO descriptors rather than using global GPIO numbers grabbed by the |
| 396 | + * driver. This will fill in @cs_gpiods and @cs_gpios should not be used, |
| 397 | + * and SPI devices will have the cs_gpiod assigned rather than cs_gpio. |
| 382 | 398 | * @statistics: statistics for the spi_controller |
| 383 | 399 | * @dma_tx: DMA transmit channel |
| 384 | 400 | * @dma_rx: DMA receive channel |
| @@ -557,6 +573,8 @@ struct spi_controller { · 172 unmodified lines |
| 557 | 573 | |
| 558 | 574 | /* gpio chip select */ |
| 559 | 575 | int *cs_gpios; |
| 576 | + struct gpio_desc **cs_gpiods; |
| 577 | + bool use_gpio_descriptors; |
| 560 | 578 | |
| 561 | 579 | /* statistics */ |
| 562 | 580 | struct spi_statistics statistics; |
| @@ -706,6 +724,8 @@ extern void spi_res_release(struct spi_controller *ctlr, · 143 unmodified lines |
| 706 | 724 | * @delay_usecs: microseconds to delay after this transfer before |
| 707 | 725 | * (optionally) changing the chipselect status, then starting |
| 708 | 726 | * the next transfer or completing this @spi_message. |
| 727 | + * @word_delay_usecs: microseconds to inter word delay after each word size |
| 728 | + * (set by bits_per_word) transmission. |
| 709 | 729 | * @word_delay: clock cycles to inter word delay after each word size |
| 710 | 730 | * (set by bits_per_word) transmission. |
| 711 | 731 | * @transfer_list: transfers are sequenced through @spi_message.transfers |
| @@ -788,6 +808,7 @@ struct spi_transfer { · 76 unmodified lines |
| 788 | 808 | #define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ |
| 789 | 809 | #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ |
| 790 | 810 | u8 bits_per_word; |
| 811 | + u8 word_delay_usecs; |
| 791 | 812 | u16 delay_usecs; |
| 792 | 813 | u32 speed_hz; |
| 793 | 814 | u16 word_delay; |