mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
To: Mark Brown <broonie@kernel.org>
Cc: <linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<git@amd.com>, <saikrishna12468@gmail.com>,
	Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Subject: [PATCH 1/2] spi: cadence-quadspi: Update the read timeout based on the length
Date: Mon, 20 Mar 2023 15:29:30 +0530	[thread overview]
Message-ID: <20230320095931.2651714-2-sai.krishna.potthuri@amd.com> (raw)
In-Reply-To: <20230320095931.2651714-1-sai.krishna.potthuri@amd.com>

When performing indirect read via external DMA the timeout for
completion is set equal to the read length instead of fixed timeout value.
For reads larger than 500 bytes, the timeout will continue to be
equal to the read length whereas for a small read like the Read Status
Register command, the timeout would be 1 or 2 milliseconds. This is not
enough to cover the overhead needed in setting up DMA, in that case make
sure the timeout is at least 500ms to allow DMA to finish. This solution
is inline with the timeout used for Direct read via DMA.

Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
---
 drivers/spi/spi-cadence-quadspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index 79ab7e309644..e281732aba91 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -863,7 +863,7 @@ static int cqspi_versal_indirect_read_dma(struct cqspi_flash_pdata *f_pdata,
 	reinit_completion(&cqspi->transfer_complete);
 
 	if (!wait_for_completion_timeout(&cqspi->transfer_complete,
-					 msecs_to_jiffies(CQSPI_READ_TIMEOUT_MS))) {
+					 msecs_to_jiffies(max_t(size_t, bytes_to_dma, 500)))) {
 		ret = -ETIMEDOUT;
 		goto failrd;
 	}
-- 
2.25.1


  reply	other threads:[~2023-03-20 10:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20  9:59 [PATCH 0/2] spi: cadence-quadspi: Fix random issues with Xilinx Versal DMA read Sai Krishna Potthuri
2023-03-20  9:59 ` Sai Krishna Potthuri [this message]
2023-03-20  9:59 ` [PATCH 2/2] spi: cadence-quadspi: Disable the SPI before reconfiguring Sai Krishna Potthuri
2023-04-14  6:05 ` [PATCH 0/2] spi: cadence-quadspi: Fix random issues with Xilinx Versal DMA read Potthuri, Sai Krishna
2023-04-17 12:50   ` Mark Brown
2023-04-17 19:28 ` 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=20230320095931.2651714-2-sai.krishna.potthuri@amd.com \
    --to=sai.krishna.potthuri@amd.com \
    --cc=broonie@kernel.org \
    --cc=git@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=saikrishna12468@gmail.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

all inboxes | Powered by JetHome®