Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: onenand: samsung: report DMA completion timeouts
@ 2026-06-23  6:12 Pengpeng Hou
  2026-06-29 15:00 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-23  6:12 UTC (permalink / raw)
  To: Kyungmin Park, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-mtd, linux-kernel
  Cc: Pengpeng Hou

The S5PC110 OneNAND DMA helpers have bounded waits for transfer
completion. The polling helper falls out of its timeout loop and returns
success, and the IRQ helper ignores wait_for_completion_timeout().

Return -ETIMEDOUT when the DMA transfer-done bit or completion does not
arrive before the timeout so callers can treat the buffer transfer as
failed.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/mtd/nand/onenand/onenand_samsung.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/onenand/onenand_samsung.c b/drivers/mtd/nand/onenand/onenand_samsung.c
index 6d6aa709a21f..b7b7758ce4d8 100644
--- a/drivers/mtd/nand/onenand/onenand_samsung.c
+++ b/drivers/mtd/nand/onenand/onenand_samsung.c
@@ -554,6 +554,9 @@ static int s5pc110_dma_poll(dma_addr_t dst, dma_addr_t src, size_t count, int di
 	} while (!(status & S5PC110_DMA_TRANS_STATUS_TD) &&
 		time_before(jiffies, timeout));
 
+	if (!(status & S5PC110_DMA_TRANS_STATUS_TD))
+		return -ETIMEDOUT;
+
 	writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD);
 
 	return 0;
@@ -608,7 +611,9 @@ static int s5pc110_dma_irq(dma_addr_t dst, dma_addr_t src, size_t count, int dir
 
 	writel(S5PC110_DMA_TRANS_CMD_TR, base + S5PC110_DMA_TRANS_CMD);
 
-	wait_for_completion_timeout(&onenand->complete, msecs_to_jiffies(20));
+	if (!wait_for_completion_timeout(&onenand->complete,
+					 msecs_to_jiffies(20)))
+		return -ETIMEDOUT;
 
 	return 0;
 }
-- 
2.50.1 (Apple Git-155)


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: onenand: samsung: report DMA completion timeouts
  2026-06-23  6:12 [PATCH] mtd: onenand: samsung: report DMA completion timeouts Pengpeng Hou
@ 2026-06-29 15:00 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2026-06-29 15:00 UTC (permalink / raw)
  To: Pengpeng Hou
  Cc: Kyungmin Park, Richard Weinberger, Vignesh Raghavendra, linux-mtd,
	linux-kernel

Hi Pengpeng,

On 23/06/2026 at 14:12:33 +08, Pengpeng Hou <pengpeng@iscas.ac.cn> wrote:

> The S5PC110 OneNAND DMA helpers have bounded waits for transfer
> completion. The polling helper falls out of its timeout loop and returns
> success, and the IRQ helper ignores wait_for_completion_timeout().
>
> Return -ETIMEDOUT when the DMA transfer-done bit or completion does not
> arrive before the timeout so callers can treat the buffer transfer as
> failed.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>

There is a list a commits for which you forgot to Cc: stable and more
importantly set a Fixes tag. Please add the missing tags and send a v2
for the following commits:

[PATCH] mtd: rawnand: lpc32xx_mlc: fail DMA transfers on timeout
[PATCH] mtd: rawnand: lpc32xx_slc: fail DMA transfer on completion timeout
[PATCH] mtd: mchp23k256: Use SPI match data for chip caps
[PATCH] mtd: rawnand: fsl_ifc: return errors for failed page reads
[PATCH] mtd: onenand: samsung: report DMA completion timeouts

Thank you,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-29 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23  6:12 [PATCH] mtd: onenand: samsung: report DMA completion timeouts Pengpeng Hou
2026-06-29 15:00 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox