u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Dhruva Gole <d-gole@ti.com>
To: Tom Rini <trini@konsulko.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>,
	Nishanth Menon <nm@ti.com>, Dhruva Gole <d-gole@ti.com>,
	Vignesh Raghavendra <vigneshr@ti.com>, <u-boot@lists.denx.de>,
	Pratyush Yadav <pratyush@kernel.org>
Subject: [PATCH v2] spi: spi-mem: ease checks in dtr_supports_op()
Date: Tue, 25 Oct 2022 11:50:36 +0530	[thread overview]
Message-ID: <20221025062036.383460-1-d-gole@ti.com> (raw)

Remove the extra conditions that cause some cases to fail prematurely
like if the data number of bytes is odd. The controller can handle odd
number of bytes data read in DTR Mode. Don't fail supports op for this
condition. This change can also be justified by taking a look at the
equivalent code in the linux kernel (v6.0.3), in drivers/spi/spi-mem.c,
where such an even number of data bytes check is absent as well.
The presence of this even byte check causes supports op failure even if
the controller can indeed work in case of odd bytes data reads in
DTR (Dual Transfer Rate) mode in xSPI.
There have not been any sort of major bugs in the absence of this
particular supports_op check, so it is safe to discard this
check from here.

Signed-off-by: Dhruva Gole <d-gole@ti.com>
---
v1 of the patch had a relatively shorter commit body that did not
sufficiently describe and justify this patch. link to v1:
https://lore.kernel.org/u-boot/20221020083424.86848-1-d-gole@ti.com/

v2 has just updated the commit body while preserving the code changes from
earlier v1 patch. This tries to address the changes requested from Jagan Teki.

 drivers/spi/spi-mem.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 8e8995fc537f..eecc13bec90d 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -181,10 +181,6 @@ bool spi_mem_dtr_supports_op(struct spi_slave *slave,
 	if (op->dummy.nbytes && op->dummy.buswidth == 8 && op->dummy.nbytes % 2)
 		return false;
 
-	if (op->data.dir != SPI_MEM_NO_DATA &&
-	    op->dummy.buswidth == 8 && op->data.nbytes % 2)
-		return false;
-
 	return spi_mem_check_buswidth(slave, op);
 }
 EXPORT_SYMBOL_GPL(spi_mem_dtr_supports_op);
-- 
2.25.1


             reply	other threads:[~2022-10-25  6:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25  6:20 Dhruva Gole [this message]
2022-10-27 15:09 ` [PATCH v2] spi: spi-mem: ease checks in dtr_supports_op() Dhruva Gole
2022-11-06 22:46 ` Pratyush Yadav
2022-11-07 13:16   ` Gole, Dhruva
2022-11-11 19:42     ` Pratyush Yadav

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=20221025062036.383460-1-d-gole@ti.com \
    --to=d-gole@ti.com \
    --cc=jagan@amarulasolutions.com \
    --cc=nm@ti.com \
    --cc=pratyush@kernel.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /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;
as well as URLs for NNTP newsgroup(s).