From: Antoni Pokusinski <apokusinski01@gmail.com>
To: broonie@kernel.org
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
Antoni Pokusinski <apokusinski01@gmail.com>
Subject: [PATCH] spi: omap2-mcspi: add support for 3-wire transfers
Date: Sat, 14 Feb 2026 22:28:00 +0100 [thread overview]
Message-ID: <20260214212800.262461-1-apokusinski01@gmail.com> (raw)
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>
---
drivers/spi/spi-omap2-mcspi.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 70bb74b3bd9c..bf4c3770bc7f 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -943,10 +943,16 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
l = mcspi_cached_chconf0(spi);
- /* standard 4-wire host mode: SCK, MOSI/out, MISO/in, nCS
- * REVISIT: this controller could support SPI_3WIRE mode.
- */
- if (mcspi->pin_dir == MCSPI_PINDIR_D0_IN_D1_OUT) {
+ if (spi->mode & SPI_3WIRE) {
+ if (t && !t->tx_buf) {
+ l &= ~OMAP2_MCSPI_CHCONF_IS;
+ l |= OMAP2_MCSPI_CHCONF_DPE0;
+ } else if (t && !t->rx_buf) {
+ l |= OMAP2_MCSPI_CHCONF_IS;
+ l &= ~OMAP2_MCSPI_CHCONF_DPE0;
+ }
+ l |= OMAP2_MCSPI_CHCONF_DPE1;
+ } else if (mcspi->pin_dir == MCSPI_PINDIR_D0_IN_D1_OUT) {
l &= ~OMAP2_MCSPI_CHCONF_IS;
l &= ~OMAP2_MCSPI_CHCONF_DPE1;
l |= OMAP2_MCSPI_CHCONF_DPE0;
@@ -1179,6 +1185,7 @@ static int omap2_mcspi_transfer_one(struct spi_controller *ctlr,
omap2_mcspi_set_cs(spi, spi->mode & SPI_CS_HIGH);
if (par_override ||
+ (spi->mode & SPI_3WIRE) ||
(t->speed_hz != spi->max_speed_hz) ||
(t->bits_per_word != spi->bits_per_word)) {
par_override = 1;
@@ -1486,7 +1493,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
return -ENOMEM;
/* the spi->mode bits understood by this driver: */
- ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
+ ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_3WIRE;
ctlr->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
ctlr->setup = omap2_mcspi_setup;
ctlr->auto_runtime_pm = true;
--
2.53.0
next reply other threads:[~2026-02-14 21:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-14 21:28 Antoni Pokusinski [this message]
2026-02-25 19:07 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260214212800.262461-1-apokusinski01@gmail.com \
--to=apokusinski01@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®