From: Ben Dooks <ben.dooks@codethink.co.uk>
To: linux-spi@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Alim Akhtar <alim.akhtar@samsung.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Andi Shyti <andi.shyti@kernel.org>,
Mark Brown <broonie@kernel.org>,
Ben Dooks <ben.dooks@codethink.co.uk>
Subject: [PATCH 2/2] spi: s3c64xx: update flush_fifo timeout code
Date: Tue, 24 Sep 2024 14:40:09 +0100 [thread overview]
Message-ID: <20240924134009.116247-3-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <20240924134009.116247-1-ben.dooks@codethink.co.uk>
The code that checks for loops in the s3c6xx_flush_fifo() checks
for loops being non-zero as a timeout, however the code /could/
finish with loops being zero and the fifo being flushed...
Also, it would be useful to know what is left in the fifo for this
error case, so update the checks to see what is left, and then also
print the number of entries.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
drivers/spi/spi-s3c64xx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 6ab416a33966..7b244e1fd58a 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -247,8 +247,8 @@ static void s3c64xx_flush_fifo(struct s3c64xx_spi_driver_data *sdd)
val = readl(regs + S3C64XX_SPI_STATUS);
} while (TX_FIFO_LVL(val, sdd) && --loops);
- if (loops == 0)
- dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n");
+ if (TX_FIFO_LVL(val, sdd))
+ dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO (%d left)\n", TX_FIFO_LVL(val, sdd));
/* Flush RxFIFO*/
loops = msecs_to_loops(1);
@@ -260,8 +260,8 @@ static void s3c64xx_flush_fifo(struct s3c64xx_spi_driver_data *sdd)
break;
} while (--loops);
- if (loops == 0)
- dev_warn(&sdd->pdev->dev, "Timed out flushing RX FIFO\n");
+ if (RX_FIFO_LVL(val, sdd))
+ dev_warn(&sdd->pdev->dev, "Timed out flushing RX FIFO (%d left)\n", RX_FIFO_LVL(val, sdd));
val = readl(regs + S3C64XX_SPI_CH_CFG);
val &= ~S3C64XX_SPI_CH_SW_RST;
--
2.37.2.352.g3c44437643
next prev parent reply other threads:[~2024-09-24 13:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 13:40 two (possibly bug) updates for spi-s3c644 Ben Dooks
2024-09-24 13:40 ` [PATCH 1/2] spi: s3c64xx: fix timeout counters in flush_fifo Ben Dooks
2024-09-30 17:45 ` Andi Shyti
2024-10-02 0:38 ` (subset) " Mark Brown
2024-10-02 6:07 ` Andi Shyti
2024-10-02 12:37 ` Mark Brown
2024-09-24 13:40 ` Ben Dooks [this message]
2024-09-30 22:51 ` [PATCH 2/2] spi: s3c64xx: update flush_fifo timeout code Andi Shyti
2024-10-01 7:01 ` Ben Dooks
2024-10-01 9:19 ` Andi Shyti
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=20240924134009.116247-3-ben.dooks@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=alim.akhtar@samsung.com \
--cc=andi.shyti@kernel.org \
--cc=broonie@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-samsung-soc@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;
as well as URLs for NNTP newsgroup(s).