* [PATCH] mtd: rawnand: brcmnand: skip DMA during panic write
@ 2026-03-05 20:21 Kamal Dasu
2026-03-05 23:12 ` Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kamal Dasu @ 2026-03-05 20:21 UTC (permalink / raw)
To: computersforpeace, miquel.raynal, richard, vigneshr
Cc: florian.fainelli, william.zhang, bcm-kernel-feedback-list,
linux-mtd, linux-kernel, Kamal Dasu
When oops_panic_write is set, the driver disables interrupts and
switches to PIO polling mode but still falls through into the DMA
path. DMA cannot be used reliably in panic context, so make the
DMA path an else branch to ensure only PIO is used during panic
writes.
Fixes: c1ac2dc34b51 ("mtd: rawnand: brcmnand: When oops in progress use pio and interrupt polling")
Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com>
---
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 0427d76f45d0..5b9dadd5405e 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -2350,14 +2350,12 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip,
for (i = 0; i < ctrl->max_oob; i += 4)
oob_reg_write(ctrl, i, 0xffffffff);
- if (mtd->oops_panic_write)
+ if (mtd->oops_panic_write) {
/* switch to interrupt polling and PIO mode */
disable_ctrl_irqs(ctrl);
-
- if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
+ } else if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
if (ctrl->dma_trans(host, addr, (u32 *)buf, oob, mtd->writesize,
CMD_PROGRAM_PAGE))
-
ret = -EIO;
goto out;
--
2.34.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] mtd: rawnand: brcmnand: skip DMA during panic write
2026-03-05 20:21 [PATCH] mtd: rawnand: brcmnand: skip DMA during panic write Kamal Dasu
@ 2026-03-05 23:12 ` Florian Fainelli
2026-03-06 2:50 ` William Zhang
2026-03-11 15:33 ` Miquel Raynal
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2026-03-05 23:12 UTC (permalink / raw)
To: Kamal Dasu, computersforpeace, miquel.raynal, richard, vigneshr
Cc: florian.fainelli, william.zhang, bcm-kernel-feedback-list,
linux-mtd, linux-kernel
On 3/5/26 12:21, Kamal Dasu wrote:
> When oops_panic_write is set, the driver disables interrupts and
> switches to PIO polling mode but still falls through into the DMA
> path. DMA cannot be used reliably in panic context, so make the
> DMA path an else branch to ensure only PIO is used during panic
> writes.
>
> Fixes: c1ac2dc34b51 ("mtd: rawnand: brcmnand: When oops in progress use pio and interrupt polling")
> Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mtd: rawnand: brcmnand: skip DMA during panic write
2026-03-05 20:21 [PATCH] mtd: rawnand: brcmnand: skip DMA during panic write Kamal Dasu
2026-03-05 23:12 ` Florian Fainelli
@ 2026-03-06 2:50 ` William Zhang
2026-03-11 15:33 ` Miquel Raynal
2 siblings, 0 replies; 4+ messages in thread
From: William Zhang @ 2026-03-06 2:50 UTC (permalink / raw)
To: Kamal Dasu
Cc: computersforpeace, miquel.raynal, richard, vigneshr,
florian.fainelli, bcm-kernel-feedback-list, linux-mtd,
linux-kernel
On Thu, Mar 5, 2026 at 12:23 PM Kamal Dasu <kamal.dasu@broadcom.com> wrote:
>
> When oops_panic_write is set, the driver disables interrupts and
> switches to PIO polling mode but still falls through into the DMA
> path. DMA cannot be used reliably in panic context, so make the
> DMA path an else branch to ensure only PIO is used during panic
> writes.
>
> Fixes: c1ac2dc34b51 ("mtd: rawnand: brcmnand: When oops in progress use pio and interrupt polling")
> Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com>
> ---
> drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> index 0427d76f45d0..5b9dadd5405e 100644
> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> @@ -2350,14 +2350,12 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip,
> for (i = 0; i < ctrl->max_oob; i += 4)
> oob_reg_write(ctrl, i, 0xffffffff);
>
> - if (mtd->oops_panic_write)
> + if (mtd->oops_panic_write) {
> /* switch to interrupt polling and PIO mode */
> disable_ctrl_irqs(ctrl);
> -
> - if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
> + } else if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
> if (ctrl->dma_trans(host, addr, (u32 *)buf, oob, mtd->writesize,
> CMD_PROGRAM_PAGE))
> -
> ret = -EIO;
>
> goto out;
> --
> 2.34.1
>
Reviewed-by: William Zhang <william.zhang@broadcom.com>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mtd: rawnand: brcmnand: skip DMA during panic write
2026-03-05 20:21 [PATCH] mtd: rawnand: brcmnand: skip DMA during panic write Kamal Dasu
2026-03-05 23:12 ` Florian Fainelli
2026-03-06 2:50 ` William Zhang
@ 2026-03-11 15:33 ` Miquel Raynal
2 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2026-03-11 15:33 UTC (permalink / raw)
To: computersforpeace, richard, vigneshr, Kamal Dasu
Cc: florian.fainelli, william.zhang, bcm-kernel-feedback-list,
linux-mtd, linux-kernel
On Thu, 05 Mar 2026 15:21:57 -0500, Kamal Dasu wrote:
> When oops_panic_write is set, the driver disables interrupts and
> switches to PIO polling mode but still falls through into the DMA
> path. DMA cannot be used reliably in panic context, so make the
> DMA path an else branch to ensure only PIO is used during panic
> writes.
>
>
> [...]
Applied to mtd/fixes, thanks!
[1/1] mtd: rawnand: brcmnand: skip DMA during panic write
commit: da9ba4dcc01e7cf52b7676f0ee9607b8358c2171
Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-11 15:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05 20:21 [PATCH] mtd: rawnand: brcmnand: skip DMA during panic write Kamal Dasu
2026-03-05 23:12 ` Florian Fainelli
2026-03-06 2:50 ` William Zhang
2026-03-11 15:33 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox