Skip to content

Commit d6a711a

Browse files
Patrice Chotardbroonie
authored andcommitted
spi: Fix OCTAL mode support
Add OCTAL mode support. Issue detected using "--octal" spidev_test's option. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Link: https://msgid.link/r/20240618132951.2743935-4-patrice.chotard@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 63deee5 commit d6a711a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

drivers/spi/spi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4156,7 +4156,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
41564156
return -EINVAL;
41574157
if (xfer->tx_nbits != SPI_NBITS_SINGLE &&
41584158
xfer->tx_nbits != SPI_NBITS_DUAL &&
4159-
xfer->tx_nbits != SPI_NBITS_QUAD)
4159+
xfer->tx_nbits != SPI_NBITS_QUAD &&
4160+
xfer->tx_nbits != SPI_NBITS_OCTAL)
41604161
return -EINVAL;
41614162
if ((xfer->tx_nbits == SPI_NBITS_DUAL) &&
41624163
!(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD)))
@@ -4171,7 +4172,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
41714172
return -EINVAL;
41724173
if (xfer->rx_nbits != SPI_NBITS_SINGLE &&
41734174
xfer->rx_nbits != SPI_NBITS_DUAL &&
4174-
xfer->rx_nbits != SPI_NBITS_QUAD)
4175+
xfer->rx_nbits != SPI_NBITS_QUAD &&
4176+
xfer->rx_nbits != SPI_NBITS_OCTAL)
41754177
return -EINVAL;
41764178
if ((xfer->rx_nbits == SPI_NBITS_DUAL) &&
41774179
!(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD)))

include/linux/spi/spi.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,12 +1085,13 @@ struct spi_transfer {
10851085
unsigned dummy_data:1;
10861086
unsigned cs_off:1;
10871087
unsigned cs_change:1;
1088-
unsigned tx_nbits:3;
1089-
unsigned rx_nbits:3;
1088+
unsigned tx_nbits:4;
1089+
unsigned rx_nbits:4;
10901090
unsigned timestamped:1;
10911091
#define SPI_NBITS_SINGLE 0x01 /* 1-bit transfer */
10921092
#define SPI_NBITS_DUAL 0x02 /* 2-bit transfer */
10931093
#define SPI_NBITS_QUAD 0x04 /* 4-bit transfer */
1094+
#define SPI_NBITS_OCTAL 0x08 /* 8-bit transfer */
10941095
u8 bits_per_word;
10951096
struct spi_delay delay;
10961097
struct spi_delay cs_change_delay;

0 commit comments

Comments
 (0)