Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: omap2-mcspi: add support for 3-wire transfers

Update omap_mcspi_setup_transfer() so that the driver supports
communication over a single data line for 3-wire SPI devices.

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
Link: https://patch.msgid.link/20260214212800.262461-1-apokusinski01@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Antoni Pokusinski and committed by
Mark Brown
6f7e9b11 4d28f38f

+12 -5
+12 -5
drivers/spi/spi-omap2-mcspi.c
··· 942 942 943 943 l = mcspi_cached_chconf0(spi); 944 944 945 - /* standard 4-wire host mode: SCK, MOSI/out, MISO/in, nCS 946 - * REVISIT: this controller could support SPI_3WIRE mode. 947 - */ 948 - if (mcspi->pin_dir == MCSPI_PINDIR_D0_IN_D1_OUT) { 945 + if (spi->mode & SPI_3WIRE) { 946 + if (t && !t->tx_buf) { 947 + l &= ~OMAP2_MCSPI_CHCONF_IS; 948 + l |= OMAP2_MCSPI_CHCONF_DPE0; 949 + } else if (t && !t->rx_buf) { 950 + l |= OMAP2_MCSPI_CHCONF_IS; 951 + l &= ~OMAP2_MCSPI_CHCONF_DPE0; 952 + } 953 + l |= OMAP2_MCSPI_CHCONF_DPE1; 954 + } else if (mcspi->pin_dir == MCSPI_PINDIR_D0_IN_D1_OUT) { 949 955 l &= ~OMAP2_MCSPI_CHCONF_IS; 950 956 l &= ~OMAP2_MCSPI_CHCONF_DPE1; 951 957 l |= OMAP2_MCSPI_CHCONF_DPE0; ··· 1184 1178 omap2_mcspi_set_cs(spi, spi->mode & SPI_CS_HIGH); 1185 1179 1186 1180 if (par_override || 1181 + (spi->mode & SPI_3WIRE) || 1187 1182 (t->speed_hz != spi->max_speed_hz) || 1188 1183 (t->bits_per_word != spi->bits_per_word)) { 1189 1184 par_override = 1; ··· 1491 1484 return -ENOMEM; 1492 1485 1493 1486 /* the spi->mode bits understood by this driver: */ 1494 - ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; 1487 + ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_3WIRE; 1495 1488 ctlr->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); 1496 1489 ctlr->setup = omap2_mcspi_setup; 1497 1490 ctlr->auto_runtime_pm = true;