diff options
Diffstat (limited to 'include/linux/spi/spi.h')
| -rw-r--r-- | include/linux/spi/spi.h | 29 | 
1 files changed, 25 insertions, 4 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 314d922ca607..662b336aa2e4 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -12,6 +12,7 @@  #include <linux/kthread.h>  #include <linux/completion.h>  #include <linux/scatterlist.h> +#include <linux/gpio/consumer.h>  struct dma_chan;  struct property_entry; @@ -116,8 +117,13 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats,   * @modalias: Name of the driver to use with this device, or an alias   *	for that name.  This appears in the sysfs "modalias" attribute   *	for driver coldplugging, and in uevents used for hotplugging - * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when + * @cs_gpio: LEGACY: gpio number of the chipselect line (optional, -ENOENT when + *	not using a GPIO line) use cs_gpiod in new drivers by opting in on + *	the spi_master. + * @cs_gpiod: gpio descriptor of the chipselect line (optional, NULL when   *	not using a GPIO line) + * @word_delay_usecs: microsecond delay to be inserted between consecutive + *	words of a transfer   *   * @statistics: statistics for the spi_device   * @@ -163,7 +169,9 @@ struct spi_device {  	void			*controller_data;  	char			modalias[SPI_NAME_SIZE];  	const char		*driver_override; -	int			cs_gpio;	/* chip select gpio */ +	int			cs_gpio;	/* LEGACY: chip select gpio */ +	struct gpio_desc	*cs_gpiod;	/* chip select gpio desc */ +	uint8_t			word_delay_usecs; /* inter-word delay */  	/* the statistics */  	struct spi_statistics	statistics; @@ -376,9 +384,17 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)   *	     controller has native support for memory like operations.   * @unprepare_message: undo any work done by prepare_message().   * @slave_abort: abort the ongoing transfer request on an SPI slave controller - * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS - *	number. Any individual value may be -ENOENT for CS lines that + * @cs_gpios: LEGACY: array of GPIO descs to use as chip select lines; one per + *	CS number. Any individual value may be -ENOENT for CS lines that + *	are not GPIOs (driven by the SPI controller itself). Use the cs_gpiods + *	in new drivers. + * @cs_gpiods: Array of GPIO descs to use as chip select lines; one per CS + *	number. Any individual value may be NULL for CS lines that   *	are not GPIOs (driven by the SPI controller itself). + * @use_gpio_descriptors: Turns on the code in the SPI core to parse and grab + *	GPIO descriptors rather than using global GPIO numbers grabbed by the + *	driver. This will fill in @cs_gpiods and @cs_gpios should not be used, + *	and SPI devices will have the cs_gpiod assigned rather than cs_gpio.   * @statistics: statistics for the spi_controller   * @dma_tx: DMA transmit channel   * @dma_rx: DMA receive channel @@ -557,6 +573,8 @@ struct spi_controller {  	/* gpio chip select */  	int			*cs_gpios; +	struct gpio_desc	**cs_gpiods; +	bool			use_gpio_descriptors;  	/* statistics */  	struct spi_statistics	statistics; @@ -706,6 +724,8 @@ extern void spi_res_release(struct spi_controller *ctlr,   * @delay_usecs: microseconds to delay after this transfer before   *	(optionally) changing the chipselect status, then starting   *	the next transfer or completing this @spi_message. + * @word_delay_usecs: microseconds to inter word delay after each word size + *	(set by bits_per_word) transmission.   * @word_delay: clock cycles to inter word delay after each word size   *	(set by bits_per_word) transmission.   * @transfer_list: transfers are sequenced through @spi_message.transfers @@ -788,6 +808,7 @@ struct spi_transfer {  #define	SPI_NBITS_DUAL		0x02 /* 2bits transfer */  #define	SPI_NBITS_QUAD		0x04 /* 4bits transfer */  	u8		bits_per_word; +	u8		word_delay_usecs;  	u16		delay_usecs;  	u32		speed_hz;  	u16		word_delay;  |