spi: core,atmel: convert word_delay_usecs
-> word_delay
for spi_device
This change does a conversion from the `word_delay_usecs` -> `word_delay` for the `spi_device` struct. This allows users to specify inter-word delays in other unit types (nano-seconds or clock cycles), depending on how users want. The Atmel SPI driver is the only current user of the `word_delay_usecs` field (from the `spi_device` struct). So, it needed a slight conversion to use the `word_delay` as an `spi_delay` struct. In SPI core, the only required mechanism is to update the `word_delay` information per `spi_transfer`. This requires a bit more logic than before, because it needs that both delays be converted to a common unit (nano-seconds) for comparison. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20190926105147.7839-8-alexandru.ardelean@analog.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:

committed by
Mark Brown

parent
ec3fa72fa8
commit
6c613f68aa
@@ -139,7 +139,7 @@ extern int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer);
|
||||
* 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
|
||||
* @word_delay: delay to be inserted between consecutive
|
||||
* words of a transfer
|
||||
*
|
||||
* @statistics: statistics for the spi_device
|
||||
@@ -189,7 +189,7 @@ struct spi_device {
|
||||
const char *driver_override;
|
||||
int cs_gpio; /* LEGACY: chip select gpio */
|
||||
struct gpio_desc *cs_gpiod; /* chip select gpio desc */
|
||||
uint8_t word_delay_usecs; /* inter-word delay */
|
||||
struct spi_delay word_delay; /* inter-word delay */
|
||||
|
||||
/* the statistics */
|
||||
struct spi_statistics statistics;
|
||||
@@ -781,8 +781,6 @@ 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: inter word delay to be introduced after each word size
|
||||
* (set by bits_per_word) transmission.
|
||||
* @effective_speed_hz: the effective SCK-speed that was used to
|
||||
@@ -897,7 +895,6 @@ 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;
|
||||
struct spi_delay cs_change_delay;
|
||||
struct spi_delay word_delay;
|
||||
|
Reference in New Issue
Block a user