Commit d6a711a8 authored by Patrice Chotard's avatar Patrice Chotard Committed by Mark Brown

spi: Fix OCTAL mode support

Add OCTAL mode support.
Issue detected using "--octal" spidev_test's option.
Signed-off-by: default avatarPatrice Chotard <patrice.chotard@foss.st.com>
Link: https://msgid.link/r/20240618132951.2743935-4-patrice.chotard@foss.st.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 63deee52
...@@ -4156,7 +4156,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) ...@@ -4156,7 +4156,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
return -EINVAL; return -EINVAL;
if (xfer->tx_nbits != SPI_NBITS_SINGLE && if (xfer->tx_nbits != SPI_NBITS_SINGLE &&
xfer->tx_nbits != SPI_NBITS_DUAL && xfer->tx_nbits != SPI_NBITS_DUAL &&
xfer->tx_nbits != SPI_NBITS_QUAD) xfer->tx_nbits != SPI_NBITS_QUAD &&
xfer->tx_nbits != SPI_NBITS_OCTAL)
return -EINVAL; return -EINVAL;
if ((xfer->tx_nbits == SPI_NBITS_DUAL) && if ((xfer->tx_nbits == SPI_NBITS_DUAL) &&
!(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD))) !(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD)))
...@@ -4171,7 +4172,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) ...@@ -4171,7 +4172,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
return -EINVAL; return -EINVAL;
if (xfer->rx_nbits != SPI_NBITS_SINGLE && if (xfer->rx_nbits != SPI_NBITS_SINGLE &&
xfer->rx_nbits != SPI_NBITS_DUAL && xfer->rx_nbits != SPI_NBITS_DUAL &&
xfer->rx_nbits != SPI_NBITS_QUAD) xfer->rx_nbits != SPI_NBITS_QUAD &&
xfer->rx_nbits != SPI_NBITS_OCTAL)
return -EINVAL; return -EINVAL;
if ((xfer->rx_nbits == SPI_NBITS_DUAL) && if ((xfer->rx_nbits == SPI_NBITS_DUAL) &&
!(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD))) !(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD)))
......
...@@ -1085,12 +1085,13 @@ struct spi_transfer { ...@@ -1085,12 +1085,13 @@ struct spi_transfer {
unsigned dummy_data:1; unsigned dummy_data:1;
unsigned cs_off:1; unsigned cs_off:1;
unsigned cs_change:1; unsigned cs_change:1;
unsigned tx_nbits:3; unsigned tx_nbits:4;
unsigned rx_nbits:3; unsigned rx_nbits:4;
unsigned timestamped:1; unsigned timestamped:1;
#define SPI_NBITS_SINGLE 0x01 /* 1-bit transfer */ #define SPI_NBITS_SINGLE 0x01 /* 1-bit transfer */
#define SPI_NBITS_DUAL 0x02 /* 2-bit transfer */ #define SPI_NBITS_DUAL 0x02 /* 2-bit transfer */
#define SPI_NBITS_QUAD 0x04 /* 4-bit transfer */ #define SPI_NBITS_QUAD 0x04 /* 4-bit transfer */
#define SPI_NBITS_OCTAL 0x08 /* 8-bit transfer */
u8 bits_per_word; u8 bits_per_word;
struct spi_delay delay; struct spi_delay delay;
struct spi_delay cs_change_delay; struct spi_delay cs_change_delay;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment