Skip to content

Commit 6935224

Browse files
msperlbroonie
authored andcommitted
spi: bcm2835: enable support of 3-wire mode
Signed-off-by: Martin Sperl <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 210b492 commit 6935224

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/spi/spi-bcm2835.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
#define BCM2835_SPI_CS_CS_01 0x00000001
6868

6969
#define BCM2835_SPI_TIMEOUT_MS 30000
70-
#define BCM2835_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_NO_CS)
70+
#define BCM2835_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \
71+
| SPI_NO_CS | SPI_3WIRE)
7172

7273
#define DRV_NAME "spi-bcm2835"
7374

@@ -163,6 +164,9 @@ static int bcm2835_spi_start_transfer(struct spi_device *spi,
163164
cdiv = 0; /* 0 is the slowest we can go */
164165
}
165166

167+
if ((spi->mode & SPI_3WIRE) && (tfr->rx_buf))
168+
cs |= BCM2835_SPI_CS_REN;
169+
166170
if (spi->mode & SPI_CPOL)
167171
cs |= BCM2835_SPI_CS_CPOL;
168172
if (spi->mode & SPI_CPHA)

0 commit comments

Comments
 (0)